1!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{};e.SENTRY_RELEASE={id:"stable-commerce-web@d14b09d"};var t=(new e.Error).stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="dc063bdc-345d-4f7a-a92e-baf71e1e054a",e._sentryDebugIdIdentifier="sentry-dbid-dc063bdc-345d-4f7a-a92e-baf71e1e054a")}catch(n){}}();import{ad as e,w as t,s as n,az as r,ay as a,r as i,bY as o,av as s,bZ as l,j as c,aU as u,b9 as d,al as f,bV as p,ax as h,aT as m,bs as y,bb as x,br as g,ab as v,bi as b,bj as j,bk as w,bl as N,a8 as S,b_ as O,b$ as k,aA as A,aY as P,af as E,I as _,c0 as C,F as M,d as T,K as D,c1 as I}from"./index-B-mMgbQT.js";import{t as R,c as L,e as B,a as z,d as $,b as F,g as U,m as q,h as W,i as H,f as V,s as K,j as X,D as G}from"./DateRangePicker-CfjANfBH.js";import{C as Y,b as J,c as Z,a as Q}from"./card-CXdQPa6X.js";import{S as ee,T as te,G as ne,R as re}from"./textarea-CIF7OB6M.js";import{p as ae,P as ie}from"./purify.es-B7pz6MQB.js";import{S as oe,C as se}from"./search-C16UtZjG.js";import{U as le}from"./user-CV_ltdNq.js";import{T as ce}from"./trash-2-BJSS6bjp.js";import{S as ue}from"./save-OCMPhkA-.js";import{P as de}from"./play-BTVUtkVt.js";import{P as fe}from"./pencil-DE_qnpnT.js";import{C as pe}from"./chevron-up-3rYXBrx8.js";import{U as he}from"./upload-DyGbPDpf.js";import"./calendar-CGoWLKrI.js"; 2/** 3 * @license lucide-react v0.462.0 - ISC 4 * 5 * This source code is licensed under the ISC license. 6 * See the LICENSE file in the root directory of this source tree. 7 */const me=e("Bot",[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]]),ye=e("Eraser",[["path",{d:"m7 21-4.3-4.3c-1-1-1-2.5 0-3.4l9.6-9.6c1-1 2.5-1 3.4 0l5.6 5.6c1 1 1 2.5 0 3.4L13 21",key:"182aya"}],["path",{d:"M22 21H7",key:"t4ddhn"}],["path",{d:"m5 11 9 9",key:"1mo9qw"}]]),xe=e("Image",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]),ge=e("LogIn",[["path",{d:"M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4",key:"u53s6r"}],["polyline",{points:"10 17 15 12 10 7",key:"1ail0h"}],["line",{x1:"15",x2:"3",y1:"12",y2:"12",key:"v6grx8"}]]),ve=e("MessageSquare",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}]]),be=e("PackageSearch",[["path",{d:"M21 10V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l2-1.14",key:"e7tb2h"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["line",{x1:"12",x2:"12",y1:"22",y2:"12",key:"a4e8g8"}],["circle",{cx:"18.5",cy:"15.5",r:"2.5",key:"b5zd12"}],["path",{d:"M20.27 17.27 22 19",key:"1l4muz"}]]),je=e("SkipForward",[["polygon",{points:"5 4 15 12 5 20 5 4",key:"16p6eg"}],["line",{x1:"19",x2:"19",y1:"5",y2:"19",key:"futhcm"}]]),we=e("TriangleAlert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]),Ne=e("Users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["path",{d:"M16 3.13a4 4 0 0 1 0 7.75",key:"1da9ce"}]]),Se=e("Wrench",[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z",key:"cbrjhi"}]]); 8/** 9 * @license lucide-react v0.462.0 - ISC 10 * 11 * This source code is licensed under the ISC license. 12 * See the LICENSE file in the root directory of this source tree. 13 */function Oe(e,t){const n=R(e),r=R(t),a=n.getTime()-r.getTime();return a<0?-1:a>0?1:a}function ke(e,t){const n=R(e),r=R(t),a=Oe(n,r),i=Math.abs($(n,r));let o;if(i<1)o=0;else{1===n.getMonth()&&n.getDate()>
1327&&n.setDate(30),n.setMonth(n.getMonth()-a*i);let t=Oe(n,r)===-a;(function(e){const t=R(e);return+B(t)===+z(t)})(R(e))&&1===i&&1===Oe(e,r)&&(t=!1),o=a*(i-Number(t))}return 0===o?0:o}function Ae(e,t,n){const r=function(e,t){return+R(e)-+R(t)}(e,t)/1e3;return(a=null==n?void 0:n.roundingMethod,e=>{const t=(a?Math[a]:Math.trunc)(e);return 0===t?0:t})(r);var a}function Pe(e,t){return function(e,t,n){const r=H(),a=(null==n?void 0:n.locale)??r.locale??F,i=Oe(e,t);if(isNaN(i))throw new RangeError("Invalid time value");const o=Object.assign({},n,{addSuffix:null==n?void 0:n.addSuffix,comparison:i});let s,l;i>0?(s=R(t),l=R(e)):(s=R(e),l=R(t));const c=Ae(l,s),u=(U(l)-U(s))/1e3,d=Math.round((c-u)/60);let f;if(d<2)return(null==n?void 0:n.includeSeconds)?c<5?a.formatDistance("lessThanXSeconds",5,o):c<10?a.formatDistance("lessThanXSeconds",10,o):c<20?a.formatDistance("lessThanXSeconds",20,o):c<40?a.formatDistance("halfAMinute",0,o):c<60?a.formatDistance("lessThanXMinutes",1,o):a.formatDistance("xMinutes",1,o):0===d?a.formatDistance("lessThanXMinutes",1,o):a.formatDistance("xMinutes",d,o);if(d<45)return a.formatDistance("xMinutes",d,o);if(d<90)return a.formatDistance("aboutXHours",1,o);if(d<q){const e=Math.round(d/60);return a.formatDistance("aboutXHours",e,o)}if(d<2520)return a.formatDistance("xDays",1,o);if(d<W){const e=Math.round(d/q);return a.formatDistance("xDays",e,o)}if(d<2*W)return f=Math.round(d/W),a.formatDistance("aboutXMonths",f,o);if(f=ke(l,s),f<12){const e=Math.round(d/W);return a.formatDistance("xMonths",e,o)}{const e=f%12,t=Math.trunc(f/12);return e<3?a.formatDistance("aboutXYears",t,o):e<9?a.formatDistance("overXYears",t,o):a.formatDistance("almostXYears",t+1,o)}}(e,function(e){return L(e,Date.now())}(e),t)}const Ee=`${t()}/api/admin-dashboard`;let _e=null;async function Ce(){if(_e)return{"X-Internal-Admin-Token":_e,"Content-Type":"application/json"};const{data:{session:e}}=await n.auth.getSession();if(!(null==e?void 0:e.access_token))throw new Error("Not authenticated");return{Authorization:`Bearer ${e.access_token}`,"Content-Type":"application/json"}}async function Me(e,t,n){const r=await Ce(),a=await fetch(`${Ee}${e}${function(e,t){return`?from=${e.toISOString()}&to=${t.toISOString()}`}(t,n)}`,{headers:r});if(!a.ok){const e=await a.json().catch(()=>({error:a.statusText}));throw new Error(e.error||`Request failed: ${a.status}`)}return a.json()}"undefined"!=typeof window&&window.addEventListener("message",e=>{if(!e.origin||e.origin===window.location.origin)return;const t=e.data;t&&"object"==typeof t&&"admin-token"===t.type&&"string"==typeof t.token&&(_e=t.token)});const Te=(e,t)=>
13Me("/stores",e,t),De=(e,t)=>Me("/meta/registration-reconciliation",e,t),Ie=(e,t)=>Me("/landing-analysis/campaigns",e,t);async function Re(e){const t=await Ce(),n=await fetch(`${Ee}${e}`,{headers:t});if(!n.ok){const e=await n.json().catch(()=>({error:n.statusText}));throw new Error(e.error||`Request failed: ${n.status}`)}return(await n.json()).data}async function Le(e,t){const n=await Ce(),r=await fetch(`${Ee}${e}`,{method:"POST",headers:n,body:JSON.stringify(t)});if(!r.ok){const e=await r.json().catch(()=>({error:r.statusText}));throw new Error(e.error||`Request failed: ${r.status}`)}return(await r.json()).data}async function Be(e,t){const n=await Ce(),r=await fetch(`${Ee}${e}`,{method:"PUT",headers:n,body:JSON.stringify(t)});if(!r.ok){const e=await r.json().catch(()=>({error:r.statusText}));throw new Error(e.error||`Request failed: ${r.status}`)}return(await r.json()).data}async function ze(e){const t=await Ce(),n=await fetch(`${Ee}${e}`,{method:"DELETE",headers:t});if(!n.ok){const e=await n.json().catch(()=>({error:n.statusText}));throw new Error(e.error||`Request failed: ${n.status}`)}}const $e=e=>`/challenge/enrollments/${e}`,Fe=(e,t)=>Le(`${$e(e)}/clear-context-channel`,{channel:t}),Ue=(e,t)=>Be(`/agent-tools/${e}`,t),qe=()=>Re("/prompt-fragments");async function We(e,t){const n=await Ce(),r=await fetch(`${Ee}/waitlist${e}`,{...t,headers:{...n,...(null==t?void 0:t.headers)||{}}});if(!r.ok){const e=await r.json().catch(()=>({error:r.statusText}));throw new Error(e.error||`Request failed: ${r.status}`)}return r.json()}const He=e=>{const t=new URLSearchParams;(null==e?void 0:e.status)&&t.set("status",e.status),(null==e?void 0:e.batchId)&&t.set("batch_id",e.batchId);return We(`/entries${t.toString()?`?${t}`:""}`).then(e=>e.entries)};async function Ve(e,t={}){const n=await Ce(),r=new URLSearchParams;t.limit&&r.set("limit",String(t.limit)),t.offset&&r.set("offset",String(t.offset)),t.storeId&&r.set("storeId",t.storeId),t.agentChannel&&r.set("agentChannel",t.agentChannel);const a=r.toString()?`?${r}`:"",i=await fetch(`${Ee}/users/${e}/chat-history${a}`,{headers:n});if(!i.ok){const e=await i.json().catch(()=>({error:i.statusText}));throw new Error(e.error||`Request failed: ${i.status}`)}return i.json()}async function Ke(e,t){const n=await Ce(),r=await fetch(`${Ee}${e}`,{method:"DELETE",headers:n,body:JSON.stringify(t)});if(!r.ok){const e=await r.json().catch(()=>({error:r.statusText}));throw new Error(e.error||`Request failed: ${r.status}`)}return r.json()}async function Xe(e,t){const n=await Ce(),r=await fetch(`${Ee}${e}`,{headers:n,...t});if(!r.ok){const e=await r.json().catch(()=>({error:r.statusText}));throw new Error(e.error||`Request failed: ${r.status}`)}return r.json()}var Ge=Array.isArray,Ye="object"==typeof r&&r&&r.Object===Object&&r,Je=Ye,Ze="object"==typeof self&&self&&self.Object===Object&&self,Qe=Je||Ze||Function("return this")(),et=Qe.Symbol,tt=et,nt=Object.prototype,rt=nt.hasOwnProperty,at=nt.toString,it=tt?tt.toStringTag:void 0;var ot=function(e){var t=rt.call(e,it),n=e[it];try{e[it]=void 0;var r=!0}catch(i){}var a=at.call(e);return r&&(t?e[it]=n:delete e[it]),a},st=Object.prototype.toString;var lt=ot,ct=function(e){return st.call(e)},ut=et?et.toStringTag:void 0;var dt=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":ut&&ut in Object(e)?lt(e):ct(e)};var ft=function(e){return null!=e&&"object"==typeof e},pt=dt,ht=ft;var mt=function(e){return"symbol"==typeof e||ht(e)&&"[object Symbol]"==pt(e)},yt=Ge,xt=mt,gt=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,vt=/^\w*$/;var bt=function(e,t){if(yt(e))return!1;var n=typeof e;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=e&&!xt(e))||(vt.test(e)||!gt.test(e)||null!=t&&e in Object(t))};var jt=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)};const wt=a(jt);var Nt=dt,St=jt;var Ot=function(e){if(!St(e))return!1;var t=Nt(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t};const kt=a(Ot);var At,Pt=Qe["__core-js_shared__"],Et=(At=/[^.]+$/.exec(Pt&&Pt.keys&&Pt.keys.IE_PROTO||""))?"Symbol(sr
13c)_1."+At:"";var _t=function(e){return!!Et&&Et in e},Ct=Function.prototype.toString;var Mt=function(e){if(null!=e){try{return Ct.call(e)}catch(t){}try{return e+""}catch(t){}}return""},Tt=Ot,Dt=_t,It=jt,Rt=Mt,Lt=/^\[object .+?Constructor\]$/,Bt=Function.prototype,zt=Object.prototype,$t=Bt.toString,Ft=zt.hasOwnProperty,Ut=RegExp("^"+$t.call(Ft).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");var qt=function(e){return!(!It(e)||Dt(e))&&(Tt(e)?Ut:Lt).test(Rt(e))},Wt=function(e,t){return null==e?void 0:e[t]};var Ht=function(e,t){var n=Wt(e,t);return qt(n)?n:void 0},Vt=Ht(Object,"create"),Kt=Vt;var Xt=function(){this.__data__=Kt?Kt(null):{},this.size=0};var Gt=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},Yt=Vt,Jt=Object.prototype.hasOwnProperty;var Zt=function(e){var t=this.__data__;if(Yt){var n=t[e];return"__lodash_hash_undefined__"===n?void 0:n}return Jt.call(t,e)?t[e]:void 0},Qt=Vt,en=Object.prototype.hasOwnProperty;var tn=Vt;var nn=Xt,rn=Gt,an=Zt,on=function(e){var t=this.__data__;return Qt?void 0!==t[e]:en.call(t,e)},sn=function(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=tn&&void 0===t?"__lodash_hash_undefined__":t,this};function ln(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}ln.prototype.clear=nn,ln.prototype.delete=rn,ln.prototype.get=an,ln.prototype.has=on,ln.prototype.set=sn;var cn=ln;var un=function(){this.__data__=[],this.size=0};var dn=function(e,t){return e===t||e!=e&&t!=t},fn=dn;var pn=function(e,t){for(var n=e.length;n--;)if(fn(e[n][0],t))return n;return-1},hn=pn,mn=Array.prototype.splice;var yn=pn;var xn=pn;var gn=pn;var vn=un,bn=function(e){var t=this.__data__,n=hn(t,e);return!(n<0)&&(n==t.length-1?t.pop():mn.call(t,n,1),--this.size,!0)},jn=function(e){var t=this.__data__,n=yn(t,e);return n<0?void 0:t[n][1]},wn=function(e){return xn(this.__data__,e)>-1},Nn=function(e,t){var n=this.__data__,r=gn(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this};function Sn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}Sn.prototype.clear=vn,Sn.prototype.delete=bn,Sn.prototype.get=jn,Sn.prototype.has=wn,Sn.prototype.set=Nn;var On=Sn,kn=Ht(Qe,"Map"),An=cn,Pn=On,En=kn;var _n=function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e};var Cn=function(e,t){var n=e.__data__;return _n(t)?n["string"==typeof t?"string":"hash"]:n.map},Mn=Cn;var Tn=Cn;var Dn=Cn;var In=Cn;var Rn=function(){this.size=0,this.__data__={hash:new An,map:new(En||Pn),string:new An}},Ln=function(e){var t=Mn(this,e).delete(e);return this.size-=t?1:0,t},Bn=function(e){return Tn(this,e).get(e)},zn=function(e){return Dn(this,e).has(e)},$n=function(e,t){var n=In(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this};function Fn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}Fn.prototype.clear=Rn,Fn.prototype.delete=Ln,Fn.prototype.get=Bn,Fn.prototype.has=zn,Fn.prototype.set=$n;var Un=Fn,qn=Un;function Wn(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new TypeError("Expected a function");var n=function(){var r=arguments,a=t?t.apply(this,r):r[0],i=n.cache;if(i.has(a))return i.get(a);var o=e.apply(this,r);return n.cache=i.set(a,o)||i,o};return n.cache=new(Wn.Cache||qn),n}Wn.Cache=qn;var Hn=Wn;const Vn=a(Hn);var Kn=Hn;var Xn=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Gn=/\\(\\)?/g,Yn=function(e){var t=Kn(e,function(e){return 500===n.size&&n.clear(),e}),n=t.cache;return t}(function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(Xn,function(e,n,r,a){t.push(r?a.replace(Gn,"$1"):n||e)}),t});var Jn=function(e,t){for(var n=-1,r=null==e?0:e.length,a=Array(r);++n<r;)a[n]=t(e[n],n,e);return a},Zn=Jn,Qn=Ge,er=mt,tr=et?et.prototype:void 0,nr=tr?tr.toString:void 0;var rr=function e(t){if("string"==typeof t)return t;if(Qn(t))return Zn(t,e)+"";if(er(t))return nr?nr.call(t):"";var n=t+"";return"0"==n&&1/t==-1/0?"-0":n},ar=rr;var ir=function(e){return null==e?"":ar(e)},or=Ge,sr=bt,lr=Yn,cr=ir;var ur=function(e,t){return or(e)?e:sr(e,t)?[e]:lr(cr(e))},dr=mt;var fr=function(e){if("string"==typeof e||dr(e))return e;var t=e+"";return"0"==t&&1/e==-1/0?"-0":t},pr=ur,hr=fr;var mr=function(e,t){for(var n=0,r=(t=pr(t,e)).length;null!=e&&n<r;)e=e[hr(t[n++])];return n&&n==r?e:void 0},yr=mr;var xr=function(e,t,n){var r=null==e?void 0:yr(e,t);return void 0===r?n:r};const gr=a(xr);const vr=a(function(e){return null==e});var br=dt,jr=Ge,wr=ft;const Nr=a(function(e){return"string"==typeof e||!jr(e)&&wr(e)&&"[object String]"==br(e)});var Sr,Or={exports:{}},kr={},Ar=Symbol.for("react.element"),Pr=Symbol.for("react.portal"),Er=Symbol.for("react.fragment"),_r=Symbol.for("react.strict_mode"),Cr=Symbol.for("react.profiler"),Mr=Symbol.for("react.provider"),Tr=Symbol.for("react.context"),Dr=Symbol.for("react.server_context"),Ir=Symbol.for("react.forward_ref"),Rr=Symbol.for("react.suspense"),Lr=Symbol.for("react.suspense_list"),Br=Symbol.for("react.memo"),zr=Symbol.for("react.lazy"),$r=Symbol.for("react.offscreen");function Fr(e){if("object"==typeof e&&null!==e){var t=e.$$typeof;switch(t){case Ar:switch(e=e.type){case Er:case Cr:case _r:case Rr:case Lr:return e;default:switch(e=e&&e.$$typeof){case Dr:case Tr:case Ir:case zr:case Br:case Mr:return e;default:return t}}case Pr:return t}}}Sr=Symbol.for("react.module.reference"),kr.ContextConsumer=Tr,kr.ContextProvider=Mr,kr.Element=Ar,kr.ForwardRef=Ir,kr.Fragment=Er,kr.Lazy=zr,kr.Memo=Br,kr.Portal=Pr,kr.Profiler=Cr,kr.StrictMode=_r,kr.Suspense=Rr,kr.SuspenseList=Lr,kr.isAsyncMode=function(){return!1},kr.isConcurrentMode=function(){return!1},kr.isContextConsumer=function(e){return Fr(e)===Tr},kr.isContextProvider=function(e){return Fr(e)===Mr},kr.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===Ar},kr.isForwardRef=function(e){return Fr(e)===Ir},kr.isFragment=function(e){return Fr(e)===Er},kr.isLazy=function(e){return Fr(e)===zr},kr.isMemo=function(e){return Fr(e)===Br},kr.isPortal=function(e){return Fr(e)===Pr},kr.isProfiler=function(e){return Fr(e)===Cr},kr.isStrictMode=function(e){return Fr(e)===_r},kr.isSuspense=function(e){return Fr(e)===Rr},kr.isSuspenseList=function(e){return Fr(e)===Lr},kr.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===Er||e===Cr||e===_r||e===Rr||e===Lr||e===$r||"object"==typeof e&&null!==e&&(e.$$typeof===zr||e.$$typeof===Br||e.$$typeof===Mr||e.$$typeof===Tr||e.$$typeof===Ir||e.$$typeof===Sr||void 0!==e.getModuleId)}
vendor: 44,298 bytes, line 13
13,kr.typeOf=Fr,Or.exports=kr;var Ur=Or.exports,qr=dt,Wr=ft;var Hr=function(e){return"number"==typeof e||Wr(e)&&"[object Number]"==qr(e)};const Vr=a(Hr);var Kr=Hr;const Xr=a(function(e){return Kr(e)&&e!=+e});var Gr=function(e){return 0===e?0:e>0?1:-1},Yr=function(e){return Nr(e)&&e.indexOf("%")===e.length-1},Jr=function(e){return Vr(e)&&!Xr(e)},Zr=function(e){return Jr(e)||Nr(e)},Qr=0,ea=function(e){var t=++Qr;return"".concat(e||"").concat(t)},ta=function(e,t){var n,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,a=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(!Jr(e)&&!Nr(e))return r;if(Yr(e)){var i=e.indexOf("%");n=t*parseFloat(e.slice(0,i))/100}else n=+e;return Xr(n)&&(n=r),a&&n>t&&(n=t),n},na=function(e){if(!e)return null;var t=Object.keys(e);return t&&t.length?e[t[0]]:null},ra=function(e,t){return Jr(e)&&Jr(t)?function(n){return e+n*(t-e)}:function(){return t}};function aa(e,t,n){return e&&e.length?e.find(function(e){return e&&("function"==typeof t?t(e):gr(e,t))===n}):null}var ia=function(e,t){return Jr(e)&&Jr(t)?e-t:Nr(e)&&Nr(t)?e.localeCompare(t):e instanceof Date&&t instanceof Date?e.getTime()-t.getTime():String(e).localeCompare(String(t))};function oa(e,t){for(var n in e)if({}.hasOwnProperty.call(e,n)&&(!{}.hasOwnProperty.call(t,n)||e[n]!==t[n]))return!1;for(var r in t)if({}.hasOwnProperty.call(t,r)&&!{}.hasOwnProperty.call(e,r))return!1;return!0}function sa(e){return(sa="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var la=["aria-activedescendant","aria-atomic","aria-autocomplete","aria-busy","aria-checked","aria-colcount","aria-colindex","aria-colspan","aria-controls","aria-current","aria-describedby","aria-details","aria-disabled","aria-errormessage","aria-expanded","aria-flowto","aria-haspopup","aria-hidden","aria-invalid","aria-keyshortcuts","aria-label","aria-labelledby","aria-level","aria-live","aria-modal","aria-multiline","aria-multiselectable","aria-orientation","aria-owns","aria-placeholder","aria-posinset","aria-pressed","aria-readonly","aria-relevant","aria-required","aria-roledescription","aria-rowcount","aria-rowindex","aria-rowspan","aria-selected","aria-setsize","aria-sort","aria-valuemax","aria-valuemin","aria-valuenow","aria-valuetext","className","color","height","id","lang","max","media","method","min","name","style","target","width","role","tabIndex","accentHeight","accumulate","additive","alignmentBaseline","allowReorder","alphabetic","amplitude","arabicForm","ascent","attributeName","attributeType","autoReverse","azimuth","baseFrequency","baselineShift","baseProfile","bbox","begin","bias","by","calcMode","capHeight","clip","clipPath","clipPathUnits","clipRule","colorInterpolation","colorInterpolationFilters","colorProfile","colorRendering","contentScriptType","contentStyleType","cursor","cx","cy","d","decelerate","descent","diffuseConstant","direction","display","divisor","dominantBaseline","dur","dx","dy","edgeMode","elevation","enableBackground","end","exponent","externalResourcesRequired","fill","fillOpacity","fillRule","filter","filterRes","filterUnits","floodColor","floodOpacity","focusable","fontFamily","fontSize","fontSizeAdjust","fontStretch","fontStyle","fontVariant","fontWeight","format","from","fx","fy","g1","g2","glyphName","glyphOrientationHorizontal","glyphOrientationVertical","glyphRef","gradientTransform","gradientUnits","hanging","horizAdvX","horizOriginX","href","ideographic","imageRendering","in2","in","intercept","k1","k2","k3","k4","k","kernelMatrix","kernelUnitLength","kerning","keyPoints","keySplines","keyTimes","lengthAdjust","letterSpacing","lightingColor","limitingConeAngle","local","markerEnd","markerHeight","markerMid","markerStart","markerUnits","markerWidth","mask","maskContentUnits","maskUnits","mathematical","mode","numOctaves","offset","opacity","operator","order","orient","orientation","origin","overflow","overlinePosition","overlineThickness","paintOrder","panose1","pathLength","patternContentUnits","patternTransform","patternUnits","pointerEvents","pointsAtX","pointsAtY","pointsAtZ","preserveAlpha","preserveAspectRatio","primitiveUnits","r","radius","refX","refY","renderingIntent","repeatCount","repeatDur","requiredExtensions","requiredFeatures","restart","result","rotate","rx","ry","seed","shapeRendering","slope","spacing","specularConstant","specularExponent","speed","spreadMethod","startOffset","stdDeviation","stemh","stemv","stitchTiles","stopColor","stopOpacity","strikethroughPosition","strikethroughThickness","string","stroke","strokeDasharray","strokeDashoffset","strokeLinecap","strokeLinejoin","strokeMiterlimit","strokeOpacity","strokeWidth","surfaceScale","systemLanguage","tableValues","targetX","targetY","textAnchor","textDecoration","textLength","textRendering","to","transform","u1","u2","underlinePosition","underlineThickness","unicode","unicodeBidi","unicodeRange","unitsPerEm","vAlphabetic","values","vectorEffect","version","vertAdvY","vertOriginX","vertOriginY","vHanging","vIdeographic","viewTarget","visibility","vMathematical","widths","wordSpacing","writingMode","x1","x2","x","xChannelSelector","xHeight","xlinkActuate","xlinkArcrole","xlinkHref","xlinkRole","xlinkShow","xlinkTitle","xlinkType","xmlBase","xmlLang","xmlns","xmlnsXlink","xmlSpace","y1","y2","y","yChannelSelector","z","zoomAndPan","ref","key","angle"],ca=["points","pathLength"],ua={svg:["viewBox","children"],polygon:ca,polyline:ca},da=["dangerouslySetInnerHTML","onCopy","onCopyCapture","onCut","onCutCapture","onPaste","onPasteCapture","onCompositionEnd","onCompositionEndCapture","onCompositionStart","onCompositionStartCapture","onCompositionUpdate","onCompositionUpdateCapture","onFocus","onFocusCapture","onBlur","onBlurCapture","onChange","onChangeCapture","onBeforeInput","onBeforeInputCapture","onInput","onInputCapture","onReset","onResetCapture","onSubmit","onSubmitCapture","onInvalid","onInvalidCapture","onLoad","onLoadCapture","onError","onErrorCapture","onKeyDown","onKeyDownCapture","onKeyPress","onKeyPressCapture","onKeyUp","onKeyUpCapture","onAbort","onAbortCapture","onCanPlay","onCanPlayCapture","onCanPlayThrough","onCanPlayThroughCapture","onDurationChange","onDurationChangeCapture","onEmptied","onEmptiedCapture","onEncrypted","onEncryptedCapture","onEnded","onEndedCapture","onLoadedData","onLoadedDataCapture","onLoadedMetadata","onLoadedMetadataCapture","onLoadStart","onLoadStartCapture","onPause","onPauseCapture","onPlay","onPlayCapture","onPlaying","onPlayingCapture","onProgress","onProgressCapture","onRateChange","onRateChangeCapture","onSeeked","onSeekedCapture","onSeeking","onSeekingCapture","onStalled","onStalledCapture","onSuspend","onSuspendCapture","onTimeUpdate","onTimeUpdateCapture","onVolumeChange","onVolumeChangeCapture","onWaiting","onWaitingCapture","onAuxClick","onAuxClickCapture","onClick","onClickCapture","onContextMenu","onContextMenuCapture","onDoubleClick","onDoubleClickCapture","onDrag","onDragCapture","onDragEnd","onDragEndCapture","onDragEnter","onDragEnterCapture","onDragExit","onDragExitCapture","onDragLeave","onDragLeaveCapture","onDragOver","onDragOverCapture","onDragStart","onDragStartCapture","onDrop","onDropCapture","onMouseDown","onMouseDownCapture","onMouseEnter","onMouseLeave","onMouseMove","onMouseMoveCapture","onMouseOut","onMouseOutCapture","onMouseOver","onMouseOverCapture","onMouseUp","onMouseUpCapture","onSelect","onSelectCapture","onTouchCancel","onTouchCancelCapture","onTouchEnd","onTouchEndCapture","onTouchMove","onTouchMoveCapture","onTouchStart","onTouchStartCapture","onPointerDown","onPointerDownCapture","onPointerMove","onPointerMoveCapture","onPointerUp","onPointerUpCapture","onPointerCancel","onPointerCancelCapture","onPointerEnter","onPointerEnterCapture","onPointerLeave","onPointerLeaveCapture","onPointerOver","onPointerOverCapture","onPointerOut","onPointerOutCapture","onGotPointerCapture","onGotPointerCaptureCapture","onLostPointerCapture","onLostPointerCaptureCapture","onScroll","onScrollCapture","onWheel","onWheelCapture","onAnimationStart","onAnimationStartCapture","onAnimationEnd","onAnimationEndCapture","onAnimationIteration","onAnimationIterationCapture","onTransitionEnd","onTransitionEndCapture"],fa=function(e,t){if(!e||"function"==typeof e||"boolean"==typeof e)return null;var n=e;if(i.isValidElement(e)&&(n=e.props),!wt(n))return null;var r={};return Object.keys(n).forEach(function(e){da.includes(e)&&(r[e]=t||function(t){return n[e](n,t)})}),r},pa=function(e,t,n){if(!wt(e)||"object"!==sa(e))return null;var r=null;return Object.keys(e).forEach(function(a){var i=e[a];da.includes(a)&&"function"==typeof i&&(r||(r={}),r[a]=function(e,t,n){return function(r){return e(t,n,r),null}}(i,t,n))}),r},ha=["children"],ma=["children"];function ya(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)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}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}function xa(e){return(xa="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var ga={click:"onClick",mousedown:"onMouseDown",mouseup:"onMouseUp",mouseover:"onMouseOver",mousemove:"onMouseMove",mouseout:"onMouseOut",mouseenter:"onMouseEnter",mouseleave:"onMouseLeave",touchcancel:"onTouchCancel",touchend:"onTouchEnd",touchmove:"onTouchMove",touchstart:"onTouchStart",contextmenu:"onContextMenu",dblclick:"onDoubleClick"},va=function(e){return"string"==typeof e?e:e?e.displayName||e.name||"Component":""},ba=null,ja=null,wa=function e(t){if(t===ba&&Array.isArray(ja))return ja;var n=[];return i.Children.forEach(t,function(t){vr(t)||(Ur.isFragment(t)?n=n.concat(e(t.props.children)):n.push(t))}),ja=n,ba=t,n};function Na(e,t){var n=[],r=[];return r=Array.isArray(t)?t.map(function(e){return va(e)}):[va(t)],wa(e).forEach(function(e){var t=gr(e,"type.displayName")||gr(e,"type.name");-1!==r.indexOf(t)&&n.push(e)}),n}function Sa(e,t){var n=Na(e,t);return n&&n[0]}var Oa=function(e){if(!e||!e.props)return!1;var t=e.props,n=t.width,r=t.height;return!(!Jr(n)||n<=0||!Jr(r)||r<=0)},ka=["a","altGlyph","altGlyphDef","altGlyphItem","animate","animateColor","animateMotion","animateTransform","circle","clipPath","color-profile","cursor","defs","desc","ellipse","feBlend","feColormatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","filter","font","font-face","font-face-format","font-face-name","font-face-url","foreignObject","g","glyph","glyphRef","hkern","image","line","lineGradient","marker","mask","metadata","missing-glyph","mpath","path","pattern","polygon","polyline","radialGradient","rect","script","set","stop","style","svg","switch","symbol","text","textPath","title","tref","tspan","use","view","vkern"],Aa=function(e){return e&&"object"===xa(e)&&"clipDot"in e},Pa=function(e,t,n){if(!e||"function"==typeof e||"boolean"==typeof e)return null;var r=e;if(i.isValidElement(e)&&(r=e.props),!wt(r))return null;var a={};return Object.keys(r).forEach(function(e){var i;(function(e,t,n,r){var a,i=null!==(a=null==ua?void 0:ua[r])&&void 0!==a?a:[];return t.startsWith("data-")||!kt(e)&&(r&&i.includes(t)||la.includes(t))||n&&da.includes(t)})(null===(i=r)||void 0===i?void 0:i[e],e,t,n)&&(a[e]=r[e])}),a},Ea=function e(t,n){if(t===n)return!0;var r=i.Children.count(t);if(r!==i.Children.count(n))return!1;if(0===r)return!0;if(1===r)return _a(Array.isArray(t)?t[0]:t,Array.isArray(n)?n[0]:n);for(var a=0;a<r;a++){var o=t[a],s=n[a];if(Array.isArray(o)||Array.isArray(s)){if(!e(o,s))return!1}else if(!_a(o,s))return!1}return!0},_a=function(e,t){if(vr(e)&&vr(t))return!0;if(!vr(e)&&!vr(t)){var n=e.props||{},r=n.children,a=ya(n,ha),i=t.props||{},o=i.children,s=ya(i,ma);return r&&o?oa(a,s)&&Ea(r,o):!r&&!o&&oa(a,s)}return!1},Ca=function(e,t){var n=[],r={};return wa(e).forEach(function(e,a){if(function(e){return e&&e.type&&Nr(e.type)&&ka.indexOf(e.type)>=0}(e))n.push(e);else if(e){var i=va(e.type),o=t[i]||{},s=o.handler,l=o.once;if(s&&(!l||!r[i])){var c=s(e,i,a);n.push(c),r[i]=!0}}}),n},Ma=["children","width","height","viewBox","className","style","title","desc"];function Ta(){return Ta=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},Ta.apply(this,arguments)}function Da(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)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}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}function Ia(e){var t=e.children,n=e.width,r=e.height,a=e.viewBox,i=e.className,l=e.style,c=e.title,u=e.desc,d=Da(e,Ma),f=a||{width:n,height:r,x:0,y:0},p=o("recharts-surface",i);return s.createElement("svg",Ta({},Pa(d,!0,"svg"),{className:p,width:n,height:r,style:l,viewBox:"".concat(f.x," ").concat(f.y," ").concat(f.width," ").concat(f.height)}),s.createElement("title",null,c),s.createElement("desc",null,u),t)}var Ra=["children","className"];function La(){return La=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},La.apply(this,arguments)}function Ba(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)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}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var za=s.forwardRef(function(e,t){var n=e.children,r=e.className,a=Ba(e,Ra),i=o("recharts-layer",r);return s.createElement("g",La({className:i},Pa(a,!0),{ref:t}),n)}),$a=function(e,t){for(var n=arguments.length,r=new Array(n>2?n-2:0),a=2;a<n;a++)r[a-2]=arguments[a]};var Fa=function(e,t,n){var r=-1,a=e.length;t<0&&(t=-t>a?0:a+t),(n=n>a?a:n)<0&&(n+=a),a=t>n?0:n-t>>>0,t>>>=0;for(var i=Array(a);++r<a;)i[r]=e[r+t];return i};var Ua=function(e,t,n){var r=e.length;return n=void 0===n?r:n,!t&&n>=r?e:Fa(e,t,n)},qa=RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]");var Wa=function(e){return qa.test(e)};var Ha=function(e){return e.split("")},Va="\\ud800-\\udfff",Ka="["+Va+"]",Xa="[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]",Ga="\\ud83c[\\udffb-\\udfff]",Ya="[^"+Va+"]",Ja="(?:\\ud83c[\\udde6-\\uddff]){2}",Za="[\\ud800-\\udbff][\\udc00-\\udfff]",Qa="(?:"+Xa+"|"+Ga+")"+"?",ei="[\\ufe0e\\ufe0f]?",ti=ei+Qa+("(?:\\u200d(?:"+[Ya,Ja,Za].join("|")+")"+ei+Qa+")*"),ni="(?:"+[Ya+Xa+"?",Xa,Ja,Za,Ka].join("|")+")",ri=RegExp(Ga+"(?="+Ga+")|"+ni+ti,"g");var ai=Ha,ii=Wa,oi=function(e){return e.match(ri)||[]};var si=Ua,li=Wa,ci=function(e){return ii(e)?oi(e):ai(e)},ui=ir;const di=a(function(e){return function(t){t=ui(t);var n=li(t)?ci(t):void 0,r=n?n[0]:t.charAt(0),a=n?si(n,1).join(""):t.slice(1);return r[e]()+a}}("toUpperCase"));function fi(e){return function(){return e}}const pi=Math.cos,hi=Math.sin,mi=Math.sqrt,yi=Math.PI,xi=2*yi,gi=Math.PI,vi=2*gi,bi=1e-6,ji=vi-bi;function wi(e){this._+=e[0];for(let t=1,n=e.length;t<n;++t)this._+=arguments[t]+e[t]}class Ni{constructor(e){this._x0=this._y0=this._x1=this._y1=null,this._="",this._append=null==e?wi:function(e){let t=Math.floor(e);if(!(t>=0))throw new Error(`invalid digits: ${e}`);if(t>15)return wi;const n=10**t;return function(e){this._+=e[0];for(let t=1,r=e.length;t<r;++t)this._+=Math.round(arguments[t]*n)/n+e[t]}}(e)}moveTo(e,t){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+t}`}closePath(){null!==this._x1&&(this._x1=this._x0,this._y1=this._y0,this._append`Z`)}lineTo(e,t){this._append`L${this._x1=+e},${this._y1=+t}`}quadraticCurveTo(e,t,n,r){this._append`Q${+e},${+t},${this._x1=+n},${this._y1=+r}`}bezierCurveTo(e,t,n,r,a,i){this._append`C${+e},${+t},${+n},${+r},${this._x1=+a},${this._y1=+i}`}arcTo(e,t,n,r,a){if(e=+e,t=+t,n=+n,r=+r,(a=+a)<0)throw new Error(`negative radius: ${a}`);let i=this._x1,o=this._y1,s=n-e,l=r-t,c=i-e,u=o-t,d=c*c+u*u;if(null===this._x1)this._append`M${this._x1=e},${this._y1=t}`;else if(d>bi)if(Math.abs(u*s-l*c)>bi&&a){let f=n-i,p=r-o,h=s*s+l*l,m=f*f+p*p,y=Math.sqrt(h),x=Math.sqrt(d),g=a*Math.tan((gi-Math.acos((h+d-m)/(2*y*x)))/2),v=g/x,b=g/y;Math.abs(v-1)>bi&&this._append`L${e+v*c},${t+v*u}`,this._append`A${a},${a},0,0,${+(u*f>c*p)},${this._x1=e+b*s},${this._y1=t+b*l}`}else this._append`L${this._x1=e},${this._y1=t}`;else;}arc(e,t,n,r,a,i){if(e=+e,t=+t,i=!!i,(n=+n)<0)throw new Error(`negative radius: ${n}`);let o=n*Math.cos(r),s=n*Math.sin(r),l=e+o,c=t+s,u=1^i,d=i?r-a:a-r;null===this._x1?this._append`M${l},${c}`:(Math.abs(this._x1-l)>bi||Math.abs(this._y1-c)>bi)&&this._append`L${l},${c}`,n&&(d<0&&(d=d%vi+vi),d>ji?this._append`A${n},${n},0,1,${u},${e-o},${t-s}A${n},${n},0,1,${u},${this._x1=l},${this._y1=c}`:d>bi&&this._append`A${n},${n},0,${+(d>=gi)},${u},${this._x1=e+n*Math.cos(a)},${this._y1=t+n*Math.sin(a)}`)}rect(e,t,n,r){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+t}h${n=+n}v${+r}h${-n}Z`}toString(){return this._}}function Si(e){let t=3;return e.digits=function(n){if(!arguments.length)return t;if(null==n)t=null;else{const e=Math.floor(n);if(!(e>=0))throw new RangeError(`invalid digits: ${n}`);t=e}return e},()=>new Ni(t)}function Oi(e){return"object"==typeof e&&"length"in e?e:Array.from(e)}function ki(e){this._context=e}function Ai(e){return new ki(e)}function Pi(e){return e[0]}function Ei(e){return e[1]}function _i(e,t){var n=fi(!0),r=null,a=Ai,i=null,o=Si(s);function s(s){var l,c,u,d=(s=Oi(s)).length,f=!1;for(null==r&&(i=a(u=o())),l=0;l<=d;++l)!(l<d&&n(c=s[l],l,s))===f&&((f=!f)?i.lineStart():i.lineEnd()),f&&i.point(+e(c,l,s),+t(c,l,s));if(u)return i=null,u+""||null}return e="function"==typeof e?e:void 0===e?Pi:fi(e),t="function"==typeof t?t:void 0===t?Ei:fi(t),s.x=function(t){return arguments.length?(e="function"==typeof t?t:fi(+t),s):e},s.y=function(e){return arguments.length?(t="function"==typeof e?e:fi(+e),s):t},s.defined=function(e){return arguments.length?(n="function"==typeof e?e:fi(!!e),s):n},s.curve=function(e){return arguments.length?(a=e,null!=r&&(i=a(r)),s):a},s.context=function(e){return arguments.length?(null==e?r=i=null:i=a(r=e),s):r},s}function Ci(e,t,n){var r=null,a=fi(!0),i=null,o=Ai,s=null,l=Si(c);function c(c){var u,d,f,p,h,m=(c=Oi(c)).length,y=!1,x=new Array(m),g=new Array(m);for(null==i&&(s=o(h=l())),u=0;u<=m;++u){if(!(u<m&&a(p=c[u],u,c))===y)if(y=!y)d=u,s.areaStart(),s.lineStart();else{for(s.lineEnd(),s.lineStart(),f=u-1;f>=d;--f)s.point(x[f],g[f]);s.lineEnd(),s.areaEnd()}y&&(x[u]=+e(p,u,c),g[u]=+t(p,u,c),s.point(r?+r(p,u,c):x[u],n?+n(p,u,c):g[u]))}if(h)return s=null,h+""||null}function u(){return _i().defined(a).curve(o).context(i)}return e="function"==typeof e?e:void 0===e?Pi:fi(+e),t="function"==typeof t?t:fi(void 0===t?0:+t),n="function"==typeof n?n:void 0===n?Ei:fi(+n),c.x=function(t){return arguments.length?(e="function"==typeof t?t:fi(+t),r=null,c):e},c.x0=function(t){return arguments.length?(e="function"==typeof t?t:fi(+t),c):e},c.x1=function(e){return arguments.length?(r=null==e?null:"function"==typeof e?e:fi(+e),c):r},c.y=function(e){return arguments.length?(t="function"==typeof e?e:fi(+e),n=null,c):t},c.y0=function(e){return arguments.length?(t="function"==typeof e?e:fi(+e),c):t},c.y1=function(e){return arguments.length?(n=null==e?null:"function"==typeof e?e:fi(+e),c):n},c.lineX0=c.lineY0=function(){return u().x(e).y(t)},c.lineY1=function(){return u().x(e).y(n)},c.lineX1=function(){return u().x(r).y(t)},c.defined=function(e){return arguments.length?(a="function"==typeof e?e:fi(!!e),c):a},c.curve=function(e){return arguments.length?(o=e,null!=i&&(s=o(i)),c):o},c.context=function(e){return arguments.length?(null==e?i=s=null:s=o(i=e),c):i},c}ki.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._context.lineTo(e,t)}}};class Mi{constructor(e,t){this._context=e,this._x=t}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line}point(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._x?this._context.bezierCurveTo(this._x0=(this._x0+e)/2,this._y0,this._x0,t,e,t):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+t)/2,e,this._y0,e,t)}this._x0=e,this._y0=t}}const Ti={draw(e,t){const n=mi(t/yi);e.moveTo(n,0),e.arc(0,0,n,0,xi)}},Di={draw(e,t){const n=mi(t/5)/2;e.moveTo(-3*n,-n),e.lineTo(-n,-n),e.lineTo(-n,-3*n),e.lineTo(n,-3*n),e.lineTo(n,-n),e.lineTo(3*n,-n),e.lineTo(3*n,n),e.lineTo(n,n),e.lineTo(n,3*n),e.lineTo(-n,3*n),e.lineTo(-n,n),e.lineTo(-3*n,n),e.closePath()}},Ii=mi(1/3),Ri=2*Ii,Li={draw(e,t){const n=mi(t/Ri),r=n*Ii;e.moveTo(0,-n),e.lineTo(r,0),e.lineTo(0,n),e.lineTo(-r,0),e.closePath()}},Bi={draw(e,t){const n=mi(t),r=-n/2;e.rect(r,r,n,n)}},zi=hi(yi/10)/hi(7*yi/10),$i=hi(xi/10)*zi,Fi=-pi(xi/10)*zi,Ui={draw(e,t){const n=mi(.8908130915292852*t),r=$i*n,a=Fi*n;e.moveTo(0,-n),e.lineTo(r,a);for(let i=1;i<5;++i){const t=xi*i/5,o=pi(t),s=hi(t);e.lineTo(s*n,-o*n),e.lineTo(o*r-s*a,s*r+o*a)}e.closePath()}},qi=mi(3),Wi={draw(e,t){const n=-mi(t/(3*qi));e.moveTo(0,2*n),e.lineTo(-qi*n,-n),e.lineTo(qi*n,-n),e.closePath()}},Hi=-.5,Vi=mi(3)/2,Ki=1/mi(12),Xi=3*(Ki/2+1),Gi={draw(e,t){const n=mi(t/Xi),r=n/2,a=n*Ki,i=r,o=n*Ki+n,s=-i,l=o;e.moveTo(r,a),e.lineTo(i,o),e.lineTo(s,l),e.lineTo(Hi*r-Vi*a,Vi*r+Hi*a),e.lineTo(Hi*i-Vi*o,Vi*i+Hi*o),e.lineTo(Hi*s-Vi*l,Vi*s+Hi*l),e.lineTo(Hi*r+Vi*a,Hi*a-Vi*r),e.lineTo(Hi*i+Vi*o,Hi*o-Vi*i),e.lineTo(Hi*s+Vi*l,Hi*l-Vi*s),e.closePath()}};function Yi(){}function Ji(e,t,n){e._context.bezierCurveTo((2*e._x0+e._x1)/3,(2*e._y0+e._y1)/3,(e._x0+2*e._x1)/3,(e._y0+2*e._y1)/3,(e._x0+4*e._x1+t)/6,(e._y0+4*e._y1+n)/6)}function Zi(e){this._context=e}function Qi(e){this._context=e}function eo(e){this._context=e}function to(e){this._context=e}function no(e){return e<0?-1:1}function ro(e,t,n){var r=e._x1-e._x0,a=t-e._x1,i=(e._y1-e._y0)/(r||a<0&&-0),o=(n-e._y1)/(a||r<0&&-0),s=(i*a+o*r)/(r+a);return(no(i)+no(o))*Math.min(Math.abs(i),Math.abs(o),.5*Math.abs(s))||0}function ao(e,t){var n=e._x1-e._x0;return n?(3*(e._y1-e._y0)/n-t)/2:t}function io(e,t,n){var r=e._x0,a=e._y0,i=e._x1,o=e._y1,s=(i-r)/3;e._context.bezierCurveTo(r+s,a+s*t,i-s,o-s*n,i,o)}function oo(e){this._context=e}function so(e){this._context=new lo(e)}function lo(e){this._context=e}function co(e){this._context=e}function uo(e){var t,n,r=e.length-1,a=new Array(r),i=new Array(r),o=new Array(r);for(a[0]=0,i[0]=2,o[0]=e[0]+2*e[1],t=1;t<r-1;++t)a[t]=1,i[t]=4,o[t]=4*e[t]+2*e[t+1];for(a[r-1]=2,i[r-1]=7,o[r-1]=8*e[r-1]+e[r],t=1;t<r;++t)n=a[t]/i[t-1],i[t]-=n,o[t]-=n*o[t-1];for(a[r-1]=o[r-1]/i[r-1],t=r-2;t>=0;--t)a[t]=(o[t]-a[t+1])/i[t];for(i[r-1]=(e[r]+a[r-1])/2,t=0;t<r-1;++t)i[t]=2*e[t+1]-a[t+1];return[a,i]}function fo(e,t){this._context=e,this._t=t}function po(e,t){if((a=e.length)>1)for(var n,r,a,i=1,o=e[t[0]],s=o.length;i<a;++i)for(r=o,o=e[t[i]],n=0;n<s;++n)o[n][1]+=o[n][0]=isNaN(r[n][1])?r[n][0]:r[n][1]}function ho(e){for(var t=e.length,n=new Array(t);--t>=0;)n[t]=t;return n}function mo(e,t){return e[t]}function yo(e){const t=[];return t.key=e,t}function xo(e){return(xo="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}Zi.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:Ji(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:Ji(this,e,t)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}},Qi.prototype={areaStart:Yi,areaEnd:Yi,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x2,this._y2),this._context.closePath();break;case 2:this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break;case 3:this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4)}},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._x2=e,this._y2=t;break;case 1:this._point=2,this._x3=e,this._y3=t;break;case 2:this._point=3,this._x4=e,this._y4=t,this._context.moveTo((this._x0+4*this._x1+e)/6,(this._y0+4*this._y1+t)/6);break;default:Ji(this,e,t)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}},eo.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var n=(this._x0+4*this._x1+e)/6,r=(this._y0+4*this._y1+t)/6;this._line?this._context.lineTo(n,r):this._context.moveTo(n,r);break;case 3:this._point=4;default:Ji(this,e,t)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}},to.prototype={areaStart:Yi,areaEnd:Yi,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(e,t){e=+e,t=+t,this._point?this._context.lineTo(e,t):(this._point=1,this._context.moveTo(e,t))}},oo.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:io(this,this._t0,ao(this,this._t0))}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){var n=NaN;if(t=+t,(e=+e)!==this._x1||t!==this._y1){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,io(this,ao(this,n=ro(this,e,t)),n);break;default:io(this,this._t0,n=ro(this,e,t))}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=n}}},(so.prototype=Object.create(oo.prototype)).point=function(e,t){oo.prototype.point.call(this,t,e)},lo.prototype={moveTo:function(e,t){this._context.moveTo(t,e)},closePath:function(){this._context.closePath()},lineTo:function(e,t){this._context.lineTo(t,e)},bezierCurveTo:function(e,t,n,r,a,i){this._context.bezierCurveTo(t,e,r,n,i,a)}},co.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var e=this._x,t=this._y,n=e.length;if(n)if(this._line?this._context.lineTo(e[0],t[0]):this._context.moveTo(e[0],t[0]),2===n)this._context.lineTo(e[1],t[1]);else for(var r=uo(e),a=uo(t),i=0,o=1;o<n;++i,++o)this._context.bezierCurveTo(r[0][i],a[0][i],r[1][i],a[1][i],e[o],t[o]);(this._line||0!==this._line&&1===n)&&this._context.closePath(),this._line=1-this._line,this._x=this._y=null},point:function(e,t){this._x.push(+e),this._y.push(+t)}},fo.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=this._y=NaN,this._point=0},lineEnd:function(){0<this._t&&this._t<1&&2===this._point&&this._context.lineTo(this._x,this._y),(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line>=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:if(this._t<=0)this._context.lineTo(this._x,t),this._context.lineTo(e,t);else{var n=this._x*(1-this._t)+e*this._t;this._context.lineTo(n,this._y),this._context.lineTo(n,t)}}this._x=e,this._y=t}};var go=["type","size","sizeType"];function vo(){return vo=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},vo.apply(this,arguments)}function bo(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function jo(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?bo(Object(n),!0).forEach(function(t){wo(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):bo(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function wo(e,t,n){var r;return r=function(e,t){if("object"!=xo(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=xo(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(t,"string"),(t="symbol"==xo(r)?r:r+"")in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function No(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)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}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var So={symbolCircle:Ti,symbolCross:Di,symbolDiamond:Li,symbolSquare:Bi,symbolStar:Ui,symbolTriangle:Wi,symbolWye:Gi},Oo=Math.PI/180,ko=function(e){var t,n,r=e.type,a=void 0===r?"circle":r,i=e.size,l=void 0===i?64:i,c=e.sizeType,u=void 0===c?"area":c,d=jo(jo({},No(e,go)),{},{type:a,size:l,sizeType:u}),f=d.className,p=d.cx,h=d.cy,m=Pa(d,!0);return p===+p&&h===+h&&l===+l?s.createElement("path",vo({},m,{className:o("recharts-symbols",f),transform:"translate(".concat(p,", ").concat(h,")"),d:(t=function(e){var t="symbol".concat(di(e));return So[t]||Ti}(a),n=function(e,t){let n=null,r=Si(a);function a(){let a;if(n||(n=a=r()),e.apply(this,arguments).draw(n,+t.apply(this,arguments)),a)return n=null,a+""||null}return e="function"==typeof e?e:fi(e||Ti),t="function"==typeof t?t:fi(void 0===t?64:+t),a.type=function(t){return arguments.length?(e="function"==typeof t?t:fi(t),a):e},a.size=function(e){return arguments.length?(t="function"==typeof e?e:fi(+e),a):t},a.context=function(e){return arguments.length?(n=null==e?null:e,a):n},a}().type(t).size(function(e,t,n){if("area"===t)return e;switch(n){case"cross":return 5*e*e/9;case"diamond":return.5*e*e/Math.sqrt(3);case"square":return e*e;case"star":var r=18*Oo;return 1.25*e*e*(Math.tan(r)-Math.tan(2*r)*Math.pow(Math.tan(r),2));case"triangle":return Math.sqrt(3)*e*e/4;case"wye":return(21-10*Math.sqrt(3))*e*e/8;default:return Math.PI*e*e/4}}(l,u,a)),n())})):null};function Ao(e){return(Ao="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Po(){return Po=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},Po.apply(this,arguments)}function Eo(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function _o(e,t,n){return t&&function(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,Ro(r.key),r)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function Co(e,t,n){return t=To(t),function(e,t){if(t&&("object"===Ao(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,Mo()?Reflect.construct(t,n||[],To(e).constructor):t.apply(e,n))}function Mo(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Mo=function(){return!!e})()}function To(e){return(To=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Do(e,t){return(Do=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function Io(e,t,n){return(t=Ro(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ro(e){var t=function(e,t){if("object"!=Ao(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=Ao(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==Ao(t)?t:t+""}ko.registerSymbol=function(e,t){So["symbol".concat(di(e))]=t};var Lo=32,Bo=function(){function e(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),Co(this,e,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)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&&Do(e,t)}(e,i.PureComponent),_o(e,[{key:"renderIcon",value:function(e){var t=this.props.inactiveColor,n=16,r=Lo/6,a=Lo/3,i=e.inactive?t:e.color;if("plainline"===e.type)return s.createElement("line",{strokeWidth:4,fill:"none",stroke:i,strokeDasharray:e.payload.strokeDasharray,x1:0,y1:n,x2:Lo,y2:n,className:"recharts-legend-icon"});if("line"===e.type)return s.createElement("path",{strokeWidth:4,fill:"none",stroke:i,d:"M0,".concat(n,"h").concat(a,"\n A").concat(r,",").concat(r,",0,1,1,").concat(2*a,",").concat(n,"\n H").concat(Lo,"M").concat(2*a,",").concat(n,"\n A").concat(r,",").concat(r,",0,1,1,").concat(a,",").concat(n),className:"recharts-legend-icon"});if("rect"===e.type)return s.createElement("path",{stroke:"none",fill:i,d:"M0,".concat(4,"h").concat(Lo,"v").concat(24,"h").concat(-32,"z"),className:"recharts-legend-icon"});if(s.isValidElement(e.legendIcon)){var o=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Eo(Object(n),!0).forEach(function(t){Io(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Eo(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}({},e);return delete o.legendIcon,s.cloneElement(e.legendIcon,o)}return s.createElement(ko,{fill:i,cx:n,cy:n,size:Lo,sizeType:"diameter",type:e.type})}},{key:"renderItems",value:function(){var e=this,t=this.props,n=t.payload,r=t.iconSize,a=t.layout,i=t.formatter,l=t.inactiveColor,c={x:0,y:0,width:Lo,height:Lo},u={display:"horizontal"===a?"inline-block":"block",marginRight:10},d={display:"inline-block",verticalAlign:"middle",marginRight:4};return n.map(function(t,n){var a=t.formatter||i,f=o(Io(Io({"recharts-legend-item":!0},"legend-item-".concat(n),!0),"inactive",t.inactive));if("none"===t.type)return null;var p=kt(t.value)?null:t.value;$a(!kt(t.value),'The name property is also required when using a function for the dataKey of a chart\'s cartesian components. Ex: <Bar name="Name of my Data"/>');var h=t.inactive?l:t.color;return s.createElement("li",Po({className:f,style:u,key:"legend-item-".concat(n)},pa(e.props,t,n)),s.createElement(Ia,{width:r,height:r,viewBox:c,style:d},e.renderIcon(t)),s.createElement("span",{className:"recharts-legend-item-text",style:{color:h}},a?a(p,t,n):p))})}},{key:"render",value:function(){var e=this.props,t=e.payload,n=e.layout,r=e.align;if(!t||!t.length)return null;var a={padding:0,margin:0,textAlign:"horizontal"===n?r:"left"};return s.createElement("ul",{className:"recharts-default-legend",style:a},this.renderItems())}}])}();Io(Bo,"displayName","Legend"),Io(Bo,"defaultProps",{iconSize:14,layout:"horizontal",align:"center",verticalAlign:"middle",inactiveColor:"#ccc"});var zo=On;var $o=On,Fo=kn,Uo=Un;var qo=On,Wo=function(){this.__data__=new zo,this.size=0},Ho=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},Vo=function(e){return this.__data__.get(e)},Ko=function(e){return this.__data__.has(e)},Xo=function(e,t){var n=this.__data__;if(n instanceof $o){var r=n.__data__;if(!Fo||r.length<199)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new Uo(r)}return n.set(e,t),this.size=n.size,this};function Go(e){var t=this.__data__=new qo(e);this.size=t.size}Go.prototype.clear=Wo,Go.prototype.delete=Ho,Go.prototype.get=Vo,Go.prototype.has=Ko,Go.prototype.set=Xo;var Yo=Go;var Jo=Un,Zo=function(e){return this.__data__.set(e,"__lodash_hash_undefined__"),this},Qo=function(e){return this.__data__.has(e)};function es(e){var t=-1,n=null==e?0:e.length;for(this.__data__=new Jo;++t<n;)this.add(e[t])}es.prototype.add=es.prototype.push=Zo,es.prototype.has=Qo;var ts=es;var ns=function(e,t){for(var n=-1,r=null==e?0:e.length;++n<r;)if(t(e[n],n,e))return!0;return!1};var rs=function(e,t){return e.has(t)},as=ts,is=ns,os=rs;var ss=function(e,t,n,r,a,i){var o=1&n,s=e.length,l=t.length;if(s!=l&&!(o&&l>s))return!1;var c=i.get(e),u=i.get(t);if(c&&u)return c==t&&u==e;var d=-1,f=!0,p=2&n?new as:void 0;for(i.set(e,t),i.set(t,e);++d<s;){var h=e[d],m=t[d];if(r)var y=o?r(m,h,d,t,e,i):r(h,m,d,e,t,i);if(void 0!==y){if(y)continue;f=!1;break}if(p){if(!is(t,function(e,t){if(!os(p,t)&&(h===e||a(h,e,n,r,i)))return p.push(t)})){f=!1;break}}else if(h!==m&&!a(h,m,n,r,i)){f=!1;break}}return i.delete(e),i.delete(t),f};var ls=function(e){var t=-1,n=Array(e.size);return e.forEach(function(e){n[++t]=e}),n},cs=Qe.Uint8Array,us=dn,ds=ss,fs=function(e){var t=-1,n=Array(e.size);return e.forEach(function(e,r){n[++t]=[r,e]}),n},ps=ls,hs=et?et.prototype:void 0,ms=hs?hs.valueOf:void 0;var ys=function(e,t,n,r,a,i,o){switch(n){case"[object DataView]":if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case"[object ArrayBuffer]":return!(e.byteLength!=t.byteLength||!i(new cs(e),new cs(t)));case"[object Boolean]":case"[object Date]":case"[object Number]":return us(+e,+t);case"[object Error]":return e.name==t.name&&e.message==t.message;case"[object RegExp]":case"[object String]":return e==t+"";case"[object Map]":var s=fs;case"[object Set]":var l=1&r;if(s||(s=ps),e.size!=t.size&&!l)return!1;var c=o.get(e);if(c)return c==t;r|=2,o.set(e,t);var u=ds(s(e),s(t),r,a,i,o);return o.delete(e),u;case"[object Symbol]":if(ms)return ms.call(e)==ms.call(t)}return!1};var xs=function(e,t){for(var n=-1,r=t.length,a=e.length;++n<r;)e[a+n]=t[n];return e},gs=xs,vs=Ge;var bs=function(e,t,n){var r=t(e);return vs(e)?r:gs(r,n(e))};var js=function(e,t){for(var n=-1,r=null==e?0:e.length,a=0,i=[];++n<r;){var o=e[n];t(o,n,e)&&(i[a++]=o)}return i},ws=function(){return[]},Ns=Object.prototype.propertyIsEnumerable,Ss=Object.getOwnPropertySymbols,Os=Ss?function(e){return null==e?[]:(e=Object(e),js(Ss(e),function(t){return Ns.call(e,t)}))}:ws;var ks=function(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r},As=dt,Ps=ft;var Es,_s,Cs,Ms,Ts,Ds,Is,Rs,Ls=function(e){return Ps(e)&&"[object Arguments]"==As(e)},Bs=ft,zs=Object.prototype,$s=zs.hasOwnProperty,Fs=zs.propertyIsEnumerable,Us=Ls(function(){return arguments}())?Ls:function(e){return Bs(e)&&$s.call(e,"callee")&&!Fs.call(e,"callee")},qs={exports:{}};Es=qs,Cs=Qe,Ms=function(){return!1},Ts=(_s=qs.exports)&&!_s.nodeType&&_s,Ds=Ts&&Es&&!Es.nodeType&&Es,Is=Ds&&Ds.exports===Ts?Cs.Buffer:void 0,Rs=(Is?Is.isBuffer:void 0)||Ms,Es.exports=Rs;var Ws=qs.exports,Hs=/^(?:0|[1-9]\d*)$/;var Vs=function(e,t){var n=typeof e;return!!(t=null==t?9007199254740991:t)&&("number"==n||"symbol"!=n&&Hs.test(e))&&e>-1&&e%1==0&&e<t};var Ks=function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991},Xs=dt,Gs=Ks,Ys=ft,Js={};Js["[object Float32Array]"]=Js["[object Float64Array]"]=Js["[object Int8Array]"]=Js["[object Int16Array]"]=Js["[object Int32Array]"]=Js["[object Uint8Array]"]=Js["[object Uint8ClampedArray]"]=Js["[object Uint16Array]"]=Js["[object Uint32Array]"]=!0,Js["[object Arguments]"]=Js["[object Array]"]=Js["[object ArrayBuffer]"]=Js["[object Boolean]"]=Js["[object DataView]"]=Js["[object Date]"]=Js["[object Error]"]=Js["[object Function]"]=Js["[object Map]"]=Js["[object Number]"]=Js["[object Object]"]=Js["[object RegExp]"]=Js["[object Set]"]=Js["[object String]"]=Js["[object WeakMap]"]=!1;var Zs=function(e){return Ys(e)&&Gs(e.length)&&!!Js[Xs(e)]};var Qs=function(e){return function(t){return e(t)}},el={exports:{}};!function(e,t){var n=Ye,r=t&&!t.nodeType&&t,a=r&&e&&!e.nodeType&&e,i=a&&a.exports===r&&n.process,o=function(){try{var e=a&&a.require&&a.require("util").types;return e||i&&i.binding&&i.binding("util")}catch(t){}}();e.exports=o}(el,el.exports);var tl=el.exports,nl=Zs,rl=Qs,al=tl&&tl.isTypedArray,il=al?rl(al):nl,ol=ks,sl=Us,ll=Ge,cl=Ws,ul=Vs,dl=il,fl=Object.prototype.hasOwnProperty;var pl=function(e,t){var n=ll(e),r=!n&&sl(e),a=!n&&!r&&cl(e),i=!n&&!r&&!a&&dl(e),o=n||r||a||i,s=o?ol(e.length,String):[],l=s.length;for(var c in e)!t&&!fl.call(e,c)||o&&("length"==c||a&&("offset"==c||"parent"==c)||i&&("buffer"==c||"byteLength"==c||"byteOffset"==c)||ul(c,l))||s.push(c);return s},hl=Object.prototype;var ml=function(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||hl)};var yl=function(e,t){return function(n){return e(t(n))}},xl=yl(Object.keys,Object),gl=ml,vl=xl,bl=Object.prototype.hasOwnProperty;var jl=Ot,wl=Ks;var Nl=function(e){return null!=e&&wl(e.length)&&!jl(e)},Sl=pl,Ol=function(e){if(!gl(e))return vl(e);var t=[];for(var n in Object(e))bl.call(e,n)&&"constructor"!=n&&t.push(n);return t},kl=Nl;var Al=function(e){return kl(e)?Sl(e):Ol(e)},Pl=bs,El=Os,_l=Al;var Cl=function(e){return Pl(e,_l,El)},Ml=Object.prototype.hasOwnProperty;var Tl=function(e,t,n,r,a,i){var o=1&n,s=Cl(e),l=s.length;if(l!=Cl(t).length&&!o)return!1;for(var c=l;c--;){var u=s[c];if(!(o?u in t:Ml.call(t,u)))return!1}var d=i.get(e),f=i.get(t);if(d&&f)return d==t&&f==e;var p=!0;i.set(e,t),i.set(t,e);for(var h=o;++c<l;){var m=e[u=s[c]],y=t[u];
vendor: 1,398 bytes, line 13
13if(r)var x=o?r(y,m,u,t,e,i):r(m,y,u,e,t,i);if(!(void 0===x?m===y||a(m,y,n,r,i):x)){p=!1;break}h||(h="constructor"==u)}if(p&&!h){var g=e.constructor,v=t.constructor;g==v||!("constructor"in e)||!("constructor"in t)||"function"==typeof g&&g instanceof g&&"function"==typeof v&&v instanceof v||(p=!1)}return i.delete(e),i.delete(t),p},Dl=Ht(Qe,"DataView"),Il=Ht(Qe,"Promise"),Rl=Ht(Qe,"Set"),Ll=Dl,Bl=kn,zl=Il,$l=Rl,Fl=Ht(Qe,"WeakMap"),Ul=dt,ql=Mt,Wl="[object Map]",Hl="[object Promise]",Vl="[object Set]",Kl="[object WeakMap]",Xl="[object DataView]",Gl=ql(Ll),Yl=ql(Bl),Jl=ql(zl),Zl=ql($l),Ql=ql(Fl),ec=Ul;(Ll&&ec(new Ll(new ArrayBuffer(1)))!=Xl||Bl&&ec(new Bl)!=Wl||zl&&ec(zl.resolve())!=Hl||$l&&ec(new $l)!=Vl||Fl&&ec(new Fl)!=Kl)&&(ec=function(e){var t=Ul(e),n="[object Object]"==t?e.constructor:void 0,r=n?ql(n):"";if(r)switch(r){case Gl:return Xl;case Yl:return Wl;case Jl:return Hl;case Zl:return Vl;case Ql:return Kl}return t});var tc=Yo,nc=ss,rc=ys,ac=Tl,ic=ec,oc=Ge,sc=Ws,lc=il,cc="[object Arguments]",uc="[object Array]",dc="[object Object]",fc=Object.prototype.hasOwnProperty;var pc=function(e,t,n,r,a,i){var o=oc(e),s=oc(t),l=o?uc:ic(e),c=s?uc:ic(t),u=(l=l==cc?dc:l)==dc,d=(c=c==cc?dc:c)==dc,f=l==c;if(f&&sc(e)){if(!sc(t))return!1;o=!0,u=!1}if(f&&!u)return i||(i=new tc),o||lc(e)?nc(e,t,n,r,a,i):rc(e,t,l,n,r,a,i);if(!(1&n)){var p=u&&fc.call(e,"__wrapped__"),h=d&&fc.call(t,"__wrapped__");
vendor: 40,794 bytes, line 13
13if(p||h){var m=p?e.value():e,y=h?t.value():t;return i||(i=new tc),a(m,y,n,r,i)}}return!!f&&(i||(i=new tc),ac(e,t,n,r,a,i))},hc=ft;var mc=function e(t,n,r,a,i){return t===n||(null==t||null==n||!hc(t)&&!hc(n)?t!=t&&n!=n:pc(t,n,r,a,e,i))},yc=Yo,xc=mc;var gc=jt;var vc=function(e){return e==e&&!gc(e)},bc=vc,jc=Al;var wc=function(e,t){return function(n){return null!=n&&(n[e]===t&&(void 0!==t||e in Object(n)))}},Nc=function(e,t,n,r){var a=n.length,i=a,o=!r;if(null==e)return!i;for(e=Object(e);a--;){var s=n[a];if(o&&s[2]?s[1]!==e[s[0]]:!(s[0]in e))return!1}for(;++a<i;){var l=(s=n[a])[0],c=e[l],u=s[1];if(o&&s[2]){if(void 0===c&&!(l in e))return!1}else{var d=new yc;if(r)var f=r(c,u,l,e,t,d);if(!(void 0===f?xc(u,c,3,r,d):f))return!1}}return!0},Sc=function(e){for(var t=jc(e),n=t.length;n--;){var r=t[n],a=e[r];t[n]=[r,a,bc(a)]}return t},Oc=wc;var kc=ur,Ac=Us,Pc=Ge,Ec=Vs,_c=Ks,Cc=fr;var Mc=function(e,t){return null!=e&&t in Object(e)},Tc=function(e,t,n){for(var r=-1,a=(t=kc(t,e)).length,i=!1;++r<a;){var o=Cc(t[r]);if(!(i=null!=e&&n(e,o)))break;e=e[o]}return i||++r!=a?i:!!(a=null==e?0:e.length)&&_c(a)&&Ec(o,a)&&(Pc(e)||Ac(e))};var Dc=mc,Ic=xr,Rc=function(e,t){return null!=e&&Tc(e,t,Mc)},Lc=bt,Bc=vc,zc=wc,$c=fr;var Fc=function(e){return e};var Uc=mr;var qc=function(e){return function(t){return null==t?void 0:t[e]}},Wc=function(e){return function(t){return Uc(t,e)}},Hc=bt,Vc=fr;var Kc=function(e){var t=Sc(e);return 1==t.length&&t[0][2]?Oc(t[0][0],t[0][1]):function(n){return n===e||Nc(n,e,t)}},Xc=function(e,t){return Lc(e)&&Bc(t)?zc($c(e),t):function(n){var r=Ic(n,e);return void 0===r&&r===t?Rc(n,e):Dc(t,r,3)}},Gc=Fc,Yc=Ge,Jc=function(e){return Hc(e)?qc(Vc(e)):Wc(e)};var Zc=function(e){return"function"==typeof e?e:null==e?Gc:"object"==typeof e?Yc(e)?Xc(e[0],e[1]):Kc(e):Jc(e)};var Qc=function(e,t,n,r){for(var a=e.length,i=n+(r?1:-1);r?i--:++i<a;)if(t(e[i],i,e))return i;return-1};var eu=Qc,tu=function(e){return e!=e},nu=function(e,t,n){for(var r=n-1,a=e.length;++r<a;)if(e[r]===t)return r;return-1};var ru=function(e,t,n){return t==t?nu(e,t,n):eu(e,tu,n)};var au=function(e,t){return!!(null==e?0:e.length)&&ru(e,t,0)>-1};var iu=function(e,t,n){for(var r=-1,a=null==e?0:e.length;++r<a;)if(n(t,e[r]))return!0;return!1};var ou=Rl,su=function(){},lu=ou&&1/ls(new ou([,-0]))[1]==1/0?function(e){return new ou(e)}:su,cu=ts,uu=au,du=iu,fu=rs,pu=lu,hu=ls;var mu=Zc,yu=function(e,t,n){var r=-1,a=uu,i=e.length,o=!0,s=[],l=s;if(n)o=!1,a=du;else if(i>=200){var c=t?null:pu(e);if(c)return hu(c);o=!1,a=fu,l=new cu}else l=t?[]:s;e:for(;++r<i;){var u=e[r],d=t?t(u):u;if(u=n||0!==u?u:0,o&&d==d){for(var f=l.length;f--;)if(l[f]===d)continue e;t&&l.push(d),s.push(u)}else a(l,d,n)||(l!==s&&l.push(d),s.push(u))}return s};const xu=a(function(e,t){return e&&e.length?yu(e,mu(t)):[]});function gu(e,t,n){return!0===t?xu(e,n):kt(t)?xu(e,t):e}function vu(e){return(vu="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var bu=["ref"];function ju(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function wu(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ju(Object(n),!0).forEach(function(t){Pu(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ju(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Nu(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,Eu(r.key),r)}}function Su(e,t,n){return t=ku(t),function(e,t){if(t&&("object"===vu(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,Ou()?Reflect.construct(t,n||[],ku(e).constructor):t.apply(e,n))}function Ou(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Ou=function(){return!!e})()}function ku(e){return(ku=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Au(e,t){return(Au=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function Pu(e,t,n){return(t=Eu(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Eu(e){var t=function(e,t){if("object"!=vu(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=vu(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==vu(t)?t:t+""}function _u(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)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}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}function Cu(e){return e.value}var Mu=function(){function e(){var t;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e);for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Pu(t=Su(this,e,[].concat(r)),"lastBoundingBox",{width:-1,height:-1}),t}return function(e,t){if("function"!=typeof t&&null!==t)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&&Au(e,t)}(e,i.PureComponent),t=e,r=[{key:"getWithHeight",value:function(e,t){var n=wu(wu({},this.defaultProps),e.props).layout;return"vertical"===n&&Jr(e.props.height)?{height:e.props.height}:"horizontal"===n?{width:e.props.width||t}:null}}],(n=[{key:"componentDidMount",value:function(){this.updateBBox()}},{key:"componentDidUpdate",value:function(){this.updateBBox()}},{key:"getBBox",value:function(){if(this.wrapperNode&&this.wrapperNode.getBoundingClientRect){var e=this.wrapperNode.getBoundingClientRect();return e.height=this.wrapperNode.offsetHeight,e.width=this.wrapperNode.offsetWidth,e}return null}},{key:"updateBBox",value:function(){var e=this.props.onBBoxUpdate,t=this.getBBox();t?(Math.abs(t.width-this.lastBoundingBox.width)>1||Math.abs(t.height-this.lastBoundingBox.height)>1)&&(this.lastBoundingBox.width=t.width,this.lastBoundingBox.height=t.height,e&&e(t)):-1===this.lastBoundingBox.width&&-1===this.lastBoundingBox.height||(this.lastBoundingBox.width=-1,this.lastBoundingBox.height=-1,e&&e(null))}},{key:"getBBoxSnapshot",value:function(){return this.lastBoundingBox.width>=0&&this.lastBoundingBox.height>=0?wu({},this.lastBoundingBox):{width:0,height:0}}},{key:"getDefaultPosition",value:function(e){var t,n,r=this.props,a=r.layout,i=r.align,o=r.verticalAlign,s=r.margin,l=r.chartWidth,c=r.chartHeight;return e&&(void 0!==e.left&&null!==e.left||void 0!==e.right&&null!==e.right)||(t="center"===i&&"vertical"===a?{left:((l||0)-this.getBBoxSnapshot().width)/2}:"right"===i?{right:s&&s.right||0}:{left:s&&s.left||0}),e&&(void 0!==e.top&&null!==e.top||void 0!==e.bottom&&null!==e.bottom)||(n="middle"===o?{top:((c||0)-this.getBBoxSnapshot().height)/2}:"bottom"===o?{bottom:s&&s.bottom||0}:{top:s&&s.top||0}),wu(wu({},t),n)}},{key:"render",value:function(){var e=this,t=this.props,n=t.content,r=t.width,a=t.height,i=t.wrapperStyle,o=t.payloadUniqBy,l=t.payload,c=wu(wu({position:"absolute",width:r||"auto",height:a||"auto"},this.getDefaultPosition(i)),i);return s.createElement("div",{className:"recharts-legend-wrapper",style:c,ref:function(t){e.wrapperNode=t}},function(e,t){if(s.isValidElement(e))return s.cloneElement(e,t);if("function"==typeof e)return s.createElement(e,t);t.ref;var n=_u(t,bu);return s.createElement(Bo,n)}(n,wu(wu({},this.props),{},{payload:gu(l,o,Cu)})))}}])&&Nu(t.prototype,n),r&&Nu(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,n,r}();Pu(Mu,"displayName","Legend"),Pu(Mu,"defaultProps",{iconSize:14,layout:"horizontal",align:"center",verticalAlign:"bottom"});var Tu=Us,Du=Ge,Iu=et?et.isConcatSpreadable:void 0;var Ru=xs,Lu=function(e){return Du(e)||Tu(e)||!!(Iu&&e&&e[Iu])};var Bu=function e(t,n,r,a,i){var o=-1,s=t.length;for(r||(r=Lu),i||(i=[]);++o<s;){var l=t[o];n>0&&r(l)?n>1?e(l,n-1,r,a,i):Ru(i,l):a||(i[i.length]=l)}return i};var zu=function(e){return function(t,n,r){for(var a=-1,i=Object(t),o=r(t),s=o.length;s--;){var l=o[e?s:++a];if(!1===n(i[l],l,i))break}return t}}(),$u=Al;var Fu=function(e,t){return e&&zu(e,t,$u)},Uu=Nl;var qu=function(e,t){return function(n,r){if(null==n)return n;if(!Uu(n))return e(n,r);for(var a=n.length,i=t?a:-1,o=Object(n);(t?i--:++i<a)&&!1!==r(o[i],i,o););return n}}(Fu),Wu=qu,Hu=Nl;var Vu=function(e,t){var n=-1,r=Hu(e)?Array(e.length):[];return Wu(e,function(e,a,i){r[++n]=t(e,a,i)}),r};var Ku=mt;var Xu=function(e,t){if(e!==t){var n=void 0!==e,r=null===e,a=e==e,i=Ku(e),o=void 0!==t,s=null===t,l=t==t,c=Ku(t);if(!s&&!c&&!i&&e>t||i&&o&&l&&!s&&!c||r&&o&&l||!n&&l||!a)return 1;if(!r&&!i&&!c&&e<t||c&&n&&a&&!r&&!i||s&&n&&a||!o&&a||!l)return-1}return 0};var Gu=Jn,Yu=mr,Ju=Zc,Zu=Vu,Qu=function(e,t){var n=e.length;for(e.sort(t);n--;)e[n]=e[n].value;return e},ed=Qs,td=function(e,t,n){for(var r=-1,a=e.criteria,i=t.criteria,o=a.length,s=n.length;++r<o;){var l=Xu(a[r],i[r]);if(l)return r>=s?l:l*("desc"==n[r]?-1:1)}return e.index-t.index},nd=Fc,rd=Ge;var ad=function(e,t,n){t=t.length?Gu(t,function(e){return rd(e)?function(t){return Yu(t,1===e.length?e[0]:e)}:e}):[nd];var r=-1;t=Gu(t,ed(Ju));var a=Zu(e,function(e,n,a){return{criteria:Gu(t,function(t){return t(e)}),index:++r,value:e}});return Qu(a,function(e,t){return td(e,t,n)})};var id=function(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)},od=Math.max;var sd=function(e,t,n){return t=od(void 0===t?e.length-1:t,0),function(){for(var r=arguments,a=-1,i=od(r.length-t,0),o=Array(i);++a<i;)o[a]=r[t+a];a=-1;for(var s=Array(t+1);++a<t;)s[a]=r[a];return s[t]=n(o),id(e,this,s)}};var ld=function(e){return function(){return e}},cd=Ht,ud=function(){try{var e=cd(Object,"defineProperty");return e({},"",{}),e}catch(t){}}(),dd=ld,fd=ud,pd=fd?function(e,t){return fd(e,"toString",{configurable:!0,enumerable:!1,value:dd(t),writable:!0})}:Fc,hd=Date.now;var md=function(e){var t=0,n=0;return function(){var r=hd(),a=16-(r-n);if(n=r,a>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}(pd),yd=Fc,xd=sd,gd=md;var vd=dn,bd=Nl,jd=Vs,wd=jt;var Nd=function(e,t,n){if(!wd(n))return!1;var r=typeof t;return!!("number"==r?bd(n)&&jd(t,n.length):"string"==r&&t in n)&&vd(n[t],e)},Sd=Bu,Od=ad,kd=Nd;const Ad=a(function(e,t){return gd(xd(e,t,yd),e+"")}(function(e,t){if(null==e)return[];var n=t.length;return n>1&&kd(e,t[0],t[1])?t=[]:n>2&&kd(t[0],t[1],t[2])&&(t=[t[0]]),Od(e,Sd(t,1),[])}));function Pd(e){return(Pd="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Ed(){return Ed=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},Ed.apply(this,arguments)}function _d(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,i,o,s=[],l=!0,c=!1;try{if(i=(n=n.call(e)).next,0===t);else for(;!(l=(r=i.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(u){c=!0,a=u}finally{try{if(!l&&null!=n.return&&(o=n.return(),Object(o)!==o))return}finally{if(c)throw a}}return s}}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return Cd(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Cd(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Cd(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Md(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Td(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Md(Object(n),!0).forEach(function(t){Dd(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Md(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Dd(e,t,n){var r;return r=function(e,t){if("object"!=Pd(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=Pd(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(t,"string"),(t="symbol"==Pd(r)?r:r+"")in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Id(e){return Array.isArray(e)&&Zr(e[0])&&Zr(e[1])?e.join(" ~ "):e}var Rd=function(e){var t=e.separator,n=void 0===t?" : ":t,r=e.contentStyle,a=void 0===r?{}:r,i=e.itemStyle,l=void 0===i?{}:i,c=e.labelStyle,u=void 0===c?{}:c,d=e.payload,f=e.formatter,p=e.itemSorter,h=e.wrapperClassName,m=e.labelClassName,y=e.label,x=e.labelFormatter,g=e.accessibilityLayer,v=void 0!==g&&g,b=Td({margin:0,padding:10,backgroundColor:"#fff",border:"1px solid #ccc",whiteSpace:"nowrap"},a),j=Td({margin:0},u),w=!vr(y),N=w?y:"",S=o("recharts-default-tooltip",h),O=o("recharts-tooltip-label",m);w&&x&&null!=d&&(N=x(y,d));var k=v?{role:"status","aria-live":"assertive"}:{};return s.createElement("div",Ed({className:S,style:b},k),s.createElement("p",{className:O,style:j},s.isValidElement(N)?N:"".concat(N)),function(){if(d&&d.length){var e=(p?Ad(d,p):d).map(function(e,t){if("none"===e.type)return null;var r=Td({display:"block",paddingTop:4,paddingBottom:4,color:e.color||"#000"},l),a=e.formatter||f||Id,i=e.value,o=e.name,c=i,u=o;if(a&&null!=c&&null!=u){var p=a(i,o,e,t,d);if(Array.isArray(p)){var h=_d(p,2);c=h[0],u=h[1]}else c=p}return s.createElement("li",{className:"recharts-tooltip-item",key:"tooltip-item-".concat(t),style:r},Zr(u)?s.createElement("span",{className:"recharts-tooltip-item-name"},u):null,Zr(u)?s.createElement("span",{className:"recharts-tooltip-item-separator"},n):null,s.createElement("span",{className:"recharts-tooltip-item-value"},c),s.createElement("span",{className:"recharts-tooltip-item-unit"},e.unit||""))});return s.createElement("ul",{className:"recharts-tooltip-item-list",style:{padding:0,margin:0}},e)}return null}())};function Ld(e){return(Ld="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Bd(e,t,n){var r;return r=function(e,t){if("object"!=Ld(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=Ld(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(t,"string"),(t="symbol"==Ld(r)?r:r+"")in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var zd="recharts-tooltip-wrapper",$d={visibility:"hidden"};function Fd(e){var t=e.coordinate,n=e.translateX,r=e.translateY;return o(zd,Bd(Bd(Bd(Bd({},"".concat(zd,"-right"),Jr(n)&&t&&Jr(t.x)&&n>=t.x),"".concat(zd,"-left"),Jr(n)&&t&&Jr(t.x)&&n<t.x),"".concat(zd,"-bottom"),Jr(r)&&t&&Jr(t.y)&&r>=t.y),"".concat(zd,"-top"),Jr(r)&&t&&Jr(t.y)&&r<t.y))}function Ud(e){var t=e.allowEscapeViewBox,n=e.coordinate,r=e.key,a=e.offsetTopLeft,i=e.position,o=e.reverseDirection,s=e.tooltipDimension,l=e.viewBox,c=e.viewBoxDimension;if(i&&Jr(i[r]))return i[r];var u=n[r]-s-a,d=n[r]+a;return t[r]?o[r]?u:d:o[r]?u<l[r]?Math.max(d,l[r]):Math.max(u,l[r]):d+s>l[r]+c?Math.max(u,l[r]):Math.max(d,l[r])}function qd(e){return(qd="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Wd(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Hd(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Wd(Object(n),!0).forEach(function(t){Jd(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Wd(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Vd(e,t,n){return t&&function(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,Zd(r.key),r)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function Kd(e,t,n){return t=Gd(t),function(e,t){if(t&&("object"===qd(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,Xd()?Reflect.construct(t,n||[],Gd(e).constructor):t.apply(e,n))}function Xd(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Xd=function(){return!!e})()}function Gd(e){return(Gd=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Yd(e,t){return(Yd=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function Jd(e,t,n){return(t=Zd(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Zd(e){var t=function(e,t){if("object"!=qd(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=qd(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==qd(t)?t:t+""}var Qd=function(){function e(){var t;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e);for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Jd(t=Kd(this,e,[].concat(r)),"state",{dismissed:!1,dismissedAtCoordinate:{x:0,y:0},lastBoundingBox:{width:-1,height:-1}}),Jd(t,"handleKeyDown",function(e){var n,r,a,i;"Escape"===e.key&&t.setState({dismissed:!0,dismissedAtCoordinate:{x:null!==(n=null===(r=t.props.coordinate)||void 0===r?void 0:r.x)&&void 0!==n?n:0,y:null!==(a=null===(i=t.props.coordinate)||void 0===i?void 0:i.y)&&void 0!==a?a:0}})}),t}return function(e,t){if("function"!=typeof t&&null!==t)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&&Yd(e,t)}(e,i.PureComponent),Vd(e,[{key:"updateBBox",value:function(){if(this.wrapperNode&&this.wrapperNode.getBoundingClientRect){var e=this.wrapperNode.getBoundingClientRect();(Math.abs(e.width-this.state.lastBoundingBox.width)>1||Math.abs(e.height-this.state.lastBoundingBox.height)>1)&&this.setState({lastBoundingBox:{width:e.width,height:e.height}})}else-1===this.state.lastBoundingBox.width&&-1===this.state.lastBoundingBox.height||this.setState({lastBoundingBox:{width:-1,height:-1}})}},{key:"componentDidMount",value:function(){document.addEventListener("keydown",this.handleKeyDown),this.updateBBox()}},{key:"componentWillUnmount",value:function(){document.removeEventListener("keydown",this.handleKeyDown)}},{key:"componentDidUpdate",value:function(){var e,t;this.props.active&&this.updateBBox(),this.state.dismissed&&((null===(e=this.props.coordinate)||void 0===e?void 0:e.x)===this.state.dismissedAtCoordinate.x&&(null===(t=this.props.coordinate)||void 0===t?void 0:t.y)===this.state.dismissedAtCoordinate.y||(this.state.dismissed=!1))}},{key:"render",value:function(){var e=this,t=this.props,n=t.active,r=t.allowEscapeViewBox,a=t.animationDuration,i=t.animationEasing,o=t.children,l=t.coordinate,c=t.hasPayload,u=t.isAnimationActive,d=t.offset,f=t.position,p=t.reverseDirection,h=t.useTranslate3d,m=t.viewBox,y=t.wrapperStyle,x=function(e){var t,n,r=e.allowEscapeViewBox,a=e.coordinate,i=e.offsetTopLeft,o=e.position,s=e.reverseDirection,l=e.tooltipBox,c=e.useTranslate3d,u=e.viewBox;return{cssProperties:l.height>0&&l.width>0&&a?function(e){var t=e.translateX,n=e.translateY;return{transform:e.useTranslate3d?"translate3d(".concat(t,"px, ").concat(n,"px, 0)"):"translate(".concat(t,"px, ").concat(n,"px)")}}({translateX:t=Ud({allowEscapeViewBox:r,coordinate:a,key:"x",offsetTopLeft:i,position:o,reverseDirection:s,tooltipDimension:l.width,viewBox:u,viewBoxDimension:u.width}),translateY:n=Ud({allowEscapeViewBox:r,coordinate:a,key:"y",offsetTopLeft:i,position:o,reverseDirection:s,tooltipDimension:l.height,viewBox:u,viewBoxDimension:u.height}),useTranslate3d:c}):$d,cssClasses:Fd({translateX:t,translateY:n,coordinate:a})}}({allowEscapeViewBox:r,coordinate:l,offsetTopLeft:d,position:f,reverseDirection:p,tooltipBox:this.state.lastBoundingBox,useTranslate3d:h,viewBox:m}),g=x.cssClasses,v=x.cssProperties,b=Hd(Hd({transition:u&&n?"transform ".concat(a,"ms ").concat(i):void 0},v),{},{pointerEvents:"none",visibility:!this.state.dismissed&&n&&c?"visible":"hidden",position:"absolute",top:0,left:0},y);return s.createElement("div",{tabIndex:-1,className:g,style:b,ref:function(t){e.wrapperNode=t}},o)}}])}(),ef={isSsr:!("undefined"!=typeof window&&window.document&&window.document.createElement&&window.setTimeout),get:function(e){return ef[e]},set:function(e,t){if("string"==typeof e)ef[e]=t;else{var n=Object.keys(e);n&&n.length&&n.forEach(function(t){ef[t]=e[t]})}}};function tf(e){return(tf="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function nf(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function rf(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?nf(Object(n),!0).forEach(function(t){uf(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):nf(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function af(e,t,n){return t&&function(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,df(r.key),r)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function of(e,t,n){return t=lf(t),function(e,t){if(t&&("object"===tf(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,sf()?Reflect.construct(t,n||[],lf(e).constructor):t.apply(e,n))}function sf(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(sf=function(){return!!e})()}function lf(e){return(lf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function cf(e,t){return(cf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function uf(e,t,n){return(t=df(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function df(e){var t=function(e,t){if("object"!=tf(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=tf(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==tf(t)?t:t+""}function ff(e){return e.dataKey}var pf=function(){function e(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),of(this,e,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)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&&cf(e,t)}(e,i.PureComponent),af(e,[{key:"render",value:function(){var e=this,t=this.props,n=t.active,r=t.allowEscapeViewBox,a=t.animationDuration,i=t.animationEasing,o=t.content,l=t.coordinate,c=t.filterNull,u=t.isAnimationActive,d=t.offset,f=t.payload,p=t.payloadUniqBy,h=t.position,m=t.reverseDirection,y=t.useTranslate3d,x=t.viewBox,g=t.wrapperStyle,v=null!=f?f:[];c&&v.length&&(v=gu(f.filter(function(t){return null!=t.value&&(!0!==t.hide||e.props.includeHidden)}),p,ff));var b=v.length>0;return s.createElement(Qd,{allowEscapeViewBox:r,animationDuration:a,animationEasing:i,isAnimationActive:u,active:n,coordinate:l,hasPayload:b,offset:d,position:h,reverseDirection:m,useTranslate3d:y,viewBox:x,wrapperStyle:g},function(e,t){return s.isValidElement(e)?s.cloneElement(e,t):"function"==typeof e?s.createElement(e,t):s.createElement(Rd,t)}(o,rf(rf({},this.props),{},{payload:v})))}}])}();uf(pf,"displayName","Tooltip"),uf(pf,"defaultProps",{accessibilityLayer:!1,allowEscapeViewBox:{x:!1,y:!1},animationDuration:400,animationEasing:"ease",contentStyle:{},coordinate:{x:0,y:0},cursor:!0,cursorStyle:{},filterNull:!0,isAnimationActive:!ef.isSsr,itemStyle:{},labelStyle:{},offset:10,reverseDirection:{x:!1,y:!1},separator:" : ",trigger:"hover",useTranslate3d:!1,viewBox:{x:0,y:0,height:0,width:0},wrapperStyle:{}});var hf=Qe,mf=/\s/;var yf=function(e){for(var t=e.length;t--&&mf.test(e.charAt(t)););return t},xf=/^\s+/;var gf=function(e){return e?e.slice(0,yf(e)+1).replace(xf,""):e},vf=jt,bf=mt,jf=/^[-+]0x[0-9a-f]+$/i,wf=/^0b[01]+$/i,Nf=/^0o[0-7]+$/i,Sf=parseInt;var Of=function(e){if("number"==typeof e)return e;if(bf(e))return NaN;if(vf(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=vf(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=gf(e);var n=wf.test(e);return n||Nf.test(e)?Sf(e.slice(2),n?2:8):jf.test(e)?NaN:+e},kf=jt,Af=function(){return hf.Date.now()},Pf=Of,Ef=Math.max,_f=Math.min;var Cf=function(e,t,n){var r,a,i,o,s,l,c=0,u=!1,d=!1,f=!0;if("function"!=typeof e)throw new TypeError("Expected a function");function p(t){var n=r,i=a;return r=a=void 0,c=t,o=e.apply(i,n)}function h(e){var n=e-l;return void 0===l||n>=t||n<0||d&&e-c>=i}function m(){var e=Af();if(h(e))return y(e);s=setTimeout(m,function(e){var n=t-(e-l);return d?_f(n,i-(e-c)):n}(e))}function y(e){return s=void 0,f&&r?p(e):(r=a=void 0,o)}function x(){var e=Af(),n=h(e);if(r=arguments,a=this,l=e,n){if(void 0===s)return function(e){return c=e,s=setTimeout(m,t),u?p(e):o}(l);if(d)return clearTimeout(s),s=setTimeout(m,t),p(l)}return void 0===s&&(s=setTimeout(m,t)),o}return t=Pf(t)||0,kf(n)&&(u=!!n.leading,i=(d="maxWait"in n)?Ef(Pf(n.maxWait)||0,t):i,f="trailing"in n?!!n.trailing:f),x.cancel=function(){void 0!==s&&clearTimeout(s),c=0,r=l=a=s=void 0},x.flush=function(){return void 0===s?o:y(Af())},x},Mf=jt;const Tf=a(function(e,t,n){var r=!0,a=!0;if("function"!=typeof e)throw new TypeError("Expected a function");return Mf(n)&&(r="leading"in n?!!n.leading:r,a="trailing"in n?!!n.trailing:a),Cf(e,t,{leading:r,maxWait:t,trailing:a})});function Df(e){return(Df="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function If(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Rf(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?If(Object(n),!0).forEach(function(t){Lf(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):If(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Lf(e,t,n){var r;return r=function(e,t){if("object"!=Df(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=Df(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(t,"string"),(t="symbol"==Df(r)?r:r+"")in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Bf(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,i,o,s=[],l=!0,c=!1;try{if(i=(n=n.call(e)).next,0===t);else for(;!(l=(r=i.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(u){c=!0,a=u}finally{try{if(!l&&null!=n.return&&(o=n.return(),Object(o)!==o))return}finally{if(c)throw a}}return s}}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return zf(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return zf(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function zf(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var $f=i.forwardRef(function(e,t){var n=e.aspect,r=e.initialDimension,a=void 0===r?{width:-1,height:-1}:r,l=e.width,c=void 0===l?"100%":l,u=e.height,d=void 0===u?"100%":u,f=e.minWidth,p=void 0===f?0:f,h=e.minHeight,m=e.maxHeight,y=e.children,x=e.debounce,g=void 0===x?0:x,v=e.id,b=e.className,j=e.onResize,w=e.style,N=void 0===w?{}:w,S=i.useRef(null),O=i.useRef();O.current=j,i.useImperativeHandle(t,function(){return Object.defineProperty(S.current,"current",{get:function(){return console.warn("The usage of ref.current.current is deprecated and will no longer be supported."),S.current},configurable:!0})});var k=Bf(i.useState({containerWidth:a.width,containerHeight:a.height}),2),A=k[0],P=k[1],E=i.useCallback(function(e,t){P(function(n){var r=Math.round(e),a=Math.round(t);return n.containerWidth===r&&n.containerHeight===a?n:{containerWidth:r,containerHeight:a}})},[]);i.useEffect(function(){var e=function(e){var t,n=e[0].contentRect,r=n.width,a=n.height;E(r,a),null===(t=O.current)||void 0===t||t.call(O,r,a)};g>0&&(e=Tf(e,g,{trailing:!0,leading:!1}));var t=new ResizeObserver(e),n=S.current.getBoundingClientRect(),r=n.width,a=n.height;return E(r,a),t.observe(S.current),function(){t.disconnect()}},[E,g]);var _=i.useMemo(function(){var e=A.containerWidth,t=A.containerHeight;if(e<0||t<0)return null;$a(Yr(c)||Yr(d),"The width(%s) and height(%s) are both fixed numbers,\n maybe you don't need to use a ResponsiveContainer.",c,d),$a(!n||n>0,"The aspect(%s) must be greater than zero.",n);var r=Yr(c)?e:c,a=Yr(d)?t:d;n&&n>0&&(r?a=r/n:a&&(r=a*n),m&&a>m&&(a=m)),$a(r>0||a>0,"The width(%s) and height(%s) of chart should be greater than 0,\n please check the style of container, or the props width(%s) and height(%s),\n or add a minWidth(%s) or minHeight(%s) or use aspect(%s) to control the\n height and width.",r,a,c,d,p,h,n);var o=!Array.isArray(y)&&va(y.type).endsWith("Chart");return s.Children.map(y,function(e){return s.isValidElement(e)?i.cloneElement(e,Rf({width:r,height:a},o?{style:Rf({height:"100%",width:"100%",maxHeight:a,maxWidth:r},e.props.style)}:{})):e})},[n,y,d,m,h,p,A,c]);return s.createElement("div",{id:v?"".concat(v):void 0,className:o("recharts-responsive-container",b),style:Rf(Rf({},N),{},{width:c,height:d,minWidth:p,minHeight:h,maxHeight:m}),ref:S},_)}),Ff=function(e){return null};function Uf(e){return(Uf="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function qf(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Wf(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?qf(Object(n),!0).forEach(function(t){Hf(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):qf(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Hf(e,t,n){var r;return r=function(e,t){if("object"!=Uf(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=Uf(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(t,"string"),(t="symbol"==Uf(r)?r:r+"")in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}Ff.displayName="Cell";var Vf={widthCache:{},cacheCount:0},Kf={position:"absolute",top:"-20000px",left:0,padding:0,margin:0,border:"none",whiteSpace:"pre"},Xf="recharts_measurement_span";var Gf=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(null==e||ef.isSsr)return{width:0,height:0};var n,r=(n=Wf({},t),Object.keys(n).forEach(function(e){n[e]||delete n[e]}),n),a=JSON.stringify({text:e,copyStyle:r});if(Vf.widthCache[a])return Vf.widthCache[a];try{var i=document.getElementById(Xf);i||((i=document.createElement("span")).setAttribute("id",Xf),i.setAttribute("aria-hidden","true"),document.body.appendChild(i));var o=Wf(Wf({},Kf),r);Object.assign(i.style,o),i.textContent="".concat(e);var s=i.getBoundingClientRect(),l={width:s.width,height:s.height};return Vf.widthCache[a]=l,++Vf.cacheCount>2e3&&(Vf.cacheCount=0,Vf.widthCache={}),l}catch(c){return{width:0,height:0}}};function Yf(e){return(Yf="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Jf(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,i,o,s=[],l=!0,c=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=i.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(u){c=!0,a=u}finally{try{if(!l&&null!=n.return&&(o=n.return(),Object(o)!==o))return}finally{if(c)throw a}}return s}}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return Zf(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Zf(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Zf(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Qf(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,ep(r.key),r)}}function ep(e){var t=function(e,t){if("object"!=Yf(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t);if("object"!=Yf(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e,"string");return"symbol"==Yf(t)?t:t+""}var tp=/(-?\d+(?:\.\d+)?[a-zA-Z%]*)([*/])(-?\d+(?:\.\d+)?[a-zA-Z%]*)/,np=/(-?\d+(?:\.\d+)?[a-zA-Z%]*)([+-])(-?\d+(?:\.\d+)?[a-zA-Z%]*)/,rp=/^px|cm|vh|vw|em|rem|%|mm|in|pt|pc|ex|ch|vmin|vmax|Q$/,ap=/(-?\d+(?:\.\d+)?)([a-zA-Z%]+)?/,ip={cm:96/2.54,mm:96/25.4,pt:96/72,pc:16,in:96,Q:96/101.6,px:1},op=Object.keys(ip),sp="NaN";var lp=function(){function e(t,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.num=t,this.unit=n,this.num=t,this.unit=n,Number.isNaN(t)&&(this.unit=""),""===n||rp.test(n)||(this.num=NaN,this.unit=""),op.includes(n)&&(this.num=function(e,t){return e*ip[t]}(t,n),this.unit="px")}return t=e,r=[{key:"parse",value:function(t){var n,r=Jf(null!==(n=ap.exec(t))&&void 0!==n?n:[],3),a=r[1],i=r[2];return new e(parseFloat(a),null!=i?i:"")}}],(n=[{key:"add",value:function(t){return this.unit!==t.unit?new e(NaN,""):new e(this.num+t.num,this.unit)}},{key:"subtract",value:function(t){return this.unit!==t.unit?new e(NaN,""):new e(this.num-t.num,this.unit)}},{key:"multiply",value:function(t){return""!==this.unit&&""!==t.unit&&this.unit!==t.unit?new e(NaN,""):new e(this.num*t.num,this.unit||t.unit)}},{key:"divide",value:function(t){return""!==this.unit&&""!==t.unit&&this.unit!==t.unit?new e(NaN,""):new e(this.num/t.num,this.unit||t.unit)}},{key:"toString",value:function(){return"".concat(this.num).concat(this.unit)}},{key:"isNaN",value:function(){return Number.isNaN(this.num)}}])&&Qf(t.prototype,n),r&&Qf(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,n,r}();function cp(e){if(e.includes(sp))return sp;for(var t=e;t.includes("*")||t.includes("/");){var n,r=Jf(null!==(n=tp.exec(t))&&void 0!==n?n:[],4),a=r[1],i=r[2],o=r[3],s=lp.parse(null!=a?a:""),l=lp.parse(null!=o?o:""),c="*"===i?s.multiply(l):s.divide(l);if(c.isNaN())return sp;t=t.replace(tp,c.toString())}for(;t.includes("+")||/.-\d+(?:\.\d+)?/.test(t);){var u,d=Jf(null!==(u=np.exec(t))&&void 0!==u?u:[],4),f=d[1],p=d[2],h=d[3],m=lp.parse(null!=f?f:""),y=lp.parse(null!=h?h:""),x="+"===p?m.add(y):m.subtract(y);if(x.isNaN())return sp;t=t.replace(np,x.toString())}return t}var up=/\(([^()]*)\)/;function dp(e){var t=e.replace(/\s+/g,"");return t=function(e){for(var t=e;t.includes("(");){var n=Jf(up.exec(t),2)[1];t=t.replace(up,cp(n))}return t}(t),t=cp(t)}function fp(e){var t=function(e){try{return dp(e)}catch(t){return sp}}(e.slice(5,-1));return t===sp?"":t}var pp=["x","y","lineHeight","capHeight","scaleToFit","textAnchor","verticalAnchor","fill"],hp=["dx","dy","angle","className","breakAll"];function mp(){return mp=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},mp.apply(this,arguments)}function yp(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)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}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}function xp(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,i,o,s=[],l=!0,c=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=i.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(u){c=!0,a=u}
vendor: 12,749 bytes, line 13
13finally{try{if(!l&&null!=n.return&&(o=n.return(),Object(o)!==o))return}finally{if(c)throw a}}return s}}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return gp(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return gp(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function gp(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var vp=/[ \f\n\r\t\v\u2028\u2029]+/,bp=function(e){var t=e.children,n=e.breakAll,r=e.style;try{var a=[];return vr(t)||(a=n?t.toString().split(""):t.toString().split(vp)),{wordsWithComputedWidth:a.map(function(e){return{word:e,width:Gf(e,r).width}}),spaceWidth:n?0:Gf(" ",r).width}}catch(i){return null}},jp=function(e){return[{words:vr(e)?[]:e.toString().split(vp)}]},wp=function(e){var t=e.width,n=e.scaleToFit,r=e.children,a=e.style,i=e.breakAll,o=e.maxLines;if((t||n)&&!ef.isSsr){var s=bp({breakAll:i,children:r,style:a});return s?function(e,t,n,r,a){var i=e.maxLines,o=e.children,s=e.style,l=e.breakAll,c=Jr(i),u=o,d=function(){return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]).reduce(function(e,t){var i=t.word,o=t.width,s=e[e.length-1];if(s&&(null==r||a||s.width+o+n<Number(r)))s.words.push(i),s.width+=o+n;else{var l={words:[i],width:o};e.push(l)}return e},[])},f=d(t);if(!c)return f;for(var p,h=function(e){var t=u.slice(0,e),n=bp({breakAll:l,style:s,children:t+"â¦"}).wordsWithComputedWidth,a=d(n),o=a.length>i||function(e){return e.reduce(function(e,t){return e.width>t.width?e:t})}(a).width>Number(r);return[o,a]},m=0,y=u.length-1,x=0;m<=y&&x<=u.length-1;){var g=Math.floor((m+y)/2),v=xp(h(g-1),2),b=v[0],j=v[1],w=xp(h(g),1)[0];if(b||w||(m=g+1),b&&w&&(y=g-1),!b&&w){p=j;break}x++}return p||f}({breakAll:i,children:r,maxLines:o,style:a},s.wordsWithComputedWidth,s.spaceWidth,t,n):jp(r)}return jp(r)},Np="#808080",Sp=function(e){var t=e.x,n=void 0===t?0:t,r=e.y,a=void 0===r?0:r,l=e.lineHeight,c=void 0===l?"1em":l,u=e.capHeight,d=void 0===u?"0.71em":u,f=e.scaleToFit,p=void 0!==f&&f,h=e.textAnchor,m=void 0===h?"start":h,y=e.verticalAnchor,x=void 0===y?"end":y,g=e.fill,v=void 0===g?Np:g,b=yp(e,pp),j=i.useMemo(function(){return wp({breakAll:b.breakAll,children:b.children,maxLines:b.maxLines,scaleToFit:p,style:b.style,width:b.width})},[b.breakAll,b.children,b.maxLines,p,b.style,b.width]),w=b.dx,N=b.dy,S=b.angle,O=b.className,k=b.breakAll,A=yp(b,hp);if(!Zr(n)||!Zr(a))return null;var P,E=n+(Jr(w)?w:0),_=a+(Jr(N)?N:0);switch(x){case"start":P=fp("calc(".concat(d,")"));break;case"middle":P=fp("calc(".concat((j.length-1)/2," * -").concat(c," + (").concat(d," / 2))"));break;default:P=fp("calc(".concat(j.length-1," * -").concat(c,")"))}var C=[];if(p){var M=j[0].width,T=b.width;C.push("scale(".concat((Jr(T)?T/M:1)/M,")"))}return S&&C.push("rotate(".concat(S,", ").concat(E,", ").concat(_,")")),C.length&&(A.transform=C.join(" ")),s.createElement("text",mp({},Pa(A,!0),{x:E,y:_,className:o("recharts-text",O),textAnchor:m,fill:v.includes("url")?Np:v}),j.map(function(e,t){var n=e.words.join(k?"":" ");return s.createElement("tspan",{x:E,dy:0===t?P:c,key:"".concat(n,"-").concat(t)},n)}))};function Op(e,t){return null==e||null==t?NaN:e<t?-1:e>t?1:e>=t?0:NaN}function kp(e,t){return null==e||null==t?NaN:t<e?-1:t>e?1:t>=e?0:NaN}function Ap(e){let t,n,r;function a(e,r,a=0,i=e.length){if(a<i){if(0!==t(r,r))return i;do{const t=a+i>>>1;n(e[t],r)<0?a=t+1:i=t}while(a<i)}return a}return 2!==e.length?(t=Op,n=(t,n)=>Op(e(t),n),r=(t,n)=>e(t)-n):(t=e===Op||e===kp?e:Pp,n=e,r=e),{left:a,center:function(e,t,n=0,i=e.length){const o=a(e,t,n,i-1);return o>n&&r(e[o-1],t)>-r(e[o],t)?o-1:o},right:function(e,r,a=0,i=e.length){if(a<i){if(0!==t(r,r))return i;do{const t=a+i>>>1;n(e[t],r)<=0?a=t+1:i=t}while(a<i)}return a}}}function Pp(){return 0}function Ep(e){return null===e?NaN:+e}const _p=Ap(Op).right;Ap(Ep).center;class Cp extends Map{constructor(e,t=Tp){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:t}}),null!=e)for(const[n,r]of e)this.set(n,r)}get(e){return super.get(Mp(this,e))}has(e){return super.has(Mp(this,e))}set(e,t){return super.set(function({_intern:e,_key:t},n){const r=t(n);return e.has(r)?e.get(r):(e.set(r,n),n)}(this,e),t)}delete(e){return super.delete(function({_intern:e,_key:t},n){const r=t(n);e.has(r)&&(n=e.get(r),e.delete(r));return n}(this,e))}}function Mp({_intern:e,_key:t},n){const r=t(n);return e.has(r)?e.get(r):n}function Tp(e){return null!==e&&"object"==typeof e?e.valueOf():e}function Dp(e,t){return(null==e||!(e>=e))-(null==t||!(t>=t))||(e<t?-1:e>t?1:0)}const Ip=Math.sqrt(50),Rp=Math.sqrt(10),Lp=Math.sqrt(2);function Bp(e,t,n){const r=(t-e)/Math.max(0,n),a=Math.floor(Math.log10(r)),i=r/Math.pow(10,a),o=i>=Ip?10:i>=Rp?5:i>=Lp?2:1;let s,l,c;return a<0?(c=Math.pow(10,-a)/o,s=Math.round(e*c),l=Math.round(t*c),s/c<e&&++s,l/c>t&&--l,c=-c):(c=Math.pow(10,a)*o,s=Math.round(e/c),l=Math.round(t/c),s*c<e&&++s,l*c>t&&--l),l<s&&.5<=n&&n<2?Bp(e,t,2*n):[s,l,c]}function zp(e,t,n){if(!((n=+n)>0))return[];if((e=+e)===(t=+t))return[e];const r=t<e,[a,i,o]=r?Bp(t,e,n):Bp(e,t,n);if(!(i>=a))return[];const s=i-a+1,l=new Array(s);if(r)if(o<0)for(let c=0;c<s;++c)l[c]=(i-c)/-o;else for(let c=0;c<s;++c)l[c]=(i-c)*o;else if(o<0)for(let c=0;c<s;++c)l[c]=(a+c)/-o;else for(let c=0;c<s;++c)l[c]=(a+c)*o;return l}function $p(e,t,n){return Bp(e=+e,t=+t,n=+n)[2]}function Fp(e,t,n){n=+n;const r=(t=+t)<(e=+e),a=r?$p(t,e,n):$p(e,t,n);return(r?-1:1)*(a<0?1/-a:a)}function Up(e,t){let n;for(const r of e)null!=r&&(n<r||void 0===n&&r>=r)&&(n=r);return n}function qp(e,t){let n;for(const r of e)null!=r&&(n>r||void 0===n&&r>=r)&&(n=r);return n}function Wp(e,t,n=0,r=1/0,a){if(t=Math.floor(t),n=Math.floor(Math.max(0,n)),r=Math.floor(Math.min(e.length-1,r)),!(n<=t&&t<=r))return e;for(a=void 0===a?Dp:function(e=Op){if(e===Op)return Dp;if("function"!=typeof e)throw new TypeError("compare is not a function");return(t,n)=>{const r=e(t,n);return r||0===r?r:(0===e(n,n))-(0===e(t,t))}}(a);r>n;){if(r-n>600){const i=r-n+1,o=t-n+1,s=Math.log(i),l=.5*Math.exp(2*s/3),c=.5*Math.sqrt(s*l*(i-l)/i)*(o-i/2<0?-1:1);Wp(e,t,Math.max(n,Math.floor(t-o*l/i+c)),Math.min(r,Math.floor(t+(i-o)*l/i+c)),a)}const i=e[t];let o=n,s=r;for(Hp(e,n,t),a(e[r],i)>0&&Hp(e,n,r);o<s;){for(Hp(e,o,s),++o,--s;a(e[o],i)<0;)++o;for(;a(e[s],i)>0;)--s}0===a(e[n],i)?Hp(e,n,s):(++s,Hp(e,s,r)),s<=t&&(n=s+1),t<=s&&(r=s-1)}return e}function Hp(e,t,n){const r=e[t];e[t]=e[n],e[n]=r}function Vp(e,t,n=Ep){if((r=e.length)&&!isNaN(t=+t)){if(t<=0||r<2)return+n(e[0],0,e);if(t>=1)return+n(e[r-1],r-1,e);var r,a=(r-1)*t,i=Math.floor(a),o=+n(e[i],i,e);return o+(+n(e[i+1],i+1,e)-o)*(a-i)}}function Kp(e,t){switch(arguments.length){case 0:break;case 1:this.range(e);break;default:this.range(t).domain(e)}return this}function Xp(e,t){switch(arguments.length){case 0:break;case 1:"function"==typeof e?this.interpolator(e):this.range(e);break;default:this.domain(e),"function"==typeof t?this.interpolator(t):this.range(t)}return this}const Gp=Symbol("implicit");function Yp(){var e=new Cp,t=[],n=[],r=Gp;function a(a){let i=e.get(a);if(void 0===i){if(r!==Gp)return r;e.set(a,i=t.push(a)-1)}return n[i%n.length]}return a.domain=function(n){if(!arguments.length)return t.slice();t=[],e=new Cp;for(const r of n)e.has(r)||e.set(r,t.push(r)-1);return a},a.range=function(e){return arguments.length?(n=Array.from(e),a):n.slice()},a.unknown=function(e){return arguments.length?(r=e,a):r},a.copy=function(){return Yp(t,n).unknown(r)},Kp.apply(a,arguments),a}function Jp(){var e,t,n=Yp().unknown(void 0),r=n.domain,a=n.range,i=0,o=1,s=!1,l=0,c=0,u=.5;function d(){var n=r().length,d=o<i,f=d?o:i,p=d?i:o;e=(p-f)/Math.max(1,n-l+2*c),s&&(e=Math.floor(e)),f+=(p-f-e*(n-l))*u,t=e*(1-l),s&&(f=Math.round(f),t=Math.round(t));var h=function(e,t,n){e=+e,t=+t,n=(a=arguments.length)<2?(t=e,e=0,1):a<3?1:+n;for(var r=-1,a=0|Math.max(0,Math.ceil((t-e)/n)),i=new Array(a);++r<a;)i[r]=e+r*n;return i}(n).map(function(t){return f+e*t});return a(d?h.reverse():h)}return delete n.unknown,n.domain=function(e){return arguments.length?(r(e),d()):r()},n.range=function(e){return arguments.length?([i,o]=e,i=+i,o=+o,d()):[i,o]},n.rangeRound=function(e){return[i,o]=e,i=+i,o=+o,s=!0,d()},n.bandwidth=function(){return t},n.step=function(){return e},n.round=function(e){return arguments.length?(s=!!e,d()):s},n.padding=function(e){return arguments.length?(l=Math.min(1,c=+e),d()):l},n.paddingInner=function(e){return arguments.length?(l=Math.min(1,e),d()):l},n.paddingOuter=function(e){return arguments.length?(c=+e,d()):c},n.align=function(e){return arguments.length?(u=Math.max(0,Math.min(1,e)),d()):u},n.copy=function(){return Jp(r(),[i,o]).round(s).paddingInner(l).paddingOuter(c).align(u)},Kp.apply(d(),arguments)}function Zp(e){var t=e.copy;return e.padding=e.paddingOuter,delete e.paddingInner,delete e.paddingOuter,e.copy=function(){return Zp(t())},e}function Qp(){return Zp(Jp.apply(null,arguments).paddingInner(1))}function eh(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function th(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function nh(){}var rh=.7,ah=1/rh,ih="\\s*([+-]?\\d+)\\s*",oh="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",sh="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",lh=/^#([0-9a-f]{3,8})$/,ch=new RegExp(`^rgb\\(${ih},${ih},${ih}\\)$`),uh=new RegExp(`^rgb\\(${sh},${sh},${sh}\\)$`),dh=new RegExp(`^rgba\\(${ih},${ih},${ih},${oh}\\)$`),fh=new RegExp(`^rgba\\(${sh},${sh},${sh},${oh}\\)$`),ph=new RegExp(`^hsl\\(${oh},${sh},${sh}\\)$`),hh=new RegExp(`^hsla\\(${oh},${sh},${sh},${oh}\\)$`),mh={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};function yh(){return this.rgb().formatHex()}function xh(){return this.rgb().formatRgb()}function gh(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=lh.exec(e))?(n=t[1].length,t=parseInt(t[1],16),6===n?vh(t):3===n?
vendor: 7,098 bytes, line 13
13new wh(t>>8&15|t>>4&240,t>>4&15|240&t,(15&t)<<4|15&t,1):8===n?bh(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):4===n?bh(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|240&t,((15&t)<<4|15&t)/255):null):(t=ch.exec(e))?new wh(t[1],t[2],t[3],1):(t=uh.exec(e))?new wh(255*t[1]/100,255*t[2]/100,255*t[3]/100,1):(t=dh.exec(e))?bh(t[1],t[2],t[3],t[4]):(t=fh.exec(e))?bh(255*t[1]/100,255*t[2]/100,255*t[3]/100,t[4]):(t=ph.exec(e))?Ph(t[1],t[2]/100,t[3]/100,1):(t=hh.exec(e))?Ph(t[1],t[2]/100,t[3]/100,t[4]):mh.hasOwnProperty(e)?vh(mh[e]):"transparent"===e?new wh(NaN,NaN,NaN,0):null}function vh(e){return new wh(e>>16&255,e>>8&255,255&e,1)}function bh(e,t,n,r){return r<=0&&(e=t=n=NaN),new wh(e,t,n,r)}function jh(e,t,n,r){return 1===arguments.length?((a=e)instanceof nh||(a=gh(a)),a?new wh((a=a.rgb()).r,a.g,a.b,a.opacity):new wh):new wh(e,t,n,null==r?1:r);var a}function wh(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}function Nh(){return`#${Ah(this.r)}${Ah(this.g)}${Ah(this.b)}`}function Sh(){const e=Oh(this.opacity);return`${1===e?"rgb(":"rgba("}${kh(this.r)}, ${kh(this.g)}, ${kh(this.b)}${1===e?")":`, ${e})`}`}function Oh(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function kh(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Ah(e){return((e=kh(e))<16?"0":"")+e.toString(16)}function Ph(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new _h(e,t,n,r)}function Eh(e){if(e instanceof _h)return new _h(e.h,e.s,e.l,e.opacity);if(e instanceof nh||(e=gh(e)),!e)return new _h;if(e instanceof _h)return e;var t=(e=e.rgb()).r/255,n=e.g/255,r=e.b/255,a=Math.min(t,n,r),i=Math.max(t,n,r),o=NaN,s=i-a,l=(i+a)/2;return s?(o=t===i?(n-r)/s+6*(n<r):n===i?(r-t)/s+2:(t-n)/s+4,s/=l<.5?i+a:2-i-a,o*=60):s=l>0&&l<1?0:o,new _h(o,s,l,e.opacity)}function _h(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}function Ch(e){return(e=(e||0)%360)<0?e+360:e}function Mh(e){return Math.max(0,Math.min(1,e||0))}function Th(e,t,n){return 255*(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)}eh(nh,gh,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:yh,formatHex:yh,formatHex8:function(){return this.rgb().formatHex8()},formatHsl:function(){return Eh(this).formatHsl()},formatRgb:xh,toString:xh}),eh(wh,jh,th(nh,{brighter(e){return e=null==e?ah:Math.pow(ah,e),new wh(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=null==e?rh:Math.pow(rh,e),new wh(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new wh(kh(this.r),kh(this.g),kh(this.b),Oh(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:Nh,formatHex:Nh,formatHex8:function(){return`#${Ah(this.r)}${Ah(this.g)}${Ah(this.b)}${Ah(255*(isNaN(this.opacity)?1:this.opacity))}`},formatRgb:Sh,toString:Sh})),eh(_h,function(e,t,n,r){return 1===arguments.length?Eh(e):new _h(e,t,n,null==r?1:r)},th(nh,{brighter(e){return e=null==e?ah:Math.pow(ah,e),new _h(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=null==e?rh:Math.pow(rh,e),new _h(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+360*(this.h<0),t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,a=2*n-r;return new wh(Th(e>=240?e-240:e+120,a,r),Th(e,a,r),Th(e<120?e+240:e-120,a,r),this.opacity)},clamp(){return new _h(Ch(this.h),Mh(this.s),Mh(this.l),Oh(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=Oh(this.opacity);return`${1===e?"hsl(":"hsla("}${Ch(this.h)}, ${100*Mh(this.s)}%, ${100*Mh(this.l)}%${1===e?")":`, ${e})`}`}}));const Dh=e=>()=>e;function Ih(e){return 1===(e=+e)?Rh:function(t,n){return n-t?function(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(r){return Math.pow(e+r*t,n)}}(t,n,e):Dh(isNaN(t)?n:t)}}function Rh(e,t){var n=t-e;return n?function(e,t){return function(n){return e+n*t}}(e,n):Dh(isNaN(e)?t:e)}const Lh=function e(t){var n=Ih(t);function r(e,t){var r=n((e=jh(e)).r,(t=jh(t)).r),a=n(e.g,t.g),i=n(e.b,t.b),o=Rh(e.opacity,t.opacity);return function(t){return e.r=r(t),e.g=a(t),e.b=i(t),e.opacity=o(t),e+""}}return r.gamma=e,r}(1);function Bh(e,t){t||(t=[]);var n,r=e?Math.min(t.length,e.length):0,a=t.slice();return function(i){for(n=0;n<r;++n)a[n]=e[n]*(1-i)+t[n]*i;return a}}function zh(e,t){var n,r=t?t.length:0,a=e?Math.min(r,e.length):0,i=new Array(a),o=new Array(r);for(n=0;n<a;++n)i[n]=Vh(e[n],t[n]);for(;n<r;++n)o[n]=t[n];return function(e){for(n=0;n<a;++n)o[n]=i[n](e);return o}}function $h(e,t){var n=new Date;return e=+e,t=+t,function(r){return n.setTime(e*(1-r)+t*r),n}}function Fh(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function Uh(e,t){var n,r={},a={};for(n in null!==e&&"object"==typeof e||(e={}),null!==t&&"object"==typeof t||(t={}),t)n in e?r[n]=Vh(e[n],t[n]):a[n]=t[n];return function(e){for(n in r)a[n]=r[n](e);return a}}var qh=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Wh=new RegExp(qh.source,"g");function Hh(e,t){var n,r,a,i=qh.lastIndex=Wh.lastIndex=0,o=-1,s=[],l=[];for(e+="",t+="";(n=qh.exec(e))&&(r=Wh.exec(t));)(a=r.index)>i&&(a=t.slice(i,a),s[o]?s[o]+=a:s[++o]=a),(n=n[0])===(r=r[0])?s[o]?s[o]+=r:s[++o]=r:(s[++o]=null,l.push({i:o,x:Fh(n,r)})),i=Wh.lastIndex;return i<t.length&&(a=t.slice(i),s[o]?s[o]+=a:s[++o]=a),s.length<2?l[0]?function(e){return function(t){return e(t)+""}}(l[0].x):function(e){return function(){return e}}(t):(t=l.length,function(e){for(var n,r=0;r<t;++r)s[(n=l[r]).i]=n.x(e);return s.join("")})}function Vh(e,t){var n,r,a=typeof t;return null==t||"boolean"===a?Dh(t):("number"===a?Fh:"string"===a?(n=gh(t))?(t=n,Lh):Hh:t instanceof gh?Lh:t instanceof Date?$h:(r=t,!ArrayBuffer.isView(r)||r instanceof DataView?Array.isArray(t)?zh:"function"!=typeof t.valueOf&&"function"!=typeof t.toString||isNaN(t)?Uh:Fh:Bh))(e,t)}function Kh(e,t){return e=+e,t=+t,function(n){return Math.round(e*(1-n)+t*n)}}function Xh(e){return+e}var Gh=[0,1];function Yh(e){return e}function Jh(e,t){return(t-=e=+e)?function(n){return(n-e)/t}:(n=isNaN(t)?NaN:.5,function(){return n});var n}function Zh(e,t,n){var r=e[0],a=e[1],i=t[0],o=t[1];return a<r?(r=Jh(a,r),i=n(o,i)):(r=Jh(r,a),i=n(i,o)),function(e){return i(r(e))}}function Qh(e,t,n){var r=Math.min(e.length,t.length)-1,a=new Array(r),i=new Array(r),o=-1;for(e[r]<e[0]&&(e=e.slice().reverse(),t=t.slice().reverse());++o<r;)a[o]=Jh(e[o],e[o+1]),i[o]=n(t[o],t[o+1]);return function(t){var n=_p(e,t,1,r)-1;return i[n](a[n](t))}}function em(e,t){return t.domain(e.domain()).range(e.range()).interpolate(e.interpolate()).clamp(e.clamp()).unknown(e.unknown())}function tm(){var e,t,n,r,a,i,o=Gh,s=Gh,l=Vh,c=Yh;function u(){var e,t,n,l=Math.min(o.length,s.length);return c!==Yh&&(e=o[0],t=o[l-1],e>t&&(n=e,e=t,t=n),c=function(n){return Math.max(e,Math.min(t,n))}),r=l>2?Qh:Zh,a=i=null,d}function d(t){return null==t||isNaN(t=+t)?n:(a||(a=r(o.map(e),s,l)))(e(c(t)))}return d.invert=function(n){return c(t((i||(i=r(s,o.map(e),Fh)))(n)))},d.domain=function(e){return arguments.length?(o=Array.from(e,Xh),u(
vendor: 4,784 bytes, line 13
13)):o.slice()},d.range=function(e){return arguments.length?(s=Array.from(e),u()):s.slice()},d.rangeRound=function(e){return s=Array.from(e),l=Kh,u()},d.clamp=function(e){return arguments.length?(c=!!e||Yh,u()):c!==Yh},d.interpolate=function(e){return arguments.length?(l=e,u()):l},d.unknown=function(e){return arguments.length?(n=e,d):n},function(n,r){return e=n,t=r,u()}}function nm(){return tm()(Yh,Yh)}function rm(e,t){if((n=(e=t?e.toExponential(t-1):e.toExponential()).indexOf("e"))<0)return null;var n,r=e.slice(0,n);return[r.length>1?r[0]+r.slice(2):r,+e.slice(n+1)]}function am(e){return(e=rm(Math.abs(e)))?e[1]:NaN}var im,om=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function sm(e){if(!(t=om.exec(e)))throw new Error("invalid format: "+e);var t;return new lm({fill:t[1],align:t[2],sign:t[3],symbol:t[4],zero:t[5],width:t[6],comma:t[7],precision:t[8]&&t[8].slice(1),trim:t[9],type:t[10]})}function lm(e){this.fill=void 0===e.fill?" ":e.fill+"",this.align=void 0===e.align?">":e.align+"",this.sign=void 0===e.sign?"-":e.sign+"",this.symbol=void 0===e.symbol?"":e.symbol+"",this.zero=!!e.zero,this.width=void 0===e.width?void 0:+e.width,this.comma=!!e.comma,this.precision=void 0===e.precision?void 0:+e.precision,this.trim=!!e.trim,this.type=void 0===e.type?"":e.type+""}function cm(e,t){var n=rm(e,t);if(!n)return e+"";var r=n[0],a=n[1];return a<0?"0."+new Array(-a).join("0")+r:r.length>a+1?r.slice(0,a+1)+"."+r.slice(a+1):r+new Array(a-r.length+2).join("0")}sm.prototype=lm.prototype,lm.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(void 0===this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(void 0===this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type};const um={"%":(e,t)=>(100*e).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+"",d:function(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString("en").replace(/,/g,""):e.toString(10)},e:(e,t)=>e.toExponential(t),f:(e,t)=>e.toFixed(t),g:(e,t)=>e.toPrecision(t),o:e=>Math.round(e).toString(8),p:(e,t)=>cm(100*e,t),r:cm,s:function(e,t){var n=rm(e,t);if(!n)return e+"";var r=n[0],a=n[1],i=a-(im=3*Math.max(-8,Math.min(8,Math.floor(a/3))))+1,o=r.length;return i===o?r:i>o?r+new Array(i-o+1).join("0"):i>0?r.slice(0,i)+"."+r.slice(i):"0."+new Array(1-i).join("0")+rm(e,Math.max(0,t+i-1))[0]},X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function dm(e){return e}var fm,pm,hm,mm=Array.prototype.map,ym=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function xm(e){var t,n,r=void 0===e.grouping||void 0===e.thousands?dm:(t=mm.call(e.grouping,Number),n=e.thousands+"",function(e,r){for(var a=e.length,i=[],o=0,s=t[0],l=0;a>0&&s>0&&(l+s+1>r&&(s=Math.max(1,r-l)),i.push(e.substring(a-=s,a+s)),!((l+=s+1)>r));)s=t[o=(o+1)%t.length];return i.reverse().join(n)}),a=void 0===e.currency?"":e.currency[0]+"",i=void 0===e.currency?"":e.currency[1]+"",o=void 0===e.decimal?".":e.decimal+"",s=void 0===e.numerals?dm:function(e){return function(t){return t.replace(/[0-9]/g,function(t){return e[+t]})}}(mm.call(e.numerals,String)),l=void 0===e.percent?"%":e.percent+"",c=void 0===e.minus?"â":e.minus+"",u=void 0===e.nan?"NaN":e.nan+"";function d(e){var t=(e=sm(e)).fill,n=e.align,d=e.sign,f=e.symbol,p=e.zero,h=e.width,m=e.comma,y=e.precision,x=e.trim,g=e.type;"n"===g?(m=!0,g="g"):um[g]||(void 0===y&&(y=12),x=!0,g="g"),(p||"0"===t&&"="===n)&&(p=!0,t="0",n="=");var v="$"===f?a:"#"===f&&/[boxX]/.test(g)?"0"+g.toLowerCase():"",b="$"===f?i:/[%p]/.test(g)?l:"",j=um[g],w=/[defgprs%]/.test(g);function N(e){var a,i,l,f=v,N=b;if("c"===g)N=j(e)+N,e="";else{var S=(e=+e)<0||1/e<0;if(e=isNaN(e)?u:j(Math.abs(e),y),x&&(e=function(e){e:for(var t,n=e.length,r=1,a=-1;r<n;++r)switch(e[r]){case".":a=t=r;break;case"0":0===a&&(a=r),t=r;break;default:if(!+e[r])break e;a>0&&(a=0)}return a>0?e.slice(0,a)+e.slice(t+1):e}(e)),S&&0===+e&&"+"!==d&&(S=!1),f=(S?"("===d?d:c:"-"===d||"("===d?"":d)+f,N=("s"===g?ym[8+im/3]:"")+N+(S&&"("===d?")":""),w)for(a=-1,i=e.length;++a<i;)if(48>(l=e.charCodeAt(a))||l>57){N=(46===l?o+e.slice(a+1):e.slice(a))+N,e=e.slice(0,a);break}}m&&!p&&(e=r(e,1/0));var O=f.length+e.length+N.length,k=O<h?new Array(h-O+1).join(t):"";switch(m&&p&&(e=r(k+e,k.length?h-N.length:1/0),k=""),n){case"<":e=f+e+N+k;break;case"=":e=f+k+e+N;break;case"^":e=k.slice(0,O=k.length>>1)+f+e+N+k.slice(O);break;default:e=k+f+e+N}return s(e)}return y=void 0===y?6:/[gprs]/.test(g)?Math.max(1,Math.min(21,y)):Math.max(0,Math.min(20,y)),N.toString=function(){return e+""},N}return{format:d,formatPrefix:function(e,t){var n=d(((e=sm(e)).type="f",e)),r=3*Math.max(-8,Math.min(8,Math.floor(am(t)/3))),a=Math.pow(10,-r),i=ym[8+r/3];return function(e){return n(a*e)+i}}}}
vendor: 14,396 bytes, line 13
13function gm(e,t,n,r){var a,i=Fp(e,t,n);switch((r=sm(null==r?",f":r)).type){case"s":var o=Math.max(Math.abs(e),Math.abs(t));return null!=r.precision||isNaN(a=function(e,t){return Math.max(0,3*Math.max(-8,Math.min(8,Math.floor(am(t)/3)))-am(Math.abs(e)))}(i,o))||(r.precision=a),hm(r,o);case"":case"e":case"g":case"p":case"r":null!=r.precision||isNaN(a=function(e,t){return e=Math.abs(e),t=Math.abs(t)-e,Math.max(0,am(t)-am(e))+1}(i,Math.max(Math.abs(e),Math.abs(t))))||(r.precision=a-("e"===r.type));break;case"f":case"%":null!=r.precision||isNaN(a=function(e){return Math.max(0,-am(Math.abs(e)))}(i))||(r.precision=a-2*("%"===r.type))}return pm(r)}function vm(e){var t=e.domain;return e.ticks=function(e){var n=t();return zp(n[0],n[n.length-1],null==e?10:e)},e.tickFormat=function(e,n){var r=t();return gm(r[0],r[r.length-1],null==e?10:e,n)},e.nice=function(n){null==n&&(n=10);var r,a,i=t(),o=0,s=i.length-1,l=i[o],c=i[s],u=10;for(c<l&&(a=l,l=c,c=a,a=o,o=s,s=a);u-- >0;){if((a=$p(l,c,n))===r)return i[o]=l,i[s]=c,t(i);if(a>0)l=Math.floor(l/a)*a,c=Math.ceil(c/a)*a;else{if(!(a<0))break;l=Math.ceil(l*a)/a,c=Math.floor(c*a)/a}r=a}return e},e}function bm(){var e=nm();return e.copy=function(){return em(e,bm())},Kp.apply(e,arguments),vm(e)}function jm(e,t){var n,r=0,a=(e=e.slice()).length-1,i=e[r],o=e[a];return o<i&&(n=r,r=a,a=n,n=i,i=o,o=n),e[r]=t.floor(i),e[a]=t.ceil(o),e}function wm(e){return Math.log(e)}function Nm(e){return Math.exp(e)}function Sm(e){return-Math.log(-e)}function Om(e){return-Math.exp(-e)}function km(e){return isFinite(e)?+("1e"+e):e<0?0:e}function Am(e){return(t,n)=>-e(-t,n)}function Pm(e){const t=e(wm,Nm),n=t.domain;let r,a,i=10;function o(){return r=function(e){return e===Math.E?Math.log:10===e&&Math.log10||2===e&&Math.log2||(e=Math.log(e),t=>Math.log(t)/e)}(i),a=function(e){return 10===e?km:e===Math.E?Math.exp:t=>Math.pow(e,t)}(i),n()[0]<0?(r=Am(r),a=Am(a),e(Sm,Om)):e(wm,Nm),t}return t.base=function(e){return arguments.length?(i=+e,o()):i},t.domain=function(e){return arguments.length?(n(e),o()):n()},t.ticks=e=>{const t=n();let o=t[0],s=t[t.length-1];const l=s<o;l&&([o,s]=[s,o]);let c,u,d=r(o),f=r(s);const p=null==e?10:+e;let h=[];if(!(i%1)&&f-d<p){if(d=Math.floor(d),f=Math.ceil(f),o>0){for(;d<=f;++d)for(c=1;c<i;++c)if(u=d<0?c/a(-d):c*a(d),!(u<o)){if(u>s)break;h.push(u)}}else for(;d<=f;++d)for(c=i-1;c>=1;--c)if(u=d>0?c/a(-d):c*a(d),!(u<o)){if(u>s)break;h.push(u)}2*h.length<p&&(h=zp(o,s,p))}else h=zp(d,f,Math.min(f-d,p)).map(a);return l?h.reverse():h},t.tickFormat=(e,n)=>{if(null==e&&(e=10),null==n&&(n=10===i?"s":","),"function"!=typeof n&&(i%1||null!=(n=sm(n)).precision||(n.trim=!0),n=pm(n)),e===1/0)return n;const o=Math.max(1,i*e/t.ticks().length);return e=>{let t=e/a(Math.round(r(e)));return t*i<i-.5&&(t*=i),t<=o?n(e):""}},t.nice=()=>n(jm(n(),{floor:e=>a(Math.floor(r(e))),ceil:e=>a(Math.ceil(r(e)))})),t}function Em(e){return function(t){return Math.sign(t)*Math.log1p(Math.abs(t/e))}}function _m(e){return function(t){return Math.sign(t)*Math.expm1(Math.abs(t))*e}}function Cm(e){var t=1,n=e(Em(t),_m(t));return n.constant=function(n){return arguments.length?e(Em(t=+n),_m(t)):t},vm(n)}function Mm(e){return function(t){return t<0?-Math.pow(-t,e):Math.pow(t,e)}}function Tm(e){return e<0?-Math.sqrt(-e):Math.sqrt(e)}function Dm(e){return e<0?-e*e:e*e}function Im(e){var t=e(Yh,Yh),n=1;return t.exponent=function(t){return arguments.length?1===(n=+t)?e(Yh,Yh):.5===n?e(Tm,Dm):e(Mm(n),Mm(1/n)):n},vm(t)}function Rm(){var e=Im(tm());return e.copy=function(){return em(e,Rm()).exponent(e.exponent())},Kp.apply(e,arguments),e}function Lm(e){return Math.sign(e)*e*e}fm=xm({thousands:",",grouping:[3],currency:["$",""]}),pm=fm.format,hm=fm.formatPrefix;const Bm=new Date,zm=new Date;function $m(e,t,n,r){function a(t){return e(t=0===arguments.length?new Date:new Date(+t)),t}return a.floor=t=>(e(t=new Date(+t)),t),a.ceil=n=>(e(n=new Date(n-1)),t(n,1),e(n),n),a.round=e=>{const t=a(e),n=a.ceil(e);return e-t<n-e?t:n},a.offset=(e,n)=>(t(e=new Date(+e),null==n?1:Math.floor(n)),e),a.range=(n,r,i)=>{const o=[];if(n=a.ceil(n),i=null==i?1:Math.floor(i),!(n<r&&i>0))return o;let s;do{o.push(s=new Date(+n)),t(n,i),e(n)}while(s<n&&n<r);return o},a.filter=n=>$m(t=>{if(t>=t)for(;e(t),!n(t);)t.setTime(t-1)},(e,r)=>{if(e>=e)if(r<0)for(;++r<=0;)for(;t(e,-1),!n(e););else for(;--r>=0;)for(;t(e,1),!n(e););}),n&&(a.count=(t,r)=>(Bm.setTime(+t),zm.setTime(+r),e(Bm),e(zm),Math.floor(n(Bm,zm))),a.every=e=>(e=Math.floor(e),isFinite(e)&&e>0?e>1?a.filter(r?t=>r(t)%e===0:t=>a.count(0,t)%e===0):a:null)),a}const Fm=$m(()=>{},(e,t)=>{e.setTime(+e+t)},(e,t)=>t-e);Fm.every=e=>(e=Math.floor(e),isFinite(e)&&e>0?e>1?$m(t=>{t.setTime(Math.floor(t/e)*e)},(t,n)=>{t.setTime(+t+n*e)},(t,n)=>(n-t)/e):Fm:null),Fm.range;const Um=1e3,qm=6e4,Wm=36e5,Hm=864e5,Vm=6048e5,Km=2592e6,Xm=31536e6,Gm=$m(e=>{e.setTime(e-e.getMilliseconds())},(e,t)=>{e.setTime(+e+t*Um)},(e,t)=>(t-e)/Um,e=>e.getUTCSeconds());Gm.range;const Ym=$m(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*Um)},(e,t)=>{e.setTime(+e+t*qm)},(e,t)=>(t-e)/qm,e=>e.getMinutes());Ym.range;const Jm=$m(e=>{e.setUTCSeconds(0,0)},(e,t)=>{e.setTime(+e+t*qm)},(e,t)=>(t-e)/qm,e=>e.getUTCMinutes());Jm.range;const Zm=$m(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*Um-e.getMinutes()*qm)},(e,t)=>{e.setTime(+e+t*Wm)},(e,t)=>(t-e)/Wm,e=>e.getHours());Zm.range;const Qm=$m(e=>{e.setUTCMinutes(0,0,0)},(e,t)=>{e.setTime(+e+t*Wm)},(e,t)=>(t-e)/Wm,e=>e.getUTCHours());Qm.range;const ey=$m(e=>e.setHours(0,0,0,0),(e,t)=>e.setDate(e.getDate()+t),(e,t)=>(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*qm)/Hm,e=>e.getDate()-1);ey.range;const ty=$m(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/Hm,e=>e.getUTCDate()-1);ty.range;const ny=$m(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/Hm,e=>Math.floor(e/Hm));function ry(e){return $m(t=>{t.setDate(t.getDate()-(t.getDay()+7-e)%7),t.setHours(0,0,0,0)},(e,t)=>{e.setDate(e.getDate()+7*t)},(e,t)=>(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*qm)/Vm)}ny.range;const ay=ry(0),iy=ry(1),oy=ry(2),sy=ry(3),ly=ry(4),cy=ry(5),uy=ry(6);function dy(e){return $m(t=>{t.setUTCDate(t.getUTCDate()-(t.getUTCDay()+7-e)%7),t.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+7*t)},(e,t)=>(t-e)/Vm)}ay.range,iy.range,oy.range,sy.range,ly.range,cy.range,uy.range;const fy=dy(0),py=dy(1),hy=dy(2),my=dy(3),yy=dy(4),xy=dy(5),gy=dy(6);fy.range,py.range,hy.range,my.range,yy.range,xy.range,gy.range;const vy=$m(e=>{e.setDate(1),e.setHours(0,0,0,0)},(e,t)=>{e.setMonth(e.getMonth()+t)},(e,t)=>t.getMonth()-e.getMonth()+12*(t.getFullYear()-e.getFullYear()),e=>e.getMonth());vy.range;const by=$m(e=>{e.setUTCDate(1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCMonth(e.getUTCMonth()+t)},(e,t)=>t.getUTCMonth()-e.getUTCMonth()+12*(t.getUTCFullYear()-e.getUTCFullYear()),e=>e.getUTCMonth());by.range;const jy=$m(e=>{e.setMonth(0,1),e.setHours(0,0,0,0)},(e,t)=>{e.setFullYear(e.getFullYear()+t)},(e,t)=>t.getFullYear()-e.getFullYear(),e=>e.getFullYear());jy.every=e=>isFinite(e=Math.floor(e))&&e>0?$m(t=>{t.setFullYear(Math.floor(t.getFullYear()/e)*e),t.setMonth(0,1),t.setHours(0,0,0,0)},(t,n)=>{t.setFullYear(t.getFullYear()+n*e)}):null,jy.range;const wy=$m(e=>{e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCFullYear(e.getUTCFullYear()+t)},(e,t)=>t.getUTCFullYear()-e.getUTCFullYear(),e=>e.getUTCFullYear());function Ny(e,t,n,r,a,i){const o=[[Gm,1,Um],[Gm,5,5e3],[Gm,15,15e3],[Gm,30,3e4],[i,1,qm],[i,5,3e5],[i,15,9e5],[i,30,18e5],[a,1,Wm],[a,3,108e5],[a,6,216e5],[a,12,432e5],[r,1,Hm],[r,2,1728e5],[n,1,Vm],[t,1,Km],[t,3,7776e6],[e,1,Xm]];function s(t,n,r){const a=Math.abs(n-t)/r,i=Ap(([,,e])=>e).right(o,a);if(i===o.length)return e.every(Fp(t/Xm,n/Xm,r));if(0===i)return Fm.every(Math.max(Fp(t,n,r),1));const[s,l]=o[a/o[i-1][2]<o[i][2]/a?i-1:i];return s.every(l)}return[function(e,t,n){const r=t<e;r&&([e,t]=[t,e]);const a=n&&"function"==typeof n.range?n:s(e,t,n),i=a?a.range(e,+t+1):[];return r?i.reverse():i},s]}wy.every=e=>isFinite(e=Math.floor(e))&&e>0?$m(t=>{t.setUTCFullYear(Math.floor(t.getUTCFullYear()/e)*e),t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,n)=>{t.setUTCFullYear(t.getUTCFullYear()+n*e)}):null,wy.range;const[Sy,Oy]=Ny(wy,by,fy,ny,Qm,Jm),[ky,Ay]=Ny(jy,vy,ay,ey,Zm,Ym);function Py(e){if(0<=e.y&&e.y<100){var t=new Date(-1,e.m,e.d,e.H,e.M,e.S,e.L);return t.setFullYear(e.y),t}return new Date(e.y,e.m,e.d,e.H,e.M,e.S,e.L)}function Ey(e){if(0<=e.y&&e.y<100){var t=new Date(Date.UTC(-1,e.m,e.d,e.H,e.M,e.S,e.L));return t.setUTCFullYear(e.y),t}return new Date(Date.UTC(e.y,e.m,e.d,e.H,e.M,e.S,e.L))}function _y(e,t,n){return{y:e,m:t,d:n,H:0,M:0,S:0,L:0}}var Cy,My,Ty,Dy={"-":"",_:" ",0:"0"},Iy=/^\s*\d+/,Ry=/^%/,Ly=/[\\^$*+?|[\]().{}]/g;function By(e,t,n){var r=e<0?"-":"",a=(r?-e:e)+"",i=a.length;return r+(i<n?new Array(n-i+1).join(t)+a:a)}function zy(e){return e.replace(Ly,"\\$&")}function $y(e){return new RegExp("^(?:"+e.map(zy).join("|")+")","i")}function Fy(e){return new Map(e.map((e,t)=>[e.toLowerCase(),t]))}function Uy(e,t,n){var r=Iy.exec(t.slice(n,n+1));return r?(e.w=+r[0],n+r[0].length):-1}function qy(e,t,n){var r=Iy.exec(t.slice(n,n+1));return r?(e.u=+r[0],n+r[0].length):-1}function Wy(e,t,n){var r=Iy.exec(t.slice(n,n+2));return r?(e.U=+r[0],n+r[0].length):-1}function Hy(e,t,n){var r=Iy.exec(t.slice(n,n+2));return r?(e.V=+r[0],n+r[0].length):-1}function Vy(e,t,n){var r=Iy.exec(t.slice(n,n+2));return r?(e.W=+r[0],n+r[0].length):-1}function Ky(e,t,n){var r=Iy.exec(t.slice(n,n+4));return r?(e.y=+r[0],n+r[0].length):-1}function Xy(e,t,n){var r=Iy.exec(t.slice(n,n+2));return r?(e.y=+r[0]+(+r[0]>68?1900:2e3),n+r[0].length):-1}function Gy(e,t,n){var r=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(t.slice(n,n+6));return r?(e.Z=r[1]?0:-(r[2]+(r[3]||"00")),n+r[0].length):-1}function Yy(e,t,n){var r=Iy.exec(t.slice(n,n+1));return r?(e.q=3*r[0]-3,n+r[0].length):-1}function Jy(e,t,n){var r=Iy.exec(t.slice(n,n+2));return r?(e.m=r[0]-1,n+r[0].length):-1}function Zy(e,t,n){var r=Iy.exec(t.slice(n,n+2));return r?(e.d=+r[0],n+r[0].length):-1}function Qy(e,t,n){var r=Iy.exec(t.slice(n,n+3));return r?(e.m=0,e.d=+r[0],n+r[0].length):-1}function ex(e,t,n){var r=Iy.exec(t.slice(n,n+2));return r?(e.H=+r[0],n+r[0].length):-1}function tx(e,t,n){var r=Iy.exec(t.slice(n,n+2));return r?(e.M=+r[0],n+r[0].length):-1}function nx(e,t,n){var r=Iy.exec(t.slice(n,n+2));return r?(e.S=+r[0],n+r[0].length):-1}function rx(e,t,n){var r=Iy.exec(t.slice(n,n+3));return r?(e.L=+r[0],n+r[0].length):-1}function ax(e,t,n){var r=Iy.exec(t.slice(n,n+6));return r?(e.L=Math.floor(r[0]/1e3),n+r[0].length):-1}function ix(e,t,n){var r=Ry.exec(t.slice(n,n+1));return r?n+r[0].length:-1}function ox(e,t,n){var r=Iy.exec(t.slice(n));return r?(e.Q=+r[0],n+r[0].length):-1}function sx(e,t,n){var r=Iy.exec(t.slice(n));return r?(e.s=+r[0],n+r[0].length):-1}function lx(e,t){return By(e.getDate(),t,2)}function cx(e,t){return By(e.getHours(),t,2)}function ux(e,t){return By(e.getHours()%12||12,t,2)}function dx(e,t){return By(1+ey.count(jy(e),e),t,3)}function fx(e,t){return By(e.getMilliseconds(),t,3)}function px(e,t){return fx(e,t)+"000"}function hx(e,t){return By(e.getMonth()+1,t,2)}function mx(e,t){return By(e.getMinutes(),t,2)}function yx(e,t){return By(e.getSeconds(),t,2)}function xx(e){var t=e.getDay();return 0===t?7:t}function gx(e,t){return By(ay.count(jy(e)-1,e),t,2)}function vx(e){var t=e.getDay();return t>=4||0===t?ly(e):ly.ceil(e)}function bx(e,t){return e=vx(e),By(ly.count(jy(e),e)+(4===jy(e).getDay()),t,2)}function jx(e){return e.getDay()}function wx(e,t){return By(iy.count(jy(e)-1,e),t,2)}function Nx(e,t){return By(e.getFullYear()%100,t,2)}function Sx(e,t){return By((e=vx(e)).getFullYear()%100,t,2)}function Ox(e,t){return By(e.getFullYear()%1e4,t,4)}function kx(e,t){var n=e.getDay();return By((e=n>=4||0===n?ly(e):ly.ceil(e)).getFullYear()%1e4,t,4)}function Ax(e){var t=e.getTimezoneOffset();return(t>0?"-":(t*=-1,"+"))+By(t/60|0,"0",2)+By(t%60,"0",2)}function Px(e,t){return By(e.getUTCDate(),t,2)}function Ex(e,t){return By(e.getUTCHours(),t,2)}function _x(e,t){return By(e.getUTCHours()%12||12,t,2)}function Cx(e,t){return By(1+ty.count(wy(e),e),t,3)}function Mx(e,t){return By(e.getUTCMilliseconds(),t,3)}function Tx(e,t){return Mx(e,t)+"000"}function Dx(e,t){return By(e.getUTCMonth()+1,t,2)}function Ix(e,t){return By(e.getUTCMinutes(),t,2)}function Rx(e,t){return By(e.getUTCSeconds(),t,2)}function Lx(e){var t=e.getUTCDay();return 0===t?7:t}function Bx(e,t){return By(fy.count(wy(e)-1,e),t,2)}function zx(e){var t=e.getUTCDay();return t>=4||0===t?yy(e):yy.ceil(e)}function $x(e,t){return e=zx(e),By(yy.count(wy(e),e)+(4===wy(e).getUTCDay()),t,2)}function Fx(e){return e.getUTCDay()}function Ux(e,t){return By(py.count(wy(e)-1,e),t,2)}function qx(e,t){return By(e.getUTCFullYear()%100,t,2)}function Wx(e,t){return By((e=zx(e)).getUTCFullYear()%100,t,2)}function Hx(e,t){return By(e.getUTCFullYear()%1e4,t,4)}function Vx(e,t){var n=e.getUTCDay();return By((e=n>=4||0===n?yy(e):yy.ceil(e)).getUTCFullYear()%1e4,t,4)}function Kx(){return"+0000"}function Xx(){return"%"}function Gx(e){return+e}function Yx(e){return Math.floor(+e/1e3)}function Jx(e){return new Date(e)}function Zx(e){return e instanceof Date?+e:+new Date(+e)}function Qx(e,t,n,r,a,i,o,s,l,c){var u=nm(),d=u.invert,f=u.domain,p=c(".%L"),h=c(":%S"),m=c("%I:%M"),y=c("%I %p"),x=c("%a %d"),g=c("%b %d"),v=c("%B"),b=c("%Y");function j(e){return(l(e)<e?p:s(e)<e?h:o(e)<e?m:i(e)<e?y:r(e)<e?a(e)<e?x:g:n(e)<e?v:b)(e)}return u.invert=function(e){return new Date(d(e))},u.domain=function(e){return arguments.length?f(Array.from(e,Zx)):f().map(Jx)},u.ticks=function(t){var n=f();return e(n[0],n[n.length-1],null==t?10:t)},u.tickFormat=function(e,t){return null==t?j:c(t)},u.nice=function(e){var n=f();return e&&"function"==typeof e.range||(e=t(n[0],n[n.length-1],null==e?10:e)),e?f(jm(n,e)):u},u.copy=function(){return em(u,Qx(e,t,n,r,a,i,o,s,l,c))},u}function eg(){var e,t,n,r,a,i=0,o=1,s=Yh,l=!1;function c(t){return null==t||isNaN(t=+t)?a:s(0===n?.5:(t=(r(t)-e)*n,l?Math.max(0,Math.min(1,t)):t))}function u(e){return function(t){var n,r;return arguments.length?([n,r]=t,s=e(n,r),c):[s(0),s(1)]}}return c.domain=function(a){return arguments.length?([i,o]=a,e=r(i=+i),t=r(o=+o),n=e===t?0:1/(t-e),c):[i,o]},c.clamp=function(e){return arguments.length?(l=!!e,c):l},c.interpolator=function(e){return arguments.length?(s=e,c):s}
vendor: 13,714 bytes, line 13
13,c.range=u(Vh),c.rangeRound=u(Kh),c.unknown=function(e){return arguments.length?(a=e,c):a},function(a){return r=a,e=a(i),t=a(o),n=e===t?0:1/(t-e),c}}function tg(e,t){return t.domain(e.domain()).interpolator(e.interpolator()).clamp(e.clamp()).unknown(e.unknown())}function ng(){var e=Im(eg());return e.copy=function(){return tg(e,ng()).exponent(e.exponent())},Xp.apply(e,arguments)}function rg(){var e,t,n,r,a,i,o,s=0,l=.5,c=1,u=1,d=Yh,f=!1;function p(e){return isNaN(e=+e)?o:(e=.5+((e=+i(e))-t)*(u*e<u*t?r:a),d(f?Math.max(0,Math.min(1,e)):e))}function h(e){return function(t){var n,r,a;return arguments.length?([n,r,a]=t,d=function(e,t){void 0===t&&(t=e,e=Vh);for(var n=0,r=t.length-1,a=t[0],i=new Array(r<0?0:r);n<r;)i[n]=e(a,a=t[++n]);return function(e){var t=Math.max(0,Math.min(r-1,Math.floor(e*=r)));return i[t](e-t)}}(e,[n,r,a]),p):[d(0),d(.5),d(1)]}}return p.domain=function(o){return arguments.length?([s,l,c]=o,e=i(s=+s),t=i(l=+l),n=i(c=+c),r=e===t?0:.5/(t-e),a=t===n?0:.5/(n-t),u=t<e?-1:1,p):[s,l,c]},p.clamp=function(e){return arguments.length?(f=!!e,p):f},p.interpolator=function(e){return arguments.length?(d=e,p):d},p.range=h(Vh),p.rangeRound=h(Kh),p.unknown=function(e){return arguments.length?(o=e,p):o},function(o){return i=o,e=o(s),t=o(l),n=o(c),r=e===t?0:.5/(t-e),a=t===n?0:.5/(n-t),u=t<e?-1:1,p}}function ag(){var e=Im(rg());return e.copy=function(){return tg(e,ag()).exponent(e.exponent())},Xp.apply(e,arguments)}!function(e){Cy=function(e){var t=e.dateTime,n=e.date,r=e.time,a=e.periods,i=e.days,o=e.shortDays,s=e.months,l=e.shortMonths,c=$y(a),u=Fy(a),d=$y(i),f=Fy(i),p=$y(o),h=Fy(o),m=$y(s),y=Fy(s),x=$y(l),g=Fy(l),v={a:function(e){return o[e.getDay()]},A:function(e){return i[e.getDay()]},b:function(e){return l[e.getMonth()]},B:function(e){return s[e.getMonth()]},c:null,d:lx,e:lx,f:px,g:Sx,G:kx,H:cx,I:ux,j:dx,L:fx,m:hx,M:mx,p:function(e){return a[+(e.getHours()>=12)]},q:function(e){return 1+~~(e.getMonth()/3)},Q:Gx,s:Yx,S:yx,u:xx,U:gx,V:bx,w:jx,W:wx,x:null,X:null,y:Nx,Y:Ox,Z:Ax,"%":Xx},b={a:function(e){return o[e.getUTCDay()]},A:function(e){return i[e.getUTCDay()]},b:function(e){return l[e.getUTCMonth()]},B:function(e){return s[e.getUTCMonth()]},c:null,d:Px,e:Px,f:Tx,g:Wx,G:Vx,H:Ex,I:_x,j:Cx,L:Mx,m:Dx,M:Ix,p:function(e){return a[+(e.getUTCHours()>=12)]},q:function(e){return 1+~~(e.getUTCMonth()/3)},Q:Gx,s:Yx,S:Rx,u:Lx,U:Bx,V:$x,w:Fx,W:Ux,x:null,X:null,y:qx,Y:Hx,Z:Kx,"%":Xx},j={a:function(e,t,n){var r=p.exec(t.slice(n));return r?(e.w=h.get(r[0].toLowerCase()),n+r[0].length):-1},A:function(e,t,n){var r=d.exec(t.slice(n));return r?(e.w=f.get(r[0].toLowerCase()),n+r[0].length):-1},b:function(e,t,n){var r=x.exec(t.slice(n));return r?(e.m=g.get(r[0].toLowerCase()),n+r[0].length):-1},B:function(e,t,n){var r=m.exec(t.slice(n));return r?(e.m=y.get(r[0].toLowerCase()),n+r[0].length):-1},c:function(e,n,r){return S(e,t,n,r)},d:Zy,e:Zy,f:ax,g:Xy,G:Ky,H:ex,I:ex,j:Qy,L:rx,m:Jy,M:tx,p:function(e,t,n){var r=c.exec(t.slice(n));return r?(e.p=u.get(r[0].toLowerCase()),n+r[0].length):-1},q:Yy,Q:ox,s:sx,S:nx,u:qy,U:Wy,V:Hy,w:Uy,W:Vy,x:function(e,t,r){return S(e,n,t,r)},X:function(e,t,n){return S(e,r,t,n)},y:Xy,Y:Ky,Z:Gy,"%":ix};function w(e,t){return function(n){var r,a,i,o=[],s=-1,l=0,c=e.length;for(n instanceof Date||(n=new Date(+n));++s<c;)37===e.charCodeAt(s)&&(o.push(e.slice(l,s)),null!=(a=Dy[r=e.charAt(++s)])?r=e.charAt(++s):a="e"===r?" ":"0",(i=t[r])&&(r=i(n,a)),o.push(r),l=s+1);return o.push(e.slice(l,s)),o.join("")}}function N(e,t){return function(n){var r,a,i=_y(1900,void 0,1);if(S(i,e,n+="",0)!=n.length)return null;if("Q"in i)return new Date(i.Q);if("s"in i)return new Date(1e3*i.s+("L"in i?i.L:0));if(t&&!("Z"in i)&&(i.Z=0),"p"in i&&(i.H=i.H%12+12*i.p),void 0===i.m&&(i.m="q"in i?i.q:0),"V"in i){if(i.V<1||i.V>53)return null;"w"in i||(i.w=1),"Z"in i?(a=(r=Ey(_y(i.y,0,1))).getUTCDay(),r=a>4||0===a?py.ceil(r):py(r),r=ty.offset(r,7*(i.V-1)),i.y=r.getUTCFullYear(),i.m=r.getUTCMonth(),i.d=r.getUTCDate()+(i.w+6)%7):(a=(r=Py(_y(i.y,0,1))).getDay(),r=a>4||0===a?iy.ceil(r):iy(r),r=ey.offset(r,7*(i.V-1)),i.y=r.getFullYear(),i.m=r.getMonth(),i.d=r.getDate()+(i.w+6)%7)}else("W"in i||"U"in i)&&("w"in i||(i.w="u"in i?i.u%7:"W"in i?1:0),a="Z"in i?Ey(_y(i.y,0,1)).getUTCDay():Py(_y(i.y,0,1)).getDay(),i.m=0,i.d="W"in i?(i.w+6)%7+7*i.W-(a+5)%7:i.w+7*i.U-(a+6)%7);return"Z"in i?(i.H+=i.Z/100|0,i.M+=i.Z%100,Ey(i)):Py(i)}}function S(e,t,n,r){for(var a,i,o=0,s=t.length,l=n.length;o<s;){if(r>=l)return-1;if(37===(a=t.charCodeAt(o++))){if(a=t.charAt(o++),!(i=j[a in Dy?t.charAt(o++):a])||(r=i(e,n,r))<0)return-1}else if(a!=n.charCodeAt(r++))return-1}return r}return v.x=w(n,v),v.X=w(r,v),v.c=w(t,v),b.x=w(n,b),b.X=w(r,b),b.c=w(t,b),{format:function(e){var t=w(e+="",v);return t.toString=function(){return e},t},parse:function(e){var t=N(e+="",!1);return t.toString=function(){return e},t},utcFormat:function(e){var t=w(e+="",b);return t.toString=function(){return e},t},utcParse:function(e){var t=N(e+="",!0);return t.toString=function(){return e},t}}}(e),My=Cy.format,Cy.parse,Ty=Cy.utcFormat,Cy.utcParse}({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});const ig=Object.freeze(Object.defineProperty({__proto__:null,scaleBand:Jp,scaleDiverging:function e(){var t=vm(rg()(Yh));return t.copy=function(){return tg(t,e())},Xp.apply(t,arguments)},scaleDivergingLog:function e(){var t=Pm(rg()).domain([.1,1,10]);return t.copy=function(){return tg(t,e()).base(t.base())},Xp.apply(t,arguments)},scaleDivergingPow:ag,scaleDivergingSqrt:function(){return ag.apply(null,arguments).exponent(.5)},scaleDivergingSymlog:function e(){var t=Cm(rg());return t.copy=function(){return tg(t,e()).constant(t.constant())},Xp.apply(t,arguments)},scaleIdentity:function e(t){var n;function r(e){return null==e||isNaN(e=+e)?n:e}return r.invert=r,r.domain=r.range=function(e){return arguments.length?(t=Array.from(e,Xh),r):t.slice()},r.unknown=function(e){return arguments.length?(n=e,r):n},r.copy=function(){return e(t).unknown(n)},t=arguments.length?Array.from(t,Xh):[0,1],vm(r)},scaleImplicit:Gp,scaleLinear:bm,scaleLog:function e(){const t=Pm(tm()).domain([1,10]);return t.copy=()=>em(t,e()).base(t.base()),Kp.apply(t,arguments),t},scaleOrdinal:Yp,scalePoint:Qp,scalePow:Rm,scaleQuantile:function e(){var t,n=[],r=[],a=[];function i(){var e=0,t=Math.max(1,r.length);for(a=new Array(t-1);++e<t;)a[e-1]=Vp(n,e/t);return o}function o(e){return null==e||isNaN(e=+e)?t:r[_p(a,e)]}return o.invertExtent=function(e){var t=r.indexOf(e);return t<0?[NaN,NaN]:[t>0?a[t-1]:n[0],t<a.length?a[t]:n[n.length-1]]},o.domain=function(e){if(!arguments.length)return n.slice();n=[];for(let t of e)null==t||isNaN(t=+t)||n.push(t);return n.sort(Op),i()},o.range=function(e){return arguments.length?(r=Array.from(e),i()):r.slice()},o.unknown=function(e){return arguments.length?(t=e,o):t},o.quantiles=function(){return a.slice()},o.copy=function(){return e().domain(n).range(r).unknown(t)},Kp.apply(o,arguments)},scaleQuantize:function e(){var t,n=0,r=1,a=1,i=[.5],o=[0,1];function s(e){return null!=e&&e<=e?o[_p(i,e,0,a)]:t}function l(){var e=-1;for(i=new Array(a);++e<a;)i[e]=((e+1)*r-(e-a)*n)/(a+1);return s}return s.domain=function(e){return arguments.length?([n,r]=e,n=+n,r=+r,l()):[n,r]},s.range=function(e){return arguments.length?(a=(o=Array.from(e)).length-1,l()):o.slice()},s.invertExtent=function(e){var t=o.indexOf(e);return t<0?[NaN,NaN]:t<1?[n,i[0]]:t>=a?[i[a-1],r]:[i[t-1],i[t]]},s.unknown=function(e){return arguments.length?(t=e,s):s},s.thresholds=function(){return i.slice()},s.copy=function(){return e().domain([n,r]).range(o).unknown(t)},Kp.apply(vm(s),arguments)},scaleRadial:function e(){var t,n=nm(),r=[0,1],a=!1;function i(e){var r=function(e){return Math.sign(e)*Math.sqrt(Math.abs(e))}(n(e));return isNaN(r)?t:a?Math.round(r):r}return i.invert=function(e){return n.invert(Lm(e))},i.domain=function(e){return arguments.length?(n.domain(e),i):n.domain()},i.range=function(e){return arguments.length?(n.range((r=Array.from(e,Xh)).map(Lm)),i):r.slice()},i.rangeRound=function(e){return i.range(e).round(!0)},i.round=function(e){return arguments.length?(a=!!e,i):a},i.clamp=function(e){return arguments.length?(n.clamp(e),i):n.clamp()},i.unknown=function(e){return arguments.length?(t=e,i):t},i.copy=function(){return e(n.domain(),r).round(a).clamp(n.clamp()).unknown(t)},Kp.apply(i,arguments),vm(i)},scaleSequential:function e(){var t=vm(eg()(Yh));return t.copy=function(){return tg(t,e())},Xp.apply(t,arguments)},scaleSequentialLog:function e(){var t=Pm(eg()).domain([1,10]);return t.copy=function(){return tg(t,e()).base(t.base())},Xp.apply(t,arguments)},scaleSequentialPow:ng,scaleSequentialQuantile:function e(){var t=[],n=Yh;function r(e){if(null!=e&&!isNaN(e=+e))return n((_p(t,e,1)-1)/(t.length-1))}return r.domain=function(e){if(!arguments.length)return t.slice();t=[];for(let n of e)null==n||isNaN(n=+n)||t.push(n);return t.sort(Op),r},r.interpolator=function(e){return arguments.length?(n=e,r):n},r.range=function(){return t.map((e,r)=>n(r/(t.length-1)))},r.quantiles=function(e){return Array.from({length:e+1},(n,r)=>function(e,t){if((n=(e=Float64Array.from(function*(e){for(let t of e)null!=t&&(t=+t)>=t&&(yield t)}(e))).length)&&!isNaN(t=+t)){if(t<=0||n<2)return qp(e);if(t>=1)return Up(e);var n,r=(n-1)*t,a=Math.floor(r),i=Up(Wp(e,a).subarray(0,a+1));return i+(qp(e.subarray(a+1))-i)*(r-a)}}(t,r/e))},r.copy=function(){return e(n).domain(t)},Xp.apply(r,arguments)},scaleSequentialSqrt:function(){return ng.apply(null,arguments).exponent(.5)},scaleSequentialSymlog:function e(){var t=Cm(eg());return t.copy=function(){return tg(t,e()).constant(t.constant())},Xp.apply(t,arguments)},scaleSqrt:function(){return Rm.apply(null,arguments).exponent(.5)},scaleSymlog:function e(){var t=Cm(tm());return t.copy=function(){return em(t,e()).constant(t.constant())},Kp.apply(t,arguments)},scaleThreshold:function e(){var t,n=[.5],r=[0,1],a=1;function i(e){return null!=e&&e<=e?r[_p(n,e,0,a)]:t}return i.domain=function(e){return arguments.length?(n=Array.from(e),a=Math.min(n.length,r.length-1),i):n.slice()},i.range=function(e){return arguments.length?(r=Array.from(e),a=Math.min(n.length,r.length-1),i):r.slice()},i.invertExtent=function(e){var t=r.indexOf(e);return[n[t-1],n[t]]},i.unknown=function(e){return arguments.length?(t=e,i):t},i.copy=function(){return e().domain(n).range(r).unknown(t)},Kp.apply(i,arguments)},scaleTime:function(){return Kp.apply(Qx(ky,Ay,jy,vy,ay,ey,Zm,Ym,Gm,My).domain([new Date(2e3,0,1),new Date(2e3,0,2)]),arguments)},scaleUtc:function(){return Kp.apply(Qx(Sy,Oy,wy,by,fy,ty,Qm,Jm,Gm,Ty).domain([Date.UTC(2e3,0,1),Date.UTC(2e3,0,2)]),arguments)},tickFormat:gm},Symbol.toStringTag,{value:"Module"}));var og=mt;var sg=function(e,t,n){for(var r=-1,a=e.length;++r<a;){var i=e[r],o=t(i);if(null!=o&&(void 0===s?o==o&&!og(o):n(o,s)))var s=o,l=i}return l};var lg=function(e,t){return e>t},cg=sg,ug=lg,dg=Fc;const fg=a(function(e){return e&&e.length?cg(e,dg,ug):void 0});var pg=function(e,t){return e<t},hg=sg,mg=pg,yg=Fc;const xg=a(function(e){return e&&e.length?hg(e,yg,mg):void 0});var gg=Jn,vg=Zc,bg=Vu,jg=Ge;var wg=Bu,Ng=function(e,t){return(jg(e)?gg:bg)(e,vg(t))};const Sg=a(function(e,t){return wg(Ng(e,t),1)});var Og=mc;const kg=a(function(e,t){return Og(e,t)});var Ag,Pg=1e9,Eg=!0,_g="[DecimalError] ",Cg=_g+"Invalid argument: ",Mg=_g+"Exponent out of range: ",Tg=Math.floor,Dg=Math.pow,Ig=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,Rg=1e7,Lg=9007199254740991,Bg=Tg(1286742750677284.5),zg={};function $g(e,t){var n,r,a,i,o,s,l,c,u=e.constructor,d=u.precision;if(!e.s||!t.s)return t.s||(t=new u(e)),Eg?Yg(t,d):t;if(l=e.d,c=t.d,o=e.e,a=t.e,l=l.slice(),i=o-a){for(i<0?(r=l,i=-i,s=c.length):(r=c,a=o,s=l.length),i>(s=(o=Math.ceil(d/7))>s?o+1:s+1)&&(i=s,r.length=1),r.reverse();i--;)r.push(0);r.reverse()}for((s=l.length)-(i=c.length)<0&&(i=s,r=c,c=l,l=r),n=0;i;)n=(l[--i]=l[i]+c[i]+n)/Rg|0,l[i]%=Rg;for(n&&(l.unshift(n),++a),s=l.length;0==l[--s];)l.pop();return t.d=l,t.e=a,Eg?Yg(t,d):t}function Fg(e,t,n){if(e!==~~e||e<t||e>n)throw Error(Cg+e)}function Ug(e){var t,n,r,a=e.length-1,i="",o=e[0];if(a>0){for(i+=o,t=1;t<a;t++)(n=7-(r=e[t]+"").length)&&(i+=Kg(n)),i+=r;(n=7-(r=(o=e[t])+"").length)&&(i+=Kg(n))}else if(0===o)return"0";for(;o%10==0;)o/=10;return i+o}zg.absoluteValue=zg.abs=function(){var e=new this.constructor(this);return e.s&&(e.s=1),e},zg.comparedTo=zg.cmp=function(e){var t,n,r,a,i=this;if(e=new i.constructor(e),i.s!==e.s)return i.s||-e.s;if(i.e!==e.e)return i.e>e.e^i.s<0?1:-1;for(t=0,n=(r=i.d.length)<(a=e.d.length)?r:a;t<n;++t)if(i.d[t]!==e.d[t])return i.d[t]>e.d[t]^i.s<0?1:-1;return r===a?0:r>a^i.s<0?1:-1},zg.decimalPlaces=zg.dp=function(){var e=this,t=e.d.length-1,n=7*(t-e.e);if(t=e.d[t])for(;t%10==0;t/=10)n--;return n<0?0:n},zg.dividedBy=zg.div=function(e){return qg(this,new this.constructor(e))},zg.dividedToIntegerBy=zg.idiv=function(e){var t=this.constructor;return Yg(qg(this,new t(e),0,1),t.precision)},zg.equals=zg.eq=function(e){return!this.cmp(e)},zg.exponent=function(){return Hg(this)},zg.greaterThan=zg.gt=function(e){return this.cmp(e)>0},zg.greaterThanOrEqualTo=zg.gte=function(e){return this.cmp(e)>=0},zg.isInteger=zg.isint=function(){return this.e>this.d.length-2},zg.isNegative=zg.isneg=function(){return this.s<0},zg.isPositive=zg.ispos=function(){return this.s>0},zg.isZero=function(){return 0===this.s},zg.lessThan=zg.lt=function(e){return this.cmp(e)<0}
vendor: 2,564 bytes, line 13
13,zg.lessThanOrEqualTo=zg.lte=function(e){return this.cmp(e)<1},zg.logarithm=zg.log=function(e){var t,n=this,r=n.constructor,a=r.precision,i=a+5;if(void 0===e)e=new r(10);else if((e=new r(e)).s<1||e.eq(Ag))throw Error(_g+"NaN");if(n.s<1)throw Error(_g+(n.s?"NaN":"-Infinity"));return n.eq(Ag)?new r(0):(Eg=!1,t=qg(Xg(n,i),Xg(e,i),i),Eg=!0,Yg(t,a))},zg.minus=zg.sub=function(e){var t=this;return e=new t.constructor(e),t.s==e.s?Jg(t,e):$g(t,(e.s=-e.s,e))},zg.modulo=zg.mod=function(e){var t,n=this,r=n.constructor,a=r.precision;if(!(e=new r(e)).s)throw Error(_g+"NaN");return n.s?(Eg=!1,t=qg(n,e,0,1).times(e),Eg=!0,n.minus(t)):Yg(new r(n),a)},zg.naturalExponential=zg.exp=function(){return Wg(this)},zg.naturalLogarithm=zg.ln=function(){return Xg(this)},zg.negated=zg.neg=function(){var e=new this.constructor(this);return e.s=-e.s||0,e},zg.plus=zg.add=function(e){var t=this;return e=new t.constructor(e),t.s==e.s?$g(t,e):Jg(t,(e.s=-e.s,e))},zg.precision=zg.sd=function(e){var t,n,r,a=this;if(void 0!==e&&e!==!!e&&1!==e&&0!==e)throw Error(Cg+e);if(t=Hg(a)+1,n=7*(r=a.d.length-1)+1,r=a.d[r]){for(;r%10==0;r/=10)n--;for(r=a.d[0];r>=10;r/=10)n++}return e&&t>n?t:n},zg.squareRoot=zg.sqrt=function(){var e,t,n,r,a,i,o,s=this,l=s.constructor;if(s.s<1){if(!s.s)return new l(0);throw Error(_g+"NaN")}for(e=Hg(s),Eg=!1,0==(a=Math.sqrt(+s))||a==1/0?(((t=Ug(s.d)).length+e)%2==0&&(t+="0"),a=Math.sqrt(t),e=Tg((e+1)/2)-(e<0||e%2),r=new l(t=a==1/0?"5e"+e:(t=a.toExponential()).slice(0,t.indexOf("e")+1)+e)):r=new l(a.toString()),a=o=(n=l.precision)+3;;)if(r=(i=r).plus(qg(s,i,o+2)).times(.5),Ug(i.d).slice(0,o)===(t=Ug(r.d)).slice(0,o)){if(t=t.slice(o-3,o+1),a==o&&"4999"==t){if(Yg(i,n+1,0),i.times(i).eq(s)){r=i;break}}else if("9999"!=t)break;o+=4}return Eg=!0,Yg(r,n)},zg.times=zg.mul=function(e){var t,n,r,a,i,o,s,l,c,u=this,d=u.constructor,f=u.d,p=(e=new d(e)).d;if(!u.s||!e.s)return new d(0);for(e.s*=u.s,n=u.e+e.e,(l=f.length)<(c=p.length)&&(i=f,f=p,p=i,o=l,l=c,c=o),i=[],r=o=l+c;r--;)i.push(0);for(r=c;--r>=0;){for(t=0,a=l+r;a>r;)s=i[a]+p[r]*f[a-r-1]+t,i[a--]=s%Rg|0,t=s/Rg|0;i[a]=(i[a]+t)%Rg|0}for(;!i[--o];)i.pop();return t?++n:i.shift(),e.d=i,e.e=n,Eg?Yg(e,d.precision):e},zg.toDecimalPlaces=zg.todp=function(e,t){var n=this,r=n.constructor;return n=new r(n),void 0===e?n:(Fg(e,0,Pg),void 0===t?t=r.rounding:Fg(t,0,8),Yg(n,e+Hg(n)+1,t))},zg.toExponential=function(e,t){var n,r=this,a=r.constructor;return void 0===e?n=Zg(r,!0):(Fg(e,0,Pg),void 0===t?t=a.rounding:Fg(t,0,8),n=Zg(r=Yg(new a(r),e+1,t),!0,e+1)),n},zg.toFixed=function(e,t){var n,r,a=this,i=a.constructor;
vendor: 9,651 bytes, line 13
13return void 0===e?Zg(a):(Fg(e,0,Pg),void 0===t?t=i.rounding:Fg(t,0,8),n=Zg((r=Yg(new i(a),e+Hg(a)+1,t)).abs(),!1,e+Hg(r)+1),a.isneg()&&!a.isZero()?"-"+n:n)},zg.toInteger=zg.toint=function(){var e=this,t=e.constructor;return Yg(new t(e),Hg(e)+1,t.rounding)},zg.toNumber=function(){return+this},zg.toPower=zg.pow=function(e){var t,n,r,a,i,o,s=this,l=s.constructor,c=+(e=new l(e));if(!e.s)return new l(Ag);if(!(s=new l(s)).s){if(e.s<1)throw Error(_g+"Infinity");return s}if(s.eq(Ag))return s;if(r=l.precision,e.eq(Ag))return Yg(s,r);if(o=(t=e.e)>=(n=e.d.length-1),i=s.s,o){if((n=c<0?-c:c)<=Lg){for(a=new l(Ag),t=Math.ceil(r/7+4),Eg=!1;n%2&&Qg((a=a.times(s)).d,t),0!==(n=Tg(n/2));)Qg((s=s.times(s)).d,t);return Eg=!0,e.s<0?new l(Ag).div(a):Yg(a,r)}}else if(i<0)throw Error(_g+"NaN");return i=i<0&&1&e.d[Math.max(t,n)]?-1:1,s.s=1,Eg=!1,a=e.times(Xg(s,r+12)),Eg=!0,(a=Wg(a)).s=i,a},zg.toPrecision=function(e,t){var n,r,a=this,i=a.constructor;return void 0===e?r=Zg(a,(n=Hg(a))<=i.toExpNeg||n>=i.toExpPos):(Fg(e,1,Pg),void 0===t?t=i.rounding:Fg(t,0,8),r=Zg(a=Yg(new i(a),e,t),e<=(n=Hg(a))||n<=i.toExpNeg,e)),r},zg.toSignificantDigits=zg.tosd=function(e,t){var n=this.constructor;return void 0===e?(e=n.precision,t=n.rounding):(Fg(e,1,Pg),void 0===t?t=n.rounding:Fg(t,0,8)),Yg(new n(this),e,t)},zg.toString=zg.valueOf=zg.val=zg.toJSON=zg[Symbol.for("nodejs.util.inspect.custom")]=function(){var e=this,t=Hg(e),n=e.constructor;return Zg(e,t<=n.toExpNeg||t>=n.toExpPos)};var qg=function(){function e(e,t){var n,r=0,a=e.length;for(e=e.slice();a--;)n=e[a]*t+r,e[a]=n%Rg|0,r=n/Rg|0;return r&&e.unshift(r),e}function t(e,t,n,r){var a,i;if(n!=r)i=n>r?1:-1;else for(a=i=0;a<n;a++)if(e[a]!=t[a]){i=e[a]>t[a]?1:-1;break}return i}function n(e,t,n){for(var r=0;n--;)e[n]-=r,r=e[n]<t[n]?1:0,e[n]=r*Rg+e[n]-t[n];for(;!e[0]&&e.length>1;)e.shift()}return function(r,a,i,o){var s,l,c,u,d,f,p,h,m,y,x,g,v,b,j,w,N,S,O=r.constructor,k=r.s==a.s?1:-1,A=r.d,P=a.d;if(!r.s)return new O(r);if(!a.s)throw Error(_g+"Division by zero");for(l=r.e-a.e,N=P.length,j=A.length,h=(p=new O(k)).d=[],c=0;P[c]==(A[c]||0);)++c;if(P[c]>(A[c]||0)&&--l,(g=null==i?i=O.precision:o?i+(Hg(r)-Hg(a))+1:i)<0)return new O(0);if(g=g/7+2|0,c=0,1==N)for(u=0,P=P[0],g++;(c<j||u)&&g--;c++)v=u*Rg+(A[c]||0),h[c]=v/P|0,u=v%P|0;else{for((u=Rg/(P[0]+1)|0)>1&&(P=e(P,u),A=e(A,u),N=P.length,j=A.length),b=N,y=(m=A.slice(0,N)).length;y<N;)m[y++]=0;(S=P.slice()).unshift(0),w=P[0],P[1]>=Rg/2&&++w;do{u=0,(s=t(P,m,N,y))<0?(x=m[0],N!=y&&(x=x*Rg+(m[1]||0)),(u=x/w|0)>1?(u>=Rg&&(u=Rg-1),1==(s=t(d=e(P,u),m,f=d.length,y=m.length))&&(u--,n(d,N<f?S:P,f))):(0==u&&(s=u=1),d=P.slice()),(f=d.length)<y&&d.unshift(0),n(m,d,y),-1==s&&(s=t(P,m,N,y=m.length))<1&&(u++,n(m,N<y?S:P,y)),y=m.length):0===s&&(u++,m=[0]),h[c++]=u,s&&m[0]?m[y++]=A[b]||0:(m=[A[b]],y=1)}while((b++<j||void 0!==m[0])&&g--)}return h[0]||h.shift(),p.e=l,Yg(p,o?i+Hg(p)+1:i)}}();function Wg(e,t){var n,r,a,i,o,s=0,l=0,c=e.constructor,u=c.precision;if(Hg(e)>16)throw Error(Mg+Hg(e));if(!e.s)return new c(Ag);for(null==t?(Eg=!1,o=u):o=t,i=new c(.03125);e.abs().gte(.1);)e=e.times(i),l+=5;for(o+=Math.log(Dg(2,l))/Math.LN10*2+5|0,n=r=a=new c(Ag),c.precision=o;;){if(r=Yg(r.times(e),o),n=n.times(++s),Ug((i=a.plus(qg(r,n,o))).d).slice(0,o)===Ug(a.d).slice(0,o)){for(;l--;)a=Yg(a.times(a),o);return c.precision=u,null==t?(Eg=!0,Yg(a,u)):a}a=i}}function Hg(e){for(var t=7*e.e,n=e.d[0];n>=10;n/=10)t++;return t}function Vg(e,t,n){if(t>e.LN10.sd())throw Eg=!0,n&&(e.precision=n),Error(_g+"LN10 precision limit exceeded");return Yg(new e(e.LN10),t)}function Kg(e){for(var t="";e--;)t+="0";return t}function Xg(e,t){var n,r,a,i,o,s,l,c,u,d=1,f=e,p=f.d,h=f.constructor,m=h.precision;if(f.s<1)throw Error(_g+(f.s?"NaN":"-Infinity"));if(f.eq(Ag))return new h(0);if(null==t?(Eg=!1,c=m):c=t,f.eq(10))return null==t&&(Eg=!0),Vg(h,c);if(c+=10,h.precision=c,r=(n=Ug(p)).charAt(0),i=Hg(f),!(Math.abs(i)<15e14))return l=Vg(h,c+2,m).times(i+""),f=Xg(new h(r+"."+n.slice(1)),c-10).plus(l),h.precision=m,null==t?(Eg=!0,Yg(f,m)):f;for(;r<7&&1!=r||1==r&&n.charAt(1)>3;)r=(n=Ug((f=f.times(e)).d)).charAt(0),d++;for(i=Hg(f),r>1?(f=new h("0."+n),i++):f=new h(r+"."+n.slice(1)),s=o=f=qg(f.minus(Ag),f.plus(Ag),c),u=Yg(f.times(f),c),a=3;;){if(o=Yg(o.times(u),c),Ug((l=s.plus(qg(o,new h(a),c))).d).slice(0,c)===Ug(s.d).slice(0,c))return s=s.times(2),0!==i&&(s=s.plus(Vg(h,c+2,m).times(i+""))),s=qg(s,new h(d),c),h.precision=m,null==t?(Eg=!0,Yg(s,m)):s;s=l,a+=2}}function Gg(e,t){var n,r,a;for((n=t.indexOf("."))>-1&&(t=t.replace(".","")),(r=t.search(/e/i))>0?(n<0&&(n=r),n+=+t.slice(r+1),t=t.substring(0,r)):n<0&&(n=t.length),r=0;48===t.charCodeAt(r);)++r;for(a=t.length;48===t.charCodeAt(a-1);)--a;if(t=t.slice(r,a)){if(a-=r,n=n-r-1,e.e=Tg(n/7),e.d=[],r=(n+1)%7,n<0&&(r+=7),r<a){for(r&&e.d.push(+t.slice(0,r)),a-=7;r<a;)e.d.push(+t.slice(r,r+=7));r=7-(t=t.slice(r)).length}else r-=a;for(;r--;)t+="0";if(e.d.push(+t),Eg&&(e.e>Bg||e.e<-Bg))throw Error(Mg+n)}else e.s=0,e.e=0,e.d=[0];return e}function Yg(e,t,n){var r,a,i,o,s,l,c,u,d=e.d;for(o=1,i=d[0];i>=10;i/=10)o++;if((r=t-o)<0)r+=7,a=t,c=d[u=0];else{if((u=Math.ceil((r+1)/7))>=(i=d.length))return e;for(c=i=d[u],o=1;i>=10;i/=10)o++;a=(r%=7)-7+o}if(void 0!==n&&(s=c/(i=Dg(10,o-a-1))%10|0,l=t<0||void 0!==d[u+1]||c%i,l=n<4?(s||l)&&(0==n||n==(e.s<0?3:2)):s>5||5==s&&(4==n||l||6==n&&(r>0?a>0?c/Dg(10,o-a):0:d[u-1])%10&1||n==(e.s<0?8:7))),t<1||!d[0])return l?(i=Hg(e),d.length=1,t=t-i-1,d[0]=Dg(10,(7-t%7)%7),e.e=Tg(-t/7)||0):(d.length=1,d[0]=e.e=e.s=0),e;if(0==r?(d.length=u,i=1,u--):(d.length=u+1,i=Dg(10,7-r),d[u]=a>0?(c/Dg(10,o-a)%Dg(10,a)|0)*i:0),l)for(;;){if(0==u){(d[0]+=i)==Rg&&(d[0]=1,++e.e);break}if(d[u]+=i,d[u]!=Rg)break;d[u--]=0,i=1}for(r=d.length;0===d[--r];)d.pop();if(Eg&&(e.e>Bg||e.e<-Bg))throw Error(Mg+Hg(e));return e}function Jg(e,t){var n,r,a,i,o,s,l,c,u,d,f=e.constructor,p=f.precision;if(!e.s||!t.s)return t.s?t.s=-t.s:t=new f(e),Eg?Yg(t,p):t;if(l=e.d,d=t.d,r=t.e,c=e.e,l=l.slice(),o=c-r){for((u=o<0)?(n=l,o=-o,s=d.length):(n=d,r=c,s=l.length),o>(a=Math.max(Math.ceil(p/7),s)+2)&&(o=a,n.length=1),n.reverse(),a=o;a--;)n.push(0);n.reverse()}else{for((u=(a=l.length)<(s=d.length))&&(s=a),a=0;a<s;a++)if(l[a]!=d[a]){u=l[a]<d[a];break}o=0}for(u&&(n=l,l=d,d=n,t.s=-t.s),s=l.length,a=d.length-s;a>0;--a)l[s++]=0;for(a=d.length;a>o;){if(l[--a]<d[a]){for(i=a;i&&0===l[--i];)l[i]=Rg-1;--l[i],l[a]+=Rg}l[a]-=d[a]}for(;0===l[--s];)l.pop();for(;0===l[0];l.shift())--r;return l[0]?(t.d=l,t.e=r,Eg?Yg(t,p):t):new f(0)}function Zg(e,t,n){var r,a=Hg(e),i=Ug(e.d),o=i.length;return t?(n&&(r=n-o)>0?i=i.charAt(0)+"."+i.slice(1)+Kg(r):o>1&&(i=i.charAt(0)+"."+i.slice(1)),i=i+(a<0?"e":"e+")+a):a<0?(i="0."+Kg(-a-1)+i,n&&(r=n-o)>0&&(i+=Kg(r))):a>=o?(i+=Kg(a+1-o),n&&(r=n-a-1)>0&&(i=i+"."+Kg(r))):((r=a+1)<o&&(i=i.slice(0,r)+"."+i.slice(r)),n&&(r=n-o)>0&&(a+1===o&&(i+="."),i+=Kg(r))),e.s<0?"-"+i:i}function Qg(e,t){if(e.length>t)return e.length=t,!0}function ev(e){if(!e||"object"!=typeof e)throw Error(_g+"Object expected");var t,n,r,a=["precision",1,Pg,"rounding",0,8,"toExpNeg",-1/0,0,"toExpPos",0,1/0];for(t=0;t<a.length;t+=3)if(void 0!==(r=e[n=a[t]])){if(!(Tg(r)===r&&r>=a[t+1]&&r<=a[t+2]))throw Error(Cg+n+": "+r);this[n]=r}if(void 0!==(r=e[n="LN10"])){if(r!=Math.LN10)throw Error(Cg+n+": "+r);this[n]=new this(r)}return this}var tv=function e(t){var n,r,a;function i(e){var t=this;if(!(t instanceof i))return new i(e);if(t.constructor=i,e instanceof i)return t.s=e.s,t.e=e.e,void(t.d=(e=e.d)?e.slice():e);if("number"==typeof e){if(0*e!=0)throw Error(Cg+e);if(e>0)t.s=1;else{if(!(e<0))return t.s=0,t.e=0,void(t.d=[0]);e=-e,t.s=-1}return e===~~e&&e<1e7?(t.e=0,void(t.d=[e])):Gg(t,e.toString())}if("string"!=typeof e)throw Error(Cg+e);if(45===e.charCodeAt(0)?(e=e.slice(1),t.s=-1):t.s=1,!Ig.test(e))throw Error(Cg+e);Gg(t,e)}if(i.prototype=zg,i.ROUND_UP=0,i.ROUND_DOWN=1,i.ROUND_CEIL=2,i.ROUND_FLOOR=3,i.ROUND_HALF_UP=4,i.ROUND_HALF_DOWN=5,i.ROUND_HALF_EVEN=6,i.ROUND_HALF_CEIL=7,i.ROUND_HALF_FLOOR=8,i.clone=e,i.config=i.set=ev,void 0===t&&(t={}),t)for(a=["precision","rounding","toExpNeg","toExpPos","LN10"],n=0;n<a.length;)t.hasOwnProperty(r=a[n++])||(t[r]=this[r]);return i.config(t),i}({precision:20,rounding:4,toExpNeg:-7,toExpPos:21,LN10:"2.302585092994045684017991454684364207601101488628772976033327900967572609677352480235997205089598298341967784042286"});Ag=new tv(1);const nv=tv;function rv(e){return function(e){if(Array.isArray(e))return av(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return av(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return av(e,t)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function av(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var iv=function(e){return e},ov={"@@functional/placeholder":!0},sv=function(e){return e===ov},lv=function(e){return function t(){return 0===arguments.length||1===arguments.length&&sv(arguments.length<=0?void 0:arguments[0])?t:e.apply(void 0,arguments)}},cv=function e(t,n){return 1===t?n:lv(function(){for(var r=arguments.length,a=new Array(r),i=0;i<r;i++)a[i]=arguments[i];var o=a.filter(function(e){return e!==ov}).length;return o>=t?n.apply(void 0,a):e(t-o,lv(function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];var i=a.map(function(e){return sv(e)?t.shift():e});
vendor: 4,353 bytes, line 13
13return n.apply(void 0,rv(i).concat(t))}))})},uv=function(e){return cv(e.length,e)},dv=function(e,t){for(var n=[],r=e;r<t;++r)n[r-e]=r;return n},fv=uv(function(e,t){return Array.isArray(t)?t.map(e):Object.keys(t).map(function(e){return t[e]}).map(e)}),pv=function(e){return Array.isArray(e)?e.reverse():e.split("").reverse.join("")},hv=function(e){var t=null,n=null;return function(){for(var r=arguments.length,a=new Array(r),i=0;i<r;i++)a[i]=arguments[i];return t&&a.every(function(e,n){return e===t[n]})?n:(t=a,n=e.apply(void 0,a))}};const mv={rangeStep:function(e,t,n){for(var r=new nv(e),a=0,i=[];r.lt(t)&&a<1e5;)i.push(r.toNumber()),r=r.add(n),a++;return i},getDigitCount:function(e){return 0===e?1:Math.floor(new nv(e).abs().log(10).toNumber())+1},interpolateNumber:uv(function(e,t,n){var r=+e;return r+n*(+t-r)}),uninterpolateNumber:uv(function(e,t,n){var r=t-+e;return(n-e)/(r=r||1/0)}),uninterpolateTruncation:uv(function(e,t,n){var r=t-+e;return r=r||1/0,Math.max(0,Math.min(1,(n-e)/r))})};function yv(e){return function(e){if(Array.isArray(e))return vv(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||gv(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function xv(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var n=[],r=!0,a=!1,i=void 0;try{for(var o,s=e[Symbol.iterator]();!(r=(o=s.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(l){a=!0,i=l}finally{try{r||null==s.return||s.return()}finally{if(a)throw i}}return n}(e,t)||gv(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function gv(e,t){if(e){if("string"==typeof e)return vv(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?vv(e,t):void 0}}function vv(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function bv(e){var t=xv(e,2),n=t[0],r=t[1],a=n,i=r;return n>r&&(a=r,i=n),[a,i]}function jv(e,t,n){if(e.lte(0))return new nv(0);var r=mv.getDigitCount(e.toNumber()),a=new nv(10).pow(r),i=e.div(a),o=1!==r?.05:.1,s=new nv(Math.ceil(i.div(o).toNumber())).add(n).mul(o).mul(a);return t?s:new nv(Math.ceil(s))}function wv(e,t,n){var r=1,a=new nv(e);if(!a.isint()&&n){var i=Math.abs(e);i<1?(r=new nv(10).pow(mv.getDigitCount(e)-1),a=new nv(Math.floor(a.div(r).toNumber())).mul(r)):i>1&&(a=new nv(Math.floor(e)))}else 0===e?a=new nv(Math.floor((t-1)/2)):n||(a=new nv(Math.floor(e)));var o=Math.floor((t-1)/2),s=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];if(!t.length)return iv;var r=t.reverse(),a=r[0],i=r.slice(1);return function(){return i.reduce(function(e,t){return t(e)},a.apply(void 0,arguments))}}(fv(function(e){return a.add(new nv(e-o).mul(r)).toNumber()}),dv);return s(0,t)}function Nv(e,t,n,r){var a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;if(!Number.isFinite((t-e)/(n-1)))return{step:new nv(0),tickMin:new nv(0),tickMax:new nv(0)};var i,o=jv(new nv(t).sub(e).div(n-1),r,a);i=e<=0&&t>=0?new nv(0):(i=new nv(e).add(t).div(2)).sub(new nv(i).mod(o));var s=Math.ceil(i.sub(e).div(o).toNumber()),l=Math.ceil(new nv(t).sub(i).div(o).toNumber()),c=s+l+1;return c>n?Nv(e,t,n,r,a+1):(c<n&&(l=t>0?l+(n-c):l,s=t>0?s:s+(n-c)),{step:o,tickMin:i.sub(new nv(s).mul(o)),tickMax:i.add(new nv(l).mul(o))})}var Sv=hv(function(e){var t=xv(e,2),n=t[0],r=t[1],a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:6,i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],o=Math.max(a,2),s=xv(bv([n,r]),2),l=s[0],c=s[1];if(l===-1/0||c===1/0){var u=c===1/0?[l].concat(yv(dv(0,a-1).map(function(){return 1/0}))):[].concat(yv(dv(0,a-1).map(function(){return-1/0})),[c]);return n>r?pv(u):u}if(l===c)return wv(l,a,i);var d=Nv(l,c,o,i),f=d.step,p=d.tickMin,h=d.tickMax,m=mv.rangeStep(p,h.add(new nv(.1).mul(f)),f);return n>r?pv(m):m}),Ov=hv(function(e,t){var n=xv(e,2),r=n[0],a=n[1],i=!(arguments.length>
vendor: 11,301 bytes, line 13
132&&void 0!==arguments[2])||arguments[2],o=xv(bv([r,a]),2),s=o[0],l=o[1];if(s===-1/0||l===1/0)return[r,a];if(s===l)return[s];var c=Math.max(t,2),u=jv(new nv(l).sub(s).div(c-1),i,0),d=[].concat(yv(mv.rangeStep(new nv(s),new nv(l).sub(new nv(.99).mul(u)),u)),[l]);return r>a?pv(d):d});function kv(e,t){throw new Error("Invariant failed")}var Av=["offset","layout","width","dataKey","data","dataPointFormatter","xAxis","yAxis"];function Pv(e){return(Pv="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Ev(){return Ev=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},Ev.apply(this,arguments)}function _v(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,i,o,s=[],l=!0,c=!1;try{if(i=(n=n.call(e)).next,0===t);else for(;!(l=(r=i.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(u){c=!0,a=u}finally{try{if(!l&&null!=n.return&&(o=n.return(),Object(o)!==o))return}finally{if(c)throw a}}return s}}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return Cv(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Cv(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Cv(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Mv(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)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}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}function Tv(e,t,n){return t&&function(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,zv(r.key),r)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function Dv(e,t,n){return t=Rv(t),function(e,t){if(t&&("object"===Pv(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,Iv()?Reflect.construct(t,n||[],Rv(e).constructor):t.apply(e,n))}function Iv(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Iv=function(){return!!e})()}function Rv(e){return(Rv=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Lv(e,t){return(Lv=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function Bv(e,t,n){return(t=zv(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function zv(e){var t=function(e,t){if("object"!=Pv(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=Pv(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==Pv(t)?t:t+""}var $v=function(){function e(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),Dv(this,e,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)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&&Lv(e,t)}(e,s.Component),Tv(e,[{key:"render",value:function(){var e=this.props,t=e.offset,n=e.layout,r=e.width,a=e.dataKey,i=e.data,o=e.dataPointFormatter,l=e.xAxis,c=e.yAxis,u=Mv(e,Av),d=Pa(u,!1);"x"===this.props.direction&&"number"!==l.type&&kv();var f=i.map(function(e){var i=o(e,a),u=i.x,f=i.y,p=i.value,h=i.errorVal;if(!h)return null;var m,y,x=[];if(Array.isArray(h)){var g=_v(h,2);m=g[0],y=g[1]}else m=y=h;if("vertical"===n){var v=l.scale,b=f+t,j=b+r,w=b-r,N=v(p-m),S=v(p+y);x.push({x1:S,y1:j,x2:S,y2:w}),x.push({x1:N,y1:b,x2:S,y2:b}),x.push({x1:N,y1:j,x2:N,y2:w})}else if("horizontal"===n){var O=c.scale,k=u+t,A=k-r,P=k+r,E=O(p-m),_=O(p+y);x.push({x1:A,y1:_,x2:P,y2:_}),x.push({x1:k,y1:E,x2:k,y2:_}),x.push({x1:A,y1:E,x2:P,y2:E})}return s.createElement(za,Ev({className:"recharts-errorBar",key:"bar-".concat(x.map(function(e){return"".concat(e.x1,"-").concat(e.x2,"-").concat(e.y1,"-").concat(e.y2)}))},d),x.map(function(e){return s.createElement("line",Ev({},e,{key:"line-".concat(e.x1,"-").concat(e.x2,"-").concat(e.y1,"-").concat(e.y2)}))}))});return s.createElement(za,{className:"recharts-errorBars"},f)}}])}();function Fv(e){return(Fv="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Uv(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function qv(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Uv(Object(n),!0).forEach(function(t){Wv(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Uv(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Wv(e,t,n){var r;return r=function(e,t){if("object"!=Fv(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=Fv(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(t,"string"),(t="symbol"==Fv(r)?r:r+"")in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}Bv($v,"defaultProps",{stroke:"black",strokeWidth:1.5,width:5,offset:0,layout:"horizontal"}),Bv($v,"displayName","ErrorBar");var Hv=function(e){var t=e.children,n=e.formattedGraphicalItems,r=e.legendWidth,a=e.legendContent,i=Sa(t,Mu);if(!i)return null;var o,s=Mu.defaultProps,l=void 0!==s?qv(qv({},s),i.props):{};return o=i.props&&i.props.payload?i.props&&i.props.payload:"children"===a?(n||[]).reduce(function(e,t){var n=t.item,r=t.props,a=r.sectors||r.data||[];return e.concat(a.map(function(e){return{type:i.props.iconType||n.props.legendType,value:e.name,color:e.fill,payload:e}}))},[]):(n||[]).map(function(e){var t=e.item,n=t.type.defaultProps,r=void 0!==n?qv(qv({},n),t.props):{},a=r.dataKey,i=r.name,o=r.legendType;return{inactive:r.hide,dataKey:a,type:l.iconType||o||"square",color:eb(t),value:i||a,payload:r}}),qv(qv(qv({},l),Mu.getWithHeight(i,r)),{},{payload:o,item:i})};function Vv(e){return(Vv="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Kv(e){return function(e){if(Array.isArray(e))return Xv(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return Xv(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Xv(e,t)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Xv(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Gv(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Yv(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Gv(Object(n),!0).forEach(function(t){Jv(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Gv(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Jv(e,t,n){var r;return r=function(e,t){if("object"!=Vv(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=Vv(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(t,"string"),(t="symbol"==Vv(r)?r:r+"")in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Zv(e,t,n){return vr(e)||vr(t)?n:Zr(t)?gr(e,t,n):kt(t)?t(e):n}function Qv(e,t,n,r){var a=Sg(e,function(e){return Zv(e,t)});if("number"===n){var i=a.filter(function(e){return Jr(e)||parseFloat(e)});return i.length?[xg(i),fg(i)]:[1/0,-1/0]}return(r?a.filter(function(e){return!vr(e)}):a).map(function(e){return Zr(e)||e instanceof Date?e:""})}var eb=function(e){var t,n,r=e.type.displayName,a=null!==(t=e.type)&&void 0!==t&&t.defaultProps?Yv(Yv({},e.type.defaultProps),e.props):e.props,i=a.stroke,o=a.fill;switch(r){case"Line":n=i;break;case"Area":case"Radar":n=i&&"none"!==i?i:o;break;default:n=o}return n},tb=function(e,t,n,r,a){var i=Na(t.props.children,$v).filter(function(e){return function(e,t,n){return!!vr(t)||("horizontal"===e?"yAxis"===t:"vertical"===e||"x"===n?"xAxis"===t:"y"!==n||"yAxis"===t)}(r,a,e.props.direction)});if(i&&i.length){var o=i.map(function(e){return e.props.dataKey});return e.reduce(function(e,t){var r=Zv(t,n);if(vr(r))return e;var a=Array.isArray(r)?[xg(r),fg(r)]:[r,r],i=o.reduce(function(e,n){var r=Zv(t,n,0),i=a[0]-Math.abs(Array.isArray(r)?r[0]:r),o=a[1]+Math.abs(Array.isArray(r)?r[1]:r);return[Math.min(i,e[0]),Math.max(o,e[1])]},[1/0,-1/0]);return[Math.min(i[0],e[0]),Math.max(i[1],e[1])]},[1/0,-1/0])}return null},nb=function(e,t,n,r,a){var i=t.map(function(t){var i=t.props.dataKey;return"number"===n&&i&&tb(e,t,i,r)||Qv(e,i,n,a)});if("number"===n)return i.reduce(function(e,t){return[Math.min(e[0],t[0]),Math.max(e[1],t[1])]},[1/0,-1/0]);var o={};return i.reduce(function(e,t){for(var n=0,r=t.length;n<r;n++)o[t[n]]||(o[t[n]]=!0,e.push(t[n]));return e},[])},rb=function(e,t){return"horizontal"===e&&"xAxis"===t||"vertical"===e&&"yAxis"===t||"centric"===e&&"angleAxis"===t||"radial"===e&&"radiusAxis"===t},ab=function(e,t,n,r){if(r)return e.map(function(e){return e.coordinate});
vendor: 1,426 bytes, line 13
13var a,i,o=e.map(function(e){return e.coordinate===t&&(a=!0),e.coordinate===n&&(i=!0),e.coordinate});return a||o.push(t),i||o.push(n),o},ib=function(e,t,n){if(!e)return null;var r=e.scale,a=e.duplicateDomain,i=e.type,o=e.range,s="scaleBand"===e.realScaleType?r.bandwidth()/2:2,l=(t||n)&&"category"===i&&r.bandwidth?r.bandwidth()/s:0;return l="angleAxis"===e.axisType&&(null==o?void 0:o.length)>=2?2*Gr(o[0]-o[1])*l:l,t&&(e.ticks||e.niceTicks)?(e.ticks||e.niceTicks).map(function(e){var t=a?a.indexOf(e):e;return{coordinate:r(t)+l,value:e,offset:l}}).filter(function(e){return!Xr(e.coordinate)}):e.isCategorical&&e.categoricalDomain?e.categoricalDomain.map(function(e,t){return{coordinate:r(e)+l,value:e,index:t,offset:l}}):r.ticks&&!n?r.ticks(e.tickCount).map(function(e){return{coordinate:r(e)+l,value:e,offset:l}}):r.domain().map(function(e,t){return{coordinate:r(e)+l,value:a?a[e]:e,index:t,offset:l}})},ob=new WeakMap,sb=function(e,t){if("function"!=typeof t)return e;ob.has(e)||ob.set(e,new WeakMap);var n=ob.get(e);if(n.has(t))return n.get(t);var r=function(){e.apply(void 0,arguments),t.apply(void 0,arguments)};return n.set(t,r),r},lb=function(e,t,n){var r=e.scale,a=e.type,i=e.layout,o=e.axisType;if("auto"===r)return"radial"===i&&"radiusAxis"===o?{scale:Jp(),realScaleType:"band"}:"radial"===i&&"angleAxis"===o?{scale:bm(),realScaleType:"linear"}:"category"===a&&t&&(t.indexOf("LineChart")>=0||t.indexOf("AreaChart")>
vendor: 88,748 bytes, line 13
13=0||t.indexOf("ComposedChart")>=0&&!n)?{scale:Qp(),realScaleType:"point"}:"category"===a?{scale:Jp(),realScaleType:"band"}:{scale:bm(),realScaleType:"linear"};if(Nr(r)){var s="scale".concat(di(r));return{scale:(ig[s]||Qp)(),realScaleType:ig[s]?s:"point"}}return kt(r)?{scale:r}:{scale:Qp(),realScaleType:"point"}},cb=1e-4,ub=function(e){var t=e.domain();if(t&&!(t.length<=2)){var n=t.length,r=e.range(),a=Math.min(r[0],r[1])-cb,i=Math.max(r[0],r[1])+cb,o=e(t[0]),s=e(t[n-1]);(o<a||o>i||s<a||s>i)&&e.domain([t[0],t[n-1]])}},db={sign:function(e){var t=e.length;if(!(t<=0))for(var n=0,r=e[0].length;n<r;++n)for(var a=0,i=0,o=0;o<t;++o){var s=Xr(e[o][n][1])?e[o][n][0]:e[o][n][1];s>=0?(e[o][n][0]=a,e[o][n][1]=a+s,a=e[o][n][1]):(e[o][n][0]=i,e[o][n][1]=i+s,i=e[o][n][1])}},expand:function(e,t){if((r=e.length)>0){for(var n,r,a,i=0,o=e[0].length;i<o;++i){for(a=n=0;n<r;++n)a+=e[n][i][1]||0;if(a)for(n=0;n<r;++n)e[n][i][1]/=a}po(e,t)}},none:po,silhouette:function(e,t){if((n=e.length)>0){for(var n,r=0,a=e[t[0]],i=a.length;r<i;++r){for(var o=0,s=0;o<n;++o)s+=e[o][r][1]||0;a[r][1]+=a[r][0]=-s/2}po(e,t)}},wiggle:function(e,t){if((a=e.length)>0&&(r=(n=e[t[0]]).length)>0){for(var n,r,a,i=0,o=1;o<r;++o){for(var s=0,l=0,c=0;s<a;++s){for(var u=e[t[s]],d=u[o][1]||0,f=(d-(u[o-1][1]||0))/2,p=0;p<s;++p){var h=e[t[p]];f+=(h[o][1]||0)-(h[o-1][1]||0)}l+=d,c+=f*d}n[o-1][1]+=n[o-1][0]=i,l&&(i-=c/l)}n[o-1][1]+=n[o-1][0]=i,po(e,t)}},positive:function(e){var t=e.length;if(!(t<=0))for(var n=0,r=e[0].length;n<r;++n)for(var a=0,i=0;i<t;++i){var o=Xr(e[i][n][1])?e[i][n][0]:e[i][n][1];o>=0?(e[i][n][0]=a,e[i][n][1]=a+o,a=e[i][n][1]):(e[i][n][0]=0,e[i][n][1]=0)}}},fb=function(e,t,n){var r=t.map(function(e){return e.props.dataKey}),a=db[n],i=function(){var e=fi([]),t=ho,n=po,r=mo;function a(a){var i,o,s=Array.from(e.apply(this,arguments),yo),l=s.length,c=-1;for(const e of a)for(i=0,++c;i<l;++i)(s[i][c]=[0,+r(e,s[i].key,c,a)]).data=e;for(i=0,o=Oi(t(s));i<l;++i)s[o[i]].index=i;return n(s,o),s}return a.keys=function(t){return arguments.length?(e="function"==typeof t?t:fi(Array.from(t)),a):e},a.value=function(e){return arguments.length?(r="function"==typeof e?e:fi(+e),a):r},a.order=function(e){return arguments.length?(t=null==e?ho:"function"==typeof e?e:fi(Array.from(e)),a):t},a.offset=function(e){return arguments.length?(n=null==e?po:e,a):n},a}().keys(r).value(function(e,t){return+Zv(e,t,0)}).order(ho).offset(a);return i(e)},pb=function(e,t){var n=t.realScaleType,r=t.type,a=t.tickCount,i=t.originalDomain,o=t.allowDecimals,s=n||t.scale;if("auto"!==s&&"linear"!==s)return null;if(a&&"number"===r&&i&&("auto"===i[0]||"auto"===i[1])){var l=e.domain();if(!l.length)return null;var c=Sv(l,a,o);return e.domain([xg(c),fg(c)]),{niceTicks:c}}if(a&&"number"===r){var u=e.domain();return{niceTicks:Ov(u,a,o)}}return null};function hb(e){var t=e.axis,n=e.ticks,r=e.bandSize,a=e.entry,i=e.index,o=e.dataKey;if("category"===t.type){if(!t.allowDuplicatedCategory&&t.dataKey&&!vr(a[t.dataKey])){var s=aa(n,"value",a[t.dataKey]);if(s)return s.coordinate+r/2}return n[i]?n[i].coordinate+r/2:null}var l=Zv(a,vr(o)?t.dataKey:o);return vr(l)?null:t.scale(l)}var mb=function(e){var t=e.axis,n=e.ticks,r=e.offset,a=e.bandSize,i=e.entry,o=e.index;if("category"===t.type)return n[o]?n[o].coordinate+r:null;var s=Zv(i,t.dataKey,t.domain[o]);return vr(s)?null:t.scale(s)-a/2+r},yb=function(e,t,n){return Object.keys(e).reduce(function(r,a){var i=e[a].stackedData.reduce(function(e,r){var a=r.slice(t,n+1).reduce(function(e,t){return[xg(t.concat([e[0]]).filter(Jr)),fg(t.concat([e[1]]).filter(Jr))]},[1/0,-1/0]);return[Math.min(e[0],a[0]),Math.max(e[1],a[1])]},[1/0,-1/0]);return[Math.min(i[0],r[0]),Math.max(i[1],r[1])]},[1/0,-1/0]).map(function(e){return e===1/0||e===-1/0?0:e})},xb=/^dataMin[\s]*-[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,gb=/^dataMax[\s]*\+[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,vb=function(e,t,n){if(kt(e))return e(t,n);if(!Array.isArray(e))return t;var r=[];if(Jr(e[0]))r[0]=n?e[0]:Math.min(e[0],t[0]);else if(xb.test(e[0])){var a=+xb.exec(e[0])[1];r[0]=t[0]-a}else kt(e[0])?r[0]=e[0](t[0]):r[0]=t[0];if(Jr(e[1]))r[1]=n?e[1]:Math.max(e[1],t[1]);else if(gb.test(e[1])){var i=+gb.exec(e[1])[1];r[1]=t[1]+i}else kt(e[1])?r[1]=e[1](t[1]):r[1]=t[1];return r},bb=function(e,t,n){if(e&&e.scale&&e.scale.bandwidth){var r=e.scale.bandwidth();if(!n||r>0)return r}if(e&&t&&t.length>=2){for(var a=Ad(t,function(e){return e.coordinate}),i=1/0,o=1,s=a.length;o<s;o++){var l=a[o],c=a[o-1];i=Math.min((l.coordinate||0)-(c.coordinate||0),i)}return i===1/0?0:i}return n?void 0:0},jb=function(e,t,n){return e&&e.length?kg(e,gr(n,"type.defaultProps.domain"))?t:e:t},wb=function(e,t){var n=e.type.defaultProps?Yv(Yv({},e.type.defaultProps),e.props):e.props,r=n.dataKey,a=n.name,i=n.unit,o=n.formatter,s=n.tooltipType,l=n.chartType,c=n.hide;return Yv(Yv({},Pa(e,!1)),{},{dataKey:r,unit:i,formatter:o,name:a||r,color:eb(e),value:Zv(t,r),type:s,payload:t,chartType:l,hide:c})};function Nb(e){return(Nb="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Sb(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Ob(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Sb(Object(n),!0).forEach(function(t){kb(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Sb(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function kb(e,t,n){var r;return r=function(e,t){if("object"!=Nb(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=Nb(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(t,"string"),(t="symbol"==Nb(r)?r:r+"")in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ab(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,i,o,s=[],l=!0,c=!1;try{if(i=(n=n.call(e)).next,0===t);else for(;!(l=(r=i.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(u){c=!0,a=u}finally{try{if(!l&&null!=n.return&&(o=n.return(),Object(o)!==o))return}finally{if(c)throw a}}return s}}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return Pb(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Pb(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Pb(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var Eb=Math.PI/180,_b=function(e){return 180*e/Math.PI},Cb=function(e,t,n,r){return{x:e+Math.cos(-Eb*r)*n,y:t+Math.sin(-Eb*r)*n}},Mb=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{top:0,right:0,bottom:0,left:0};return Math.min(Math.abs(e-(n.left||0)-(n.right||0)),Math.abs(t-(n.top||0)-(n.bottom||0)))/2},Tb=function(e,t){var n=e.x,r=e.y,a=t.cx,i=t.cy,o=function(e,t){var n=e.x,r=e.y,a=t.x,i=t.y;return Math.sqrt(Math.pow(n-a,2)+Math.pow(r-i,2))}({x:n,y:r},{x:a,y:i});if(o<=0)return{radius:o};var s=(n-a)/o,l=Math.acos(s);return r>i&&(l=2*Math.PI-l),{radius:o,angle:_b(l),angleInRadian:l}},Db=function(e,t){var n=t.startAngle,r=t.endAngle,a=Math.floor(n/360),i=Math.floor(r/360);return e+360*Math.min(a,i)},Ib=function(e,t){var n=e.x,r=e.y,a=Tb({x:n,y:r},t),i=a.radius,o=a.angle,s=t.innerRadius,l=t.outerRadius;if(i<s||i>l)return!1;if(0===i)return!0;var c,u=function(e){var t=e.startAngle,n=e.endAngle,r=Math.floor(t/360),a=Math.floor(n/360),i=Math.min(r,a);return{startAngle:t-360*i,endAngle:n-360*i}}(t),d=u.startAngle,f=u.endAngle,p=o;if(d<=f){for(;p>f;)p-=360;for(;p<d;)p+=360;c=p>=d&&p<=f}else{for(;p>d;)p-=360;for(;p<f;)p+=360;c=p>=f&&p<=d}return c?Ob(Ob({},t),{},{radius:i,angle:Db(p,t)}):null},Rb=function(e){return i.isValidElement(e)||kt(e)||"boolean"==typeof e?"":e.className};function Lb(e){return(Lb="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var Bb=["offset"];function zb(e){return function(e){if(Array.isArray(e))return $b(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return $b(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return $b(e,t)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function $b(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Fb(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)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}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}function Ub(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function qb(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ub(Object(n),!0).forEach(function(t){Wb(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ub(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Wb(e,t,n){var r;return r=function(e,t){if("object"!=Lb(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=Lb(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(t,"string"),(t="symbol"==Lb(r)?r:r+"")in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Hb(){return Hb=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},Hb.apply(this,arguments)}var Vb=function(e,t,n){var r,a,i=e.position,l=e.viewBox,c=e.offset,u=e.className,d=l,f=d.cx,p=d.cy,h=d.innerRadius,m=d.outerRadius,y=d.startAngle,x=d.endAngle,g=d.clockWise,v=(h+m)/2,b=function(e,t){return Gr(t-e)*Math.min(Math.abs(t-e),360)}(y,x),j=b>=0?1:-1;"insideStart"===i?(r=y+j*c,a=g):"insideEnd"===i?(r=x-j*c,a=!g):"end"===i&&(r=x+j*c,a=g),a=b<=0?a:!a;var w=Cb(f,p,v,r),N=Cb(f,p,v,r+359*(a?1:-1)),S="M".concat(w.x,",").concat(w.y,"\n A").concat(v,",").concat(v,",0,1,").concat(a?0:1,",\n ").concat(N.x,",").concat(N.y),O=vr(e.id)?ea("recharts-radial-line-"):e.id;return s.createElement("text",Hb({},n,{dominantBaseline:"central",className:o("recharts-radial-bar-label",u)}),s.createElement("defs",null,s.createElement("path",{id:O,d:S})),s.createElement("textPath",{xlinkHref:"#".concat(O)},t))};function Kb(e){var t,n=e.offset,r=qb({offset:void 0===n?5:n},Fb(e,Bb)),a=r.viewBox,l=r.position,c=r.value,u=r.children,d=r.content,f=r.className,p=void 0===f?"":f,h=r.textBreakAll;if(!a||vr(c)&&vr(u)&&!i.isValidElement(d)&&!kt(d))return null;if(i.isValidElement(d))return i.cloneElement(d,r);if(kt(d)){if(t=i.createElement(d,r),i.isValidElement(t))return t}else t=function(e){var t=e.value,n=e.formatter,r=vr(e.children)?t:e.children;return kt(n)?n(r):r}(r);var m=function(e){return"cx"in e&&Jr(e.cx)}(a),y=Pa(r,!0);if(m&&("insideStart"===l||"insideEnd"===l||"end"===l))return Vb(r,t,y);var x=m?function(e){var t=e.viewBox,n=e.offset,r=e.position,a=t,i=a.cx,o=a.cy,s=a.innerRadius,l=a.outerRadius,c=(a.startAngle+a.endAngle)/2;if("outside"===r){var u=Cb(i,o,l+n,c),d=u.x;return{x:d,y:u.y,textAnchor:d>=i?"start":"end",verticalAnchor:"middle"}}if("center"===r)return{x:i,y:o,textAnchor:"middle",verticalAnchor:"middle"};if("centerTop"===r)return{x:i,y:o,textAnchor:"middle",verticalAnchor:"start"};if("centerBottom"===r)return{x:i,y:o,textAnchor:"middle",verticalAnchor:"end"};var f=Cb(i,o,(s+l)/2,c);return{x:f.x,y:f.y,textAnchor:"middle",verticalAnchor:"middle"}}(r):function(e){var t=e.viewBox,n=e.parentViewBox,r=e.offset,a=e.position,i=t,o=i.x,s=i.y,l=i.width,c=i.height,u=c>=0?1:-1,d=u*r,f=u>0?"end":"start",p=u>0?"start":"end",h=l>=0?1:-1,m=h*r,y=h>0?"end":"start",x=h>0?"start":"end";if("top"===a)return qb(qb({},{x:o+l/2,y:s-u*r,textAnchor:"middle",verticalAnchor:f}),n?{height:Math.max(s-n.y,0),width:l}:{});if("bottom"===a)return qb(qb({},{x:o+l/2,y:s+c+d,textAnchor:"middle",verticalAnchor:p}),n?{height:Math.max(n.y+n.height-(s+c),0),width:l}:{});if("left"===a){var g={x:o-m,y:s+c/2,textAnchor:y,verticalAnchor:"middle"};return qb(qb({},g),n?{width:Math.max(g.x-n.x,0),height:c}:{})}if("right"===a){var v={x:o+l+m,y:s+c/2,textAnchor:x,verticalAnchor:"middle"};return qb(qb({},v),n?{width:Math.max(n.x+n.width-v.x,0),height:c}:{})}var b=n?{width:l,height:c}:{};return"insideLeft"===a?qb({x:o+m,y:s+c/2,textAnchor:x,verticalAnchor:"middle"},b):"insideRight"===a?qb({x:o+l-m,y:s+c/2,textAnchor:y,verticalAnchor:"middle"},b):"insideTop"===a?qb({x:o+l/2,y:s+d,textAnchor:"middle",verticalAnchor:p},b):"insideBottom"===a?qb({x:o+l/2,y:s+c-d,textAnchor:"middle",verticalAnchor:f},b):"insideTopLeft"===a?qb({x:o+m,y:s+d,textAnchor:x,verticalAnchor:p},b):"insideTopRight"===a?qb({x:o+l-m,y:s+d,textAnchor:y,verticalAnchor:p},b):"insideBottomLeft"===a?qb({x:o+m,y:s+c-d,textAnchor:x,verticalAnchor:f},b):"insideBottomRight"===a?qb({x:o+l-m,y:s+c-d,textAnchor:y,verticalAnchor:f},b):wt(a)&&(Jr(a.x)||Yr(a.x))&&(Jr(a.y)||Yr(a.y))?qb({x:o+ta(a.x,l),y:s+ta(a.y,c),textAnchor:"end",verticalAnchor:"end"},b):qb({x:o+l/2,y:s+c/2,textAnchor:"middle",verticalAnchor:"middle"},b)}(r);return s.createElement(Sp,Hb({className:o("recharts-label",p)},y,x,{breakAll:h}),t)}Kb.displayName="Label";var Xb=function(e){var t=e.cx,n=e.cy,r=e.angle,a=e.startAngle,i=e.endAngle,o=e.r,s=e.radius,l=e.innerRadius,c=e.outerRadius,u=e.x,d=e.y,f=e.top,p=e.left,h=e.width,m=e.height,y=e.clockWise,x=e.labelViewBox;if(x)return x;if(Jr(h)&&Jr(m)){if(Jr(u)&&Jr(d))return{x:u,y:d,width:h,height:m};if(Jr(f)&&Jr(p))return{x:f,y:p,width:h,height:m}}return Jr(u)&&Jr(d)?{x:u,y:d,width:0,height:0}:Jr(t)&&Jr(n)?{cx:t,cy:n,startAngle:a||r||0,endAngle:i||r||0,innerRadius:l||0,outerRadius:c||s||o||0,clockWise:y}:e.viewBox?e.viewBox:{}};Kb.parseViewBox=Xb,Kb.renderCallByParent=function(e,t){var n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(!e||!e.children&&n&&!e.label)return null;var r=e.children,a=Xb(e),o=Na(r,Kb).map(function(e,n){return i.cloneElement(e,{viewBox:t||a,key:"label-".concat(n)})});if(!n)return o;var l=function(e,t){return e?!0===e?s.createElement(Kb,{key:"label-implicit",viewBox:t}):Zr(e)?s.createElement(Kb,{key:"label-implicit",viewBox:t,value:e}):i.isValidElement(e)?e.type===Kb?i.cloneElement(e,{key:"label-implicit",viewBox:t}):s.createElement(Kb,{key:"label-implicit",content:e,viewBox:t}):kt(e)?s.createElement(Kb,{key:"label-implicit",content:e,viewBox:t}):wt(e)?s.createElement(Kb,Hb({viewBox:t},e,{key:"label-implicit"})):null:null}(e.label,t||a);return[l].concat(zb(o))};const Gb=a(function(e){var t=null==e?0:e.length;return t?e[t-1]:void 0});function Yb(e){return(Yb="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var Jb=["valueAccessor"],Zb=["data","dataKey","clockWise","id","textBreakAll"];function Qb(e){return function(e){if(Array.isArray(e))return ej(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return ej(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return ej(e,t)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function ej(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function tj(){return tj=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},tj.apply(this,arguments)}function nj(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function rj(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?nj(Object(n),!0).forEach(function(t){aj(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):nj(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function aj(e,t,n){var r;return r=function(e,t){if("object"!=Yb(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=Yb(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(t,"string"),(t="symbol"==Yb(r)?r:r+"")in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ij(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)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}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var oj=function(e){return Array.isArray(e.value)?Gb(e.value):e.value};function sj(e){var t=e.valueAccessor,n=void 0===t?oj:t,r=ij(e,Jb),a=r.data,i=r.dataKey,o=r.clockWise,l=r.id,c=r.textBreakAll,u=ij(r,Zb);return a&&a.length?s.createElement(za,{className:"recharts-label-list"},a.map(function(e,t){var r=vr(i)?n(e,t):Zv(e&&e.payload,i),a=vr(l)?{}:{id:"".concat(l,"-").concat(t)};return s.createElement(Kb,tj({},Pa(e,!0),u,a,{parentViewBox:e.parentViewBox,value:r,textBreakAll:c,viewBox:Kb.parseViewBox(vr(o)?e:rj(rj({},e),{},{clockWise:o})),key:"label-".concat(t),index:t}))})):null}function lj(e){return(lj="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function cj(){return cj=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},cj.apply(this,arguments)}function uj(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function dj(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?uj(Object(n),!0).forEach(function(t){fj(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):uj(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function fj(e,t,n){var r;return r=function(e,t){if("object"!=lj(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=lj(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(t,"string"),(t="symbol"==lj(r)?r:r+"")in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}sj.displayName="LabelList",sj.renderCallByParent=function(e,t){var n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(!e||!e.children&&n&&!e.label)return null;var r=Na(e.children,sj).map(function(e,n){return i.cloneElement(e,{data:t,key:"labelList-".concat(n)})});return n?[function(e,t){return e?!0===e?s.createElement(sj,{key:"labelList-implicit",data:t}):s.isValidElement(e)||kt(e)?s.createElement(sj,{key:"labelList-implicit",data:t,content:e}):wt(e)?s.createElement(sj,tj({data:t},e,{key:"labelList-implicit"})):null:null}(e.label,t)].concat(Qb(r)):r};var pj=function(e){var t=e.cx,n=e.cy,r=e.radius,a=e.angle,i=e.sign,o=e.isExternal,s=e.cornerRadius,l=e.cornerIsExternal,c=s*(o?1:-1)+r,u=Math.asin(s/c)/Eb,d=l?a:a+i*u,f=l?a-i*u:a;return{center:Cb(t,n,c,d),circleTangency:Cb(t,n,r,d),lineTangency:Cb(t,n,c*Math.cos(u*Eb),f),theta:u}},hj=function(e){var t=e.cx,n=e.cy,r=e.innerRadius,a=e.outerRadius,i=e.startAngle,o=function(e,t){return Gr(t-e)*Math.min(Math.abs(t-e),359.999)}(i,e.endAngle),s=i+o,l=Cb(t,n,a,i),c=Cb(t,n,a,s),u="M ".concat(l.x,",").concat(l.y,"\n A ").concat(a,",").concat(a,",0,\n ").concat(+(Math.abs(o)>180),",").concat(+(i>s),",\n ").concat(c.x,",").concat(c.y,"\n ");if(r>0){var d=Cb(t,n,r,i),f=Cb(t,n,r,s);u+="L ".concat(f.x,",").concat(f.y,"\n A ").concat(r,",").concat(r,",0,\n ").concat(+(Math.abs(o)>180),",").concat(+(i<=s),",\n ").concat(d.x,",").concat(d.y," Z")}else u+="L ".concat(t,",").concat(n," Z");return u},mj={cx:0,cy:0,innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,cornerRadius:0,forceCornerRadius:!1,cornerIsExternal:!1},yj=function(e){var t=dj(dj({},mj),e),n=t.cx,r=t.cy,a=t.innerRadius,i=t.outerRadius,l=t.cornerRadius,c=t.forceCornerRadius,u=t.cornerIsExternal,d=t.startAngle,f=t.endAngle,p=t.className;if(i<a||d===f)return null;var h,m=o("recharts-sector",p),y=i-a,x=ta(l,y,0,!0);return h=x>0&&Math.abs(d-f)<360?function(e){var t=e.cx,n=e.cy,r=e.innerRadius,a=e.outerRadius,i=e.cornerRadius,o=e.forceCornerRadius,s=e.cornerIsExternal,l=e.startAngle,c=e.endAngle,u=Gr(c-l),d=pj({cx:t,cy:n,radius:a,angle:l,sign:u,cornerRadius:i,cornerIsExternal:s}),f=d.circleTangency,p=d.lineTangency,h=d.theta,m=pj({cx:t,cy:n,radius:a,angle:c,sign:-u,cornerRadius:i,cornerIsExternal:s}),y=m.circleTangency,x=m.lineTangency,g=m.theta,v=s?Math.abs(l-c):Math.abs(l-c)-h-g;if(v<0)return o?"M ".concat(p.x,",").concat(p.y,"\n a").concat(i,",").concat(i,",0,0,1,").concat(2*i,",0\n a").concat(i,",").concat(i,",0,0,1,").concat(2*-i,",0\n "):hj({cx:t,cy:n,innerRadius:r,outerRadius:a,startAngle:l,endAngle:c});var b="M ".concat(p.x,",").concat(p.y,"\n A").concat(i,",").concat(i,",0,0,").concat(+(u<0),",").concat(f.x,",").concat(f.y,"\n A").concat(a,",").concat(a,",0,").concat(+(v>180),",").concat(+(u<0),",").concat(y.x,",").concat(y.y,"\n A").concat(i,",").concat(i,",0,0,").concat(+(u<0),",").concat(x.x,",").concat(x.y,"\n ");if(r>0){var j=pj({cx:t,cy:n,radius:r,angle:l,sign:u,isExternal:!0,cornerRadius:i,cornerIsExternal:s}),w=j.circleTangency,N=j.lineTangency,S=j.theta,O=pj({cx:t,cy:n,radius:r,angle:c,sign:-u,isExternal:!0,cornerRadius:i,cornerIsExternal:s}),k=O.circleTangency,A=O.lineTangency,P=O.theta,E=s?Math.abs(l-c):Math.abs(l-c)-S-P;if(E<0&&0===i)return"".concat(b,"L").concat(t,",").concat(n,"Z");b+="L".concat(A.x,",").concat(A.y,"\n A").concat(i,",").concat(i,",0,0,").concat(+(u<0),",").concat(k.x,",").concat(k.y,"\n A").concat(r,",").concat(r,",0,").concat(+(E>180),",").concat(+(u>0),",").concat(w.x,",").concat(w.y,"\n A").concat(i,",").concat(i,",0,0,").concat(+(u<0),",").concat(N.x,",").concat(N.y,"Z")}else b+="L".concat(t,",").concat(n,"Z");return b}({cx:n,cy:r,innerRadius:a,outerRadius:i,cornerRadius:Math.min(x,y/2),forceCornerRadius:c,cornerIsExternal:u,startAngle:d,endAngle:f}):hj({cx:n,cy:r,innerRadius:a,outerRadius:i,startAngle:d,endAngle:f}),s.createElement("path",cj({},Pa(t,!0),{className:m,d:h,role:"img"}))};function xj(e){return(xj="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function gj(){return gj=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},gj.apply(this,arguments)}function vj(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function bj(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?vj(Object(n),!0).forEach(function(t){jj(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):vj(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function jj(e,t,n){var r;return r=function(e,t){if("object"!=xj(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=xj(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(t,"string"),(t="symbol"==xj(r)?r:r+"")in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var wj={curveBasisClosed:function(e){return new Qi(e)},curveBasisOpen:function(e){return new eo(e)},curveBasis:function(e){return new Zi(e)},curveBumpX:function(e){return new Mi(e,!0)},curveBumpY:function(e){return new Mi(e,!1)},curveLinearClosed:function(e){return new to(e)},curveLinear:Ai,curveMonotoneX:function(e){return new oo(e)},curveMonotoneY:function(e){return new so(e)},curveNatural:function(e){return new co(e)},curveStep:function(e){return new fo(e,.5)},curveStepAfter:function(e){return new fo(e,1)},curveStepBefore:function(e){return new fo(e,0)}},Nj=function(e){return e.x===+e.x&&e.y===+e.y},Sj=function(e){return e.x},Oj=function(e){return e.y},kj=function(e){var t,n=e.type,r=void 0===n?"linear":n,a=e.points,i=void 0===a?[]:a,o=e.baseLine,s=e.layout,l=e.connectNulls,c=void 0!==l&&l,u=function(e,t){if(kt(e))return e;var n="curve".concat(di(e));return"curveMonotone"!==n&&"curveBump"!==n||!t?wj[n]||Ai:wj["".concat(n).concat("vertical"===t?"Y":"X")]}(r,s),d=c?i.filter(function(e){return Nj(e)}):i;if(Array.isArray(o)){var f=c?o.filter(function(e){return Nj(e)}):o,p=d.map(function(e,t){return bj(bj({},e),{},{base:f[t]})});return(t="vertical"===s?Ci().y(Oj).x1(Sj).x0(function(e){return e.base.x}):Ci().x(Sj).y1(Oj).y0(function(e){return e.base.y})).defined(Nj).curve(u),t(p)}return(t="vertical"===s&&Jr(o)?Ci().y(Oj).x1(Sj).x0(o):Jr(o)?Ci().x(Sj).y1(Oj).y0(o):_i().x(Sj).y(Oj)).defined(Nj).curve(u),t(d)},Aj=function(e){var t=e.className,n=e.points,r=e.path,a=e.pathRef;if(!(n&&n.length||r))return null;var s=n&&n.length?kj(e):r;return i.createElement("path",gj({},Pa(e,!1),fa(e),{className:o("recharts-curve",t),d:s,ref:a}))},Pj=Object.getOwnPropertyNames,Ej=Object.getOwnPropertySymbols,_j=Object.prototype.hasOwnProperty;function Cj(e,t){return function(n,r,a){return e(n,r,a)&&t(n,r,a)}}function Mj(e){return function(t,n,r){if(!t||!n||"object"!=typeof t||"object"!=typeof n)return e(t,n,r);var a=r.cache,i=a.get(t),o=a.get(n);if(i&&o)return i===n&&o===t;a.set(t,n),a.set(n,t);var s=e(t,n,r);return a.delete(t),a.delete(n),s}}function Tj(e){return Pj(e).concat(Ej(e))}var Dj=Object.hasOwn||function(e,t){return _j.call(e,t)};function Ij(e,t){return e===t||!e&&!t&&e!=e&&t!=t}var Rj=Object.getOwnPropertyDescriptor,Lj=Object.keys;function Bj(e,t,n){var 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 zj(e,t){return Ij(e.getTime(),t.getTime())}function $j(e,t){return e.name===t.name&&e.message===t.message&&e.cause===t.cause&&e.stack===t.stack}function Fj(e,t){return e===t}function Uj(e,t,n){var r=e.size;if(r!==t.size)return!1;if(!r)return!0;for(var a,i,o=new Array(r),s=e.entries(),l=0;(a=s.next())&&!a.done;){for(var c=t.entries(),u=!1,d=0;(i=c.next())&&!i.done;)if(o[d])d++;else{var f=a.value,p=i.value;if(n.equals(f[0],p[0],l,d,e,t,n)&&n.equals(f[1],p[1],f[0],p[0],e,t,n)){u=o[d]=!0;break}d++}if(!u)return!1;l++}return!0}var qj=Ij;function Wj(e,t,n){var r=Lj(e),a=r.length;if(Lj(t).length!==a)return!1;for(;a-- >0;)if(!Jj(e,t,n,r[a]))return!1;return!0}function Hj(e,t,n){var r,a,i,o=Tj(e),s=o.length;if(Tj(t).length!==s)return!1;for(;s-- >0;){if(!Jj(e,t,n,r=o[s]))return!1;if(a=Rj(e,r),i=Rj(t,r),(a||i)&&(!a||!i||a.configurable!==i.configurable||a.enumerable!==i.enumerable||a.writable!==i.writable))return!1}return!0}function Vj(e,t){return Ij(e.valueOf(),t.valueOf())}function Kj(e,t){return e.source===t.source&&e.flags===t.flags}function Xj(e,t,n){var r=e.size;if(r!==t.size)return!1;if(!r)return!0;for(var a,i,o=new Array(r),s=e.values();(a=s.next())&&!a.done;){for(var l=t.values(),c=!1,u=0;(i=l.next())&&!i.done;){if(!o[u]&&n.equals(a.value,i.value,a.value,i.value,e,t,n)){c=o[u]=!0;break}u++}if(!c)return!1}return!0}function Gj(e,t){var n=e.length;if(t.length!==n)return!1;for(;n-- >0;)if(e[n]!==t[n])return!1;return!0}function Yj(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 Jj(e,t,n,r){return!("_owner"!==r&&"__o"!==r&&"__v"!==r||!e.$$typeof&&!t.$$typeof)||Dj(t,r)&&n.equals(e[r],t[r],r,r,e,t,n)}var Zj=Array.isArray,Qj="function"==typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView:null,ew=Object.assign,tw=Object.prototype.toString.call.bind(Object.prototype.toString);var nw=rw();function rw(e){void 0===e&&(e={});var t,n=e.circular,r=void 0!==n&&n,a=e.createInternalComparator,i=e.createState,o=e.strict,s=void 0!==o&&o,l=function(e){var t=e.circular,n=e.createCustomConfig,r=e.strict,a={areArraysEqual:r?Hj:Bj,areDatesEqual:zj,areErrorsEqual:$j,areFunctionsEqual:Fj,areMapsEqual:r?Cj(Uj,Hj):Uj,areNumbersEqual:qj,areObjectsEqual:r?Hj:Wj,arePrimitiveWrappersEqual:Vj,areRegExpsEqual:Kj,areSetsEqual:r?Cj(Xj,Hj):Xj,areTypedArraysEqual:r?Hj:Gj,areUrlsEqual:Yj};if(n&&(a=ew({},a,n(a))),t){var i=Mj(a.areArraysEqual),o=Mj(a.areMapsEqual),s=Mj(a.areObjectsEqual),l=Mj(a.areSetsEqual);a=ew({},a,{areArraysEqual:i,areMapsEqual:o,areObjectsEqual:s,areSetsEqual:l})}return a}(e),c=function(e){var t=e.areArraysEqual,n=e.areDatesEqual,r=e.areErrorsEqual,a=e.areFunctionsEqual,i=e.areMapsEqual,o=e.areNumbersEqual,s=e.areObjectsEqual,l=e.arePrimitiveWrappersEqual,c=e.areRegExpsEqual,u=e.areSetsEqual,d=e.areTypedArraysEqual,f=e.areUrlsEqual;return function(e,p,h){if(e===p)return!0;if(null==e||null==p)return!1;var m=typeof e;if(m!==typeof p)return!1;if("object"!==m)return"number"===m?o(e,p,h):"function"===m&&a(e,p,h);var y=e.constructor;if(y!==p.constructor)return!1;if(y===Object)return s(e,p,h);if(Zj(e))return t(e,p,h);if(null!=Qj&&Qj(e))return d(e,p,h);if(y===Date)return n(e,p,h);if(y===RegExp)return c(e,p,h);if(y===Map)return i(e,p,h);if(y===Set)return u(e,p,h);var x=tw(e);return"[object Date]"===x?n(e,p,h):"[object RegExp]"===x?c(e,p,h):"[object Map]"===x?i(e,p,h):"[object Set]"===x?u(e,p,h):"[object Object]"===x?"function"!=typeof e.then&&"function"!=typeof p.then&&s(e,p,h):"[object URL]"===x?f(e,p,h):"[object Error]"===x?r(e,p,h):"[object Arguments]"===x?s(e,p,h):("[object Boolean]"===x||"[object Number]"===x||"[object String]"===x)&&l(e,p,h)}}(l);return function(e){var t=e.circular,n=e.comparator,r=e.createState,a=e.equals,i=e.strict;if(r)return function(e,o){var s=r(),l=s.cache,c=void 0===l?t?new WeakMap:void 0:l,u=s.meta;return n(e,o,{cache:c,equals:a,meta:u,strict:i})};if(t)return function(e,t){return n(e,t,{cache:new WeakMap,equals:a,meta:void 0,strict:i})};var o={cache:void 0,equals:a,meta:void 0,strict:i};return function(e,t){return n(e,t,o)}}({circular:r,comparator:c,createState:i,equals:a?a(c):(t=c,function(e,n,r,a,i,o,s){return t(e,n,s)}),strict:s})}function aw(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=-1;requestAnimationFrame(function r(a){n<0&&(n=a),a-n>t?(e(a),n=-1):function(e){"undefined"!=typeof requestAnimationFrame&&requestAnimationFrame(e)}(r)})}function iw(e){return(iw="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function ow(e){return function(e){if(Array.isArray(e))return e}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return sw(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return sw(e,t)}(e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function sw(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function lw(){var e=function(){return null},t=!1,n=function n(r){if(!t){if(Array.isArray(r)){if(!r.length)return;var a=ow(r),i=a[0],o=a.slice(1);return"number"==typeof i?void aw(n.bind(null,o),i):(n(i),void aw(n.bind(null,o)))}"object"===iw(r)&&e(r),"function"==typeof r&&r()}};return{stop:function(){t=!0},start:function(e){t=!1,n(e)},subscribe:function(t){return e=t,function(){e=function(){return null}}}}}function cw(e){return(cw="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function uw(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function dw(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?uw(Object(n),!0).forEach(function(t){fw(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):uw(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function fw(e,t,n){return(t=function(e){var t=function(e,t){if("object"!==cw(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!==cw(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===cw(t)?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}rw({strict:!0}),rw({circular:!0}),rw({circular:!0,strict:!0}),rw({createInternalComparator:function(){return Ij}}),rw({strict:!0,createInternalComparator:function(){return Ij}}),rw({circular:!0,createInternalComparator:function(){return Ij}}),rw({circular:!0,createInternalComparator:function(){return Ij},strict:!0});var pw=function(e){return e},hw=function(e,t){return Object.keys(t).reduce(function(n,r){return dw(dw({},n),{},fw({},r,e(r,t[r])))},{})},mw=function(e,t,n){return e.map(function(e){return"".concat((r=e,r.replace(/([A-Z])/g,function(e){return"-".concat(e.toLowerCase())}))," ").concat(t,"ms ").concat(n);var r}).join(",")};function yw(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,i,o,s=[],l=!0,c=!1;try{if(i=(n=n.call(e)).next,0===t);else for(;!(l=(r=i.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(u){c=!0,a=u}finally{try{if(!l&&null!=n.return&&(o=n.return(),Object(o)!==o))return}finally{if(c)throw a}}return s}}(e,t)||gw(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function xw(e){return function(e){if(Array.isArray(e))return vw(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||gw(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function gw(e,t){if(e){if("string"==typeof e)return vw(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?vw(e,t):void 0}}function vw(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var bw=1e-4,jw=function(e,t){return[0,3*e,3*t-6*e,3*e-3*t+1]},ww=function(e,t){return e.map(function(e,n){return e*Math.pow(t,n)}).reduce(function(e,t){return e+t})},Nw=function(e,t){return function(n){var r=jw(e,t);return ww(r,n)}},Sw=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];var r=t[0],a=t[1],i=t[2],o=t[3];if(1===t.length)switch(t[0]){case"linear":r=0,a=0,i=1,o=1;break;case"ease":r=.25,a=.1,i=.25,o=1;break;case"ease-in":r=.42,a=0,i=1,o=1;break;case"ease-out":r=.42,a=0,i=.58,o=1;break;case"ease-in-out":r=0,a=0,i=.58,o=1;break;default:var s=t[0].split("(");if("cubic-bezier"===s[0]&&4===s[1].split(")")[0].split(",").length){var l=yw(s[1].split(")")[0].split(",").map(function(e){return parseFloat(e)}),4);r=l[0],a=l[1],i=l[2],o=l[3]}}var c,u,d=Nw(r,i),f=Nw(a,o),p=(c=r,u=i,function(e){var t=jw(c,u),n=[].concat(xw(t.map(function(e,t){return e*t}).slice(1)),[0]);return ww(n,e)}),h=function(e){return e>1?1:e<0?0:e},m=function(e){for(var t=e>1?1:e,n=t,r=0;r<8;++r){var a=d(n)-t,i=p(n);if(Math.abs(a-t)<bw||i<bw)return f(n);n=h(n-a/i)}return f(n)};return m.isStepper=!1,m},Ow=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];var r=t[0];if("string"==typeof r)switch(r){case"ease":case"ease-in-out":case"ease-out":case"ease-in":case"linear":return Sw(r);case"spring":return function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.stiff,n=void 0===t?100:t,r=e.damping,a=void 0===r?8:r,i=e.dt,o=void 0===i?17:i,s=function(e,t,r){var i=r+(-(e-t)*n-r*a)*o/1e3,s=r*o/1e3+e;return Math.abs(s-t)<bw&&Math.abs(i)<bw?[t,0]:[s,i]};return s.isStepper=!0,s.dt=o,s}();default:if("cubic-bezier"===r.split("(")[0])return Sw(r)}return"function"==typeof r?r:null};function kw(e){return(kw="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Aw(e){return function(e){if(Array.isArray(e))return Tw(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||Mw(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Pw(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Ew(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Pw(Object(n),!0).forEach(function(t){_w(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Pw(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function _w(e,t,n){return(t=function(e){var t=function(e,t){if("object"!==kw(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!==kw(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===kw(t)?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Cw(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,i,o,s=[],l=!0,c=!1;try{if(i=(n=n.call(e)).next,0===t);else for(;!(l=(r=i.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(u){c=!0,a=u}finally{try{if(!l&&null!=n.return&&(o=n.return(),Object(o)!==o))return}finally{if(c)throw a}}return s}}(e,t)||Mw(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Mw(e,t){if(e){if("string"==typeof e)return Tw(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Tw(e,t):void 0}}function Tw(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var Dw=function(e,t,n){return e+(t-e)*n},Iw=function(e){return e.from!==e.to},Rw=function e(t,n,r){var a=hw(function(e,n){if(Iw(n)){var r=Cw(t(n.from,n.to,n.velocity),2),a=r[0],i=r[1];return Ew(Ew({},n),{},{from:a,velocity:i})}return n},n);return r<1?hw(function(e,t){return Iw(t)?Ew(Ew({},t),{},{velocity:Dw(t.velocity,a[e].velocity,r),from:Dw(t.from,a[e].from,r)}):t},n):e(t,a,r-1)};const Lw=function(e,t,n,r,a){var i,o,s,l,c=(i=e,o=t,[Object.keys(i),Object.keys(o)].reduce(function(e,t){return e.filter(function(e){return t.includes(e)})})),u=c.reduce(function(n,r){return Ew(Ew({},n),{},_w({},r,[e[r],t[r]]))},{}),d=c.reduce(function(n,r){return Ew(Ew({},n),{},_w({},r,{from:e[r],velocity:0,to:t[r]}))},{}),f=-1,p=function(){return null};return p=n.isStepper?function(r){s||(s=r);var i=(r-s)/n.dt;d=Rw(n,d,i),a(Ew(Ew(Ew({},e),t),hw(function(e,t){return t.from},d))),s=r,Object.values(d).filter(Iw).length&&(f=requestAnimationFrame(p))}:function(i){l||(l=i);var o=(i-l)/r,s=hw(function(e,t){return Dw.apply(void 0,Aw(t).concat([n(o)]))},u);if(a(Ew(Ew(Ew({},e),t),s)),o<1)f=requestAnimationFrame(p);else{var c=hw(function(e,t){return Dw.apply(void 0,Aw(t).concat([n(1)]))},u);a(Ew(Ew(Ew({},e),t),c))}},function(){return requestAnimationFrame(p),function(){cancelAnimationFrame(f)}}};function Bw(e){return(Bw="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var zw=["children","begin","duration","attributeName","easing","isActive","steps","from","to","canBegin","onAnimationEnd","shouldReAnimate","onAnimationReStart"];function $w(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}function Fw(e){return function(e){if(Array.isArray(e))return Uw(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return Uw(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Uw(e,t)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Uw(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function qw(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Ww(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?qw(Object(n),!0).forEach(function(t){Hw(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):qw(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Hw(e,t,n){return(t=Kw(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Vw(e,t,n){return t&&function(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,Kw(r.key),r)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function Kw(e){var t=function(e,t){if("object"!==Bw(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!==Bw(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===Bw(t)?t:String(t)}function Xw(e,t){return(Xw=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function Gw(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}();return function(){var n,r=Zw(e);if(t){var a=Zw(this).constructor;n=Reflect.construct(r,arguments,a)}else n=r.apply(this,arguments);return Yw(this,n)}}function Yw(e,t){if(t&&("object"===Bw(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return Jw(e)}function Jw(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Zw(e){return(Zw=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var Qw=function(){!function(e,t){if("function"!=typeof t&&null!==t)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&&Xw(e,t)}(t,i.PureComponent);var e=Gw(t);function t(n,r){var a;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var i=(a=e.call(this,n,r)).props,o=i.isActive,s=i.attributeName,l=i.from,c=i.to,u=i.steps,d=i.children,f=i.duration;if(a.handleStyleChange=a.handleStyleChange.bind(Jw(a)),a.changeStyle=a.changeStyle.bind(Jw(a)),!o||f<=0)return a.state={style:{}},"function"==typeof d&&(a.state={style:c}),Yw(a);if(u&&u.length)a.state={style:u[0].style};else if(l){if("function"==typeof d)return a.state={style:l},Yw(a);a.state={style:s?Hw({},s,l):l}}else a.state={style:{}};return a}return Vw(t,[{key:"componentDidMount",value:function(){var e=this.props,t=e.isActive,n=e.canBegin;this.mounted=!0,t&&n&&this.runAnimation(this.props)}},{key:"componentDidUpdate",value:function(e){var t=this.props,n=t.isActive,r=t.canBegin,a=t.attributeName,i=t.shouldReAnimate,o=t.to,s=t.from,l=this.state.style;if(r)if(n){if(!(nw(e.to,o)&&e.canBegin&&e.isActive)){var c=!e.canBegin||!e.isActive;this.manager&&this.manager.stop(),this.stopJSAnimation&&this.stopJSAnimation();var u=c||i?s:e.to;if(this.state&&l){var d={style:a?Hw({},a,u):u};(a&&l[a]!==u||!a&&l!==u)&&this.setState(d)}this.runAnimation(Ww(Ww({},this.props),{},{from:u,begin:0}))}}else{var f={style:a?Hw({},a,o):o};this.state&&l&&(a&&l[a]!==o||!a&&l!==o)&&this.setState(f)}}},{key:"componentWillUnmount",value:function(){this.mounted=!1;var e=this.props.onAnimationEnd;this.unSubscribe&&this.unSubscribe(),this.manager&&(this.manager.stop(),this.manager=null),this.stopJSAnimation&&this.stopJSAnimation(),e&&e()}},{key:"handleStyleChange",value:function(e){this.changeStyle(e)}},{key:"changeStyle",value:function(e){this.mounted&&this.setState({style:e})}},{key:"runJSAnimation",value:function(e){var t=this,n=e.from,r=e.to,a=e.duration,i=e.easing,o=e.begin,s=e.onAnimationEnd,l=e.onAnimationStart,c=Lw(n,r,Ow(i),a,this.changeStyle);this.manager.start([l,o,function(){t.stopJSAnimation=c()},a,s])}},{key:"runStepAnimation",value:function(e){var t=this,n=e.steps,r=e.begin,a=e.onAnimationStart,i=n[0],o=i.style,s=i.duration,l=void 0===s?0:s;return this.manager.start([a].concat(Fw(n.reduce(function(e,r,a){if(0===a)return e;var i=r.duration,o=r.easing,s=void 0===o?"ease":o,l=r.style,c=r.properties,u=r.onAnimationEnd,d=a>0?n[a-1]:r,f=c||Object.keys(l);if("function"==typeof s||"spring"===s)return[].concat(Fw(e),[t.runJSAnimation.bind(t,{from:d.style,to:l,duration:i,easing:s}),i]);var p=mw(f,i,s),h=Ww(Ww(Ww({},d.style),l),{},{transition:p});return[].concat(Fw(e),[h,i,u]).filter(pw)},[o,Math.max(l,r)])),[e.onAnimationEnd]))}},{key:"runAnimation",value:function(e){this.manager||(this.manager=lw());var t=e.begin,n=e.duration,r=e.attributeName,a=e.to,i=e.easing,o=e.onAnimationStart,s=e.onAnimationEnd,l=e.steps,c=e.children,u=this.manager;if(this.unSubscribe=u.subscribe(this.handleStyleChange),"function"!=typeof i&&"function"!=typeof c&&"spring"!==i)if(l.length>1)this.runStepAnimation(e);else{var d=r?Hw({},r,a):a,f=mw(Object.keys(d),n,i);u.start([o,t,Ww(Ww({},d),{},{transition:f}),n,s])}else this.runJSAnimation(e)}},{key:"render",value:function(){var e=this.props,t=e.children;e.begin;var n=e.duration;e.attributeName,e.easing;var r=e.isActive;e.steps,e.from,e.to,e.canBegin,e.onAnimationEnd,e.shouldReAnimate,e.onAnimationReStart;var a=$w(e,zw),o=i.Children.count(t),l=this.state.style;if("function"==typeof t)return t(l);if(!r||0===o||n<=0)return t;var c=function(e){var t=e.props,n=t.style,r=void 0===n?{}:n,o=t.className;return i.cloneElement(e,Ww(Ww({},a),{},{style:Ww(Ww({},r),l),className:o}))};return 1===o?c(i.Children.only(t)):s.createElement("div",null,i.Children.map(t,function(e){return c(e)}))}}]),t}();function eN(e){return(eN="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function tN(){return tN=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},tN.apply(this,arguments)}function nN(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,i,o,s=[],l=!0,c=!1;try{if(i=(n=n.call(e)).next,0===t);else for(;!(l=(r=i.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(u){c=!0,a=u}finally{try{if(!l&&null!=n.return&&(o=n.return(),Object(o)!==o))return}finally{if(c)throw a}}return s}}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return rN(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return rN(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function rN(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function aN(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function iN(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?aN(Object(n),!0).forEach(function(t){oN(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):aN(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function oN(e,t,n){var r;return r=function(e,t){if("object"!=eN(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=eN(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(t,"string"),(t="symbol"==eN(r)?r:r+"")in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}Qw.displayName="Animate",Qw.defaultProps={begin:0,duration:1e3,from:"",to:"",attributeName:"",easing:"ease",isActive:!0,canBegin:!0,steps:[],onAnimationEnd:function(){},onAnimationStart:function(){}},Qw.propTypes={from:l.oneOfType([l.object,l.string]),to:l.oneOfType([l.object,l.string]),attributeName:l.string,duration:l.number,begin:l.number,easing:l.oneOfType([l.string,l.func]),steps:l.arrayOf(l.shape({duration:l.number.isRequired,style:l.object.isRequired,easing:l.oneOfType([l.oneOf(["ease","ease-in","ease-out","ease-in-out","linear"]),l.func]),properties:l.arrayOf("string"),onAnimationEnd:l.func})),children:l.oneOfType([l.node,l.func]),isActive:l.bool,canBegin:l.bool,onAnimationEnd:l.func,shouldReAnimate:l.bool,onAnimationStart:l.func,onAnimationReStart:l.func};var sN=function(e,t,n,r,a){var i,o=Math.min(Math.abs(n)/2,Math.abs(r)/2),s=r>=0?1:-1,l=n>=0?1:-1,c=r>=0&&n>=0||r<0&&n<0?1:0;if(o>0&&a instanceof Array){for(var u=[0,0,0,0],d=0;d<4;d++)u[d]=a[d]>o?o:a[d];i="M".concat(e,",").concat(t+s*u[0]),u[0]>0&&(i+="A ".concat(u[0],",").concat(u[0],",0,0,").concat(c,",").concat(e+l*u[0],",").concat(t)),i+="L ".concat(e+n-l*u[1],",").concat(t),u[1]>0&&(i+="A ".concat(u[1],",").concat(u[1],",0,0,").concat(c,",\n ").concat(e+n,",").concat(t+s*u[1])),i+="L ".concat(e+n,",").concat(t+r-s*u[2]),u[2]>0&&(i+="A ".concat(u[2],",").concat(u[2],",0,0,").concat(c,",\n ").concat(e+n-l*u[2],",").concat(t+r)),i+="L ".concat(e+l*u[3],",").concat(t+r),u[3]>0&&(i+="A ".concat(u[3],",").concat(u[3],",0,0,").concat(c,",\n ").concat(e,",").concat(t+r-s*u[3])),i+="Z"}else if(o>0&&a===+a&&a>0){var f=Math.min(o,a);i="M ".concat(e,",").concat(t+s*f,"\n A ").concat(f,",").concat(f,",0,0,").concat(c,",").concat(e+l*f,",").concat(t,"\n L ").concat(e+n-l*f,",").concat(t,"\n A ").concat(f,",").concat(f,",0,0,").concat(c,",").concat(e+n,",").concat(t+s*f,"\n L ").concat(e+n,",").concat(t+r-s*f,"\n A ").concat(f,",").concat(f,",0,0,").concat(c,",").concat(e+n-l*f,",").concat(t+r,"\n L ").concat(e+l*f,",").concat(t+r,"\n A ").concat(f,",").concat(f,",0,0,").concat(c,",").concat(e,",").concat(t+r-s*f," Z")}else i="M ".concat(e,",").concat(t," h ").concat(n," v ").concat(r," h ").concat(-n," Z");return i},lN=function(e,t){if(!e||!t)return!1;var n=e.x,r=e.y,a=t.x,i=t.y,o=t.width,s=t.height;if(Math.abs(o)>0&&Math.abs(s)>0){var l=Math.min(a,a+o),c=Math.max(a,a+o),u=Math.min(i,i+s),d=Math.max(i,i+s);return n>=l&&n<=c&&r>=u&&r<=d}return!1},cN={x:0,y:0,width:0,height:0,radius:0,isAnimationActive:!1,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},uN=function(e){var t=iN(iN({},cN),e),n=i.useRef(),r=nN(i.useState(-1),2),a=r[0],l=r[1];i.useEffect(function(){if(n.current&&n.current.getTotalLength)try{var e=n.current.getTotalLength();e&&l(e)}catch(t){}},[]);var c=t.x,u=t.y,d=t.width,f=t.height,p=t.radius,h=t.className,m=t.animationEasing,y=t.animationDuration,x=t.animationBegin,g=t.isAnimationActive,v=t.isUpdateAnimationActive;if(c!==+c||u!==+u||d!==+d||f!==+f||0===d||0===f)return null;var b=o("recharts-rectangle",h);return v?s.createElement(Qw,{canBegin:a>0,from:{width:d,height:f,x:c,y:u},to:{width:d,height:f,x:c,y:u},duration:y,animationEasing:m,isActive:v},function(e){var r=e.width,i=e.height,o=e.x,l=e.y;return s.createElement(Qw,{canBegin:a>0,from:"0px ".concat(-1===a?1:a,"px"),to:"".concat(a,"px 0px"),attributeName:"strokeDasharray",begin:x,duration:y,isActive:g,easing:m},s.createElement("path",tN({},Pa(t,!0),{className:b,d:sN(o,l,r,i,p),ref:n})))}):s.createElement("path",tN({},Pa(t,!0),{className:b,d:sN(c,u,d,f,p)}))},dN=["points","className","baseLinePoints","connectNulls"];function fN(){return fN=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},fN.apply(this,arguments)}function pN(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)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}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}function hN(e){return function(e){if(Array.isArray(e))return mN(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return mN(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return mN(e,t)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function mN(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var yN=function(e){return e&&e.x===+e.x&&e.y===+e.y},xN=function(e,t){var n=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=[[]];return e.forEach(function(e){yN(e)?t[t.length-1].push(e):t[t.length-1].length>0&&t.push([])}),yN(e[0])&&t[t.length-1].push(e[0]),t[t.length-1].length<=0&&(t=t.slice(0,-1)),t}(e);t&&(n=[n.reduce(function(e,t){return[].concat(hN(e),hN(t))},[])]);var r=n.map(function(e){return e.reduce(function(e,t,n){return"".concat(e).concat(0===n?"M":"L").concat(t.x,",").concat(t.y)},"")}).join("");return 1===n.length?"".concat(r,"Z"):r},gN=function(e){var t=e.points,n=e.className,r=e.baseLinePoints,a=e.connectNulls,i=pN(e,dN);if(!t||!t.length)return null;var l=o("recharts-polygon",n);if(r&&r.length){var c=i.stroke&&"none"!==i.stroke,u=function(e,t,n){var r=xN(e,n);return"".concat("Z"===r.slice(-1)?r.slice(0,-1):r,"L").concat(xN(t.reverse(),n).slice(1))}(t,r,a);return s.createElement("g",{className:l},s.createElement("path",fN({},Pa(i,!0),{fill:"Z"===u.slice(-1)?i.fill:"none",stroke:"none",d:u})),c?s.createElement("path",fN({},Pa(i,!0),{fill:"none",d:xN(t,a)})):null,c?s.createElement("path",fN({},Pa(i,!0),{fill:"none",d:xN(r,a)})):null)}var d=xN(t,a);return s.createElement("path",fN({},Pa(i,!0),{fill:"Z"===d.slice(-1)?i.fill:"none",className:l,d:d}))};function vN(){return vN=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},vN.apply(this,arguments)}var bN=function(e){var t=e.cx,n=e.cy,r=e.r,a=e.className,s=o("recharts-dot",a);return t===+t&&n===+n&&r===+r?i.createElement("circle",vN({},Pa(e,!1),fa(e),{className:s,cx:t,cy:n,r:r})):null};function jN(e){return(jN="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var wN=["x","y","top","left","width","height","className"];function NN(){return NN=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},NN.apply(this,arguments)}function SN(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function ON(e,t,n){var r;return r=function(e,t){if("object"!=jN(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=jN(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(t,"string"),(t="symbol"==jN(r)?r:r+"")in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function kN(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)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}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var AN=function(e,t,n,r,a,i){return"M".concat(e,",").concat(a,"v").concat(r,"M").concat(i,",").concat(t,"h").concat(n)},PN=function(e){var t=e.x,n=void 0===t?0:t,r=e.y,a=void 0===r?0:r,i=e.top,l=void 0===i?0:i,c=e.left,u=void 0===c?0:c,d=e.width,f=void 0===d?0:d,p=e.height,h=void 0===p?0:p,m=e.className,y=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?SN(Object(n),!0).forEach(function(t){ON(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):SN(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}({x:n,y:a,top:l,left:u,width:f,height:h},kN(e,wN));return Jr(n)&&Jr(a)&&Jr(f)&&Jr(h)&&Jr(l)&&Jr(u)?s.createElement("path",NN({},Pa(y,!0),{className:o("recharts-cross",m),d:AN(n,a,f,h,l,u)})):null},EN=sg,_N=lg,CN=Zc;const MN=a(function(e,t){return e&&e.length?EN(e,CN(t),_N):void 0});var TN=sg,DN=Zc,IN=pg;const RN=a(function(e,t){return e&&e.length?TN(e,DN(t),IN):void 0});var LN=["cx","cy","angle","ticks","axisLine"],BN=["ticks","tick","angle","tickFormatter","stroke"];function zN(e){return(zN="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function $N(){return $N=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},$N.apply(this,arguments)}function FN(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function UN(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?FN(Object(n),!0).forEach(function(t){GN(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):FN(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function qN(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)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}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}function WN(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,YN(r.key),r)}}function HN(e,t,n){return t=KN(t),function(e,t){if(t&&("object"===zN(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,VN()?Reflect.construct(t,n||[],KN(e).constructor):t.apply(e,n))}function VN(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(VN=function(){return!!e})()}function KN(e){return(KN=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function XN(e,t){return(XN=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function GN(e,t,n){return(t=YN(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function YN(e){var t=function(e,t){if("object"!=zN(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=zN(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==zN(t)?t:t+""}var JN=function(){function e(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),HN(this,e,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)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&&XN(e,t)}(e,i.PureComponent),t=e,r=[{key:"renderTickItem",value:function(e,t,n){return s.isValidElement(e)?s.cloneElement(e,t):kt(e)?e(t):s.createElement(Sp,$N({},t,{className:"recharts-polar-radius-axis-tick-value"}),n)}}],(n=[{key:"getTickValueCoord",value:function(e){var t=e.coordinate,n=this.props,r=n.angle,a=n.cx,i=n.cy;return Cb(a,i,t,r)}},{key:"getTickTextAnchor",value:function(){var e;switch(this.props.orientation){case"left":e="end";break;case"right":e="start";break;default:e="middle"}return e}},{key:"getViewBox",value:function(){var e=this.props,t=e.cx,n=e.cy,r=e.angle,a=e.ticks,i=MN(a,function(e){return e.coordinate||0});return{cx:t,cy:n,startAngle:r,endAngle:r,innerRadius:RN(a,function(e){return e.coordinate||0}).coordinate||0,outerRadius:i.coordinate||0}}},{key:"renderAxisLine",value:function(){var e=this.props,t=e.cx,n=e.cy,r=e.angle,a=e.ticks,i=e.axisLine,o=qN(e,LN),l=a.reduce(function(e,t){return[Math.min(e[0],t.coordinate),Math.max(e[1],t.coordinate)]},[1/0,-1/0]),c=Cb(t,n,l[0],r),u=Cb(t,n,l[1],r),d=UN(UN(UN({},Pa(o,!1)),{},{fill:"none"},Pa(i,!1)),{},{x1:c.x,y1:c.y,x2:u.x,y2:u.y});return s.createElement("line",$N({className:"recharts-polar-radius-axis-line"},d))}},{key:"renderTicks",value:function(){var t=this,n=this.props,r=n.ticks,a=n.tick,i=n.angle,l=n.tickFormatter,c=n.stroke,u=qN(n,BN),d=this.getTickTextAnchor(),f=Pa(u,!1),p=Pa(a,!1),h=r.map(function(n,r){var u=t.getTickValueCoord(n),h=UN(UN(UN(UN({textAnchor:d,transform:"rotate(".concat(90-i,", ").concat(u.x,", ").concat(u.y,")")},f),{},{stroke:"none",fill:c},p),{},{index:r},u),{},{payload:n});return s.createElement(za,$N({className:o("recharts-polar-radius-axis-tick",Rb(a)),key:"tick-".concat(n.coordinate)},pa(t.props,n,r)),e.renderTickItem(a,h,l?l(n.value,r):n.value))});return s.createElement(za,{className:"recharts-polar-radius-axis-ticks"},h)}},{key:"render",value:function(){var e=this.props,t=e.ticks,n=e.axisLine,r=e.tick;return t&&t.length?s.createElement(za,{className:o("recharts-polar-radius-axis",this.props.className)},n&&this.renderAxisLine(),r&&this.renderTicks(),Kb.renderCallByParent(this.props,this.getViewBox())):null}}])&&WN(t.prototype,n),r&&WN(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,n,r}();function ZN(e){return(ZN="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function QN(){return QN=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},QN.apply(this,arguments)}function eS(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function tS(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?eS(Object(n),!0).forEach(function(t){sS(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):eS(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function nS(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,lS(r.key),r)}}function rS(e,t,n){return t=iS(t),function(e,t){if(t&&("object"===ZN(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,aS()?Reflect.construct(t,n||[],iS(e).constructor):t.apply(e,n))}function aS(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(aS=function(){return!!e})()}function iS(e){return(iS=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function oS(e,t){return(oS=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function sS(e,t,n){return(t=lS(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function lS(e){var t=function(e,t){if("object"!=ZN(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=ZN(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==ZN(t)?t:t+""}GN(JN,"displayName","PolarRadiusAxis"),GN(JN,"axisType","radiusAxis"),GN(JN,"defaultProps",{type:"number",radiusAxisId:0,cx:0,cy:0,angle:0,orientation:"right",stroke:"#ccc",axisLine:!0,tick:!0,tickCount:5,allowDataOverflow:!1,scale:"auto",allowDuplicatedCategory:!0});var cS=Math.PI/180,uS=1e-5,dS=function(){function e(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),rS(this,e,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)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&&oS(e,t)}(e,i.PureComponent),t=e,r=[{key:"renderTickItem",value:function(e,t,n){return s.isValidElement(e)?s.cloneElement(e,t):kt(e)?e(t):s.createElement(Sp,QN({},t,{className:"recharts-polar-angle-axis-tick-value"}),n)}}],(n=[{key:"getTickLineCoord",value:function(e){var t=this.props,n=t.cx,r=t.cy,a=t.radius,i=t.orientation,o=t.tickSize||8,s=Cb(n,r,a,e.coordinate),l=Cb(n,r,a+("inner"===i?-1:1)*o,e.coordinate);return{x1:s.x,y1:s.y,x2:l.x,y2:l.y}}},{key:"getTickTextAnchor",value:function(e){var t=this.props.orientation,n=Math.cos(-e.coordinate*cS);return n>uS?"outer"===t?"start":"end":n<-uS?"outer"===t?"end":"start":"middle"}},{key:"renderAxisLine",value:function(){var e=this.props,t=e.cx,n=e.cy,r=e.radius,a=e.axisLine,i=e.axisLineType,o=tS(tS({},Pa(this.props,!1)),{},{fill:"none"},Pa(a,!1));if("circle"===i)return s.createElement(bN,QN({className:"recharts-polar-angle-axis-line"},o,{cx:t,cy:n,r:r}));var l=this.props.ticks.map(function(e){return Cb(t,n,r,e.coordinate)});return s.createElement(gN,QN({className:"recharts-polar-angle-axis-line"},o,{points:l}))}},{key:"renderTicks",value:function(){var t=this,n=this.props,r=n.ticks,a=n.tick,i=n.tickLine,l=n.tickFormatter,c=n.stroke,u=Pa(this.props,!1),d=Pa(a,!1),f=tS(tS({},u),{},{fill:"none"},Pa(i,!1)),p=r.map(function(n,r){var p=t.getTickLineCoord(n),h=tS(tS(tS({textAnchor:t.getTickTextAnchor(n)},u),{},{stroke:"none",fill:c},d),{},{index:r,payload:n,x:p.x2,y:p.y2});return s.createElement(za,QN({className:o("recharts-polar-angle-axis-tick",Rb(a)),key:"tick-".concat(n.coordinate)},pa(t.props,n,r)),i&&s.createElement("line",QN({className:"recharts-polar-angle-axis-tick-line"},f,p)),a&&e.renderTickItem(a,h,l?l(n.value,r):n.value))});return s.createElement(za,{className:"recharts-polar-angle-axis-ticks"},p)}},{key:"render",value:function(){var e=this.props,t=e.ticks,n=e.radius,r=e.axisLine;return n<=0||!t||!t.length?null:s.createElement(za,{className:o("recharts-polar-angle-axis",this.props.className)},r&&this.renderAxisLine(),this.renderTicks())}}])&&nS(t.prototype,n),r&&nS(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,n,r}();sS(dS,"displayName","PolarAngleAxis"),sS(dS,"axisType","angleAxis"),sS(dS,"defaultProps",{type:"category",angleAxisId:0,scale:"auto",cx:0,cy:0,orientation:"outer",axisLine:!0,tickLine:!0,tickSize:8,tick:!0,hide:!1,allowDuplicatedCategory:!0});var fS=yl(Object.getPrototypeOf,Object),pS=dt,hS=fS,mS=ft,yS=Function.prototype,xS=Object.prototype,gS=yS.toString,vS=xS.hasOwnProperty,bS=gS.call(Object);const jS=a(function(e){if(!mS(e)||"[object Object]"!=pS(e))return!1;var t=hS(e);if(null===t)return!0;var n=vS.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&gS.call(n)==bS});var wS=dt,NS=ft;const SS=a(function(e){return!0===e||!1===e||NS(e)&&"[object Boolean]"==wS(e)});function OS(e){return(OS="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function kS(){return kS=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},kS.apply(this,arguments)}function AS(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,i,o,s=[],l=!0,c=!1;try{if(i=(n=n.call(e)).next,0===t);else for(;!(l=(r=i.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(u){c=!0,a=u}finally{try{if(!l&&null!=n.return&&(o=n.return(),Object(o)!==o))return}finally{if(c)throw a}}return s}}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return PS(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return PS(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function PS(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function ES(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function _S(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ES(Object(n),!0).forEach(function(t){CS(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ES(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function CS(e,t,n){var r;return r=function(e,t){if("object"!=OS(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=OS(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(t,"string"),(t="symbol"==OS(r)?r:r+"")in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var MS,TS=function(e,t,n,r,a){var i,o=n-r;return i="M ".concat(e,",").concat(t),i+="L ".concat(e+n,",").concat(t),i+="L ".concat(e+n-o/2,",").concat(t+a),i+="L ".concat(e+n-o/2-r,",").concat(t+a),i+="L ".concat(e,",").concat(t," Z")},DS={x:0,y:0,upperWidth:0,lowerWidth:0,height:0,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},IS=function(e){var t=_S(_S({},DS),e),n=i.useRef(),r=AS(i.useState(-1),2),a=r[0],l=r[1];i.useEffect(function(){if(n.current&&n.current.getTotalLength)try{var e=n.current.getTotalLength();e&&l(e)}catch(t){}},[]);var c=t.x,u=t.y,d=t.upperWidth,f=t.lowerWidth,p=t.height,h=t.className,m=t.animationEasing,y=t.animationDuration,x=t.animationBegin,g=t.isUpdateAnimationActive;if(c!==+c||u!==+u||d!==+d||f!==+f||p!==+p||0===d&&0===f||0===p)return null;var v=o("recharts-trapezoid",h);return g?s.createElement(Qw,{canBegin:a>0,from:{upperWidth:0,lowerWidth:0,height:p,x:c,y:u},to:{upperWidth:d,lowerWidth:f,height:p,x:c,y:u},duration:y,animationEasing:m,isActive:g},function(e){var r=e.upperWidth,i=e.lowerWidth,o=e.height,l=e.x,c=e.y;return s.createElement(Qw,{canBegin:a>0,from:"0px ".concat(-1===a?1:a,"px"),to:"".concat(a,"px 0px"),attributeName:"strokeDasharray",begin:x,duration:y,easing:m},s.createElement("path",kS({},Pa(t,!0),{className:v,d:TS(l,c,r,i,o),ref:n})))}):s.createElement("g",null,s.createElement("path",kS({},Pa(t,!0),{className:v,d:TS(c,u,d,f,p)})))},RS=["option","shapeType","propTransformer","activeClassName","isActive"];function LS(e){return(LS="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function BS(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)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}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}function zS(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function $S(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?zS(Object(n),!0).forEach(function(t){FS(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):zS(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function FS(e,t,n){var r;return r=function(e,t){if("object"!=LS(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=LS(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(t,"string"),(t="symbol"==LS(r)?r:r+"")in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function US(e,t){return $S($S({},t),e)}function qS(e){var t=e.shapeType,n=e.elementProps;switch(t){case"rectangle":return s.createElement(uN,n);case"trapezoid":return s.createElement(IS,n);case"sector":return s.createElement(yj,n);case"symbols":if(function(e){return"symbols"===e}(t))return s.createElement(ko,n);break;default:return null}}function WS(e){var t,n=e.option,r=e.shapeType,a=e.propTransformer,o=void 0===a?US:a,l=e.activeClassName,c=void 0===l?"recharts-active-shape":l,u=e.isActive,d=BS(e,RS);if(i.isValidElement(n))t=i.cloneElement(n,$S($S({},d),function(e){return i.isValidElement(e)?e.props:e}(n)));else if(kt(n))t=n(d);else if(jS(n)&&!SS(n)){var f=o(n,d);t=s.createElement(qS,{shapeType:r,elementProps:f})}else{var p=d;t=s.createElement(qS,{shapeType:r,elementProps:p})}return u?s.createElement(za,{className:c},t):t}function HS(e,t){return null!=t&&"trapezoids"in e.props}function VS(e,t){return null!=t&&"sectors"in e.props}function KS(e,t){return null!=t&&"points"in e.props}function XS(e,t){var n,r,a=e.x===(null==t||null===(n=t.labelViewBox)||void 0===n?void 0:n.x)||e.x===t.x,i=e.y===(null==t||null===(r=t.labelViewBox)||void 0===r?void 0:r.y)||e.y===t.y;return a&&i}function GS(e,t){var n=e.endAngle===t.endAngle,r=e.startAngle===t.startAngle;return n&&r}function YS(e,t){var n=e.x===t.x,r=e.y===t.y,a=e.z===t.z;return n&&r&&a}function JS(e){var t=e.activeTooltipItem,n=e.graphicalItem,r=e.itemData,a=function(e,t){var n;return HS(e,t)?n="trapezoids":VS(e,t)?n="sectors":KS(e,t)&&(n="points"),n}(n,t),i=function(e,t){var n,r;return HS(e,t)?null===(n=t.tooltipPayload)||void 0===n||null===(n=n[0])||void 0===n||null===(n=n.payload)||void 0===n?void 0:n.payload:VS(e,t)?null===(r=t.tooltipPayload)||void 0===r||null===(r=r[0])||void 0===r||null===(r=r.payload)||void 0===r?void 0:r.payload:KS(e,t)?t.payload:{}}(n,t),o=r.filter(function(e,r){var o=kg(i,e),s=n.props[a].filter(function(e){var r=function(e,t){var n;return HS(e,t)?n=XS:VS(e,t)?n=GS:KS(e,t)&&(n=YS),n}(n,t);return r(e,t)}),l=n.props[a].indexOf(s[s.length-1]);return o&&r===l});return r.indexOf(o[o.length-1])}function ZS(e){return(ZS="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function QS(){return QS=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},QS.apply(this,arguments)}function eO(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function tO(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?eO(Object(n),!0).forEach(function(t){sO(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):eO(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function nO(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,lO(r.key),r)}}function rO(e,t,n){return t=iO(t),function(e,t){if(t&&("object"===ZS(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,aO()?Reflect.construct(t,n||[],iO(e).constructor):t.apply(e,n))}function aO(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(aO=function(){return!!e})()}function iO(e){return(iO=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function oO(e,t){return(oO=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function sO(e,t,n){return(t=lO(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function lO(e){var t=function(e,t){if("object"!=ZS(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=ZS(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==ZS(t)?t:t+""}var cO=function(){function e(t){var n;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),sO(n=rO(this,e,[t]),"pieRef",null),sO(n,"sectorRefs",[]),sO(n,"id",ea("recharts-pie-")),sO(n,"handleAnimationEnd",function(){var e=n.props.onAnimationEnd;n.setState({isAnimationFinished:!0}),kt(e)&&e()}),sO(n,"handleAnimationStart",function(){var e=n.props.onAnimationStart;n.setState({isAnimationFinished:!1}),kt(e)&&e()}),n.state={isAnimationFinished:!t.isAnimationActive,prevIsAnimationActive:t.isAnimationActive,prevAnimationId:t.animationId,sectorToFocus:0},n}return function(e,t){if("function"!=typeof t&&null!==t)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&&oO(e,t)}(e,i.PureComponent),t=e,r=[{key:"getDerivedStateFromProps",value:function(e,t){return t.prevIsAnimationActive!==e.isAnimationActive?{prevIsAnimationActive:e.isAnimationActive,prevAnimationId:e.animationId,curSectors:e.sectors,prevSectors:[],isAnimationFinished:!0}:e.isAnimationActive&&e.animationId!==t.prevAnimationId?{prevAnimationId:e.animationId,curSectors:e.sectors,prevSectors:t.curSectors,isAnimationFinished:!0}:e.sectors!==t.curSectors?{curSectors:e.sectors,isAnimationFinished:!0}:null}},{key:"getTextAnchor",value:function(e,t){return e>t?"start":e<t?"end":"middle"}},{key:"renderLabelLineItem",value:function(e,t,n){if(s.isValidElement(e))return s.cloneElement(e,t);if(kt(e))return e(t);var r=o("recharts-pie-label-line","boolean"!=typeof e?e.className:"");return s.createElement(Aj,QS({},t,{key:n,type:"linear",className:r}))}},{key:"renderLabelItem",value:function(e,t,n){if(s.isValidElement(e))return s.cloneElement(e,t);var r=n;if(kt(e)&&(r=e(t),s.isValidElement(r)))return r;var a=o("recharts-pie-label-text","boolean"==typeof e||kt(e)?"":e.className);return s.createElement(Sp,QS({},t,{alignmentBaseline:"middle",className:a}),r)}}],(n=[{key:"isActiveIndex",value:function(e){var t=this.props.activeIndex;return Array.isArray(t)?-1!==t.indexOf(e):e===t}},{key:"hasActiveIndex",value:function(){var e=this.props.activeIndex;return Array.isArray(e)?0!==e.length:e||0===e}},{key:"renderLabels",value:function(t){if(this.props.isAnimationActive&&!this.state.isAnimationFinished)return null;var n=this.props,r=n.label,a=n.labelLine,i=n.dataKey,o=n.valueKey,l=Pa(this.props,!1),c=Pa(r,!1),u=Pa(a,!1),d=r&&r.offsetRadius||20,f=t.map(function(t,n){var f=(t.startAngle+t.endAngle)/2,p=Cb(t.cx,t.cy,t.outerRadius+d,f),h=tO(tO(tO(tO({},l),t),{},{stroke:"none"},c),{},{index:n,textAnchor:e.getTextAnchor(p.x,t.cx)},p),m=tO(tO(tO(tO({},l),t),{},{fill:"none",stroke:t.fill},u),{},{index:n,points:[Cb(t.cx,t.cy,t.outerRadius,f),p]}),y=i;return vr(i)&&vr(o)?y="value":vr(i)&&(y=o),s.createElement(za,{key:"label-".concat(t.startAngle,"-").concat(t.endAngle,"-").concat(t.midAngle,"-").concat(n)},a&&e.renderLabelLineItem(a,m,"line"),e.renderLabelItem(r,h,Zv(t,y)))});return s.createElement(za,{className:"recharts-pie-labels"},f)}},{key:"renderSectorsStatically",value:function(e){var t=this,n=this.props,r=n.activeShape,a=n.blendStroke,i=n.inactiveShape;return e.map(function(n,o){if(0===(null==n?void 0:n.startAngle)&&0===(null==n?void 0:n.endAngle)&&1!==e.length)return null;var l=t.isActiveIndex(o),c=i&&t.hasActiveIndex()?i:null,u=l?r:c,d=tO(tO({},n),{},{stroke:a?n.fill:n.stroke,tabIndex:-1});return s.createElement(za,QS({ref:function(e){e&&!t.sectorRefs.includes(e)&&t.sectorRefs.push(e)}
vendor: 2,175 bytes, line 13
13,tabIndex:-1,className:"recharts-pie-sector"},pa(t.props,n,o),{key:"sector-".concat(null==n?void 0:n.startAngle,"-").concat(null==n?void 0:n.endAngle,"-").concat(n.midAngle,"-").concat(o)}),s.createElement(WS,QS({option:u,isActive:l,shapeType:"sector"},d)))})}},{key:"renderSectorsWithAnimation",value:function(){var e=this,t=this.props,n=t.sectors,r=t.isAnimationActive,a=t.animationBegin,i=t.animationDuration,o=t.animationEasing,l=t.animationId,c=this.state,u=c.prevSectors,d=c.prevIsAnimationActive;return s.createElement(Qw,{begin:a,duration:i,isActive:r,easing:o,from:{t:0},to:{t:1},key:"pie-".concat(l,"-").concat(d),onAnimationStart:this.handleAnimationStart,onAnimationEnd:this.handleAnimationEnd},function(t){var r=t.t,a=[],i=(n&&n[0]).startAngle;return n.forEach(function(e,t){var n=u&&u[t],o=t>0?gr(e,"paddingAngle",0):0;if(n){var s=ra(n.endAngle-n.startAngle,e.endAngle-e.startAngle),l=tO(tO({},e),{},{startAngle:i+o,endAngle:i+s(r)+o});a.push(l),i=l.endAngle}else{var c=e.endAngle,d=e.startAngle,f=ra(0,c-d)(r),p=tO(tO({},e),{},{startAngle:i+o,endAngle:i+f+o});a.push(p),i=p.endAngle}}),s.createElement(za,null,e.renderSectorsStatically(a))})}},{key:"attachKeyboardHandlers",value:function(e){var t=this;e.onkeydown=function(e){if(!e.altKey)switch(e.key){case"ArrowLeft":var n=++t.state.sectorToFocus%t.sectorRefs.length;t.sectorRefs[n].focus(),t.setState({sectorToFocus:n});break;case"ArrowRight":var r=--t.state.sectorToFocus<0?t.sectorRefs.length-1:t.state.sectorToFocus%t.sectorRefs.length;t.sectorRefs[r].focus(),t.setState({sectorToFocus:r});break;case"Escape":t.sectorRefs[t.state.sectorToFocus].blur(),t.setState({sectorToFocus:0})}}}},{key:"renderSectors",value:function(){var e=this.props,t=e.sectors,n=e.isAnimationActive,r=this.state.prevSectors;return!(n&&t&&t.length)||r&&kg(r,t)?this.renderSectorsStatically(t):this.renderSectorsWithAnimation()}},{key:"componentDidMount",value:function(){this.pieRef&&this.attachKeyboardHandlers(this.pieRef)}},{key:"render",value:function(){var e=this,t=this.props,n=t.hide,r=t.sectors,a=t.className,i=t.label,l=t.cx,c=t.cy,u=t.innerRadius,d=t.outerRadius,f=t.isAnimationActive,p=this.state.isAnimationFinished;
vendor: 1,897 bytes, line 13
13if(n||!r||!r.length||!Jr(l)||!Jr(c)||!Jr(u)||!Jr(d))return null;var h=o("recharts-pie",a);return s.createElement(za,{tabIndex:this.props.rootTabIndex,className:h,ref:function(t){e.pieRef=t}},this.renderSectors(),i&&this.renderLabels(r),Kb.renderCallByParent(this.props,null,!1),(!f||p)&&sj.renderCallByParent(this.props,r,!1))}}])&&nO(t.prototype,n),r&&nO(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,n,r}();MS=cO,sO(cO,"displayName","Pie"),sO(cO,"defaultProps",{stroke:"#fff",fill:"#808080",legendType:"rect",cx:"50%",cy:"50%",startAngle:0,endAngle:360,innerRadius:0,outerRadius:"80%",paddingAngle:0,labelLine:!0,hide:!1,minAngle:0,isAnimationActive:!ef.isSsr,animationBegin:400,animationDuration:1500,animationEasing:"ease",nameKey:"name",blendStroke:!1,rootTabIndex:0}),sO(cO,"parseDeltaAngle",function(e,t){return Gr(t-e)*Math.min(Math.abs(t-e),360)}),sO(cO,"getRealPieData",function(e){var t=e.data,n=e.children,r=Pa(e,!1),a=Na(n,Ff);return t&&t.length?t.map(function(e,t){return tO(tO(tO({payload:e},r),e),a&&a[t]&&a[t].props)}):a&&a.length?a.map(function(e){return tO(tO({},r),e.props)}):[]}),sO(cO,"parseCoordinateOfPie",function(e,t){var n=t.top,r=t.left,a=t.width,i=t.height,o=Mb(a,i);return{cx:r+ta(e.cx,a,a/2),cy:n+ta(e.cy,i,i/2),innerRadius:ta(e.innerRadius,o,0),outerRadius:ta(e.outerRadius,o,.8*o),maxRadius:e.maxRadius||Math.sqrt(a*a+i*i)/2}}),sO(cO,"getComposedData",function(e){var t=e.item,n=e.offset,r=void 0!==t.type.defaultProps?tO(tO({},t.type.defaultProps),t.props):t.props,a=MS.getRealPieData(r);if(!a||!a.length)return null;var i=r.cornerRadius,o=r.startAngle,s=r.endAngle,l=r.paddingAngle,c=r.dataKey,u=r.nameKey,d=r.valueKey,f=r.tooltipType,p=Math.abs(r.minAngle),h=MS.parseCoordinateOfPie(r,n),m=MS.parseDeltaAngle(o,s),y=Math.abs(m),x=c;vr(c)&&vr(d)?($a(!1,'Use "dataKey" to specify the value of pie,\n the props "valueKey" will be deprecated
13in 1.1.0'),x="value"):vr(c)&&($a(!1,'Use "dataKey" to specify the value of pie,\n the props "valueKey" will be deprecated in 1.1.0'),x=d);var g,v,b=a.filter(function(e){return 0!==Zv(e,x,0)}).length,j=y-b*p-(y>=360?b:b-1)*l,w=a.reduce(function(e,t){var n=Zv(t,x,0);return e+(Jr(n)?n:0)},0);w>0&&(g=a.map(function(e,t){var n,r=Zv(e,x,0),a=Zv(e,u,t),s=(Jr(r)?r:0)/w,c=(n=t?v.endAngle+Gr(m)*l*(0!==r?1:0):o)+Gr(m)*((0!==r?p:0)+s*j),d=(n+c)/2,y=(h.innerRadius+h.outerRadius)/2,g=[{name:a,value:r,payload:e,dataKey:x,type:f}],b=Cb(h.cx,h.cy,y,d);return v=tO(tO(tO({percent:s,cornerRadius:i,name:a,tooltipPayload:g,midAngle:d,middleRadius:y,tooltipPosition:b},e),h),{},{value:Zv(e,x),startAngle:n,endAngle:c,payload:e,paddingAngle:Gr(m)*l})}));return tO(tO({},h),{},{sectors:g,data:a})});var uO=Math.ceil,dO=Math.max;var fO=Of,pO=1/0;var hO=function(e){return e?(e=fO(e))===pO||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0},mO=function(e,t,n,r){for(var a=-1,i=dO(uO((t-e)/(n||1)),0),o=Array(i);i--;)o[r?i:++a]=e,e+=n;return o},yO=Nd,xO=hO;const gO=a(function(e){return function(t,n,r){return r&&"number"!=typeof r&&yO(t,n,r)&&(n=r=void 0),t=xO(t),void 0===n?(n=t,t=0):n=xO(n),r=void 0===r?t<n?1:-1:xO(r),mO(t,n,r,e)}}());function vO(e){return(vO="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function bO(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function jO(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?bO(Object(n),!0).forEach(function(t){wO(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):bO(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function wO(e,t,n){var r;return r=function(e,t){if("object"!=vO(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=vO(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(t,"string"),(t="symbol"==vO(r)?r:r+"")in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var NO=["Webkit","Moz","O","ms"];function SO(e){return(SO="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function OO(){return OO=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},OO.apply(this,arguments)}function kO(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function AO(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?kO(Object(n),!0).forEach(function(t){TO(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):kO(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function PO(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,DO(r.key),r)}}function EO(e,t,n){return t=CO(t),function(e,t){if(t&&("object"===SO(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,_O()?Reflect.construct(t,n||[],CO(e).constructor):t.apply(e,n))}function _O(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(_O=function(){return!!e})()}function CO(e){return(CO=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function MO(e,t){return(MO=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function TO(e,t,n){return(t=DO(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function DO(e){var t=function(e,t){if("object"!=SO(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=SO(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==SO(t)?t:t+""}var IO=function(e){return e.changedTouches&&!!e.changedTouches.length},RO=function(){function e(t){var n;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),TO(n=EO(this,e,[t]),"handleDrag",function(e){n.leaveTimer&&(clearTimeout(n.leaveTimer),n.leaveTimer=null),n.state.isTravellerMoving?n.handleTravellerMove(e):n.state.isSlideMoving&&n.handleSlideDrag(e)}),TO(n,"handleTouchMove",function(e){null!=e.changedTouches&&e.changedTouches.length>0&&n.handleDrag(e.changedTouches[0])}),TO(n,"handleDragEnd",function(){n.setState({isTravellerMoving:!1,isSlideMoving:!1},function(){var e=n.props,t=e.endIndex,r=e.onDragEnd,a=e.startIndex;null==r||r({endIndex:t,startIndex:a})}),n.detachDragEndListener()}),TO(n,"handleLeaveWrapper",function(){(n.state.isTravellerMoving||n.state.isSlideMoving)&&(n.leaveTimer=window.setTimeout(n.handleDragEnd,n.props.leaveTimeOut))}),TO(n,"handleEnterSlideOrTraveller",function(){n.setState({isTextActive:!0})}),TO(n,"handleLeaveSlideOrTraveller",function(){n.setState({isTextActive:!1})}),TO(n,"handleSlideDragStart",function(e){var t=IO(e)?e.changedTouches[0]:e;n.setState({isTravellerMoving:!1,isSlideMoving:!0,slideMoveStartX:t.pageX}),n.attachDragEndListener()}),n.travellerDragStartHandlers={startX:n.handleTravellerDragStart.bind(n,"startX"),endX:n.handleTravellerDragStart.bind(n,"endX")},n.state={},n}return function(e,t){if("function"!=typeof t&&null!==t)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&&MO(e,t)}(e,i.PureComponent),t=e,r=[{key:"renderDefaultTraveller",value:function(e){var t=e.x,n=e.y,r=e.width,a=e.height,i=e.stroke,o=Math.floor(n+a/2)-1;return s.createElement(s.Fragment,null,s.createElement("rect",{x:t,y:n,width:r,height:a,fill:i,stroke:"none"}),s.createElement("line",{x1:t+1,y1:o,x2:t+r-1,y2:o,fill:"none",stroke:"#fff"}),s.createElement("line",{x1:t+1,y1:o+2,x2:t+r-1,y2:o+2,fill:"none",stroke:"#fff"}))}},{key:"renderTraveller",value:function(t,n){return s.isValidElement(t)?s.cloneElement(t,n):kt(t)?t(n):e.renderDefaultTraveller(n)}},{key:"getDerivedStateFromProps",value:function(e,t){var n=e.data,r=e.width,a=e.x,i=e.travellerWidth,o=e.updateId,s=e.startIndex,l=e.endIndex;if(n!==t.prevData||o!==t.prevUpdateId)return AO({prevData:n,prevTravellerWidth:i,prevUpdateId:o,prevX:a,prevWidth:r},n&&n.length?function(e){var t=e.data,n=e.startIndex,r=e.endIndex,a=e.x,i=e.width,o=e.travellerWidth;if(!t||!t.length)return{};var s=t.length,l=Qp().domain(gO(0,s)).range([a,a+i-o]),c=l.domain().map(function(e){return l(e)});return{isTextActive:!1,isSlideMoving:!1,isTravellerMoving:!1,isTravellerFocused:!1,startX:l(n),endX:l(r),scale:l,scaleValues:c}}({data:n,width:r,x:a,travellerWidth:i,startIndex:s,endIndex:l}):{scale:null,scaleValues:null});if(t.scale&&(r!==t.prevWidth||a!==t.prevX||i!==t.prevTravellerWidth)){t.scale.range([a,a+r-i]);var c=t.scale.domain().map(function(e){return t.scale(e)});return{prevData:n,prevTravellerWidth:i,prevUpdateId:o,prevX:a,prevWidth:r,startX:t.scale(e.startIndex),endX:t.scale(e.endIndex),scaleValues:c}}return null}},{key:"getIndexInRange",value:function(e,t){for(var n=0,r=e.length-1;r-n>1;){var a=Math.floor((n+r)/2);e[a]>t?r=a:n=a}return t>=e[r]?r:n}}],(n=[{key:"componentWillUnmount",value:function(){this.leaveTimer&&(clearTimeout(this.leaveTimer),this.leaveTimer=null),this.detachDragEndListener()}},{key:"getIndex",value:function(t){var n=t.startX,r=t.endX,a=this.state.scaleValues,i=this.props,o=i.gap,s=i.data.length-1,l=Math.min(n,r),c=Math.max(n,r),u=e.getIndexInRange(a,l),d=e.getIndexInRange(a,c);
vendor: 1,540 bytes, line 13
13return{startIndex:u-u%o,endIndex:d===s?s:d-d%o}}},{key:"getTextOfTick",value:function(e){var t=this.props,n=t.data,r=t.tickFormatter,a=t.dataKey,i=Zv(n[e],a,e);return kt(r)?r(i,e):i}},{key:"attachDragEndListener",value:function(){window.addEventListener("mouseup",this.handleDragEnd,!0),window.addEventListener("touchend",this.handleDragEnd,!0),window.addEventListener("mousemove",this.handleDrag,!0)}},{key:"detachDragEndListener",value:function(){window.removeEventListener("mouseup",this.handleDragEnd,!0),window.removeEventListener("touchend",this.handleDragEnd,!0),window.removeEventListener("mousemove",this.handleDrag,!0)}},{key:"handleSlideDrag",value:function(e){var t=this.state,n=t.slideMoveStartX,r=t.startX,a=t.endX,i=this.props,o=i.x,s=i.width,l=i.travellerWidth,c=i.startIndex,u=i.endIndex,d=i.onChange,f=e.pageX-n;f>0?f=Math.min(f,o+s-l-a,o+s-l-r):f<0&&(f=Math.max(f,o-r,o-a));var p=this.getIndex({startX:r+f,endX:a+f});p.startIndex===c&&p.endIndex===u||!d||d(p),this.setState({startX:r+f,endX:a+f,slideMoveStartX:e.pageX})}},{key:"handleTravellerDragStart",value:function(e,t){var n=IO(t)?t.changedTouches[0]:t;this.setState({isSlideMoving:!1,isTravellerMoving:!0,movingTravellerId:e,brushMoveStartX:n.pageX}),this.attachDragEndListener()}},{key:"handleTravellerMove",value:function(e){var t=this.state,n=t.brushMoveStartX,r=t.movingTravellerId,a=t.endX,i=t.startX,o=this.state[r],s=this.props,l=s.x,c=s.width,u=s.travellerWidth,d=s.onChange,f=s.gap,p=s.data,h={startX:this.state.startX,endX:this.state.endX},m=e.pageX-n;m>
vendor: 17,561 bytes, line 13
130?m=Math.min(m,l+c-u-o):m<0&&(m=Math.max(m,l-o)),h[r]=o+m;var y=this.getIndex(h),x=y.startIndex,g=y.endIndex;this.setState(TO(TO({},r,o+m),"brushMoveStartX",e.pageX),function(){var e;d&&(e=p.length-1,("startX"===r&&(a>i?x%f===0:g%f===0)||a<i&&g===e||"endX"===r&&(a>i?g%f===0:x%f===0)||a>i&&g===e)&&d(y))})}},{key:"handleTravellerMoveKeyboard",value:function(e,t){var n=this,r=this.state,a=r.scaleValues,i=r.startX,o=r.endX,s=this.state[t],l=a.indexOf(s);if(-1!==l){var c=l+e;if(!(-1===c||c>=a.length)){var u=a[c];"startX"===t&&u>=o||"endX"===t&&u<=i||this.setState(TO({},t,u),function(){n.props.onChange(n.getIndex({startX:n.state.startX,endX:n.state.endX}))})}}}},{key:"renderBackground",value:function(){var e=this.props,t=e.x,n=e.y,r=e.width,a=e.height,i=e.fill,o=e.stroke;return s.createElement("rect",{stroke:o,fill:i,x:t,y:n,width:r,height:a})}},{key:"renderPanorama",value:function(){var e=this.props,t=e.x,n=e.y,r=e.width,a=e.height,o=e.data,l=e.children,c=e.padding,u=i.Children.only(l);return u?s.cloneElement(u,{x:t,y:n,width:r,height:a,margin:c,compact:!0,data:o}):null}},{key:"renderTravellerLayer",value:function(t,n){var r,a,i=this,o=this.props,l=o.y,c=o.travellerWidth,u=o.height,d=o.traveller,f=o.ariaLabel,p=o.data,h=o.startIndex,m=o.endIndex,y=Math.max(t,this.props.x),x=AO(AO({},Pa(this.props,!1)),{},{x:y,y:l,width:c,height:u}),g=f||"Min value: ".concat(null===(r=p[h])||void 0===r?void 0:r.name,", Max value: ").concat(null===(a=p[m])||void 0===a?void 0:a.name);return s.createElement(za,{tabIndex:0,role:"slider","aria-label":g,"aria-valuenow":t,className:"recharts-brush-traveller",onMouseEnter:this.handleEnterSlideOrTraveller,onMouseLeave:this.handleLeaveSlideOrTraveller,onMouseDown:this.travellerDragStartHandlers[n],onTouchStart:this.travellerDragStartHandlers[n],onKeyDown:function(e){["ArrowLeft","ArrowRight"].includes(e.key)&&(e.preventDefault(),e.stopPropagation(),i.handleTravellerMoveKeyboard("ArrowRight"===e.key?1:-1,n))},onFocus:function(){i.setState({isTravellerFocused:!0})},onBlur:function(){i.setState({isTravellerFocused:!1})},style:{cursor:"col-resize"}},e.renderTraveller(d,x))}},{key:"renderSlide",value:function(e,t){var n=this.props,r=n.y,a=n.height,i=n.stroke,o=n.travellerWidth,l=Math.min(e,t)+o,c=Math.max(Math.abs(t-e)-o,0);return s.createElement("rect",{className:"recharts-brush-slide",onMouseEnter:this.handleEnterSlideOrTraveller,onMouseLeave:this.handleLeaveSlideOrTraveller,onMouseDown:this.handleSlideDragStart,onTouchStart:this.handleSlideDragStart,style:{cursor:"move"},stroke:"none",fill:i,fillOpacity:.2,x:l,y:r,width:c,height:a})}},{key:"renderText",value:function(){var e=this.props,t=e.startIndex,n=e.endIndex,r=e.y,a=e.height,i=e.travellerWidth,o=e.stroke,l=this.state,c=l.startX,u=l.endX,d={pointerEvents:"none",fill:o};return s.createElement(za,{className:"recharts-brush-texts"},s.createElement(Sp,OO({textAnchor:"end",verticalAnchor:"middle",x:Math.min(c,u)-5,y:r+a/2},d),this.getTextOfTick(t)),s.createElement(Sp,OO({textAnchor:"start",verticalAnchor:"middle",x:Math.max(c,u)+i+5,y:r+a/2},d),this.getTextOfTick(n)))}},{key:"render",value:function(){var e=this.props,t=e.data,n=e.className,r=e.children,a=e.x,i=e.y,l=e.width,c=e.height,u=e.alwaysShowText,d=this.state,f=d.startX,p=d.endX,h=d.isTextActive,m=d.isSlideMoving,y=d.isTravellerMoving,x=d.isTravellerFocused;if(!t||!t.length||!Jr(a)||!Jr(i)||!Jr(l)||!Jr(c)||l<=0||c<=0)return null;var g,v,b,j,w=o("recharts-brush",n),N=1===s.Children.count(r),S=(v="none",b=(g="userSelect").replace(/(\w)/,function(e){return e.toUpperCase()}),(j=NO.reduce(function(e,t){return jO(jO({},e),{},wO({},t+b,v))},{}))[g]=v,j);return s.createElement(za,{className:w,onMouseLeave:this.handleLeaveWrapper,onTouchMove:this.handleTouchMove,style:S},this.renderBackground(),N&&this.renderPanorama(),this.renderSlide(f,p),this.renderTravellerLayer(f,"startX"),this.renderTravellerLayer(p,"endX"),(h||m||y||x||u)&&this.renderText())}}])&&PO(t.prototype,n),r&&PO(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,n,r}();TO(RO,"displayName","Brush"),TO(RO,"defaultProps",{height:40,travellerWidth:5,gap:1,fill:"#fff",stroke:"#666",padding:{top:1,right:1,bottom:1,left:1},leaveTimeOut:1e3,alwaysShowText:!1});var LO=qu;var BO=ns,zO=Zc,$O=function(e,t){var n;return LO(e,function(e,r,a){return!(n=t(e,r,a))}),!!n},FO=Ge,UO=Nd;const qO=a(function(e,t,n){var r=FO(e)?BO:$O;return n&&UO(e,t,n)&&(t=void 0),r(e,zO(t))});var WO=function(e,t){var n=e.alwaysShow,r=e.ifOverflow;return n&&(r="extendDomain"),r===t},HO=ud;var VO=function(e,t,n){"__proto__"==t&&HO?HO(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n},KO=Fu,XO=Zc;const GO=a(function(e,t){var n={};return t=XO(t),KO(e,function(e,r,a){VO(n,r,t(e,r,a))}),n});var YO=qu;var JO=function(e,t){for(var n=-1,r=null==e?0:e.length;++n<r;)if(!t(e[n],n,e))return!1;return!0},ZO=function(e,t){var n=!0;return YO(e,function(e,r,a){return n=!!t(e,r,a)}),n},QO=Zc,ek=Ge,tk=Nd;const nk=a(function(e,t,n){var r=ek(e)?JO:ZO;return n&&tk(e,t,n)&&(t=void 0),r(e,QO(t))});var rk=["x","y"];function ak(e){return(ak="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function ik(){return ik=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},ik.apply(this,arguments)}function ok(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function sk(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ok(Object(n),!0).forEach(function(t){lk(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ok(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function lk(e,t,n){var r;return r=function(e,t){if("object"!=ak(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=ak(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(t,"string"),(t="symbol"==ak(r)?r:r+"")in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ck(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)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}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}function uk(e,t){var n=e.x,r=e.y,a=ck(e,rk),i="".concat(n),o=parseInt(i,10),s="".concat(r),l=parseInt(s,10),c="".concat(t.height||a.height),u=parseInt(c,10),d="".concat(t.width||a.width),f=parseInt(d,10);return sk(sk(sk(sk(sk({},t),a),o?{x:o}:{}),l?{y:l}:{}),{},{height:u,width:f,name:t.name,radius:t.radius})}function dk(e){return s.createElement(WS,ik({shapeType:"rectangle",propTransformer:uk,activeClassName:"recharts-active-bar"},e))}var fk,pk=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return function(n,r){if("number"==typeof e)return e;var a=Jr(n)||function(e){return vr(e)}(n);return a?e(n,r):(a||kv(),t)}},hk=["value","background"];function mk(e){return(mk="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function yk(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)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}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}function xk(){return xk=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},xk.apply(this,arguments)}function gk(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function vk(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?gk(Object(n),!0).forEach(function(t){Ok(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):gk(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function bk(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,kk(r.key),r)}}function jk(e,t,n){return t=Nk(t),function(e,t){if(t&&("object"===mk(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,wk()?Reflect.construct(t,n||[],Nk(e).constructor):t.apply(e,n))}function wk(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(wk=function(){return!!e})()}function Nk(e){return(Nk=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Sk(e,t){return(Sk=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function Ok(e,t,n){return(t=kk(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function kk(e){var t=function(e,t){if("object"!=mk(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=mk(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==mk(t)?t:t+""}var Ak=function(){function e(){var t;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e);for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Ok(t=jk(this,e,[].concat(r)),"state",{isAnimationFinished:!1}),Ok(t,"id",ea("recharts-bar-")),Ok(t,"handleAnimationEnd",function(){var e=t.props.onAnimationEnd;t.setState({isAnimationFinished:!0}),e&&e()}),Ok(t,"handleAnimationStart",function(){var e=t.props.onAnimationStart;t.setState({isAnimationFinished:!1}),e&&e()}),t}return function(e,t){if("function"!=typeof t&&null!==t)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&&Sk(e,t)}(e,i.PureComponent),t=e,r=[{key:"getDerivedStateFromProps",value:function(e,t){return e.animationId!==t.prevAnimationId?{prevAnimationId:e.animationId,curData:e.data,prevData:t.curData}:e.data!==t.curData?{curData:e.data}:null}}],(n=[{key:"renderRectanglesStatically",value:function(e){var t=this,n=this.props,r=n.shape,a=n.dataKey,i=n.activeIndex,o=n.activeBar,l=Pa(this.props,!1);return e&&e.map(function(e,n){var c=n===i,u=c?o:r,d=vk(vk(vk({},l),e),{},{isActive:c,option:u,index:n,dataKey:a,onAnimationStart:t.handleAnimationStart,onAnimationEnd:t.handleAnimationEnd});return s.createElement(za,xk({className:"recharts-bar-rectangle"},pa(t.props,e,n),{key:"rectangle-".concat(null==e?void 0:e.x,"-").concat(null==e?void 0:e.y,"-").concat(null==e?void 0:e.value,"-").concat(n)}),s.createElement(dk,d))})}},{key:"renderRectanglesWithAnimation",value:function(){var e=this,t=this.props,n=t.data,r=t.layout,a=t.isAnimationActive,i=t.animationBegin,o=t.animationDuration,l=t.animationEasing,c=t.animationId,u=this.state.prevData;return s.createElement(Qw,{begin:i,duration:o,isActive:a,easing:l,from:{t:0},to:{t:1},key:"bar-".concat(c),onAnimationEnd:this.handleAnimationEnd,onAnimationStart:this.handleAnimationStart},function(t){var a=t.t,i=n.map(function(e,t){var n=u&&u[t];if(n){var i=ra(n.x,e.x),o=ra(n.y,e.y),s=ra(n.width,e.width),l=ra(n.height,e.height);return vk(vk({},e),{},{x:i(a),y:o(a),width:s(a),height:l(a)})}if("horizontal"===r){var c=ra(0,e.height)(a);return vk(vk({},e),{},{y:e.y+e.height-c,height:c})}var d=ra(0,e.width)(a);return vk(vk({},e),{},{width:d})});return s.createElement(za,null,e.renderRectanglesStatically(i))})}},{key:"renderRectangles",value:function(){var e=this.props,t=e.data,n=e.isAnimationActive,r=this.state.prevData;return!(n&&t&&t.length)||r&&kg(r,t)?this.renderRectanglesStatically(t):this.renderRectanglesWithAnimation()}},{key:"renderBackground",value:function(){var e=this,t=this.props,n=t.data,r=t.dataKey,a=t.activeIndex,i=Pa(this.props.background,!1);return n.map(function(t,n){t.value;var o=t.background,l=yk(t,hk);if(!o)return null;var c=vk(vk(vk(vk(vk({},l),{},{fill:"#eee"},o),i),pa(e.props,t,n)),{},{onAnimationStart:e.handleAnimationStart,onAnimationEnd:e.handleAnimationEnd,dataKey:r,index:n,className:"recharts-bar-background-rectangle"});return s.createElement(dk,xk({key:"background-bar-".concat(n),option:e.props.background,isActive:n===a},c))})}},{key:"renderErrorBar",value:function(e,t){if(this.props.isAnimationActive&&!this.state.isAnimationFinished)return null;var n=this.props,r=n.data,a=n.xAxis,i=n.yAxis,o=n.layout,l=Na(n.children,$v);if(!l)return null;var c="vertical"===o?r[0].height/2:r[0].width/2,u=function(e,t){var n=Array.isArray(e.value)?e.value[1]:e.value;return{x:e.x,y:e.y,value:n,errorVal:Zv(e,t)}},d={clipPath:e?"url(#clipPath-".concat(t,")"):null};return s.createElement(za,d,l.map(function(e){return s.cloneElement(e,{key:"error-bar-".concat(t,"-").concat(e.props.dataKey),data:r,xAxis:a,yAxis:i,layout:o,offset:c,dataPointFormatter:u})}))}},{key:"render",value:function(){var e=this.props,t=e.hide,n=e.data,r=e.className,a=e.xAxis,i=e.yAxis,l=e.left,c=e.top,u=e.width,d=e.height,f=e.isAnimationActive,p=e.background,h=e.id;if(t||!n||!n.length)return null;var m=this.state.isAnimationFinished,y=o("recharts-bar",r),x=a&&a.allowDataOverflow,g=i&&i.allowDataOverflow,v=x||g,b=vr(h)?this.id:h;return s.createElement(za,{className:y},x||g?s.createElement("defs",null,s.createElement("clipPath",{id:"clipPath-".concat(b)},s.createElement("rect",{x:x?l:l-u/2,y:g?c:c-d/2,width:x?u:2*u,height:g?d:2*d}))):null,s.createElement(za,{className:"recharts-bar-rectangles",clipPath:v?"url(#clipPath-".concat(b,")"):null},p?this.renderBackground():null,this.renderRectangles()),this.renderErrorBar(v,b),(!f||m)&&sj.renderCallByParent(this.props,n))}}])&&bk(t.prototype,n),r&&bk(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,n,r}();function Pk(e){return(Pk="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Ek(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,Tk(r.key),r)}}function _k(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Ck(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?_k(Object(n),!0).forEach(function(t){Mk(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):_k(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Mk(e,t,n){return(t=Tk(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Tk(e){var t=function(e,t){if("object"!=Pk(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=Pk(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==Pk(t)?t:t+""}fk=Ak,Ok(Ak,"displayName","Bar"),Ok(Ak,"defaultProps",{xAxisId:0,yAxisId:0,legendType:"rect",minPointSize:0,hide:!1,data:[],layout:"vertical",activeBar:!1,isAnimationActive:!ef.isSsr,animationBegin:0,animationDuration:400,animationEasing:"ease"}),Ok(Ak,"getComposedData",function(e){var t=e.props,n=e.item,r=e.barPosition,a=e.bandSize,i=e.xAxis,o=e.yAxis,s=e.xAxisTicks,l=e.yAxisTicks,c=e.stackedData,u=e.dataStartIndex,d=e.displayedData,f=e.offset,p=function(e,t){if(!e)return null;for(var n=0,r=e.length;n<r;n++)if(e[n].item===t)return e[n].position;return null}(r,n);if(!p)return null;var h=t.layout,m=n.type.defaultProps,y=void 0!==m?vk(vk({},m),n.props):n.props,x=y.dataKey,g=y.children,v=y.minPointSize,b="horizontal"===h?o:i,j=c?b.scale.domain():null,w=function(e){var t=e.numericAxis,n=t.scale.domain();if("number"===t.type){var r=Math.min(n[0],n[1]),a=Math.max(n[0],n[1]);return r<=0&&a>=0?0:a<0?a:r}return n[0]}({numericAxis:b}),N=Na(g,Ff),S=d.map(function(e,t){var r,d,f,m,y,g;
vendor: 4,405 bytes, line 13
13c?r=function(e,t){if(!t||2!==t.length||!Jr(t[0])||!Jr(t[1]))return e;var n=Math.min(t[0],t[1]),r=Math.max(t[0],t[1]),a=[e[0],e[1]];return(!Jr(e[0])||e[0]<n)&&(a[0]=n),(!Jr(e[1])||e[1]>r)&&(a[1]=r),a[0]>r&&(a[0]=r),a[1]<n&&(a[1]=n),a}(c[u+t],j):(r=Zv(e,x),Array.isArray(r)||(r=[w,r]));var b=pk(v,fk.defaultProps.minPointSize)(r[1],t);if("horizontal"===h){var S,O=[o.scale(r[0]),o.scale(r[1])],k=O[0],A=O[1];d=mb({axis:i,ticks:s,bandSize:a,offset:p.offset,entry:e,index:t}),f=null!==(S=null!=A?A:k)&&void 0!==S?S:void 0,m=p.size;var P=k-A;if(y=Number.isNaN(P)?0:P,g={x:d,y:o.y,width:m,height:o.height},Math.abs(b)>0&&Math.abs(y)<Math.abs(b)){var E=Gr(y||b)*(Math.abs(b)-Math.abs(y));f-=E,y+=E}}else{var _=[i.scale(r[0]),i.scale(r[1])],C=_[0],M=_[1];if(d=C,f=mb({axis:o,ticks:l,bandSize:a,offset:p.offset,entry:e,index:t}),m=M-C,y=p.size,g={x:i.x,y:f,width:i.width,height:y},Math.abs(b)>0&&Math.abs(m)<Math.abs(b))m+=Gr(m||b)*(Math.abs(b)-Math.abs(m))}return vk(vk(vk({},e),{},{x:d,y:f,width:m,height:y,value:c?r:r[1],payload:e,background:g},N&&N[t]&&N[t].props),{},{tooltipPayload:[wb(n,e)],tooltipPosition:{x:d+m/2,y:f+y/2}})});return vk({data:S,layout:h},f)});var Dk=function(e,t,n,r,a){var i=e.width,o=e.height,s=e.layout,l=e.children,c=Object.keys(t),u={left:n.left,leftMirror:n.left,right:i-n.right,rightMirror:i-n.right,top:n.top,topMirror:n.top,bottom:o-n.bottom,bottomMirror:o-n.bottom},d=!!Sa(l,Ak);return c.reduce(function(i,o){var l,c,f,p,h,m=t[o],y=m.orientation,x=m.domain,g=m.padding,v=void 0===g?{}:g,b=m.mirror,j=m.reversed,w="".concat(y).concat(b?"Mirror":"");if("number"===m.type&&("gap"===m.padding||"no-gap"===m.padding)){var N=x[1]-x[0],S=1/0,O=m.categoricalDomain.sort(ia);if(O.forEach(function(e,t){t>0&&(S=Math.min((e||0)-(O[t-1]||0),S))}),Number.isFinite(S)){var k=S/N,A="vertical"===m.layout?n.height:n.width;if("gap"===m.padding&&(l=k*A/2),"no-gap"===m.padding){var P=ta(e.barCategoryGap,k*A),E=k*A/2;l=E-P-(E-P)/A*P}}}c="xAxis"===r?[n.left+(v.left||0)+(l||0),n.left+n.width-(v.right||0)-(l||0)]:"yAxis"===r?"horizontal"===s?[n.top+n.height-(v.bottom||0),n.top+(v.top||0)]:[n.top+(v.top||0)+(l||0),n.top+n.height-(v.bottom||0)-(l||0)]:m.range,j&&(c=[c[1],c[0]]);var _=lb(m,a,d),C=_.scale,M=_.realScaleType;C.domain(x).range(c),ub(C);var T=pb(C,Ck(Ck({},m),{},{realScaleType:M}));"xAxis"===r?(h="top"===y&&!b||"bottom"===y&&b,f=n.left,p=u[w]-h*m.height):"yAxis"===r&&(h="left"===y&&!b||"right"===y&&b,f=u[w]-h*m.width,p=n.top);var D=Ck(Ck(Ck({},m),T),{},{realScaleType:M,x:f,y:p,scale:C,width:"xAxis"===r?n.width:m.width,height:"yAxis"===r?n.height:m.height});return D.bandSize=bb(D,T),m.hide||"xAxis"!==r?m.hide||(u[w]+=(h?-1:1)*D.width):u[w]+=(h?-1:1)*D.height,Ck(Ck({},i),{},Mk({},o,D))},{})},Ik=function(e,t){var n=e.x,r=e.y,a=t.x,i=t.y;return{x:Math.min(n,a),y:Math.min(r,i),width:Math.abs(a-n),height:Math.abs(i-r)}},Rk=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.scale=t}return t=e,n=[{key:"domain",get:function(){return this.scale.domain}},{key:"range",get:function(){return this.scale.range}},{key:"rangeMin",get:function(){return this.range()[0]}},{key:"rangeMax",get:function(){return this.range()[1]}},{key:"bandwidth",get:function(){return this.scale.bandwidth}},{key:"apply",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.bandAware,r=t.position;if(void 0!==e){if(r)switch(r){case"start":default:return this.scale(e);case"middle":var a=this.bandwidth?this.bandwidth()/2:0;return this.scale(e)+a;case"end":var i=this.bandwidth?this.bandwidth():0;return this.scale(e)+i}if(n){var o=this.bandwidth?this.bandwidth()/2:0;return this.scale(e)+o}return this.scale(e)}}},{key:"isInRange",value:function(e){var t=this.range(),n=t[0],r=t[t.length-1];return n<=r?e>=n&&e<=r:e>=r&&e<=n}}],r=[{key:"create",value:function(t){return new e(t)}}],n&&Ek(t.prototype,n),r&&Ek(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,n,r}();Mk(Rk,"EPS",1e-4);var Lk=function(e){var t=Object.keys(e).reduce(function(t,n){return Ck(Ck({},t),{},Mk({},n,Rk.create(e[n])))},{});return Ck(Ck({},t),{},{apply:function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=n.bandAware,a=n.position;return GO(e,function(e,n){return t[n].apply(e,{bandAware:r,position:a})})},isInRange:function(e){return nk(e,function(e,n){return t[n].isInRange(e)}
vendor: 74,437 bytes, line 13
13)}})};var Bk=Zc,zk=Nl,$k=Al;var Fk=function(e){return function(t,n,r){var a=Object(t);if(!zk(t)){var i=Bk(n);t=$k(t),n=function(e){return i(a[e],e,a)}}var o=e(t,n,r);return o>-1?a[i?t[o]:o]:void 0}},Uk=hO;var qk=Qc,Wk=Zc,Hk=function(e){var t=Uk(e),n=t%1;return t==t?n?t-n:t:0},Vk=Math.max;const Kk=a(Fk(function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var a=null==n?0:Hk(n);return a<0&&(a=Vk(r+a,0)),qk(e,Wk(t),a)}));var Xk=Vn(function(e){return{x:e.left,y:e.top,width:e.width,height:e.height}},function(e){return["l",e.left,"t",e.top,"w",e.width,"h",e.height].join("")}),Gk=i.createContext(void 0),Yk=i.createContext(void 0),Jk=i.createContext(void 0),Zk=i.createContext({}),Qk=i.createContext(void 0),eA=i.createContext(0),tA=i.createContext(0),nA=function(e){var t=e.state,n=t.xAxisMap,r=t.yAxisMap,a=t.offset,i=e.clipPathId,o=e.children,l=e.width,c=e.height,u=Xk(a);return s.createElement(Gk.Provider,{value:n},s.createElement(Yk.Provider,{value:r},s.createElement(Zk.Provider,{value:a},s.createElement(Jk.Provider,{value:u},s.createElement(Qk.Provider,{value:i},s.createElement(eA.Provider,{value:c},s.createElement(tA.Provider,{value:l},o)))))))},rA=function(e){var t=i.useContext(Gk);null==t&&kv();var n=t[e];return null==n&&kv(),n},aA=function(e){var t=i.useContext(Yk);null==t&&kv();var n=t[e];return null==n&&kv(),n},iA=function(){return i.useContext(tA)},oA=function(){return i.useContext(eA)};function sA(e){return(sA="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function lA(e,t,n){return t&&function(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,yA(r.key),r)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function cA(e,t,n){return t=dA(t),function(e,t){if(t&&("object"===sA(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,uA()?Reflect.construct(t,n||[],dA(e).constructor):t.apply(e,n))}function uA(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(uA=function(){return!!e})()}function dA(e){return(dA=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function fA(e,t){return(fA=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function pA(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function hA(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?pA(Object(n),!0).forEach(function(t){mA(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):pA(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function mA(e,t,n){return(t=yA(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function yA(e){var t=function(e,t){if("object"!=sA(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=sA(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==sA(t)?t:t+""}function xA(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,i,o,s=[],l=!0,c=!1;try{if(i=(n=n.call(e)).next,0===t);else for(;!(l=(r=i.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(u){c=!0,a=u}finally{try{if(!l&&null!=n.return&&(o=n.return(),Object(o)!==o))return}finally{if(c)throw a}}return s}}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return gA(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return gA(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function gA(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function vA(){return vA=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},vA.apply(this,arguments)}function bA(e){var t=e.x,n=e.y,r=e.segment,a=e.xAxisId,l=e.yAxisId,c=e.shape,u=e.className,d=e.alwaysShow,f=i.useContext(Qk),p=rA(a),h=aA(l),m=i.useContext(Jk);if(!f||!m)return null;$a(void 0===d,'The alwaysShow prop is deprecated. Please use ifOverflow="extendDomain" instead.');var y=function(e,t,n,r,a,i,o,s,l){var c=a.x,u=a.y,d=a.width,f=a.height;if(n){var p=l.y,h=e.y.apply(p,{position:i});if(WO(l,"discard")&&!e.y.isInRange(h))return null;var m=[{x:c+d,y:h},{x:c,y:h}];return"left"===s?m.reverse():m}if(t){var y=l.x,x=e.x.apply(y,{position:i});if(WO(l,"discard")&&!e.x.isInRange(x))return null;var g=[{x:x,y:u+f},{x:x,y:u}];return"top"===o?g.reverse():g}if(r){var v=l.segment.map(function(t){return e.apply(t,{position:i})});return WO(l,"discard")&&qO(v,function(t){return!e.isInRange(t)})?null:v}return null}(Lk({x:p.scale,y:h.scale}),Zr(t),Zr(n),r&&2===r.length,m,e.position,p.orientation,h.orientation,e);if(!y)return null;var x=xA(y,2),g=x[0],v=g.x,b=g.y,j=x[1],w=j.x,N=j.y,S=hA(hA({clipPath:WO(e,"hidden")?"url(#".concat(f,")"):void 0},Pa(e,!0)),{},{x1:v,y1:b,x2:w,y2:N});return s.createElement(za,{className:o("recharts-reference-line",u)},function(e,t){return s.isValidElement(e)?s.cloneElement(e,t):kt(e)?e(t):s.createElement("line",vA({},t,{className:"recharts-reference-line-line"}))}(c,S),Kb.renderCallByParent(e,function(e){var t=e.x1,n=e.y1,r=e.x2,a=e.y2;return Ik({x:t,y:n},{x:r,y:a})}({x1:v,y1:b,x2:w,y2:N})))}var jA=function(){function e(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),cA(this,e,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)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&&fA(e,t)}(e,s.Component),lA(e,[{key:"render",value:function(){return s.createElement(bA,this.props)}}])}();function wA(){return wA=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},wA.apply(this,arguments)}function NA(e){return(NA="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function SA(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function OA(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?SA(Object(n),!0).forEach(function(t){CA(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):SA(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function kA(e,t,n){return t&&function(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,MA(r.key),r)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function AA(e,t,n){return t=EA(t),function(e,t){if(t&&("object"===NA(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,PA()?Reflect.construct(t,n||[],EA(e).constructor):t.apply(e,n))}function PA(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(PA=function(){return!!e})()}function EA(e){return(EA=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function _A(e,t){return(_A=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function CA(e,t,n){return(t=MA(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function MA(e){var t=function(e,t){if("object"!=NA(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=NA(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==NA(t)?t:t+""}mA(jA,"displayName","ReferenceLine"),mA(jA,"defaultProps",{isFront:!1,ifOverflow:"discard",xAxisId:0,yAxisId:0,fill:"none",stroke:"#ccc",fillOpacity:1,strokeWidth:1,position:"middle"});var TA=function(){function e(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),AA(this,e,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)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&&_A(e,t)}(e,s.Component),kA(e,[{key:"render",value:function(){var t=this.props,n=t.x,r=t.y,a=t.r,i=t.alwaysShow,l=t.clipPathId,c=Zr(n),u=Zr(r);if($a(void 0===i,'The alwaysShow prop is deprecated. Please use ifOverflow="extendDomain" instead.'),!c||!u)return null;var d=function(e){var t=e.x,n=e.y,r=e.xAxis,a=e.yAxis,i=Lk({x:r.scale,y:a.scale}),o=i.apply({x:t,y:n},{bandAware:!0});return WO(e,"discard")&&!i.isInRange(o)?null:o}(this.props);if(!d)return null;var f=d.x,p=d.y,h=this.props,m=h.shape,y=h.className,x=OA(OA({clipPath:WO(this.props,"hidden")?"url(#".concat(l,")"):void 0},Pa(this.props,!0)),{},{cx:f,cy:p});return s.createElement(za,{className:o("recharts-reference-dot",y)},e.renderDot(m,x),Kb.renderCallByParent(this.props,{x:f-a,y:p-a,width:2*a,height:2*a}))}}])}();function DA(){return DA=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},DA.apply(this,arguments)}function IA(e){return(IA="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function RA(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function LA(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?RA(Object(n),!0).forEach(function(t){qA(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):RA(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function BA(e,t,n){return t&&function(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,WA(r.key),r)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function zA(e,t,n){return t=FA(t),function(e,t){if(t&&("object"===IA(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,$A()?Reflect.construct(t,n||[],FA(e).constructor):t.apply(e,n))}function $A(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return($A=function(){return!!e})()}function FA(e){return(FA=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function UA(e,t){return(UA=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function qA(e,t,n){return(t=WA(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function WA(e){var t=function(e,t){if("object"!=IA(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=IA(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==IA(t)?t:t+""}CA(TA,"displayName","ReferenceDot"),CA(TA,"defaultProps",{isFront:!1,ifOverflow:"discard",xAxisId:0,yAxisId:0,r:10,fill:"#fff",stroke:"#ccc",fillOpacity:1,strokeWidth:1}),CA(TA,"renderDot",function(e,t){return s.isValidElement(e)?s.cloneElement(e,t):kt(e)?e(t):s.createElement(bN,wA({},t,{cx:t.cx,cy:t.cy,className:"recharts-reference-dot-dot"}))});var HA=function(){function e(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),zA(this,e,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)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&&UA(e,t)}(e,s.Component),BA(e,[{key:"render",value:function(){var t=this.props,n=t.x1,r=t.x2,a=t.y1,i=t.y2,l=t.className,c=t.alwaysShow,u=t.clipPathId;$a(void 0===c,'The alwaysShow prop is deprecated. Please use ifOverflow="extendDomain" instead.');var d=Zr(n),f=Zr(r),p=Zr(a),h=Zr(i),m=this.props.shape;if(!(d||f||p||h||m))return null;var y=function(e,t,n,r,a){var i=a.x1,o=a.x2,s=a.y1,l=a.y2,c=a.xAxis,u=a.yAxis;if(!c||!u)return null;var d=Lk({x:c.scale,y:u.scale}),f={x:e?d.x.apply(i,{position:"start"}):d.x.rangeMin,y:n?d.y.apply(s,{position:"start"}):d.y.rangeMin},p={x:t?d.x.apply(o,{position:"end"}):d.x.rangeMax,y:r?d.y.apply(l,{position:"end"}):d.y.rangeMax};return!WO(a,"discard")||d.isInRange(f)&&d.isInRange(p)?Ik(f,p):null}(d,f,p,h,this.props);if(!y&&!m)return null;var x=WO(this.props,"hidden")?"url(#".concat(u,")"):void 0;return s.createElement(za,{className:o("recharts-reference-area",l)},e.renderRect(m,LA(LA({clipPath:x},Pa(this.props,!0)),y)),Kb.renderCallByParent(this.props,y))}}])}();function VA(e,t,n){if(t<1)return[];if(1===t&&void 0===n)return e;for(var r=[],a=0;a<e.length;a+=t)r.push(e[a]);return r}function KA(e,t,n){return function(e){var t=e.width,n=e.height,r=function(e){return(e%180+180)%180}(arguments.length>1&&void 0!==arguments[1]?arguments[1]:0),a=r*Math.PI/180,i=Math.atan(n/t),o=a>i&&a<Math.PI-i?n/Math.sin(a):t/Math.cos(a);return Math.abs(o)}({width:e.width+t.width,height:e.height+t.height},n)}function XA(e,t,n,r,a){if(e*t<e*r||e*t>e*a)return!1;var i=n();return e*(t-e*i/2-r)>=0&&e*(t+e*i/2-a)<=0}function GA(e){return(GA="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function YA(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function JA(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?YA(Object(n),!0).forEach(function(t){ZA(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):YA(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function ZA(e,t,n){var r;return r=function(e,t){if("object"!=GA(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=GA(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(t,"string"),(t="symbol"==GA(r)?r:r+"")in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function QA(e,t,n){var r=e.tick,a=e.ticks,i=e.viewBox,o=e.minTickGap,s=e.orientation,l=e.interval,c=e.tickFormatter,u=e.unit,d=e.angle;if(!a||!a.length||!r)return[];if(Jr(l)||ef.isSsr)return function(e,t){return VA(e,t+1)}(a,"number"==typeof l&&Jr(l)?l:0);var f=[],p="top"===s||"bottom"===s?"width":"height",h=u&&"width"===p?Gf(u,{fontSize:t,letterSpacing:n}):{width:0,height:0},m=function(e,r){var a=kt(c)?c(e.value,r):e.value;return"width"===p?KA(Gf(a,{fontSize:t,letterSpacing:n}),h,d):Gf(a,{fontSize:t,letterSpacing:n})[p]},y=a.length>=2?Gr(a[1].coordinate-a[0].coordinate):1,x=function(e,t,n){var r="width"===n,a=e.x,i=e.y,o=e.width,s=e.height;return 1===t?{start:r?a:i,end:r?a+o:i+s}:{start:r?a+o:i+s,end:r?a:i}}(i,y,p);return"equidistantPreserveStart"===l?function(e,t,n,r,a){for(var i,o=(r||[]).slice(),s=t.start,l=t.end,c=0,u=1,d=s,f=function(){var t=null==r?void 0:r[c];if(void 0===t)return{v:VA(r,u)};var i,o=c,f=function(){return void 0===i&&(i=n(t,o)),i},p=t.coordinate,h=0===c||XA(e,p,f,d,l);h||(c=0,d=s,u+=1),h&&(d=p+e*(f()/2+a),c+=u)};u<=o.length;)if(i=f())return i.v;return[]}(y,x,m,a,o):(f="preserveStart"===l||"preserveStartEnd"===l?function(e,t,n,r,a,i){var o=(r||[]).slice(),s=o.length,l=t.start,c=t.end;if(i){var u=r[s-1],d=n(u,s-1),f=e*(u.coordinate+e*d/2-c);o[s-1]=u=JA(JA({},u),{},{tickCoord:f>0?u.coordinate-f*e:u.coordinate}),XA(e,u.tickCoord,function(){return d},l,c)&&(c=u.tickCoord-e*(d/2+a),o[s-1]=JA(JA({},u),{},{isShow:!0}))}for(var p=i?s-1:s,h=function(t){var r,i=o[t],s=function(){return void 0===r&&(r=n(i,t)),r};if(0===t){var u=e*(i.coordinate-e*s()/2-l);o[t]=i=JA(JA({},i),{},{tickCoord:u<0?i.coordinate-u*e:i.coordinate})}else o[t]=i=JA(JA({},i),{},{tickCoord:i.coordinate});XA(e,i.tickCoord,s,l,c)&&(l=i.tickCoord+e*(s()/2+a),o[t]=JA(JA({},i),{},{isShow:!0}))},m=0;m<p;m++)h(m);return o}(y,x,m,a,o,"preserveStartEnd"===l):function(e,t,n,r,a){for(var i=(r||[]).slice(),o=i.length,s=t.start,l=t.end,c=function(t){var r,c=i[t],u=function(){return void 0===r&&(r=n(c,t)),r};if(t===o-1){var d=e*(c.coordinate+e*u()/2-l);i[t]=c=JA(JA({},c),{},{tickCoord:d>0?c.coordinate-d*e:c.coordinate})}else i[t]=c=JA(JA({},c),{},{tickCoord:c.coordinate});XA(e,c.tickCoord,u,s,l)&&(l=c.tickCoord-e*(u()/2+a),i[t]=JA(JA({},c),{},{isShow:!0}))},u=o-1;u>=0;u--)c(u);return i}(y,x,m,a,o),f.filter(function(e){return e.isShow}))}qA(HA,"displayName","ReferenceArea"),qA(HA,"defaultProps",{isFront:!1,ifOverflow:"discard",xAxisId:0,yAxisId:0,r:10,fill:"#ccc",fillOpacity:.5,stroke:"none",strokeWidth:1}),qA(HA,"renderRect",function(e,t){return s.isValidElement(e)?s.cloneElement(e,t):kt(e)?e(t):s.createElement(uN,DA({},t,{className:"recharts-reference-area-rect"}))});var eP=["viewBox"],tP=["viewBox"],nP=["ticks"];function rP(e){return(rP="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function aP(){return aP=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},aP.apply(this,arguments)}function iP(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function oP(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?iP(Object(n),!0).forEach(function(t){pP(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):iP(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function sP(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)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}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}function lP(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,hP(r.key),r)}}function cP(e,t,n){return t=dP(t),function(e,t){if(t&&("object"===rP(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,uP()?Reflect.construct(t,n||[],dP(e).constructor):t.apply(e,n))}function uP(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(uP=function(){return!!e})()}function dP(e){return(dP=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function fP(e,t){return(fP=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function pP(e,t,n){return(t=hP(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function hP(e){var t=function(e,t){if("object"!=rP(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=rP(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==rP(t)?t:t+""}var mP=function(){function e(t){var n;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),(n=cP(this,e,[t])).state={fontSize:"",letterSpacing:""},n}return function(e,t){if("function"!=typeof t&&null!==t)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&&fP(e,t)}(e,i.Component),t=e,r=[{key:"renderTickItem",value:function(e,t,n){var r=o(t.className,"recharts-cartesian-axis-tick-value");return s.isValidElement(e)?s.cloneElement(e,oP(oP({},t),{},{className:r})):kt(e)?e(oP(oP({},t),{},{className:r})):s.createElement(Sp,aP({},t,{className:"recharts-cartesian-axis-tick-value"}),n)}}],(n=[{key:"shouldComponentUpdate",value:function(e,t){var n=e.viewBox,r=sP(e,eP),a=this.props,i=a.viewBox,o=sP(a,tP);return!oa(n,i)||!oa(r,o)||!oa(t,this.state)}},{key:"componentDidMount",value:function(){var e=this.layerReference;if(e){var t=e.getElementsByClassName("recharts-cartesian-axis-tick-value")[0];t&&this.setState({fontSize:window.getComputedStyle(t).fontSize,letterSpacing:window.getComputedStyle(t).letterSpacing})}}},{key:"getTickLineCoord",value:function(e){var t,n,r,a,i,o,s=this.props,l=s.x,c=s.y,u=s.width,d=s.height,f=s.orientation,p=s.tickSize,h=s.mirror,m=s.tickMargin,y=h?-1:1,x=e.tickSize||p,g=Jr(e.tickCoord)?e.tickCoord:e.coordinate;switch(f){case"top":t=n=e.coordinate,o=(r=(a=c+ +!h*d)-y*x)-y*m,i=g;break;case"left":r=a=e.coordinate,i=(t=(n=l+ +!h*u)-y*x)-y*m,o=g;break;case"right":r=a=e.coordinate,i=(t=(n=l+ +h*u)+y*x)+y*m,o=g;break;default:t=n=e.coordinate,o=(r=(a=c+ +h*d)+y*x)+y*m,i=g}return{line:{x1:t,y1:r,x2:n,y2:a},tick:{x:i,y:o}}}},{key:"getTickTextAnchor",value:function(){var e,t=this.props,n=t.orientation,r=t.mirror;switch(n){case"left":e=r?"start":"end";break;case"right":e=r?"end":"start";break;default:e="middle"}return e}},{key:"getTickVerticalAnchor",value:function(){var e=this.props,t=e.orientation,n=e.mirror,r="end";switch(t){case"left":case"right":r="middle";break;case"top":r=n?"start":"end";break;default:r=n?"end":"start"}return r}},{key:"renderAxisLine",value:function(){var e=this.props,t=e.x,n=e.y,r=e.width,a=e.height,i=e.orientation,l=e.mirror,c=e.axisLine,u=oP(oP(oP({},Pa(this.props,!1)),Pa(c,!1)),{},{fill:"none"});if("top"===i||"bottom"===i){var d=+("top"===i&&!l||"bottom"===i&&l);u=oP(oP({},u),{},{x1:t,y1:n+d*a,x2:t+r,y2:n+d*a})}else{var f=+("left"===i&&!l||"right"===i&&l);u=oP(oP({},u),{},{x1:t+f*r,y1:n,x2:t+f*r,y2:n+a})}return s.createElement("line",aP({},u,{className:o("recharts-cartesian-axis-line",gr(c,"className"))}))}},{key:"renderTicks",value:function(t,n,r){var a=this,i=this.props,l=i.tickLine,c=i.stroke,u=i.tick,d=i.tickFormatter,f=i.unit,p=QA(oP(oP({},this.props),{},{ticks:t}),n,r),h=this.getTickTextAnchor(),m=this.getTickVerticalAnchor(),y=Pa(this.props,!1),x=Pa(u,!1),g=oP(oP({},y),{},{fill:"none"},Pa(l,!1)),v=p.map(function(t,n){var r=a.getTickLineCoord(t),i=r.line,v=r.tick,b=oP(oP(oP(oP({textAnchor:h,verticalAnchor:m},y),{},{stroke:"none",fill:c},x),v),{},{index:n,payload:t,visibleTicksCount:p.length,tickFormatter:d});return s.createElement(za,aP({className:"recharts-cartesian-axis-tick",key:"tick-".concat(t.value,"-").concat(t.coordinate,"-").concat(t.tickCoord)},pa(a.props,t,n)),l&&s.createElement("line",aP({},g,i,{className:o("recharts-cartesian-axis-tick-line",gr(l,"className"))})),u&&e.renderTickItem(u,b,"".concat(kt(d)?d(t.value,n):t.value).concat(f||"")))});return s.createElement("g",{className:"recharts-cartesian-axis-ticks"},v)}},{key:"render",value:function(){var e=this,t=this.props,n=t.axisLine,r=t.width,a=t.height,i=t.ticksGenerator,l=t.className;if(t.hide)return null;var c=this.props,u=c.ticks,d=sP(c,nP),f=u;return kt(i)&&(f=u&&u.length>0?i(this.props):i(d)),r<=0||a<=0||!f||!f.length?null:s.createElement(za,{className:o("recharts-cartesian-axis",l),ref:function(t){e.layerReference=t}},n&&this.renderAxisLine(),this.renderTicks(f,this.state.fontSize,this.state.letterSpacing),Kb.renderCallByParent(this.props))}}])&&lP(t.prototype,n),r&&lP(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,n,r}();pP(mP,"displayName","CartesianAxis"),pP(mP,"defaultProps",{x:0,y:0,width:0,height:0,viewBox:{x:0,y:0,width:0,height:0},orientation:"bottom",ticks:[],stroke:"#666",tickLine:!0,axisLine:!0,tick:!0,mirror:!1,minTickGap:5,tickSize:6,tickMargin:2,interval:"preserveEnd"});var yP=["x1","y1","x2","y2","key"],xP=["offset"];function gP(e){return(gP="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function vP(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function bP(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?vP(Object(n),!0).forEach(function(t){jP(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):vP(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function jP(e,t,n){var r;return r=function(e,t){if("object"!=gP(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=gP(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(t,"string"),(t="symbol"==gP(r)?r:r+"")in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function wP(){return wP=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},wP.apply(this,arguments)}function NP(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)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}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var SP=function(e){var t=e.fill;if(!t||"none"===t)return null;var n=e.fillOpacity,r=e.x,a=e.y,i=e.width,o=e.height,l=e.ry;return s.createElement("rect",{x:r,y:a,ry:l,width:i,height:o,stroke:"none",fill:t,fillOpacity:n,className:"recharts-cartesian-grid-bg"})};function OP(e,t){var n;if(s.isValidElement(e))n=s.cloneElement(e,t);else if(kt(e))n=e(t);else{var r=t.x1,a=t.y1,i=t.x2,o=t.y2,l=t.key,c=NP(t,yP),u=Pa(c,!1);u.offset;var d=NP(u,xP);n=s.createElement("line",wP({},d,{x1:r,y1:a,x2:i,y2:o,fill:"none",key:l}))}return n}function kP(e){var t=e.x,n=e.width,r=e.horizontal,a=void 0===r||r,i=e.horizontalPoints;if(!a||!i||!i.length)return null;var o=i.map(function(r,i){var o=bP(bP({},e),{},{x1:t,y1:r,x2:t+n,y2:r,key:"line-".concat(i),index:i});return OP(a,o)});return s.createElement("g",{className:"recharts-cartesian-grid-horizontal"},o)}function AP(e){var t=e.y,n=e.height,r=e.vertical,a=void 0===r||r,i=e.verticalPoints;if(!a||!i||!i.length)return null;var o=i.map(function(r,i){var o=bP(bP({},e),{},{x1:r,y1:t,x2:r,y2:t+n,key:"line-".concat(i),index:i});return OP(a,o)});return s.createElement("g",{className:"recharts-cartesian-grid-vertical"},o)}function PP(e){var t=e.horizontalFill,n=e.fillOpacity,r=e.x,a=e.y,i=e.width,o=e.height,l=e.horizontalPoints,c=e.horizontal;if(!(void 0===c||c)||!t||!t.length)return null;var u=l.map(function(e){return Math.round(e+a-a)}).sort(function(e,t){return e-t});a!==u[0]&&u.unshift(0);var d=u.map(function(e,l){var c=!u[l+1]?a+o-e:u[l+1]-e;if(c<=0)return null;var d=l%t.length;return s.createElement("rect",{key:"react-".concat(l),y:e,x:r,height:c,width:i,stroke:"none",fill:t[d],fillOpacity:n,className:"recharts-cartesian-grid-bg"})});return s.createElement("g",{className:"recharts-cartesian-gridstripes-horizontal"},d)}function EP(e){var t=e.vertical,n=void 0===t||t,r=e.verticalFill,a=e.fillOpacity,i=e.x,o=e.y,l=e.width,c=e.height,u=e.verticalPoints;if(!n||!r||!r.length)return null;var d=u.map(function(e){return Math.round(e+i-i)}).sort(function(e,t){return e-t});i!==d[0]&&d.unshift(0);var f=d.map(function(e,t){var n=!d[t+1]?i+l-e:d[t+1]-e;if(n<=0)return null;var u=t%r.length;return s.createElement("rect",{key:"react-".concat(t),x:e,y:o,width:n,height:c,stroke:"none",fill:r[u],fillOpacity:a,className:"recharts-cartesian-grid-bg"})});return s.createElement("g",{className:"recharts-cartesian-gridstripes-vertical"},f)}var _P=function(e,t){var n=e.xAxis,r=e.width,a=e.height,i=e.offset;return ab(QA(bP(bP(bP({},mP.defaultProps),n),{},{ticks:ib(n,!0),viewBox:{x:0,y:0,width:r,height:a}})),i.left,i.left+i.width,t)},CP=function(e,t){var n=e.yAxis,r=e.width,a=e.height,i=e.offset;return ab(QA(bP(bP(bP({},mP.defaultProps),n),{},{ticks:ib(n,!0),viewBox:{x:0,y:0,width:r,height:a}})),i.top,i.top+i.height,t)},MP={horizontal:!0,vertical:!0,horizontalPoints:[],verticalPoints:[],stroke:"#ccc",fill:"none",verticalFill:[],horizontalFill:[]};function TP(e){var t,n,r,a,o,l,c,u,d=iA(),f=oA(),p=i.useContext(Zk),h=bP(bP({},e),{},{stroke:null!==(t=e.stroke)&&void 0!==t?t:MP.stroke,fill:null!==(n=e.fill)&&void 0!==n?n:MP.fill,horizontal:null!==(r=e.horizontal)&&void 0!==r?r:MP.horizontal,horizontalFill:null!==(a=e.horizontalFill)&&void 0!==a?a:MP.horizontalFill,vertical:null!==(o=e.vertical)&&void 0!==o?o:MP.vertical,verticalFill:null!==(l=e.verticalFill)&&void 0!==l?l:MP.verticalFill,x:Jr(e.x)?e.x:p.left,y:Jr(e.y)?e.y:p.top,width:Jr(e.width)?e.width:p.width,height:Jr(e.height)?e.height:p.height}),m=h.x,y=h.y,x=h.width,g=h.height,v=h.syncWithTicks,b=h.horizontalValues,j=h.verticalValues,w=(c=i.useContext(Gk),na(c)),N=(u=i.useContext(Yk),Kk(u,function(e){return nk(e.domain,Number.isFinite)})||na(u));if(!Jr(x)||x<=0||!Jr(g)||g<=0||!Jr(m)||m!==+m||!Jr(y)||y!==+y)return null;var S=h.verticalCoordinatesGenerator||_P,O=h.horizontalCoordinatesGenerator||CP,k=h.horizontalPoints,A=h.verticalPoints;if((!k||!k.length)&&kt(O)){var P=b&&b.length,E=O({yAxis:N?bP(bP({},N),{},{ticks:P?b:N.ticks}):void 0,width:d,height:f,offset:p},!!P||v);$a(Array.isArray(E),"horizontalCoordinatesGenerator should return Array but instead it returned [".concat(gP(E),"]")),Array.isArray(E)&&(k=E)}if((!A||!A.length)&&kt(S)){var _=j&&j.length,C=S({xAxis:w?bP(bP({},w),{},{ticks:_?j:w.ticks}):void 0,width:d,height:f,offset:p},!!_||v);$a(Array.isArray(C),"verticalCoordinatesGenerator should return Array but instead it returned [".concat(gP(C),"]")),Array.isArray(C)&&(A=C)}return s.createElement("g",{className:"recharts-cartesian-grid"},s.createElement(SP,{fill:h.fill,fillOpacity:h.fillOpacity,x:h.x,y:h.y,width:h.width,height:h.height,ry:h.ry}),s.createElement(kP,wP({},h,{offset:p,horizontalPoints:k,xAxis:w,yAxis:N})),s.createElement(AP,wP({},h,{offset:p,verticalPoints:A,xAxis:w,yAxis:N})),s.createElement(PP,wP({},h,{horizontalPoints:k})),s.createElement(EP,wP({},h,{verticalPoints:A})))}TP.displayName="CartesianGrid";var DP=["type","layout","connectNulls","ref"],IP=["key"];function RP(e){return(RP="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function LP(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)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}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}function BP(){return BP=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},BP.apply(this,arguments)}function zP(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function $P(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?zP(Object(n),!0).forEach(function(t){XP(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):zP(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function FP(e){return function(e){if(Array.isArray(e))return UP(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return UP(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return UP(e,t)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function UP(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function qP(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,GP(r.key),r)}}function WP(e,t,n){return t=VP(t),function(e,t){if(t&&("object"===RP(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,HP()?Reflect.construct(t,n||[],VP(e).constructor):t.apply(e,n))}function HP(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(HP=function(){return!!e})()}function VP(e){return(VP=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function KP(e,t){return(KP=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function XP(e,t,n){return(t=GP(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function GP(e){var t=function(e,t){if("object"!=RP(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=RP(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==RP(t)?t:t+""}var YP=function(){function e(){var t;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e);for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return XP(t=WP(this,e,[].concat(r)),"state",{isAnimationFinished:!0,totalLength:0}),XP(t,"generateSimpleStrokeDasharray",function(e,t){return"".concat(t,"px ").concat(e-t,"px")}),XP(t,"getStrokeDasharray",function(n,r,a){var i=a.reduce(function(e,t){return e+t});if(!i)return t.generateSimpleStrokeDasharray(r,n);for(var o=Math.floor(n/i),s=n%i,l=r-n,c=[],u=0,d=0;u<a.length;d+=a[u],++u)if(d+a[u]>s){c=[].concat(FP(a.slice(0,u)),[s-d]);break}var f=c.length%2==0?[0,l]:[l];return[].concat(FP(e.repeat(a,o)),FP(c),f).map(function(e){return"".concat(e,"px")}).join(", ")}),XP(t,"id",ea("recharts-line-")),XP(t,"pathRef",function(e){t.mainCurve=e}),XP(t,"handleAnimationEnd",function(){t.setState({isAnimationFinished:!0}),t.props.onAnimationEnd&&t.props.onAnimationEnd()}),XP(t,"handleAnimationStart",function(){t.setState({isAnimationFinished:!1}),t.props.onAnimationStart&&t.props.onAnimationStart()}),t}return function(e,t){if("function"!=typeof t&&null!==t)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&&KP(e,t)}(e,i.PureComponent),t=e,r=[{key:"getDerivedStateFromProps",value:function(e,t){return e.animationId!==t.prevAnimationId?{prevAnimationId:e.animationId,curPoints:e.points,prevPoints:t.curPoints}:e.points!==t.curPoints?{curPoints:e.points}:null}},{key:"repeat",value:function(e,t){for(var n=e.length%2!=0?[].concat(FP(e),[0]):e,r=[],a=0;a<t;++a)r=[].concat(FP(r),FP(n));return r}},{key:"renderDotItem",value:function(e,t){var n;if(s.isValidElement(e))n=s.cloneElement(e,t);else if(kt(e))n=e(t);else{var r=t.key,a=LP(t,IP),i=o("recharts-line-dot","boolean"!=typeof e?e.className:"");n=s.createElement(bN,BP({key:r},a,{className:i}))}return n}}],(n=[{key:"componentDidMount",value:function(){if(this.props.isAnimationActive){var e=this.getTotalLength();this.setState({totalLength:e})}}},{key:"componentDidUpdate",value:function(){if(this.props.isAnimationActive){var e=this.getTotalLength();e!==this.state.totalLength&&this.setState({totalLength:e})}}},{key:"getTotalLength",value:function(){var e=this.mainCurve;try{return e&&e.getTotalLength&&e.getTotalLength()||0}catch(t){return 0}}},{key:"renderErrorBar",value:function(e,t){if(this.props.isAnimationActive&&!this.state.isAnimationFinished)return null;var n=this.props,r=n.points,a=n.xAxis,i=n.yAxis,o=n.layout,l=Na(n.children,$v);if(!l)return null;var c=function(e,t){return{x:e.x,y:e.y,value:e.value,errorVal:Zv(e.payload,t)}},u={clipPath:e?"url(#clipPath-".concat(t,")"):null};return s.createElement(za,u,l.map(function(e){return s.cloneElement(e,{key:"bar-".concat(e.props.dataKey),data:r,xAxis:a,yAxis:i,layout:o,dataPointFormatter:c})}))}},{key:"renderDots",value:function(t,n,r){if(this.props.isAnimationActive&&!this.state.isAnimationFinished)return null;var a=this.props,i=a.dot,o=a.points,l=a.dataKey,c=Pa(this.props,!1),u=Pa(i,!0),d=o.map(function(t,n){var r=$P($P($P({key:"dot-".concat(n),r:3},c),u),{},{index:n,cx:t.x,cy:t.y,value:t.value,dataKey:l,payload:t.payload,points:o});return e.renderDotItem(i,r)}),f={clipPath:t?"url(#clipPath-".concat(n?"":"dots-").concat(r,")"):null};return s.createElement(za,BP({className:"recharts-line-dots",key:"dots"},f),d)}},{key:"renderCurveStatically",value:function(e,t,n,r){var a=this.props,i=a.type,o=a.layout,l=a.connectNulls;a.ref;var c=LP(a,DP),u=$P($P($P({},Pa(c,!0)),{},{fill:"none",className:"recharts-line-curve",clipPath:t?"url(#clipPath-".concat(n,")"):null,points:e},r),{},{type:i,layout:o,connectNulls:l});return s.createElement(Aj,BP({},u,{pathRef:this.pathRef}))}},{key:"renderCurveWithAnimation",value:function(e,t){var n=this,r=this.props,a=r.points,i=r.strokeDasharray,o=r.isAnimationActive,l=r.animationBegin,c=r.animationDuration,u=r.animationEasing,d=r.animationId,f=r.animateNewValues,p=r.width,h=r.height,m=this.state,y=m.prevPoints,x=m.totalLength;return s.createElement(Qw,{begin:l,duration:c,isActive:o,easing:u,from:{t:0},to:{t:1},key:"line-".concat(d),onAnimationEnd:this.handleAnimationEnd,onAnimationStart:this.handleAnimationStart},function(r){var o=r.t;if(y){var s=y.length/a.length,l=a.map(function(e,t){var n=Math.floor(t*s);if(y[n]){var r=y[n],a=ra(r.x,e.x),i=ra(r.y,e.y);return $P($P({},e),{},{x:a(o),y:i(o)})}if(f){var l=ra(2*p,e.x),c=ra(h/2,e.y);return $P($P({},e),{},{x:l(o),y:c(o)})}return $P($P({},e),{},{x:e.x,y:e.y})});return n.renderCurveStatically(l,e,t)}var c,u=ra(0,x)(o);if(i){var d="".concat(i).split(/[,\s]+/gim).map(function(e){return parseFloat(e)});c=n.getStrokeDasharray(u,x,d)}else c=n.generateSimpleStrokeDasharray(x,u);return n.renderCurveStatically(a,e,t,{strokeDasharray:c})})}},{key:"renderCurve",value:function(e,t){var n=this.props,r=n.points,a=n.isAnimationActive,i=this.state,o=i.prevPoints,s=i.totalLength;return a&&r&&r.length&&(!o&&s>0||!kg(o,r))?this.renderCurveWithAnimation(e,t):this.renderCurveStatically(r,e,t)}},{key:"render",value:function(){var e,t=this.props,n=t.hide,r=t.dot,a=t.points,i=t.className,l=t.xAxis,c=t.yAxis,u=t.top,d=t.left,f=t.width,p=t.height,h=t.isAnimationActive,m=t.id;if(n||!a||!a.length)return null;var y=this.state.isAnimationFinished,x=1===a.length,g=o("recharts-line",i),v=l&&l.allowDataOverflow,b=c&&c.allowDataOverflow,j=v||b,w=vr(m)?this.id:m,N=null!==(e=Pa(r,!1))&&void 0!==e?e:{r:3,strokeWidth:2},S=N.r,O=void 0===S?3:S,k=N.strokeWidth,A=void 0===k?2:k,P=(Aa(r)?r:{}).clipDot,E=void 0===P||P,_=2*O+A;return s.createElement(za,{className:g},v||b?s.createElement("defs",null,s.createElement("clipPath",{id:"clipPath-".concat(w)},s.createElement("rect",{x:v?d:d-f/2,y:b?u:u-p/2,width:v?f:2*f,height:b?p:2*p})),!E&&s.createElement("clipPath",{id:"clipPath-dots-".concat(w)},s.createElement("rect",{x:d-_/2,y:u-_/2,width:f+_,height:p+_}))):null,!x&&this.renderCurve(j,w),this.renderErrorBar(j,w),(x||r)&&this.renderDots(j,E,w),(!h||y)&&sj.renderCallByParent(this.props,a))}}])&&qP(t.prototype,n),r&&qP(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,n,r}();XP(YP,"displayName","Line"),XP(YP,"defaultProps",{xAxisId:0,yAxisId:0,connectNulls:!1,activeDot:!0,dot:!0,legendType:"line",stroke:"#3182bd",strokeWidth:1,fill:"#fff",points:[],isAnimationActive:!ef.isSsr,animateNewValues:!0,animationBegin:0,animationDuration:1500,animationEasing:"ease",hide:!1,label:!1}),XP(YP,"getComposedData",function(e){var t=e.props,n=e.xAxis,r=e.yAxis,a=e.xAxisTicks,i=e.yAxisTicks,o=e.dataKey,s=e.bandSize,l=e.displayedData,c=e.offset,u=t.layout;return $P({points:l.map(function(e,t){var l=Zv(e,o);return"horizontal"===u?{x:hb({axis:n,ticks:a,bandSize:s,entry:e,index:t}),y:vr(l)?null:r.scale(l),value:l,payload:e}:{x:vr(l)?null:n.scale(l),y:hb({axis:r,ticks:i,bandSize:s,entry:e,index:t}),value:l,payload:e}}),layout:u},c)});var JP,ZP=["layout","type","stroke","connectNulls","isRange","ref"],QP=["key"];function eE(e){return(eE="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function tE(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)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}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}function nE(){return nE=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},nE.apply(this,arguments)}function rE(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function aE(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?rE(Object(n),!0).forEach(function(t){uE(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):rE(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function iE(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,dE(r.key),r)}}function oE(e,t,n){return t=lE(t),function(e,t){if(t&&("object"===eE(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,sE()?Reflect.construct(t,n||[],lE(e).constructor):t.apply(e,n))}function sE(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(sE=function(){return!!e})()}function lE(e){return(lE=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function cE(e,t){return(cE=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function uE(e,t,n){return(t=dE(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function dE(e){var t=function(e,t){if("object"!=eE(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=eE(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==eE(t)?t:t+""}var fE=function(){function e(){var t;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e);for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return uE(t=oE(this,e,[].concat(r)),"state",{isAnimationFinished:!0}),uE(t,"id",ea("recharts-area-")),uE(t,"handleAnimationEnd",function(){var e=t.props.onAnimationEnd;t.setState({isAnimationFinished:!0}),kt(e)&&e()}),uE(t,"handleAnimationStart",function(){var e=t.props.onAnimationStart;t.setState({isAnimationFinished:!1}),kt(e)&&e()}),t}return function(e,t){if("function"!=typeof t&&null!==t)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&&cE(e,t)}(e,i.PureComponent),t=e,r=[{key:"getDerivedStateFromProps",value:function(e,t){return e.animationId!==t.prevAnimationId?{prevAnimationId:e.animationId,curPoints:e.points,curBaseLine:e.baseLine,prevPoints:t.curPoints,prevBaseLine:t.curBaseLine}:e.points!==t.curPoints||e.baseLine!==t.curBaseLine?{curPoints:e.points,curBaseLine:e.baseLine}:null}}],(n=[{key:"renderDots",value:function(t,n,r){var a=this.props.isAnimationActive,i=this.state.isAnimationFinished;if(a&&!i)return null;var o=this.props,l=o.dot,c=o.points,u=o.dataKey,d=Pa(this.props,!1),f=Pa(l,!0),p=c.map(function(t,n){var r=aE(aE(aE({key:"dot-".concat(n),r:3},d),f),{},{index:n,cx:t.x,cy:t.y,dataKey:u,value:t.value,payload:t.payload,points:c});return e.renderDotItem(l,r)}),h={clipPath:t?"url(#clipPath-".concat(n?"":"dots-").concat(r,")"):null};return s.createElement(za,nE({className:"recharts-area-dots"},h),p)}},{key:"renderHorizontalRect",value:function(e){var t=this.props,n=t.baseLine,r=t.points,a=t.strokeWidth,i=r[0].x,o=r[r.length-1].x,l=e*Math.abs(i-o),c=fg(r.map(function(e){return e.y||0}));return Jr(n)&&"number"==typeof n?c=Math.max(n,c):n&&Array.isArray(n)&&n.length&&(c=Math.max(fg(n.map(function(e){return e.y||0})),c)),Jr(c)?s.createElement("rect",{x:i<o?i:i-l,y:0,width:l,height:Math.floor(c+(a?parseInt("".concat(a),10):1))}):null}},{key:"renderVerticalRect",value:function(e){var t=this.props,n=t.baseLine,r=t.points,a=t.strokeWidth,i=r[0].y,o=r[r.length-1].y,l=e*Math.abs(i-o),c=fg(r.map(function(e){return e.x||0}));return Jr(n)&&"number"==typeof n?c=Math.max(n,c):n&&Array.isArray(n)&&n.length&&(c=Math.max(fg(n.map(function(e){return e.x||0})),c)),Jr(c)?s.createElement("rect",{x:0,y:i<o?i:i-l,width:c+(a?parseInt("".concat(a),10):1),height:Math.floor(l)}):null}},{key:"renderClipRect",value:function(e){return"vertical"===this.props.layout?this.renderVerticalRect(e):this.renderHorizontalRect(e)}},{key:"renderAreaStatically",value:function(e,t,n,r){var a=this.props,i=a.layout,o=a.type,l=a.stroke,c=a.connectNulls,u=a.isRange;a.ref;var d=tE(a,ZP);return s.createElement(za,{clipPath:n?"url(#clipPath-".concat(r,")"):null},s.createElement(Aj,nE({},Pa(d,!0),{points:e,connectNulls:c,type:o,baseLine:t,layout:i,stroke:"none",className:"recharts-area-area"})),"none"!==l&&s.createElement(Aj,nE({},Pa(this.props,!1),{className:"recharts-area-curve",layout:i,type:o,connectNulls:c,fill:"none",points:e})),"none"!==l&&u&&s.createElement(Aj,nE({},Pa(this.props,!1),{className:"recharts-area-curve",layout:i,type:o,connectNulls:c,fill:"none",points:t})))}},{key:"renderAreaWithAnimation",value:function(e,t){var n=this,r=this.props,a=r.points,i=r.baseLine,o=r.isAnimationActive,l=r.animationBegin,c=r.animationDuration,u=r.animationEasing,d=r.animationId,f=this.state,p=f.prevPoints,h=f.prevBaseLine;return s.createElement(Qw,{begin:l,duration:c,isActive:o,easing:u,from:{t:0},to:{t:1},key:"area-".concat(d),onAnimationEnd:this.handleAnimationEnd,onAnimationStart:this.handleAnimationStart},function(r){var o=r.t;if(p){var l,c=p.length/a.length,u=a.map(function(e,t){var n=Math.floor(t*c);if(p[n]){var r=p[n],a=ra(r.x,e.x),i=ra(r.y,e.y);return aE(aE({},e),{},{x:a(o),y:i(o)})}return e});return l=Jr(i)&&"number"==typeof i?ra(h,i)(o):vr(i)||Xr(i)?ra(h,0)(o):i.map(function(e,t){var n=Math.floor(t*c);if(h[n]){var r=h[n],a=ra(r.x,e.x),i=ra(r.y,e.y);return aE(aE({},e),{},{x:a(o),y:i(o)})}return e}),n.renderAreaStatically(u,l,e,t)}return s.createElement(za,null,s.createElement("defs",null,s.createElement("clipPath",{id:"animationClipPath-".concat(t)},n.renderClipRect(o))),s.createElement(za,{clipPath:"url(#animationClipPath-".concat(t,")")},n.renderAreaStatically(a,i,e,t)))})}},{key:"renderArea",value:function(e,t){var n=this.props,r=n.points,a=n.baseLine,i=n.isAnimationActive,o=this.state,s=o.prevPoints,l=o.prevBaseLine,c=o.totalLength;return i&&r&&r.length&&(!s&&c>0||!kg(s,r)||!kg(l,a))?this.renderAreaWithAnimation(e,t):this.renderAreaStatically(r,a,e,t)}},{key:"render",value:function(){var e,t=this.props,n=t.hide,r=t.dot,a=t.points,i=t.className,l=t.top,c=t.left,u=t.xAxis,d=t.yAxis,f=t.width,p=t.height,h=t.isAnimationActive,m=t.id;if(n||!a||!a.length)return null;var y=this.state.isAnimationFinished,x=1===a.length,g=o("recharts-area",i),v=u&&u.allowDataOverflow,b=d&&d.allowDataOverflow,j=v||b,w=vr(m)?this.id:m,N=null!==(e=Pa(r,!1))&&void 0!==e?e:{r:3,strokeWidth:2},S=N.r,O=void 0===S?3:S,k=N.strokeWidth,A=void 0===k?2:k,P=(Aa(r)?r:{}).clipDot,E=void 0===P||P,_=2*O+A;return s.createElement(za,{className:g},v||b?s.createElement("defs",null,s.createElement("clipPath",{id:"clipPath-".concat(w)},s.createElement("rect",{x:v?c:c-f/2,y:b?l:l-p/2,width:v?f:2*f,height:b?p:2*p})),!E&&s.createElement("clipPath",{id:"clipPath-dots-".concat(w)},s.createElement("rect",{x:c-_/2,y:l-_/2,width:f+_,height:p+_}))):null,x?null:this.renderArea(j,w),(r||x)&&this.renderDots(j,E,w),(!h||y)&&sj.renderCallByParent(this.props,a))}}])&&iE(t.prototype,n),r&&iE(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,n,r}();function pE(e){return(pE="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function hE(e,t,n){return t&&function(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,bE(r.key),r)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function mE(e,t,n){return t=xE(t),function(e,t){if(t&&("object"===pE(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,yE()?Reflect.construct(t,n||[],xE(e).constructor):t.apply(e,n))}function yE(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(yE=function(){return!!e})()}function xE(e){return(xE=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function gE(e,t){return(gE=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function vE(e,t,n){return(t=bE(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function bE(e){var t=function(e,t){if("object"!=pE(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=pE(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==pE(t)?t:t+""}function jE(){return jE=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},jE.apply(this,arguments)}function wE(e){var t=e.xAxisId,n=iA(),r=oA(),a=rA(t);return null==a?null:i.createElement(mP,jE({},a,{className:o("recharts-".concat(a.axisType," ").concat(a.axisType),a.className),viewBox:{x:0,y:0,width:n,height:r},ticksGenerator:function(e){return ib(e,!0)}}))}JP=fE,uE(fE,"displayName","Area"),uE(fE,"defaultProps",{stroke:"#3182bd",fill:"#3182bd",fillOpacity:.6,xAxisId:0,yAxisId:0,legendType:"line",connectNulls:!1,points:[],dot:!1,activeDot:!0,hide:!1,isAnimationActive:!ef.isSsr,animationBegin:0,animationDuration:1500,animationEasing:"ease"}),uE(fE,"getBaseValue",function(e,t,n,r){var a=e.layout,i=e.baseValue,o=t.props.baseValue,s=null!=o?o:i;if(Jr(s)&&"number"==typeof s)return s;var l="horizontal"===a?r:n,c=l.scale.domain();if("number"===l.type){var u=Math.max(c[0],c[1]),d=Math.min(c[0],c[1]);return"dataMin"===s?d:"dataMax"===s||u<0?u:Math.max(Math.min(c[0],c[1]),0)}return"dataMin"===s?c[0]:"dataMax"===s?c[1]:c[0]}),uE(fE,"getComposedData",function(e){var t,n=e.props,r=e.item,a=e.xAxis,i=e.yAxis,o=e.xAxisTicks,s=e.yAxisTicks,l=e.bandSize,c=e.dataKey,u=e.stackedData,d=e.dataStartIndex,f=e.displayedData,p=e.offset,h=n.layout,m=u&&u.length,y=JP.getBaseValue(n,r,a,i),x="horizontal"===h,g=!1,v=f.map(function(e,t){var n;m?n=u[d+t]:(n=Zv(e,c),Array.isArray(n)?g=!0:n=[y,n]);var r=null==n[1]||m&&null==Zv(e,c);return x?{x:hb({axis:a,ticks:o,bandSize:l,entry:e,index:t}),y:r?null:i.scale(n[1]),value:n,payload:e}:{x:r?null:a.scale(n[1]),y:hb({axis:i,ticks:s,bandSize:l,entry:e,index:t}),value:n,payload:e}});return t=m||g?v.map(function(e){var t=Array.isArray(e.value)?e.value[0]:null;return x?{x:e.x,y:null!=t&&null!=e.y?i.scale(t):null}:{x:null!=t?a.scale(t):null,y:e.y}}):x?i.scale(y):a.scale(y),aE({points:v,baseLine:t,layout:h,isRange:g},p)}),uE(fE,"renderDotItem",function(e,t){var n;if(s.isValidElement(e))n=s.cloneElement(e,t);else if(kt(e))n=e(t);else{var r=o("recharts-area-dot","boolean"!=typeof e?e.className:""),a=t.key,i=tE(t,QP);n=s.createElement(bN,nE({},i,{key:a,className:r}))}return n});var NE=function(){function e(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),mE(this,e,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)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&&gE(e,t)}(e,i.Component),hE(e,[{key:"render",value:function(){return i.createElement(wE,this.props)}}])}();function SE(e){return(SE="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function OE(e,t,n){return t&&function(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,CE(r.key),r)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function kE(e,t,n){return t=PE(t),function(e,t){if(t&&("object"===SE(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,AE()?Reflect.construct(t,n||[],PE(e).constructor):t.apply(e,n))}function AE(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(AE=function(){return!!e})()}function PE(e){return(PE=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function EE(e,t){return(EE=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function _E(e,t,n){return(t=CE(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function CE(e){var t=function(e,t){if("object"!=SE(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=SE(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==SE(t)?t:t+""}function ME(){return ME=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},ME.apply(this,arguments)}vE(NE,"displayName","XAxis"),vE(NE,"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});var TE=function(e){var t=e.yAxisId,n=iA(),r=oA(),a=aA(t);return null==a?null:i.createElement(mP,ME({},a,{className:o("recharts-".concat(a.axisType," ").concat(a.axisType),a.className),viewBox:{x:0,y:0,width:n,height:r},ticksGenerator:function(e){return ib(e,!0)}}))},DE=function(){function e(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),kE(this,e,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)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&&EE(e,t)}(e,i.Component),OE(e,[{key:"render",value:function(){return i.createElement(TE,this.props)}}])}();function IE(e){return function(e){if(Array.isArray(e))return RE(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return RE(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return RE(e,t)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function RE(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}_E(DE,"displayName","YAxis"),_E(DE,"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});var LE=function(e,t,n,r,a){var i=Na(e,jA),o=Na(e,TA),s=[].concat(IE(i),IE(o)),l=Na(e,HA),c="".concat(r,"Id"),u=r[0],d=t;if(s.length&&(d=s.reduce(function(e,t){if(t.props[c]===n&&WO(t.props,"extendDomain")&&Jr(t.props[u])){var r=t.props[u];return[Math.min(e[0],r),Math.max(e[1],r)]}return e},d)),l.length){var f="".concat(u,"1"),p="".concat(u,"2");d=l.reduce(function(e,t){if(t.props[c]===n&&WO(t.props,"extendDomain")&&Jr(t.props[f])&&Jr(t.props[p])){var r=t.props[f],a=t.props[p];return[Math.min(e[0],r,a),Math.max(e[1],r,a)]}return e},d)}return a&&a.length&&(d=a.reduce(function(e,t){return Jr(t)?[Math.min(e[0],t),Math.max(e[1],t)]:e},d)),d},BE={exports:{}};!function(e){var t=Object.prototype.hasOwnProperty,n="~";function r(){}function a(e,t,n){this.fn=e,this.context=t,this.once=n||!1}function i(e,t,r,i,o){if("function"!=typeof r)throw new TypeError("The listener must be a function");var s=new a(r,i||e,o),l=n?n+t:t;return e._events[l]?e._events[l].fn?e._events[l]=[e._events[l],s]:e._events[l].push(s):(e._events[l]=s,e._eventsCount++),e}function o(e,t){0===--e._eventsCount?e._events=new r:delete e._events[t]}function s(){this._events=new r,this._eventsCount=0}Object.create&&(r.prototype=Object.create(null),(new r).__proto__||(n=!1)),s.prototype.eventNames=function(){var e,r,a=[];if(0===this._eventsCount)return a;for(r in e=this._events)t.call(e,r)&&a.push(n?r.slice(1):r);return Object.getOwnPropertySymbols?a.concat(Object.getOwnPropertySymbols(e)):a},s.prototype.listeners=function(e){var t=n?n+e:e,r=this._events[t];if(!r)return[];if(r.fn)return[r.fn];for(var a=0,i=r.length,o=new Array(i);a<i;a++)o[a]=r[a].fn;return o},s.prototype.listenerCount=function(e){var t=n?n+e:e,r=this._events[t];return r?r.fn?1:r.length:0},s.prototype.emit=function(e,t,r,a,i,o){var s=n?n+e:e;if(!this._events[s])return!1;var l,c,u=this._events[s],d=arguments.length;if(u.fn){switch(u.once&&this.removeListener(e,u.fn,void 0,!0),d){case 1:return u.fn.call(u.context),!0;case 2:return u.fn.call(u.context,t),!0;case 3:return u.fn.call(u.context,t,r),!0;case 4:return u.fn.call(u.context,t,r,a),!0;case 5:return u.fn.call(u.context,t,r,a,i),!0;case 6:return u.fn.call(u.context,t,r,a,i,o),!0}for(c=1,l=new Array(d-1);c<d;c++)l[c-1]=arguments[c];u.fn.apply(u.context,l)}else{var f,p=u.length;for(c=0;c<p;c++)switch(u[c].once&&this.removeListener(e,u[c].fn,void 0,!0),d){case 1:u[c].fn.call(u[c].context);break;case 2:u[c].fn.call(u[c].context,t);break;case 3:u[c].fn.call(u[c].context,t,r);break;case 4:u[c].fn.call(u[c].context,t,r,a);break;default:if(!l)for(f=1,l=new Array(d-1);f<d;f++)l[f-1]=arguments[f];u[c].fn.apply(u[c].context,l)}}return!0},s.prototype.on=function(e,t,n){return i(this,e,t,n,!1)},s.prototype.once=function(e,t,n){return i(this,e,t,n,!0)},s.prototype.removeListener=function(e,t,r,a){var i=n?n+e:e;if(!this._events[i])return this;if(!t)return o(this,i),this;var s=this._events[i];if(s.fn)s.fn!==t||a&&!s.once||r&&s.context!==r||o(this,i);else{for(var l=0,c=[],u=s.length;l<u;l++)(s[l].fn!==t||a&&!s[l].once||r&&s[l].context!==r)&&c.push(s[l]);c.length?this._events[i]=1===c.length?c[0]:c:o(this,i)}return this},s.prototype.removeAllListeners=function(e){var t;return e?(t=n?n+e:e,this._events[t]&&o(this,t)):(this._events=new r,this._eventsCount=0),this},s.prototype.off=s.prototype.removeListener,s.prototype.addListener=s.prototype.on,s.prefixed=n,s.EventEmitter=s,e.exports=s}(BE);var zE=new(a(BE.exports)),$E="recharts.syncMouseEvents";function FE(e){return(FE="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function UE(e,t,n){return t&&function(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,WE(r.key),r)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function qE(e,t,n){return(t=WE(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function WE(e){var t=function(e,t){if("object"!=FE(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t);if("object"!=FE(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e,"string");return"symbol"==FE(t)?t:t+""}var HE=function(){return UE(function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),qE(this,"activeIndex",0),qE(this,"coordinateList",[]),qE(this,"layout","horizontal")},[{key:"setDetails",value:function(e){var t,n=e.coordinateList,r=void 0===n?null:n,a=e.container,i=void 0===a?null:a,o=e.layout,s=void 0===o?null:o,l=e.offset,c=void 0===l?null:l,u=e.mouseHandlerCallback,d=void 0===u?null:u;this.coordinateList=null!==(t=null!=r?r:this.coordinateList)&&void 0!==t?t:[],this.container=null!=i?i:this.container,this.layout=null!=s?s:this.layout,this.offset=null!=c?c:this.offset,this.mouseHandlerCallback=null!=d?d: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(e){if(0!==this.coordinateList.length)switch(e.key){case"ArrowRight":if("horizontal"!==this.layout)return;this.activeIndex=Math.min(this.activeIndex+1,this.coordinateList.length-1),this.spoofMouse();break;case"ArrowLeft":if("horizontal"!==this.layout)return;this.activeIndex=Math.max(this.activeIndex-1,0),this.spoofMouse()}}},{key:"setIndex",value:function(e){this.activeIndex=e}},{key:"spoofMouse",value:function(){var e,t;if("horizontal"===this.layout&&0!==this.coordinateList.length){var n=this.container.getBoundingClientRect(),r=n.x,a=n.y,i=n.height,o=this.coordinateList[this.activeIndex].coordinate,s=(null===(e=window)||void 0===e?void 0:e.scrollX)||0,l=(null===(t=window)||void 0===t?void 0:t.scrollY)||0,c=r+o+s,u=a+this.offset.top+i/2+l;this.mouseHandlerCallback({pageX:c,pageY:u})}}}])}();function VE(e){var t=e.cx,n=e.cy,r=e.radius,a=e.startAngle,i=e.endAngle;return{points:[Cb(t,n,r,a),Cb(t,n,r,i)],cx:t,cy:n,radius:r,startAngle:a,endAngle:i}}function KE(e,t,n){var r,a,i,o;if("horizontal"===e)i=r=t.x,a=n.top,o=n.top+n.height;else if("vertical"===e)o=a=t.y,r=n.left,i=n.left+n.width;else if(null!=t.cx&&null!=t.cy){if("centric"!==e)return VE(t);var s=t.cx,l=t.cy,c=t.innerRadius,u=t.outerRadius,d=t.angle,f=Cb(s,l,c,d),p=Cb(s,l,u,d);r=f.x,a=f.y,i=p.x,o=p.y}return[{x:r,y:a},{x:i,y:o}]}function XE(e){return(XE="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function GE(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function YE(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?GE(Object(n),!0).forEach(function(t){JE(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):GE(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function JE(e,t,n){var r;return r=function(e,t){if("object"!=XE(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=XE(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(t,"string"),(t="symbol"==XE(r)?r:r+"")in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ZE(e){var t,n,r,a=e.element,s=e.tooltipEventType,l=e.isActive,c=e.activeCoordinate,u=e.activePayload,d=e.offset,f=e.activeTooltipIndex,p=e.tooltipAxisBandSize,h=e.layout,m=e.chartName,y=null!==(t=a.props.cursor)&&void 0!==t?t:null===(n=a.type.defaultProps)||void 0===n?void 0:n.cursor;if(!a||!y||!l||!c||"ScatterChart"!==m&&"axis"!==s)return null;var x=Aj;if("ScatterChart"===m)r=c,x=PN;else if("BarChart"===m)r=function(e,t,n,r){var a=r/2;return{stroke:"none",fill:"#ccc",x:"horizontal"===e?t.x-a:n.left+.5,y:"horizontal"===e?n.top+.5:t.y-a,width:"horizontal"===e?r:n.width-1,height:"horizontal"===e?n.height-1:r}}(h,c,d,p),x=uN;else if("radial"===h){var g=VE(c),v=g.cx,b=g.cy,j=g.radius;r={cx:v,cy:b,startAngle:g.startAngle,endAngle:g.endAngle,innerRadius:j,outerRadius:j},x=yj}else r={points:KE(h,c,d)},x=Aj;var w=YE(YE(YE(YE({stroke:"#ccc",pointerEvents:"none"},d),r),Pa(y,!1)),{},{payload:u,payloadIndex:f,className:o("recharts-tooltip-cursor",y.className)});return i.isValidElement(y)?i.cloneElement(y,w):i.createElement(x,w)}var QE=["item"],e_=["children","className","width","height","style","compact","title","desc"];function t_(e){return(t_="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function n_(){return n_=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},n_.apply(this,arguments)}function r_(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,i,o,s=[],l=!0,c=!1;try{if(i=(n=n.call(e)).next,0===t);else for(;!(l=(r=i.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(u){c=!0,a=u}finally{try{if(!l&&null!=n.return&&(o=n.return(),Object(o)!==o))return}finally{if(c)throw a}}return s}}(e,t)||d_(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function a_(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)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}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}function i_(e,t,n){return t&&function(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,y_(r.key),r)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function o_(e,t,n){return t=l_(t),function(e,t){if(t&&("object"===t_(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,s_()?Reflect.construct(t,n||[],l_(e).constructor):t.apply(e,n))}function s_(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(s_=function(){return!!e})()}function l_(e){return(l_=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function c_(e,t){return(c_=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function u_(e){return function(e){if(Array.isArray(e))return f_(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||d_(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function d_(e,t){if(e){if("string"==typeof e)return f_(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?f_(e,t):void 0}}function f_(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function p_(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function h_(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};
vendor: 33,962 bytes, line 13
13t%2?p_(Object(n),!0).forEach(function(t){m_(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):p_(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function m_(e,t,n){return(t=y_(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function y_(e){var t=function(e,t){if("object"!=t_(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=t_(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==t_(t)?t:t+""}var x_={xAxis:["bottom","top"],yAxis:["left","right"]},g_={width:"100%",height:"100%"},v_={x:0,y:0};function b_(e){return e}var j_=function(e,t){var n=t.graphicalItems,r=t.dataStartIndex,a=t.dataEndIndex,i=(null!=n?n:[]).reduce(function(e,t){var n=t.props.data;return n&&n.length?[].concat(u_(e),u_(n)):e},[]);return i.length>0?i:e&&e.length&&Jr(r)&&Jr(a)?e.slice(r,a+1):[]};function w_(e){return"number"===e?[0,"auto"]:void 0}var N_=function(e,t,n,r){var a=e.graphicalItems,i=e.tooltipAxis,o=j_(t,e);return n<0||!a||!a.length||n>=o.length?null:a.reduce(function(a,s){var l,c,u=null!==(l=s.props.data)&&void 0!==l?l:t;(u&&e.dataStartIndex+e.dataEndIndex!==0&&e.dataEndIndex-e.dataStartIndex>=n&&(u=u.slice(e.dataStartIndex,e.dataEndIndex+1)),i.dataKey&&!i.allowDuplicatedCategory)?c=aa(void 0===u?o:u,i.dataKey,r):c=u&&u[n]||o[n];return c?[].concat(u_(a),[wb(s,c)]):a},[])},S_=function(e,t,n,r){var a=r||{x:e.chartX,y:e.chartY},i=function(e,t){return"horizontal"===t?e.x:"vertical"===t?e.y:"centric"===t?e.angle:e.radius}(a,n),o=e.orderedTooltipTicks,s=e.tooltipAxis,l=e.tooltipTicks,c=function(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],r=arguments.length>2?arguments[2]:void 0,a=arguments.length>3?arguments[3]:void 0,i=-1,o=null!==(t=null==n?void 0:n.length)&&void 0!==t?t:0;if(o<=1)return 0;if(a&&"angleAxis"===a.axisType&&Math.abs(Math.abs(a.range[1]-a.range[0])-360)<=1e-6)for(var s=a.range,l=0;l<o;l++){var c=l>0?r[l-1].coordinate:r[o-1].coordinate,u=r[l].coordinate,d=l>=o-1?r[0].coordinate:r[l+1].coordinate,f=void 0;if(Gr(u-c)!==Gr(d-u)){var p=[];if(Gr(d-u)===Gr(s[1]-s[0])){f=d;var h=u+s[1]-s[0];p[0]=Math.min(h,(h+c)/2),p[1]=Math.max(h,(h+c)/2)}else{f=c;var m=d+s[1]-s[0];p[0]=Math.min(u,(m+u)/2),p[1]=Math.max(u,(m+u)/2)}var y=[Math.min(u,(f+u)/2),Math.max(u,(f+u)/2)];if(e>y[0]&&e<=y[1]||e>=p[0]&&e<=p[1]){i=r[l].index;break}}else{var x=Math.min(c,d),g=Math.max(c,d);if(e>(x+u)/2&&e<=(g+u)/2){i=r[l].index;break}}}else for(var v=0;v<o;v++)if(0===v&&e<=(n[v].coordinate+n[v+1].coordinate)/2||v>0&&v<o-1&&e>(n[v].coordinate+n[v-1].coordinate)/2&&e<=(n[v].coordinate+n[v+1].coordinate)/2||v===o-1&&e>(n[v].coordinate+n[v-1].coordinate)/2){i=n[v].index;break}return i}(i,o,l,s);if(c>=0&&l){var u=l[c]&&l[c].value,d=N_(e,t,c,u),f=function(e,t,n,r){var a=t.find(function(e){return e&&e.index===n});if(a){if("horizontal"===e)return{x:a.coordinate,y:r.y};if("vertical"===e)return{x:r.x,y:a.coordinate};if("centric"===e){var i=a.coordinate,o=r.radius;return h_(h_(h_({},r),Cb(r.cx,r.cy,o,i)),{},{angle:i,radius:o})}var s=a.coordinate,l=r.angle;return h_(h_(h_({},r),Cb(r.cx,r.cy,s,l)),{},{angle:l,radius:s})}return v_}(n,o,c,a);return{activeTooltipIndex:c,activeLabel:u,activePayload:d,activeCoordinate:f}}return null},O_=function(e,t){var n=t.axes,r=t.graphicalItems,a=t.axisType,i=t.axisIdKey,o=t.stackGroups,s=t.dataStartIndex,l=t.dataEndIndex,c=e.layout,u=e.children,d=e.stackOffset,f=rb(c,a);return n.reduce(function(t,n){var p,h=void 0!==n.type.defaultProps?h_(h_({},n.type.defaultProps),n.props):n.props,m=h.type,y=h.dataKey,x=h.allowDataOverflow,g=h.allowDuplicatedCategory,v=h.scale,b=h.ticks,j=h.includeHidden,w=h[i];if(t[w])return t;var N,S,O,k=j_(e.data,{graphicalItems:r.filter(function(e){var t;return(i in e.props?e.props[i]:null===(t=e.type.defaultProps)||void 0===t?void 0:t[i])===w}),dataStartIndex:s,dataEndIndex:l}),A=k.length;(function(e,t,n){if("number"===n&&!0===t&&Array.isArray(e)){var r=null==e?void 0:e[0],a=null==e?void 0:e[1];if(r&&a&&Jr(r)&&Jr(a))return!0}return!1})(h.domain,x,m)&&(N=vb(h.domain,null,x),!f||"number"!==m&&"auto"===v||(O=Qv(k,y,"category")));var P=w_(m);if(!N||0===N.length){var E,_=null!==(E=h.domain)&&void 0!==E?E:P;if(y){if(N=Qv(k,y,m),"category"===m&&f){var C=function(e){if(!Array.isArray(e))return!1;for(var t=e.length,n={},r=0;r<t;r++){if(n[e[r]])return!0;n[e[r]]=!0}return!1}(N);g&&C?(S=N,N=gO(0,A)):g||(N=jb(_,N,n).reduce(function(e,t){return e.indexOf(t)>=0?e:[].concat(u_(e),[t])},[]))}else if("category"===m)N=g?N.filter(function(e){return""!==e&&!vr(e)}):jb(_,N,n).reduce(function(e,t){return e.indexOf(t)>=0||""===t||vr(t)?e:[].concat(u_(e),[t])},[]);else if("number"===m){var M=function(e,t,n,r,a){var i=t.map(function(t){return tb(e,t,n,a,r)}).filter(function(e){return!vr(e)});return i&&i.length?i.reduce(function(e,t){return[Math.min(e[0],t[0]),Math.max(e[1],t[1])]},[1/0,-1/0]):null}(k,r.filter(function(e){var t,n,r=i in e.props?e.props[i]:null===(t=e.type.defaultProps)||void 0===t?void 0:t[i],a="hide"in e.props?e.props.hide:null===(n=e.type.defaultProps)||void 0===n?void 0:n.hide;return r===w&&(j||!a)}),y,a,c);M&&(N=M)}!f||"number"!==m&&"auto"===v||(O=Qv(k,y,"category"))}else N=f?gO(0,A):o&&o[w]&&o[w].hasStack&&"number"===m?"expand"===d?[0,1]:yb(o[w].stackGroups,s,l):nb(k,r.filter(function(e){var t=i in e.props?e.props[i]:e.type.defaultProps[i],n="hide"in e.props?e.props.hide:e.type.defaultProps.hide;return t===w&&(j||!n)}),m,c,!0);if("number"===m)N=LE(u,N,w,a,b),_&&(N=vb(_,N,x));else if("category"===m&&_){var T=_;N.every(function(e){return T.indexOf(e)>=0})&&(N=T)}}return h_(h_({},t),{},m_({},w,h_(h_({},h),{},{axisType:a,domain:N,categoricalDomain:O,duplicateDomain:S,originalDomain:null!==(p=h.domain)&&void 0!==p?p:P,isCategorical:f,layout:c})))},{})},k_=function(e,t){var n=t.axisType,r=void 0===n?"xAxis":n,a=t.AxisComp,i=t.graphicalItems,o=t.stackGroups,s=t.dataStartIndex,l=t.dataEndIndex,c=e.children,u="".concat(r,"Id"),d=Na(c,a),f={};return d&&d.length?f=O_(e,{axes:d,graphicalItems:i,axisType:r,axisIdKey:u,stackGroups:o,dataStartIndex:s,dataEndIndex:l}):i&&i.length&&(f=function(e,t){var n=t.graphicalItems,r=t.Axis,a=t.axisType,i=t.axisIdKey,o=t.stackGroups,s=t.dataStartIndex,l=t.dataEndIndex,c=e.layout,u=e.children,d=j_(e.data,{graphicalItems:n,dataStartIndex:s,dataEndIndex:l}),f=d.length,p=rb(c,a),h=-1;return n.reduce(function(e,t){var m,y=(void 0!==t.type.defaultProps?h_(h_({},t.type.defaultProps),t.props):t.props)[i],x=w_("number");return e[y]?e:(h++,p?m=gO(0,f):o&&o[y]&&o[y].hasStack?(m=yb(o[y].stackGroups,s,l),m=LE(u,m,y,a)):(m=vb(x,nb(d,n.filter(function(e){var t,n,r=i in e.props?e.props[i]:null===(t=e.type.defaultProps)||void 0===t?void 0:t[i],a="hide"in e.props?e.props.hide:null===(n=e.type.defaultProps)||void 0===n?void 0:n.hide;return r===y&&!a}),"number",c),r.defaultProps.allowDataOverflow),m=LE(u,m,y,a)),h_(h_({},e),{},m_({},y,h_(h_({axisType:a},r.defaultProps),{},{hide:!0,orientation:gr(x_,"".concat(a,".").concat(h%2),null),domain:m,originalDomain:x,isCategorical:p,layout:c}))))},{})}(e,{Axis:a,graphicalItems:i,axisType:r,axisIdKey:u,stackGroups:o,dataStartIndex:s,dataEndIndex:l})),f},A_=function(e){var t=e.children,n=e.defaultShowTooltip,r=Sa(t,RO),a=0,i=0;return e.data&&0!==e.data.length&&(i=e.data.length-1),r&&r.props&&(r.props.startIndex>=0&&(a=r.props.startIndex),r.props.endIndex>=0&&(i=r.props.endIndex)),{chartX:0,chartY:0,dataStartIndex:a,dataEndIndex:i,activeTooltipIndex:-1,isTooltipActive:Boolean(n)}},P_=function(e){return"horizontal"===e?{numericAxisName:"yAxis",cateAxisName:"xAxis"}:"vertical"===e?{numericAxisName:"xAxis",cateAxisName:"yAxis"}:"centric"===e?{numericAxisName:"radiusAxis",cateAxisName:"angleAxis"}:{numericAxisName:"angleAxis",cateAxisName:"radiusAxis"}},E_=function(e,t){var n=e.props,r=(e.graphicalItems,e.xAxisMap),a=void 0===r?{}:r,i=e.yAxisMap,o=void 0===i?{}:i,s=n.width,l=n.height,c=n.children,u=n.margin||{},d=Sa(c,RO),f=Sa(c,Mu),p=Object.keys(o).reduce(function(e,t){var n=o[t],r=n.orientation;return n.mirror||n.hide?e:h_(h_({},e),{},m_({},r,e[r]+n.width))},{left:u.left||0,right:u.right||0}),h=Object.keys(a).reduce(function(e,t){var n=a[t],r=n.orientation;return n.mirror||n.hide?e:h_(h_({},e),{},m_({},r,gr(e,"".concat(r))+n.height))},{top:u.top||0,bottom:u.bottom||0}),m=h_(h_({},h),p),y=m.bottom;d&&(m.bottom+=d.props.height||RO.defaultProps.height),f&&t&&(m=function(e,t,n,r){var a=n.children,i=n.width,o=n.margin,s=i-(o.left||0)-(o.right||0),l=Hv({children:a,legendWidth:s});if(l){var c=r||{},u=c.width,d=c.height,f=l.align,p=l.verticalAlign,h=l.layout;if(("vertical"===h||"horizontal"===h&&"middle"===p)&&"center"!==f&&Jr(e[f]))return Yv(Yv({},e),{},Jv({},f,e[f]+(u||0)));if(("horizontal"===h||"vertical"===h&&"center"===f)&&"middle"!==p&&Jr(e[p]))return Yv(Yv({},e),{},Jv({},p,e[p]+(d||0)))}return e}(m,0,n,t));var x=s-m.left-m.right,g=l-m.top-m.bottom;return h_(h_({brushBottom:y},m),{},{width:Math.max(x,0),height:Math.max(g,0)})},__=function(e,t){return"xAxis"===t?e[t].width:"yAxis"===t?e[t].height:void 0},C_=function(e){var t=e.chartName,n=e.GraphicalChild,r=e.defaultTooltipEventType,a=void 0===r?"axis":r,l=e.validateTooltipEventTypes,c=void 0===l?["axis"]:l,u=e.axisComponents,d=e.legendContent,f=e.formatAxisMap,p=e.defaultProps,h=function(e,t){var n=t.graphicalItems,r=t.stackGroups,a=t.offset,i=t.updateId,o=t.dataStartIndex,s=t.dataEndIndex,l=e.barSize,c=e.layout,d=e.barGap,f=e.barCategoryGap,p=e.maxBarSize,h=P_(c),m=h.numericAxisName,y=h.cateAxisName,x=function(e){return!(!e||!e.length)&&e.some(function(e){var t=va(e&&e.type);return t&&t.indexOf("Bar")>=0})}(n),g=[];return n.forEach(function(n,h){var v=j_(e.data,{graphicalItems:[n],dataStartIndex:o,dataEndIndex:s}),b=void 0!==n.type.defaultProps?h_(h_({},n.type.defaultProps),n.props):n.props,j=b.dataKey,w=b.maxBarSize,N=b["".concat(m,"Id")],S=b["".concat(y,"Id")],O=u.reduce(function(e,n){var r=t["".concat(n.axisType,"Map")],a=b["".concat(n.axisType,"Id")];r&&r[a]||"zAxis"===n.axisType||kv();var i=r[a];return h_(h_({},e),{},m_(m_({},n.axisType,i),"".concat(n.axisType,"Ticks"),ib(i)))},{}),k=O[y],A=O["".concat(y,"Ticks")],P=r&&r[N]&&r[N].hasStack&&function(e,t){var n,r=(null!==(n=e.type)&&void 0!==n&&n.defaultProps?Yv(Yv({},e.type.defaultProps),e.props):e.props).stackId;if(Zr(r)){var a=t[r];if(a){var i=a.items.indexOf(e);return i>=0?a.stackedData[i]:null}}return null}(n,r[N].stackGroups),E=va(n.type).indexOf("Bar")>=0,_=bb(k,A),C=[],M=x&&function(e){var t=e.barSize,n=e.totalSize,r=e.stackGroups,a=void 0===r?{}:r;if(!a)return{};for(var i={},o=Object.keys(a),s=0,l=o.length;s<l;s++)for(var c=a[o[s]].stackGroups,u=Object.keys(c),d=0,f=u.length;d<f;d++){var p=c[u[d]],h=p.items,m=p.cateAxisId,y=h.filter(function(e){return va(e.type).indexOf("Bar")>=0});if(y&&y.length){var x=y[0].type.defaultProps,g=void 0!==x?Yv(Yv({},x),y[0].props):y[0].props,v=g.barSize,b=g[m];i[b]||(i[b]=[]);var j=vr(v)?t:v;i[b].push({item:y[0],stackList:y.slice(1),barSize:vr(j)?void 0:ta(j,n,0)})}}return i}({barSize:l,stackGroups:r,totalSize:__(O,y)});if(E){var T,D,I=vr(w)?p:w,R=null!==(T=null!==(D=bb(k,A,!0))&&void 0!==D?D:I)&&void 0!==T?T:0;C=function(e){var t=e.barGap,n=e.barCategoryGap,r=e.bandSize,a=e.sizeList,i=void 0===a?[]:a,o=e.maxBarSize,s=i.length;if(s<1)return null;var l,c=ta(t,r,0,!0),u=[];if(i[0].barSize===+i[0].barSize){var d=!1,f=r/s,p=i.reduce(function(e,t){return e+t.barSize||0},0);(p+=(s-1)*c)>=r&&(p-=(s-1)*c,c=0),p>=r&&f>0&&(d=!0,p=s*(f*=.9));var h={offset:((r-p)/2|0)-c,size:0};l=i.reduce(function(e,t){var n={item:t.item,position:{offset:h.offset+h.size+c,size:d?f:t.barSize}},r=[].concat(Kv(e),[n]);return h=r[r.length-1].position,t.stackList&&t.stackList.length&&t.stackList.forEach(function(e){r.push({item:e,position:h})}),r},u)}else{var m=ta(n,r,0,!0);r-2*m-(s-1)*c<=0&&(c=0);var y=(r-2*m-(s-1)*c)/s;y>1&&(y>>=0);var x=o===+o?Math.min(y,o):y;l=i.reduce(function(e,t,n){var r=[].concat(Kv(e),[{item:t.item,position:{offset:m+(y+c)*n+(y-x)/2,size:x}}]);return t.stackList&&t.stackList.length&&t.stackList.forEach(function(e){r.push({item:e,position:r[r.length-1].position})}),r},u)}return l}({barGap:d,barCategoryGap:f,bandSize:R!==_?R:_,sizeList:M[S],maxBarSize:I}),R!==_&&(C=C.map(function(e){return h_(h_({},e),{},{position:h_(h_({},e.position),{},{offset:e.position.offset-R/2})})}))}var L,B,z=n&&n.type&&n.type.getComposedData;z&&g.push({props:h_(h_({},z(h_(h_({},O),{},{displayedData:v,props:e,dataKey:j,item:n,bandSize:_,barPosition:C,offset:a,stackedData:P,layout:c,dataStartIndex:o,dataEndIndex:s}))),{},m_(m_(m_({key:n.key||"item-".concat(h)},m,O[m]),y,O[y]),"animationId",i)),childIndex:(L=n,B=e.children,wa(B).indexOf(L)),item:n})}),g},m=function(e,r){var a=e.props,i=e.dataStartIndex,o=e.dataEndIndex,s=e.updateId;if(!Oa({props:a}))return null;var l=a.children,c=a.layout,d=a.stackOffset,p=a.data,m=a.reverseStackOrder,y=P_(c),x=y.numericAxisName,g=y.cateAxisName,v=Na(l,n),b=function(e,t,n,r,a,i){if(!e)return null;var o=(i?t.reverse():t).reduce(function(e,t){var a,i=null!==(a=t.type)&&void 0!==a&&a.defaultProps?Yv(Yv({},t.type.defaultProps),t.props):t.props,o=i.stackId;if(i.hide)return e;var s=i[n],l=e[s]||{hasStack:!1,stackGroups:{}};if(Zr(o)){var c=l.stackGroups[o]||{numericAxisId:n,cateAxisId:r,items:[]};c.items.push(t),l.hasStack=!0,l.stackGroups[o]=c}else l.stackGroups[ea("_stackId_")]={numericAxisId:n,cateAxisId:r,items:[t]};return Yv(Yv({},e),{},Jv({},s,l))},{});return Object.keys(o).reduce(function(t,i){var s=o[i];return s.hasStack&&(s.stackGroups=Object.keys(s.stackGroups).reduce(function(t,i){var o=s.stackGroups[i];return Yv(Yv({},t),{},Jv({},i,{numericAxisId:n,cateAxisId:r,items:o.items,stackedData:fb(e,o.items,a)}))},{})),Yv(Yv({},t),{},Jv({},i,s))},{})}(p,v,"".concat(x,"Id"),"".concat(g,"Id"),d,m),j=u.reduce(function(e,t){var n="".concat(t.axisType,"Map");return h_(h_({},e),{},m_({},n,k_(a,h_(h_({},t),{},{graphicalItems:v,stackGroups:t.axisType===x&&b,dataStartIndex:i,dataEndIndex:o}))))},{}),w=E_(h_(h_({},j),{},{props:a,graphicalItems:v}),null==r?void 0:r.legendBBox);Object.keys(j).forEach(function(e){j[e]=f(a,j[e],w,e.replace("Map",""),t)});var N,S,O=j["".concat(g,"Map")],k=(N=na(O),{tooltipTicks:S=ib(N,!1,!0),orderedTooltipTicks:Ad(S,function(e){return e.coordinate}),tooltipAxis:N,tooltipAxisBandSize:bb(N,S)}),A=h(a,h_(h_({},j),{},{dataStartIndex:i,dataEndIndex:o,updateId:s,graphicalItems:v,stackGroups:b,offset:w}));return h_(h_({formattedGraphicalItems:A,graphicalItems:v,offset:w,stackGroups:b},k),j)},y=function(){function e(n){var r,a,l;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),m_(l=o_(this,e,[n]),"eventEmitterSymbol",Symbol("rechartsEventEmitter")),m_(l,"accessibilityManager",new HE),m_(l,"handleLegendBBoxUpdate",function(e){if(e){var t=l.state,n=t.dataStartIndex,r=t.dataEndIndex,a=t.updateId;l.setState(h_({legendBBox:e},m({props:l.props,dataStartIndex:n,dataEndIndex:r,updateId:a},h_(h_({},l.state),{},{legendBBox:e}))))}}),m_(l,"handleReceiveSyncEvent",function(e,t,n){if(l.props.syncId===e){if(n===l.eventEmitterSymbol&&"function"!=typeof l.props.syncMethod)return;l.applySyncEvent(t)}}),m_(l,"handleBrushChange",function(e){var t=e.startIndex,n=e.endIndex;if(t!==l.state.dataStartIndex||n!==l.state.dataEndIndex){var r=l.state.updateId;l.setState(function(){return h_({dataStartIndex:t,dataEndIndex:n},m({props:l.props,dataStartIndex:t,dataEndIndex:n,updateId:r},l.state))}),l.triggerSyncEvent({dataStartIndex:t,dataEndIndex:n})}}),m_(l,"handleMouseEnter",function(e){var t=l.getMouseInfo(e);if(t){var n=h_(h_({},t),{},{isTooltipActive:!0});l.setState(n),l.triggerSyncEvent(n);var r=l.props.onMouseEnter;kt(r)&&r(n,e)}}),m_(l,"triggeredAfterMouseMove",function(e){var t=l.getMouseInfo(e),n=t?h_(h_({},t),{},{isTooltipActive:!0}):{isTooltipActive:!1};l.setState(n),l.triggerSyncEvent(n);var r=l.props.onMouseMove;kt(r)&&r(n,e)}),m_(l,"handleItemMouseEnter",function(e){l.setState(function(){return{isTooltipActive:!0,activeItem:e,activePayload:e.tooltipPayload,activeCoordinate:e.tooltipPosition||{x:e.cx,y:e.cy}}})}),m_(l,"handleItemMouseLeave",function(){l.setState(function(){return{isTooltipActive:!1}})}),m_(l,"handleMouseMove",function(e){e.persist(),l.throttleTriggeredAfterMouseMove(e)}),m_(l,"handleMouseLeave",function(e){l.throttleTriggeredAfterMouseMove.cancel();var t={isTooltipActive:!1};l.setState(t),l.triggerSyncEvent(t);var n=l.props.onMouseLeave;kt(n)&&n(t,e)}),m_(l,"handleOuterEvent",function(e){var t,n=function(e){var t=e&&e.type;return t&&ga[t]?ga[t]:null}(e),r=gr(l.props,"".concat(n));n&&kt(r)&&r(null!==(t=/.*touch.*/i.test(n)?l.getMouseInfo(e.changedTouches[0]):l.getMouseInfo(e))&&void 0!==t?t:{},e)}),m_(l,"handleClick",function(e){var t=l.getMouseInfo(e);if(t){var n=h_(h_({},t),{},{isTooltipActive:!0});l.setState(n),l.triggerSyncEvent(n);var r=l.props.onClick;kt(r)&&r(n,e)}}),m_(l,"handleMouseDown",function(e){var t=l.props.onMouseDown;kt(t)&&t(l.getMouseInfo(e),e)}),m_(l,"handleMouseUp",function(e){var t=l.props.onMouseUp;kt(t)&&t(l.getMouseInfo(e),e)}),m_(l,"handleTouchMove",function(e){null!=e.changedTouches&&e.changedTouches.length>0&&l.throttleTriggeredAfterMouseMove(e.changedTouches[0])}),m_(l,"handleTouchStart",function(e){null!=e.changedTouches&&e.changedTouches.length>0&&l.handleMouseDown(e.changedTouches[0])}),m_(l,"handleTouchEnd",function(e){null!=e.changedTouches&&e.changedTouches.length>0&&l.handleMouseUp(e.changedTouches[0])}),m_(l,"handleDoubleClick",function(e){var t=l.props.onDoubleClick;kt(t)&&t(l.getMouseInfo(e),e)}),m_(l,"handleContextMenu",function(e){var t=l.props.onContextMenu;kt(t)&&t(l.getMouseInfo(e),e)}),m_(l,"triggerSyncEvent",function(e){void 0!==l.props.syncId&&zE.emit($E,l.props.syncId,e,l.eventEmitterSymbol)}),m_(l,"applySyncEvent",function(e){var t=l.props,n=t.layout,r=t.syncMethod,a=l.state.updateId,i=e.dataStartIndex,o=e.dataEndIndex;if(void 0!==e.dataStartIndex||void 0!==e.dataEndIndex)l.setState(h_({dataStartIndex:i,dataEndIndex:o},m({props:l.props,dataStartIndex:i,dataEndIndex:o,updateId:a},l.state)));else if(void 0!==e.activeTooltipIndex){var s=e.chartX,c=e.chartY,u=e.activeTooltipIndex,d=l.state,f=d.offset,p=d.tooltipTicks;if(!f)return;if("function"==typeof r)u=r(p,e);else if("value"===r){u=-1;for(var h=0;h<p.length;h++)if(p[h].value===e.activeLabel){u=h;break}}var y=h_(h_({},f),{},{x:f.left,y:f.top}),x=Math.min(s,y.x+y.width),g=Math.min(c,y.y+y.height),v=p[u]&&p[u].value,b=N_(l.state,l.props.data,u),j=p[u]?{x:"horizontal"===n?p[u].coordinate:x,y:"horizontal"===n?g:p[u].coordinate}:v_;l.setState(h_(h_({},e),{},{activeLabel:v,activeCoordinate:j,activePayload:b,activeTooltipIndex:u}))}else l.setState(e)}),m_(l,"renderCursor",function(e){var n,r=l.state,a=r.isTooltipActive,i=r.activeCoordinate,o=r.activePayload,c=r.offset,u=r.activeTooltipIndex,d=r.tooltipAxisBandSize,f=l.getTooltipEventType(),p=null!==(n=e.props.active)&&void 0!==n?n:a,h=l.props.layout,m=e.key||"_recharts-cursor";return s.createElement(ZE,{key:m,activeCoordinate:i,activePayload:o,activeTooltipIndex:u,chartName:t,element:e,isActive:p,layout:h,offset:c,tooltipAxisBandSize:d,tooltipEventType:f})}),m_(l,"renderPolarAxis",function(e,t,n){var r=gr(e,"type.axisType"),a=gr(l.state,"".concat(r,"Map")),s=e.type.defaultProps,c=void 0!==s?h_(h_({},s),e.props):e.props,u=a&&a[c["".concat(r,"Id")]];return i.cloneElement(e,h_(h_({},u),{},{className:o(r,u.className),key:e.key||"".concat(t,"-").concat(n),ticks:ib(u,!0)}))}),m_(l,"renderPolarGrid",function(e){var t=e.props,n=t.radialLines,r=t.polarAngles,a=t.polarRadius,o=l.state,s=o.radiusAxisMap,c=o.angleAxisMap,u=na(s),d=na(c),f=d.cx,p=d.cy,h=d.innerRadius,m=d.outerRadius;return i.cloneElement(e,{polarAngles:Array.isArray(r)?r:ib(d,!0).map(function(e){return e.coordinate}),polarRadius:Array.isArray(a)?a:ib(u,!0).map(function(e){return e.coordinate}),cx:f,cy:p,innerRadius:h,outerRadius:m,key:e.key||"polar-grid",radialLines:n})}),m_(l,"renderLegend",function(){var e=l.state.formattedGraphicalItems,t=l.props,n=t.children,r=t.width,a=t.height,o=l.props.margin||{},s=r-(o.left||0)-(o.right||0),c=Hv({children:n,formattedGraphicalItems:e,legendWidth:s,legendContent:d});if(!c)return null;var u=c.item,f=a_(c,QE);return i.cloneElement(u,h_(h_({},f),{},{chartWidth:r,chartHeight:a,margin:o,onBBoxUpdate:l.handleLegendBBoxUpdate}))}),m_(l,"renderTooltip",function(){var e,t=l.props,n=t.children,r=t.accessibilityLayer,a=Sa(n,pf);if(!a)return null;var o=l.state,s=o.isTooltipActive,c=o.activeCoordinate,u=o.activePayload,d=o.activeLabel,f=o.offset,p=null!==(e=a.props.active)&&void 0!==e?e:s;return i.cloneElement(a,{viewBox:h_(h_({},f),{},{x:f.left,y:f.top}),active:p,label:d,payload:p?u:[],coordinate:c,accessibilityLayer:r})}),m_(l,"renderBrush",function(e){var t=l.props,n=t.margin,r=t.data,a=l.state,o=a.offset,s=a.dataStartIndex,c=a.dataEndIndex,u=a.updateId;return i.cloneElement(e,{key:e.key||"_recharts-brush",onChange:sb(l.handleBrushChange,e.props.onChange),data:r,x:Jr(e.props.x)?e.props.x:o.left,y:Jr(e.props.y)?e.props.y:o.top+o.height+o.brushBottom-(n.bottom||0),width:Jr(e.props.width)?e.props.width:o.width,startIndex:s,endIndex:c,updateId:"brush-".concat(u)})}),m_(l,"renderReferenceElement",function(e,t,n){if(!e)return null;var r=l.clipPathId,a=l.state,o=a.xAxisMap,s=a.yAxisMap,c=a.offset,u=e.type.defaultProps||{},d=e.props,f=d.xAxisId,p=void 0===f?u.xAxisId:f,h=d.yAxisId,m=void 0===h?u.yAxisId:h;return i.cloneElement(e,{key:e.key||"".concat(t,"-").concat(n),xAxis:o[p],yAxis:s[m],viewBox:{x:c.left,y:c.top,width:c.width,height:c.height},clipPathId:r})}),m_(l,"renderActivePoints",function(t){var n=t.item,r=t.activePoint,a=t.basePoint,i=t.childIndex,o=t.isRange,s=[],l=n.props.key,c=void 0!==n.item.type.defaultProps?h_(h_({},n.item.type.defaultProps),n.item.props):n.item.props,u=c.activeDot,d=h_(h_({index:i,dataKey:c.dataKey,cx:r.x,cy:r.y,r:4,fill:eb(n.item),strokeWidth:2,stroke:"#fff",payload:r.payload,value:r.value},Pa(u,!1)),fa(u));return s.push(e.renderActiveDot(u,d,"".concat(l,"-activePoint-").concat(i))),a?s.push(e.renderActiveDot(u,h_(h_({},d),{},{cx:a.x,cy:a.y}),"".concat(l,"-basePoint-").concat(i))):o&&s.push(null),s}),m_(l,"renderGraphicChild",function(e,t,n){var r=l.filterFormatItem(e,t,n);if(!r)return null;var a=l.getTooltipEventType(),o=l.state,s=o.isTooltipActive,c=o.tooltipAxis,u=o.activeTooltipIndex,d=o.activeLabel,f=Sa(l.props.children,pf),p=r.props,h=p.points,m=p.isRange,y=p.baseLine,x=void 0!==r.item.type.defaultProps?h_(h_({},r.item.type.defaultProps),r.item.props):r.item.props,g=x.activeDot,v=x.hide,b=x.activeBar,j=x.activeShape,w=Boolean(!v&&s&&f&&(g||b||j)),N={};"axis"!==a&&f&&"click"===f.props.trigger?N={onClick:sb(l.handleItemMouseEnter,e.props.onClick)}:"axis"!==a&&(N={onMouseLeave:sb(l.handleItemMouseLeave,e.props.onMouseLeave),onMouseEnter:sb(l.handleItemMouseEnter,e.props.onMouseEnter)});var S=i.cloneElement(e,h_(h_({},r.props),N));if(w){if(!(u>=0)){var O,k=(null!==(O=l.getItemByXY(l.state.activeCoordinate))&&void 0!==O?O:{graphicalItem:S}).graphicalItem,A=k.item,P=void 0===A?e:A,E=k.childIndex,_=h_(h_(h_({},r.props),N),{},{activeIndex:E});return[i.cloneElement(P,_),null,null]}var C,M;if(c.dataKey&&!c.allowDuplicatedCategory){var T="function"==typeof c.dataKey?function(e){return"function"==typeof c.dataKey?c.dataKey(e.payload):null}:"payload.".concat(c.dataKey.toString());C=aa(h,T,d),M=m&&y&&aa(y,T,d)}else C=null==h?void 0:h[u],M=m&&y&&y[u];if(j||b){var D=void 0!==e.props.activeIndex?e.props.activeIndex:u;return[i.cloneElement(e,h_(h_(h_({},r.props),N),{},{activeIndex:D})),null,null]}if(!vr(C))return[S].concat(u_(l.renderActivePoints({item:r,activePoint:C,basePoint:M,childIndex:u,isRange:m})))}return m?[S,null,null]:[S,null]}),m_(l,"renderCustomized",function(e,t,n){return i.cloneElement(e,h_(h_({key:"recharts-customized-".concat(n)},l.props),l.state))}),m_(l,"renderMap",{CartesianGrid:{handler:b_,once:!0},ReferenceArea:{handler:l.renderReferenceElement},ReferenceLine:{handler:b_},ReferenceDot:{handler:l.renderReferenceElement},XAxis:{handler:b_},YAxis:{handler:b_},Brush:{handler:l.renderBrush,once:!0},Bar:{handler:l.renderGraphicChild},Line:{handler:l.renderGraphicChild},Area:{handler:l.renderGraphicChild},Radar:{handler:l.renderGraphicChild},RadialBar:{handler:l.renderGraphicChild},Scatter:{handler:l.renderGraphicChild},Pie:{handler:l.renderGraphicChild},Funnel:{handler:l.renderGraphicChild},Tooltip:{handler:l.renderCursor,once:!0},PolarGrid:{handler:l.renderPolarGrid,once:!0},PolarAngleAxis:{handler:l.renderPolarAxis},PolarRadiusAxis:{handler:l.renderPolarAxis},Customized:{handler:l.renderCustomized}}),l.clipPathId="".concat(null!==(r=n.id)&&void 0!==r?r:ea("recharts"),"-clip"),l.throttleTriggeredAfterMouseMove=Tf(l.triggeredAfterMouseMove,null!==(a=n.throttleDelay)&&void 0!==a?a:1e3/60),l.state={},l}return function(e,t){if("function"!=typeof t&&null!==t)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&&c_(e,t)}(e,i.Component),i_(e,[{key:"componentDidMount",value:function(){var e,t;this.addListener(),this.accessibilityManager.setDetails({container:this.container,offset:{left:null!==(e=this.props.margin.left)&&void 0!==e?e:0,top:null!==(t=this.props.margin.top)&&void 0!==t?t:0},coordinateList:this.state.tooltipTicks,mouseHandlerCallback:this.triggeredAfterMouseMove,layout:this.props.layout}),this.displayDefaultTooltip()}},{key:"displayDefaultTooltip",value:function(){var e=this.props,t=e.children,n=e.data,r=e.height,a=e.layout,i=Sa(t,pf);if(i){var o=i.props.defaultIndex;if(!("number"!=typeof o||o<0||o>this.state.tooltipTicks.length-1)){var s=this.state.tooltipTicks[o]&&this.state.tooltipTicks[o].value,l=N_(this.state,n,o,s),c=this.state.tooltipTicks[o].coordinate,u=(this.state.offset.top+r)/2,d="horizontal"===a?{x:c,y:u}:{y:c,x:u},f=this.state.formattedGraphicalItems.find(function(e){return"Scatter"===e.item.type.name});f&&(d=h_(h_({},d),f.props.points[o].tooltipPosition),l=f.props.points[o].tooltipPayload);var p={activeTooltipIndex:o,isTooltipActive:!0,activeLabel:s,activePayload:l,activeCoordinate:d};this.setState(p),this.renderCursor(i),this.accessibilityManager.setIndex(o)}}}},{key:"getSnapshotBeforeUpdate",value:function(e,t){if(!this.props.accessibilityLayer)return null;var n,r;(this.state.tooltipTicks!==t.tooltipTicks&&this.accessibilityManager.setDetails({coordinateList:this.state.tooltipTicks}),this.props.layout!==e.layout&&this.accessibilityManager.setDetails({layout:this.props.layout}),this.props.margin!==e.margin)&&this.accessibilityManager.setDetails({offset:{left:null!==(n=this.props.margin.left)&&void 0!==n?n:0,top:null!==(r=this.props.margin.top)&&void 0!==r?r:0}});return null}},{key:"componentDidUpdate",value:function(e){Ea([Sa(e.children,pf)],[Sa(this.props.children,pf)])||this.displayDefaultTooltip()}},{key:"componentWillUnmount",value:function(){this.removeListener(),this.throttleTriggeredAfterMouseMove.cancel()}},{key:"getTooltipEventType",value:function(){var e=Sa(this.props.children,pf);if(e&&"boolean"==typeof e.props.shared){var t=e.props.shared?"axis":"item";return c.indexOf(t)>=0?t:a}return a}},{key:"getMouseInfo",value:function(e){if(!this.container)return null;var t,n=this.container,r=n.getBoundingClientRect(),a={top:(t=r).top+window.scrollY-document.documentElement.clientTop,left:t.left+window.scrollX-document.documentElement.clientLeft},i={chartX:Math.round(e.pageX-a.left),chartY:Math.round(e.pageY-a.top)},o=r.width/n.offsetWidth||1,s=this.inRange(i.chartX,i.chartY,o);if(!s)return null;var l=this.state,c=l.xAxisMap,u=l.yAxisMap,d=this.getTooltipEventType(),f=S_(this.state,this.props.data,this.props.layout,s);if("axis"!==d&&c&&u){var p=na(c).scale,h=na(u).scale,m=p&&p.invert?p.invert(i.chartX):null,y=h&&h.invert?h.invert(i.chartY):null;return h_(h_({},i),{},{xValue:m,yValue:y},f)}return f?h_(h_({},i),f):null}},{key:"inRange",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,r=this.props.layout,a=e/n,i=t/n;if("horizontal"===r||"vertical"===r){var o=this.state.offset;return a>=o.left&&a<=o.left+o.width&&i>=o.top&&i<=o.top+o.height?{x:a,y:i}:null}var s=this.state,l=s.angleAxisMap,c=s.radiusAxisMap;if(l&&c){var u=na(l);return Ib({x:a,y:i},u)}return null}},{key:"parseEventsOfWrapper",value:function(){var e=this.props.children,t=this.getTooltipEventType(),n=Sa(e,pf),r={};return n&&"axis"===t&&(r="click"===n.props.trigger?{onClick:this.handleClick}:{onMouseEnter:this.handleMouseEnter,onDoubleClick:this.handleDoubleClick,onMouseMove:this.handleMouseMove,onMouseLeave:this.handleMouseLeave,onTouchMove:this.handleTouchMove,onTouchStart:this.handleTouchStart,onTouchEnd:this.handleTouchEnd,onContextMenu:this.handleContextMenu}),h_(h_({},fa(this.props,this.handleOuterEvent)),r)}},{key:"addListener",value:function(){zE.on($E,this.handleReceiveSyncEvent)}},{key:"removeListener",value:function(){zE.removeListener($E,this.handleReceiveSyncEvent)}},{key:"filterFormatItem",value:function(e,t,n){for(var r=this.state.formattedGraphicalItems,a=0,i=r.length;a<i;a++){var o=r[a];if(o.item===e||o.props.key===e.key||t===va(o.item.type)&&n===o.childIndex)return o}return null}},{key:"renderClipPath",value:function(){var e=this.clipPathId,t=this.state.offset,n=t.left,r=t.top,a=t.height,i=t.width;return s.createElement("defs",null,s.createElement("clipPath",{id:e},s.createElement("rect",{x:n,y:r,height:a,width:i})))}},{key:"getXScales",value:function(){var e=this.state.xAxisMap;return e?Object.entries(e).reduce(function(e,t){var n=r_(t,2),r=n[0],a=n[1];return h_(h_({},e),{},m_({},r,a.scale))},{}):null}},{key:"getYScales",value:function(){var e=this.state.yAxisMap;return e?Object.entries(e).reduce(function(e,t){var n=r_(t,2),r=n[0],a=n[1];return h_(h_({},e),{},m_({},r,a.scale))},{}):null}},{key:"getXScaleByAxisId",value:function(e){var t;return null===(t=this.state.xAxisMap)||void 0===t||null===(t=t[e])||void 0===t?void 0:t.scale}},{key:"getYScaleByAxisId",value:function(e){var t;return null===(t=this.state.yAxisMap)||void 0===t||null===(t=t[e])||void 0===t?void 0:t.scale}},{key:"getItemByXY",value:function(e){var t=this.state,n=t.formattedGraphicalItems,r=t.activeItem;if(n&&n.length)for(var a=0,i=n.length;a<i;a++){var o=n[a],s=o.props,l=o.item,c=void 0!==l.type.defaultProps?h_(h_({},l.type.defaultProps),l.props):l.props,u=va(l.type);if("Bar"===u){var d=(s.data||[]).find(function(t){return lN(e,t)});if(d)return{graphicalItem:o,payload:d}}else if("RadialBar"===u){var f=(s.data||[]).find(function(t){return Ib(e,t)});if(f)return{graphicalItem:o,payload:f}}else if(HS(o,r)||VS(o,r)||KS(o,r)){var p=JS({graphicalItem:o,activeTooltipItem:r,itemData:c.data}),h=void 0===c.activeIndex?p:c.activeIndex;return{graphicalItem:h_(h_({},o),{},{childIndex:h}),payload:KS(o,r)?c.data[p]:o.props.data[p]}}}return null}},{key:"render",value:function(){var e=this;if(!Oa(this))return null;var t,n,r=this.props,a=r.children,i=r.className,l=r.width,c=r.height,u=r.style,d=r.compact,f=r.title,p=r.desc,h=a_(r,e_),m=Pa(h,!1);if(d)return s.createElement(nA,{state:this.state,width:this.props.width,height:this.props.height,clipPathId:this.clipPathId},s.createElement(Ia,n_({},m,{width:l,height:c,title:f,desc:p}),this.renderClipPath(),Ca(a,this.renderMap)));this.props.accessibilityLayer&&(m.tabIndex=null!==(t=this.props.tabIndex)&&void 0!==t?t:0,m.role=null!==(n=this.props.role)&&void 0!==n?n:"application",m.onKeyDown=function(t){e.accessibilityManager.keyboardEvent(t)},m.onFocus=function(){e.accessibilityManager.focus()});var y=this.parseEventsOfWrapper();return s.createElement(nA,{state:this.state,width:this.props.width,height:this.props.height,clipPathId:this.clipPathId},s.createElement("div",n_({className:o("recharts-wrapper",i),style:h_({position:"relative",cursor:"default",width:l,height:c},u)},y,{ref:function(t){e.container=t}}),s.createElement(Ia,n_({},m,{width:l,height:c,title:f,desc:p,style:g_}),this.renderClipPath(),Ca(a,this.renderMap)),this.renderLegend(),this.renderTooltip()))}}])}();m_(y,"displayName",t),m_(y,"defaultProps",h_({layout:"horizontal",stackOffset:"none",barCategoryGap:"10%",barGap:4,margin:{top:5,right:5,bottom:5,left:5},reverseStackOrder:!1,syncMethod:"index"},p)),m_(y,"getDerivedStateFromProps",function(e,t){var n=e.dataKey,r=e.data,a=e.children,i=e.width,o=e.height,s=e.layout,l=e.stackOffset,c=e.margin,u=t.dataStartIndex,d=t.dataEndIndex;if(void 0===t.updateId){var f=A_(e);return h_(h_(h_({},f),{},{updateId:0},m(h_(h_({props:e},f),{},{updateId:0}),t)),{},{prevDataKey:n,prevData:r,prevWidth:i,prevHeight:o,prevLayout:s,prevStackOffset:l,prevMargin:c,prevChildren:a})}if(n!==t.prevDataKey||r!==t.prevData||i!==t.prevWidth||o!==t.prevHeight||s!==t.prevLayout||l!==t.prevStackOffset||!oa(c,t.prevMargin)){var p=A_(e),h={chartX:t.chartX,chartY:t.chartY,isTooltipActive:t.isTooltipActive},y=h_(h_({},S_(t,r,s)),{},{updateId:t.updateId+1}),x=h_(h_(h_({},p),h),y);return h_(h_(h_({},x),m(h_({props:e},x),t)),{},{prevDataKey:n,prevData:r,prevWidth:i,prevHeight:o,prevLayout:s,prevStackOffset:l,prevMargin:c,prevChildren:a})}if(!Ea(a,t.prevChildren)){var g,v,b,j,w=Sa(a,RO),N=w&&null!==(g=null===(v=w.props)||void 0===v?void 0:v.startIndex)&&void 0!==g?g:u,S=w&&null!==(b=null===(j=w.props)||void 0===j?void 0:j.endIndex)&&void 0!==b?b:d,O=N!==u||S!==d,k=!vr(r)&&!O?t.updateId:t.updateId+1;return h_(h_({updateId:k},m(h_(h_({props:e},t),{},{updateId:k,dataStartIndex:N,dataEndIndex:S}),t)),{},{prevChildren:a,dataStartIndex:N,dataEndIndex:S})}return null}),m_(y,"renderActiveDot",function(e,t,n){var r;return r=i.isValidElement(e)?i.cloneElement(e,t):kt(e)?e(t):s.createElement(bN,t),s.createElement(za,{className:"recharts-active-dot",ke
13y:n},r)});var x=i.forwardRef(function(e,t){return s.createElement(y,n_({},e,{ref:t}))});return x.displayName=y.displayName,x},M_=C_({chartName:"LineChart",GraphicalChild:YP,axisComponents:[{axisType:"xAxis",AxisComp:NE},{axisType:"yAxis",AxisComp:DE}],formatAxisMap:Dk}),T_=C_({chartName:"BarChart",GraphicalChild:Ak,defaultTooltipEventType:"axis",validateTooltipEventTypes:["axis","item"],axisComponents:[{axisType:"xAxis",AxisComp:NE},{axisType:"yAxis",AxisComp:DE}],formatAxisMap:Dk}),D_=C_({chartName:"PieChart",GraphicalChild:cO,validateTooltipEventTypes:["item"],defaultTooltipEventType:"item",legendContent:"children",axisComponents:[{axisType:"angleAxis",AxisComp:dS},{axisType:"radiusAxis",AxisComp:JN}],formatAxisMap:function(e,t,n,r,a){var i=e.width,o=e.height,s=e.startAngle,l=e.endAngle,c=ta(e.cx,i,i/2),u=ta(e.cy,o,o/2),d=Mb(i,o,n),f=ta(e.innerRadius,d,0),p=ta(e.outerRadius,d,.8*d);return Object.keys(t).reduce(function(e,n){var i,o=t[n],d=o.domain,h=o.reversed;if(vr(o.range))"angleAxis"===r?i=[s,l]:"radiusAxis"===r&&(i=[f,p]),h&&(i=[i[1],i[0]]);else{var m=Ab(i=o.range,2);s=m[0],l=m[1]}var y=lb(o,a),x=y.realScaleType,g=y.scale;g.domain(d).range(i),ub(g);var v=pb(g,Ob(Ob({},o),{},{realScaleType:x})),b=Ob(Ob(Ob({},o),v),{},{range:i,radius:p,realScaleType:x,scale:g,cx:c,cy:u,innerRadius:f,outerRadius:p,startAngle:s,endAngle:l});return Ob(Ob({},e),{},kb({},n,b))},{})},defaultProps:{layout:"centric",startAngle:0,endAngle:360,cx:"50%",cy:"50%",innerRadius:0,outerRadius:"80%"}}),I_=C_({chartName:"AreaChart",GraphicalChild:fE,axisComponents:[{axisType:"xAxis",AxisComp:NE},{axisType:"yAxis",AxisComp:DE}],formatAxisMap:Dk});const R_="#94a3b8",L_="#3b82f6",B_="#8b5cf6",z_=["#3b82f6","#e2e8f0"];function $_({dateRange:e}){const[t,n]=i.useState(null),[r,a]=i.useState(!0),[o,s]=i.useState(null);if(i.useEffect(()=>{var t,r;a(!0),s(null),(t=e.from,r=e.to,Me("/overview",t,r)).then(n).catch(e=>s(e.message)).finally(()=>a(!1))},[e.from.getTime(),e.to.getTime()]),r)return c.jsx(U_,{});if(o)return c.jsx("p",{className:"text-destructive text-sm",children:o});if(!t)return null;const l=[{name:"Free",value:t.subscriptions.free,color:R_},{name:"Premium",value:t.subscriptions.premium,color:L_},{name:"Agentic",value:t.subscriptions.agentic,color:B_}],d=[{name:"Created store",value:t.conversionFunnel.createdStore,color:z_[0]},{name:"No store yet",value:Math.max(0,t.totalUsers-t.conversionFunnel.createdStore),color:z_[1]}],f=t.totalUsers>0?(t.conversionFunnel.createdStore/t.totalUsers*100).toFixed(0):"0";return c.jsxs("div",{className:"space-y-6",children:[c.jsxs("div",{children:[c.jsx("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide mb-2",children:"All Time"}),c.jsxs("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-4",children:[c.jsx(F_,{icon:c.jsx(Ne,{className:"h-4 w-4 text-blue-500"}),title:"Total Users",value:t.totalUsers}),c.jsx(F_,{icon:c.jsx(ee,{className:"h-4 w-4 text-purple-500"}),title:"Total Stores",value:t.totalStores}),c.jsx(F_,{icon:c.jsx(u,{className:"h-4 w-4 text-orange-500"}),title:"Custom Domains",value:t.storesWithDomains,sub:`${(t.storesWithDomains/Math.max(t.totalStores,1)*100).toFixed(0)}% of stores`}),c.jsx(F_,{icon:c.jsx(Ne,{className:"h-4 w-4 text-emerald-500"}),title:"Store Adoption",value:`${f}%`,sub:`${t.conversionFunnel.createdStore} of ${t.totalUsers} users`})]})]}),c.jsxs("div",{children:[c.jsx("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide mb-2",children:"In Selected Period"}),c.jsxs("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-3",children:[c.jsx(F_,{icon:c.jsx(Ne,{className:"h-4 w-4 text-blue-500"}),title:"New Signups",value:t.newUsersInRange}),c.jsx(F_,{icon:c.jsx(ee,{className:"h-4 w-4 text-purple-500"}),title:"New Stores",value:t.newStoresInRange}),c.jsx(F_,{icon:c.jsx(me,{className:"h-4 w-4 text-indigo-500"}),title:"AI Requests",value:t.totalAiRequests.toLocaleString()})]})]}),c.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[c.jsxs(Y,{children:[c.jsx(J,{children:c.jsx(Z,{className:"text-sm font-medium",children:"Subscription Distribution"})}),c.jsxs(Q,{children:[c.jsx("div",{className:"h-52",children:c.jsx($f,{width:"100%",height:"100%",children:c.jsxs(D_,{children:[c.jsx(cO,{data:l,cx:"50%",cy:"50%",innerRadius:55,outerRadius:80,paddingAngle:3,dataKey:"value",label:!1,labelLine:!1,children:l.map(e=>c.jsx(Ff,{fill:e.color},e.name))}),c.jsx(pf,{formatter:e=>[e,"Users"]})]})})}),c.jsx("div",{className:"flex justify-center gap-4 text-xs text-muted-foreground mt-1",children:l.map(e=>c.jsxs("span",{className:"flex items-center gap-1",children:[c.jsx("span",{className:"inline-block w-2 h-2 rounded-full",style:{background:e.color}}),e.name]},e.name))})]})]}),c.jsxs(Y,{children:[c.jsx(J,{children:c.jsx(Z,{className:"text-sm font-medium",children:"Store Adoption"})}),c.jsxs(Q,{children:[c.jsx("div",{className:"h-52",children:c.jsx($f,{width:"100%",height:"100%",children:c.jsxs(D_,{children:[c.jsx(cO,{data:d,cx:"50%",cy:"50%",innerRadius:55,outerRadius:80,paddingAngle:3,dataKey:"value",label:!1,labelLine:!1,children:d.map(e=>c.jsx(Ff,{fill:e.color},e.name))}),c.jsx(pf,{formatter:e=>[e,"Users"]})]})})}),c.jsx("div",{className:"flex justify-center gap-4 text-xs text-muted-foreground mt-1",children:d.map(e=>c.jsxs("span",{className:"flex items-center gap-1",children:[c.jsx("span",{className:"inline-block w-2 h-2 rounded-full",style:{background:e.color}}),e.name]},e.name))})]})]})]})]})}
13function F_({icon:e,title:t,value:n,sub:r}){return c.jsxs(Y,{children:[c.jsxs(J,{className:"flex flex-row items-center justify-between pb-2",children:[c.jsx(Z,{className:"text-xs font-medium text-muted-foreground",children:t}),e]}),c.jsxs(Q,{children:[c.jsx("p",{className:"text-2xl font-bold",children:n}),r&&c.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:r})]})]})}function U_(){return c.jsxs("div",{className:"space-y-6",children:[c.jsx("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-4",children:Array.from({length:4}).map((e,t)=>c.jsx(d,{className:"h-24"},t))}),c.jsx("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-3",children:Array.from({length:3}).map((e,t)=>c.jsx(d,{className:"h-24"},t))}),c.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[c.jsx(d,{className:"h-64"}),c.jsx(d,{className:"h-64"})]})]})}const q_=i.forwardRef(({className:e,...t},n)=>c.jsx("div",{className:"relative w-full overflow-auto",children:c.jsx("table",{ref:n,className:f("w-full caption-bottom text-sm",e),...t})}));q_.displayName="Table";const W_=i.forwardRef(({className:e,...t},n)=>c.jsx("thead",{ref:n,className:f("[&_tr]:border-b",e),...t}));W_.displayName="TableHeader";const H_=i.forwardRef(({className:e,...t},n)=>c.jsx("tbody",{ref:n,className:f("[&_tr:last-child]:border-0",e),...t}));H_.displayName="TableBody";i.forwardRef(({className:e,...t},n)=>c.jsx("tfoot",{ref:n,className:f("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",e),...t})).displayName="TableFooter";const V_=i.forwardRef(({className:e,...t},n)=>c.jsx("tr",{ref:n,className:f("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",e),...t}));V_.displayName="TableRow";const K_=i.forwardRef(({className:e,...t},n)=>c.jsx("th",{ref:n,className:f("h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0",e),...t}));K_.displayName="TableHead";const X_=i.forwardRef(({className:e,...t},n)=>c.jsx("td",{ref:n,className:f("p-4 align-middle [&:has([role=checkbox])]:pr-0",e),...t}));X_.displayName="TableCell";i.forwardRef(({className:e,...t},n)=>c.jsx("caption",{ref:n,className:f("mt-4 text-sm text-muted-foreground",e),...t})).displayName="TableCaption";const G_={"control-tower":"bg-blue-100 text-blue-700","shop-builder":"bg-purple-100 text-purple-700",marketing:"bg-pink-100 text-pink-700",inventory:"bg-green-100 text-green-700",orders:"bg-orange-100 text-orange-700",analytics:"bg-indigo-100 text-indigo-700"};function Y_(e){if(!e)return"bg-gray-100 text-gray-600";const t=Object.keys(G_).find(t=>e.startsWith(t));return t?G_[t]:"bg-gray-100 text-gray-600"}function J_({userId:e,storeId:t,agentChannel:n}){const[r,a]=i.useState([]),[o,s]=i.useState(0),[l,u]=i.useState(!0),[f,p]=i.useState(!1),[h,m]=i.useState(null);return i.useEffect(()=>{u(!0),m(null),a([]),Ve(e,{limit:20,storeId:t,agentChannel:n}).then(e=>{a(e.data),s(e.pagination.total)}).catch(e=>m(e.message)).finally(()=>u(!1))},[e,t,n]),l?c.jsx("div",{className:"space-y-2 mt-2",children:[1,2,3].map(e=>c.jsx(d,{className:"h-16 w-full"},e))}):h?c.jsx("p",{className:"text-xs text-red-600 mt-2",children:h}):0===r.length?c.jsx("p",{className:"text-xs text-muted-foreground mt-2",children:"No chat history."}):c.jsxs("div",{className:"space-y-3 mt-2",children:[c.jsxs("p",{className:"text-xs text-muted-foreground",children:["Showing ",r.length," of ",o," message pairs"]}),r.map(e=>{return c.jsxs("div",{className:"border rounded p-3 space-y-2 text-xs",children:[c.jsxs("div",{className:"flex items-center gap-2 flex-wrap text-muted-foreground",children:[c.jsx("span",{children:V(new Date(e.created_at),"MMM d, yyyy HH:mm")}),e.agent_channel&&c.jsx("span",{className:`px-1.5 py-0.5 rounded font-medium ${Y_(e.agent_channel)}`,children:e.agent_channel}),e.store_id&&c.jsx("span",{className:"font-mono bg-muted px-1 rounded truncate max-w-[160px]",title:e.store_id,children:e.store_id}),c.jsx("span",{className:"ml-auto bg-gray-100 text-gray-600 px-1.5 py-0.5 rounded",children:e.response_type})]}),e.user_prompt&&c.jsxs("div",{className:"bg-muted/60 rounded px-2 py-1.5",children:[c.jsx("span",{className:"text-muted-foreground font-medium mr-1",children:"User:"}),c.jsx("span",{className:"whitespace-pre-wrap break-words",children:e.user_prompt})]}),e.ai_response&&c.jsxs("div",{className:"bg-blue-50/50 rounded px-2 py-1.5",children:[c.jsx("span",{className:"text-blue-700 font-medium block mb-1",children:"AI:"}),c.jsx("div",{className:"prose prose-xs max-w-none [overflow-wrap:anywhere] [&_a]:text-blue-600 [&_a]:underline",dangerouslySetInnerHTML:{__html:(t=e.ai_response,ae.sanitize(t,{USE_PROFILES:{html:!0},ADD_ATTR:["target","rel"]}))}})]})]},e.id);var t}),r.length<o&&c.jsx("button",{onClick:async function(){p(!0);try{const i=await Ve(e,{limit:20,offset:r.length,storeId:t,agentChannel:n});a(e=>[...e,...i.data])}catch(i){m(i instanceof Error?i.message:String(i))}finally{p(!1)}},disabled:f,className:"w-full py-1.5 text-xs text-muted-foreground border rounded hover:bg-muted/50 disabled:opacity-50",children:f?"Loadingâ¦":`Load more (${o-r.length} remaining)`})]})}function Z_(e){return e?V(new Date(e),"MMM d, yyyy"):"â"}function Q_({log:e}){return c.jsx("div",{className:"mt-3 border rounded bg-gray-50 p-3 max-h-64 overflow-y-auto text-xs font-mono space-y-0.5",children:e.map((e,t)=>{return c.jsxs("div",{className:(n=e.status,"ok"===n?"text-green-700":"fail"===n?"text-red-600":"warn"===n?"text-yellow-600":"text-gray-500"),children:["[",e.status.toUpperCase().padEnd(4),"] ",e.step,e.detail?` â ${e.detail}`:""]},t);var n})})}function eC({label:e,confirmText:t,placeholder:n,onConfirm:r,onCancel:a,loading:o,danger:s}){const[l,u]=i.useState(""),d=l===t;return c.jsxs("div",{className:"mt-2 p-3 border border-red-200 rounded bg-red-50 space-y-2",children:[c.jsx("p",{className:"text-sm text-red-800 font-medium",children:e}),c.jsxs("p",{className:"text-xs text-red-700",children:["Type ",c.jsx("code",{className:"bg-red-100 px-1 rounded",children:t})," to confirm:"]}),c.jsx("input",{className:"w-full border border-red-300 rounded px-2 py-1 text-sm font-mono",value:l,onCh
13ange:e=>u(e.target.value),placeholder:n,autoFocus:!0}),c.jsxs("div",{className:"flex gap-2",children:[c.jsx("button",{onClick:r,disabled:!d||o,className:"px-3 py-1 rounded text-sm font-medium text-white transition-colors "+(d&&!o?"bg-red-600 hover:bg-red-700":"bg-red-300 cursor-not-allowed"),children:o?"Deletingâ¦":s?"Delete User + All Data":"Delete Store"}),c.jsx("button",{onClick:a,className:"px-3 py-1 rounded text-sm font-medium border hover:bg-gray-50",children:"Cancel"})]})]})}function tC({store:e,onDeleted:t}){const[n,r]=i.useState(!1),[a,o]=i.useState(!1),[s,l]=i.useState(null),[u,d]=i.useState(null);const f=e.subdomain||e.id;return c.jsxs("div",{className:"border rounded p-3 space-y-2",children:[c.jsxs("div",{className:"flex items-start justify-between gap-2",children:[c.jsxs("div",{className:"min-w-0",children:[c.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[c.jsx("span",{className:"font-medium text-sm",children:e.name||f}),e.store_type&&c.jsx(x,{variant:"outline",className:"text-xs",children:e.store_type}),e.status&&c.jsx("span",{className:"text-xs px-1.5 py-0.5 rounded font-medium "+("active"===e.status?"bg-green-100 text-green-700":"bg-gray-100 text-gray-600"),children:e.status})]}),c.jsxs("div",{className:"text-xs text-muted-foreground mt-0.5 space-x-2 flex items-center flex-wrap gap-y-0.5",children:[c.jsxs("span",{children:["ID: ",c.jsx("code",{className:"bg-muted px-1 rounded",children:e.id})]}),e.subdomain&&c.jsxs("a",{href:`https://${e.subdomain}.stablecommerce.ai`,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-0.5 text-blue-500 hover:underline",onClick:e=>e.stopPropagation(),children:[c.jsx(y,{size:10})," ",e.subdomain]}),e.custom_domain&&c.jsxs("a",{href:`https://${e.custom_domain}`,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-0.5 text-blue-600 hover:underline",onClick:e=>e.stopPropagation(),children:[c.jsx(y,{size:10})," ",e.custom_domain,"entri_purchase"===e.custom_domain_source&&" â ï¸ Entri"]})]}),c.jsxs("div",{className:"text-xs text-muted-foreground mt-0.5 space-x-2",children:[c.jsxs("span",{children:["Created: ",Z_(e.created_at)]}),e.posthog_project_id&&c.jsx("span",{className:"text-green-600",children:"PostHog â"}),e.notifuse_workspace_id&&c.jsx("span",{className:"text-green-600",children:"Notifuse â"}),e.resend_domain_id&&c.jsx("span",{className:"text-green-600",children:"Resend â"})]})]}),!s&&c.jsxs("button",{onClick:()=>r(e=>!e),className:"shrink-0 flex items-center gap-1 px-2 py-1 rounded border border-red-300 text-red-600 text-xs hover:bg-red-50",children:[c.jsx(ce,{size:12})," Delete Store"]})]}),n&&!s&&c.jsx(eC,{label:`Delete store "${e.name||f}" and all its data?`,confirmText:f,placeholder:`Type ${f}`,onConfirm:async function(){o(!0),d(null);try{const a=await(n=e.id,Ke(`/stores/${n}`,{confirm:!0,storeId:n}));l(a.log),r(!1),t(e.id)}catch(a){d(a instanceof Error?a.message:String(a))}finally{o(!1)}var n},onCancel:()=>r(!1),loading:a}),u&&c.jsx("p",{className:"text-xs text-red-600 mt-1",children:u}),s&&c.jsxs(c.Fragment,{children:[c.jsx("p",{className:"text-xs text-green-700 font-medium",children:"Store deleted."}),c.jsx(Q_,{log:s})]})]})}const nC={free:"bg-gray-100 text-gray-700",premium:"bg-blue-100 text-blue-700",agentic:"bg-purple-100 text-purple-700"};function rC({userId:e,currentTier:t,onUpgraded:n}){const[r,a]=i.useState("premium"),[o,s]=i.useState(!1),[l,u]=i.useState(null),[d,f]=i.useState(null);return c.jsxs("div",{className:"border rounded p-3 space-y-2 bg-blue-50/50",children:[c.jsxs("p",{className:"text-xs font-medium text-blue-800 flex items-center gap-1.5",children:[c.jsx(g,{size:12})," Change Subscription Tier"]}),c.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[c.jsxs("span",{className:"text-xs text-muted-foreground",children:["Current: ",c.jsx("span",{className:`inline-block px-1.5 py-0.5 rounded text-xs font-medium ${nC[t||"free"]||nC.free}`,children:t||"free"})]}),c.jsx("span",{className:"text-xs text-muted-foreground",children:"â"}),c.jsxs("select",{value:r,onChange:e=>a(e.target.value),className:"border rounded px-2 py-1 text-xs",disabled:o,children:[c.jsx("option",{value:"free",children:"free"}),c.jsx("option",{value:"premium",children:"premium"}),c.jsx("option",{value:"agentic",children:"agentic"})]}),c.jsx("button",{onClick:async function(){s(!0),f(null);try{const t=await async function(e,t){const n=await Ce(),r=await fetch(`${Ee}/users/${e}/upgrade-tier`,{method:"POST",headers:n,body:JSON.stringify({tier:t})});if(!r.ok){const e=await r.json().catch(()=>({error:r.statusText}));throw new Error(e.error||`Request failed: ${r.status}`)}return r.json()}(e,r);u({tier:t.tier,importQueued:t.importQueued,importReason:t.importReason}),n(t.tier)}catch(t){f(t instanceof Error?t.message:String(t))}finally{s(!1)}},disabled:o||r===(t||"free"),className:"px-3 py-1 rounded bg-blue-600 text-white text-xs font-medium hover:bg-blue-700 disabled:opacity-50",children:o?"Upgradingâ¦":"Apply"})]}),d&&c.jsx("p",{className:"text-xs text-red-600",children:d}),l&&c.jsxs("p",{className:"text-xs text-green-700",children:["â Moved to ",c.jsx("strong",{children:l.tier}),"."," ",l.importQueued?"Post-payment import queued.":"already_complete"===l.importReason?"All products already imported.":"no_pending_import"===l.importReason?"No Etsy shop to import from.":""]})]})}function aC({userId:e}){const[t,n]=i.useState(!1),[r,a]=i.useState(!1),[o,s]=i.useState(null);return c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsxs("button",{onClick:async function(){n(!0),s(null);try{await async function(e,t){const n=await Ce(),r=await fetch(`${Ee}/users/${e}/clear-context`,{method:"POST",headers:n,body:JSON.stringify({channel:t})});if(!r.ok){const e=await r.json().catch(()=>({error:r.statusText}));throw new Error(e.error||`Request failed: ${r.status}`)}}(e),a(!0),setTimeout(()=>a(!1),3e3)}catch(t){s(t instanceof Error?t.message:String(t))}finally{n(!1)}},disabled:t,className:"flex items-center gap-1.5 px-3 py-1.5 rounded border border-orange-400 text-orange-600 text-sm font-medium hover:bg-orange-50 disabled:opacity-50",children:[c.jsx(ye,{size:13})," ",t?"Clearingâ¦":"Clear Context"]}),r&&c.jsx("span",{className:"text-xs text-green-700",children:"â Cleared"}),o&&c.jsx("span",{className:"text-xs text-red-600",children:o})]})}function iC({userId:e,email:t}){const[n,r]=i.useState(!1),[a,o]=i.useState(null),[s,l]=i.useState(!1),[u,d]=i.useState(null);return a?c.jsxs("div",{className:"flex flex-col gap-1 w-full",children:[c.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[c.jsxs("a",{href:a,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1.5 px-3 py-1.5 rounded border border-indigo-400 text-indigo-600 text-sm font-medium hover:bg-indigo-50",children:[c.jsx(ge,{size:13})," Open login link for ",t]}),c.jsxs("button",{onClick:()=>{navigator.clipboard.writeText(a),l(!0),setTimeout(()=>l(!1),2e3)},className:"inline-flex items-center gap-1 px-2 py-1.5 rounded border text-xs hover:bg-gray-50",children:[c.jsx(p,{size:12})," ",s?"Copied":"Copy"]})]}),c.jsx("p",{className:"text-xs text-muted-foreground",children:'Right-click â "Open in incognito window" to log in as this user. Link is single-use.'})]}):c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsxs("button",{onClick:async function(){r(!0),d(null);try{const{actionLink:t}=await async function(e,t){const n=await Ce(),r=await fetch(`${Ee}/users/${e}/impersonate`,{method:"POST",headers:n,body:JSON.stringify({redirectTo:t})});if(!r.ok){const e=await r.json().catch(()=>({error:r.statusText}));throw new Error(e.error||`Request failed: ${r.status}`)}return r.json()}(e,`${window.location.origin}/auth/callback`);o(t)}catch(t){d(t instanceof Error?t.message:String(t))}finally{r(!1)}},disabled:n,className:"flex items-center gap-1.5 px-3 py-1.5 rounded border border-indigo-400 text-indigo-600 text-sm font-medium hover:bg-indigo-50 disabled:opacity-50",children:[c.jsx(ge,{size:13})," ",n?"Generatingâ¦":"Login as user"]}),u&&c.jsx("span",{className:"text-xs text-red-600",children:u})]})}function oC({userId:e}){const[t,n]=i.useState(!1),[r,a]=i.useState(null),[o,s]=i.useState(!1),[l,u]=i.useState(null);const d=null==r?void 0:r.nudge_state,f=d?d.terminal_executed_at?"text-red-600":d.closing_warning_sent_at?"text-yellow-600":"active"===d.status?"text-green-600":"text-gray-500":"";return c.jsxs("div",{className:"border rounded p-3 space-y-2 bg-muted/10",children:[c.jsxs("button",{onClick:async function(){const i=!t;if(n(i),i&&!r){s(!0),u(null);try{a(await async function(e){const t=await Ce(),n=await fetch(`${Ee}/users/${e}/nudges`,{headers:t});if(!n.ok){const e=await n.json().catch(()=>({error:n.statusText}));throw new Error(e.error||`Request failed: ${n.status}`)}return n.json()}(e))}catch(o){u(o instanceof Error?o.message:String(o))}finally{s(!1)}}},className:"flex items-center gap-1.5 text-xs font-medium text-muted-foreground hover:text-foreground w-full text-left",children:[t?c.jsx(h,{size:12}):c.jsx(m,{size:12}),c.jsx(v,{size:12}),"Nudge History",d&&c.jsxs("span",{className:`ml-1 ${f}`,children:["· ",d.nudge_count," sent · ",d.status]})]}),t&&c.jsxs("div",{className:"space-y-2",children:[o&&c.jsx("p",{className:"text-xs text-muted-foreground",children:"Loadingâ¦"}),l&&c.jsx("p",{className:"text-xs text-red-600",children:l}),r&&c.jsxs(c.Fragment,{children:[d?c.jsxs("div",{className:"text-xs text-muted-foreground flex flex-wrap gap-x-3 gap-y-0.5",children:[c.jsxs("span",{children:["Sent: ",c.jsx("strong",{children:d.nudge_count})]}),c.jsxs("span",{children:["Status: ",c.jsx("span",{className:f,children:d.status})]}),d.last_nudge_at&&c.jsxs("span",{children:["Last: ",Z_(d.last_nudge_at)]}),d.closing_warning_sent_at&&c.jsxs("span",{className:"text-yellow-600",children:["Warning sent: ",Z_(d.closing_warning_sent_at)]}),d.terminal_executed_at&&c.jsxs("span",{className:"text-red-600",children:["Terminated: ",Z_(d.terminal_executed_at)]})]}):c.jsx("p",{className:"text-xs text-muted-foreground",children:"No nudges sent yet."}),r.nudge_emails.length>0&&c.jsx("div",{className:"space-y-1 max-h-52 overflow-y-auto",children:r.nudge_emails.map(e=>c.jsxs("div",{className:"flex items-start gap-2 text-xs border rounded px-2 py-1.5 bg-white",children:[c.jsxs("div",{className:"flex-1 min-w-0",children:[c.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[c.jsx("span",{className:"px-1 py-0.5 rounded font-medium "+("ai"===e.nudge_type?"bg-purple-100 text-purple-700":"bg-orange-100 text-orange-700"),
13children:"ai"===e.nudge_type?"AI":"Warning"}),c.jsx("span",{className:"font-medium truncate",children:e.subject||"(no subject)"}),"failed"===e.status&&c.jsx("span",{className:"text-red-600",children:"failed"})]}),e.cta_label&&c.jsxs("div",{className:"text-muted-foreground mt-0.5",children:["CTA: ",e.cta_label]})]}),c.jsx("span",{className:"shrink-0 text-muted-foreground",children:Z_(e.created_at)})]},e.id))})]})]})]})}function sC({user:e}){const[t,n]=i.useState(!1),[r,a]=i.useState(null),[o,s]=i.useState(!1),[l,u]=i.useState([]),[d,f]=i.useState(null),[p,g]=i.useState(!1),[v,b]=i.useState(!1),[j,w]=i.useState(null),[N,S]=i.useState(null),[O,k]=i.useState(!1),[A,P]=i.useState(!1);function E(e){u(t=>t.filter(t=>t.id!==e))}return c.jsxs("div",{className:"border rounded-lg overflow-hidden "+(O?"opacity-50":""),children:[c.jsxs("div",{className:"flex items-center justify-between gap-3 px-4 py-3 bg-card cursor-pointer hover:bg-muted/50 select-none",onClick:async function(){var i;if(O)return;const o=!t;if(n(o),o&&!r){s(!0);try{const t=await async function(e){const t=await Ce(),n=await fetch(`${Ee}/users/${e}`,{headers:t});if(!n.ok){const e=await n.json().catch(()=>({error:n.statusText}));throw new Error(e.error||`Request failed: ${n.status}`)}return n.json()}(e.id);a(t),u(t.stores),f((null==(i=t.subscription)?void 0:i.tier)||"free")}catch(l){S(l instanceof Error?l.message:String(l))}finally{s(!1)}}},children:[c.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[t?c.jsx(h,{size:14,className:"shrink-0"}):c.jsx(m,{size:14,className:"shrink-0"}),c.jsx("span",{className:"font-mono text-sm truncate",children:e.email}),e.name&&c.jsxs("span",{className:"text-muted-foreground text-sm",children:["(",e.name,")"]})]}),c.jsxs("div",{className:"flex items-center gap-3 shrink-0 text-xs text-muted-foreground",children:[c.jsxs("span",{className:"flex items-center gap-1",children:[c.jsx(ee,{size:11})," ",e.storeCount]}),e.storeUrl&&c.jsxs("a",{href:e.storeUrl,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-0.5 text-blue-500 hover:underline",onClick:e=>e.stopPropagation(),children:[c.jsx(y,{size:11})," Store"]}),c.jsx("span",{children:Z_(e.createdAt)}),c.jsx(x,{variant:"outline",className:"text-xs",children:e.provider}),O&&c.jsx("span",{className:"text-red-500 font-medium",children:"Deleted"})]})]}),t&&!O&&c.jsxs("div",{className:"border-t px-4 py-3 space-y-3 bg-muted/20",children:[o&&c.jsx("p",{className:"text-sm text-muted-foreground",children:"Loadingâ¦"}),r&&c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"flex gap-4 text-xs text-muted-foreground flex-wrap",children:[c.jsxs("span",{children:["Last sign-in: ",Z_(r.user.lastSignIn)]}),r.subscription&&c.jsxs("span",{children:["Subscription: ",c.jsx("span",{className:`inline-block px-1.5 py-0.5 rounded font-medium ${nC[d||"free"]||""}`,children:d||"free"}),"active"!==r.subscription.subscription_status&&c.jsxs("span",{className:"text-yellow-600 ml-1",children:["(",r.subscription.subscription_status,")"]})]}),r.challenge&&c.jsxs("span",{children:["Challenge: task ",r.challenge.current_task," / ",r.challenge.pacing_mode]})]}),c.jsx(rC,{userId:e.id,currentTier:d,onUpgraded:e=>f(e)}),l.length>0?c.jsxs("div",{className:"space-y-2",children:[c.jsxs("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide",children:["Stores (",l.length,")"]}),l.map(e=>c.jsx(tC,{store:e,onDeleted:E},e.id))]}):c.jsx("p",{className:"text-sm text-muted-foreground",children:"No stores."}),c.jsxs("div",{className:"border rounded p-3 space-y-2 bg-muted/10",children:[c.jsxs("button",{onClick:()=>P(e=>!e),className:"flex items-center gap-1.5 text-xs font-medium text-muted-foreground hover:text-foreground w-full text-left",children:[A?c.jsx(h,{size:12}):c.jsx(m,{size:12}),c.jsx(ve,{size:12}),"Chat History"]}),A&&c.jsx(J_,{userId:e.id})]}),c.jsx(oC,{userId:e.id}),!j&&c.jsxs("div",{className:"pt-1 flex flex-wrap gap-2 items-start",children:[c.jsx(aC,{userId:e.id}),c.jsx(iC,{userId:e.id,email:e.email}),c.jsxs("button",{onClick:()=>g(e=>!e),className:"flex items-center gap-1.5 px-3 py-1.5 rounded border border-red-400 text-red-600 text-sm font-medium hover:bg-red-50",children:[c.jsx(le,{size:13})," Delete User Completely"]})]}),p&&!j&&c.jsx(eC,{label:`Permanently delete ${e.email} and ALL their data? This cannot be undone.`,confirmText:e.email,placeholder:`Type ${e.email}`,onConfirm:async function(){b(!0),S(null);try{const r=await(t=e.id,Ke(`/users/${t}`,{confirm:!0,userId:t}));w(r.log),g(!1),k(!0),n(!1)}catch(r){S(r instanceof Error?r.message:String(r))}finally{b(!1)}var t},onCancel:()=>g(!1),loading:v,danger:!0}),j&&c.jsxs(c.Fragment,{children:[c.jsx("p",{className:"text-xs text-green-700 font-medium",children:"User deleted."}),c.jsx(Q_,{log:j})]})]}),N&&c.jsx("p",{className:"text-xs text-red-600",children:N})]}),O&&j&&c.jsx("div",{className:"border-t px-4 py-3",children:c.jsx(Q_,{log:j})})]})}function lC(){const[e,t]=i.useState(""),[n,r]=i.useState([]),[a,o]=i.useState(!1),[s,l]=i.useState(!1),[u,d]=i.useState(null);return c.jsxs("div",{className:"space-y-4",children:[c.jsxs(Y,{children:[c.jsx(J,{children:c.jsx(Z,{className:"text-sm font-medium",children:"User Search & Management"})}),c.jsxs(Q,{children:[c.jsxs("form",{onSubmit:async function(t){null==t||t.preventDefault(),o(!0),d(null),l(!1);try{const t=await async function(e){const t=await Ce(),n=await fetch(`${Ee}/users/search?q=${encodeURIComponent(e)}`,{headers:t});if(!n.ok){const e=await n.json().catch(()=>({error:n.statusText}));throw new Error(e.error||`Request failed: ${n.status}`)}return(await n.json()).results}(e);r(t),l(!0)}catch(n){d(n instanceof Error?n.message:String(n))}finally{o(!1)}},className:"flex gap-2",children:[c.jsxs("div",{className:"relative flex-1",children:[c.jsx(oe,{size:14,className:"absolute left-2.5 top-1/2 -translate-y-1/2 text-muted-foreground"}),c.jsx("input",{className:"w-full border rounded px-3 py-2 pl-8 text-sm",placeholder:"Search by email or nameâ¦",value:e,onCh
13ange:e=>t(e.target.value)})]}),c.jsx("button",{type:"submit",disabled:a,className:"px-4 py-2 rounded bg-primary text-primary-foreground text-sm font-medium hover:bg-primary/90 disabled:opacity-50",children:a?"Searchingâ¦":"Search"})]}),u&&c.jsx("p",{className:"text-sm text-red-600 mt-2",children:u})]})]}),s&&c.jsxs(Y,{children:[c.jsx(J,{children:c.jsx(Z,{className:"text-sm font-medium",children:0===n.length?"No users found":`${n.length} user${1===n.length?"":"s"} found`})}),n.length>0&&c.jsx(Q,{className:"space-y-2",children:n.map(e=>c.jsx(sC,{user:e},e.id))})]})]})}function cC({user:e}){const[t,n]=i.useState(!1),r=e.promptCount>1;return c.jsxs(c.Fragment,{children:[c.jsxs(V_,{className:"cursor-pointer hover:bg-muted/50 "+(r?"bg-emerald-500/10":""),onClick:()=>n(e=>!e),children:[c.jsx(X_,{className:"w-8",children:t?c.jsx(h,{size:12}):c.jsx(m,{size:12})}),c.jsx(X_,{className:"text-xs font-mono",children:e.email}),c.jsx(X_,{className:"hidden md:table-cell text-xs",children:e.name||"â"}),c.jsx(X_,{className:"hidden md:table-cell",children:c.jsx(x,{variant:"secondary",className:"text-xs capitalize",children:e.provider})}),c.jsx(X_,{className:"hidden md:table-cell text-xs text-muted-foreground",children:V(new Date(e.createdAt),"MMM d, yyyy")}),c.jsx(X_,{className:"hidden md:table-cell text-xs text-muted-foreground",children:e.lastSignIn?V(new Date(e.lastSignIn),"MMM d, yyyy"):"â"}),c.jsx(X_,{children:r?c.jsxs(x,{className:"text-xs bg-emerald-500/15 text-emerald-600 hover:bg-emerald-500/15",children:[e.promptCount," prompts"]}):c.jsx("span",{className:"text-xs text-muted-foreground",children:e.promptCount})}),c.jsx(X_,{onClick:e=>e.stopPropagation(),children:e.storeUrl?c.jsxs("a",{href:e.storeUrl,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1 text-xs text-blue-500 hover:underline",children:[c.jsx(y,{className:"h-3 w-3"}),"Visit"]}):c.jsx("span",{className:"text-xs text-muted-foreground",children:"â"})})]}),t&&c.jsx(V_,{children:c.jsxs(X_,{colSpan:8,className:"bg-muted/20 px-4 py-3",children:[c.jsx("div",{className:"mb-3",children:c.jsx(iC,{userId:e.id,email:e.email})}),c.jsxs("div",{className:"flex items-center gap-1.5 text-xs font-medium text-muted-foreground mb-2",children:[c.jsx(ve,{size:12})," Chat history for ",e.email]}),c.jsx(J_,{userId:e.id})]})})]})}function uC({user:e}){const[t,n]=i.useState(!1),r=e.promptCount>1;return c.jsxs(c.Fragment,{children:[c.jsxs(V_,{className:"cursor-pointer hover:bg-muted/50 "+(r?"bg-emerald-500/10":""),onClick:()=>n(e=>!e),children:[c.jsx(X_,{className:"w-8",children:t?c.jsx(h,{size:12}):c.jsx(m,{size:12})}),c.jsx(X_,{className:"text-xs font-mono",title:e.email,children:e.email.split("@")[0]}),c.jsx(X_,{className:"text-xs text-muted-foreground whitespace-nowrap",children:V(new Date(e.createdAt),"MMM d, yyyy")}),c.jsx(X_,{className:"text-xs text-muted-foreground whitespace-nowrap",children:c.jsx("span",{title:V(new Date(e.lastMessageAt),"MMM d, yyyy HH:mm"),children:Pe(new Date(e.lastMessageAt),{addSuffix:!0})})}),c.jsx(X_,{children:r?c.jsxs(x,{className:"text-xs bg-emerald-500/15 text-emerald-600 hover:bg-emerald-500/15",children:[e.promptCount," prompts"]}):c.jsx("span",{className:"text-xs text-muted-foreground",children:e.promptCount})}),c.jsx(X_,{className:"hidden md:table-cell text-xs text-muted-foreground max-w-xs truncate",children:e.lastMessagePreview||"â"}),c.jsx(X_,{onClick:e=>e.stopPropagation(),children:e.storeUrl?c.jsxs("a",{href:e.storeUrl,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1 text-xs text-blue-500 hover:underline",children:[c.jsx(y,{className:"h-3 w-3"}),"Visit"]}):c.jsx("span",{className:"text-xs text-muted-foreground",children:"â"})})]}),t&&c.jsx(V_,{children:c.jsxs(X_,{colSpan:7,className:"bg-muted/20 px-4 py-3",children:[c.jsx("div",{className:"mb-3",children:c.jsx(iC,{userId:e.id,email:e.email})}),c.jsxs("div",{className:"flex items-center gap-1.5 text-xs font-medium text-muted-foreground mb-2",children:[c.jsx(ve,{size:12})," Chat history for ",e.email]}),c.jsx(J_,{userId:e.id})]})})]})}const dC="#3b82f6",fC={"multi-product":"#3b82f6","single-product":"#f59e0b"};function pC({dateRange:e}){const[t,n]=i.useState(null),[r,a]=i.useState(null),[o,s]=i.useState(null),[l,u]=i.useState(!0),[d,f]=i.useState(null);if(i.useEffect(()=>{var t,r;u(!0),f(null),Promise.all([(t=e.from,r=e.to,Me("/users",t,r)),Te(e.from,e.to),De(e.from,e.to)]).then(([e,t,r])=>{n(e),a(t),s(r)}).catch(e=>f(e.message)).finally(()=>u(!1))},[e.from.getTime(),e.to.getTime()]),l)return c.jsx(hC,{});if(d)return c.jsx("p",{className:"text-destructive text-sm",children:d});if(!t||!r||!o)return null;const p=function(e){const t=new Set([...e.actualFirstStores.map(e=>e.date),...e.reportedRegistrations.map(e=>e.date)]),n=new Map(e.actualFirstStores.map(e=>[e.date,e.count])),r=new Map(e.reportedRegistrations.map(e=>[e.date,e.count]));return Array.from(t).sort().map(e=>({date:e,actual:n.get(e)??0,reported:r.get(e)??0}
13))}(o);return c.jsxs("div",{className:"space-y-6",children:[c.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[c.jsxs(Y,{children:[c.jsx(J,{children:c.jsx(Z,{className:"text-sm font-medium",children:"Cumulative User Registrations"})}),c.jsx(Q,{children:c.jsx("div",{className:"h-56",children:c.jsx($f,{width:"100%",height:"100%",children:c.jsxs(I_,{data:t.cumulative,children:[c.jsx("defs",{children:c.jsxs("linearGradient",{id:"cumGrad",x1:"0",y1:"0",x2:"0",y2:"1",children:[c.jsx("stop",{offset:"5%",stopColor:dC,stopOpacity:.3}),c.jsx("stop",{offset:"95%",stopColor:dC,stopOpacity:0})]})}),c.jsx(TP,{strokeDasharray:"3 3"}),c.jsx(NE,{dataKey:"date",tick:{fontSize:10},tickFormatter:e=>V(new Date(e),"MMM d")}),c.jsx(DE,{tick:{fontSize:10}}),c.jsx(pf,{labelFormatter:e=>V(new Date(e),"MMM d, yyyy")}),c.jsx(fE,{type:"monotone",dataKey:"total",stroke:dC,fill:"url(#cumGrad)",name:"Total users"})]})})})})]}),c.jsxs(Y,{children:[c.jsx(J,{children:c.jsx(Z,{className:"text-sm font-medium",children:"Daily New Registrations"})}),c.jsx(Q,{children:c.jsx("div",{className:"h-56",children:c.jsx($f,{width:"100%",height:"100%",children:c.jsxs(T_,{data:t.dailyRegistrations,children:[c.jsx(TP,{strokeDasharray:"3 3"}),c.jsx(NE,{dataKey:"date",tick:{fontSize:10},tickFormatter:e=>V(new Date(e),"MMM d")}),c.jsx(DE,{tick:{fontSize:10},allowDecimals:!1}),c.jsx(pf,{labelFormatter:e=>V(new Date(e),"MMM d, yyyy")}),c.jsx(Ak,{dataKey:"count",fill:dC,name:"New users",radius:[3,3,0,0]})]})})})})]})]}),c.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[c.jsxs(Y,{children:[c.jsx(J,{children:c.jsx(Z,{className:"text-sm font-medium",children:"Store Creations Over Time"})}),c.jsx(Q,{children:c.jsx("div",{className:"h-56",children:c.jsx($f,{width:"100%",height:"100%",children:c.jsxs(T_,{data:r.dailyCreations,children:[c.jsx(TP,{strokeDasharray:"3 3"}),c.jsx(NE,{dataKey:"date",tick:{fontSize:10},tickFormatter:e=>V(new Date(e),"MMM d")}),c.jsx(DE,{tick:{fontSize:10},allowDecimals:!1}),c.jsx(pf,{labelFormatter:e=>V(new Date(e),"MMM d, yyyy")}),c.jsx(Ak,{dataKey:"count",fill:"#8b5cf6",name:"Stores created",radius:[3,3,0,0]})]})})})})]}),c.jsxs(Y,{children:[c.jsx(J,{children:c.jsx(Z,{className:"text-sm font-medium",children:"Store Type Distribution"})}),c.jsxs(Q,{children:[c.jsx("div",{className:"h-56",children:c.jsx($f,{width:"100%",height:"100%",children:c.jsxs(D_,{children:[c.jsx(cO,{data:r.typeDistribution,cx:"50%",cy:"50%",innerRadius:55,outerRadius:80,paddingAngle:3,dataKey:"count",nameKey:"type",label:!1,labelLine:!1,children:r.typeDistribution.map(e=>c.jsx(Ff,{fill:fC[e.type]||"#94a3b8"},e.type))}),c.jsx(pf,{formatter:e=>[e,"Stores"]})]})})}),c.jsx("div",{className:"flex justify-center gap-4 text-xs text-muted-foreground mt-1",children:r.typeDistribution.map(e=>c.jsxs("span",{className:"flex items-center gap-1",children:[c.jsx("span",{className:"inline-block w-2 h-2 rounded-full",style:{background:fC[e.type]||"#94a3b8"}}),e.type]},e.type))})]})]})]}),c.jsx("div",{className:"grid gap-4",children:c.jsxs(Y,{children:[c.jsx(J,{children:c.jsx(Z,{className:"text-sm font-medium",children:"Meta CompleteRegistration Reconciliation"})}),c.jsx(Q,{children:c.jsx("div",{className:"h-56",children:c.jsx($f,{width:"100%",height:"100%",children:c.jsxs(M_,{data:p,children:[c.jsx(TP,{strokeDasharray:"3 3"}),c.jsx(NE,{dataKey:"date",tick:{fontSize:10},tickFormatter:e=>V(new Date(e),"MMM d")}),c.jsx(DE,{tick:{fontSize:10},allowDecimals:!1}),c.jsx(pf,{labelFormatter:e=>V(new Date(e),"MMM d, yyyy")}),c.jsx(Mu,{wrapperStyle:{fontSize:11}}),c.jsx(YP,{type:"monotone",dataKey:"actual",stroke:"#10b981",name:"Actual first-store creations",strokeWidth:2,dot:!1}),c.jsx(YP,{type:"monotone",dataKey:"reported",stroke:"#3b82f6",name:"Reported CompleteRegistration",strokeWidth:2,dot:!1})]})})})})]})}),c.jsx(Y,{children:c.jsxs(b,{defaultValue:"signups",children:[c.jsx(J,{className:"pb-0",children:c.jsxs("div",{className:"flex items-center justify-between",children:[c.jsx(Z,{className:"text-sm font-medium",children:"Recent Users"}),c.jsxs(j,{className:"h-7",children:[c.jsx(w,{value:"signups",className:"text-xs px-3 h-6",children:"Recent Signups"}),c.jsx(w,{value:"activity",className:"text-xs px-3 h-6",children:"Recent Activity"})]})]})}),c.jsxs(Q,{className:"p-0 pt-0",children:[c.jsx(N,{value:"signups",className:"mt-0",children:c.jsxs(q_,{children:[c.jsx(W_,{children:c.jsxs(V_,{children:[c.jsx(K_,{className:"w-8"}),c.jsx(K_,{children:"Email"}),c.jsx(K_,{className:"hidden md:table-cell",children:"Name"}),c.jsx(K_,{className:"hidden md:table-cell",children:"Provider"}),c.jsx(K_,{className:"hidden md:table-cell",children:"Registered"}),c.jsx(K_,{className:"hidden md:table-cell",children:"Last Sign In"}),c.jsx(K_,{children:"Prompts"}),c.jsx(K_,{children:"Store"})]})}),c.jsx(H_,{children:t.recent.map(e=>c.jsx(cC,{user:e},e.id))})]})}),c.jsx(N,{value:"activity",className:"mt-0",children:c.jsxs(q_,{children:[c.jsx(W_,{children:c.jsxs(V_,{children:[c.jsx(K_,{className:"w-8"}),c.jsx(K_,{children:"User"}),c.jsx(K_,{children:"Signed Up"}),c.jsx(K_,{children:"Last Active"}),c.jsx(K_,{children:"Prompts"}),c.jsx(K_,{className:"hidden md:table-cell",children:"Preview"}),c.jsx(K_,{children:"Store"})]})}),c.jsx(H_,{children:(t.recentActive??[]).map(e=>c.jsx(uC,{user:e},e.id))})]})})]})]})}),c.jsx(lC,{})]})}function hC(){return c.jsxs("div",{className:"space-y-4",children:[c.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[c.jsx(d,{className:"h-72"}),c.jsx(d,{className:"h-72"})]}),c.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[c.jsx(d,{className:"h-72"}),c.jsx(d,{className:"h-72"})]}),c.jsx(d,{className:"h-64"})]})}const mC=["#3b82f6","#8b5cf6","#f59e0b","#10b981","#ef4444","#6366f1"];function yC({dateRange:e}){const[t,n]=i.useState(null),[r,a]=i.useState(!0),[o,s]=i.useState(null);if(i.useEffect(()=>{var t,r;a(!0),s(null),(t=e.from,r=e.to,Me("/ai-usage",t,r)).then(n).catch(e=>s(e.message)).finally(()=>a(!1))},[e.from.getTime(),e.to.getTime()]),r)return c.jsx(bC,{});if(o)return c.jsx("p",{className:"text-destructive text-sm",children:o});if(!t)return null;const l=t.langsmith;return c.jsxs("div",{className:"space-y-6",children:[l&&c.jsxs("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-4",children:[c.jsx(vC,{title:"Total Agent Runs",value:l.totalRuns.toLocaleStr
13ing()}),c.jsx(vC,{title:"Total Tokens",value:l.totalTokens.toLocaleString()}),c.jsx(vC,{title:"Total AI Cost",value:`$${l.totalCost.toFixed(2)}`}),c.jsx(vC,{title:"Agent Error Rate",value:`${(100*l.errorRate).toFixed(1)}%`,muted:l.errorRate<.05,alert:l.errorRate>.1})]}),l&&l.dailyMetrics.length>0&&c.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[c.jsxs(Y,{children:[c.jsx(J,{children:c.jsx(Z,{className:"text-sm font-medium",children:"Token Consumption (Input / Output)"})}),c.jsx(Q,{children:c.jsx("div",{className:"h-56",children:c.jsx($f,{width:"100%",height:"100%",children:c.jsxs(I_,{data:l.dailyMetrics,children:[c.jsxs("defs",{children:[c.jsxs("linearGradient",{id:"promptGrad",x1:"0",y1:"0",x2:"0",y2:"1",children:[c.jsx("stop",{offset:"5%",stopColor:"#3b82f6",stopOpacity:.4}),c.jsx("stop",{offset:"95%",stopColor:"#3b82f6",stopOpacity:0})]}),c.jsxs("linearGradient",{id:"completionGrad",x1:"0",y1:"0",x2:"0",y2:"1",children:[c.jsx("stop",{offset:"5%",stopColor:"#8b5cf6",stopOpacity:.4}),c.jsx("stop",{offset:"95%",stopColor:"#8b5cf6",stopOpacity:0})]})]}),c.jsx(TP,{strokeDasharray:"3 3"}),c.jsx(NE,{dataKey:"date",tick:{fontSize:10},tickFormatter:e=>V(new Date(e),"MMM d")}),c.jsx(DE,{tick:{fontSize:10}}),c.jsx(pf,{labelFormatter:e=>V(new Date(e),"MMM d, yyyy")}),c.jsx(Mu,{}),c.jsx(fE,{type:"monotone",dataKey:"promptTokens",stroke:"#3b82f6",fill:"url(#promptGrad)",name:"Input tokens"}),c.jsx(fE,{type:"monotone",dataKey:"completionTokens",stroke:"#8b5cf6",fill:"url(#completionGrad)",name:"Output tokens"})]})})})})]}),c.jsxs(Y,{children:[c.jsx(J,{children:c.jsx(Z,{className:"text-sm font-medium",children:"Daily AI Cost ($)"})}),c.jsx(Q,{children:c.jsx("div",{className:"h-56",children:c.jsx($f,{width:"100%",height:"100%",children:c.jsxs(I_,{data:l.dailyMetrics,children:[c.jsx("defs",{children:c.jsxs("linearGradient",{id:"costGrad",x1:"0",y1:"0",x2:"0",y2:"1",children:[c.jsx("stop",{offset:"5%",stopColor:"#10b981",stopOpacity:.4}),c.jsx("stop",{offset:"95%",stopColor:"#10b981",stopOpacity:0})]})}),c.jsx(TP,{strokeDasharray:"3 3"}),c.jsx(NE,{dataKey:"date",tick:{fontSize:10},tickFormatter:e=>V(new Date(e),"MMM d")}),c.jsx(DE,{tick:{fontSize:10},tickFormatter:e=>`$${e.toFixed(2)}`}),c.jsx(pf,{labelFormatter:e=>V(new Date(e),"MMM d, yyyy"),formatter:e=>[`$${e.toFixed(4)}`,"Cost"]}),c.jsx(fE,{type:"monotone",dataKey:"cost",stroke:"#10b981",fill:"url(#costGrad)",name:"Cost"})]})})})})]}),c.jsxs(Y,{children:[c.jsx(J,{children:c.jsx(Z,{className:"text-sm font-medium",children:"Average Agent Latency (ms)"})}),c.jsx(Q,{children:c.jsx("div",{className:"h-56",children:c.jsx($f,{width:"100%",height:"100%",children:c.jsxs(M_,{data:l.dailyMetrics,children:[c.jsx(TP,{strokeDasharray:"3 3"}),c.jsx(NE,{dataKey:"date",tick:{fontSize:10},tickFormatter:e=>V(new Date(e),"MMM d")}),c.jsx(DE,{tick:{fontSize:10},tickFormatter:e=>`${(e/1e3).toFixed(1)}s`}),c.jsx(pf,{labelFormatter:e=>V(new Date(e),"MMM d, yyyy"),formatter:e=>[`${(e/1e3).toFixed(2)}s`,"Avg latency"]}),c.jsx(YP,{type:"monotone",dataKey:"avgLatencyMs",stroke:"#f59e0b",dot:!1,name:"Avg latency"})]})})})})]}),c.jsxs(Y,{children:[c.jsx(J,{children:c.jsx(Z,{className:"text-sm font-medium",children:"Model Usage Breakdown"})}),c.jsx(Q,{children:c.jsx("div",{className:"h-56",children:c.jsx($f,{width:"100%",height:"100%",children:c.jsxs(D_,{children:[c.jsx(cO,{data:l.modelBreakdown,cx:"50%",cy:"50%",innerRadius:50,outerRadius:75,paddingAngle:3,dataKey:"count",nameKey:"model",label:!1,labelLine:!1,children:l.modelBreakdown.map((e,t)=>c.jsx(Ff,{fill:mC[t%mC.length]},e.model))}),c.jsx(pf,{formatter:(e,t,n)=>[e,n.payload.model]}),c.jsx(Mu,{})]})})})})]})]}),c.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[c.jsxs(Y,{children:[c.jsx(J,{children:c.jsx(Z,{className:"text-sm font-medium",children:"Chat Messages Over Time"})}),c.jsx(Q,{children:c.jsx("div",{className:"h-56",children:c.jsx($f,{width:"100%",height:"100%",children:c.jsxs(T_,{data:t.chatMessages,children:[c.jsx(TP,{strokeDasharray:"3 3"}),c.jsx(NE,{dataKey:"date",tick:{fontSize:10},tickFormatter:e=>V(new Date(e),"MMM d")}),c.jsx(DE,{tick:{fontSize:10},allowDecimals:!1}),c.jsx(pf,{labelFormatter:e=>V(new Date(e),"MMM d, yyyy")}),c.jsx(Ak,{dataKey:"count",fill:"#6366f1",name:"Messages",radius:[3,3,0,0]})]})})})})]}),c.jsxs(Y,{children:[c.jsx(J,{children:c.jsx(Z,{className:"text-sm font-medium",children:"Chat Response Types"})}),c.jsx(Q,{children:c.jsx("div",{className:"h-56",children:c.jsx($f,{width:"100%",height:"100%",children:c.jsxs(D_,{children:[c.jsx(cO,{data:t.responseTypeDistribution,cx:"50%",cy:"50%",innerRadius:50,outerRadius:75,paddingAngle:3,dataKey:"count",nameKey:"type",label:!1,labelLine:!1,children:t.responseTypeDistribution.map((e,t)=>c.jsx(Ff,{fill:mC[t%mC.length]},e.type))}),c.jsx(pf,{formatter:e=>[e,"Messages"]}),c.jsx(Mu,{})]})})})})]})]}),t.topUsers.length>0&&c.jsxs(Y,{children:[c.jsx(J,{children:c.jsx(Z,{className:"text-sm font-medium",children:"Top Users by AI Requests"})}),c.jsx(Q,{className:"p-0",children:c.jsx(gC,{users:t.topUsers})})]})]})}function xC({user:e,rank:t}){const[n,r]=i.useState(!1);return c.jsxs(c.Fragment,{children:[c.jsxs(V_,{className:"cursor-pointer hover:bg-muted/50",onClick:()=>r(e=>!e),children:[c.jsx(X_,{className:"text-muted-foreground text-xs w-8",children:n?c.jsx(h,{size:12}):c.jsx(m,{size:12})}),c.jsx(X_,{className:"hidden md:table-cell text-muted-foreground text-xs",children:t}),c.jsx(X_,{className:"text-xs font-mono",children:e.email}),c.jsx(X_,{className:"hidden md:table-cell text-xs",children:e.storeUrl?c.jsxs("a",{href:e.storeUrl,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1 text-blue-500 hover:underline",onClick:e=>e.stopPropagation(),children:[c.jsx(y,{size:11})," Visit"]}):c.jsx("span",{className:"text-muted-foreground",children:"â"})}),c.jsx(X_,{className:"text-right text-xs font-medium",children:e.requests.toLocaleStr
13ing()})]}),n&&c.jsx(V_,{children:c.jsxs(X_,{colSpan:5,className:"bg-muted/20 px-4 py-3",children:[c.jsxs("div",{className:"flex items-center gap-1.5 text-xs font-medium text-muted-foreground mb-2",children:[c.jsx(ve,{size:12})," Chat history for ",e.email]}),c.jsx(J_,{userId:e.userId})]})})]})}function gC({users:e}){return c.jsx("div",{className:"overflow-x-auto",children:c.jsxs(q_,{children:[c.jsx(W_,{children:c.jsxs(V_,{children:[c.jsx(K_,{className:"w-8"}),c.jsx(K_,{className:"hidden md:table-cell",children:"#"}),c.jsx(K_,{children:"Email"}),c.jsx(K_,{className:"hidden md:table-cell",children:"Store"}),c.jsx(K_,{className:"text-right",children:"Requests"})]})}),c.jsx(H_,{children:e.map((e,t)=>c.jsx(xC,{user:e,rank:t+1},e.userId))})]})})}function vC({title:e,value:t,muted:n,alert:r}){return c.jsxs(Y,{children:[c.jsx(J,{className:"pb-2",children:c.jsx(Z,{className:"text-xs font-medium text-muted-foreground",children:e})}),c.jsx(Q,{children:c.jsx("p",{className:"text-2xl font-bold "+(r?"text-destructive":n?"text-muted-foreground":""),children:t})})]})}function bC(){return c.jsxs("div",{className:"space-y-4",children:[c.jsx("div",{className:"grid gap-4 sm:grid-cols-4",children:Array.from({length:4}).map((e,t)=>c.jsx(d,{className:"h-20"},t))}),c.jsx("div",{className:"grid gap-4 md:grid-cols-2",children:Array.from({length:4}).map((e,t)=>c.jsx(d,{className:"h-72"},t))}),c.jsx(d,{className:"h-48"})]})}const jC=(()=>{try{return new RegExp("(?<=a)b"),!0}catch{return!1}})()?[k]:[],wC=["How is our Google Ads spend converting to signups this month?","Top Google search terms driving signups â and which waste budget?","Which Meta ad creatives have the best clickâsignup rate?","Where are users dropping off between ad click and store creation?"];function NC(){const[e,t]=i.useState([]),[n,r]=i.useState(""),[a,o]=i.useState(!1),[s,l]=i.useState(""),u=i.useRef(null),d=i.useRef(null);i.useEffect(()=>{var e;null==(e=d.current)||e.scrollIntoView({behavior:"smooth"})},[e]);const f=i.useCallback(async e=>{const n=e.trim();n&&!a&&(t(e=>[...e,{role:"user",content:n}]),r(""),o(!0),l("Thinking..."),u.current=new AbortController,await async function(e,t,n){const r=await Ce();let a;try{a=await fetch(`${Ee}/traffic-chat`,{method:"POST",headers:r,body:JSON.stringify({message:e}),signal:n})}catch(l){return void("AbortError"!==l.name&&t.onError(l.message))}if(!a.ok){const e=await a.json().catch(()=>({error:`HTTP ${a.status}`}));return void t.onError(e.error||`Request failed: ${a.status}`)}const i=a.body.getReader(),o=new TextDecoder;let s="";try{for(;;){const{done:e,value:n}=await i.read();if(e)break;s+=o.decode(n,{stream:!0});const r=s.split("\n");s=r.pop()??"";for(const a of r)if(a.startsWith("data: "))try{const e=JSON.parse(a.slice(6));"progress"===e.type?t.onProgress(e.message):"complete"===e.type?t.onComplete(e.result.answer):"error"===e.type&&t.onError(e.message)}catch{}}}catch(l){"AbortError"!==l.name&&t.onError(l.message)}}(n,{onProgress:e=>l(e),onComplete:e=>{t(t=>[...t,{role:"assistant",content:e}]),l(""),o(!1)},onError:e=>{t(t=>[...t,{role:"assistant",content:`Error: ${e}`}]),l(""),o(!1)}},u.current.signal))},[a]);return c.jsxs(Y,{className:"flex flex-col h-full min-h-[480px]",children:[c.jsxs(J,{className:"pb-2 flex flex-row items-center justify-between",children:[c.jsx(Z,{className:"text-sm font-medium",children:"Ask about the full user journey (traffic + Google & Meta ads)"}),e.length>0&&c.jsx(S,{variant:"ghost",size:"sm",className:"text-xs text-muted-foreground",onClick:async()=>{await async function(){const e=await Ce();await fetch(`${Ee}/traffic-chat/history`,{method:"DELETE",headers:e})}(),t([])},children:"Clear"})]}),c.jsxs(Q,{className:"flex flex-col flex-1 gap-3 overflow-hidden p-4 pt-0",children:[c.jsxs("div",{className:"flex-1 overflow-y-auto space-y-3 pr-1",children:[0===e.length&&!a&&c.jsxs("div",{className:"space-y-2",children:[c.jsx("p",{className:"text-xs text-muted-foreground",children:"Ask anything about the full funnel: Google/Meta ads â site traffic (PostHog) â signups â store creation."}),c.jsx("div",{className:"flex flex-wrap gap-2",children:wC.map(e=>c.jsx("button",{onClick:()=>f(e),className:"text-xs px-2 py-1 rounded-md bg-muted hover:bg-muted/80 transition-colors text-foreground",children:e},e))})]}),e.map((e,t)=>c.jsx("div",{className:"flex "+("user"===e.role?"justify-end":"justify-start"),children:c.jsx("div",{className:"max-w-[90%] rounded-lg px-3 py-2 text-sm "+("user"===e.role?"bg-primary text-primary-foreground whitespace-pre-wrap":"bg-muted text-foreground"),children:"user"===e.role?e.content:c.jsx(O,{remarkPlugins:jC,components:{p:({children:e})=>c.jsx("p",{className:"mb-1 last:mb-0",children:e}),strong:({children:e})=>c.jsx("strong",{className:"font-semibold",children:e}),em:({children:e})=>c.jsx("em",{className:"italic",children:e}),h1:({children:e})=>c.jsx("h1",{className:"text-base font-bold mt-2 mb-1",children:e}),h2:({children:e})=>c.jsx("h2",{className:"text-sm font-bold mt-2 mb-1",children:e}),h3:({children:e})=>c.jsx("h3",{className:"text-sm font-semibold mt-1 mb-1",children:e}),ul:({children:e})=>c.jsx("ul",{className:"list-disc list-inside mb-1 space-y-0.5",children:e}),ol:({children:e})=>c.jsx("ol",{className:"list-decimal list-inside mb-1 space-y-0.5",children:e}),li:({children:e})=>c.jsx("li",{className:"text-sm",children:e}),code:({children:e,className:t})=>t?c.jsx("code",{className:"block bg-background/60 rounded px-2 py-1 text-xs font-mono my-1 overflow-x-auto whitespace-pre",children:e}):c.jsx("code",{className:"bg-background/60 rounded px-1 text-xs font-mono",children:e}),pre:({children:e})=>c.jsx("pre",{className:"my-1 overflow-x-auto",children:e}),table:({children:e})=>c.jsx("div",{className:"overflow-x-auto my-1",children:c.jsx("table",{className:"text-xs border-collapse w-full",children:e})}),th:({children:e})=>c.jsx("th",{className:"border border-border px-2 py-1 font-semibold bg-background/40 text-left",children:e}),td:({children:e})=>c.jsx("td",{className:"border border-border px-2 py-1",children:e}),blockquote:({children:e})=>c.jsx("blockquote",{className:"border-l-2 border-muted-foreground pl-2 italic text-muted-foreground my-1",children:e}),hr:()=>c.jsx("hr",{className:"my-2 border-border"})},children:e.content})})}
13,t)),a&&c.jsx("div",{className:"flex justify-start",children:c.jsx("div",{className:"bg-muted rounded-lg px-3 py-2 text-xs text-muted-foreground italic",children:s||"Thinking..."})}),c.jsx("div",{ref:d})]}),c.jsxs("div",{className:"flex flex-col gap-2",children:[c.jsx(te,{value:n,onChange:e=>r(e.target.value),onKeyDown:e=>{"Enter"!==e.key||e.shiftKey||(e.preventDefault(),f(n))},placeholder:"Ask a question about traffic...",rows:2,className:"resize-none text-sm w-full",disabled:a}),c.jsxs("div",{className:"flex justify-end gap-2",children:[a&&c.jsx(S,{size:"sm",variant:"outline",onClick:()=>{var e;null==(e=u.current)||e.abort(),o(!1),l("")},children:"Stop"}),c.jsx(S,{size:"sm",onClick:()=>f(n),disabled:a||!n.trim(),children:"Send"})]})]})]})]})}function SC(e){try{const{pathname:t,search:n}=new URL(e);return t+n}catch{return e}}function OC({dateRange:e}){const[t,n]=i.useState(null),[r,a]=i.useState(!0),[o,s]=i.useState(null);return i.useEffect(()=>{var t,r;a(!0),s(null),(t=e.from,r=e.to,Me("/traffic",t,r)).then(n).catch(e=>s(e.message)).finally(()=>a(!1))},[e.from.getTime(),e.to.getTime()]),c.jsxs("div",{className:"grid grid-cols-1 gap-6 lg:grid-cols-2 lg:items-start",children:[c.jsx("div",{className:"space-y-6",children:r?c.jsx(kC,{}):o?c.jsx("p",{className:"text-destructive text-sm",children:o}):t?c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[c.jsxs(Y,{children:[c.jsx(J,{className:"pb-2",children:c.jsx(Z,{className:"text-xs font-medium text-muted-foreground",children:"Total Pageviews"})}),c.jsx(Q,{children:c.jsx("p",{className:"text-2xl font-bold",children:t.totalPageviews.toLocaleString()})})]}),c.jsxs(Y,{children:[c.jsx(J,{className:"pb-2",children:c.jsx(Z,{className:"text-xs font-medium text-muted-foreground",children:"Unique Visitors"})}),c.jsx(Q,{children:c.jsx("p",{className:"text-2xl font-bold",children:t.totalUniqueVisitors.toLocaleString()})})]})]}),c.jsxs(Y,{children:[c.jsx(J,{children:c.jsx(Z,{className:"text-sm font-medium",children:"Pageviews & Unique Visitors Over Time"})}),c.jsx(Q,{children:c.jsx("div",{className:"h-72",children:c.jsx($f,{width:"100%",height:"100%",children:c.jsxs(I_,{data:t.daily,children:[c.jsxs("defs",{children:[c.jsxs("linearGradient",{id:"pvGrad",x1:"0",y1:"0",x2:"0",y2:"1",children:[c.jsx("stop",{offset:"5%",stopColor:"#3b82f6",stopOpacity:.3}),c.jsx("stop",{offset:"95%",stopColor:"#3b82f6",stopOpacity:0})]}),c.jsxs("linearGradient",{id:"uvGrad",x1:"0",y1:"0",x2:"0",y2:"1",children:[c.jsx("stop",{offset:"5%",stopColor:"#10b981",stopOpacity:.3}),c.jsx("stop",{offset:"95%",stopColor:"#10b981",stopOpacity:0})]})]}),c.jsx(TP,{strokeDasharray:"3 3"}),c.jsx(NE,{dataKey:"date",tick:{fontSize:10},tickFormatter:e=>V(new Date(e),"MMM d")}),c.jsx(DE,{tick:{fontSize:10}}),c.jsx(pf,{labelFormatter:e=>V(new Date(e),"MMM d, yyyy")}),c.jsx(Mu,{}),c.jsx(fE,{type:"monotone",dataKey:"pageviews",stroke:"#3b82f6",fill:"url(#pvGrad)",name:"Pageviews"}),c.jsx(fE,{type:"monotone",dataKey:"uniqueVisitors",stroke:"#10b981",fill:"url(#uvGrad)",name:"Unique visitors"})]})})})})]}),t.topPages.length>0&&c.jsxs(Y,{children:[c.jsx(J,{children:c.jsx(Z,{className:"text-sm font-medium",children:"Top Pages"})}),c.jsx(Q,{children:c.jsxs(q_,{children:[c.jsx(W_,{children:c.jsxs(V_,{children:[c.jsx(K_,{children:"#"}),c.jsx(K_,{children:"URL"}),c.jsx(K_,{className:"text-right",children:"Views"})]})}),c.jsx(H_,{children:t.topPages.map((e,t)=>c.jsxs(V_,{children:[c.jsx(X_,{className:"text-muted-foreground text-xs",children:t+1}),c.jsx(X_,{className:"text-xs font-mono max-w-[140px] sm:max-w-xs truncate",title:e.url,children:SC(e.url)}),c.jsx(X_,{className:"text-right text-xs font-medium",children:e.views.toLocaleString()})]},e.url))})]})})]})]}):null}),c.jsx("div",{className:"lg:sticky lg:top-6",children:c.jsx(NC,{})})]})}function kC(){return c.jsxs("div",{className:"space-y-4",children:[c.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[c.jsx(d,{className:"h-20"}),c.jsx(d,{className:"h-20"})]}),c.jsx(d,{className:"h-80"}),c.jsx(d,{className:"h-56"})]})}const AC={"stable-front":"#ef4444","stable-back":"#f97316"};function PC(e,t){if(AC[e])return AC[e];const n=["#ef4444","#f97316","#eab308","#8b5cf6"];return n[t%n.length]}function EC({dateRange:e}){const[t,n]=i.useState(null),[r,a]=i.useState(!0),[o,s]=i.useState(null);if(i.useEffect(()=>{var t,r;a(!0),s(null),(t=e.from,r=e.to,Me("/errors",t,r)).then(n).catch(e=>s(e.message)).finally(()=>a(!1))},[e.from.getTime(),e.to.getTime()]),r)return c.jsx(_C,{});if(o)return c.jsx("p",{className:"text-destructive text-sm",children:o});if(!t)return null;const l=Array.from(new Set(t.daily.flatMap(e=>Object.keys(e.byProject)))),u=t.daily.map(e=>({date:e.date,total:e.total,...e.byProject}));return c.jsxs("div",{className:"space-y-6",children:[c.jsxs(Y,{className:"max-w-xs",children:[c.jsx(J,{className:"pb-2",children:c.jsxs(Z,{className:"text-xs font-medium text-muted-foreground flex items-center gap-1",children:[c.jsx(we,{className:"h-3 w-3 text-destructive"}),"Total Errors in Period"]}
13)}),c.jsx(Q,{children:c.jsx("p",{className:"text-2xl font-bold text-destructive",children:t.totalErrors.toLocaleString()})})]}),c.jsxs(Y,{children:[c.jsx(J,{children:c.jsx(Z,{className:"text-sm font-medium",children:"Error Trend by Project"})}),c.jsx(Q,{children:c.jsx("div",{className:"h-72",children:c.jsx($f,{width:"100%",height:"100%",children:c.jsxs(T_,{data:u,children:[c.jsx(TP,{strokeDasharray:"3 3"}),c.jsx(NE,{dataKey:"date",tick:{fontSize:10},tickFormatter:e=>V(new Date(e),"MMM d")}),c.jsx(DE,{tick:{fontSize:10},allowDecimals:!1}),c.jsx(pf,{labelFormatter:e=>V(new Date(e),"MMM d, yyyy")}),c.jsx(Mu,{}),l.length>0?l.map((e,t)=>c.jsx(Ak,{dataKey:e,stackId:"errors",fill:PC(e,t),name:e,radius:t===l.length-1?[3,3,0,0]:[0,0,0,0]},e)):c.jsx(Ak,{dataKey:"total",fill:"#ef4444",name:"Errors",radius:[3,3,0,0]})]})})})})]}),t.topIssues.length>0&&c.jsxs(Y,{children:[c.jsx(J,{children:c.jsx(Z,{className:"text-sm font-medium",children:"Top Unresolved Issues"})}),c.jsx(Q,{children:c.jsx("div",{className:"overflow-x-auto",children:c.jsxs(q_,{children:[c.jsx(W_,{children:c.jsxs(V_,{children:[c.jsx(K_,{children:"Issue"}),c.jsx(K_,{className:"hidden md:table-cell",children:"Project"}),c.jsx(K_,{className:"text-right",children:"Events"}),c.jsx(K_,{className:"hidden md:table-cell text-right",children:"Users"}),c.jsx(K_,{className:"hidden md:table-cell",children:"Last Seen"}),c.jsx(K_,{})]})}),c.jsx(H_,{children:t.topIssues.map(e=>c.jsxs(V_,{children:[c.jsxs(X_,{className:"max-w-xs",children:[c.jsx("p",{className:"text-xs font-medium truncate",children:e.title}),e.culprit&&c.jsx("p",{className:"text-xs text-muted-foreground font-mono truncate",children:e.culprit})]}),c.jsx(X_,{className:"hidden md:table-cell",children:c.jsx(x,{variant:"secondary",className:"text-xs",children:e.project||"â"})}),c.jsx(X_,{className:"text-right text-xs font-medium",children:e.count.toLocaleString()}),c.jsx(X_,{className:"hidden md:table-cell text-right text-xs",children:e.userCount.toLocaleString()}),c.jsx(X_,{className:"hidden md:table-cell text-xs text-muted-foreground",children:e.lastSeen?V(new Date(e.lastSeen),"MMM d, HH:mm"):"â"}),c.jsx(X_,{children:e.permalink&&c.jsx("a",{href:e.permalink,target:"_blank",rel:"noopener noreferrer",className:"text-muted-foreground hover:text-foreground",children:c.jsx(y,{className:"h-3 w-3"})})})]},e.id))})]})})})]})]})}function _C(){return c.jsxs("div",{className:"space-y-4",children:[c.jsx(d,{className:"h-20 max-w-xs"}),c.jsx(d,{className:"h-80"}),c.jsx(d,{className:"h-64"})]})}const CC="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement;function MC(e){const t=Object.prototype.toString.call(e);return"[object Window]"===t||"[object global]"===t}function TC(e){return"nodeType"in e}function DC(e){var t,n;return e?MC(e)?e:TC(e)&&null!=(t=null==(n=e.ownerDocument)?void 0:n.defaultView)?t:window:window}function IC(e){const{Document:t}=DC(e);return e instanceof t}function RC(e){return!MC(e)&&e instanceof DC(e).HTMLElement}function LC(e){return e instanceof DC(e).SVGElement}function BC(e){return e?MC(e)?e.document:TC(e)?IC(e)?e:RC(e)||LC(e)?e.ownerDocument:document:document:document}const zC=CC?i.useLayoutEffect:i.useEffect;function $C(e){const t=i.useRef(e);return zC(()=>{t.current=e}),i.useCallback(function(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return null==t.current?void 0:t.current(...n)},[])}function FC(e,t){void 0===t&&(t=[e]);const n=i.useRef(e);return zC(()=>{n.current!==e&&(n.current=e)},t),n}function UC(e,t){const n=i.useRef();return i.useMemo(()=>{const t=e(n.current);return n.current=t,t},[...t])}function qC(e){const t=$C(e),n=i.useRef(null),r=i.useCallback(e=>{e!==n.current&&(null==t||t(e,n.current)),n.current=e},[]);return[n,r]}function WC(e){const t=i.useRef();return i.useEffect(()=>{t.current=e},[e]),t.current}let HC={};function VC(e,t){return i.useMemo(()=>{if(t)return t;const n=null==HC[e]?0:HC[e]+1;return HC[e]=n,e+"-"+n},[e,t])}function KC(e){return function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),a=1;a<n;a++)r[a-1]=arguments[a];return r.reduce((t,n)=>{const r=Object.entries(n);for(const[a,i]of r){const n=t[a];null!=n&&(t[a]=n+e*i)}return t},{...t})}}const XC=KC(1),GC=KC(-1);function YC(e){if(!e)return!1;const{KeyboardEvent:t}=DC(e.target);return t&&e instanceof t}function JC(e){if(function(e){if(!e)return!1;const{TouchEvent:t}=DC(e.target);return t&&e instanceof t}(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return function(e){return"clientX"in e&&"clientY"in e}(e)?{x:e.clientX,y:e.clientY}:null}const ZC=Object.freeze({Translate:{toString(e){if(!e)return;const{x:t,y:n}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(n?Math.round(n):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:t,scaleY:n}=e;return"scaleX("+t+") scaleY("+n+")"}},Transform:{toString(e){if(e)return[ZC.Translate.toString(e),ZC.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+" "+n+"ms "+r}}}),QC="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function eM(e){return e.matches(QC)?e:e.querySelector(QC)}const tM={display:"none"};function nM(e){let{id:t,value:n}=e;return s.createElement("div",{id:t,style:tM},n)}function rM(e){let{id:t,announcement:n,ariaLiveType:r="assertive"}=e;return s.createElement("div",{id:t,style:{position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"},role:"status","aria-live":r,"aria-atomic":!0},n)}const aM=i.createContext(null);const iM={draggable:"\n To pick up a draggable item, press the space bar.\n While dragging, use the arrow keys to move the item.\n Press space again to drop the item in its new position, or press escape to cancel.\n "},oM={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was moved over droppable area "+n.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was dropped over droppable area "+n.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function sM(e){let{announcements:t=oM,container:n,hiddenTextDescribedById:r,screenReaderInstructions:a=iM}=e;const{announce:o,announcement:l}=function(){const[e,t]=i.useState("");return{announce:i.useCallback(e=>{null!=e&&t(e)},[]),announcement:e}}(),c=VC("DndLiveRegion"),[u,d]=i.useState(!1);if(i.useEffect(()=>{d(!0)},[]),function(e){const t=i.useContext(aM);i.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}(i.useMemo(()=>({onDragStart(e){let{active:n}=e;o(t.onDragStart({active:n}))},onDragMove(e){let{active:n,over:r}=e;t.onDragMove&&o(t.onDragMove({active:n,over:r}))},onDragOver(e){let{active:n,over:r}=e;o(t.onDragOver({active:n,over:r}))},onDragEnd(e){let{active:n,over:r}=e;o(t.onDragEnd({active:n,over:r}))},onDragCancel(e){let{active:n,over:r}=e;
vendor: 11,542 bytes, line 13
13o(t.onDragCancel({active:n,over:r}))}}),[o,t])),!u)return null;const f=s.createElement(s.Fragment,null,s.createElement(nM,{id:r,value:a.draggable}),s.createElement(rM,{id:c,announcement:l}));return n?A.createPortal(f,n):f}var lM,cM;function uM(){}(cM=lM||(lM={})).DragStart="dragStart",cM.DragMove="dragMove",cM.DragEnd="dragEnd",cM.DragCancel="dragCancel",cM.DragOver="dragOver",cM.RegisterDroppable="registerDroppable",cM.SetDroppableDisabled="setDroppableDisabled",cM.UnregisterDroppable="unregisterDroppable";const dM=Object.freeze({x:0,y:0});function fM(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function pM(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function hM(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function mM(e,t,n){return void 0===t&&(t=e.left),void 0===n&&(n=e.top),{x:t+.5*e.width,y:n+.5*e.height}}const yM=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const a=mM(t,t.left,t.top),i=[];for(const o of r){const{id:e}=o,t=n.get(e);if(t){const n=fM(mM(t),a);i.push({id:e,data:{droppableContainer:o,value:n}})}}return i.sort(pM)};function xM(e,t){const n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),a=Math.min(t.left+t.width,e.left+e.width),i=Math.min(t.top+t.height,e.top+e.height),o=a-r,s=i-n;if(r<a&&n<i){const n=t.width*t.height,r=e.width*e.height,a=o*s;return Number((a/(n+r-a)).toFixed(4))}return 0}const gM=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const a=[];for(const i of r){const{id:e}=i,r=n.get(e);if(r){const n=xM(r,t);n>0&&a.push({id:e,data:{droppableContainer:i,value:n}})}}return a.sort(hM)};function vM(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:dM}function bM(e){return function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),a=1;a<n;a++)r[a-1]=arguments[a];return r.reduce((t,n)=>({...t,top:t.top+e*n.y,bottom:t.bottom+e*n.y,left:t.left+e*n.x,right:t.right+e*n.x}),{...t})}}const jM=bM(1);const wM={ignoreTransform:!1};function NM(e,t){void 0===t&&(t=wM);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:t,transformOrigin:r}=DC(e).getComputedStyle(e);t&&(n=function(e,t,n){const r=function(e){if(e.startsWith("matrix3d(")){const t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}if(e.startsWith("matrix(")){const t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}(t);if(!r)return e;const{scaleX:a,scaleY:i,x:o,y:s}=r,l=e.left-o-(1-a)*parseFloat(n),c=e.top-s-(1-i)*parseFloat(n.slice(n.indexOf(" ")+1)),u=a?e.width/a:e.width,d=i?e.height/i:e.height;return{width:u,height:d,top:c,right:l+u,bottom:c+d,left:l}}(n,t,r))}const{top:r,left:a,width:i,height:o,bottom:s,right:l}=n;return{top:r,left:a,width:i,height:o,bottom:s,right:l}}function SM(e){return NM(e,{ignoreTransform:!0})}function OM(e,t){const n=[];return e?function r(a){if(null!=t&&n.length>=t)return n;if(!a)return n;if(IC(a)&&null!=a.scrollingElement&&!n.includes(a.scrollingElement))return n.push(a.scrollingElement),n;if(!RC(a)||LC(a))return n;if(n.includes(a))return n;const i=DC(e).getComputedStyle(a);return a!==e&&function(e,t){void 0===t&&(t=DC(e).getComputedStyle(e));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(e=>{const r=t[e];return"string"==typeof r&&n.test(r)})}(a,i)&&n.push(a),function(e,t){return void 0===t&&(t=DC(e).getComputedStyle(e)),"fixed"===t.position}(a,i)?n:r(a.parentNode)}(e):n}function kM(e){const[t]=OM(e,1);return null!=t?t:null}function AM(e){return CC&&e?MC(e)?e:TC(e)?IC(e)||e===BC(e).scrollingElement?window:RC(e)?e:null:null:null}function PM(e){return MC(e)?e.scrollX:e.scrollLeft}function EM(e){return MC(e)?e.scrollY:e.scrollTop}function _M(e){return{x:PM(e),y:EM(e)}}var CM,MM;function TM(e){return!(!CC||!e)&&e===document.scrollingElement}function DM(e){const t={x:0,y:0},n=TM(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height};return{isTop:e.scrollTop<=t.y,isLeft:e.scrollLeft<=t.x,isBottom:e.scrollTop>=r.y,isRight:e.scrollLeft>=r.x,maxScroll:r,minScroll:t}}(MM=CM||(CM={}))[MM.Forward=1]="Forward",MM[MM.Backward=-1]="Backward";const IM={x:.2,y:.2};function RM(e,t,n,r,a){let{top:i,left:o,right:s,bottom:l}=n;void 0===r&&(r=10),void 0===a&&(a=IM);const{isTop:c,isBottom:u,isLeft:d,isRight:f}=DM(e),p={x:0,y:0},h={x:0,y:0},m=t.height*a.y,y=t.width*a.x;return!c&&i<=t.top+m?(p.y=CM.Backward,h.y=r*Math.abs((t.top+m-i)/m)):!u&&l>=t.bottom-m&&(p.y=CM.Forward,h.y=r*Math.abs((t.bottom-m-l)/m)),!f&&s>=t.right-y?(p.x=CM.Forward,h.x=r*Math.abs((t.right-y-s)/y)):!d&&o<=t.left+y&&(p.x=CM.Backward,h.x=r*Math.abs((t.left+y-o)/y)),{direction:p,speed:h}}function LM(e){if(e===document.scrollingElement){const{innerWidth:e,innerHeight:t}=window;return{top:0,left:0,right:e,bottom:t,width:e,height:t}}const{top:t,left:n,right:r,bottom:a}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:a,width:e.clientWidth,height:e.clientHeight}}function BM(e){return e.reduce((e,t)=>XC(e,_M(t)),dM)}const zM=[["x",["left","right"],function(e){return e.reduce((e,t)=>e+PM(t),0)}],["y",["top","bottom"],function(e){return e.reduce((e,t)=>e+EM(t),0)}]];class $M{constructor(e,t){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const n=OM(t),r=BM(n);this.rect={...e},this.width=e.width,this.height=e.height;for(const[a,i,o]of zM)for(const e of i)Object.defineProperty(this,e,{get:()=>{const t=o(n),i=r[a]-t;return this.rect[e]+i},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class FM{constructor(e){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(e=>{var t;return null==(t=this.target)?void 0:t.removeEventListener(...e)})},this.target=e}add(e,t,n){var r;null==(r=this.target)||r.addEventListener(e,t,n),this.listeners.push([e,t,n])}}function UM(e,t){const n=Math.abs(e.x),r=Math.abs(e.y);return"number"==typeof t?Math.sqrt(n**2+r**2)>t:"x"in t&&"y"in t?n>t.x&&r>t.y:"x"in t?n>t.x:"y"in t&&r>t.y}var qM,WM,HM,VM;function KM(e){e.preventDefault()}function XM(e){e.stopPropagation()}(WM=qM||(qM={})).Click="click",WM.DragStart="dragstart",WM.Keydown="keydown",WM.ContextMenu="contextmenu",WM.Resize="resize",WM.SelectionChange="selectionchange",WM.VisibilityChange="visibilitychange",(VM=HM||(HM={})).Space="Space",VM.Down="ArrowDown",VM.Right="ArrowRight",VM.Left="ArrowLeft",VM.Up="ArrowUp",VM.Esc="Escape",VM.Enter="Enter",VM.Tab="Tab";const GM={start:[HM.Space,HM.Enter],cancel:[HM.Esc],end:[HM.Space,HM.Enter,HM.Tab]},YM=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case HM.Right:return{...n,x:n.x+25};case HM.Left:return{...n,x:n.x-25};case HM.Down:return{...n,y:n.y+25};case HM.Up:return{...n,y:n.y-25}}};class JM{constructor(e){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=e;const{event:{target:t}}=e;this.props=e,this.listeners=new FM(BC(t)),this.windowListeners=new FM(DC(t)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(qM.Resize,this.handleCancel),this.windowListeners.add(qM.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(qM.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:e,onStart:t}=this.props,n=e.node.current;n&&function(e,t){if(void 0===t&&(t=NM),!e)return;const{top:n,left:r,bottom:a,right:i}=t(e);kM(e)&&(a<=0||i<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}(n),t(dM)}handleKeyDown(e){if(YC(e)){const{active:t,context:n,options:r}=this.props,{keyboardCodes:a=GM,coordinateGetter:i=YM,scrollBehavior:o="smooth"}=r,{code:s}=e;if(a.end.includes(s))return void this.handleEnd(e);if(a.cancel.includes(s))return void this.handleCancel(e);const{collisionRect:l}=n.current,c=l?{x:l.left,y:l.top}:dM;this.referenceCoordinates||(this.referenceCoordinates=c);const u=i(e,{active:t,context:n.current,currentCoordinates:c});if(u){const t=GC(u,c),r={x:0,y:0},{scrollableAncestors:a}=n.current;for(const n of a){const a=e.code,{isTop:i,isRight:s,isLeft:l,isBottom:c,maxScroll:d,minScroll:f}=DM(n),p=LM(n),h={x:Math.min(a===HM.Right?p.right-p.width/2:p.right,Math.max(a===HM.Right?p.left:p.left+p.width/2,u.x)),y:Math.min(a===HM.Down?p.bottom-p.height/2:p.bottom,Math.max(a===HM.Down?p.top:p.top+p.height/2,u.y))},m=a===HM.Right&&!s||a===HM.Left&&!l,y=a===HM.Down&&!c||a===HM.Up&&!i;if(m&&h.x!==u.x){const e=n.scrollLeft+t.x,i=a===HM.Right&&e<=d.x||a===HM.Left&&e>=f.x;if(i&&!t.y)return void n.scrollTo({left:e,behavior:o});r.x=i?n.scrollLeft-e:a===HM.Right?n.scrollLeft-d.x:n.scrollLeft-f.x,r.x&&n.scrollBy({left:-r.x,behavior:o});break}if(y&&h.y!==u.y){const e=n.scrollTop+t.y,i=a===HM.Down&&e<=d.y||a===HM.Up&&e>=f.y;if(i&&!t.x)return void n.scrollTo({top:e,behavior:o});r.y=i?n.scrollTop-e:a===HM.Down?n.scrollTop-d.y:n.scrollTop-f.y,r.y&&n.scrollBy({top:-r.y,behavior:o});break}}this.handleMove(e,XC(GC(u,this.referenceCoordinates),r))}}}handleMove(e,t){const{onMove:n}=this.props;e.preventDefault(),n(t)}handleEnd(e){const{onEnd:t}=this.props;e.preventDefault(),this.detach(),t()}handleCancel(e){const{onCancel:t}=this.props;e.preventDefault(),this.detach(),t()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}function ZM(e){return Boolean(e&&"distance"in e)}function QM(e){return Boolean(e&&"delay"in e)}JM.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:r=GM,onActivation:a}=t,{active:i}=n;const{code:o}=e.nativeEvent;if(r.start.includes(o)){const t=i.activatorNode.current;return(!t||e.target===t)&&(e.preventDefault(),null==a||a({event:e.nativeEvent}),!0)}return!1}}];class eT{constructor(e,t,n){var r;void 0===n&&(n=function(e){const{EventTarget:t}=DC(e);return e instanceof t?e:BC(e)}(e.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=e,this.events=t;const{event:a}=e,{target:i}=a;this.props=e,this.events=t,this.document=BC(i),this.documentListeners=new FM(this.document),this.listeners=new FM(n),this.windowListeners=new FM(DC(i)),this.initialCoordinates=null!=(r=JC(a))?r:dM,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:e,props:{options:{activationConstraint:t,bypassActivationConstraint:n}}}=this;if(this.listeners.add(e.move.name,this.handleMove,{passive:!1}),this.listeners.add(e.end.name,this.handleEnd),e.cancel&&this.listeners.add(e.cancel.name,this.handleCancel),this.windowListeners.add(qM.Resize,this.handleCancel),this.windowListeners.add(qM.DragStart,KM),this.windowListeners.add(qM.VisibilityChange,this.handleCancel),this.windowListeners.add(qM.ContextMenu,KM),this.documentListeners.add(qM.Keydown,this.handleKeydown),t){if(null!=n&&n({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(QM(t))return this.timeoutId=setTimeout(this.handleStart,t.delay),void this.handlePending(t);if(ZM(t))return void this.handlePending(t)}
vendor: 1,419 bytes, line 13
13this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),null!==this.timeoutId&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(e,t){const{active:n,onPending:r}=this.props;r(n,e,this.initialCoordinates,t)}handleStart(){const{initialCoordinates:e}=this,{onStart:t}=this.props;e&&(this.activated=!0,this.documentListeners.add(qM.Click,XM,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(qM.SelectionChange,this.removeTextSelection),t(e))}handleMove(e){var t;const{activated:n,initialCoordinates:r,props:a}=this,{onMove:i,options:{activationConstraint:o}}=a;if(!r)return;const s=null!=(t=JC(e))?t:dM,l=GC(r,s);if(!n&&o){if(ZM(o)){if(null!=o.tolerance&&UM(l,o.tolerance))return this.handleCancel();if(UM(l,o.distance))return this.handleStart()}return QM(o)&&UM(l,o.tolerance)?this.handleCancel():void this.handlePending(o,l)}e.cancelable&&e.preventDefault(),i(s)}handleEnd(){const{onAbort:e,onEnd:t}=this.props;this.detach(),this.activated||e(this.props.active),t()}handleCancel(){const{onAbort:e,onCancel:t}=this.props;this.detach(),this.activated||e(this.props.active),t()}handleKeydown(e){e.code===HM.Esc&&this.handleCancel()}removeTextSelection(){var e;null==(e=this.document.getSelection())||e.removeAllRanges()}}const tT={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};
13class nT extends eT{constructor(e){const{event:t}=e,n=BC(t.target);super(e,tT,n)}}nT.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!(!n.isPrimary||0!==n.button)&&(null==r||r({event:n}),!0)}}];const rT={move:{name:"mousemove"},end:{name:"mouseup"}};var aT,iT;(iT=aT||(aT={}))[iT.RightClick=2]="RightClick";(class extends eT{constructor(e){super(e,rT,BC(e.event.target))}}).activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button!==aT.RightClick&&(null==r||r({event:n}),!0)}}];const oT={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};var sT,lT,cT,uT;function dT(e){let{acceleration:t,activator:n=sT.Pointer,canScroll:r,draggingRect:a,enabled:o,interval:s=5,order:l=cT.TreeOrder,pointerCoordinates:c,scrollableAncestors:u,scrollableAncestorRects:d,delta:f,threshold:p}=e;const h=function(e){let{delta:t,disabled:n}=e;const r=WC(t);return UC(e=>{if(n||!r||!e)return fT;const a={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[CM.Backward]:e.x[CM.Backward]||-1===a.x,[CM.Forward]:e.x[CM.Forward]||1===a.x},y:{[CM.Backward]:e.y[CM.Backward]||-1===a.y,[CM.Forward]:e.y[CM.Forward]||1===a.y}}},[n,t,r])}({delta:f,disabled:!o}),[m,y]=function(){const e=i.useRef(null);return[i.useCallback((t,n)=>{e.current=setInterval(t,n)},[]),i.useCallback(()=>{null!==e.current&&(clearInterval(e.current),e.current=null)},[])]}(),x=i.useRef({x:0,y:0}),g=i.useRef({x:0,y:0}),v=i.useMemo(()=>{switch(n){case sT.Pointer:return c?{top:c.y,bottom:c.y,left:c.x,right:c.x}:null;case sT.DraggableRect:return a}},[n,a,c]),b=i.useRef(null),j=i.useCallback(()=>{const e=b.current;if(!e)return;const t=x.current.x*g.current.x,n=x.current.y*g.current.y;e.scrollBy(t,n)},[]),w=i.useMemo(()=>l===cT.TreeOrder?[...u].reverse():u,[l,u]);i.useEffect(()=>{if(o&&u.length&&v){for(const e of w){if(!1===(null==r?void 0:r(e)))continue;const n=u.indexOf(e),a=d[n];if(!a)continue;const{direction:i,speed:o}=RM(e,a,v,t,p);for(const e of["x","y"])h[e][i[e]]||(o[e]=0,i[e]=0);if(o.x>0||o.y>0)return y(),b.current=e,m(j,s),x.current=o,void(g.current=i)}x.current={x:0,y:0},g.current={x:0,y:0},y()}else y()},[t,j,r,y,o,s,JSON.stringify(v),JSON.stringify(h),m,u,w,d,JSON.stringify(p)])}(class extends eT{constructor(e){super(e,oT)}static setup(){return window.addEventListener(oT.move.name,e,{capture:!1,passive:!1}),function(){window.removeEventListener(oT.move.name,e)};function e(){}}}).activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;const{touches:a}=n;return!(a.length>1)&&(null==r||r({event:n}),!0)}}],(lT=sT||(sT={}))[lT.Pointer=0]="Pointer",lT[lT.DraggableRect=1]="DraggableRect",(uT=cT||(cT={}))[uT.TreeOrder=0]="TreeOrder",uT[uT.ReversedTreeOrder=1]="ReversedTreeOrder";const fT={x:{[CM.Backward]:!1,[CM.Forward]:!1},y:{[CM.Backward]:!1,[CM.Forward]:!1}};var pT,hT,mT;(hT=pT||(pT={}))[hT.Always=0]="Always",hT[hT.BeforeDragging=1]="BeforeDragging",hT[hT.WhileDragging=2]="WhileDragging",(mT||(mT={})).Optimized="optimized";const yT=new Map;function xT(e,t){return UC(n=>e?n||("function"==typeof t?t(e):e):null,[t,e])}function gT(e){let{callback:t,disabled:n}=e;const r=$C(t),a=i.useMemo(()=>{if(n||"undefined"==typeof window||void 0===window.ResizeObserver)return;const{ResizeObserver:e}=window;return new e(r)},[n]);return i.useEffect(()=>()=>null==a?void 0:a.disconnect(),[a]),a}function vT(e){return new $M(NM(e),e)}function bT(e,t,n){void 0===t&&(t=vT);const[r,a]=i.useState(null);function o(){a(r=>{if(!e)return null;var a;if(!1===e.isConnected)return null!=(a=null!=r?r:n)?a:null;const i=t(e);return JSON.stringify(r)===JSON.stringify(i)?r:i})}const s=function(e){let{callback:t,disabled:n}=e;const r=$C(t),a=i.useMemo(()=>{if(n||"undefined"==typeof window||void 0===window.MutationObserver)return;const{MutationObserver:e}=window;return new e(r)},[r,n]);return i.useEffect(()=>()=>null==a?void 0:a.disconnect(),[a]),a}({callback(t){if(e)for(const n of t){const{type:t,target:r}=n;if("childList"===t&&r instanceof HTMLElement&&r.contains(e)){o();break}}}}),l=gT({callback:o});return zC(()=>{o(),e?(null==l||l.observe(e),null==s||s.observe(document.body,{childList:!0,subtree:!0})):(null==l||l.disconnect(),null==s||s.disconnect())},[e]),r}const jT=[];function wT(e,t){void 0===t&&(t=[]);const n=i.useRef(null);return i.useEffect(()=>{n.current=null},t),i.useEffect(()=>{const t=e!==dM;t&&!n.current&&(n.current=e),!t&&n.current&&(n.current=null)},[e]),n.current?GC(e,n.current):dM}function NT(e){return i.useMemo(()=>
vendor: 14,133 bytes, line 13
13e?function(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}(e):null,[e])}const ST=[];function OT(e){let{measure:t}=e;const[n,r]=i.useState(null),a=gT({callback:i.useCallback(e=>{for(const{target:n}of e)if(RC(n)){r(e=>{const r=t(n);return e?{...e,width:r.width,height:r.height}:r});break}},[t])}),o=i.useCallback(e=>{const n=function(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return RC(t)?t:e}(e);null==a||a.disconnect(),n&&(null==a||a.observe(n)),r(n?t(n):null)},[t,a]),[s,l]=qC(o);return i.useMemo(()=>({nodeRef:s,rect:n,setRef:l}),[n,s,l])}const kT=[{sensor:nT,options:{}},{sensor:JM,options:{}}],AT={current:{}},PT={draggable:{measure:SM},droppable:{measure:SM,strategy:pT.WhileDragging,frequency:mT.Optimized},dragOverlay:{measure:NM}};class ET extends Map{get(e){var t;return null!=e&&null!=(t=super.get(e))?t:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(e=>{let{disabled:t}=e;return!t})}getNodeFor(e){var t,n;return null!=(t=null==(n=this.get(e))?void 0:n.node.current)?t:void 0}}const _T={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new ET,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:uM},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:PT,measureDroppableContainers:uM,windowRect:null,measuringScheduled:!1},CT={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:uM,draggableNodes:new Map,over:null,measureDroppableContainers:uM},MT=i.createContext(CT),TT=i.createContext(_T);function DT(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new ET}}}function IT(e,t){switch(t.type){case lM.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case lM.DragMove:return null==e.draggable.active?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case lM.DragEnd:case lM.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case lM.RegisterDroppable:{const{element:n}=t,{id:r}=n,a=new ET(e.droppable.containers);return a.set(r,n),{...e,droppable:{...e.droppable,containers:a}}}case lM.SetDroppableDisabled:{const{id:n,key:r,disabled:a}=t,i=e.droppable.containers.get(n);if(!i||r!==i.key)return e;const o=new ET(e.droppable.containers);return o.set(n,{...i,disabled:a}),{...e,droppable:{...e.droppable,containers:o}}}case lM.UnregisterDroppable:{const{id:n,key:r}=t,a=e.droppable.containers.get(n);if(!a||r!==a.key)return e;const i=new ET(e.droppable.containers);return i.delete(n),{...e,droppable:{...e.droppable,containers:i}}}default:return e}}function RT(e){let{disabled:t}=e;const{active:n,activatorEvent:r,draggableNodes:a}=i.useContext(MT),o=WC(r),s=WC(null==n?void 0:n.id);return i.useEffect(()=>{if(!t&&!r&&o&&null!=s){if(!YC(o))return;if(document.activeElement===o.target)return;const e=a.get(s);if(!e)return;const{activatorNode:t,node:n}=e;if(!t.current&&!n.current)return;requestAnimationFrame(()=>{for(const e of[t.current,n.current]){if(!e)continue;const t=eM(e);if(t){t.focus();break}}})}},[r,t,a,s,o]),null}const LT=i.createContext({...dM,scaleX:1,scaleY:1});var BT,zT;(zT=BT||(BT={}))[zT.Uninitialized=0]="Uninitialized",zT[zT.Initializing=1]="Initializing",zT[zT.Initialized=2]="Initialized";const $T=i.memo(function(e){var t,n,r,a;let{id:o,accessibility:l,autoScroll:c=!0,children:u,sensors:d=kT,collisionDetection:f=gM,measuring:p,modifiers:h,...m}=e;const y=i.useReducer(IT,void 0,DT),[x,g]=y,[v,b]=function(){const[e]=i.useState(()=>new Set),t=i.useCallback(t=>(e.add(t),()=>e.delete(t)),[e]);return[i.useCallback(t=>{let{type:n,event:r}=t;e.forEach(e=>{var t;return null==(t=e[n])?void 0:t.call(e,r)})},[e]),t]}(),[j,w]=i.useState(BT.Uninitialized),N=j===BT.Initialized,{draggable:{active:S,nodes:O,translate:k},droppable:{containers:P}}=x,E=null!=S?O.get(S):null,_=i.useRef({initial:null,translated:null}),C=i.useMemo(()=>{var e;return null!=S?{id:S,data:null!=(e=null==E?void 0:E.data)?e:AT,rect:_}:null},[S,E]),M=i.useRef(null),[T,D]=i.useState(null),[I,R]=i.useState(null),L=FC(m,Object.values(m)),B=VC("DndDescribedBy",o),z=i.useMemo(()=>P.getEnabled(),[P]),$=(F=p,i.useMemo(()=>({draggable:{...PT.draggable,...null==F?void 0:F.draggable},droppable:{...PT.droppable,...null==F?void 0:F.droppable},dragOverlay:{...PT.dragOverlay,...null==F?void 0:F.dragOverlay}}),[null==F?void 0:F.draggable,null==F?void 0:F.droppable,null==F?void 0:F.dragOverlay]));var F;const{droppableRects:U,measureDroppableContainers:q,measuringScheduled:W}=function(e,t){let{dragging:n,dependencies:r,config:a}=t;const[o,s]=i.useState(null),{frequency:l,measure:c,strategy:u}=a,d=i.useRef(e),f=function(){switch(u){case pT.Always:return!1;case pT.BeforeDragging:return n;default:return!n}}(),p=FC(f),h=i.useCallback(function(e){void 0===e&&(e=[]),p.current||s(t=>null===t?e:t.concat(e.filter(e=>!t.includes(e))))},[p]),m=i.useRef(null),y=UC(t=>{if(f&&!n)return yT;if(!t||t===yT||d.current!==e||null!=o){const t=new Map;for(let n of e){if(!n)continue;if(o&&o.length>0&&!o.includes(n.id)&&n.rect.current){t.set(n.id,n.rect.current);continue}const e=n.node.current,r=e?new $M(c(e),e):null;n.rect.current=r,r&&t.set(n.id,r)}return t}return t},[e,o,n,f,c]);return i.useEffect(()=>{d.current=e},[e]),i.useEffect(()=>{f||h()},[n,f]),i.useEffect(()=>{o&&o.length>0&&s(null)},[JSON.stringify(o)]),i.useEffect(()=>{f||"number"!=typeof l||null!==m.current||(m.current=setTimeout(()=>{h(),m.current=null},l))},[l,f,h,...r]),{droppableRects:y,measureDroppableContainers:h,measuringScheduled:null!=o}}(z,{dragging:N,dependencies:[k.x,k.y],config:$.droppable}),H=function(e,t){const n=null!=t?e.get(t):void 0,r=n?n.node.current:null;return UC(e=>{var n;return null==t?null:null!=(n=null!=r?r:e)?n:null},[r,t])}(O,S),V=i.useMemo(()=>I?JC(I):null,[I]),K=function(){const e=!1===(null==T?void 0:T.autoScrollEnabled),t="object"==typeof c?!1===c.enabled:!1===c,n=N&&!e&&!t;if("object"==typeof c)return{...c,enabled:n};return{enabled:n}}(),X=function(e,t){return xT(e,t)}(H,$.draggable.measure);!function(e){let{activeNode:t,measure:n,initialRect:r,config:a=!0}=e;const o=i.useRef(!1),{x:s,y:l}="boolean"==typeof a?{x:a,y:a}:a;zC(()=>{if(!s&&!l||!t)return void(o.current=!1);if(o.current||!r)return;const e=null==t?void 0:t.node.current;if(!e||!1===e.isConnected)return;const a=vM(n(e),r);if(s||(a.x=0),l||(a.y=0),o.current=!0,Math.abs(a.x)>0||Math.abs(a.y)>0){const t=kM(e);t&&t.scrollBy({top:a.y,left:a.x})}},[t,s,l,r,n])}({activeNode:null!=S?O.get(S):null,config:K.layoutShiftCompensation,initialRect:X,measure:$.draggable.measure});const G=bT(H,$.draggable.measure,X),Y=bT(H?H.parentElement:null),J=i.useRef({activatorEvent:null,active:null,activeNode:H,collisionRect:null,collisions:null,droppableRects:U,draggableNodes:O,draggingNode:null,draggingNodeRect:null,droppableContainers:P,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),Z=P.getNodeFor(null==(t=J.current.over)?void 0:t.id),Q=OT({measure:$.dragOverlay.measure}),ee=null!=(n=Q.nodeRef.current)?n:H,te=N?null!=(r=Q.rect)?r:G:null,ne=Boolean(Q.nodeRef.current&&Q.rect),re=vM(ae=ne?null:G,xT(ae));var ae;const ie=NT(ee?DC(ee):null),oe=function(e){const t=i.useRef(e),n=UC(n=>e?n&&n!==jT&&e&&t.current&&e.parentNode===t.current.parentNode?n:OM(e):jT,[e]);return i.useEffect(()=>{t.current=e},[e]),n}(N?null!=Z?Z:H:null),se=function(e,t){void 0===t&&(t=NM);const[n]=e,r=NT(n?DC(n):null),[a,o]=i.useState(ST);function s(){o(()=>e.length?e.map(e=>TM(e)?r:new $M(t(e),e)):ST)}const l=gT({callback:s});return zC(()=>{null==l||l.disconnect(),s(),e.forEach(e=>null==l?void 0:l.observe(e))},[e]),a}(oe),le=function(e,t){let{transform:n,...r}=t;return null!=e&&e.length?e.reduce((e,t)=>t({transform:e,...r}),n):n}(h,{transform:{x:k.x-re.x,y:k.y-re.y,scaleX:1,scaleY:1},activatorEvent:I,active:C,activeNodeRect:G,containerNodeRect:Y,draggingNodeRect:te,over:J.current.over,overlayNodeRect:Q.rect,scrollableAncestors:oe,scrollableAncestorRects:se,windowRect:ie}),ce=V?XC(V,k):null,ue=function(e){const[t,n]=i.useState(null),r=i.useRef(e),a=i.useCallback(e=>{const t=AM(e.target);t&&n(e=>e?(e.set(t,_M(t)),new Map(e)):null)},[]);return i.useEffect(()=>{const t=r.current;if(e!==t){i(t);const o=e.map(e=>{const t=AM(e);return t?(t.addEventListener("scroll",a,{passive:!0}),[t,_M(t)]):null}).filter(e=>null!=e);n(o.length?new Map(o):null),r.current=e}return()=>{i(e),i(t)};function i(e){e.forEach(e=>{const t=AM(e);null==t||t.removeEventListener("scroll",a)})}},[a,e]),i.useMemo(()=>e.length?t?Array.from(t.values()).reduce((e,t)=>XC(e,t),dM):BM(e):dM,[e,t])}(oe),de=wT(ue),fe=wT(ue,[G]),pe=XC(le,de),he=te?jM(te,le):null,me=C&&he?f({active:C,collisionRect:he,droppableRects:U,droppableContainers:z,pointerCoordinates:ce}):null,ye=function(e,t){if(!e||0===e.length)return null;const[n]=e;return n[t]}(me,"id"),[xe,ge]=i.useState(null),ve=function(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}(ne?le:XC(le,fe),null!=(a=null==xe?void 0:xe.rect)?a:null,G),be=i.useRef(null),je=i.useCallback((e,t)=>{let{sensor:n,options:r}=t;if(null==M.current)return;const a=O.get(M.current);if(!a)return;const i=e.nativeEvent,o=new n({active:M.current,activeNode:a,event:i,options:r,context:J,onAbort(e){if(!O.get(e))return;const{onDragAbort:t}=L.current,n={id:e};null==t||t(n),v({type:"onDragAbort",event:n})},onPending(e,t,n,r){if(!O.get(e))return;const{onDragPending:a}=L.current,i={id:e,constraint:t,initialCoordinates:n,offset:r};null==a||a(i),v({type:"onDragPending",event:i})},onStart(e){const t=M.current;if(null==t)return;const n=O.get(t);if(!n)return;const{onDragStart:r}=L.current,a={activatorEvent:i,active:{id:t,data:n.data,rect:_}};A.unstable_batchedUpdates(()=>{null==r||r(a),w(BT.Initializing),g({type:lM.DragStart,initialCoordinates:e,active:t}),v({type:"onDragStart",event:a}),D(be.current),R(i)})},onMove(e){g({type:lM.DragMove,coordinates:e})},onEnd:s(lM.DragEnd),onCancel:s(lM.DragCancel)});function s(e){return async function(){const{active:t,collisions:n,over:r,scrollAdjustedTranslate:a}=J.current;let o=null;if(t&&a){const{cancelDrop:s}=L.current;if(o={activatorEvent:i,active:t,collisions:n,delta:a,over:r},e===lM.DragEnd&&"function"==typeof s){await Promise.resolve(s(o))&&(e=lM.DragCancel)}}M.current=null,A.unstable_batchedUpdates(()=>{g({type:e}),w(BT.Uninitialized),ge(null),D(null),R(null),be.current=null;const t=e===lM.DragEnd?"onDragEnd":"onDragCancel";if(o){const e=L.current[t];null==e||e(o),v({type:t,event:o})}})}}be.current=o},[O]),we=function(e,t){return i.useMemo(()=>e.reduce((e,n)=>{const{sensor:r}=n;return[...e,...r.activators.map(e=>({eventName:e.eventName,handler:t(e.handler,n)}))]},[]),[e,t])}(d,i.useCallback((e,t)=>(n,r)=>{const a=n.nativeEvent,i=O.get(r);if(null!==M.current||!i||a.dndKit||a.defaultPrevented)return;const o={active:i};!0===e(n,t.options,o)&&(a.dndKit={capturedBy:t.sensor},M.current=r,je(n,t))},[O,je]));!function(e){i.useEffect(()=>{if(!CC)return;const t=e.map(e=>{let{sensor:t}=e;return null==t.setup?void 0:t.setup()});return()=>{for(const e of t)null==e||e()}},e.map(e=>{let{sensor:t}=e;return t}))}(d),zC(()=>{G&&j===BT.Initializing&&w(BT.Initialized)},[G,j]),i.useEffect(()=>{const{onDragMove:e}=L.current,{active:t,activatorEvent:n,collisions:r,over:a}=J.current;if(!t||!n)return;const i={active:t,activatorEvent:n,collisions:r,delta:{x:pe.x,y:pe.y},over:a};A.unstable_batchedUpdates(()=>{null==e||e(i),v({type:"onDragMove",event:i})})},[pe.x,pe.y]),i.useEffect(()=>{const{active:e,activatorEvent:t,collisions:n,droppableContainers:r,scrollAdjustedTranslate:a}=J.current;if(!e||null==M.current||!t||!a)return;const{onDragOver:i}=L.current,o=r.get(ye),s=o&&o.rect.current?{id:o.id,rect:o.rect.current,data:o.data,disabled:o.disabled}:null,l={active:e,activatorEvent:t,collisions:n,delta:{x:a.x,y:a.y},over:s};A.unstable_batchedUpdates(()=>{ge(s),null==i||i(l),v({type:"onDragOver",event:l})})},[ye]),zC(()=>{J.current={activatorEvent:I,active:C,activeNode:H,collisionRect:he,collisions:me,droppableRects:U,draggableNodes:O,draggingNode:ee,draggingNodeRect:te,droppableContainers:P,over:xe,scrollableAncestors:oe,scrollAdjustedTranslate:pe},_.current={initial:te,translated:he}},[C,H,me,he,O,ee,te,U,P,xe,oe,pe]),dT({...K,delta:k,draggingRect:he,pointerCoordinates:ce,scrollableAncestors:oe,scrollableAncestorRects:se});const Ne=i.useMemo(()=>({active:C,activeNode:H,activeNodeRect:G,activatorEvent:I,collisions:me,containerNodeRect:Y,dragOverlay:Q,draggableNodes:O,droppableContainers:P,droppableRects:U,over:xe,measureDroppableContainers:q,scrollableAncestors:oe,scrollableAncestorRects:se,measuringConfiguration:$,measuringScheduled:W,windowRect:ie}),[C,H,G,I,me,Y,Q,O,P,U,xe,q,oe,se,$,W,ie]),Se=i.useMemo(()=>({activatorEvent:I,activators:we,active:C,activeNodeRect:G,ariaDescribedById:{draggable:B},dispatch:g,draggableNodes:O,over:xe,measureDroppableContainers:q}),[I,we,C,G,g,B,O,xe,q]);return s.createElement(aM.Provider,{value:b},s.createElement(MT.Provider,{value:Se},s.createElement(TT.Provider,{value:Ne},s.createElement(LT.Provider,{value:ve},u)),s.createElement(RT,{disabled:!1===(null==l?void 0:l.restoreFocus)})),s.createElement(sM,{...l,hiddenTextDescribedById:B}))}),FT=i.createContext(null),UT="button";function qT(e){let{id:t,data:n,disabled:r=!1,attributes:a}=e;const o=VC("Draggable"),{activators:s,activatorEvent:l,active:c,activeNodeRect:u,ariaDescribedById:d,draggableNodes:f,over:p}=i.useContext(MT),{role:h=UT,roleDescription:m="draggable",tabIndex:y=0}=null!=a?a:{},x=(null==c?void 0:c.id)===t,g=i.useContext(x?LT:FT),[v,b]=qC(),[j,w]=qC(),N=function(e,t){return i.useMemo(()=>e.reduce((e,n)=>{let{eventName:r,handler:a}=n;return e[r]=e=>{a(e,t)},e},{}),[e,t])}(s,t),S=FC(n);zC(()=>(f.set(t,{id:t,key:o,node:v,activatorNode:j,data:S}
13),()=>{const e=f.get(t);e&&e.key===o&&f.delete(t)}),[f,t]);return{active:c,activatorEvent:l,activeNodeRect:u,attributes:i.useMemo(()=>({role:h,tabIndex:y,"aria-disabled":r,"aria-pressed":!(!x||h!==UT)||void 0,"aria-roledescription":m,"aria-describedby":d.draggable}),[r,h,y,x,m,d.draggable]),isDragging:x,listeners:r?void 0:N,node:v,over:p,setNodeRef:b,setActivatorNodeRef:w,transform:g}}const WT={timeout:25};function HT(e,t,n){const r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function VT(e,t){return e.reduce((e,n,r)=>{const a=t.get(n);return a&&(e[r]=a),e},Array(e.length))}function KT(e){return null!==e&&e>=0}const XT=e=>{let{rects:t,activeIndex:n,overIndex:r,index:a}=e;const i=HT(t,r,n),o=t[a],s=i[a];return s&&o?{x:s.left-o.left,y:s.top-o.top,scaleX:s.width/o.width,scaleY:s.height/o.height}:null},GT={scaleX:1,scaleY:1},YT=e=>{var t;let{activeIndex:n,activeNodeRect:r,index:a,rects:i,overIndex:o}=e;const s=null!=(t=i[n])?t:r;if(!s)return null;if(a===n){const e=i[o];return e?{x:0,y:n<o?e.top+e.height-(s.top+s.height):e.top-s.top,...GT}:null}const l=function(e,t,n){const r=e[t],a=e[t-1],i=e[t+1];if(!r)return 0;if(n<t)return a?r.top-(a.top+a.height):i?i.top-(r.top+r.height):0;return i?i.top-(r.top+r.height):a?r.top-(a.top+a.height):0}(i,a,n);return a>n&&a<=o?{x:0,y:-s.height-l,...GT}:a<n&&a>=o?{x:0,y:s.height+l,...GT}:{x:0,y:0,...GT}};const JT="Sortable",ZT=s.createContext({activeIndex:-1,containerId:JT,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:XT,disabled:{draggable:!1,droppable:!1}});function QT(e){let{children:t,id:n,items:r,strategy:a=XT,disabled:o=!1}=e;const{active:l,dragOverlay:c,droppableRects:u,over:d,measureDroppableContainers:f}=i.useContext(TT),p=VC(JT,n),h=Boolean(null!==c.rect),m=i.useMemo(()=>r.map(e=>"object"==typeof e&&"id"in e?e.id:e),[r]),y=null!=l,x=l?m.indexOf(l.id):-1,g=d?m.indexOf(d.id):-1,v=i.useRef(m),b=!function(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}(m,v.current),j=-1!==g&&-1===x||b,w=function(e){return"boolean"==typeof e?{draggable:e,droppable:e}:e}(o);zC(()=>{b&&y&&f(m)},[b,m,y,f]),i.useEffect(()=>{v.current=m},[m]);const N=i.useMemo(()=>({activeIndex:x,containerId:p,disabled:w,disableTransforms:j,items:m,overIndex:g,useDragOverlay:h,sortedRects:VT(m,u),strategy:a}),[x,p,w.draggable,w.droppable,j,m,g,u,h,a]);return s.createElement(ZT.Provider,{value:N},t)}const eD=e=>{let{id:t,items:n,activeIndex:r,overIndex:a}=e;return HT(n,r,a).indexOf(t)},tD=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:a,items:i,newIndex:o,previousItems:s,previousContainerId:l,transition:c}=e;return!(!c||!r)&&((s===i||a!==o)&&(!!n||o!==a&&t===l))},nD={duration:200,easing:"ease"},rD="transform",aD=ZC.Transition.toString({property:rD,duration:0,easing:"linear"}),iD={roleDescription:"sortable"};function oD(e){let{animateLayoutChanges:t=tD,attributes:n,disabled:r,data:a,getNewIndex:o=eD,id:s,strategy:l,resizeObserverConfig:c,transition:u=nD}=e;const{items:d,containerId:f,activeIndex:p,disabled:h,disableTransforms:m,sortedRects:y,overIndex:x,useDragOverlay:g,strategy:v}=i.useContext(ZT),b=function(e,t){var n,r;if("boolean"==typeof e)return{draggable:e,droppable:!1};return{draggable:null!=(n=null==e?void 0:e.draggable)?n:t.draggable,droppable:null!=(r=null==e?void 0:e.droppable)?r:t.droppable}}(r,h),j=d.indexOf(s),w=i.useMemo(()=>({sortable:{containerId:f,index:j,items:d},...a}),[f,a,j,d]),N=i.useMemo(()=>d.slice(d.indexOf(s)),[d,s]),{rect:S,node:O,isOver:k,setNodeRef:A}=function(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:a}=e;const o=VC("Droppable"),{active:s,dispatch:l,over:c,measureDroppableContainers:u}=i.useContext(MT),d=i.useRef({disabled:n}),f=i.useRef(!1),p=i.useRef(null),h=i.useRef(null),{disabled:m,updateMeasurementsFor:y,timeout:x}={...WT,...a},g=FC(null!=y?y:r),v=gT({callback:i.useCallback(()=>{f.current?(null!=h.current&&clearTimeout(h.current),h.current=setTimeout(()=>{u(Array.isArray(g.current)?g.current:[g.current]),h.current=null},x)):f.current=!0},[x]),disabled:m||!s}),b=i.useCallback((e,t)=>{v&&(t&&(v.unobserve(t),f.current=!1),e&&v.observe(e))},[v]),[j,w]=qC(b),N=FC(t);return i.useEffect(()=>{v&&j.current&&(v.disconnect(),f.current=!1,v.observe(j.current))},[j,v]),i.useEffect(()=>(l({type:lM.RegisterDroppable,element:{id:r,key:o,disabled:n,node:j,rect:p,data:N}}),()=>l({type:lM.UnregisterDroppable,key:o,id:r})),[r]),i.useEffect(()=>{n!==d.current.disabled&&(l({type:lM.SetDroppableDisabled,id:r,key:o,disabled:n}),d.current.disabled=n)},[r,o,n,l]),{active:s,rect:p,isOver:(null==c?void 0:c.id)===r,node:j,over:c,setNodeRef:w}}({id:s,data:w,disabled:b.droppable,resizeObserverConfig:{updateMeasurementsFor:N,...c}}),{active:P,activatorEvent:E,activeNodeRect:_,attributes:C,setNodeRef:M,listeners:T,isDragging:D,over:I,setActivatorNodeRef:R,transform:L}
13=qT({id:s,data:w,attributes:{...iD,...n},disabled:b.draggable}),B=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return i.useMemo(()=>e=>{t.forEach(t=>t(e))},t)}(A,M),z=Boolean(P),$=z&&!m&&KT(p)&&KT(x),F=!g&&D,U=F&&$?L:null,q=$?null!=U?U:(null!=l?l:v)({rects:y,activeNodeRect:_,activeIndex:p,overIndex:x,index:j}):null,W=KT(p)&&KT(x)?o({id:s,items:d,activeIndex:p,overIndex:x}):j,H=null==P?void 0:P.id,V=i.useRef({activeId:H,items:d,newIndex:W,containerId:f}),K=d!==V.current.items,X=t({active:P,containerId:f,isDragging:D,isSorting:z,id:s,index:j,items:d,newIndex:V.current.newIndex,previousItems:V.current.items,previousContainerId:V.current.containerId,transition:u,wasDragging:null!=V.current.activeId}),G=function(e){let{disabled:t,index:n,node:r,rect:a}=e;const[o,s]=i.useState(null),l=i.useRef(n);return zC(()=>{if(!t&&n!==l.current&&r.current){const e=a.current;if(e){const t=NM(r.current,{ignoreTransform:!0}),n={x:e.left-t.left,y:e.top-t.top,scaleX:e.width/t.width,scaleY:e.height/t.height};(n.x||n.y)&&s(n)}}n!==l.current&&(l.current=n)},[t,n,r,a]),i.useEffect(()=>{o&&s(null)},[o]),o}({disabled:!X,index:j,node:O,rect:S});return i.useEffect(()=>{z&&V.current.newIndex!==W&&(V.current.newIndex=W),f!==V.current.containerId&&(V.current.containerId=f),d!==V.current.items&&(V.current.items=d)},[z,W,f,d]),i.useEffect(()=>{if(H===V.current.activeId)return;if(null!=H&&null==V.current.activeId)return void(V.current.activeId=H);const e=setTimeout(()=>{V.current.activeId=H},50);return()=>clearTimeout(e)},[H]),{active:P,activeIndex:p,attributes:C,data:w,rect:S,index:j,newIndex:W,items:d,isOver:k,isSorting:z,isDragging:D,listeners:T,node:O,overIndex:x,over:I,setNodeRef:B,setActivatorNodeRef:R,setDroppableNodeRef:A,setDraggableNodeRef:M,transform:null!=G?G:q,transition:function(){if(G||K&&V.current.newIndex===j)return aD;if(F&&!YC(E)||!u)return;if(z||X)return ZC.Transition.toString({...u,property:rD});return}()}}function sD(e){return c.jsx(x,{className:`text-xs ${{completed:"bg-green-100 text-green-800",in_progress:"bg-yellow-100 text-yellow-800",failed:"bg-red-100 text-red-800",delivered:"bg-gray-100 text-gray-600"}[e]??"bg-gray-100 text-gray-500"}`,children:e})}function lD({step:e,validatorFns:t,onSave:n,onDelete:r}){const[a,o]=i.useState({...e}),[s,l]=i.useState(!1),[u,d]=i.useState(!1),[f,p]=i.useState(null);return c.jsxs("div",{className:"border border-gray-200 rounded-lg p-4 space-y-3 bg-white",children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("span",{className:"text-xs text-gray-400 w-6 text-center",children:a.step_index}),c.jsx("input",{className:"flex-1 text-sm font-medium border-b border-dashed border-gray-300 bg-transparent",value:a.title,onChange:e=>o(t=>({...t,title:e.target.value})),placeholder:"Step title"}),c.jsxs("select",{className:"text-xs border rounded px-1 py-0.5",value:a.step_type,onChange:e=>o(t=>({...t,step_type:e.target.value})),children:[c.jsx("option",{value:"external-guided",children:"â manual"}),c.jsx("option",{value:"agent-executed",children:"ð¤ agent"})]}),c.jsxs("label",{className:"flex items-center gap-1 text-xs text-gray-600 cursor-pointer",children:[c.jsx("input",{type:"checkbox",checked:a.interactive,onChange:e=>o(t=>({...t,interactive:e.target.checked}))}),"interactive"]})]}),c.jsx("textarea",{className:"w-full text-sm border rounded p-2 resize-y min-h-[60px]",value:a.description,onChange:e=>o(t=>({...t,description:e.target.value})),placeholder:"Step description shown to user",rows:2}),c.jsxs("div",{children:[c.jsx("p",{className:"text-xs font-medium text-gray-500 mb-1",children:"Validator checks"}),c.jsx("div",{className:"flex flex-wrap gap-1.5",children:t.map(e=>c.jsx("button",{title:e.description,onClick:()=>{return t=e.name,void o(e=>({...e,validator_checks:e.validator_checks.includes(t)?e.validator_checks.filter(e=>e!==t):[...e.validator_checks,t]}));var t},className:"text-xs px-2 py-0.5 rounded border transition-colors "+(a.validator_checks.includes(e.name)?"bg-green-100 border-green-400 text-green-800":"bg-gray-50 border-gray-300 text-gray-500 hover:border-gray-400"),children:e.name.replace(/_/g," ")},e.name))})]}),c.jsxs("div",{children:[c.jsxs("p",{className:"text-xs font-medium text-gray-500 mb-1",children:["Agentic validation prompt ",c.jsx("span",{className:"font-normal",children:"(optional)"})]}),c.jsx("textarea",{className:"w-full text-xs border rounded p-2 resize-y min-h-[50px] font-mono",value:a.agentic_validation_prompt??"",onChange:e=>o(t=>({...t,agentic_validation_prompt:e.target.value||null})),placeholder:"e.g. Check if the user has connected at least one social media link...",rows:2})]}),f&&c.jsx("p",{className:"text-xs text-red-600",children:f}),c.jsxs("div",{className:"flex justify-between items-center pt-1",children:[c.jsxs("button",{onClick:async()=>
13{if(confirm(`Delete step "${a.title}"?`)){d(!0);try{await r()}catch(e){p(e instanceof Error?e.message:"Delete failed"),d(!1)}}},disabled:u,className:"text-xs text-red-500 hover:text-red-700 flex items-center gap-1",children:[c.jsx(ce,{className:"w-3 h-3"})," ",u?"Deletingâ¦":"Delete"]}),c.jsxs("button",{onClick:async()=>{if(a.step_index<0)p("Step index cannot be negative");else{l(!0),p(null);try{await n({title:a.title,description:a.description,step_type:a.step_type,interactive:a.interactive,validator_checks:a.validator_checks,agentic_validation_prompt:a.agentic_validation_prompt,step_index:a.step_index})}catch(e){p(e instanceof Error?e.message:"Save failed")}finally{l(!1)}}},disabled:s,className:"text-xs bg-blue-600 text-white px-3 py-1 rounded hover:bg-blue-700 flex items-center gap-1",children:[c.jsx(ue,{className:"w-3 h-3"})," ",s?"Savingâ¦":"Save"]})]})]})}function cD({task:e,validatorFns:t,onRefresh:n,onDelete:r}){const[a,o]=i.useState(!1),[s,l]=i.useState(e.steps),[u,d]=i.useState(!1),[f,p]=i.useState(e.title),[y,g]=i.useState(e.description),[v,b]=i.useState(!1),[j,w]=i.useState(!1),[N,S]=i.useState(null),O=f!==e.title,k=y!==e.description,A=O||k,{attributes:P,listeners:E,setNodeRef:_,transform:C,transition:M,isDragging:T}=oD({id:e.task_number}),D={transform:ZC.Transform.toString(C),transition:M,opacity:T?.5:1},I=async(e,t)=>{var n,r;await(n=e.id,r=t,Be(`/challenge/steps/${n}`,r)),l(n=>n.map(n=>n.id===e.id?{...n,...t}:n))},R=async e=>{var t;await(t=e.id,ze(`/challenge/steps/${t}`)),l(t=>t.filter(t=>t.id!==e.id))};return c.jsxs("div",{ref:_,style:D,className:"border border-gray-200 rounded-xl overflow-hidden bg-white",children:[c.jsxs("div",{className:"w-full flex items-center gap-3 px-4 py-3 bg-gray-50 hover:bg-gray-100 transition-colors",children:[c.jsx("button",{...P,...E,className:"text-gray-300 hover:text-gray-500 shrink-0 cursor-grab active:cursor-grabbing touch-none",title:"Drag to reorder",children:c.jsx(ne,{className:"w-4 h-4"})}),c.jsxs("button",{className:"flex-1 flex items-center gap-3 text-left min-w-0",onClick:()=>o(e=>!e),children:[a?c.jsx(h,{className:"w-4 h-4 text-gray-400 shrink-0"}):c.jsx(m,{className:"w-4 h-4 text-gray-400 shrink-0"}),c.jsxs("span",{className:"text-sm font-semibold text-gray-700 w-16 shrink-0",children:["Task ",e.task_number]}),c.jsx("span",{className:"text-sm text-gray-800 flex-1 truncate",children:f}),c.jsxs("span",{className:"text-xs text-gray-400 shrink-0",children:[s.length," step",1!==s.length?"s":""]}),c.jsx("div",{className:"flex gap-1 shrink-0",children:s.map(e=>"agent-executed"===e.step_type?c.jsx(x,{className:"bg-purple-100 text-purple-800 text-xs",children:"ð¤ agent"}):c.jsx(x,{className:"bg-blue-100 text-blue-800 text-xs",children:"â manual"}))})]})]}),a&&c.jsxs("div",{className:"p-4 space-y-3 bg-white",children:[c.jsxs("div",{className:"space-y-2",children:[c.jsxs("div",{className:"space-y-1",children:[c.jsxs("div",{className:"flex items-center justify-between",children:[c.jsx("p",{className:"text-xs font-medium text-gray-500",children:"Task title"}),c.jsxs("button",{onClick:async()=>{if(confirm(`Delete Task ${e.task_number} â "${f}"? Subsequent tasks will be renumbered. This cannot be undone.`)){w(!0),S(null);try{await r()}catch(t){S(t instanceof Error?t.message:"Delete failed"),w(!1)}}},disabled:j,className:"text-xs text-red-500 hover:text-red-700 flex items-center gap-1 disabled:opacity-50",children:[c.jsx(ce,{className:"w-3 h-3"})," ",j?"Deletingâ¦":"Delete task"]})]}),N&&c.jsx("p",{className:"text-xs text-red-600",children:N}),c.jsx("input",{className:"w-full text-sm border rounded p-2",value:f,onChange:e=>p(e.target.value),placeholder:"Task titleâ¦"})]}),c.jsxs("div",{className:"space-y-1",children:[c.jsxs("p",{className:"text-xs font-medium text-gray-500",children:["Task description ",c.jsx("span",{className:"font-normal text-gray-400",children:"(shown on dashboard cards)"})]}),c.jsx("textarea",{className:"w-full text-sm border rounded p-2 resize-y min-h-[60px]",value:y,onChange:e=>g(e.target.value),placeholder:"Short description of what this task is aboutâ¦",rows:2})]}),A&&c.jsxs("button",{onClick:async()=>{b(!0);try{await(t=e.task_number,n={title:f,description:y},Be(`/challenge/curriculum/${t}`,n)),e.title=f,e.description=y}finally{b(!1)}var t,n},disabled:v,className:"text-xs bg-blue-600 text-white px-3 py-1.5 rounded hover:bg-blue-700 flex items-center gap-1",children:[c.jsx(ue,{className:"w-3 h-3"})," ",v?"Savingâ¦":"Save"]})]}),c.jsx("div",{className:"border-t border-gray-100 pt-1"}),0===s.length&&c.jsx("p",{className:"text-sm text-gray-400 text-center py-2",children:"No steps configured for this task."}),s.slice().sort((e,t)=>
13e.step_index-t.step_index).map(e=>c.jsx(lD,{step:e,validatorFns:t,onSave:t=>I(e,t),onDelete:()=>R(e)},e.id)),c.jsxs("button",{onClick:async()=>{d(!0);try{const n=s.length?Math.max(...s.map(e=>e.step_index))+1:0,r=await(t={task_number:e.task_number,step_index:n,title:"New step",description:"",step_type:"external-guided",interactive:!1,validator_checks:[],agentic_validation_prompt:null},Le("/challenge/steps",t));l(e=>[...e,r])}finally{d(!1)}var t},disabled:u,className:"w-full text-xs text-blue-600 border border-dashed border-blue-300 rounded py-1.5 hover:bg-blue-50 flex items-center justify-center gap-1",children:[c.jsx(ie,{className:"w-3 h-3"})," ",u?"Addingâ¦":"Add step"]})]})]})}function uD({enrollment:e,onBack:t}){const[n,r]=i.useState([]),[a,o]=i.useState(!0),[s,l]=i.useState(null),[u,f]=i.useState(null),[p,h]=i.useState(""),m=i.useCallback(async()=>{o(!0),f(null);try{r(await(t=e.id,Re(`${$e(t)}/tasks`)))}catch(n){f(n instanceof Error?n.message:"Failed to load")}finally{o(!1)}var t},[e.id]);i.useEffect(()=>{m()},[m]);const y=async(e,t)=>{l(e),f(null);try{await t(),await m()}catch(n){f(n instanceof Error?n.message:"Action failed")}finally{l(null)}},x=e.email??`${e.user_id.slice(0,8)}â¦`;return c.jsxs(Y,{children:[c.jsx(J,{className:"pb-3",children:c.jsxs("div",{className:"flex items-center justify-between",children:[c.jsxs("div",{className:"flex items-center gap-3",children:[c.jsx("button",{onClick:t,className:"text-gray-400 hover:text-gray-700",children:c.jsx(se,{className:"w-5 h-5"})}),c.jsx(Z,{className:"text-base",children:x}),c.jsxs("span",{className:"text-xs text-gray-400",children:[e.completedTasks,"/",e.totalTasks," tasks"]})]}),c.jsxs("div",{className:"flex flex-wrap gap-2",children:[c.jsxs("button",{onClick:()=>y("fix",()=>{return t=e.id,Le(`${$e(t)}/fix`,{});var t}),disabled:!!s,className:"text-xs px-3 py-1.5 rounded border border-yellow-300 text-yellow-700 hover:bg-yellow-50 flex items-center gap-1 disabled:opacity-50",title:"Reset all stuck in_progress tasks to delivered",children:[c.jsx(Se,{className:"w-3 h-3"})," ","fix"===s?"Fixingâ¦":"Fix Stuck"]}),c.jsxs("button",{onClick:()=>{confirm(`Restart all tasks for ${x}? This clears all progress and chat history.`)&&y("restart",()=>{return t=e.id,Le(`${$e(t)}/restart`,{});var t})},disabled:!!s,className:"text-xs px-3 py-1.5 rounded border border-red-300 text-red-700 hover:bg-red-50 flex items-center gap-1 disabled:opacity-50",children:[c.jsx(re,{className:"w-3 h-3"})," ","restart"===s?"Restartingâ¦":"Restart All"]}),c.jsxs("button",{onClick:()=>{confirm(`Clear ALL chat context for ${x}? This deletes all chat history and conversation summaries across every channel.`)&&y("clear-ctx",()=>{return t=e.id,Le(`${$e(t)}/clear-context`,{});var t})},disabled:!!s,className:"text-xs px-3 py-1.5 rounded border border-orange-300 text-orange-700 hover:bg-orange-50 flex items-center gap-1 disabled:opacity-50",title:"Delete all chat history + conversation summaries for this user",children:[c.jsx(ye,{className:"w-3 h-3"})," ","clear-ctx"===s?"Clearingâ¦":"Clear All Ctx"]}),c.jsx("button",{onClick:m,disabled:a,className:"text-xs text-gray-400 hover:text-gray-700",children:c.jsx(P,{className:"w-3.5 h-3.5 "+(a?"animate-spin":"")})})]})]})}),c.jsxs(Q,{children:[c.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[c.jsx("span",{className:"text-xs text-gray-500 shrink-0",children:"Clear channel ctx:"}),c.jsx("input",{className:"text-xs border rounded px-2 py-1 w-40",placeholder:"e.g. control-tower",value:p,onChange:e=>h(e.target.value),onKeyDown:t=>{if("Enter"===t.key&&p.trim()){const t=p.trim();if(!confirm(`Clear chat history for channel "${t}" for ${x}?`))return;y("clear-ch",()=>Fe(e.id,t)),h("")}}}),c.jsxs("button",{disabled:!!s||!p.trim(),onClick:()=>{const t=p.trim();t&&confirm(`Clear chat history for channel "${t}" for ${x}?`)&&(y("clear-ch",()=>Fe(e.id,t)),h(""))},className:"text-xs px-2 py-1 rounded border border-orange-300 text-orange-700 hover:bg-orange-50 flex items-center gap-1 disabled:opacity-40",children:[c.jsx(ye,{className:"w-3 h-3"})," ","clear-ch"===s?"Clearingâ¦":"Clear"]}),c.jsx("span",{className:"text-xs text-gray-400",children:'or click "Ctx" per task below'})]}),u&&c.jsx("p",{className:"text-xs text-red-600 mb-3",children:u}),a?c.jsx("div",{className:"space-y-1.5",children:Array.from({length:8}).map((e,t)=>c.jsx(d,{className:"h-9 w-full"},t))}):c.jsx("div",{className:"overflow-x-auto",children:c.jsxs("table",{className:"w-full text-xs",children:[c.jsx("thead",{children:c.jsxs("tr",{className:"border-b text-left text-gray-400",children:[c.jsx("th",{className:"pb-2 pr-3 w-10",children:"Task"}),c.jsx("th",{className:"pb-2 pr-3",children:"Title"}),c.jsx("th",{className:"pb-2 pr-3 w-28",children:"Status"}),c.jsx("th",{className:"pb-2 pr-3 w-16",children:"Step"}),c.jsx("th",{className:"pb-2 pr-3 w-28",children:"Interaction"}),c.jsx("th",{className:"pb-2 pr-3 w-24",children:"Completed"}),c.jsx("th",{className:"pb-2 w-64",children:"Actions"})]})}),c.jsx("tbody",{children:n.map(t=>{const n=e=>s===`${t.task_number}-${e}`;return null==s||s.startsWith(`${t.task_number}-`),c.jsxs("tr",{className:"border-b last:border-0 hover:bg-gray-50",children:[c.jsx("td",{className:"py-2 pr-3 font-mono text-gray-500",children:t.task_number}),c.jsx("td",{className:"py-2 pr-3 text-gray-800 max-w-[180px] truncate",title:t.title,children:t.title}),c.jsx("td",{className:"py-2 pr-3",children:sD(t.status)}),c.jsx("td",{className:"py-2 pr-3 text-gray-500",children:t.total_steps>0?`${t.current_step_index+1}/${t.total_steps}`:"â"}),c.jsx("td",{className:"py-2 pr-3 text-gray-400",children:t.interaction_state??"â"}),c.jsx("td",{className:"py-2 pr-3 text-gray-400",children:t.completed_at?new Date(t.completed_at).toLocaleDateString():"â"}),c.jsx("td",{className:"py-2",children:c.jsxs("div",{className:"flex gap-1 flex-wrap",children:[c.jsx("button",{onClick:()=>y(`${t.task_number}-advance`,()=>{return n=e.id,r=t.task_number,Le(`${$e(n)}/advance`,{toDay:r});var n,r}),disabled:!!s,title:`Mark tasks 1â${t.task_number-1} as completed`,className:"px-2 py-0.5 rounded border border-gray-300 text-gray-600 hover:bg-gray-100 disabled:opacity-40",children:n("advance")?"â¦":`â Task ${t.task_number}`}),c.jsxs("button",{onClick:()=>y(`${t.task_number}-skip`,()=>{return n=e.id,r=t.task_number,Le(`${$e(n)}/skip-task`,{taskNumber:r});var n,r}),disabled:!!s,title:"Mark this task as completed",className:"px-2 py-0.5 rounded border border-green-300 text-green-700 hover:bg-green-50 disabled:opacity-40 flex items-center gap-0.5",children:[c.jsx(je,{className:"w-3 h-3"}),n("skip")?"â¦":"Skip"]}),c.jsx("button",{onClick:()=>y(`${t.task_number}-step-reset`,()=>{return n=e.id,r=t.task_number,Le(`${$e(n)}/step-reset`,{taskNumber:r});var n,r}),disabled:!!s,title:"Reset step index to 0 (keep status)",className:"px-2 py-0.5 rounded border border-blue-300 text-blue-700 hover:bg-blue-50 disabled:opacity-40",children:n("step-reset")?"â¦":"Step â©"}),c.jsxs("button",{onClick:()=>y(`${t.task_number}-reset`,()=>{return n=e.id,r=t.task_number,Le(`${$e(n)}/reset-task`,{taskNumber:r});var n,r}),disabled:!!s,title:"Full reset: delivered at step 0, clears chat",className:"px-2 py-0.5 rounded border border-red-300 text-red-700 hover:bg-red-50 disabled:opacity-40 flex items-center gap-0.5",children:[c.jsx(re,{className:"w-3 h-3"}),n("reset")?"â¦":"Reset"]}),c.jsxs("button",{onClick:()=>y(`${t.task_number}-clear-ctx`,()=>{return n=e.id,r=t.task_number,Le(`${$e(n)}/clear-context-task`,{taskNumber:r});var n,r}),disabled:!!s,title:`Clear chat history for task-${t.task_number} channel only`,className:"px-2 py-0.5 rounded border border-orange-300 text-orange-700 hover:bg-orange-50 disabled:opacity-40 flex items-center gap-0.5",children:[c.jsx(ye,{className:"w-3 h-3"}),n("clear-ctx")?"â¦":"Ctx"]})]})})]},t.task_number)})})]})})]})]})}function dD(){const[e,t]=i.useState([]),[n,r]=i.useState(!0),[a,o]=i.useState(null),[s,l]=i.useState(null),[u,f]=i.useState(null),p=i.useCallback(async()=>{r(!0),o(null);try{t(await Re("/challenge/enrollments"))}catch(e){o(e instanceof Error?e.message:"Failed to load")}finally{r(!1)}},[]);return i.useEffect(()=>{p()},[p]),s?c.jsx(uD,{enrollment:s,onBack:()=>{l(null),p()}}):n?c.jsx(d,{className:"h-40 w-full"}):a?c.jsx("p",{className:"text-sm text-red-600",children:a}):c.jsxs(Y,{children:[c.jsx(J,{children:c.jsxs(Z,{className:"text-base flex items-center gap-2",children:[c.jsx(Ne,{className:"w-4 h-4"})," Enrollments (",e.length,")"]})}),c.jsx(Q,{children:c.jsxs("div",{className:"overflow-x-auto",children:[c.jsxs("table",{className:"w-full text-sm",children:[c.jsx("thead",{children:c.jsxs("tr",{className:"border-b text-left text-xs text-gray-500",children:[c.jsx("th",{className:"pb-2 pr-4",children:"User"}),c.jsx("th",{className:"pb-2 pr-4 hidden md:table-cell",children:"Mode"}),c.jsx("th",{className:"pb-2 pr-4",children:"Status"}),c.jsx("th",{className:"pb-2 pr-4",children:"Task"}),c.jsx("th",{className:"pb-2 pr-4 hidden md:table-cell",children:"Progress"}),c.jsx("th",{className:"pb-2 pr-4 hidden md:table-cell",children:"Enrolled"}),c.jsx("th",{className:"pb-2"})]})}),c.jsx("tbody",{children:e.map(e=>c.jsxs("tr",{className:"border-b last:border-b-0 hover:bg-gray-50",children:[c.jsx("td",{className:"py-2 pr-4 text-xs",children:e.email?c.jsx("span",{className:"text-gray-700",children:e.email}):c.jsxs("span",{className:"font-mono text-gray-400",children:[e.user_id.slice(0,8),"â¦"]})}),c.jsx("td",{className:"py-2 pr-4 hidden md:table-cell",children:c.jsx("button",{disabled:u===e.id,onClick:async()=>{const n="calendar"===e.pacing_mode?"self-paced":"calendar";f(e.id);try{await(r=e.id,a=n,Be(`${$e(r)}/pacing`,{pacing_mode:a})),t(t=>t.map(t=>
13t.id===e.id?{...t,pacing_mode:n}:t))}finally{f(null)}var r,a},className:`text-xs px-2 py-0.5 rounded border font-medium transition-colors ${"calendar"===e.pacing_mode?"border-blue-300 text-blue-700 bg-blue-50 hover:bg-blue-100":"border-purple-300 text-purple-700 bg-purple-50 hover:bg-purple-100"} disabled:opacity-50`,title:"Switch to "+("calendar"===e.pacing_mode?"self-paced":"calendar"),children:u===e.id?"â¦":e.pacing_mode})}),c.jsx("td",{className:"py-2 pr-4",children:sD(e.status)}),c.jsx("td",{className:"py-2 pr-4 text-gray-700",children:e.current_task}),c.jsxs("td",{className:"py-2 pr-4 text-gray-700 hidden md:table-cell",children:[e.completedTasks,"/",e.totalTasks]}),c.jsx("td",{className:"py-2 pr-4 text-xs text-gray-400 hidden md:table-cell",children:new Date(e.created_at).toLocaleDateString()}),c.jsx("td",{className:"py-2",children:c.jsx("button",{onClick:()=>l(e),className:"text-xs px-2.5 py-1 rounded border border-gray-300 text-gray-600 hover:bg-gray-100",children:"Manage"})})]},e.id))})]}),0===e.length&&c.jsx("p",{className:"text-sm text-gray-400 text-center py-4",children:"No enrollments yet."})]})})]})}function fD(){const[e,t]=i.useState([]),[n,r]=i.useState([]),[a,o]=i.useState(!0),[s,l]=i.useState(null),[u,f]=i.useState("curriculum"),[p,h]=i.useState(!1),m=i.useCallback(async()=>{o(!0),l(null);try{const[e,n]=await Promise.all([Re("/challenge/curriculum"),Re("/challenge/validator-functions")]);t(e),r(n)}catch(e){l(e instanceof Error?e.message:"Failed to load")}finally{o(!1)}},[]);i.useEffect(()=>{m()},[m]);const y=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return i.useMemo(()=>[...t].filter(e=>null!=e),[...t])}((x=nT,g={activationConstraint:{distance:5}},i.useMemo(()=>({sensor:x,options:null!=g?g:{}}),[x,g])));var x,g;const v=async e=>{await(e=>ze(`/challenge/curriculum/${e}`))(e),await m()};return c.jsxs("div",{className:"space-y-4",children:[c.jsxs("div",{className:"flex items-center justify-between",children:[c.jsxs("div",{className:"flex gap-2",children:[c.jsx("button",{onClick:()=>f("curriculum"),className:"px-3 py-1.5 text-sm rounded-md font-medium "+("curriculum"===u?"bg-gray-900 text-white":"bg-gray-100 text-gray-600 hover:bg-gray-200"),children:"Curriculum"}),c.jsx("button",{onClick:()=>f("enrollments"),className:"px-3 py-1.5 text-sm rounded-md font-medium "+("enrollments"===u?"bg-gray-900 text-white":"bg-gray-100 text-gray-600 hover:bg-gray-200"),children:"Enrollments"})]}),"curriculum"===u&&c.jsx("button",{onClick:m,className:"text-xs text-gray-500 hover:text-gray-800",children:"â» Refresh"})]}),"enrollments"===u&&c.jsx(dD,{}),"curriculum"===u&&c.jsxs(c.Fragment,{children:[a&&c.jsx("div",{className:"space-y-2",children:Array.from({length:6}).map((e,t)=>c.jsx(d,{className:"h-12 w-full"},t))}),s&&c.jsx("p",{className:"text-sm text-red-600",children:s}),!a&&!s&&c.jsxs("div",{className:"space-y-2",children:[c.jsxs("p",{className:"text-xs text-gray-500",children:[e.length," tasks · ",e.reduce((e,t)=>e+t.steps.length,0)," total steps ·"," ",n.length," validator functions available"]}),c.jsx($T,{sensors:y,collisionDetection:yM,onDragEnd:async n=>{const{active:r,over:a}=n;if(!a||r.id===a.id)return;const i=e.findIndex(e=>e.task_number===r.id),o=e.findIndex(e=>e.task_number===a.id);if(-1===i||-1===o)return;const s=HT(e,i,o);t(s);try{await(l=s.map(e=>e.task_number),Le("/challenge/curriculum/reorder",{order:l}))}finally{await m()}var l},children:c.jsx(QT,{items:e.map(e=>e.task_number),strategy:YT,children:c.jsx("div",{className:"space-y-2",children:e.map(e=>c.jsx(cD,{task:e,validatorFns:n,onRefresh:m,onDelete:()=>v(e.task_number)},e.task_number))})})}),c.jsxs("button",{onClick:async()=>{h(!0);try{await((e={})=>Le("/challenge/curriculum",e))(),await m()}finally{h(!1)}},disabled:p,className:"w-full text-xs text-blue-600 border border-dashed border-blue-300 rounded py-2 hover:bg-blue-50 flex items-center justify-center gap-1 disabled:opacity-50",children:[c.jsx(ie,{className:"w-3.5 h-3.5"})," ",p?"Addingâ¦":"Add task"]})]})]})]})}HM.Down,HM.Right,HM.Up,HM.Left;const pD={pending:"bg-gray-100 text-gray-700",creating_user:"bg-blue-100 text-blue-700",creating_store:"bg-blue-100 text-blue-700",importing_products:"bg-yellow-100 text-yellow-700",verifying:"bg-purple-100 text-purple-700",ready:"bg-green-100 text-green-700",activating:"bg-teal-100 text-teal-700",activated:"bg-teal-600 text-white",failed:"bg-red-100 text-red-700"},hD={pending:"Pending",creating_user:"Creating User",creating_store:"Building Store",importing_products:"Importing Products",verifying:"Verifying",ready:"Ready",activating:"Activating",activated:"Activated",failed:"Failed"};function mD({status:e}){return c.jsx("span",{className:`inline-block px-2 py-0.5 rounded text-xs font-medium ${pD[e]||"bg-gray-100 text-gray-600"}`,children:hD[e]||e})}function yD({batch:e,onActivate:t,onFilterBatch:n}){const r=e.counts.ready||0,a=e.counts.activated||0,i=e.counts.failed||0,o=(e.counts.creating_user||0)+(e.counts.creating_store||0)+(e.counts.importing_products||0)+(e.counts.verifying||0);return c.jsx(Y,{className:"mb-3",children:c.jsx(Q,{className:"pt-4",children:c.jsxs("div",{className:"flex items-center justify-between gap-2 flex-wrap",children:[c.jsxs("div",{children:[c.jsx("div",{className:"font-mono text-xs text-muted-foreground",children:e.batchId}),c.jsxs("div",{className:"text-sm mt-0.5",children:["Total: ",c.jsx("strong",{children:e.total}),r>0&&c.jsxs("span",{className:"ml-2 text-green-700",children:["â ",r," ready"]}),o>0&&c.jsxs("span",{className:"ml-2 text-blue-700",children:["â³ ",o," in progress"]}),a>0&&c.jsxs("span",{className:"ml-2 text-teal-700",children:["â
",a," activated"]}),i>0&&c.jsxs("span",{className:"ml-2 text-red-700",children:["â ",i," failed"]})]})]}),c.jsxs("div",{className:"flex gap-2",children:[c.jsx("button",{onClick:()=>n(e.batchId),className:"text-xs px-3 py-1.5 border rounded hover:bg-gray-50",children:"View Entries"}),r>0&&c.jsxs("button",{onClick:()=>t(e.batchId),className:"text-xs px-3 py-1.5 bg-green-600 text-white rounded hover:bg-green-700",children:[c.jsx(de,{className:"inline w-3 h-3 mr-1"}),"Activate ",r," ready"]})]})]})})})}function xD({entry:e,selected:t,onSelect:n,onRetry:r,onRestart:a,onReiport:o,onCancel:s}){var l;const[u,d]=i.useState(!1),f=e.store_id?`https://staging-${e.store_id}.stablecommerce.ai`:null;return c.jsxs(c.Fragment,{children:[c.jsxs("tr",{className:"border-b hover:bg-gray-50 "+(t?"bg-green-50":""),children:[c.jsx("td",{className:"px-3 py-2",children:"ready"===e.status&&c.jsx("input",{type:"checkbox",checked:t,onChange:t=>n(e.id,t.target.checked),className:"rounded"})}),c.jsx("td",{className:"px-3 py-2 text-sm",children:e.email}),c.jsx("td",{className:"px-3 py-2 text-xs text-muted-foreground max-w-[180px] truncate hidden md:table-cell",children:c.jsx("a",{href:e.etsy_shop_url,target:"_blank",rel:"noreferrer",className:"hover:underline",children:e.etsy_shop_url.replace("https://www.etsy.com/shop/","")})}),c.jsx("td",{className:"px-3 py-2",children:c.jsx(mD,{status:e.status})}),c.jsx("td",{className:"px-3 py-2 text-sm text-center hidden md:table-cell",children:null!=e.total_products_found?`${e.products_imported}/${e.total_products_found}`:"â"}),c.jsx("td",{className:"px-3 py-2 text-xs text-muted-foreground hidden md:table-cell",children:new Date(e.created_at).toLocaleDateString()}),c.jsx("td",{className:"px-3 py-2",children:c.jsxs("div",{className:"flex gap-1 items-center",children:[f&&c.jsx("a",{href:f,target:"_blank",rel:"noreferrer",title:"View Store",children:c.jsx(y,{className:"w-3.5 h-3.5 text-muted-foreground hover:text-foreground"})}),"failed"===e.status&&c.jsx("button",{onClick:()=>r(e.id),title:"Retry (resume from where it failed)",className:"p-1 rounded hover:bg-gray-100",children:c.jsx(re,{className:"w-3.5 h-3.5 text-blue-600"})}),"activated"!==e.status&&c.jsx("button",{onClick:()=>a(e.id),title:"Restart from scratch (deletes user & store, re-runs everything)",className:"p-1 rounded hover:bg-gray-100",children:c.jsx(ce,{className:"w-3.5 h-3.5 text-orange-500"})}),e.store_id&&c.jsx("button",{onClick:()=>o(e.id),title:"Re-run product import (preserves store & branding, re-imports products from Etsy)",className:"p-1 rounded hover:bg-gray-100",children:c.jsx(be,{className:"w-3.5 h-3.5 text-indigo-500"})}),["pending","failed"].includes(e.status)&&c.jsx("button",{onClick:()=>s(e.id),title:"Cancel",className:"p-1 rounded hover:bg-gray-100",children:c.jsx(E,{className:"w-3.5 h-3.5 text-red-500"})}),c.jsx("button",{onClick:()=>d(e=>!e),className:"p-1 rounded hover:bg-gray-100",children:u?c.jsx(h,{className:"w-3.5 h-3.5"}):c.jsx(m,{className:"w-3.5 h-3.5"})})]})})]}),u&&c.jsx("tr",{className:"border-b bg-gray-50",children:c.jsxs("td",{colSpan:7,className:"px-4 py-3 text-xs space-y-1",children:[c.jsxs("div",{children:[c.jsx("span",{className:"font-medium",children:"Store ID:"})," ",e.store_id||"â"]}
13),e.error_step&&c.jsxs("div",{className:"text-red-600",children:[c.jsx("span",{className:"font-medium",children:"Failed at:"})," ",e.error_step," â ",e.error_message]}),e.verification_result&&c.jsxs("div",{children:[c.jsx("span",{className:"font-medium",children:"Verification:"})," ",null==(l=e.verification_result.checks)?void 0:l.map(e=>c.jsxs("span",{className:"mr-2 "+(e.passed?"text-green-700":"text-red-600"),children:[e.passed?"â":"â"," ",e.name]},e.name))]}),e.screenshot_path&&c.jsxs("div",{children:[c.jsx("span",{className:"font-medium",children:"Screenshot:"})," ",e.screenshot_path]}),e.retry_count>0&&c.jsxs("div",{children:[c.jsx("span",{className:"font-medium",children:"Retries:"})," ",e.retry_count]})]})})]})}function gD(){const[e,t]=i.useState([]),[n,r]=i.useState([]),[a,o]=i.useState(!0),[s,l]=i.useState(""),[u,f]=i.useState(""),[p,h]=i.useState(new Set),[m,y]=i.useState(""),[x,g]=i.useState(!1),[v,b]=i.useState(!1),[j,w]=i.useState(null),[N,S]=i.useState(!1);async function O(){o(!0);try{const[e,n]=await Promise.all([We("/batches").then(e=>e.batches),He({status:s||void 0,batchId:u||void 0})]);t(e),r(n)}finally{o(!1)}}async function k(e){try{await(e=>We(`/entries/${e}/retry`,{method:"POST"}))(e),w(`Entry ${e} re-queued (resuming from failure point)`),await O()}catch(t){w(`Retry failed: ${t instanceof Error?t.message:String(t)}`)}}async function A(e){const t=n.find(t=>t.id===e);if(window.confirm(`Restart entry ${null==t?void 0:t.email} from scratch?\n\nThis will:\n⢠Delete the Supabase user\n⢠Wipe the store (products, Docker container, staging files)\n⢠Re-run the full provisioning pipeline\n\nThis cannot be undone.`))try{await(e=>We(`/entries/${e}/restart`,{method:"POST"}))(e),w(`Entry ${e} restarted from scratch`),await O()}catch(r){w(`Restart failed: ${r instanceof Error?r.message:String(r)}`)}}async function E(e){const t=n.find(t=>t.id===e);if(window.confirm(`Re-run product import for ${null==t?void 0:t.email}?\n\nThis will re-import products from Etsy.\nThe store design and .brand-context.json will be preserved.\n\nThe entry will move back to "ready" when done.`))try{await(e=>We(`/entries/${e}/reimport`,{method:"POST"}))(e),w(`Entry ${e} queued for reimport`),await O()}catch(r){w(`Reimport failed: ${r instanceof Error?r.message:String(r)}`)}}async function _(e){try{await(e=>We(`/entries/${e}/cancel`,{method:"POST"}))(e),w(`Entry ${e} cancelled`),await O()}catch(t){w(`Cancel failed: ${t instanceof Error?t.message:String(t)}`)}}async function C(e){if(window.confirm(`Activate all ready entries in batch ${e}?\nThis will send login credentials and start the Store Launch Challenge.`)){b(!0);try{const t=await(e=>We("/activate",{method:"POST",body:JSON.stringify({batchId:e})}))(e);w(`Activated ${t.activated}/${t.activated+t.failed} entries`),await O()}catch(t){w(`Activation failed: ${t instanceof Error?t.message:String(t)}`)}finally{b(!1)}}}function M(e,t){h(n=>{const r=new Set(n);return t?r.add(e):r.delete(e),r})}i.useEffect(()=>{O()},[s,u]);const T=n.filter(e=>"ready"===e.status),D=T.length>0&&T.every(e=>p.has(e.id));return c.jsxs("div",{className:"space-y-6",children:[c.jsxs("div",{className:"flex items-center justify-between flex-wrap gap-3",children:[c.jsxs("div",{children:[c.jsx("h2",{className:"text-lg font-semibold",children:"Waitlist Provisioning"}),c.jsx("p",{className:"text-sm text-muted-foreground",children:"Pre-build stores from Etsy links before activation"})]}),c.jsxs("div",{className:"flex gap-2",children:[c.jsxs("button",{onClick:O,className:"flex items-center gap-1 text-sm px-3 py-1.5 border rounded hover:bg-gray-50",children:[c.jsx(P,{className:"w-3.5 h-3.5"})," Refresh"]}),c.jsx("button",{onClick:()=>S(e=>!e),className:"text-sm px-3 py-1.5 bg-blue-600 text-white rounded hover:bg-blue-700",children:"+ Submit Batch"})]})]}),j&&c.jsxs("div",{className:"text-sm bg-blue-50 border border-blue-200 rounded px-3 py-2 flex justify-between",children:[c.jsx("span",{children:j}),c.jsx("button",{onClick:()=>w(null),className:"ml-4 text-blue-400 hover:text-blue-600",children:"â"})]}),N&&c.jsxs(Y,{children:[c.jsx(J,{children:c.jsx(Z,{className:"text-sm",children:"Submit New Batch"})}),c.jsxs(Q,{className:"space-y-3",children:[c.jsxs("p",{className:"text-xs text-muted-foreground",children:["One entry per line: ",c.jsx("code",{children:"email, https://www.etsy.com/shop/ShopName"})]}),c.jsx("textarea",{value:m,onChange:e=>y(e.target.value),className:"w-full h-32 text-sm font-mono border rounded p-2 resize-y",placeholder:"[email protected], https://www.etsy.com/shop/ShopName"}),c.jsxs("div",{className:"flex gap-2",children:[c.jsx("button",{onClick:async function(){const e=m.trim().split("\n").filter(
13Boolean).map(e=>{const[t,n]=e.split(",").map(e=>e.trim());return{email:t,etsyShopUrl:n}}).filter(e=>e.email&&e.etsyShopUrl);if(!e.length)return w("No valid entries found. Format: email, etsyUrl");g(!0);try{const t=await(e=>We("/batch",{method:"POST",body:JSON.stringify({entries:e})}))(e);w(`Batch submitted: ${t.enqueued}/${t.total} enqueued (batchId: ${t.batchId})`),y(""),S(!1),await O()}catch(t){w(`Error: ${t instanceof Error?t.message:String(t)}`)}finally{g(!1)}},disabled:x||!m.trim(),className:"text-sm px-4 py-2 bg-blue-600 text-white rounded hover:bg-blue-700 disabled:opacity-50",children:x?"Submittingâ¦":"Submit"}),c.jsx("button",{onClick:()=>S(!1),className:"text-sm px-4 py-2 border rounded hover:bg-gray-50",children:"Cancel"})]})]})]}),a?c.jsx("div",{className:"space-y-2",children:[1,2].map(e=>c.jsx(d,{className:"h-16 w-full"},e))}):0===e.length?c.jsx("p",{className:"text-sm text-muted-foreground",children:"No batches yet."}):c.jsxs("div",{children:[c.jsx("h3",{className:"text-sm font-medium mb-2",children:"Batches"}),e.map(e=>c.jsx(yD,{batch:e,onActivate:C,onFilterBatch:e=>{f(e),l("")}},e.batchId))]}),c.jsxs("div",{children:[c.jsxs("div",{className:"flex items-center justify-between flex-wrap gap-3 mb-3",children:[c.jsxs("h3",{className:"text-sm font-medium",children:["Entries ",u&&c.jsxs("span",{className:"text-muted-foreground text-xs",children:["(batch: ",u.slice(-8),")"]})]}),c.jsxs("div",{className:"flex gap-2 items-center",children:[c.jsxs("select",{value:s,onChange:e=>l(e.target.value),className:"text-xs border rounded px-2 py-1.5",children:[c.jsx("option",{value:"",children:"All statuses"}),Object.keys(hD).map(e=>c.jsx("option",{value:e,children:hD[e]},e))]}),u&&c.jsx("button",{onClick:()=>f(""),className:"text-xs text-muted-foreground hover:text-foreground",children:"â Clear batch filter"}),p.size>0&&c.jsxs("button",{onClick:async function(){if(!p.size)return;if(window.confirm(`Activate ${p.size} entries? This will send login credentials and start the Store Launch Challenge.`)){b(!0);try{const t=await(e=Array.from(p),We("/activate",{method:"POST",body:JSON.stringify({entryIds:e})}));w(`Activated ${t.activated}/${t.activated+t.failed} entries`),h(new Set),await O()}catch(t){w(`Activation failed: ${t instanceof Error?t.message:String(t)}`)}finally{b(!1)}var e}},disabled:v,className:"text-xs px-3 py-1.5 bg-green-600 text-white rounded hover:bg-green-700 disabled:opacity-50",children:[c.jsx(de,{className:"inline w-3 h-3 mr-1"}),v?"Activatingâ¦":`Activate ${p.size} selected`]})]})]}),a?c.jsx("div",{className:"space-y-2",children:[1,2,3].map(e=>c.jsx(d,{className:"h-10 w-full"},e))}):0===n.length?c.jsx("p",{className:"text-sm text-muted-foreground",children:"No entries found."}):c.jsx("div",{className:"rounded border overflow-x-auto",children:c.jsxs("table",{className:"w-full text-sm",children:[c.jsx("thead",{children:c.jsxs("tr",{className:"bg-gray-50 border-b text-xs text-muted-foreground",children:[c.jsx("th",{className:"px-3 py-2 w-8",children:c.jsx("input",{type:"checkbox",checked:D,onChange:function(){h(D?new Set:new Set(T.map(e=>e.id)))},className:"rounded",title:"Select all ready"})}),c.jsx("th",{className:"px-3 py-2 text-left",children:"Email"}),c.jsx("th",{className:"px-3 py-2 text-left hidden md:table-cell",children:"Shop"}),c.jsx("th",{className:"px-3 py-2 text-left",children:"Status"}),c.jsx("th",{className:"px-3 py-2 text-center hidden md:table-cell",children:"Products"}),c.jsx("th",{className:"px-3 py-2 text-left hidden md:table-cell",children:"Created"}),c.jsx("th",{className:"px-3 py-2 w-24",children:"Actions"})]})}),c.jsx("tbody",{children:n.map(e=>c.jsx(xD,{entry:e,selected:p.has(e.id),onSelect:M,onRetry:k,onRestart:A,onReiport:E,onCancel:_},e.id))})]})})]})]})}const vD={sent:"bg-green-100 text-green-700",dryrun:"bg-blue-100 text-blue-700",skipped:"bg-gray-100 text-gray-600",failed:"bg-red-100 text-red-700",imported:"bg-purple-100 text-purple-700"};function bD({status:e}){return c.jsx("span",{className:`inline-block px-2 py-0.5 rounded text-xs font-medium ${vD[e]||"bg-gray-100 text-gray-600"}`,children:e})}function jD({label:e,value:t}){return t?c.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded bg-muted text-xs",children:[c.jsxs("span",{className:"text-muted-foreground",children:[e,":"]}
13),c.jsx("span",{className:"font-medium",children:t})]}):null}const wD="h-9 rounded-md border border-input bg-background px-2 text-sm";function ND(e){return e?new Date(e).toLocaleString():"â"}function SD(e,t){return t>0?`${(e/t*100).toFixed(1)}%`:"â"}function OD({html:e}){return c.jsx("iframe",{title:"email preview",sandbox:"",srcDoc:e,className:"w-full h-96 rounded border bg-white"})}function kD({email:e,onOpenContact:t,onRegenerated:n}){var r,a;const[o,s]=i.useState(!1),[l,u]=i.useState(!1),[d,f]=i.useState(null);return c.jsx(Y,{className:"mb-3",children:c.jsxs(Q,{className:"pt-4 space-y-2",children:[c.jsxs("div",{className:"flex items-start justify-between gap-2 flex-wrap",children:[c.jsxs("div",{className:"min-w-0",children:[c.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[c.jsx(bD,{status:e.status}),c.jsx("button",{className:"font-mono text-xs text-blue-600 hover:underline",onClick:()=>t(e.contact_email),children:e.contact_email}),c.jsx("span",{className:"text-xs text-muted-foreground",children:ND(e.created_at)})]}),e.subject&&c.jsx("div",{className:"font-medium mt-1",children:e.subject})]}),c.jsx("div",{className:"flex items-center gap-2",children:n&&"imported"!==e.status&&c.jsxs(S,{size:"sm",variant:"outline",onClick:async()=>{u(!0),f(null);try{const{email:r}=await(t=e.id,Xe(`/mailing/emails/${t}/regenerate`,{method:"POST",body:"{}"}));r&&n?n(e,r):r||f("No email generated (contact may have been skipped)")}catch(r){f(r instanceof Error?r.message:String(r))}finally{u(!1)}var t},disabled:l,children:[c.jsx(re,{className:"h-3 w-3 mr-1 "+(l?"animate-spin":"")}),"Regenerate"]})})]}),c.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[c.jsx(jD,{label:"trigger",value:e.trigger}),c.jsx(jD,{label:"stage",value:e.playbook_stage}),c.jsx(jD,{label:"seq",value:null!=e.sequence_number?String(e.sequence_number):null}),c.jsx(jD,{label:"segment",value:null==(r=e.contact)?void 0:r.source}),c.jsx(jD,{label:"track",value:null==(a=e.contact)?void 0:a.track}),c.jsx(jD,{label:"prompt",value:e.prompt_version}),c.jsx(jD,{label:"model",value:e.model})]}),e.context_summary&&c.jsxs("div",{className:"text-xs bg-amber-50 border border-amber-200 rounded p-2",children:[c.jsx("span",{className:"font-medium text-amber-800",children:"Context: "}),c.jsx("span",{className:"text-amber-900",children:e.context_summary})]}),e.skip_reason&&c.jsxs("div",{className:"text-xs text-gray-600",children:["Skip reason: ",e.skip_reason]}),e.error&&c.jsxs("div",{className:"text-xs text-red-600 flex items-center gap-1",children:[c.jsx(we,{className:"h-3 w-3"})," ",e.error]}),d&&c.jsx("div",{className:"text-xs text-red-600",children:d}),"sent"===e.status&&c.jsxs("div",{className:"flex items-center gap-3 text-xs text-muted-foreground",children:[e.delivered_at&&c.jsxs("span",{children:["delivered ",ND(e.delivered_at)]}),e.opened_at&&c.jsxs("span",{className:"text-green-700",children:["opened ",ND(e.opened_at)]}),e.clicked_at&&c.jsxs("span",{className:"text-blue-700",children:["clicked ",ND(e.clicked_at)]}),e.bounced_at&&c.jsx("span",{className:"text-red-700",children:"bounced"}),e.complained_at&&c.jsx("span",{className:"text-red-700",children:"complained"}),e.unsubscribed_at&&c.jsx("span",{className:"text-red-700",children:"unsubscribed"})]}),e.body_html&&c.jsxs("div",{children:[c.jsx("button",{className:"text-xs text-blue-600 hover:underline",onClick:()=>s(e=>!e),children:o?"Hide rendered email":"Show rendered email"}),o&&c.jsxs("div",{className:"mt-2 space-y-1",children:[c.jsx(OD,{html:e.body_html}),e.cta_label&&c.jsxs("div",{className:"text-xs text-muted-foreground",children:["CTA button: ",c.jsx("span",{className:"font-medium",children:e.cta_label}),e.cta_url&&c.jsxs("span",{className:"ml-1 font-mono break-all",children:["â ",e.cta_url]})]})]})]})]})})}function AD({original:e,regenerated:t,onDismiss:n}){return c.jsxs(Y,{className:"mb-3 border-blue-300",children:[c.jsxs(J,{className:"pb-2 flex-row items-center justify-between space-y-0",children:[c.jsxs(Z,{className:"text-sm",children:["Comparison â ",e.contact_email," (",e.playbook_stage||e.trigger,")"]}),c.jsx(S,{size:"sm",variant:"ghost",onClick:n,children:c.jsx(E,{className:"h-4 w-4"})})]}),c.jsx(Q,{children:c.jsx("div",{className:"grid md:grid-cols-2 gap-3",children:[e,t].map((e,t)=>c.jsxs("div",{className:"space-y-1",children:[c.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[c.jsx("span",{className:"text-xs font-medium",children:0===t?"Original":"Regenerated"}),c.jsx(jD,{label:"prompt",value:e.prompt_version}),c.jsx(bD,{status:e.status})]}),e.subject&&c.jsx("div",{className:"text-sm font-medium",children:e.subject}),e.body_html&&c.jsx(OD,{html:e.body_html}),e.cta_label&&c.jsxs("div",{className:"text-xs text-muted-foreground",children:["CTA: ",e.cta_label]})]},e.id))})})]})}function PD({email:e,onClose:t}){const[n,r]=i.useState(null),[a,o]=i.useState(null),[s,l]=i.useState(!0);return i.useEffect(()=>{l(!0),o(null),(e=>Xe(`/mailing/contacts/${encodeURIComponent(e)}`))(e).then(r).catch(e=>o(e instanceof Error?e.message:String(e))).finally(()=>l(!1))},[e]),c.jsxs(Y,{className:"mb-4 border-blue-300",children:[c.jsxs(J,{className:"pb-2 flex-row items-center justify-between space-y-0",children:[c.jsxs(Z,{className:"text-sm flex items-center gap-2",children:[c.jsx(le,{className:"h-4 w-4"})," Contact timeline â ",e]}),c.jsx(S,{size:"sm",variant:"ghost",onClick:t,children:c.jsx(E,{className:"h-4 w-4"})})]}),c.jsxs(Q,{children:[s&&c.jsx(d,{className:"h-24 w-full"}),a&&c.jsx("div",{className:"text-sm text-red-600",children:a}),n&&c.jsxs("div",{className:"space-y-3",children:[c.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[c.jsx(jD,{label:"track",value:n.contact.track}),c.jsx(jD,{label:"status",value:n.contact.status}),c.jsx(jD,{label:"stage",value:n.contact.stage}),c.jsx(jD,{label:"entry",value:n.contact.entry_mode}),c.jsx(jD,{label:"segment",value:n.contact.source}),c.jsx(jD,{label:"seq",value:String(n.contact.sequence_number)}),c.jsx(jD,{label:"persona",value:n.contact.persona}),c.jsx(jD,{label:"activation",value:n.contact.activation_date}),c.jsx(jD,{label:"last sent",value:n.contact.last_sent_at?ND(n.contact.last_sent_at):null}),c.jsx(jD,{label:"last engaged",value:n.contact.last_engaged_at?ND(n.contact.last_engaged_at):null})]}),n.contact.strategy&&c.jsxs("div",{className:"text-xs bg-muted rounded p-2",children:[c.jsx("span",{className:"font-medium",children:"Strategy: "}),n.contact.strategy]}),c.jsxs("div",{children:[0===n.emails.length&&c.jsx("div",{className:"text-sm text-muted-foreground",children:"No emails yet."}),n.emails.map(e=>c.jsx(kD,{email:e,onOpenContact:()=>{}},e.id))]})]})]})]})}function ED({title:e,counts:t}){const n=Object.entries(t).sort((e,t)=>
13t[1]-e[1]);return c.jsxs("div",{children:[c.jsx("div",{className:"text-xs font-medium text-muted-foreground mb-1",children:e}),0===n.length&&c.jsx("div",{className:"text-xs text-muted-foreground",children:"â"}),n.map(([e,t])=>c.jsxs("div",{className:"flex justify-between text-sm gap-4",children:[c.jsx("span",{className:"truncate",children:e}),c.jsx("span",{className:"font-mono",children:t})]},e))]})}function _D({overview:e}){const t=Object.entries(e.last30d.byTrigger);return c.jsxs("div",{className:"space-y-4",children:[c.jsxs(Y,{children:[c.jsx(J,{className:"pb-2",children:c.jsxs(Z,{className:"text-sm",children:["Contacts â ",e.contacts.total," total, ",e.contacts.pendingActivation," pending activation"]})}),c.jsx(Q,{children:c.jsxs("div",{className:"grid md:grid-cols-3 gap-4",children:[c.jsx(ED,{title:"Track / Status",counts:e.contacts.byTrackStatus}),c.jsx(ED,{title:"Stage",counts:e.contacts.byStage}),c.jsx(ED,{title:"Segment",counts:e.contacts.bySource})]})})]}),c.jsxs(Y,{children:[c.jsx(J,{className:"pb-2",children:c.jsx(Z,{className:"text-sm",children:"Last 30 days by trigger"})}),c.jsxs(Q,{children:[0===t.length&&c.jsx("div",{className:"text-sm text-muted-foreground",children:"No email activity in the last 30 days."}),t.length>0&&c.jsx("div",{className:"overflow-x-auto",children:c.jsxs("table",{className:"w-full text-sm",children:[c.jsx("thead",{children:c.jsxs("tr",{className:"text-left text-xs text-muted-foreground border-b",children:[c.jsx("th",{className:"py-1 pr-3",children:"Trigger"}),c.jsx("th",{className:"py-1 pr-3",children:"Sent"}),c.jsx("th",{className:"py-1 pr-3",children:"Dry-run"}),c.jsx("th",{className:"py-1 pr-3",children:"Skipped"}),c.jsx("th",{className:"py-1 pr-3",children:"Failed"}),c.jsx("th",{className:"py-1 pr-3",children:"Delivered"}),c.jsx("th",{className:"py-1 pr-3",children:"Open %"}),c.jsx("th",{className:"py-1 pr-3",children:"Click %"}),c.jsx("th",{className:"py-1 pr-3",children:"Bounce %"}),c.jsx("th",{className:"py-1 pr-3",children:"Unsub %"})]})}),c.jsx("tbody",{children:t.map(([e,t])=>c.jsxs("tr",{className:"border-b last:border-0",children:[c.jsx("td",{className:"py-1 pr-3 font-medium",children:e}),c.jsx("td",{className:"py-1 pr-3 font-mono",children:t.sent}),c.jsx("td",{className:"py-1 pr-3 font-mono",children:t.dryrun}),c.jsx("td",{className:"py-1 pr-3 font-mono",children:t.skipped}),c.jsx("td",{className:"py-1 pr-3 font-mono",children:t.failed}),c.jsx("td",{className:"py-1 pr-3 font-mono",children:t.delivered}),c.jsx("td",{className:"py-1 pr-3 font-mono",children:SD(t.opened,t.sent)}),c.jsx("td",{className:"py-1 pr-3 font-mono",children:SD(t.clicked,t.sent)}),c.jsx("td",{className:"py-1 pr-3 font-mono",children:SD(t.bounced,t.sent)}),c.jsx("td",{className:"py-1 pr-3 font-mono",children:SD(t.unsubscribed,t.sent)})]},e))})]})})]})]}),c.jsxs("div",{className:"grid md:grid-cols-2 gap-4",children:[c.jsxs(Y,{children:[c.jsx(J,{className:"pb-2",children:c.jsx(Z,{className:"text-sm",children:"Skip reasons (30d)"})}),c.jsx(Q,{children:c.jsx(ED,{title:"",counts:e.last30d.skipReasons})})]}),c.jsxs(Y,{children:[c.jsx(J,{className:"pb-2",children:c.jsx(Z,{className:"text-sm",children:"Daily sends (30d)"})}),c.jsx(Q,{children:c.jsx(ED,{title:"",counts:Object.fromEntries(Object.entries(e.last30d.dailySends).sort((e,t)=>t[0].localeCompare(e[0])))})})]})]})]})}function CD(){const[e,t]=i.useState(null),[n,r]=i.useState(null),[a,o]=i.useState(""),[s,l]=i.useState(!1),[u,f]=i.useState(3),[p,h]=i.useState(""),[m,x]=i.useState(!1),[g,b]=i.useState(null),[j,w]=i.useState(null),[N,O]=i.useState({status:"",segment:"",stage:"",trigger:"",promptVersion:"",contact:""}),[k,A]=i.useState([]),[E,C]=i.useState(!0),[M,T]=i.useState(null),[D,I]=i.useState(null),[R,L]=i.useState(null),B=i.useCallback(()=>{Xe("/mailing/overview").then(e=>{t(e),o(String(e.settings.daily_cap)),r(null)}).catch(e=>r(e instanceof Error?e.message:String(e)))},[]),z=i.useCallback(()=>{C(!0),(e=>{const t=new URLSearchParams;for(const[n,r]of Object.entries(e))void 0!==r&&""!==r&&t.set(n,String(r));return Xe(`/mailing/emails?${t.toString()}`)})({...N.status&&{status:N.status},...N.segment&&{segment:N.segment},...N.stage&&{stage:N.stage},...N.trigger&&{trigger:N.trigger},...N.promptVersion&&{promptVersion:N.promptVersion},...N.contact&&{contact:N.contact.trim()}}).then(e=>{A(e.emails),T(null)}
13).catch(e=>T(e instanceof Error?e.message:String(e))).finally(()=>C(!1))},[N]);i.useEffect(()=>{B()},[B]),i.useEffect(()=>{z()},[z]);const $=i.useMemo(()=>Object.keys((null==e?void 0:e.contacts.bySource)??{}).sort(),[e]),F=i.useMemo(()=>Object.keys((null==e?void 0:e.contacts.byStage)??{}).sort(),[e]),U=i.useMemo(()=>Object.keys((null==e?void 0:e.last30d.byTrigger)??{}).sort(),[e]),q=i.useMemo(()=>[...new Set(k.map(e=>e.prompt_version).filter(e=>!!e))].sort(),[k]),W=(e,t)=>L({original:e,regenerated:t});return c.jsxs("div",{className:"space-y-6",children:[c.jsxs(Y,{children:[c.jsxs(J,{className:"pb-2 flex-row items-center justify-between space-y-0",children:[c.jsxs(Z,{className:"text-sm flex items-center gap-2",children:[c.jsx(v,{className:"h-4 w-4"})," Mailing agent controls"]}),c.jsx(S,{size:"sm",variant:"ghost",onClick:()=>{B(),z()},children:c.jsx(P,{className:"h-4 w-4"})})]}),c.jsxs(Q,{className:"space-y-3",children:[n&&c.jsx("div",{className:"text-sm text-red-600",children:n}),!e&&!n&&c.jsx(d,{className:"h-16 w-full"}),e&&c.jsxs("div",{className:"flex items-center gap-6 flex-wrap",children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("span",{className:"text-sm text-muted-foreground",children:"Mode:"}),c.jsx("span",{className:"px-2 py-0.5 rounded text-xs font-medium "+("live"===e.settings.mode?"bg-green-100 text-green-700":"bg-blue-100 text-blue-700"),children:e.settings.mode}),c.jsxs(S,{size:"sm",variant:"outline",onClick:async()=>{if(!e)return;const t="live"===e.settings.mode?"dryrun":"live";if("live"!==t||window.confirm("Switch the mailing agent to LIVE mode? Emails will actually be sent.")){l(!0);try{await(n=t,Xe("/mailing/mode",{method:"POST",body:JSON.stringify({mode:n})})),B()}catch(a){r(a instanceof Error?a.message:String(a))}finally{l(!1)}var n}},disabled:s,children:["Switch to ","live"===e.settings.mode?"dry-run":"live"]})]}),c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("span",{className:"text-sm text-muted-foreground",children:"Daily cap:"}),c.jsx(_,{className:"h-9 w-24",value:a,onChange:e=>o(e.target.value)}),c.jsx(S,{size:"sm",variant:"outline",onClick:async()=>{const e=Number(a);if(Number.isInteger(e)&&!(e<0)){l(!0);try{await(t=e,Xe("/mailing/cap",{method:"POST",body:JSON.stringify({daily_cap:t})})),B()}catch(n){r(n instanceof Error?n.message:String(n))}finally{l(!1)}var t}},disabled:s||a===String(e.settings.daily_cap),children:"Save"})]}),c.jsxs("a",{href:"/internal-dashboard?tab=agent-registry",className:"text-sm text-blue-600 hover:underline inline-flex items-center gap-1",children:["Edit prompt fragments ",c.jsx(y,{className:"h-3 w-3"})]})]}),c.jsxs("div",{className:"border-t pt-3 space-y-2",children:[c.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[c.jsx("span",{className:"text-sm text-muted-foreground",children:"Generate sample (dry-run):"}),c.jsx("select",{className:wD,value:u,onChange:e=>f(Number(e.target.value)),children:[1,2,3,5,10].map(e=>c.jsxs("option",{value:e,children:[e," per segment"]},e))}),c.jsx(_,{className:"h-9 w-96 max-w-full",placeholder:"or specific emails (comma/space separated)",value:p,onChange:e=>h(e.target.value)}),c.jsxs(S,{size:"sm",onClick:async()=>{x(!0),w(null),b(null);try{const t=p.split(/[\s,;]+/).map(e=>e.trim()).filter(Boolean),n=await(e=t.length>0?{contacts:t}:{sample:{perSegment:u}},Xe("/mailing/dry-run",{method:"POST",body:JSON.stringify(e)}));b(n)}catch(t){w(t instanceof Error?t.message:String(t))}finally{x(!1)}var e},disabled:m,children:[c.jsx(de,{className:"h-3 w-3 mr-1 "+(m?"animate-pulse":"")}),m?"Generatingâ¦":"Generate"]})]}),j&&c.jsx("div",{className:"text-sm text-red-600",children:j}),g&&c.jsxs("div",{className:"space-y-2",children:[c.jsxs("div",{className:"text-xs text-muted-foreground",children:["Run ",g.runId," â ",g.processed.length," contacts processed, ",g.emails.length," emails generated."]}),c.jsx("div",{className:"flex flex-wrap gap-1.5",children:g.processed.map(e=>c.jsxs("span",{className:"text-xs bg-muted rounded px-2 py-0.5",children:[e.email,": ",e.result]},e.email))}),g.emails.map(e=>c.jsx(kD,{email:e,onOpenContact:I,onRegenerated:W},e.id))]})]})]})]}),D&&c.jsx(PD,{email:D,onClose:()=>I(null)}
13),R&&c.jsx(AD,{original:R.original,regenerated:R.regenerated,onDismiss:()=>L(null)}),c.jsxs(Y,{children:[c.jsx(J,{className:"pb-2",children:c.jsx(Z,{className:"text-sm",children:"Review stream"})}),c.jsxs(Q,{className:"space-y-3",children:[c.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[c.jsxs("select",{className:wD,value:N.status,onChange:e=>O(t=>({...t,status:e.target.value})),children:[c.jsx("option",{value:"",children:"All statuses"}),["sent","dryrun","skipped","failed","imported"].map(e=>c.jsx("option",{value:e,children:e},e))]}),c.jsxs("select",{className:wD,value:N.segment,onChange:e=>O(t=>({...t,segment:e.target.value})),children:[c.jsx("option",{value:"",children:"All segments"}),$.map(e=>c.jsx("option",{value:e,children:e},e))]}),c.jsxs("select",{className:wD,value:N.stage,onChange:e=>O(t=>({...t,stage:e.target.value})),children:[c.jsx("option",{value:"",children:"All stages"}),F.map(e=>c.jsx("option",{value:e,children:e},e))]}),c.jsxs("select",{className:wD,value:N.trigger,onChange:e=>O(t=>({...t,trigger:e.target.value})),children:[c.jsx("option",{value:"",children:"All triggers"}),U.map(e=>c.jsx("option",{value:e,children:e},e))]}),c.jsxs("select",{className:wD,value:N.promptVersion,onChange:e=>O(t=>({...t,promptVersion:e.target.value})),children:[c.jsx("option",{value:"",children:"All prompt versions"}),q.map(e=>c.jsx("option",{value:e,children:e},e))]}),c.jsx(_,{className:"h-9 w-64",placeholder:"Filter by contact email",value:N.contact,onChange:e=>O(t=>({...t,contact:e.target.value}))})]}),M&&c.jsx("div",{className:"text-sm text-red-600",children:M}),E&&c.jsx(d,{className:"h-32 w-full"}),!E&&0===k.length&&c.jsx("div",{className:"text-sm text-muted-foreground",children:"No emails match the current filters."}),!E&&k.map(e=>c.jsx(kD,{email:e,onOpenContact:I,onRegenerated:W},e.id))]})]}),e&&c.jsx(_D,{overview:e})]})}const MD=["llm","image_generation","image_edit"],TD=["text","json","array"],DD=["both","user","automatic"],ID=["string","string[]","number","boolean","object","image_url"],RD={tool_name:"",display_name:"",description:"",tool_type:"llm",system_prompt:"",output_field:"",output_format:"text",input_params:[],agents:[],caller_type:"both",enabled:!0,category:null};function LD(e){return"image_generation"===e?"bg-purple-100 text-purple-700":"image_edit"===e?"bg-orange-100 text-orange-700":"bg-blue-100 text-blue-700"}function BD({value:e,onChange:t}){function n(n,r,a){const i=[...e];i[n]={...i[n],[r]:a},t(i)}return c.jsxs("div",{className:"space-y-2",children:[e.map((r,a)=>c.jsxs("div",{className:"flex gap-2 items-start bg-gray-50 border border-gray-200 rounded p-2",children:[c.jsx("input",{className:"w-32 shrink-0 rounded border border-gray-300 px-2 py-1 text-xs font-mono",placeholder:"name",value:r.name,onChange:e=>n(a,"name",e.target.value)}),c.jsx("select",{className:"rounded border border-gray-300 px-1 py-1 text-xs",value:r.type,onCh
13ange:e=>n(a,"type",e.target.value),children:ID.map(e=>c.jsx("option",{value:e,children:e},e))}),c.jsx("input",{className:"flex-1 rounded border border-gray-300 px-2 py-1 text-xs",placeholder:"description",value:r.description,onChange:e=>n(a,"description",e.target.value)}),c.jsxs("label",{className:"flex items-center gap-1 text-xs text-gray-600 shrink-0 mt-1",children:[c.jsx("input",{type:"checkbox",checked:r.required,onChange:e=>n(a,"required",e.target.checked)}),"req"]}),"image_url"===r.type&&c.jsx("span",{className:"text-xs text-purple-600 shrink-0 mt-1",title:"Engine downloads and attaches as vision input",children:"ð"}),c.jsx("button",{onClick:()=>function(n){t(e.filter((e,t)=>t!==n))}(a),className:"p-1 text-gray-400 hover:text-red-500",children:c.jsx(ce,{size:12})})]},a)),c.jsxs("button",{onClick:function(){t([...e,{name:"",type:"string",required:!1,description:""}])},className:"flex items-center gap-1 text-xs text-blue-600 hover:text-blue-800",children:[c.jsx(ie,{size:12})," Add Parameter"]})]})}function zD({value:e,allAgents:t,onChange:n}){return c.jsxs("div",{className:"flex flex-wrap gap-2",children:[t.map(t=>c.jsx("button",{onClick:()=>function(t){e.includes(t)?n(e.filter(e=>e!==t)):n([...e,t])}(t),className:"rounded px-2 py-1 text-xs border transition-colors "+(e.includes(t)?"bg-gray-900 text-white border-gray-900":"bg-white text-gray-600 border-gray-300 hover:border-gray-500"),children:t},t)),0===t.length&&c.jsx("span",{className:"text-xs text-gray-400",children:"Loading agents..."})]})}function $D({onSelect:e}){const[t,n]=i.useState(""),[r,a]=i.useState([]),[o,s]=i.useState(!1),[l,u]=i.useState(null),[d,f]=i.useState(null),[p,m]=i.useState(!1);async function y(){if(t.trim()){s(!0),u(null),a([]),f(null);try{const e=await(e=>Re(`/agent-tools/brand-voices?email=${encodeURIComponent(e)}`))(t.trim());a(e),0===e.length&&u("No stores found for this email")}catch(e){u(e instanceof Error?e.message:"Lookup failed")}finally{s(!1)}}}const x=r.find(e=>e.store_id===d)??null;return c.jsxs("div",{className:"border border-blue-100 bg-blue-50 rounded-lg p-3 space-y-2",children:[c.jsx("p",{className:"text-xs font-medium text-blue-700",children:"Load Brand Voice from Store"}),c.jsxs("div",{className:"flex gap-2",children:[c.jsx("input",{type:"email",className:"flex-1 rounded border border-gray-300 px-2 py-1 text-xs",placeholder:"[email protected]",value:t,onChange:e=>n(e.target.value),onKeyDown:e=>"Enter"===e.key&&y()}),c.jsx("button",{onClick:y,disabled:o||!t.trim(),className:"rounded bg-blue-600 text-white text-xs px-3 py-1 hover:bg-blue-700 disabled:opacity-50",children:o?"â¦":"Look up"})]}),l&&c.jsx("p",{className:"text-xs text-red-600",children:l}),r.length>0&&(()=>{const t=new Set(r.map(e=>e.user_email)).size>1,n={};for(const e of r){const t=e.user_email??"unknown";(n[t]??(n[t]=[])).push(e)}return c.jsx("div",{className:"space-y-2",children:Object.entries(n).map(([n,a])=>c.jsxs("div",{children:[t&&c.jsx("p",{className:"text-xs text-gray-400 mb-1 px-0.5",children:n}),c.jsx("div",{className:"space-y-1",children:a.map(t=>{var n,a;return c.jsxs("button",{onClick:()=>function(t){f(t),m(!1);const n=r.find(e=>e.store_id===t);(null==n?void 0:n.brand_context)&&e(n.brand_context)}(t.store_id),disabled:!t.brand_context,className:"w-full text-left rounded border px-2 py-1.5 text-xs transition-colors "+(d===t.store_id?"bg-blue-600 text-white border-blue-600":t.brand_context?"bg-white border-gray-200 hover:border-blue-400":"bg-gray-50 border-gray-100 text-gray-400 cursor-not-allowed"),children:[c.jsx("span",{className:"font-medium",children:(null==(n=t.brand_context)?void 0:n.projectName)??t.subdomain??t.store_id.slice(0,8)}),(null==(a=t.brand_context)?void 0:a.theme)&&c.jsx("span",{className:"ml-2 opacity-70 font-normal",children:t.brand_context.theme.slice(0,60)}),!t.brand_context&&c.jsx("span",{className:"ml-2 opacity-50",children:"(no brand context)"})]},t.store_id)})})]},n))})})(),(null==x?void 0:x.brand_context)&&c.jsxs("div",{children:[c.jsxs("button",{onClick:()=>m(e=>!e),className:"flex items-center gap-1 text-xs text-blue-600 hover:text-blue-800",children:[p?c.jsx(pe,{size:11}):c.jsx(h,{size:11}),p?"Hide":"View"," brand context JSON"]}),p&&c.jsx("pre",{className:"mt-1 text-xs bg-white border rounded p-2 overflow-auto max-h-48 whitespace-pre-wrap text-gray-700",children:JSON.stringify(x.brand_context,null,2)})]})]})}function FD({tool:e}){const[t,n]=i.useState({}),[r,a]=i.useState(!1),[o,s]=i.useState(null),[l,u]=i.useState(null),[d,f]=i.useState(!1),p=e.input_params.filter(e=>e.name.includes("brand")),m=p.length>0;function y(e,t){n(n=>({...n,[e]:t}))}return c.jsxs("div",{className:"space-y-3 border-t pt-3 mt-3",children:[c.jsx("p",{className:"text-xs font-medium text-gray-500 uppercase tracking-wide",children:"Test Tool"}),m&&c.jsx($D,{onSelect:function(t){for(const e of p)y(e.name,"string"===e.type?JSON.stringify(t):t);e.input_params.find(e=>"brand_name"===e.name&&!e.name.includes("context")&&!e.name.includes("voice"))&&t.projectName&&y("brand_name",t.projectName)}}),0===e.input_params.length&&c.jsx("p",{className:"text-xs text-gray-400",children:"No input parameters defined."}),c.jsx("div",{className:"space-y-2",children:e.input_params.map(e=>c.jsxs("div",{children:[c.jsxs("label",{className:"text-xs text-gray-500 block mb-0.5",children:[e.name,e.required&&c.jsx("span",{className:"text-red-500 ml-0.5",children:"*"}),c.jsxs("span",{className:"text-gray-300 ml-1",children:["(",e.type,")"]})]}),"boolean"===e.type?c.jsx("input",{type:"checkbox",checked:!!t[e.name],onChange:t=>y(e.name,t.target.checked)}):"number"===e.type?c.jsx("input",{type:"number",className:"w-full rounded border border-gray-300 px-2 py-1 text-xs",value:t[e.name]??"",onChange:t=>y(e.name,Number(t.target.value))}):"string[]"===e.type?c.jsx("textarea",{className:"w-full rounded border border-gray-300 px-2 py-1 text-xs resize-y min-h-[3rem]",placeholder:"One item per line",value:Array.isArray(t[e.name])?t[e.name].join("\n"):"",onCh
13ange:t=>y(e.name,t.target.value.split("\n").filter(Boolean))}):"object"===e.type?c.jsx("textarea",{className:"w-full rounded border border-gray-300 px-2 py-1 text-xs font-mono resize-y min-h-[4rem]",placeholder:'{"key": "value"}',value:"object"==typeof t[e.name]?JSON.stringify(t[e.name],null,2):t[e.name]??"",onChange:t=>{try{y(e.name,JSON.parse(t.target.value))}catch{y(e.name,t.target.value)}}}):c.jsx("input",{type:"text",className:"w-full rounded border border-gray-300 px-2 py-1 text-xs",placeholder:"image_url"===e.type?"https://...":e.description,value:t[e.name]??"",onChange:t=>y(e.name,t.target.value)})]},e.name))}),c.jsxs("button",{onClick:async function(){a(!0),u(null),s(null);try{const n=await((e,t)=>Le(`/agent-tools/${e}/test`,{inputs:t}))(e.id,t);s(n)}catch(n){u(n instanceof Error?n.message:"Test failed")}finally{a(!1)}},disabled:r,className:"flex items-center gap-1.5 rounded bg-gray-900 text-white text-xs px-3 py-1.5 hover:bg-gray-700 disabled:opacity-50",children:[c.jsx(de,{size:11}),r?"Running...":"Run Test"]}),l&&c.jsx("p",{className:"text-xs text-red-600",children:l}
13),o&&c.jsxs("div",{className:"space-y-2",children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsxs("span",{className:"text-xs text-green-600 font-medium",children:["â Completed in ",o.execution_time_ms,"ms"]}),c.jsx(x,{className:`text-xs ${LD(o.tool_type)}`,children:o.tool_type})]}),o.preview_url&&c.jsx("img",{src:o.preview_url,alt:"Generated",className:"max-w-xs rounded border"}),c.jsxs("div",{children:[c.jsxs("p",{className:"text-xs font-medium text-gray-500 mb-1",children:["Output (",e.output_field,")"]}),c.jsx("pre",{className:"text-xs bg-gray-50 border rounded p-2 overflow-auto max-h-48 whitespace-pre-wrap",children:JSON.stringify(o.output,null,2)})]}),c.jsxs("button",{onClick:()=>f(e=>!e),className:"flex items-center gap-1 text-xs text-gray-400 hover:text-gray-600",children:[d?c.jsx(pe,{size:12}):c.jsx(h,{size:12}),d?"Hide":"Show"," rendered prompt"]}),d&&c.jsx("pre",{className:"text-xs bg-gray-50 border rounded p-2 overflow-auto max-h-48 whitespace-pre-wrap text-gray-600",children:o.system_prompt_rendered})]})]})}function UD({initial:e,allAgents:t,onSaved:n,onCancel:r,onDeleted:a}){const o=null===e,[s,l]=i.useState(e?{...e}:{...RD}),[u,d]=i.useState(!1),[f,p]=i.useState(!1),[h,m]=i.useState(!1),[y,x]=i.useState(null),[g,v]=i.useState(!1);function b(e,t){l(n=>({...n,[e]:t})),o&&"display_name"===e&&l(e=>{return{...e,display_name:t,tool_name:(n=t,n.toLowerCase().replace(/\s+/g,"_").replace(/[^a-z0-9_]/g,"").replace(/^_+|_+$/g,""))};var n})}const j="image_generation"===s.tool_type||"image_edit"===s.tool_type,w=[...new Set([...s.system_prompt.matchAll(/\{\{#?(\w+)\}\}/g)].map(e=>e[1]).filter(e=>"if"!==e&&"end"!==e))];return c.jsxs("div",{className:"space-y-4",children:[c.jsxs("div",{className:"flex items-center justify-between",children:[c.jsx("h3",{className:"font-semibold text-sm",children:o?"New Tool":"Edit Tool"}),c.jsx("button",{onClick:r,className:"text-gray-400 hover:text-gray-600",children:c.jsx(E,{size:16})})]}),c.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:[c.jsxs("div",{children:[c.jsx("label",{className:"text-xs font-medium text-gray-500 block mb-1",children:"Display Name"}),c.jsx("input",{className:"w-full rounded border border-gray-300 px-2 py-1.5 text-sm",placeholder:"Product Title Writer",value:s.display_name,onChange:e=>b("display_name",e.target.value)})]}),c.jsxs("div",{children:[c.jsx("label",{className:"text-xs font-medium text-gray-500 block mb-1",children:"Tool Name (snake_case)"}),c.jsx("input",{className:"w-full rounded border border-gray-300 px-2 py-1.5 text-sm font-mono "+(o?"":"bg-gray-50 text-gray-400"),placeholder:"product_title_writer",value:s.tool_name,readOnly:!o,onChange:e=>o&&b("tool_name",e.target.value)})]}),c.jsxs("div",{children:[c.jsx("label",{className:"text-xs font-medium text-gray-500 block mb-1",children:"Tool Type"}),c.jsx("select",{className:"w-full rounded border border-gray-300 px-2 py-1.5 text-sm",value:s.tool_type,onChange:e=>b("tool_type",e.target.value),children:MD.map(e=>c.jsx("option",{value:e,children:e},e))}),"image_edit"===s.tool_type&&c.jsx("p",{className:"text-xs text-orange-600 mt-0.5",children:"Requires at least one image_url input param"})]}),c.jsxs("div",{children:[c.jsx("label",{className:"text-xs font-medium text-gray-500 block mb-1",children:"Category"}),c.jsx("input",{className:"w-full rounded border border-gray-300 px-2 py-1.5 text-sm",placeholder:"product_content, seo, homepageâ¦",value:s.category??"",onChange:e=>b("category",e.target.value||null)})]})]}),c.jsxs("div",{children:[c.jsx("label",{className:"text-xs font-medium text-gray-500 block mb-1",children:"Description (shown to the LLM agent)"}),c.jsx("textarea",{className:"w-full rounded border border-gray-300 px-2 py-1.5 text-sm resize-y min-h-[3rem]",placeholder:"Generates a product title from type, features, and brand",value:s.description,onChange:e=>b("description",e.target.value)})]}),c.jsxs("div",{children:[c.jsx("label",{className:"text-xs font-medium text-gray-500 block mb-1",children:j?"Generation Prompt Template":"System Prompt"}),w.length>0&&c.jsxs("p",{className:"text-xs text-gray-400 mb-1",children:["Variables: ",w.map(e=>c.jsx("code",{className:"bg-gray-100 px-1 rounded mx-0.5",children:`{{${e}}}`},e))]}),c.jsx("textarea",{className:"w-full rounded border border-gray-300 px-2 py-1.5 text-sm font-mono resize-y min-h-[8rem]",placeholder:j?"A warm lifestyle photo of {{product_type}}â¦":"You are a {{role}}.\n\nRules:\n- {{rule}}\n\nReturn only the {{output_field}} text.",value:s.system_prompt,onChange:e=>b("system_prompt",e.target.value)}),c.jsxs("p",{className:"text-xs text-gray-400 mt-0.5",children:["Use ",c.jsx("code",{className:"bg-gray-100 px-1 rounded",children:"{{var}}"})," for inputs, ",c.jsx("code",{className:"bg-gray-100 px-1 rounded",children:"{{#if var}}...{{/if}}"})," for conditionals"]})]}),c.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:[c.jsxs("div",{children:[c.jsx("label",{className:"text-xs font-medium text-gray-500 block mb-1",children:"Output Field"}),c.jsx("input",{className:"w-full rounded border border-gray-300 px-2 py-1.5 text-sm font-mono",placeholder:"product_title",value:s.output_field,onChange:e=>b("output_field",e.target.value)})]}),!j&&c.jsxs("div",{children:[c.jsx("label",{className:"text-xs font-medium text-gray-500 block mb-1",children:"Output Format"}),c.jsx("select",{className:"w-full rounded border border-gray-300 px-2 py-1.5 text-sm",value:s.output_format,onChange:e=>b("output_format",e.target.value),children:TD.map(e=>c.jsx("option",{value:e,children:e},e))})]})]}),c.jsxs("div",{children:[c.jsx("label",{className:"text-xs font-medium text-gray-500 block mb-1",children:"Input Parameters"}),c.jsx(BD,{value:s.input_params,onChange:e=>b("input_params",e)})]}),c.jsxs("div",{children:[c.jsx("label",{className:"text-xs font-medium text-gray-500 block mb-1",children:"Agent Access"}),c.jsx(zD,{value:s.agents,allAgents:t,onChange:e=>b("agents",e)})]}),c.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:[c.jsxs("div",{children:[c.jsx("label",{className:"text-xs font-medium text-gray-500 block mb-1",children:"Caller Type"}),c.jsx("select",{className:"w-full rounded border border-gray-300 px-2 py-1.5 text-sm",value:s.caller_type,onCh
13ange:e=>b("caller_type",e.target.value),children:DD.map(e=>c.jsx("option",{value:e,children:"both"===e?"both â user and automatic":"user"===e?"user â free-form chat only":"automatic â system tasks only"},e))})]}),c.jsx("div",{className:"flex items-end pb-1.5",children:c.jsxs("label",{className:"flex items-center gap-2 text-sm cursor-pointer",children:[c.jsx("input",{type:"checkbox",checked:s.enabled,onChange:e=>b("enabled",e.target.checked),className:"rounded"}),"Enabled"]})})]}),y&&c.jsx("p",{className:"text-xs text-red-600",children:y}),c.jsxs("div",{className:"flex items-center justify-between pt-1 border-t",children:[c.jsxs("div",{className:"flex items-center gap-2",children:[!o&&c.jsx(c.Fragment,{children:h?c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("span",{className:"text-xs text-red-600",children:"Sure?"}),c.jsx("button",{onClick:async function(){if(e){p(!0),x(null);try{await(t=e.id,ze(`/agent-tools/${t}`)),null==a||a(e.id)}catch(n){x(n instanceof Error?n.message:"Delete failed"),p(!1)}var t}},disabled:f,className:"rounded bg-red-600 text-white text-xs px-2 py-1 hover:bg-red-700 disabled:opacity-50",children:f?"Deletingâ¦":"Yes, delete"}),c.jsx("button",{onClick:()=>m(!1),className:"text-xs text-gray-500 hover:text-gray-700",children:"Cancel"})]}):c.jsxs("button",{onClick:()=>m(!0),className:"flex items-center gap-1 rounded border border-red-200 text-red-600 text-xs px-2 py-1 hover:bg-red-50",children:[c.jsx(ce,{size:11})," Delete"]})}),!o&&c.jsxs("button",{onClick:()=>v(e=>!e),className:"flex items-center gap-1 rounded border border-gray-200 text-gray-600 text-xs px-2 py-1 hover:bg-gray-50",children:[c.jsx(de,{size:11})," ",g?"Hide Test":"Test"]})]}),c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("button",{onClick:r,className:"text-xs text-gray-500 hover:text-gray-700 px-2 py-1",children:"Cancel"}),c.jsxs("button",{onClick:async function(){d(!0),x(null);try{let r;r=o?await(t=s,Le("/agent-tools",t)):await Ue(e.id,s),n(r)}catch(r){x(r instanceof Error?r.message:"Save failed")}finally{d(!1)}var t},disabled:u,className:"flex items-center gap-1.5 rounded bg-gray-900 text-white text-xs px-3 py-1.5 hover:bg-gray-700 disabled:opacity-50",children:[c.jsx(ue,{size:11}),u?"Savingâ¦":o?"Create":"Save"]})]})]}),g&&e&&c.jsx(FD,{tool:{...e,...s}})]})}function qD({tool:e,allAgents:t,onUpdated:n,onDeleted:r}){const[a,o]=i.useState(!1),[s,l]=i.useState(!1);return a?c.jsx("div",{className:"border rounded-lg p-4 bg-white",children:c.jsx(UD,{initial:e,allAgents:t,onSaved:e=>{n(e),o(!1)},onCancel:()=>o(!1),onDeleted:e=>{r(e),o(!1)}})}):c.jsxs("div",{className:"border rounded-lg p-3 bg-white hover:border-gray-400 cursor-pointer transition-colors",onClick:()=>o(!0),children:[c.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[c.jsx("span",{className:"font-medium text-sm",children:e.display_name}),c.jsx("code",{className:"text-xs text-gray-400 bg-gray-100 px-1.5 py-0.5 rounded font-mono",children:e.tool_name}),c.jsxs(x,{className:`text-xs ${LD(e.tool_type)}`,children:[(u=e.tool_type,"image_generation"===u?c.jsx(xe,{size:12,className:"inline mr-1"}):"image_edit"===u?c.jsx(fe,{size:12,className:"inline mr-1"}):c.jsx(C,{size:12,className:"inline mr-1"})),e.tool_type]}),c.jsx(x,{onClick:async function(t){t.stopPropagation(),l(!0);try{const t=await Ue(e.id,{enabled:!e.enabled});n(t)}finally{l(!1)}},className:`text-xs cursor-pointer transition-opacity hover:opacity-70 ${s?"opacity-50 pointer-events-none":""} ${e.enabled?"bg-green-100 text-green-700":"bg-gray-100 text-gray-500"}`,children:e.enabled?"active":"disabled"}),c.jsx("span",{className:"text-xs text-gray-400 bg-gray-50 border rounded px-1.5 py-0.5",children:e.caller_type}),c.jsx("div",{className:"flex gap-1 flex-wrap ml-auto",children:e.agents.map(e=>c.jsx("span",{className:"text-xs text-gray-500 bg-gray-100 rounded px-1.5 py-0.5",children:e},e))})]}),e.description&&c.jsx("p",{className:"text-xs text-gray-500 mt-1 line-clamp-1",children:e.description})]});var u}function WD(){const[e,t]=i.useState([]),[n,r]=i.useState([]),[a,o]=i.useState(!0),[s,l]=i.useState(null),[u,f]=i.useState(!1),[p,h]=i.useState(""),[m,y]=i.useState(""),[g,v]=i.useState(!1),[b,j]=i.useState(null),w=i.useCallback(()=>{o(!0),Promise.all([Re("/agent-tools"),Re("/agent-tools/agents")]).then(([e,n])=>{t(e),r(n.agents)}).catch(e=>l(e.message)).finally(()=>o(!1))},[]);function N(e){t(t=>t.map(t=>
13t.id===e.id?e:t))}function S(e){t(t=>t.filter(t=>t.id!==e))}i.useEffect(()=>{w()},[w]);const O=[...new Set(e.map(e=>e.category??"uncategorized"))].sort(),k=e.filter(e=>(!p||(e.category??"uncategorized")===p)&&!(m&&!e.agents.includes(m))),A={};for(const i of k){const e=i.category??"uncategorized";(A[e]??(A[e]=[])).push(i)}return c.jsxs("div",{className:"space-y-6",children:[c.jsxs("div",{className:"flex items-center justify-between flex-wrap gap-2",children:[c.jsx("h2",{className:"text-xl font-semibold",children:"Agent Tools"}),c.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[b&&c.jsx("span",{className:"text-xs text-gray-500",children:b}),c.jsxs("button",{onClick:async function(){v(!0),j(null);try{await Le("/agent-tools/cache/invalidate",{}),j("Cache cleared!"),setTimeout(()=>j(null),2e3)}catch(e){j(e instanceof Error?e.message:"Failed")}finally{v(!1)}},disabled:g,className:"flex items-center gap-1.5 rounded border border-gray-300 bg-white text-gray-700 text-xs px-3 py-1.5 hover:bg-gray-50 disabled:opacity-50",children:[c.jsx(P,{size:12,className:g?"animate-spin":""}),"Invalidate Cache"]}),c.jsxs("button",{onClick:()=>f(!0),className:"flex items-center gap-1.5 rounded bg-gray-900 text-white text-xs px-3 py-1.5 hover:bg-gray-700",children:[c.jsx(ie,{size:12})," Add Tool"]})]})]}),e.length>0&&c.jsxs("div",{className:"flex gap-3 items-center",children:[c.jsxs("select",{className:"rounded border border-gray-300 px-2 py-1 text-xs",value:p,onChange:e=>h(e.target.value),children:[c.jsx("option",{value:"",children:"All categories"}),O.map(e=>c.jsx("option",{value:e,children:e},e))]}),c.jsxs("select",{className:"rounded border border-gray-300 px-2 py-1 text-xs",value:m,onChange:e=>y(e.target.value),children:[c.jsx("option",{value:"",children:"All agents"}),n.map(e=>c.jsx("option",{value:e,children:e},e))]}),(p||m)&&c.jsx("button",{onClick:()=>{h(""),y("")},className:"text-xs text-blue-600 hover:text-blue-800",children:"Clear filters"}),c.jsxs("span",{className:"text-xs text-gray-400 ml-auto",children:[k.length," of ",e.length," tools"]})]}),u&&c.jsx(Y,{children:c.jsx(Q,{className:"p-4",children:c.jsx(UD,{initial:null,allAgents:n,onSaved:function(e){t(t=>[...t,e].sort((e,t)=>(e.category??"").localeCompare(t.category??"")||e.tool_name.localeCompare(t.tool_name))),f(!1)},onCancel:()=>f(!1)})})}),a&&c.jsxs("div",{className:"space-y-3",children:[c.jsx(d,{className:"h-16 w-full"}),c.jsx(d,{className:"h-16 w-full"}),c.jsx(d,{className:"h-16 w-full"})]}),s&&c.jsxs("div",{className:"rounded border border-red-200 bg-red-50 p-4 text-sm text-red-700",children:["Failed to load agent tools: ",s]}),!a&&!s&&Object.entries(A).map(([e,t])=>c.jsxs(Y,{children:[c.jsx(J,{className:"pb-2",children:c.jsxs(Z,{className:"text-base flex items-center gap-2",children:[c.jsx("code",{className:"text-sm font-mono bg-gray-100 px-2 py-0.5 rounded",children:e}),c.jsxs(x,{className:"ml-auto bg-gray-100 text-gray-600 text-xs font-normal",children:[t.length," ",1===t.length?"tool":"tools"]})]})}),c.jsx(Q,{className:"space-y-2",children:t.map(e=>c.jsx(qD,{tool:e,allAgents:n,onUpdated:N,onDeleted:S},e.id))})]},e)),!a&&!s&&0===e.length&&c.jsx("div",{className:"text-sm text-gray-500 text-center py-12",children:"No dynamic tools configured. Run the SQL migration to create the table, then add your first tool."})]})}function HD({initial:e,onSaved:t,onCancel:n,onDeleted:r}){const a=null===e,[o,s]=i.useState({name:(null==e?void 0:e.name)??"",dis
13play_name:(null==e?void 0:e.display_name)??"",content:(null==e?void 0:e.content)??"",description:(null==e?void 0:e.description)??""}),[l,u]=i.useState(!1),[d,f]=i.useState(!1),[p,h]=i.useState(!1),[m,y]=i.useState(null);function x(e,t){s(n=>({...n,[e]:t}))}return c.jsxs("div",{className:"space-y-4",children:[c.jsxs("div",{className:"flex items-center justify-between",children:[c.jsx("h3",{className:"font-semibold text-sm",children:a?"New Fragment":`Edit: ${e.name}`}),c.jsx("button",{onClick:n,className:"text-gray-400 hover:text-gray-600",children:c.jsx(E,{size:16})})]}),c.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:[c.jsxs("div",{children:[c.jsx("label",{className:"text-xs font-medium text-gray-500 block mb-1",children:"Name (camelCase identifier)"}),c.jsx("input",{className:"w-full rounded border border-gray-300 px-2 py-1.5 text-sm font-mono "+(a?"":"bg-gray-50 text-gray-400"),placeholder:"safetyRules",value:o.name,readOnly:!a,onChange:e=>a&&x("name",e.target.value)})]}),c.jsxs("div",{children:[c.jsx("label",{className:"text-xs font-medium text-gray-500 block mb-1",children:"Display Name"}),c.jsx("input",{className:"w-full rounded border border-gray-300 px-2 py-1.5 text-sm",placeholder:"Safety Rules",value:o.display_name,onChange:e=>x("display_name",e.target.value)})]})]}),c.jsxs("div",{children:[c.jsx("label",{className:"text-xs font-medium text-gray-500 block mb-1",children:"Description"}),c.jsx("input",{className:"w-full rounded border border-gray-300 px-2 py-1.5 text-sm",placeholder:"Short explanation of what this fragment is for",value:o.description,onChange:e=>x("description",e.target.value)})]}),c.jsxs("div",{children:[c.jsxs("label",{className:"text-xs font-medium text-gray-500 block mb-1",children:["Content",c.jsxs("span",{className:"text-gray-400 font-normal ml-2",children:["â referenced in agent prompts as ",c.jsx("code",{className:"bg-gray-100 px-1 rounded",children:`{{${o.name||"name"}}}`})]})]}),c.jsx("textarea",{className:"w-full rounded border border-gray-300 px-2 py-1.5 text-sm font-mono resize-y min-h-[10rem]",value:o.content,onChange:e=>x("content",e.target.value)})]}),m&&c.jsx("p",{className:"text-xs text-red-600",children:m}),c.jsxs("div",{className:"flex items-center justify-between pt-1 border-t",children:[c.jsx("div",{className:"flex items-center gap-2",children:!a&&(p?c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("span",{className:"text-xs text-red-600",children:"Sure?"}),c.jsx("button",{onClick:async function(){if(e){f(!0),y(null);try{await(t=e.name,ze(`/prompt-fragments/${t}`)),null==r||r(e.name)}catch(n){y(n instanceof Error?n.message:"Delete failed"),f(!1)}var t}},disabled:d,className:"rounded bg-red-600 text-white text-xs px-2 py-1 hover:bg-red-700 disabled:opacity-50",children:d?"Deletingâ¦":"Yes, delete"}),c.jsx("button",{onClick:()=>h(!1),className:"text-xs text-gray-500 hover:text-gray-700",children:"Cancel"})]}):c.jsxs("button",{onClick:()=>h(!0),className:"flex items-center gap-1 rounded border border-red-200 text-red-600 text-xs px-2 py-1 hover:bg-red-50",children:[c.jsx(ce,{size:11})," Delete"]}))}),c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("button",{onClick:n,className:"text-xs text-gray-500 hover:text-gray-700 px-2 py-1",children:"Cancel"}),c.jsxs("button",{onClick:async function(){u(!0),y(null);try{let r;r=a?await(n={name:o.name,display_name:o.display_name||o.name,content:o.content,description:o.description||null},Le("/prompt-fragments",n)):await((e,t)=>Be(`/prompt-fragments/${e}`,t))(e.name,{display_name:o.display_name,content:o.content,description:o.description||null}),t(r)}catch(r){y(r instanceof Error?r.message:"Save failed")}finally{u(!1)}var n},disabled:l,className:"flex items-center gap-1.5 rounded bg-gray-900 text-white text-xs px-3 py-1.5 hover:bg-gray-700 disabled:opacity-50",children:[c.jsx(ue,{size:11}),l?"Savingâ¦":a?"Create":"Save"]})]})]})]})}function VD({fragment:e,onUpdated:t,onDeleted:n}){const[r,a]=i.useState(!1),[o,s]=i.useState(!1);return r?c.jsx("div",{className:"border rounded-lg p-4 bg-white",children:c.jsx(HD,{initial:e,onSaved:e=>{t(e),a(!1)},onCancel:()=>a(!1),onDeleted:e=>{n(e),a(!1)}})}):c.jsxs("div",{className:"border rounded-lg bg-white",children:[c.jsxs("div",{className:"p-3 cursor-pointer hover:bg-gray-50 transition-colors",onClick:()=>a(!0),children:[c.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[c.jsx("code",{className:"text-sm font-mono font-medium",children:e.name}),c.jsx("span",{className:"text-xs text-gray-500",children:e.display_name}),e.used_by.length>0?c.jsx("div",{className:"flex gap-1 flex-wrap ml-auto",children:e.used_by.map(e=>c.jsx(x,{className:"bg-gray-100 text-gray-600 text-xs font-normal",children:e},e))}):c.jsx("span",{className:"text-xs text-gray-400 ml-auto",children:"unused"})]}),e.description&&c.jsx("p",{className:"text-xs text-gray-400 mt-1",children:e.description})]}),c.jsxs("div",{className:"border-t",children:[c.jsxs("button",{onClick:()=>s(e=>!e),className:"flex items-center gap-1 px-3 py-1.5 text-xs text-gray-400 hover:text-gray-600 w-full",children:[o?c.jsx(pe,{size:11}):c.jsx(h,{size:11}),o?"Hide":"Preview"," content"]}),o&&c.jsx("pre",{className:"px-3 pb-3 text-xs font-mono text-gray-600 whitespace-pre-wrap overflow-auto max-h-48 bg-gray-50 border-t",children:e.content})]})]})}function KD(){const[e,t]=i.useState([]),[n,r]=i.useState(!0),[a,o]=i.useState(null),[s,l]=i.useState(!1),u=i.useCallback(()=>{r(!0),qe().then(e=>t(e)).catch(e=>o(e.message)).finally(()=>r(!1))},[]);function f(e){t(t=>t.map(t=>t.name===e.name?e:t))}function p(e){t(t=>t.filter(t=>t.name!==e))}return i.useEffect(()=>{u()},[u]),c.jsxs("div",{className:"space-y-4",children:[c.jsxs("div",{className:"flex items-center justify-between",children:[c.jsxs("div",{children:[c.jsx("h3",{className:"font-semibold text-sm",children:"Prompt Fragments"}),c.jsxs("p",{className:"text-xs text-gray-500 mt-0.5",children:["Reusable blocks referenced in agent prompts as ",c.jsx("code",{className:"bg-gray-100 px-1 rounded",children:"{{fragmentName}}"})]})]}),c.jsxs("button",{onClick:()=>l(!0),className:"flex items-center gap-1.5 rounded bg-gray-900 text-white text-xs px-3 py-1.5 hover:bg-gray-700",children:[c.jsx(ie,{size:12})," Add Fragment"]})]}),s&&c.jsx(Y,{children:c.jsx(Q,{className:"p-4",children:c.jsx(HD,{initial:null,onSaved:function(e){t(t=>[...t,e].sort((e,t)=>
13e.name.localeCompare(t.name))),l(!1)},onCancel:()=>l(!1)})})}),n&&c.jsxs("div",{className:"space-y-2",children:[c.jsx(d,{className:"h-14 w-full"}),c.jsx(d,{className:"h-14 w-full"}),c.jsx(d,{className:"h-14 w-full"})]}),a&&c.jsxs("div",{className:"rounded border border-red-200 bg-red-50 p-3 text-sm text-red-700",children:["Failed to load fragments: ",a]}),!n&&!a&&0===e.length&&!s&&c.jsx("p",{className:"text-sm text-gray-500 text-center py-8",children:"No prompt fragments defined."}),!n&&!a&&c.jsx("div",{className:"space-y-2",children:e.map(e=>c.jsx(VD,{fragment:e,onUpdated:f,onDeleted:p},e.name))})]})}function XD({initial:e,onSaved:t,onCancel:n,onDeleted:r}){const a=null===e,[o,s]=i.useState({topic:(null==e?void 0:e.topic)??"",title:(null==e?void 0:e.title)??"",description:(null==e?void 0:e.description)??"",content:(null==e?void 0:e.content)??"",sort_order:(null==e?void 0:e.sort_order)??0,enabled:(null==e?void 0:e.enabled)??!0}),[l,u]=i.useState(!1),[d,f]=i.useState(!1),[p,h]=i.useState(!1),[m,y]=i.useState(null);function x(e,t){s(n=>({...n,[e]:t}))}return c.jsxs("div",{className:"space-y-4",children:[c.jsxs("div",{className:"flex items-center justify-between",children:[c.jsx("h3",{className:"font-semibold text-sm",children:a?"New Knowledge Module":`Edit: ${e.topic}`}),c.jsx("button",{onClick:n,className:"text-gray-400 hover:text-gray-600",children:c.jsx(E,{size:16})})]}),c.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:[c.jsxs("div",{children:[c.jsx("label",{className:"text-xs font-medium text-gray-500 block mb-1",children:"Topic key (snake_case)"}),c.jsx("input",{className:"w-full rounded border border-gray-300 px-2 py-1.5 text-sm font-mono "+(a?"":"bg-gray-50 text-gray-400"),placeholder:"pricing",value:o.topic,readOnly:!a,onChange:e=>a&&x("topic",e.target.value)})]}),c.jsxs("div",{children:[c.jsx("label",{className:"text-xs font-medium text-gray-500 block mb-1",children:"Title"}),c.jsx("input",{className:"w-full rounded border border-gray-300 px-2 py-1.5 text-sm",placeholder:"Pricing Plans",value:o.title,onChange:e=>x("title",e.target.value)})]})]}),c.jsxs("div",{children:[c.jsx("label",{className:"text-xs font-medium text-gray-500 block mb-1",children:"Description (admin-facing summary)"}),c.jsx("input",{className:"w-full rounded border border-gray-300 px-2 py-1.5 text-sm",placeholder:"Short description for this knowledge module",value:o.description,onChange:e=>x("description",e.target.value)})]}),c.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-3",children:[c.jsxs("div",{children:[c.jsx("label",{className:"text-xs font-medium text-gray-500 block mb-1",children:"Sort order"}),c.jsx("input",{type:"number",className:"w-full rounded border border-gray-300 px-2 py-1.5 text-sm",value:o.sort_order,onChange:e=>x("sort_order",parseInt(e.target.value,10)||0)})]}),c.jsx("div",{className:"flex items-end pb-1.5",children:c.jsxs("label",{className:"flex items-center gap-2 text-sm cursor-pointer select-none",children:[c.jsx("input",{type:"checkbox",checked:o.enabled,onChange:e=>x("enabled",e.target.checked),className:"rounded"}),"Enabled"]})})]}),c.jsxs("div",{children:[c.jsx("label",{className:"text-xs font-medium text-gray-500 block mb-1",children:"Content (markdown)"}),c.jsx("textarea",{className:"w-full rounded border border-gray-300 px-2 py-1.5 text-sm font-mono resize-y min-h-[16rem]",value:o.content,onChange:e=>x("content",e.target.value)})]}),m&&c.jsx("p",{className:"text-xs text-red-600",children:m}),c.jsxs("div",{className:"flex items-center justify-between pt-1 border-t",children:[c.jsx("div",{className:"flex items-center gap-2",children:!a&&(p?c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("span",{className:"text-xs text-red-600",children:"Sure?"}),c.jsx("button",{onClick:async function(){if(e){f(!0),y(null);try{await(t=e.topic,ze(`/product-knowledge/${t}`)),null==r||r(e.topic)}catch(n){y(n instanceof Error?n.message:"Delete failed"),f(!1)}var t}},disabled:d,className:"rounded bg-red-600 text-white text-xs px-2 py-1 hover:bg-red-700 disabled:opacity-50",children:d?"Deletingâ¦":"Yes, delete"}),c.jsx("button",{onClick:()=>h(!1),className:"text-xs text-gray-500 hover:text-gray-700",children:"Cancel"})]}):c.jsxs("button",{onClick:()=>h(!0),className:"flex items-center gap-1 rounded border border-red-200 text-red-600 text-xs px-2 py-1 hover:bg-red-50",children:[c.jsx(ce,{size:11})," Delete"]}))}),c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("button",{onClick:n,className:"text-xs text-gray-500 hover:text-gray-700 px-2 py-1",children:"Cancel"}),c.jsxs("button",{onClick:async function(){u(!0),y(null);try{let r;r=a?await(n={topic:o.topic,title:o.title||o.topic,description:o.description,content:o.content,sort_order:Number(o.sort_order),enabled:o.enabled},Le("/product-knowledge",n)):await((e,t)=>Be(`/product-knowledge/${e}
13`,t))(e.topic,{title:o.title,description:o.description,content:o.content,sort_order:Number(o.sort_order),enabled:o.enabled}),t(r)}catch(r){y(r instanceof Error?r.message:"Save failed")}finally{u(!1)}var n},disabled:l,className:"flex items-center gap-1.5 rounded bg-gray-900 text-white text-xs px-3 py-1.5 hover:bg-gray-700 disabled:opacity-50",children:[c.jsx(ue,{size:11}),l?"Savingâ¦":a?"Create":"Save"]})]})]})]})}function GD({module:e,onUpdated:t,onDeleted:n}){const[r,a]=i.useState(!1),[o,s]=i.useState(!1);return r?c.jsx("div",{className:"border rounded-lg p-4 bg-white",children:c.jsx(XD,{initial:e,onSaved:e=>{t(e),a(!1)},onCancel:()=>a(!1),onDeleted:e=>{n(e),a(!1)}})}):c.jsxs("div",{className:"border rounded-lg bg-white",children:[c.jsxs("div",{className:"p-3 cursor-pointer hover:bg-gray-50 transition-colors",onClick:()=>a(!0),children:[c.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[c.jsx("code",{className:"text-sm font-mono font-medium",children:e.topic}),c.jsx("span",{className:"text-xs text-gray-600 font-medium",children:e.title}),c.jsxs("div",{className:"ml-auto flex items-center gap-2",children:[!e.enabled&&c.jsx(x,{className:"bg-gray-100 text-gray-500 text-xs font-normal",children:"disabled"}),c.jsxs(x,{className:"bg-blue-50 text-blue-600 text-xs font-normal",children:["#",e.sort_order]})]})]}),e.description&&c.jsx("p",{className:"text-xs text-gray-400 mt-1",children:e.description})]}),c.jsxs("div",{className:"border-t",children:[c.jsxs("button",{onClick:()=>s(e=>!e),className:"flex items-center gap-1 px-3 py-1.5 text-xs text-gray-400 hover:text-gray-600 w-full",children:[o?c.jsx(pe,{size:11}):c.jsx(h,{size:11}),o?"Hide":"Preview"," content"]}),o&&c.jsx("pre",{className:"px-3 pb-3 text-xs font-mono text-gray-600 whitespace-pre-wrap overflow-auto max-h-48 bg-gray-50 border-t",children:e.content})]})]})}function YD(){const[e,t]=i.useState([]),[n,r]=i.useState(!0),[a,o]=i.useState(null),[s,l]=i.useState(!1),u=i.useCallback(()=>{r(!0),Re("/product-knowledge").then(e=>t(e)).catch(e=>o(e.message)).finally(()=>r(!1))},[]);function f(e){t(t=>t.map(t=>t.topic===e.topic?e:t))}function p(e){t(t=>t.filter(t=>t.topic!==e))}return i.useEffect(()=>{u()},[u]),c.jsxs("div",{className:"space-y-4",children:[c.jsxs("div",{className:"flex items-center justify-between",children:[c.jsxs("div",{children:[c.jsx("h3",{className:"font-semibold text-sm",children:"Knowledge Base"}),c.jsxs("p",{className:"text-xs text-gray-500 mt-0.5",children:["Platform knowledge returned by the ",c.jsx("code",{className:"bg-gray-100 px-1 rounded",children:"get_product_knowledge"})," tool â pricing, features, limits, interface guidance, support info."]})]}),c.jsxs("button",{onClick:()=>l(!0),className:"flex items-center gap-1.5 rounded bg-gray-900 text-white text-xs px-3 py-1.5 hover:bg-gray-700",children:[c.jsx(ie,{size:12})," Add Module"]})]}),s&&c.jsx(Y,{children:c.jsx(Q,{className:"p-4",children:c.jsx(XD,{initial:null,onSaved:function(e){t(t=>[...t,e].sort((e,t)=>e.sort_order-t.sort_order)),l(!1)},onCancel:()=>l(!1)})})}),n&&c.jsxs("div",{className:"space-y-2",children:[c.jsx(d,{className:"h-14 w-full"}),c.jsx(d,{className:"h-14 w-full"}),c.jsx(d,{className:"h-14 w-full"})]}),a&&c.jsxs("div",{className:"rounded border border-red-200 bg-red-50 p-3 text-sm text-red-700",children:["Failed to load modules: ",a]}),!n&&!a&&0===e.length&&!s&&c.jsx("p",{className:"text-sm text-gray-500 text-center py-8",children:"No knowledge modules defined."}),!n&&!a&&c.jsx("div",{className:"space-y-2",children:e.map(e=>c.jsx(GD,{module:e,onUpdated:f,onDeleted:p},e.topic))})]})}function JD({tools:e}){const[t,n]=i.useState(!1),r=i.useRef(null);return i.useEffect(()=>{if(t)return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e);function e(e){r.current&&!r.current.contains(e.target)&&n(!1)}},[t]),c.jsxs("div",{className:"relative inline-block",ref:r,children:[c.jsx("button",{onClick:()=>n(e=>!e),className:"text-xs text-blue-600 hover:text-blue-800 underline",type:"button",children:t?"hide tools":`view all ${e.length} tools`}),t&&c.jsx("div",{className:"absolute z-50 left-0 top-5 w-80 max-h-64 overflow-y-auto bg-white border border-gray-200 rounded-lg shadow-lg p-2 space-y-1",children:e.map(e=>c.jsxs("div",{className:"text-xs",children:[c.jsx("code",{className:"font-mono font-medium text-gray-800",children:e.name}),e.description&&c.jsx("p",{className:"text-gray-500 mt-0.5 truncate",children:e.description})]},e.name))})]})}function ZD({value:e,allTools:t,onChange:n}){const[r,a]=i.useState("");function o(){const t=r.trim();t&&!e.includes(t)?(n([...e,t]),a("")):a("")}const s=new Map(t.map(e=>[e.name,e.description]));return c.jsxs("div",{className:"space-y-2",children:[c.jsxs("div",{className:"flex flex-wrap gap-1",children:[e.map(t=>c.jsxs("span",{title:s.get(t)||"",className:"inline-flex items-center gap-1 bg-gray-100 border border-gray-200 rounded px-2 py-0.5 text-xs font-mono",children:[t,c.jsx("button",{onClick:()=>function(t){n(e.filter(e=>e!==t))}(t),className:"text-gray-400 hover:text-red-500 ml-0.5",children:c.jsx(E,{size:10})})]},t)),0===e.length&&c.jsx("span",{className:"text-xs text-gray-400",children:"No tools â add below or use tool filter"})]}),c.jsxs("div",{className:"flex gap-2",children:[c.jsx("input",{className:"flex-1 rounded border border-gray-300 px-2 py-1 text-xs font-mono",placeholder:"tool_name",value:r,onChange:e=>a(e.target.value),onKeyDown:e=>"Enter"===e.key&&(e.preventDefault(),o()),list:"tool-suggestions"}),c.jsx("datalist",{id:"tool-suggestions",children:t.map(e=>c.jsx("option",{value:e.name},e.name))}),c.jsx("button",{onClick:o,type:"button",className:"rounded border border-gray-300 px-2 py-1 text-xs hover:bg-gray-50",children:c.jsx(ie,{size:12})})]}),t.length>0&&c.jsx(JD,{tools:t})]})}function QD({value:e,allAgents:t,selfName:n,onChange:r}){const a=t.filter(e=>e.name!==n&&e.enabled);return c.jsxs("div",{className:"flex flex-wrap gap-2",children:[a.map(t=>c.jsx("button",{type:"button",onClick:()=>{return n=t.name,void(e.includes(n)?r(e.filter(e=>e!==n)):r([...e,n]));var n},title:t.description,className:"rounded px-2 py-1 text-xs border transition-colors "+(e.includes(t.name)?"bg-gray-900 text-white border-gray-900":"bg-white text-gray-600 border-gray-300 hover:border-gray-500"),children:t.name}
13,t.name)),0===a.length&&c.jsx("span",{className:"text-xs text-gray-400",children:"No other enabled agents available"})]})}function eI({agents:e}){const t=new Map(e.map(e=>[e.name,e])),n=new Set(e.flatMap(e=>e.child_agents)),r=e.filter(e=>!n.has(e.name));function a(e,n){const r=t.get(e);return r?c.jsxs("div",{style:{paddingLeft:16*n},className:"py-0.5",children:[c.jsx("span",{className:"text-xs font-mono "+(r.enabled?"text-gray-800":"text-gray-400 line-through"),children:e}),r.channel_prefix&&c.jsxs("span",{className:"text-xs text-gray-400 ml-2",children:["(",r.channel_prefix,")"]}),r.child_agents.map(e=>a(e,n+1))]},e):null}return c.jsxs("div",{className:"bg-gray-50 border rounded p-3 text-xs font-mono space-y-0.5",children:[c.jsx("p",{className:"text-xs text-gray-500 font-sans mb-2",children:"Agent hierarchy"}),r.map(e=>a(e.name,0))]})}function tI({initial:e,allAgents:t,allTools:n,allFragments:r,onSaved:a,onCancel:o,onDeleted:s}){const l=null===e,[u,d]=i.useState(e?{...e}:{name:"",description:"",role:"",specific_content:"",direct_tools:[],child_agents:[],tool_filter_pattern:null,channel_prefix:null,sort_order:0,enabled:!0}),[f,p]=i.useState(!1),[m,y]=i.useState(!1),[x,g]=i.useState(!1),[v,b]=i.useState(null),[j,w]=i.useState(!1),N=i.useRef(null);function S(e,t){d(n=>({...n,[e]:t}))}return c.jsxs("div",{className:"space-y-4",children:[c.jsxs("div",{className:"flex items-center justify-between",children:[c.jsx("h3",{className:"font-semibold text-sm",children:l?"New Agent":`Edit: ${e.name}`}),c.jsx("button",{onClick:o,className:"text-gray-400 hover:text-gray-600",children:c.jsx(E,{size:16})})]}),c.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:[c.jsxs("div",{children:[c.jsx("label",{className:"text-xs font-medium text-gray-500 block mb-1",children:"Name (snake_case)"}),c.jsx("input",{className:"w-full rounded border border-gray-300 px-2 py-1.5 text-sm font-mono "+(l?"":"bg-gray-50 text-gray-400"),placeholder:"my_agent",value:u.name,readOnly:!l,onChange:e=>l&&S("name",e.target.value)})]}),c.jsxs("div",{children:[c.jsx("label",{className:"text-xs font-medium text-gray-500 block mb-1",children:"Channel Prefix"}),c.jsx("input",{className:"w-full rounded border border-gray-300 px-2 py-1.5 text-sm font-mono",placeholder:"shop-builder",value:u.channel_prefix??"",onChange:e=>S("channel_prefix",e.target.value||null)})]})]}),c.jsxs("div",{children:[c.jsx("label",{className:"text-xs font-medium text-gray-500 block mb-1",children:"Description (shown to parent agent as delegation tool description)"}),c.jsx("textarea",{className:"w-full rounded border border-gray-300 px-2 py-1.5 text-sm resize-y min-h-[3rem]",value:u.description,onChange:e=>S("description",e.target.value)})]}),c.jsxs("div",{children:[c.jsx("label",{className:"text-xs font-medium text-gray-500 block mb-1",children:"Role (first line of system prompt)"}),c.jsx("textarea",{className:"w-full rounded border border-gray-300 px-2 py-1.5 text-sm resize-y min-h-[3rem]",value:u.role,onChange:e=>S("role",e.target.value)})]}),c.jsxs("div",{children:[c.jsxs("div",{className:"flex items-center justify-between mb-1",children:[c.jsxs("label",{className:"text-xs font-medium text-gray-500",children:["Specific Content (agent instructions â use ",c.jsx("code",{className:"bg-gray-100 px-1 rounded",children:"{{fragmentName}}"}),")"]}),c.jsxs("button",{type:"button",onClick:()=>w(e=>!e),className:"flex items-center gap-1 text-xs text-blue-600 hover:text-blue-800",children:[j?c.jsx(pe,{size:11}):c.jsx(h,{size:11}),"Fragments"]})]}),j&&r.length>0&&c.jsx("div",{className:"mb-2 flex flex-wrap gap-1.5 bg-blue-50 border border-blue-100 rounded p-2",children:r.map(e=>c.jsx("button",{type:"button",onClick:()=>function(e){const t=`{{${e}}}`,n=N.current;if(!n)return void S("specific_content",u.specific_content+"\n"+t);const r=n.selectionStart??u.specific_content.length,a=n.selectionEnd??r,i=u.specific_content.slice(0,r),o=u.specific_content.slice(a);S("specific_content",i+t+o),requestAnimationFrame(()=>{n.focus(),n.setSelectionRange(r+t.length,r+t.length)})}(e.name),title:e.description??e.display_name,className:"text-xs bg-white border border-blue-200 rounded px-2 py-0.5 hover:bg-blue-100 font-mono",children:`{{${e.name}}}`},e.name))}),c.jsx("textarea",{ref:N,className:"w-full rounded border border-gray-300 px-2 py-1.5 text-sm font-mono resize-y min-h-[10rem]",value:u.specific_content,onChange:e=>S("specific_content",e.target.value)})]}),c.jsxs("div",{children:[c.jsx("label",{className:"text-xs font-medium text-gray-500 block mb-1",children:"Direct Tools"}),c.jsx(ZD,{value:u.direct_tools,allTools:n,onChange:e=>S("direct_tools",e)})]}),c.jsxs("div",{children:[c.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[c.jsx("label",{className:"text-xs font-medium text-gray-500",children:"Tool Filter Pattern (DSL)"}),c.jsxs("div",{className:"relative group",children:[c.jsx("button",{type:"button",className:"text-xs text-gray-400 hover:text-gray-600 underline",children:"?"}),c.jsxs("div",{className:"absolute left-0 top-5 z-50 hidden group-hover:block w-96 bg-gray-900 text-gray-100 text-xs rounded p-3 shadow-xl whitespace-pre font-mono leading-relaxed",children:["Filter DSL â comma-separated rules (AND for negations, OR for positives):\n startsWith:prefix name starts with prefix\n not_startsWith:prefix name does NOT start with prefix\n includes:str name contains str\n not_includes:str name does NOT contain str\n equals:name exact match\n not_equals:name not exact match\n\nExamples:\n startsWith:medusa_,equals:generate_image,equals:respond_to_user\n includes:-,equals:respond_to_user\n not_startsWith:medusa_,not_includes:-",n.length>0&&c.jsxs(c.Fragment,{children:["\n\nAvailable tool names:\n",n.map(e=>` ${e.name}${e.description?" â "+e.description.slice(0,50):""}`).join("\n")]})]})]})]}),c.jsx("input",{className:"w-full rounded border border-gray-300 px-2 py-1.5 text-sm font-mono",placeholder:"startsWith:medusa_,equals:respond_to_user",value:u.tool_filter_pattern??"",onChange:e=>S("tool_filter_pattern",e.target.value||null)}),c.jsx("p",{className:"text-xs text-gray-400 mt-0.5",children:"Leave empty if using direct_tools only. Hover ? for DSL syntax."})]}),c.jsxs("div",{children:[c.jsx("label",{className:"text-xs font-medium text-gray-500 block mb-1",children:"Child Agents"}),c.jsx(QD,{value:u.child_agents,allAgents:t,selfName:u.name,onChange:e=>S("child_agents",e)})]}),c.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:[c.jsxs("div",{children:[c.jsx("label",{className:"text-xs font-medium text-gray-500 block mb-1",children:"Sort Order"}),c.jsx("input",{type:"number",className:"w-full rounded border border-gray-300 px-2 py-1.5 text-sm",value:u.sort_order,onChange:e=>S("sort_order",Number(e.target.value))})]}),c.jsxs("div",{className:"flex items-end pb-1.5",children:[c.jsxs("label",{className:"flex items-center gap-2 text-sm cursor-pointer",children:[c.jsx("input",{type:"checkbox",checked:u.enabled,onChange:e=>S("enabled",e.target.checked),disabled:"orchestrator"===u.name,className:"rounded"}),"Enabled"]}),!u.enabled&&c.jsxs("span",{className:"ml-2 flex items-center gap-1 text-xs text-amber-600",children:[c.jsx(we,{size:11})," Disabling removes from parent agent child lists"]})]})]}),v&&c.jsx("p",{className:"text-xs text-red-600",children:v}),c.jsxs("div",{className:"flex items-center justify-between pt-1 border-t",children:[c.jsx("div",{className:"flex items-center gap-2",children:!l&&"orchestrator"!==u.name&&(x?c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("span",{className:"text-xs text-red-600",children:"Sure?"}),c.jsx("button",{onClick:async function(){if(e){y(!0),b(null);try{await(t=e.name,ze(`/agent-registry/${t}`)),null==s||s(e.name)}catch(n){b(n instanceof Error?n.message:"Delete failed"),y(!1)}var t}},disabled:m,className:"rounded bg-red-600 text-white text-xs px-2 py-1 hover:bg-red-700 disabled:opacity-50",children:m?"Deletingâ¦":"Yes, delete"}),c.jsx("button",{onClick:()=>g(!1),className:"text-xs text-gray-500 hover:text-gray-700",children:"Cancel"})]}):c.jsxs("button",{onClick:()=>g(!0),className:"flex items-center gap-1 rounded border border-red-200 text-red-600 text-xs px-2 py-1 hover:bg-red-50",children:[c.jsx(ce,{size:11})," Delete"]}))}),c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("button",{onClick:o,className:"text-xs text-gray-500 hover:text-gray-700 px-2 py-1",children:"Cancel"}),c.jsxs("button",{onClick:async function(){p(!0),b(null);try{let n;n=l?await(t=u,Le("/agent-registry",t)):await((e,t)=>Be(`/agent-registry/${e}`,t))(e.name,u),a(n)}catch(n){b(n instanceof Error?n.message:"Save failed")}finally{p(!1)}var t},disabled:f,className:"flex items-center gap-1.5 rounded bg-gray-900 text-white text-xs px-3 py-1.5 hover:bg-gray-700 disabled:opacity-50",children:[c.jsx(ue,{size:11}),f?"Savingâ¦":l?"Create":"Save"]})]})]})]})}function nI({agent:e,allAgents:t,allTools:n,allFragments:r,onUpdated:a,onDeleted:o}){const[s,l]=i.useState(!1);return s?c.jsx("div",{className:"border rounded-lg p-4 bg-white",children:c.jsx(tI,{initial:e,allAgents:t,allTools:n,allFragments:r,onSaved:e=>{a(e),l(!1)},onCancel:()=>l(!1),onDeleted:e=>{o(e),l(!1)}})}):c.jsxs("div",{className:"border rounded-lg p-3 bg-white hover:border-gray-400 cursor-pointer transition-colors "+(e.enabled?"":"opacity-60"),onClick:()=>l(!0),children:[c.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[c.jsx("code",{className:"font-mono font-medium text-sm",children:e.name}),e.channel_prefix&&c.jsx("span",{className:"text-xs text-gray-400 bg-gray-100 border rounded px-1.5 py-0.5 font-mono",children:e.channel_prefix}),e.enabled?c.jsx(x,{className:"bg-green-100 text-green-700 text-xs",children:"active"}):c.jsx(x,{className:"bg-gray-100 text-gray-500 text-xs",children:"disabled"}),e.tool_filter_pattern&&c.jsx(x,{className:"bg-purple-100 text-purple-700 text-xs",children:"filter"}),c.jsx("div",{className:"flex gap-1 flex-wrap ml-auto",children:e.child_agents.map(e=>c.jsx("span",{className:"text-xs text-gray-500 bg-gray-100 rounded px-1.5 py-0.5",children:e},e))})]}),e.description&&c.jsx("p",{className:"text-xs text-gray-500 mt-1 line-clamp-1",children:e.description}),e.direct_tools.length>0&&c.jsxs("p",{className:"text-xs text-gray-400 mt-0.5",children:[e.direct_tools.length," direct tools"]})]})}const rI=164,aI=46,iI=18,oI=4,sI=8,lI=44,cI=82,uI=48,dI=8,fI=[{bg:"#0f766e",fg:"#ffffff"},{bg:"#1d4ed8",fg:"#ffffff"}
13,{bg:"#7c3aed",fg:"#ffffff"},{bg:"#b45309",fg:"#ffffff"},{bg:"#be185d",fg:"#ffffff"},{bg:"#0369a1",fg:"#ffffff"},{bg:"#15803d",fg:"#ffffff"},{bg:"#c2410c",fg:"#ffffff"},{bg:"#4338ca",fg:"#ffffff"},{bg:"#0e7490",fg:"#ffffff"},{bg:"#a21caf",fg:"#ffffff"},{bg:"#b91c1c",fg:"#ffffff"}];function pI(e,t,n){const r=new Map(e.map((e,t)=>[e,t])),a=new Map(t.map((e,t)=>[e,t])),i=n.filter(([e,t])=>r.has(e)&&a.has(t));let o=0;for(let s=0;s<i.length;s++)for(let e=s+1;e<i.length;e++){const t=r.get(i[s][0]),n=a.get(i[s][1]);(t-r.get(i[e][0]))*(n-a.get(i[e][1]))<0&&o++}return o}function hI(e,t){if(0===e.length)return{nodes:[],w:0,h:0};const n=new Map;function r(t,a=new Set){if(n.has(t))return n.get(t);if(a.has(t))return 0;a.add(t);const i=e.filter(e=>e.child_agents.includes(t)),o=(0===i.length?-1:Math.max(...i.map(e=>r(e.name,new Set(a)))))+1;return n.set(t,o),o}e.forEach(e=>r(e.name));const a=new Map;for(const m of e){const e=n.get(m.name)??0;a.has(e)||a.set(e,[]),a.get(e).push(m)}for(const m of a.values())m.sort((e,t)=>e.sort_order-t.sort_order);const i=Math.max(...a.keys())+1,o=function(e,t,n){const r=Array.from({length:t},(t,n)=>(e.get(n)??[]).map(e=>e.name)),a=new Map;for(const c of e.values())c.forEach(e=>a.set(e.name,e));function i(e,t,r){const a=("parents"===r?n.filter(([t,n])=>n===e).map(([e])=>e):n.filter(([t,n])=>t===e).map(([,e])=>e)).map(e=>t.indexOf(e)).filter(e=>-1!==e);return 0===a.length?-1:a.reduce((e,t)=>e+t,0)/a.length}let o=r.map(e=>[...e]),s=r.slice(1).reduce((e,t,a)=>e+pI(r[a],t,n),0);for(let c=0;c<6;c++){if(c%2==0)for(let n=1;n<t;n++){const e=r[n].map(e=>({name:e,score:i(e,r[n-1],"parents")}));e.sort((e,t)=>-1===e.score&&-1===t.score?0:-1===e.score?1:-1===t.score?-1:e.score-t.score),r[n]=e.map(e=>e.name)}else for(let n=t-2;n>=0;n--){const e=r[n].map(e=>({name:e,score:i(e,r[n+1],"children")}));e.sort((e,t)=>-1===e.score&&-1===t.score?0:-1===e.score?1:-1===t.score?-1:e.score-t.score),r[n]=e.map(e=>e.name)}const e=r.slice(1).reduce((e,t,a)=>e+pI(r[a],t,n),0);e<s&&(s=e,o=r.map(e=>[...e]))}const l=new Map;return o.forEach((e,t)=>{l.set(t,e.map(e=>a.get(e)).filter(Boolean))}),l}(a,i,e.flatMap(e=>e.child_agents.map(t=>[e.name,t])));function s(e){const t=[];if(e.tool_filter_pattern){const n=e.tool_filter_pattern.length>26?e.tool_filter_pattern.slice(0,24)+"â¦":e.tool_filter_pattern;t.push({label:`â¡ ${n}`,full:!0})}const n=e.direct_tools.filter(e=>"respond_to_user"!==e);n.slice(0,dI).forEach(e=>t.push({label:e,full:!1}));const r=n.length-Math.min(n.length,dI);r>0&&t.push({label:`+${r} more`,full:!0});const a=[];let i=0;for(;i<t.length;)t[i].full?(a.push([t[i].label]),i++):i+1<t.length&&!t[i+1].full?(a.push([t[i].label,t[i+1].label]),i+=2):(a.push([t[i].label]),i++);return a}function l(e){return 0===e.length?0:sI+e.length*(iI+oI)}const c=new Map;for(const[m,y]of o)c.set(m,Math.max(0,...y.map(e=>l(s(e)))));let u=0;for(const m of o.values())u=Math.max(u,2*uI+m.length*rI+(m.length-1)*lI);const d=[];let f=uI;for(let m=0;m<i;m++)d.push(f),f+=aI+(c.get(m)??0)+cI;const p=f-cI+uI,h=[];for(const[m,y]of o){const e=(u-(y.length*rI+(y.length-1)*lI))/2;y.forEach((n,r)=>{const a=s(n);h.push({agent:n,cx:e+r*(rI+lI)+rI/2,y:d[m],layer:m,toolRows:a,toolsH:l(a),color:t.get(n.name)??{bg:"#6b7280",fg:"#ffffff"}})})}return{nodes:h,w:u,h:p}}function mI({agents:e}){const t=i.useMemo(()=>e.filter(e=>e.enabled),[e]),n=i.useMemo(()=>{const e=[...t].sort((e,t)=>e.sort_order-t.sort_order||e.name.localeCompare(t.name)),n=new Map;return e.forEach((e,t)=>n.set(e.name,fI[t%fI.length])),n},[t]),{nodes:r,w:a,h:o}=i.useMemo(()=>hI(t,n),[t,n]);if(0===r.length)return null;const s=new Map(r.map(e=>[e.agent.name,e])),l=r.flatMap(e=>e.agent.child_agents.map(e=>s.get(e)).filter(Boolean).map(t=>({from:e,to:t,color:e.color.bg}))),u=[...new Set(l.map(e=>e.color))],d=e=>`gv-arrow-${e.replace("#","")}`;return c.jsxs("div",{className:"rounded-lg border border-gray-200 bg-gray-50 overflow-hidden",children:[c.jsxs("div",{className:"px-4 py-2.5 border-b border-gray-200 bg-white flex items-center gap-3 flex-wrap",children:[c.jsx("span",{className:"text-sm font-medium text-gray-700",children:"Full Graph â Active Agents & Tools"}),c.jsx("div",{className:"flex items-center gap-2 ml-auto flex-wrap",children:r.map(e=>c.jsxs("span",{className:"flex items-center gap-1 text-xs text-gray-600",children:[c.jsx("svg",{width:"10",height:"10",children:c.jsx("rect",{x:"0",y:"0",width:"10",height:"10",rx:"2",fill:e.color.bg})}),e.agent.name]},e.agent.name))})]}),c.jsx("div",{className:"overflow-x-auto",children:c.jsxs("svg",{width:a,height:o,viewBox:`0 0 ${a} ${o}`,className:"block",style:{minWidth:a},children:[c.jsx("defs",{children:u.map(e=>c.jsx("marker",{id:d(e),markerWidth:"8",markerHeight:"6",refX:"7",refY:"3",orient:"auto",children:c.jsx("polygon",{points:"0 0, 8 3, 0 6",fill:e})},e))}),l.map(({from:e,to:t,color:n},r)=>{const a=e.cx,i=e.y+aI+e.toolsH,o=t.cx,s=t.y,l=.45*(s-i);return c.jsx("path",{d:`M ${a} ${i} C ${a} ${i+l}, ${o} ${s-l}, ${o} ${s}
13`,fill:"none",stroke:n,strokeWidth:"1.75",opacity:.75,markerEnd:`url(#${d(n)})`},r)}),r.map(e=>{const{bg:t,fg:n}=e.color,r=e.cx-rI/2,a=!!e.agent.channel_prefix;return c.jsxs("g",{children:[c.jsx("rect",{x:r,y:e.y,width:rI,height:aI,rx:8,fill:t}),c.jsx("text",{x:e.cx,y:e.y+aI/2-(a?7:0),textAnchor:"middle",dominantBaseline:"middle",fill:n,fontSize:12.5,fontFamily:"ui-monospace, SFMono-Regular, monospace",fontWeight:"600",children:e.agent.name}),a&&c.jsx("text",{x:e.cx,y:e.y+aI/2+9,textAnchor:"middle",dominantBaseline:"middle",fill:n,opacity:.55,fontSize:9,fontFamily:"ui-sans-serif, system-ui, sans-serif",children:e.agent.channel_prefix}),e.toolRows.length>0&&c.jsx("line",{x1:e.cx,y1:e.y+aI,x2:e.cx,y2:e.y+aI+sI-1,stroke:"#d1d5db",strokeWidth:1}),e.toolRows.map((t,n)=>{const a=e.y+aI+sI+n*(iI+oI),i=1===t.length&&t[0].startsWith("â¡"),o=1===t.length&&t[0].startsWith("+");if(1===t.length){const s=i?"#ede9fe":"#f3f4f6",l=i?"#6d28d9":"#6b7280",u=i?"#c4b5fd":"#e5e7eb";return c.jsxs("g",{children:[c.jsx("rect",{x:r+4,y:a,width:rI-8,height:iI,rx:4,fill:s,stroke:u,strokeWidth:.5}),c.jsx("text",{x:e.cx,y:a+iI/2,textAnchor:"middle",dominantBaseline:"middle",fill:l,fontSize:9,fontFamily:i?"ui-monospace, monospace":"ui-sans-serif, sans-serif",fontStyle:o?"italic":"normal",children:t[0]})]},n)}const s=(rI-8-4)/2;return c.jsx("g",{children:t.map((e,t)=>{const n=r+4+t*(s+4),i=e.length>13?e.slice(0,12)+"â¦":e;return c.jsxs("g",{children:[c.jsx("rect",{x:n,y:a,width:s,height:iI,rx:4,fill:"#f3f4f6",stroke:"#e5e7eb",strokeWidth:.5}),c.jsx("text",{x:n+s/2,y:a+iI/2,textAnchor:"middle",dominantBaseline:"middle",fill:"#374151",fontSize:8.5,fontFamily:"ui-monospace, SFMono-Regular, monospace",children:i})]},t)})},n)})]},e.agent.name)})]})})]})}function yI(){const[e,t]=i.useState([]),[n,r]=i.useState([]),[a,o]=i.useState([]),[s,l]=i.useState(!0),[u,f]=i.useState(null),[p,h]=i.useState(!1),[m,y]=i.useState(!1),[g,v]=i.useState(null),b=i.useCallback(()=>{l(!0),Promise.all([Re("/agent-registry"),Re("/agent-registry/tools"),qe()]).then(([e,n,a])=>{t(e),r(n),o(a)}).catch(e=>f(e.message)).finally(()=>l(!1))},[]);function j(e){t(t=>t.map(t=>t.name===e.name?e:t))}function w(e){t(t=>t.filter(t=>t.name!==e))}return i.useEffect(()=>{b()},[b]),c.jsxs("div",{className:"space-y-6",children:[c.jsxs("div",{className:"flex items-center justify-between flex-wrap gap-2",children:[c.jsx("h2",{className:"text-xl font-semibold",children:"Agent Registry"}),c.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[g&&c.jsx("span",{className:"text-xs text-gray-500",children:g}),c.jsxs("button",{onClick:async function(){y(!0),v(null);try{await Le("/agent-registry/cache/invalidate",{}),v("Cache cleared!"),setTimeout(()=>v(null),2e3)}catch(e){v(e instanceof Error?e.message:"Failed")}finally{y(!1)}},disabled:m,className:"flex items-center gap-1.5 rounded border border-gray-300 bg-white text-gray-700 text-xs px-3 py-1.5 hover:bg-gray-50 disabled:opacity-50",children:[c.jsx(P,{size:12,className:m?"animate-spin":""}),"Invalidate Cache"]}),c.jsxs("button",{onClick:()=>h(!0),className:"flex items-center gap-1.5 rounded bg-gray-900 text-white text-xs px-3 py-1.5 hover:bg-gray-700",children:[c.jsx(ie,{size:12})," New Agent"]})]})]}),!s&&!u&&e.length>0&&c.jsx(eI,{agents:e}),p&&c.jsx(Y,{children:c.jsx(Q,{className:"p-4",children:c.jsx(tI,{initial:null,allAgents:e,allTools:n,allFragments:a,onSaved:function(e){t(t=>[...t,e].sort((e,t)=>e.sort_order-t.sort_order||e.name.localeCompare(t.name))),h(!1)},onCancel:()=>h(!1)})})}),s&&c.jsxs("div",{className:"space-y-3",children:[c.jsx(d,{className:"h-16 w-full"}),c.jsx(d,{className:"h-16 w-full"}),c.jsx(d,{className:"h-16 w-full"})]}),u&&c.jsxs("div",{className:"rounded border border-red-200 bg-red-50 p-4 text-sm text-red-700",children:["Failed to load agents: ",u]}),!s&&!u&&c.jsxs(Y,{children:[c.jsx(J,{className:"pb-2",children:c.jsxs(Z,{className:"text-base flex items-center gap-2",children:["Agents",c.jsxs(x,{className:"ml-auto bg-gray-100 text-gray-600 text-xs font-normal",children:[e.length," total"]})]})}),c.jsxs(Q,{className:"space-y-2",children:[e.map(t=>c.jsx(nI,{agent:t,allAgents:e,allTools:n,allFragments:a,onUpdated:j,onDeleted:w},t.name)),0===e.length&&!p&&c.jsx("p",{className:"text-sm text-gray-500 text-center py-8",children:"No agents defined."})]})]}),!s&&!u&&e.length>0&&c.jsx(mI,{agents:e})]})}function xI(){return c.jsxs(b,{defaultValue:"agents",children:[c.jsxs(j,{className:"mb-4",children:[c.jsx(w,{value:"agents",children:"Agents"}),c.jsx(w,{value:"fragments",children:"Prompt Fragments"}),c.jsx(w,{value:"knowledge",children:"Knowledge Base"})]}),c.jsx(N,{value:"agents",children:c.jsx(yI,{})}),c.jsx(N,{value:"fragments",children:c.jsx(KD,{})}),c.jsx(N,{value:"knowledge",children:c.jsx(YD,{})})]})}function gI(){return c.jsx("div",{className:"space-y-4",children:[1,2,3].map(e=>c.jsx(d,{className:"h-32 w-full"},e))})}function vI(e,t){return new Intl.NumberFormat("en-US",{style:"currency",currency:t,maximumFractionDigits:2}).format(e)}function bI(e){return null===e?"â":(100*e).toFixed(1)+"%"}function jI({items:e}){return 0===e.length?c.jsx("span",{className:"text-muted-foreground",children:"â"}):c.jsx("div",{className:"flex flex-col items-end gap-0.5",children:e.map(e=>c.jsx("span",{children:vI(e.amount,e.currency)},e.currency))})}function wI({items:e}){const t=e.filter(e=>null!==e.amount);return 0===t.length?c.jsx("span",{className:"text-muted-foreground",children:"â"}):c.jsx("div",{className:"flex flex-col items-end gap-0.5",children:t.map(e=>c.jsx("span",{children:vI(e.amount,e.currency)},e.currency))})}function NI({dateRange:e}){const[t,n]=i.useState([]),[r,a]=i.useState([]),[o,s]=i.useState(!0),[l,u]=i.useState(null),[f,p]=i.useState(!1),[m,y]=i.useState(null),[g,v]=i.useState(!1);i.useEffect(()=>{var t,r;s(!0),u(null),y(null),p(!1),Promise.all([(t=e.from,r=e.to,Me("/landing-analysis/funnel",t,r)),Ie(e.from,e.to)]).then(([e,t])=>{n(e.rows),a(t.rows)}).catch(e=>u(e.message)).finally(()=>s(!1))},[e.from.getTime(),e.to.getTime()]);if(o)return c.jsx(gI,{});if(l)return c.jsx("p",{className:"text-destructive text-sm",children:l});const b=function(e,t){const n=new Map;for(const r of e)for(const e of r[t])n.set(e.currency,(n.get(e.currency)??0)+e.amount);return[...n.entries()].map(([e,t])=>({currency:e,amount:Math.round(100*t)/100}))}(t,"spend"),j=t.reduce((e,t)=>
13e+t.leads,0),w=t.reduce((e,t)=>e+t.signups,0),N=t.reduce((e,t)=>e+t.stores,0);return c.jsxs("div",{className:"space-y-6",children:[c.jsxs("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-5",children:[b.map(e=>c.jsxs(Y,{children:[c.jsx(J,{className:"pb-2",children:c.jsxs(Z,{className:"text-xs font-medium text-muted-foreground",children:["Spend (",e.currency,")"]})}),c.jsx(Q,{children:c.jsx("p",{className:"text-2xl font-bold",children:vI(e.amount,e.currency)})})]},e.currency)),[{label:"Leads",value:j.toLocaleString()},{label:"Signups",value:w.toLocaleString()},{label:"Stores Created",value:N.toLocaleString()}].map(({label:e,value:t})=>c.jsxs(Y,{children:[c.jsx(J,{className:"pb-2",children:c.jsx(Z,{className:"text-xs font-medium text-muted-foreground",children:e})}),c.jsx(Q,{children:c.jsx("p",{className:"text-2xl font-bold",children:t})})]},e))]}),c.jsx("p",{className:"text-xs text-muted-foreground",children:"Meta spend is EUR, Google spend is USD â figures are never summed across currencies."}),c.jsxs(Y,{children:[c.jsx(J,{children:c.jsx(Z,{className:"text-sm font-medium",children:"Funnel by Landing Page"})}),c.jsx(Q,{className:"p-0",children:c.jsx("div",{className:"overflow-x-auto",children:c.jsxs(q_,{children:[c.jsx(W_,{children:c.jsxs(V_,{children:[c.jsx(K_,{children:"Landing Page"}),c.jsx(K_,{children:"Platforms"}),c.jsx(K_,{className:"text-right",children:"Spend"}),c.jsx(K_,{className:"text-right",children:"Impressions"}),c.jsx(K_,{className:"text-right",children:"Clicks"}),c.jsx(K_,{className:"text-right",children:"LP Views"}),c.jsx(K_,{className:"text-right",children:"Leads"}),c.jsx(K_,{className:"text-right",children:"Signups"}),c.jsx(K_,{className:"text-right",children:"Stores"}),c.jsx(K_,{className:"text-right",children:"Cost / Store"}),c.jsx(K_,{className:"text-right",children:"ViewâLead"}),c.jsx(K_,{className:"text-right",children:"LeadâEmail"}),c.jsx(K_,{className:"text-right",children:"EmailâSignup"}),c.jsx(K_,{className:"text-right",children:"SignupâStore"})]})}),c.jsxs(H_,{children:[t.map(e=>c.jsxs(V_,{children:[c.jsxs(X_,{className:"font-medium",children:[c.jsx("div",{children:e.landingPage}),e.hosts.length>0&&c.jsx("div",{className:"text-xs text-muted-foreground",children:e.hosts.join(", ")}),!e.hasLeadForm&&c.jsx(x,{variant:"outline",className:"mt-1 text-[10px]",children:"no lead form â first-touch attributed"})]}),c.jsx(X_,{children:c.jsx("div",{className:"flex gap-1",children:e.platforms.map(e=>c.jsx(x,{variant:"secondary",children:e},e))})}),c.jsx(X_,{className:"text-right",children:c.jsx(jI,{items:e.spend})}),c.jsx(X_,{className:"text-right",children:e.impressions.toLocaleString()}),c.jsx(X_,{className:"text-right",children:e.clicks.toLocaleString()}),c.jsx(X_,{className:"text-right",children:e.lpViews.toLocaleString()}),c.jsx(X_,{className:"text-right",children:e.leads.toLocaleString()}),c.jsx(X_,{className:"text-right",children:e.signups.toLocaleString()}),c.jsx(X_,{className:"text-right",children:e.stores.toLocaleString()}),c.jsx(X_,{className:"text-right",children:c.jsx(wI,{items:e.costPerStore})}),c.jsx(X_,{className:"text-right",children:bI(e.crViewToLead)}),c.jsx(X_,{className:"text-right",children:bI(e.crLeadToEmail)}),c.jsx(X_,{className:"text-right",children:bI(e.crEmailToSignup)}),c.jsx(X_,{className:"text-right",children:bI(e.crSignupToStore)})]},e.landingPage)),0===t.length&&c.jsx(V_,{children:c.jsx(X_,{colSpan:13,className:"text-center text-muted-foreground text-sm py-6",children:"No landing page activity in the selected range."})})]})]})})})]}),c.jsxs(Y,{children:[c.jsx(J,{children:c.jsx(Z,{className:"text-sm font-medium",children:"By Campaign"})}),c.jsx(Q,{className:"p-0",children:c.jsx("div",{className:"overflow-x-auto",children:c.jsxs(q_,{children:[c.jsx(W_,{children:c.jsxs(V_,{children:[c.jsx(K_,{children:"Campaign"}),c.jsx(K_,{children:"Platform"}),c.jsx(K_,{className:"text-right",children:"Spend"}),c.jsx(K_,{className:"text-right",children:"Impressions"}),c.jsx(K_,{className:"text-right",children:"Clicks"}),c.jsx(K_,{className:"text-right",children:"Leads"}),c.jsx(K_,{className:"text-right",children:"Stores"}),c.jsx(K_,{className:"text-right",children:"Cost / Store"}),c.jsx(K_,{children:"Landing Pages"})]})}),c.jsxs(H_,{children:[r.map(e=>c.jsxs(V_,{children:[c.jsx(X_,{className:"font-medium",children:e.campaignName}),c.jsx(X_,{children:c.jsx(x,{variant:"secondary",children:e.platform})}),c.jsx(X_,{className:"text-right",children:vI(e.spend,e.currency)}),c.jsx(X_,{className:"text-right",children:e.impressions.toLocaleStr
13ing()}),c.jsx(X_,{className:"text-right",children:e.clicks.toLocaleString()}),c.jsx(X_,{className:"text-right",children:e.leads.toLocaleString()}),c.jsx(X_,{className:"text-right",children:e.stores.toLocaleString()}),c.jsx(X_,{className:"text-right",children:null===e.costPerStore?c.jsx("span",{className:"text-muted-foreground",children:"â"}):vI(e.costPerStore,e.currency)}),c.jsx(X_,{className:"text-xs text-muted-foreground",children:e.landingPages.join(", ")})]},`${e.platform}-${e.campaignId||e.campaignName}`)),0===r.length&&c.jsx(V_,{children:c.jsx(X_,{colSpan:9,className:"text-center text-muted-foreground text-sm py-6",children:"No campaign activity in the selected range."})})]})]})})})]}),c.jsxs(Y,{children:[c.jsx(J,{children:c.jsxs("button",{onClick:()=>{const t=!f;var n,r;p(t),t&&null===m&&(v(!0),(n=e.from,r=e.to,Me("/landing-analysis/ads",n,r)).then(e=>y(e.ads)).catch(()=>y([])).finally(()=>v(!1)))},className:"flex items-center justify-between w-full text-left",children:[c.jsx(Z,{className:"text-sm font-medium",children:"Ad-level Detail"}),f?c.jsx(pe,{className:"h-4 w-4"}):c.jsx(h,{className:"h-4 w-4"})]})}),f&&c.jsx(Q,{className:"p-0",children:g?c.jsx("div",{className:"p-4",children:c.jsx(d,{className:"h-40 w-full"})}):c.jsx("div",{className:"overflow-x-auto",children:c.jsxs(q_,{children:[c.jsx(W_,{children:c.jsxs(V_,{children:[c.jsx(K_,{children:"Ad"}),c.jsx(K_,{children:"Campaign"}),c.jsx(K_,{children:"Platform"}),c.jsx(K_,{className:"text-right",children:"Spend"}),c.jsx(K_,{className:"text-right",children:"Impressions"}),c.jsx(K_,{className:"text-right",children:"Clicks"}),c.jsx(K_,{children:"Landing Page"}),c.jsx(K_,{children:"UTM Content"})]})}),c.jsxs(H_,{children:[(m??[]).map(e=>c.jsxs(V_,{children:[c.jsx(X_,{className:"font-medium",children:e.adName||e.adId}),c.jsx(X_,{children:e.campaignName}),c.jsx(X_,{children:c.jsx(x,{variant:"secondary",children:e.platform})}),c.jsx(X_,{className:"text-right",children:vI(e.spend,e.currency)}),c.jsx(X_,{className:"text-right",children:e.impressions.toLocaleString()}),c.jsx(X_,{className:"text-right",children:e.clicks.toLocaleString()}),c.jsxs(X_,{className:"text-xs",children:[e.landingPage,e.host&&c.jsx("div",{className:"text-muted-foreground",children:e.host})]}),c.jsx(X_,{className:"text-xs text-muted-foreground",children:e.utm.utm_content??"â"})]},`${e.platform}-${e.adId}`)),0===(m??[]).length&&c.jsx(V_,{children:c.jsx(X_,{colSpan:8,className:"text-center text-muted-foreground text-sm py-6",children:"No ad activity in the selected range."})})]})]})})})]})]})}function SI({value:e,onChange:t}){const n=i.useRef(null),[r,a]=i.useState(!1),[o,s]=i.useState(null);async function l(e){a(!0),s(null);try{const n=await async function(e){const t=await Ce(),n=await e.arrayBuffer(),r=btoa(String.fromCharCode(...new Uint8Array(n))),a=await fetch(`${Ee}/landing-pages/upload-image`,{method:"POST",headers:t,body:JSON.stringify({filename:e.name,contentType:e.type,dataBase64:r})});if(!a.ok){const e=await a.json().catch(()=>({error:a.statusText}));throw new Error(e.error||`Upload failed: ${a.status}`)}return(await a.json()).url}(e);t(n)}catch(n){s(n instanceof Error?n.message:"Upload failed")}finally{a(!1)}}return c.jsxs("div",{className:"space-y-2",children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("input",{className:"flex-1 rounded border border-gray-300 px-2 py-1.5 text-sm",placeholder:"https://â¦",value:e,onChange:e=>t(e.target.value)}),c.jsxs("button",{type:"button",onClick:()=>{var e;return null==(e=n.current)?void 0:e.click()},disabled:r,className:"flex items-center gap-1 rounded border border-gray-300 px-2 py-1.5 text-xs text-gray-600 hover:bg-gray-50 disabled:opacity-50",children:[c.jsx(he,{size:12}),r?"Uploadingâ¦":"Upload"]})]}),o&&c.jsx("p",{className:"text-xs text-red-600",children:o}),e&&c.jsx("img",{src:e,alt:"hero preview",className:"h-16 rounded border object-cover"}),c.jsx("input",{ref:n,type:"file",accept:"image/*",className:"hidden",onChange:e=>{var t;const n=null==(t=e.target.files)?void 0:t[0];n&&l(n)}})]})}function OI({slug:e}){const[t,n]=i.useState(null),[r,a]=i.useState(!1);function o(){a(!0),(e=>Re("/landing-leads"+(e?`?slug=${encodeURIComponent(e)}`:"")))(e).then(n).catch(()=>n([])).finally(()=>a(!1))}return t?c.jsxs("div",{className:"mt-2",children:[c.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[c.jsxs("span",{className:"text-xs font-medium text-gray-500",children:["Leads (",t.length,")"]}),c.jsx("button",{onClick:o,className:"text-xs text-gray-400 hover:text-gray-600",children:"Refresh"})]}),0===t.length?c.jsx("p",{className:"text-xs text-gray-400",children:"No leads yet."}):c.jsx("div",{className:"overflow-auto max-h-48 border rounded text-xs",children:c.jsxs("table",{className:"w-full",children:[c.jsx("thead",{className:"bg-gray-50 sticky top-0",children:c.jsxs("tr",{children:[c.jsx("th",{className:"px-2 py-1 text-left font-medium text-gray-500",children:"Email"}),c.jsx("th",{className:"px-2 py-1 text-left font-medium text-gray-500",children:"Shop"}),c.jsx("th",{className:"px-2 py-1 text-left font-medium text-gray-500",children:"Ad"}),c.jsx("th",{className:"px-2 py-1 text-left font-medium text-gray-500",children:"Date"})]})}),c.jsx("tbody",{children:t.map(e=>c.jsxs("tr",{className:"border-t hover:bg-gray-50",children:[c.jsx("td",{className:"px-2 py-1",children:e.email}),c.jsx("td",{className:"px-2 py-1 truncate max-w-[120px]",title:e.etsy_shop_url,children:e.etsy_shop_url}),c.jsx("td",{className:"px-2 py-1 text-gray-500",children:e.utm_content??"â"}),c.jsx("td",{className:"px-2 py-1 text-gray-400",children:new Date(e.created_at).toLocaleDateString()})]},e.id))})]})})]}):c.jsx("button",{onClick:o,disabled:r,className:"text-xs text-blue-600 hover:underline",children:r?"Loading leadsâ¦":"View leads"})}function kI({initial:e,onSaved:t,onCancel:n,onDeleted:r}){const a=null===e,[o,s]=i.useState((null==e?void 0:e.slug)??""),[l,u]=i.useState((null==e?void 0:e.enabled)??!0),[d,f]=i.useState((null==e?void 0:e.notifuse_list_id)??"etsyads"),[p,h]=i.useState((null==e?void 0:e.post_submit_mode)??"inline"),[m,y]=i.useState((null==e?void 0:e.post_submit_redirect_url)??""),[x,g]=i.useState((null==e?void 0:e.seo_title)??""),[v,b]=i.useState((null==e?void 0:e.seo_description)??""),[j,w]=i.useState(function(e){const t={locale:"en",eyebrow:"",headline:"",subheadline:"",heroImageUrl:"",heroImageAlt:"",statValue:"",statLabel:"",painHeading:"",painBody:"",benefitsHeading:"",benefits:[],testimonialQuote:"",testimonialAttribution:"",trustLine:"",formHeading:"",formSubtext:"",ctaLabel:"",privacyLine:"",closingHeading:"",closingBody:"",thankYouHeading:"",thankYouBody:"",thankYouNote:""};return e?{...t,...e,benefits:e.benefits??[]}:t}(null==e?void 0:e.content)),[N,S]=i.useState(!1),[O,k]=i.useState(!1),[A,P]=i.useState(!1),[_,C]=i.useState(null);function M(e,t){w(n=>({...n,[e]:t}))}function T(e,t,n){w(r=>({...r,benefits:(r.benefits??[]).map((r,a)=>a===e?{...r,[t]:n}:r)}))}const D="w-full rounded border border-gray-300 px-2 py-1.5 text-sm",I="text-xs font-medium text-gray-500 block mb-1";return c.jsxs("div",{className:"space-y-5",children:[c.jsxs("div",{className:"flex items-center justify-between",children:[c.jsx("h3",{className:"font-semibold text-sm",children:a?"New L
13anding Page":`Edit: /${e.slug}`}),c.jsx("button",{onClick:n,className:"text-gray-400 hover:text-gray-600",children:c.jsx(E,{size:16})})]}),c.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-3",children:[c.jsxs("div",{children:[c.jsx("label",{className:I,children:"Slug (URL key)"}),c.jsx("input",{className:`${D} ${a?"":"bg-gray-50 text-gray-400"} font-mono`,placeholder:"own-your-visibility",value:o,readOnly:!a,onChange:e=>a&&s(e.target.value)})]}),c.jsxs("div",{children:[c.jsx("label",{className:I,children:"Notifuse list ID"}),c.jsx("input",{className:D,value:d,onChange:e=>f(e.target.value)})]}),c.jsx("div",{className:"flex items-end pb-1.5 gap-4",children:c.jsxs("label",{className:"flex items-center gap-2 text-sm cursor-pointer select-none",children:[c.jsx("input",{type:"checkbox",checked:l,onChange:e=>u(e.target.checked),className:"rounded"}),"Enabled"]})})]}),c.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:[c.jsxs("div",{children:[c.jsx("label",{className:I,children:"Post-submit mode"}),c.jsxs("select",{className:D,value:p,onChange:e=>h(e.target.value),children:[c.jsx("option",{value:"inline",children:"Inline (thank-you reveal)"}),c.jsx("option",{value:"redirect",children:"Redirect to URL"})]})]}),"redirect"===p&&c.jsxs("div",{children:[c.jsx("label",{className:I,children:"Redirect URL"}),c.jsx("input",{className:D,type:"url",placeholder:"https://â¦",value:m,onChange:e=>y(e.target.value)})]})]}),c.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:[c.jsxs("div",{children:[c.jsx("label",{className:I,children:"SEO title"}),c.jsx("input",{className:D,value:x,onChange:e=>g(e.target.value)})]}),c.jsxs("div",{children:[c.jsx("label",{className:I,children:"SEO description"}),c.jsx("input",{className:D,value:v,onChange:e=>b(e.target.value)})]})]}),c.jsx("hr",{className:"border-gray-100"}),c.jsx("p",{className:"text-xs font-semibold text-gray-400 uppercase tracking-wide",children:"Page Content"}),c.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:c.jsxs("div",{children:[c.jsx("label",{className:I,children:"Language (form labels/placeholders)"}),c.jsxs("select",{className:D,value:j.locale??"en",onChange:e=>M("locale",e.target.value),children:[c.jsx("option",{value:"en",children:"English"}),c.jsx("option",{value:"ru",children:"Russian"})]})]})}),c.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:[c.jsxs("div",{children:[c.jsx("label",{className:I,children:"Eyebrow (small mono text)"}),c.jsx("input",{className:D,value:j.eyebrow??"",onChange:e=>M("eyebrow",e.target.value)})]}),c.jsxs("div",{children:[c.jsx("label",{className:I,children:"Trust line (shown under testimonial)"}),c.jsx("input",{className:D,value:j.trustLine??"",onChange:e=>M("trustLine",e.target.value)})]})]}),c.jsxs("div",{children:[c.jsx("label",{className:I,children:"Headline (h1)"}),c.jsx("input",{className:D,value:j.headline??"",onChange:e=>M("headline",e.target.value)})]}),c.jsxs("div",{children:[c.jsx("label",{className:I,children:"Subheadline"}),c.jsx("textarea",{rows:2,className:`${D} resize-y`,value:j.subheadline??"",onChange:e=>M("subheadline",e.target.value)})]}),c.jsxs("div",{children:[c.jsx("label",{className:I,children:"Hero image"}),c.jsx(SI,{value:j.heroImageUrl??"",onChange:e=>M("heroImageUrl",e)})]}),c.jsxs("div",{children:[c.jsx("label",{className:I,children:"Hero image alt text"}),c.jsx("input",{className:D,value:j.heroImageAlt??"",onChange:e=>M("heroImageAlt",e.target.value)})]}),c.jsx("p",{className:"text-xs font-semibold text-gray-400 uppercase tracking-wide",children:"Stat / Pain section"}),c.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:[c.jsxs("div",{children:[c.jsx("label",{className:I,children:"Stat value (big number/phrase)"}),c.jsx("input",{className:D,value:j.statValue??"",onChange:e=>M("statValue",e.target.value)})]}),c.jsxs("div",{children:[c.jsx("label",{className:I,children:"Stat label"}),c.jsx("input",{className:D,value:j.statLabel??"",onChange:e=>M("statLabel",e.target.value)})]})]}),c.jsxs("div",{children:[c.jsx("label",{className:I,children:"Pain heading (h2)"}),c.jsx("input",{className:D,value:j.painHeading??"",onChange:e=>M("painHeading",e.target.value)})]}),c.jsxs("div",{children:[c.jsx("label",{className:I,children:"Pain section body"}),c.jsx("textarea",{rows:3,className:`${D} resize-y`,value:j.painBody??"",onChange:e=>M("painBody",e.target.value)})]}),c.jsx("p",{className:"text-xs font-semibold text-gray-400 uppercase tracking-wide",children:"Benefits"}),c.jsxs("div",{children:[c.jsx("label",{className:I,children:"Benefits heading"}),c.jsx("input",{className:D,value:j.benefitsHeading??"",onChange:e=>M("benefitsHeading",e.target.value)})]}),c.jsxs("div",{children:[c.jsxs("div",{className:"flex items-center justify-between mb-1",children:[c.jsx("label",{className:I,children:"Benefit cards"}),c.jsxs("button",{type:"button",onClick:function(){w(e=>({...e,benefits:[...e.benefits??[],{title:"",body:""}]}))},className:"flex items-center gap-1 text-xs text-blue-600 hover:underline",children:[c.jsx(ie,{size:11})," Add benefit"]})]}),c.jsxs("div",{className:"space-y-2",children:[(j.benefits??[]).map((e,t)=>c.jsxs("div",{className:"flex gap-2 items-start border rounded p-2",children:[c.jsxs("div",{className:"flex-1 space-y-1",children:[c.jsx("input",{className:D,placeholder:"Title",value:e.title??"",onChange:e=>T(t,"title",e.target.value)}),c.jsx("textarea",{rows:2,className:`${D} resize-y`,placeholder:"Body",value:e.body??"",onChange:e=>T(t,"body",e.target.value)})]}),c.jsx("button",{type:"button",onClick:()=>function(e){w(t=>
13({...t,benefits:(t.benefits??[]).filter((t,n)=>n!==e)}))}(t),className:"text-gray-400 hover:text-red-600 pt-1",children:c.jsx(ce,{size:13})})]},t)),0===(j.benefits??[]).length&&c.jsx("p",{className:"text-xs text-gray-400",children:"No benefits yet."})]})]}),c.jsx("p",{className:"text-xs font-semibold text-gray-400 uppercase tracking-wide",children:"Testimonial"}),c.jsxs("div",{children:[c.jsx("label",{className:I,children:"Quote"}),c.jsx("textarea",{rows:2,className:`${D} resize-y`,value:j.testimonialQuote??"",onChange:e=>M("testimonialQuote",e.target.value)})]}),c.jsxs("div",{children:[c.jsx("label",{className:I,children:"Attribution"}),c.jsx("input",{className:D,value:j.testimonialAttribution??"",onChange:e=>M("testimonialAttribution",e.target.value)})]}),c.jsx("p",{className:"text-xs font-semibold text-gray-400 uppercase tracking-wide",children:"Form & CTA"}),c.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:[c.jsxs("div",{children:[c.jsx("label",{className:I,children:"Form heading"}),c.jsx("input",{className:D,value:j.formHeading??"",onChange:e=>M("formHeading",e.target.value)})]}),c.jsxs("div",{children:[c.jsx("label",{className:I,children:"CTA button label"}),c.jsx("input",{className:D,value:j.ctaLabel??"",onChange:e=>M("ctaLabel",e.target.value)})]})]}),c.jsxs("div",{children:[c.jsx("label",{className:I,children:"Form subtext"}),c.jsx("input",{className:D,value:j.formSubtext??"",onChange:e=>M("formSubtext",e.target.value)})]}),c.jsxs("div",{children:[c.jsx("label",{className:I,children:"Privacy line"}),c.jsx("input",{className:D,value:j.privacyLine??"",onChange:e=>M("privacyLine",e.target.value)})]}),c.jsx("p",{className:"text-xs font-semibold text-gray-400 uppercase tracking-wide",children:"Closing CTA"}),c.jsxs("div",{children:[c.jsx("label",{className:I,children:"Closing heading"}),c.jsx("input",{className:D,value:j.closingHeading??"",onChange:e=>M("closingHeading",e.target.value)})]}),c.jsxs("div",{children:[c.jsx("label",{className:I,children:"Closing body"}),c.jsx("textarea",{rows:2,className:`${D} resize-y`,value:j.closingBody??"",onChange:e=>M("closingBody",e.target.value)})]}),"inline"===p&&c.jsxs(c.Fragment,{children:[c.jsx("p",{className:"text-xs font-semibold text-gray-400 uppercase tracking-wide",children:"Thank-you (shown after inline submit)"}),c.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:[c.jsxs("div",{children:[c.jsx("label",{className:I,children:"Heading"}),c.jsx("input",{className:D,value:j.thankYouHeading??"",onChange:e=>M("thankYouHeading",e.target.value)})]}),c.jsxs("div",{children:[c.jsx("label",{className:I,children:"Note (optional link label)"}),c.jsx("input",{className:D,value:j.thankYouNote??"",onChange:e=>M("thankYouNote",e.target.value)})]})]}),c.jsxs("div",{children:[c.jsx("label",{className:I,children:"Body"}),c.jsx("textarea",{rows:3,className:`${D} resize-y`,value:j.thankYouBody??"",onChange:e=>M("thankYouBody",e.target.value)})]})]}),_&&c.jsx("p",{className:"text-xs text-red-600",children:_}),c.jsxs("div",{className:"flex items-center justify-between pt-1 border-t",children:[c.jsx("div",{className:"flex items-center gap-2",children:!a&&(A?c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("span",{className:"text-xs text-red-600",children:"Sure?"}),c.jsx("button",{onClick:async function(){if(e){k(!0),C(null);try{await(e=>ze(`/landing-pages/${e}`))(e.slug),null==r||r(e.slug)}catch(t){C(t instanceof Error?t.message:"Delete failed"),k(!1)}}},disabled:O,className:"rounded bg-red-600 text-white text-xs px-2 py-1 hover:bg-red-700 disabled:opacity-50",children:O?"Deletingâ¦":"Yes, delete"}),c.jsx("button",{onClick:()=>P(!1),className:"text-xs text-gray-500 hover:text-gray-700",children:"Cancel"})]}):c.jsxs("button",{onClick:()=>P(!0),className:"flex items-center gap-1 rounded border border-red-200 text-red-600 text-xs px-2 py-1 hover:bg-red-50",children:[c.jsx(ce,{size:11})," Delete"]}))}),c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("button",{onClick:n,className:"text-xs text-gray-500 hover:text-gray-700 px-2 py-1",children:"Cancel"}),c.jsxs("button",{onClick:async function(){S(!0),C(null);try{const r={content:j,enabled:l,notifuse_list_id:d,post_submit_mode:p,post_submit_redirect_url:m||null,seo_title:x||null,seo_description:v||null};let i;i=a?await(n={slug:o,...r},Le("/landing-pages",n)):await((e,t)=>Be(`/landing-pages/${e}`,t))(e.slug,r),t(i)}catch(r){C(r instanceof Error?r.message:"Save failed")}finally{S(!1)}var n},disabled:N,className:"flex items-center gap-1.5 rounded bg-gray-900 text-white text-xs px-3 py-1.5 hover:bg-gray-700 disabled:opacity-50",children:[c.jsx(ue,{size:11}),N?"Savingâ¦":a?"Create":"Save"]})]})]})]})}function AI({slug:e,initial:t,onSaved:n,onCancel:r,onDeleted:a}){const o=null===t,[s,l]=i.useState((null==t?void 0:t.enabled)??!0),[u,d]=i.useState((null==t?void 0:t.seo_title)??""),[f,p]=i.useState((null==t?void 0:t.seo_description)??""),[h,m]=i.useState(function(e){const t={pageH1:"",reveal:"",ctaLabel:"",ctaSubtext:"",pathEyebrow:"",pathHeading:"",steps:[],credibility:[],closingHeading:"",closingBody:"",bookCallLabel:"",confirmationText:""};return e?{...t,...e,steps:e.steps??[],credibility:e.credibility??[]}:t}(null==t?void 0:t.content)),[y,x]=i.useState(!1),[g,v]=i.useState(!1),[b,j]=i.useState(!1),[w,N]=i.useState(null);function S(e,t){m(n=>({...n,[e]:t}))}function O(e,t,n){m(r=>({...r,steps:(r.steps??[]).map((r,a)=>a===e?{...r,[t]:n}:r)}))}const k="w-full rounded border border-gray-300 px-2 py-1.5 text-sm",A="text-xs font-medium text-gray-500 block mb-1";return c.jsxs("div",{className:"space-y-4",children:[c.jsxs("div",{className:"flex items-center justify-between",children:[c.jsx("h4",{className:"font-semibold text-sm",children:o?"New How It Works Page":`Edit: /lp/${e}/how-it-works`}),c.jsx("button",{onClick:r,className:"text-gray-400 hover:text-gray-600",children:c.jsx(E,{size:16})})]}),c.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-3",children:[c.jsxs("div",{children:[c.jsx("label",{className:A,children:"SEO title"}),c.jsx("input",{className:k,value:u,onChange:e=>d(e.target.value)})]}),c.jsxs("div",{children:[c.jsx("label",{className:A,children:"SEO description"}),c.jsx("input",{className:k,value:f,onChange:e=>p(e.target.value)})]}),c.jsx("div",{className:"flex items-end pb-1.5",children:c.jsxs("label",{className:"flex items-center gap-2 text-sm cursor-pointer select-none",children:[c.jsx("input",{type:"checkbox",checked:s,onChange:e=>l(e.target.checked),className:"rounded"}),"Enabled"]})})]}),c.jsxs("div",{children:[c.jsx("label",{className:A,children:"Confirmation strip text (top green banner)"}),c.jsx("input",{className:k,value:h.confirmationText??"",onChange:e=>S("confirmationText",e.target.value)})]}),c.jsxs("div",{children:[c.jsx("label",{className:A,children:"Page H1"}),c.jsx("textarea",{rows:2,className:`${k} resize-y`,value:h.pageH1??"",onChange:e=>S("pageH1",e.target.value)})]}),c.jsxs("div",{children:[c.jsx("label",{className:A,children:"Reveal paragraph"}),c.jsx("textarea",{rows:3,className:`${k} resize-y`,value:h.reveal??"",onChange:e=>S("reveal",e.target.value)})]}),c.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:[c.jsxs("div",{children:[c.jsx("label",{className:A,children:"CTA label"}),c.jsx("input",{className:k,value:h.ctaLabel??"",onChange:e=>S("ctaLabel",e.target.value)})]}),c.jsxs("div",{children:[c.jsx("label",{className:A,children:"CTA subtext"}),c.jsx("input",{className:k,value:h.ctaSubtext??"",onChange:e=>S("ctaSubtext",e.target.value)})]})]}),c.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:[c.jsxs("div",{children:[c.jsx("label",{className:A,children:"Path eyebrow"}),c.jsx("input",{className:k,value:h.pathEyebrow??"",onChange:e=>S("pathEyebrow",e.target.value)})]}),c.jsxs("div",{children:[c.jsx("label",{className:A,children:"Path heading"}),c.jsx("input",{className:k,value:h.pathHeading??"",onChange:e=>S("pathHeading",e.target.value)})]})]}),c.jsxs("div",{children:[c.jsxs("div",{className:"flex items-center justify-between mb-1",children:[c.jsx("label",{className:A,children:"Steps (numbered path)"}),c.jsxs("button",{type:"button",onClick:function(){m(e=>({...e,steps:[...e.steps??[],{title:"",body:""}]}))},className:"flex items-center gap-1 text-xs text-blue-600 hover:underline",children:[c.jsx(ie,{size:11})," Add step"]})]}),c.jsxs("div",{className:"space-y-2",children:[(h.steps??[]).map((e,t)=>c.jsxs("div",{className:"flex gap-2 items-start border rounded p-2",children:[c.jsxs("div",{className:"flex-1 space-y-1",children:[c.jsx("input",{className:k,placeholder:"Title",value:e.title??"",onChange:e=>O(t,"title",e.target.value)}),c.jsx("textarea",{rows:2,className:`${k} resize-y`,placeholder:"Body",value:e.body??"",onChange:e=>O(t,"body",e.target.value)})]}),c.jsx("button",{type:"button",onClick:()=>function(e){m(t=>
13({...t,steps:(t.steps??[]).filter((t,n)=>n!==e)}))}(t),className:"text-gray-400 hover:text-red-600 pt-1",children:c.jsx(ce,{size:13})})]},t)),0===(h.steps??[]).length&&c.jsx("p",{className:"text-xs text-gray-400",children:"No steps yet."})]})]}),c.jsxs("div",{children:[c.jsxs("div",{className:"flex items-center justify-between mb-1",children:[c.jsx("label",{className:A,children:"Credibility bullets"}),c.jsxs("button",{type:"button",onClick:function(){m(e=>({...e,credibility:[...e.credibility??[],{title:""}]}))},className:"flex items-center gap-1 text-xs text-blue-600 hover:underline",children:[c.jsx(ie,{size:11})," Add bullet"]})]}),c.jsxs("div",{className:"space-y-2",children:[(h.credibility??[]).map((e,t)=>c.jsxs("div",{className:"flex gap-2 items-start border rounded p-2",children:[c.jsx("input",{className:`${k} flex-1`,placeholder:"Title",value:e.title??"",onChange:e=>function(e,t){m(n=>({...n,credibility:(n.credibility??[]).map((n,r)=>r===e?{...n,title:t}:n)}))}(t,e.target.value)}),c.jsx("button",{type:"button",onClick:()=>function(e){m(t=>({...t,credibility:(t.credibility??[]).filter((t,n)=>n!==e)}))}(t),className:"text-gray-400 hover:text-red-600 pt-1",children:c.jsx(ce,{size:13})})]},t)),0===(h.credibility??[]).length&&c.jsx("p",{className:"text-xs text-gray-400",children:"No bullets yet."})]})]}),c.jsxs("div",{children:[c.jsx("label",{className:A,children:"Closing heading (dark CTA block)"}),c.jsx("input",{className:k,value:h.closingHeading??"",onChange:e=>S("closingHeading",e.target.value)})]}),c.jsxs("div",{children:[c.jsx("label",{className:A,children:"Closing body"}),c.jsx("textarea",{rows:2,className:`${k} resize-y`,value:h.closingBody??"",onChange:e=>S("closingBody",e.target.value)})]}),c.jsxs("div",{children:[c.jsx("label",{className:A,children:"Book-a-call link label"}),c.jsx("input",{className:k,value:h.bookCallLabel??"",onChange:e=>S("bookCallLabel",e.target.value)})]}),w&&c.jsx("p",{className:"text-xs text-red-600",children:w}),c.jsxs("div",{className:"flex items-center justify-between pt-1 border-t",children:[c.jsx("div",{children:!o&&(b?c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("span",{className:"text-xs text-red-600",children:"Sure?"}),c.jsx("button",{onClick:async function(){v(!0),N(null);try{await(e=>ze(`/landing-how-it-works/${e}`))(e),a()}catch(t){N(t instanceof Error?t.message:"Delete failed"),v(!1)}},disabled:g,className:"rounded bg-red-600 text-white text-xs px-2 py-1 hover:bg-red-700 disabled:opacity-50",children:g?"Deletingâ¦":"Yes, delete"}),c.jsx("button",{onClick:()=>j(!1),className:"text-xs text-gray-500 hover:text-gray-700",children:"Cancel"})]}):c.jsxs("button",{onClick:()=>j(!0),className:"flex items-center gap-1 rounded border border-red-200 text-red-600 text-xs px-2 py-1 hover:bg-red-50",children:[c.jsx(ce,{size:11})," Delete"]}))}),c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("button",{onClick:r,className:"text-xs text-gray-500 hover:text-gray-700 px-2 py-1",children:"Cancel"}),c.jsxs("button",{onClick:async function(){x(!0),N(null);try{const r={content:h,enabled:s,seo_title:u||null,seo_description:f||null};let a;a=o?await(t={slug:e,...r},Le("/landing-how-it-works",t)):await((e,t)=>Be(`/landing-how-it-works/${e}`,t))(e,r),n(a)}catch(r){N(r instanceof Error?r.message:"Save failed")}finally{x(!1)}var t},disabled:y,className:"flex items-center gap-1.5 rounded bg-gray-900 text-white text-xs px-3 py-1.5 hover:bg-gray-700 disabled:opacity-50",children:[c.jsx(ue,{size:11}),y?"Savingâ¦":o?"Create":"Save"]})]})]})]})}function PI({slug:e,row:t,onSaved:n,onDeleted:r}){const[a,o]=i.useState(!1);return a?c.jsx("div",{className:"border rounded-lg p-4 bg-gray-50",children:c.jsx(AI,{slug:e,initial:t,onSaved:e=>{n(e),o(!1)},onCancel:()=>o(!1),onDeleted:()=>{r(),o(!1)}})}):c.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[c.jsxs(x,{className:"text-xs font-normal "+(t?"bg-green-50 text-green-700":"bg-gray-100 text-gray-500"),children:["How it works: ",t?"configured":"not created"]}),c.jsx("a",{href:`/lp/${e}/how-it-works`,target:"_blank",rel:"noopener noreferrer",className:"text-gray-400 hover:text-gray-600",title:"Preview",children:c.jsx(y,{size:13})}),c.jsx("button",{onClick:()=>o(!0),className:"text-xs text-blue-600 hover:underline",children:t?"Edit":"Create"})]})}function EI({page:e,hiw:t,onUpdated:n,onDeleted:r,onHiwUpdated:a,onHiwDeleted:o}){var s;const[l,u]=i.useState(!1),[d,f]=i.useState(!1);return l?c.jsx("div",{className:"border rounded-lg p-4 bg-white",children:c.jsx(kI,{initial:e,onSaved:e=>{n(e),u(!1)},onCancel:()=>u(!1),onDeleted:e=>{r(e),u(!1)}})}):c.jsxs("div",{className:"border rounded-lg bg-white",children:[c.jsxs("div",{className:"p-3 flex items-center gap-2 flex-wrap",children:[c.jsxs("code",{className:"text-sm font-mono font-medium",children:["/lp/",e.slug]}),!e.enabled&&c.jsx(x,{className:"bg-gray-100 text-gray-500 text-xs font-normal",children:"disabled"}),c.jsx(x,{className:"text-xs font-normal "+("redirect"===e.post_submit_mode?"bg-orange-50 text-orange-600":"bg-blue-50 text-blue-600"),children:e.post_submit_mode}),c.jsx("span",{className:"text-xs text-gray-400 ml-auto",children:(null==(s=e.content.headline)?void 0:s.slice(0,50))||"â"}),c.jsxs("div",{className:"flex items-center gap-1",children:[c.jsx("a",{href:`/lp/${e.slug}`,target:"_blank",rel:"noopener noreferrer",onClick:e=>e.stopPropagation(),className:"p-1 text-gray-400 hover:text-gray-600",title:"Preview",children:c.jsx(y,{size:13})}),c.jsx("button",{onClick:()=>f(e=>!e),className:"p-1 text-gray-400 hover:text-gray-600",title:"Leads",children:c.jsx(M,{size:13})}),c.jsx("button",{onClick:()=>u(!0),className:"rounded border border-gray-200 text-gray-600 text-xs px-2 py-0.5 hover:bg-gray-50",children:"Edit"})]})]}),c.jsx("div",{className:"border-t px-3 py-2",children:c.jsx(PI,{slug:e.slug,row:t,onSaved:a,onDeleted:()=>o(e.slug)})}),d&&c.jsx("div",{className:"border-t px-3 pb-3",children:c.jsx(OI,{slug:e.slug})})]})}function _I(){const[e,t]=i.useState([]),[n,r]=i.useState([]),[a,o]=i.useState(!0),[s,l]=i.useState(null),[u,f]=i.useState(!1),p=i.useCallback(()=>{o(!0),Promise.all([Re("/landing-pages"),Re("/landing-how-it-works")]).then(([e,n])=>{t(e),r(n)}).catch(e=>l(e.message)).finally(()=>o(!1))},[]);function h(e){t(t=>t.map(t=>t.slug===e.slug?e:t))}function m(e){t(t=>t.filter(t=>t.slug!==e))}function y(e){r(t=>t.some(t=>t.slug===e.slug)?t.map(t=>t.slug===e.slug?e:t):[...t,e])}function x(e){r(t=>t.filter(t=>t.slug!==e))}return i.useEffect(()=>{p()},[p]),c.jsxs("div",{className:"space-y-4",children:[c.jsxs("div",{className:"flex items-center justify-between",children:[c.jsxs("div",{children:[c.jsx("h3",{className:"font-semibold text-sm",children:"Landing Pages"}),c.jsxs("p",{className:"text-xs text-gray-500 mt-0.5",children:["DB-driven pages served at ",c.jsx("code",{className:"bg-gray-100 px-1 rounded",children:"/lp/:slug"})," for Etsy Meta Ads."]})]}),c.jsxs("button",{onClick:()=>f(!0),className:"flex items-center gap-1.5 rounded bg-gray-900 text-white text-xs px-3 py-1.5 hover:bg-gray-700",children:[c.jsx(ie,{size:12})," New Page"]})]}),u&&c.jsx(Y,{children:c.jsx(Q,{className:"p-4",children:c.jsx(kI,{initial:null,onSaved:function(e){t(t=>[...t,e]),f(!1)},onCancel:()=>f(!1)})})}),a&&c.jsxs("div",{className:"space-y-2",children:[c.jsx(d,{className:"h-12 w-full"}),c.jsx(d,{className:"h-12 w-full"})]}),s&&c.jsxs("div",{className:"rounded border border-red-200 bg-red-50 p-3 text-sm text-red-700",children:["Failed to load: ",s]}),!a&&!s&&0===e.length&&!u&&c.jsx("p",{className:"text-sm text-gray-500 text-center py-8",children:"No landing pages defined."}),!a&&!s&&c.jsx("div",{className:"space-y-2",children:e.map(e=>c.jsx(EI,{page:e,hiw:n.find(t=>t.slug===e.slug)??null,onUpdated:h,onDeleted:m,onHiwUpdated:y,onHiwDeleted:x},e.slug))})]})}const CI="undefined"!=typeof window&&window.self!==window.top;function MI(){var e;const{user:t,loading:n}=T(),[r,a]=i.useState({from:K(X(new Date,29)),to:B(new Date)}),[o,s]=D(),l=o.get("tab")||"overview";return i.useEffect(()=>{CI&&"undefined"!=typeof window&&window.parent!==window&&window.parent.postMessage({type:"admin-ready"},"*")},[]),i.useEffect(()=>{const e=document.createElement("style");return e.id="hide-chatwoot-bubble-internal-dashboard",e.textContent=".woot-widget-bubble, .woot--bubble-holder { display: none !important; }",document.head.appendChild(e),()=>{e.remove()}},[]),n?c.jsx("div",{className:"flex flex-col min-h-screen",children:c.jsxs("main",{className:"container mx-auto p-3 sm:p-6 space-y-4",children:[c.jsx(d,{className:"h-8 w-64"}),c.jsx(d,{className:"h-64 w-full"})]})}):CI||t&&(null==(e=t.email)?void 0:e.endsWith("@stablecommerce.ai"))?c.jsx("div",{className:"flex flex-col min-h-screen bg-background",children:c.jsxs("main",{className:"container mx-auto p-3 sm:p-6 space-y-6",children:[c.jsxs("div",{className:"flex items-center justify-between flex-wrap gap-4",children:[c.jsxs("div",{children:[c.jsx("h1",{className:"text-2xl font-bold tracking-tight",children:"Admin Dashboard"}),c.jsx("p",{className:"text-muted-foreground text-sm",children:"Stable Commerce system metrics"})]}),c.jsx("div",{className:"w-full sm:w-auto",children:c.jsx(G,{value:r,onChange:a})})]}),c.jsxs(b,{value:l,onValueChange:e=>s({tab:e},{replace:!0}),children:[c.jsxs(j,{className:"flex h-auto w-full flex-wrap justify-start gap-1",children:[c.jsx(w,{value:"overview",className:"whitespace-nowrap",children:"Overview"}),c.jsx(w,{value:"users",className:"whitespace-nowrap",children:"Users & Stores"}),c.jsx(w,{value:"ai",className:"whitespace-nowrap",children:"AI Usage"}),c.jsx(w,{value:"traffic",className:"whitespace-nowrap",children:"Traffic"}),c.jsx(w,{value:"errors",className:"whitespace-nowrap",children:"Errors"}),c.jsx(w,{value:"challenge",className:"whitespace-nowrap",children:"Challenge"}),c.jsx(w,{value:"waitlist",className:"whitespace-nowrap",children:"Waitlist"}),c.jsx(w,{value:"agent-tools",className:"whitespace-nowrap",children:"Agent Tools"}),c.jsx(w,{value:"agent-registry",className:"whitespace-nowrap",children:"Agent Registry"}),c.jsx(w,{value:"landing-analysis",className:"whitespace-nowrap",children:"Landing Page Analysis"}),c.jsx(w,{value:"landing-pages",className:"whitespace-nowrap",children:"Landing Pages (CMS)"}),c.jsx(w,{value:"mailing",className:"whitespace-nowrap",children:"Mailing"})]}),c.jsx(N,{value:"overview",className:"mt-6",children:c.jsx($_,{dateRange:r})}),c.jsx(N,{value:"users",className:"mt-6",children:c.jsx(pC,{dateRange:r})}),c.jsx(N,{value:"ai",className:"mt-6",children:c.jsx(yC,{dateRange:r})}),c.jsx(N,{value:"traffic",className:"mt-6",children:c.jsx(OC,{dateRange:r})}),c.jsx(N,{value:"errors",className:"mt-6",children:c.jsx(EC,{dateRange:r})}),c.jsx(N,{value:"challenge",className:"mt-6",children:c.jsx(fD,{})}),c.jsx(N,{value:"waitlist",className:"mt-6",children:c.jsx(gD,{})}),c.jsx(N,{value:"agent-tools",className:"mt-6",children:c.jsx(WD,{})}),c.jsx(N,{value:"agent-registry",className:"mt-6",children:c.jsx(xI,{})}),c.jsx(N,{value:"landing-analysis",className:"mt-6",children:c.jsx(NI,{dateRange:r})}),c.jsx(N,{value:"landing-pages",className:"mt-6",children:c.jsx(_I,{})}),c.jsx(N,{value:"mailing",className:"mt-6",children:c.jsx(CD,{})})]})]})}):c.jsx(I,{to:"/",replace:!0})}export{MI as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.