vendor: 25,595 bytes, lines 1-2
1import{j as n}from"./ui-pZ967-NS.js";import{c as ee,a as g,g as Ut,r as T,aA as hr,aJ as vr,aV as xr,M as yr,b5 as gr,G as br,O as ht,_ as vt,m as jr,b6 as wr,b7 as Ar,aN as Or,Z as kr,b0 as xt,X as Nr}from"./utils-B5_VV7Cb.js";import{u as Ee,d as $e,o as U,B as xe,c as yt,s as Te}from"./blog-BCH5Rkw1.js";import{L as gt}from"./vendor-COMpnQoB.js";import{n as Sr,o as Pr,p as _r,q as Er,r as Tr,C as _,a as R,b as $,d as E,f as Lr,g as Dr,h as ye,i as ge,c as J}from"./tools-Dnd2ifXP.js";import{P as bt,a as jt,b as wt}from"./popover-BCceBuii.js";import{C as At}from"./calendar-BtVEjx7_.js";import{u as Rr}from"./use-mobile-DgXIz6wz.js";import{f as L,_ as qt,b as $r,c as Gt,d as Ir,i as ce,e as ct,p as se,L as q,g as Ht,h as ut,j as Zt,D as Xt,k as Yt,l as ie,m as ue,S as Cr,n as Jt,o as Fr,q as pe,r as Qt,s as we,t as er,u as tr,G as rr,v as Ve,w as nr,x as rt,y as zr,z as Me,E as Ot,F as Kr,H as Br,I as kt,J as ar,X as oe,Y as le,K as Mr,M as Vr,R as ne,A as Wr,C as de,T as ae,N as et,a as Nt,B as Le}from"./AreaChart-CkXPyUT9.js";import{B as De}from"./BarChart-C3FWkC8U.js";import"./index-Dh4i1-J3.js";var Ur=["points","className","baseLinePoints","connectNulls"];function Ae(){return Ae=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var r in a)Object.prototype.hasOwnProperty.call(a,r)&&(e[r]=a[r])}return e},Ae.apply(this,arguments)}function qr(e,t){if(e==null)return{};var a=Gr(e,t),r,s;if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(s=0;s<l.length;s++)r=l[s],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}function Gr(e,t){if(e==null)return{};var a={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;a[r]=e[r]}return a}function St(e){return Yr(e)||Xr(e)||Zr(e)||Hr()}function Hr(){throw new TypeError(`Invalid attempt to spread non-iterable instance. 2In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Zr(e,t){if(e){if(typeof e=="string")return nt(e,t);var a=Object.prototype.toString.call(e).slice(8,-1);if(a==="Object"&&e.constructor&&(a=e.constructor.name),a==="Map"||a==="Set")return Array.from(e);if(a==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a))return nt(e,t)}}function Xr(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function Yr(e){if(Array.isArray(e))return nt(e)}function nt(e,t){(t==null||t>e.length)&&(t=e.length);for(var a=0,r=new Array(t);a<t;a++)r[a]=e[a];return r}var Pt=function(t){return t&&t.x===+t.x&&t.y===+t.y},Jr=function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],a=[[]];return t.forEach(function(r){Pt(r)?a[a.length-1].push(r):a[a.length-1].length>0&&a.push([])}),Pt(t[0])&&a[a.length-1].push(t[0]),a[a.length-1].length<=0&&(a=a.slice(0,-1)),a},Ie=function(t,a){var r=Jr(t);a&&(r=[r.reduce(function(l,i){return[].concat(St(l),St(i))},[])]);var s=r.map(function(l){return l.reduce(function(i,u,m){return"".concat(i).concat(m===0?"M":"L").concat(u.x,",").concat(u.y)},"")}).join("");return r.length===1?"".concat(s,"Z"):s},Qr=function(t,a,r){var s=Ie(t,r);return"".concat(s.slice(-1)==="Z"?s.slice(0,-1):s,"L").concat(Ie(a.reverse(),r).slice(1))},en=function(t){var a=t.points,r=t.className,s=t.baseLinePoints,l=t.connectNulls,i=qr(t,Ur);if(!a||!a.length)return null;var u=ee("recharts-polygon",r);if(s&&s.length){var m=i.stroke&&i.stroke!=="none",f=Qr(a,s,l);return g.createElement("g",{className:u},g.createElement("path",Ae({},L(i,!0),{fill:f.slice(-1)==="Z"?i.fill:"none",stroke:"none",d:f})),m?g.createElement("path",Ae({},L(i,!0),{fill:"none",d:Ie(a,l)})):null,m?g.createElement("path",Ae({},L(i,!0),{fill:"none",d:Ie(s,l)})):null)}var p=Ie(a,l);return g.createElement("path",Ae({},L(i,!0),{fill:p.slice(-1)==="Z"?i.fill:"none",className:u,d:p}))},tn=qt,rn=$r,nn=Gt;function an(e,t){return e&&e.length?tn(e,nn(t),rn):void 0}var sn=an;const on=Ut(sn);var ln=qt,cn=Gt,un=Ir;function dn(e,t){return e&&e.length?ln(e,cn(t),un):void 0}var fn=dn;const mn=Ut(fn);var pn=["cx","cy","angle","ticks","axisLine"],hn=["ticks","tick","angle","tickFormatter","stroke"];function ke(e){"@babel/helpers - typeof";return ke=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ke(e)}function Ce(){return Ce=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var r in a)Object.prototype.hasOwnProperty.call(a,r)&&(e[r]=a[r])}return e},Ce.apply(this,arguments)}function _t(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),a.push.apply(a,r)}return a}function fe(e){for(var t=1;t<arguments.length;t++){var a=arguments[t]!=null?arguments[t]:{};t%2?_t(Object(a),!0).forEach(function(r){Ze(e,r,a[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):_t(Object(a)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(a,r))})}return e}function Et(e,t){if(e==null)return{};var a=vn(e,t),r,s;if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(s=0;s<l.length;s++)r=l[s],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}function vn(e,t){if(e==null)return{};var a={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;a[r]=e[r]}return a}function xn(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Tt(e,t){for(var a=0;a<t.length;a++){var r=t[a];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,ir(r.key),r)}}function yn(e,t,a){return t&&Tt(e.prototype,t),a&&Tt(e,a),Object.defineProperty(e,"prototype",{writable:!1}),e}function gn(e,t,a){return t=Ue(t),bn(e,sr()?Reflect.construct(t,a||[],Ue(e).constructor):t.apply(e,a))}function bn(e,t){if(t&&(ke(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return jn(e)}function jn(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function sr(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(sr=function(){return!!e})()}function Ue(e){return Ue=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(a){return a.__proto__||Object.getPrototypeOf(a)},Ue(e)}function wn(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&at(e,t)}function at(e,t){return at=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,s){return r.__proto__=s,r},at(e,t)}function Ze(e,t,a){return t=ir(t),t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function ir(e){var t=An(e,"string");return ke(t)=="symbol"?t:t+""}function An(e,t){if(ke(e)!="object"||!e)return e;var a=e[Symbol.toPrimitive];if(a!==void 0){var r=a.call(e,t);if(ke(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Xe=function(e){function t(){return xn(this,t),gn(this,t,arguments)}return wn(t,e),yn(t,[{key:"getTickValueCoord",value:function(r){var s=r.coordinate,l=this.props,i=l.angle,u=l.cx,m=l.cy;return se(u,m,s,i)}},{key:"getTickTextAnchor",value:function(){var r=this.props.orientation,s;switch(r){case"left":s="end";break;case"right":s="start";break;default:s="middle";break}return s}},{key:"getViewBox",value:function(){var r=this.props,s=r.cx,l=r.cy,i=r.angle,u=r.ticks,m=on(u,function(p){return p.coordinate||0}),f=mn(u,function(p){return p.coordinate||0});return{cx:s,cy:l,startAngle:i,endAngle:i,innerRadius:f.coordinate||0,outerRadius:m.coordinate||0}}},{key:"renderAxisLine",value:function(){var r=this.props,s=r.cx,l=r.cy,i=r.angle,u=r.ticks,m=r.axisLine,f=Et(r,pn),p=u.reduce(function(v,h){return[Math.min(v[0],h.coordinate),Math.max(v[1],h.coordinate)]},[1/0,-1/0]),x=se(s,l,p[0],i),b=se(s,l,p[1],i),y=fe(fe(fe({},L(f,!1)),{},{fill:"none"},L(m,!1)),{},{x1:x.x,y1:x.y,x2:b.x,y2:b.y});return g.createElement("line",Ce({className:"recharts-polar-radius-axis-line"},y))}},{key:"renderTicks",value:function(){var r=this,s=this.props,l=s.ticks,i=s.tick,u=s.angle,m=s.tickFormatter,f=s.stroke,p=Et(s,hn),x=this.getTickTextAnchor(),b=L(p,!1),y=L(i,!1),v=l.map(function(h,w){var j=r.getTickValueCoord(h),A=fe(fe(fe(fe({textAnchor:x,transform:"rotate(".concat(90-u,", ").concat(j.x,", ").concat(j.y,")")},b),{},{stroke:"none",fill:f},y),{},{index:w},j),{},{payload:h});return g.createElement(q,Ce({className:ee("recharts-polar-radius-axis-tick",Ht(i)),key:"tick-".concat(h.coordinate)},ut(r.props,h,w)),t.renderTickItem(i,A,m?m(h.value,w):h.value))});return g.createElement(q,{className:"recharts-polar-radius-axis-ticks"},v)}},{key:"render",value:function(){var r=this.props,s=r.ticks,l=r.axisLine,i=r.tick;return!s||!s.length?null:g.createElement(q,{className:ee("recharts-polar-radius-axis",this.props.className)},l&&this.renderAxisLine(),i&&this.renderTicks(),Zt.renderCallByParent(this.props,this.getViewBox()))}}],[{key:"renderTickItem",value:function(r,s,l){var i;return g.isValidElement(r)?i=g.cloneElement(r,s):ce(r)?i=r(s):i=g.createElement(ct,Ce({},s,{className:"recharts-polar-radius-axis-tick-value"}),l),i}}])}(T.PureComponent);Ze(Xe,"displayName","PolarRadiusAxis");Ze(Xe,"axisType","radiusAxis");Ze(Xe,"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});function Ne(e){"@babel/helpers - typeof";return Ne=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ne(e)}function he(){return he=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var r in a)Object.prototype.hasOwnProperty.call(a,r)&&(e[r]=a[r])}return e},he.apply(this,arguments)}function Lt(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),a.push.apply(a,r)}return a}function me(e){for(var t=1;t<arguments.length;t++){var a=arguments[t]!=null?arguments[t]:{};t%2?Lt(Object(a),!0).forEach(function(r){Ye(e,r,a[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):Lt(Object(a)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(a,r))})}return e}function On(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Dt(e,t){for(var a=0;a<t.length;a++){var r=t[a];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,lr(r.key),r)}}function kn(e,t,a){return t&&Dt(e.prototype,t),a&&Dt(e,a),Object.defineProperty(e,"prototype",{writable:!1}),e}function Nn(e,t,a){return t=qe(t),Sn(e,or()?Reflect.construct(t,a||[],qe(e).constructor):t.apply(e,a))}function Sn(e,t){if(t&&(Ne(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Pn(e)}function Pn(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function or(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(or=function(){return!!e})()}function qe(e){return qe=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(a){return a.__proto__||Object.getPrototypeOf(a)},qe(e)}function _n(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&st(e,t)}function st(e,t){return st=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,s){return r.__proto__=s,r},st(e,t)}function Ye(e,t,a){return t=lr(t),t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function lr(e){var t=En(e,"string");return Ne(t)=="symbol"?t:t+""}function En(e,t){if(Ne(e)!="object"||!e)return e;var a=e[Symbol.toPrimitive];if(a!==void 0){var r=a.call(e,t);if(Ne(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Tn=Math.PI/180,Rt=1e-5,Je=function(e){function t(){return On(this,t),Nn(this,t,arguments)}return _n(t,e),kn(t,[{key:"getTickLineCoord",value:function(r){var s=this.props,l=s.cx,i=s.cy,u=s.radius,m=s.orientation,f=s.tickSize,p=f||8,x=se(l,i,u,r.coordinate),b=se(l,i,u+(m==="inner"?-1:1)*p,r.coordinate);return{x1:x.x,y1:x.y,x2:b.x,y2:b.y}}},{key:"getTickTextAnchor",value:function(r){var s=this.props.orientation,l=Math.cos(-r.coordinate*Tn),i;return l>Rt?i=s==="outer"?"start":"end":l<-Rt?i=s==="outer"?"end":"start":i="middle",i}},{key:"renderAxisLine",value:function(){var r=this.props,s=r.cx,l=r.cy,i=r.radius,u=r.axisLine,m=r.axisLineType,f=me(me({},L(this.props,!1)),{},{fill:"none"},L(u,!1));if(m==="circle")return g.createElement(Xt,he({className:"recharts-polar-angle-axis-line"},f,{cx:s,cy:l,r:i}));var p=this.props.ticks,x=p.map(function(b){return se(s,l,i,b.coordinate)});return g.createElement(en,he({className:"recharts-polar-angle-axis-line"},f,{points:x}))}},{key:"renderTicks",value:function(){var r=this,s=this.props,l=s.ticks,i=s.tick,u=s.tickLine,m=s.tickFormatter,f=s.stroke,p=L(this.props,!1),x=L(i,!1),b=me(me({},p),{},{fill:"none"},L(u,!1)),y=l.map(function(v,h){var w=r.getTickLineCoord(v),j=r.getTickTextAnchor(v),A=me(me(me({textAnchor:j},p),{},{stroke:"none",fill:f},x),{},{index:h,payload:v,x:w.x2,y:w.y2});return g.createElement(q,he({className:ee("recharts-polar-angle-axis-tick",Ht(i)),key:"tick-".concat(v.coordinate)},ut(r.props,v,h)),u&&g.createElement("line",he({className:"recharts-polar-angle-axis-tick-line"},b,w)),i&&t.renderTickItem(i,A,m?m(v.value,h):v.value))});return g.createElement(q,{className:"recharts-polar-angle-axis-ticks"},y)}},{key:"render",value:function(){var r=this.props,s=r.ticks,l=r.radius,i=r.axisLine;return l<=0||!s||!s.length?null:g.createElement(q,{className:ee("recharts-polar-angle-axis",this.props.className)},i&&this.renderAxisLine(),this.renderTicks())}}],[{key:"renderTickItem",value:function(r,s,l){var i;return g.isValidElement(r)?i=g.cloneElement(r,s):ce(r)?i=r(s):i=g.createElement(ct,he({},s,{className:"recharts-polar-angle-axis-tick-value"}),l),i}}])}(T.PureComponent);Ye(Je,"displayName","PolarAngleAxis");Ye(Je,"axisType","angleAxis");Ye(Je,"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 We;function Se(e){"@babel/helpers - typeof";return Se=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Se(e)}function Oe(){return Oe=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var r in a)Object.prototype.hasOwnProperty.call(a,r)&&(e[r]=a[r])}return e},Oe.apply(this,arguments)}function $t(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),a.push.apply(a,r)}return a}function O(e){for(var t=1;t<arguments.length;t++){var a=arguments[t]!=null?arguments[t]:{};t%2?$t(Object(a),!0).forEach(function(r){Z(e,r,a[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):$t(Object(a)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(a,r))})}return e}function Ln(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function It(e,t){for(var a=0;a<t.length;a++){var r=t[a];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,ur(r.key),r)}}function Dn(e,t,a){return t&&It(e.prototype,t),a&&It(e,a),Object.defineProperty(e,"prototype",{writable:!1}),e}function Rn(e,t,a){return t=Ge(t),$n(e,cr()?Reflect.construct(t,a||[],Ge(e).constructor):t.apply(e,a))}function $n(e,t){if(t&&(Se(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return In(e)}function In(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function cr(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(cr=function(){return!!e})()}function Ge(e){return Ge=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(a){return a.__proto__||Object.getPrototypeOf(a)},Ge(e)}function Cn(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&it(e,t)}function it(e,t){return it=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,s){return r.__proto__=s,r},it(e,t)}function Z(e,t,a){return t=ur(t),t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function ur(e){var t=Fn(e,"string");return Se(t)=="symbol"?t:t+""}function Fn(e,t){if(Se(e)!="object"||!e)return e;var a=e[Symbol.toPrimitive];if(a!==void 0){var r=a.call(e,t);if(Se(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var te=function(e){function t(a){var r;return Ln(this,t),r=Rn(this,t,[a]),Z(r,"pieRef",null),Z(r,"sectorRefs",[]),Z(r,"id",tr("recharts-pie-")),Z(r,"handleAnimationEnd",function(){var s=r.props.onAnimationEnd;r.setState({isAnimationFinished:!0}),ce(s)&&s()}),Z(r,"handleAnimationStart",function(){var s=r.props.onAnimationStart;r.setState({isAnimationFinished:!1}),ce(s)&&s()}),r.state={isAnimationFinished:!a.isAnimationActive,prevIsAnimationActive:a.isAnimationActive,prevAnimationId:a.animationId,sectorToFocus:0},r}return Cn(t,e),Dn(t,[{key:"isActiveIndex",value:function(r){var s=this.props.activeIndex;return Array.isArray(s)?s.indexOf(r)!==-1:r===s}},{key:"hasActiveIndex",value:function(){var r=this.props.activeIndex;return Array.isArray(r)?r.length!==0:r||r===0}},{key:"renderLabels",value:function(r){var s=this.props.isAnimationActive;if(s&&!this.state.isAnimationFinished)return null;var l=this.props,i=l.label,u=l.labelLine,m=l.dataKey,f=l.valueKey,p=L(this.props,!1),x=L(i,!1),b=L(u,!1),y=i&&i.offsetRadius||20,v=r.map(function(h,w){var j=(h.startAngle+h.endAngle)/2,A=se(h.cx,h.cy,h.outerRadius+y,j),S=O(O(O(O({},p),h),{},{stroke:"none"},x),{},{index:w,textAnchor:t.getTextAnchor(A.x,h.cx)},A),K=O(O(O(O({},p),h),{},{fill:"none",stroke:h.fill},b),{},{index:w,points:[se(h.cx,h.cy,h.outerRadius,j),A]}),k=m;return ie(m)&&ie(f)?k="value":ie(m)&&(k=f),g.createElement(q,{key:"label-".concat(h.startAngle,"-").concat(h.endAngle,"-").concat(h.midAngle,"-").concat(w)},u&&t.renderLabelLineItem(u,K,"line"),t.renderLabelItem(i,S,ue(h,k)))});return g.createElement(q,{className:"recharts-pie-labels"},v)}},{key:"renderSectorsStatically",value:function(r){var s=this,l=this.props,i=l.activeShape,u=l.blendStroke,m=l.inactiveShape;return r.map(function(f,p){if((f==null?void 0:f.startAngle)===0&&(f==null?void 0:f.endAngle)===0&&r.length!==1)return null;var x=s.isActiveIndex(p),b=m&&s.hasActiveIndex()?m:null,y=x?i:b,v=O(O({},f),{},{stroke:u?f.fill:f.stroke,tabIndex:-1});return g.createElement(q,Oe({ref:function(w){w&&!s.sectorRefs.includes(w)&&s.sectorRefs.push(w)},tabIndex:-1,className:"recharts-pie-sector"},ut(s.props,f,p),{key:"sector-".concat(f==null?void 0:f.startAngle,"-").concat(f==null?void 0:f.endAngle,"-").concat(f.midAngle,"-").concat(p)}),g.createElement(Cr,Oe({option:y,isActive:x,shapeType:"sector"},v)))})}},{key:"renderSectorsWithAnimation",value:function(){var r=this,s=this.props,l=s.sectors,i=s.isAnimationActive,u=s.animationBegin,m=s.animationDuration,f=s.animationEasing,p=s.animationId,x=this.state,b=x.prevSectors,y=x.prevIsAnimationActive;return g.createElement(Jt,{begin:u,duration:m,isActive:i,easing:f,from:{t:0},to:{t:1},key:"pie-".concat(p,"-").concat(y),onAnimationStart:this.handleAnimationStart,onAnimationEnd:this.handleAnimationEnd},function(v){var h=v.t,w=[],j=l&&l[0],A=j.startAngle;return l.forEach(function(S,K){var k=b&&b[K],B=K>0?Fr(S,"paddingAngle",0):0;if(k){var I=pe(k.endAngle-k.startAngle,S.endAngle-S.startAngle),D=O(O({},S),{},{startAngle:A+B,endAngle:A+I(h)+B});w.push(D),A=D.endAngle}else{var V=S.endAngle,F=S.startAngle,X=pe(0,V-F),P=X(h),z=O(O({},S),{},{startAngle:A+B,endAngle:A+P+B});w.push(z),A=z.endAngle}}),g.createElement(q,null,r.renderSectorsStatically(w))})}},{key:"attachKeyboardHandlers",value:function(r){var s=this;r.onkeydown=function(l){if(!l.altKey)switch(l.key){case"ArrowLeft":{var i=++s.state.sectorToFocus%s.sectorRefs.length;s.sectorRefs[i].focus(),s.setState({sectorToFocus:i});break}case"ArrowRight":{var u=--s.state.sectorToFocus<0?s.sectorRefs.length-1:s.state.sectorToFocus%s.sectorRefs.length;s.sectorRefs[u].focus(),s.setState({sectorToFocus:u});break}case"Escape":{s.sectorRefs[s.state.sectorToFocus].blur(),s.setState({sectorToFocus:0});break}}}}},{key:"renderSectors",value:function(){var r=this.props,s=r.sectors,l=r.isAnimationActive,i=this.state.prevSectors;return l&&s&&s.length&&(!i||!Qt(i,s))?this.renderSectorsWithAnimation():this.renderSectorsStatically(s)}},{key:"componentDidMount",value:function(){this.pieRef&&this.attachKeyboardHandlers(this.pieRef)}},{key:"render",value:function(){var r=this,s=this.props,l=s.hide,i=s.sectors,u=s.className,m=s.label,f=s.cx,p=s.cy,x=s.innerRadius,b=s.outerRadius,y=s.isAnimationActive,v=this.state.isAnimationFinished;if(l||!i||!i.length||!we(f)||!we(p)||!we(x)||!we(b))return null;var h=ee("recharts-pie",u);return g.createElement(q,{tabIndex:this.props.rootTabIndex,className:h,ref:function(j){r.pieRef=j}},this.renderSectors(),m&&this.renderLabels(i),Zt.renderCallByParent(this.props,null,!1),(!y||v)&&er.renderCallByParent(this.props,i,!1))}}],[{key:"getDerivedStateFromProps",value:function(r,s){return s.prevIsAnimationActive!==r.isAnimationActive?{prevIsAnimationActive:r.isAnimationActive,prevAnimationId:r.animationId,curSectors:r.sectors,prevSectors:[],isAnimationFinished:!0}:r.isAnimationActive&&r.animationId!==s.prevAnimationId?{prevAnimationId:r.animationId,curSectors:r.sectors,prevSectors:s.curSectors,isAnimationFinished:!0}:r.sectors!==s.curSectors?{curSectors:r.sectors,isAnimationFinished:!0}:null}},{key:"getTextAnchor",value:function(r,s){return r>s?"start":r<s?"end":"middle"}},{key:"renderLabelLineItem",value:function(r,s,l){if(g.isValidElement(r))return g.cloneElement(r,s);if(ce(r))return r(s);var i=ee("recharts-pie-label-line",typeof r!="boolean"?r.className:"");return g.createElement(Yt,Oe({},s,{key:l,type:"linear",className:i}))}},{key:"renderLabelItem",value:function(r,s,l){if(g.isValidElement(r))return g.cloneElement(r,s);var i=l;if(ce(r)&&(i=r(s),g.isValidElement(i)))return i;var u=ee("recharts-pie-label-text",typeof r!="boolean"&&!ce(r)?r.className:"");return g.createElement(ct,Oe({},s,{alignmentBaseline:"middle",className:u}),i)}}])}(T.PureComponent);We=te;Z(te,"displayName","Pie");Z(te,"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:!rr.isSsr,animationBegin:400,animationDuration:1500,animationEasing:"ease",nameKey:"name",blendStroke:!1,rootTabIndex:0});Z(te,"parseDeltaAngle",function(e,t){var a=Ve(t-e),r=Math.min(Math.abs(t-e),360);return a*r});Z(te,"getRealPieData",function(e){var t=e.data,a=e.children,r=L(e,!1),s=nr(a,rt);return t&&t.length?t.map(function(l,i){return O(O(O({payload:l},r),l),s&&s[i]&&s[i].props)}):s&&s.length?s.map(function(l){return O(O({},r),l.props)}):[]});Z(te,"parseCoordinateOfPie",function(e,t){var a=t.top,r=t.left,s=t.width,l=t.height,i=zr(s,l),u=r+Me(e.cx,s,s/2),m=a+Me(e.cy,l,l/2),f=Me(e.innerRadius,i,0),p=Me(e.outerRadius,i,i*.8),x=e.maxRadius||Math.sqrt(s*s+l*l)/2;return{cx:u,cy:m,innerRadius:f,outerRadius:p,maxRadius:x}});Z(te,"getComposedData",function(e){var t=e.item,a=e.offset,r=t.type.defaultProps!==void 0?O(O({},t.type.defaultProps),t.props):t.props,s=We.getRealPieData(r);if(!s||!s.length)return null;var l=r.cornerRadius,i=r.startAngle,u=r.endAngle,m=r.paddingAngle,f=r.dataKey,p=r.nameKey,x=r.valueKey,b=r.tooltipType,y=Math.abs(r.minAngle),v=We.parseCoordinateOfPie(r,a),h=We.parseDeltaAngle(i,u),w=Math.abs(h),j=f;ie(f)&&ie(x)?(Ot(!1,`Use "dataKey" to specify the value of pie,
3 the props "valueKey" will be deprecated in 1.1.0`),j="value"):ie(f)&&(Ot(!1,`Use "dataKey" to specify the value of pie, 4 the props "valueKey" will be deprecated in 1.1.0`),j=x);var A=s.filter(function(D){return ue(D,j,0)!==0}).length,S=(w>=360?A:A-1)*m,K=w-A*y-S,k=s.reduce(function(D,V){var F=ue(V,j,0);return D+(we(F)?F:0)},0),B;if(k>0){var I;B=s.map(function(D,V){var F=ue(D,j,0),X=ue(D,p,V),P=(we(F)?F:0)/k,z;V?z=I.endAngle+Ve(h)*m*(F!==0?1:0):z=i;var H=z+Ve(h)*((F!==0?y:0)+P*K),C=(z+H)/2,Y=(v.innerRadius+v.outerRadius)/2,W=[{name:X,value:F,payload:D,dataKey:j,type:b}],ve=se(v.cx,v.cy,Y,C);return I=O(O(O({percent:P,cornerRadius:l,name:X,tooltipPayload:W,midAngle:C,middleRadius:Y,tooltipPosition:ve},D),v),{},{value:ue(D,j),startAngle:z,endAngle:H,payload:D,paddingAngle:Ve(h)*m}),I})}return O(O({},v),{},{sectors:B,data:s})});var zn=["type","layout","connectNulls","ref"],Kn=["key"];function Pe(e){"@babel/helpers - typeof";return Pe=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Pe(e)}function Ct(e,t){if(e==null)return{};var a=Bn(e,t),r,s;if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(s=0;s<l.length;s++)r=l[s],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}function Bn(e,t){if(e==null)return{};var a={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;a[r]=e[r]}return a}function Fe(){return Fe=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var r in a)Object.prototype.hasOwnProperty.call(a,r)&&(e[r]=a[r])}return e},Fe.apply(this,arguments)}function Ft(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),a.push.apply(a,r)}return a}function G(e){for(var t=1;t<arguments.length;t++){var a=arguments[t]!=null?arguments[t]:{};t%2?Ft(Object(a),!0).forEach(function(r){Q(e,r,a[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):Ft(Object(a)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(a,r))})}return e}function be(e){return Un(e)||Wn(e)||Vn(e)||Mn()}function Mn(){throw new TypeError(`Invalid attempt to spread non-iterable instance. 5In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Vn(e,t){if(e){if(typeof e=="string")return ot(e,t);var a=Object.prototype.toString.call(e).slice(8,-1);if(a==="Object"&&e.constructor&&(a=e.constructor.name),a==="Map"||a==="Set")return Array.from(e);if(a==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a))return ot(e,t)}}function Wn(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function Un(e){if(Array.isArray(e))return ot(e)}function ot(e,t){(t==null||t>e.length)&&(t=e.length);for(var a=0,r=new Array(t);a<t;a++)r[a]=e[a];return r}function qn(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function zt(e,t){for(var a=0;a<t.length;a++){var r=t[a];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,fr(r.key),r)}}function Gn(e,t,a){return t&&zt(e.prototype,t),a&&zt(e,a),Object.defineProperty(e,"prototype",{writable:!1}),e}function Hn(e,t,a){return t=He(t),Zn(e,dr()?Reflect.construct(t,a||[],He(e).constructor):t.apply(e,a))}function Zn(e,t){if(t&&(Pe(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Xn(e)}function Xn(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function dr(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(dr=function(){return!!e})()}function He(e){return He=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(a){return a.__proto__||Object.getPrototypeOf(a)},He(e)}function Yn(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&<(e,t)}function lt(e,t){return lt=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,s){return r.__proto__=s,r},lt(e,t)}function Q(e,t,a){return t=fr(t),t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function fr(e){var t=Jn(e,"string");return Pe(t)=="symbol"?t:t+""}function Jn(e,t){if(Pe(e)!="object"||!e)return e;var a=e[Symbol.toPrimitive];if(a!==void 0){var r=a.call(e,t);if(Pe(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var ze=function(e){function t(){var a;qn(this,t);for(var r=arguments.length,s=new Array(r),l=0;l<r;l++)s[l]=arguments[l];return a=Hn(this,t,[].concat(s)),Q(a,"state",{isAnimationFinished:!0,totalLength:0}),Q(a,"generateSimpleStrokeDasharray",function(i,u){return"".concat(u,"px ").concat(i-u,"px")}),Q(a,"getStrokeDasharray",function(i,u,m){var f=m.reduce(function(j,A){return j+A});if(!f)return a.generateSimpleStrokeDasharray(u,i);for(var p=Math.floor(i/f),x=i%f,b=u-i,y=[],v=0,h=0;v<m.length;h+=m[v],++v)if(h+m[v]>x){y=[].concat(be(m.slice(0,v)),[x-h]);break}var w=y.length%2===0?[0,b]:[b];return[].concat(be(t.repeat(m,p)),be(y),w).map(function(j){return"".concat(j,"px")}).join(", ")}),Q(a,"id",tr("recharts-line-")),Q(a,"pathRef",function(i){a.mainCurve=i}),Q(a,"handleAnimationEnd",function(){a.setState({isAnimationFinished:!0}),a.props.onAnimationEnd&&a.props.onAnimationEnd()}),Q(a,"handleAnimationStart",function(){a.setState({isAnimationFinished:!1}),a.props.onAnimationStart&&a.props.onAnimationStart()}),a}
vendor: 4,905 bytes, line 5
5return Yn(t,e),Gn(t,[{key:"componentDidMount",value:function(){if(this.props.isAnimationActive){var r=this.getTotalLength();this.setState({totalLength:r})}}},{key:"componentDidUpdate",value:function(){if(this.props.isAnimationActive){var r=this.getTotalLength();r!==this.state.totalLength&&this.setState({totalLength:r})}}},{key:"getTotalLength",value:function(){var r=this.mainCurve;try{return r&&r.getTotalLength&&r.getTotalLength()||0}catch{return 0}}},{key:"renderErrorBar",value:function(r,s){if(this.props.isAnimationActive&&!this.state.isAnimationFinished)return null;var l=this.props,i=l.points,u=l.xAxis,m=l.yAxis,f=l.layout,p=l.children,x=nr(p,Kr);if(!x)return null;var b=function(h,w){return{x:h.x,y:h.y,value:h.value,errorVal:ue(h.payload,w)}},y={clipPath:r?"url(#clipPath-".concat(s,")"):null};return g.createElement(q,y,x.map(function(v){return g.cloneElement(v,{key:"bar-".concat(v.props.dataKey),data:i,xAxis:u,yAxis:m,layout:f,dataPointFormatter:b})}))}},{key:"renderDots",value:function(r,s,l){var i=this.props.isAnimationActive;if(i&&!this.state.isAnimationFinished)return null;var u=this.props,m=u.dot,f=u.points,p=u.dataKey,x=L(this.props,!1),b=L(m,!0),y=f.map(function(h,w){var j=G(G(G({key:"dot-".concat(w),r:3},x),b),{},{index:w,cx:h.x,cy:h.y,value:h.value,dataKey:p,payload:h.payload,points:f});return t.renderDotItem(m,j)}),v={clipPath:r?"url(#clipPath-".concat(s?"":"dots-").concat(l,")"):null};return g.createElement(q,Fe({className:"recharts-line-dots",key:"dots"},v),y)}},{key:"renderCurveStatically",value:function(r,s,l,i){var u=this.props,m=u.type,f=u.layout,p=u.connectNulls;u.ref;var x=Ct(u,zn),b=G(G(G({},L(x,!0)),{},{fill:"none",className:"recharts-line-curve",clipPath:s?"url(#clipPath-".concat(l,")"):null,points:r},i),{},{type:m,layout:f,connectNulls:p});return g.createElement(Yt,Fe({},b,{pathRef:this.pathRef}))}},{key:"renderCurveWithAnimation",value:function(r,s){var l=this,i=this.props,u=i.points,m=i.strokeDasharray,f=i.isAnimationActive,p=i.animationBegin,x=i.animationDuration,b=i.animationEasing,y=i.animationId,v=i.animateNewValues,h=i.width,w=i.height,j=this.state,A=j.prevPoints,S=j.totalLength;return g.createElement(Jt,{begin:p,duration:x,isActive:f,easing:b,from:{t:0},to:{t:1},key:"line-".concat(y),onAnimationEnd:this.handleAnimationEnd,onAnimationStart:this.handleAnimationStart},function(K){var k=K.t;if(A){var B=A.length/u.length,I=u.map(function(P,z){var H=Math.floor(z*B);if(A[H]){var C=A[H],Y=pe(C.x,P.x),W=pe(C.y,P.y);return G(G({},P),{},{x:Y(k),y:W(k)})}if(v){var ve=pe(h*2,P.x),Ke=pe(w/2,P.y);return G(G({},P),{},{x:ve(k),y:Ke(k)})}return G(G({},P),{},{x:P.x,y:P.y})});return l.renderCurveStatically(I,r,s)}var D=pe(0,S),V=D(k),F;if(m){var X="".concat(m).split(/[,\s]+/gim).map(function(P){return parseFloat(P)});F=l.getStrokeDasharray(V,S,X)}else F=l.generateSimpleStrokeDasharray(S,V);return l.renderCurveStatically(u,r,s,{strokeDasharray:F})})}},{key:"renderCurve",value:function(r,s){var l=this.props,i=l.points,u=l.isAnimationActive,m=this.state,f=m.prevPoints,p=m.totalLength;return u&&i&&i.length&&(!f&&p>0||!Qt(f,i))?this.renderCurveWithAnimation(r,s):this.renderCurveStatically(i,r,s)}},{key:"render",value:function(){var r,s=this.props,l=s.hide,i=s.dot,u=s.points,m=s.className,f=s.xAxis,p=s.yAxis,x=s.top,b=s.left,y=s.width,v=s.height,h=s.isAnimationActive,w=s.id;if(l||!u||!u.length)return null;var j=this.state.isAnimationFinished,A=u.length===1,S=ee("recharts-line",m),K=f&&f.allowDataOverflow,k=p&&p.allowDataOverflow,B=K||k,I=ie(w)?this.id:w,D=(r=L(i,!1))!==null&&r!==void 0?r:{r:3,strokeWidth:2},V=D.r,F=V===void 0?3:V,X=D.strokeWidth,P=X===void 0?2:X,z=Br(i)?i:{},H=z.clipDot,C=H===void 0?!0:H,Y=F*2+P;return g.createElement(q,{className:S},K||k?g.createElement("defs",null,g.createElement("clipPath",{id:"clipPath-".concat(I)},g.createElement("rect",{x:K?b:b-y/2,y:k?x:x-v/2,width:K?y:y*2,height:k?v:v*2})),!C&&g.createElement("clipPath",{id:"clipPath-dots-".concat(I)},g.createElement("rect",{x:b-Y/2,y:x-Y/2,width:y+Y,height:v+Y}))):null,!A&&this.renderCurve(B,I),this.renderErrorBar(B,I),(A||i)&&this.renderDots(B,C,I),(!h||j)&&er.renderCallByParent(this.props,u))}}],[{key:"getDerivedStateFromProps",value:function(r,s){return r.animationId!==s.prevAnimationId?{prevAnimationId:r.animationId,curPoints:r.points,prevPoints:s.curPoints}:r.points!==s.curPoints?{curPoints:r.points}:null}},{key:"repeat",value:function(r,s){for(var l=r.length%2!==0?[].concat(be(r),[0]):r,i=[],u=0;u<s;++u)i=[].concat(be(i),be(l));return i}},{key:"renderDotItem",value:function(r,s){var l;if(g.isValidElement(r))l=g.cloneElement(r,s);else if(ce(r))l=r(s);else{var i=s.key,u=Ct(s,Kn),m=ee("recharts-line-dot",typeof r!="boolean"?r.className:"");l=g.createElement(Xt,Fe({key:i},u,{className:m}))}return l}}])}(T.PureComponent);Q(ze,"displayName","Line");Q(ze,"defaultProps",{xAxisId:0,yAxisId:0,connectNulls:!1,activeDot:!0,dot:!0,legendT
5ype:"line",stroke:"#3182bd",strokeWidth:1,fill:"#fff",points:[],isAnimationActive:!rr.isSsr,animateNewValues:!0,animationBegin:0,animationDuration:1500,animationEasing:"ease",hide:!1,label:!1});Q(ze,"getComposedData",function(e){var t=e.props,a=e.xAxis,r=e.yAxis,s=e.xAxisTicks,l=e.yAxisTicks,i=e.dataKey,u=e.bandSize,m=e.displayedData,f=e.offset,p=t.layout,x=m.map(function(b,y){var v=ue(b,i);return p==="horizontal"?{x:kt({axis:a,ticks:s,bandSize:u,entry:b,index:y}),y:ie(v)?null:r.scale(v),value:v,payload:b}:{x:ie(v)?null:a.scale(v),y:kt({axis:r,ticks:l,bandSize:u,entry:b,index:y}),value:v,payload:b}});return G({points:x,layout:p},f)});var Qn=ar({chartName:"LineChart",GraphicalChild:ze,axisComponents:[{axisType:"xAxis",AxisComp:oe},{axisType:"yAxis",AxisComp:le}],formatAxisMap:Mr}),Kt=ar({chartName:"PieChart",GraphicalChild:te,validateTooltipEventTypes:["item"],defaultTooltipEventType:"item",legendContent:"children",axisComponents:[{axisType:"angleAxis",AxisComp:Je},{axisType:"radiusAxis",AxisComp:Xe}],formatAxisMap:Vr,defaultProps:{layout:"centric",startAngle:0,endAngle:360,cx:"50%",cy:"50%",innerRadius:0,outerRadius:"80%"}});const Re={7:"Last 7 days",30:"Last 30 days",90:"Last 90 days",365:"Last year"},je=["hsl(var(--primary))","hsl(var(--chart-2, 200 70% 50%))","hsl(var(--chart-3, 280 70% 55%))","hsl(var(--chart-4, 30 80% 55%))","hsl(var(--chart-5, 150 60% 45%))","hsl(var(--muted-foreground))"];function tt(e){return new Date(Date.now()-e*864e5).toISOString()}function Bt(e){if(!e)return"Desktop";const t=e.toLowerCase();return/bot|crawler|spider|spyder|slurp|bingpreview|facebookexternalhit|whatsapp/.test(t)?"Bot":/ipad|tablet/.test(t)?"Tablet":/mobi|iphone|android.*mobile/.test(t)?"Mobile":"Desktop"}function Mt(e){if(!e)return"Unknown";const t=e;return/Edg\//.test(t)?"Edge":/OPR\/|Opera/.test(t)?"Opera":/Chrome\//.test(t)&&!/Chromium/.test(t)?"Chrome":/Firefox\//.test(t)?"Firefox":/Safari\//.test(t)?"Safari":"Other"}function ea(e){if(!e)return"Direct";try{return new URL(e).hostname.replace(/^www\./,"")}catch{return"Direct"}}function ta(e){if(e.length===0)return"";const t=Object.keys(e[0]),a=r=>{const s=r==null?"":String(r);return/[",\n]/.test(s)?`"${s.replace(/"/g,'""')}"`:s};return[t.join(","),...e.map(r=>t.map(s=>a(r[s])).join(","))].join(` 6`)}function Vt(e,t){const a=new Blob([ta(t)],{type:"text/csv;charset=utf-8"}),r=URL.createObjectURL(a),s=document.createElement("a");s.href=r,s.download=e,s.click(),URL.revokeObjectURL(r)}function Wt({start:e,end:t,onChange:a,fallbackLabel:r}){const s=!!(e||t);return n.jsxs("div",{className:"flex flex-wrap items-center gap-2 rounded-md border bg-card px-3 py-2",children:[n.jsx(kr,{className:"h-4 w-4 text-muted-foreground"}),n.jsx("span",{className:"text-xs text-muted-foreground",children:"Date range:"}),n.jsxs(bt,{children:[n.jsx(jt,{asChild:!0,children:n.jsx($e,{variant:"outline",size:"sm",className:yt("h-8",!e&&"text-muted-foreground"),children:e?xt(e,"PP"):"Start date"})}),n.jsx(wt,{className:"w-auto p-0",align:"start",children:n.jsx(At,{mode:"single",selected:e,onSelect:l=>a(l??void 0,t),initialFocus:!0,className:"p-3 pointer-events-auto"})})]}),n.jsx("span",{className:"text-xs text-muted-foreground",children:"â"}),n.jsxs(bt,{children:[n.jsx(jt,{asChild:!0,children:n.jsx($e,{variant:"outline",size:"sm",className:yt("h-8",!t&&"text-muted-foreground"),children:t?xt(t,"PP"):"End date"})}),n.jsx(wt,{className:"w-auto p-0",align:"start",children:n.jsx(At,{mode:"single",selected:t,onSelect:l=>a(e,l??void 0),initialFocus:!0,className:"p-3 pointer-events-auto"})})]}),s?n.jsxs($e,{variant:"ghost",size:"sm",className:"h-8 px-2",onClick:()=>a(void 0,void 0),children:[n.jsx(Nr,{className:"h-3.5 w-3.5 mr-1"})," Clear"]}):n.jsxs("span",{className:"text-[11px] text-muted-foreground ml-1",children:["Using: ",r]})]})}function ma(){var ve,Ke,dt,ft,mt;const[e,t]=T.useState("30"),a=Rr(),r=Number(e),[s,l]=T.useState(void 0),[i,u]=T.useState(void 0),m=T.useMemo(()=>{const o=i??new Date;return{startISO:(s??new Date(Date.now()-r*864e5)).toISOString(),endISO:new Date(o.getFullYear(),o.getMonth(),o.getDate(),23,59,59,999).toISOString(),custom:!!(s||i)}},[s,i,r]);async function f(o){const d=[];for(let N=0;N<1e5;N+=1e3){const _e=N+1e3-1,{data:Be,error:M}=await o().range(N,_e);
6if(M)throw M;const re=Be??[];if(d.push(...re),re.length<1e3)break}return d}const p=Ee({queryKey:["analytics-pv",e],queryFn:async()=>f(()=>Te.from("page_views").select("path, referrer, user_agent, created_at").gte("created_at",tt(r)).order("created_at",{ascending:!1}))}),x=Ee({queryKey:["analytics-leads",e],queryFn:async()=>f(()=>Te.from("leads").select("status, service_interest, source, created_at").gte("created_at",tt(r)).order("created_at",{ascending:!1}))}),b=Ee({queryKey:["analytics-contacts",e],queryFn:async()=>f(()=>Te.from("contact_submissions").select("is_read, created_at").gte("created_at",tt(r)).order("created_at",{ascending:!1}))}),y=Ee({queryKey:["analytics-events",e,m.startISO,m.endISO],queryFn:async()=>f(()=>Te.from("events").select("name, path, session_id, props, created_at").gte("created_at",m.startISO).lte("created_at",m.endISO).order("created_at",{ascending:!1}))}),v=Ee({queryKey:["analytics-counts"],queryFn:async()=>{const o=["blog_posts","services","projects","tools","team_members","testimonials","media_assets"],c={};return await Promise.all(o.map(async d=>{const{count:N}=await Te.from(d).select("*",{count:"exact",head:!0});c[d]=N??0})),c}}),h=T.useMemo(()=>{const o={};for(let c=r-1;c>=0;c--){const d=new Date(Date.now()-c*864e5).toISOString().slice(0,10);o[d]={day:d,views:0,visitors:new Set}}for(const c of p.data??[]){const d=c.created_at.slice(0,10);o[d]&&(o[d].views+=1,o[d].visitors.add((c.user_agent??"")+"|"+(c.referrer??"")))}return Object.values(o).map(c=>({day:c.day.slice(5),views:c.views,visitors:c.visitors.size}))},[p.data,r]),w=T.useMemo(()=>{const o={};for(let c=r-1;c>=0;c--){const d=new Date(Date.now()-c*864e5).toISOString().slice(0,10);o[d]=0}for(const c of x.data??[]){const d=c.created_at.slice(0,10);d in o&&(o[d]+=1)}return Object.entries(o).map(([c,d])=>({day:c.slice(5),count:d}))},[x.data,r]),j=T.useMemo(()=>{const o={};for(const c of p.data??[])o[c.path]=(o[c.path]??0)+1;return Object.entries(o).sort((c,d)=>d[1]-c[1]).slice(0,12).map(([c,d])=>({path:c,count:d}))},[p.data]),A=T.useMemo(()=>{const o={};for(const c of p.data??[]){const d=ea(c.referrer);o[d]=(o[d]??0)+1}return Object.entries(o).sort((c,d)=>d[1]-c[1]).slice(0,10).map(([c,d])=>({name:c,value:d}))},[p.data]),S=T.useMemo(()=>{const o={};for(const c of p.data??[]){const d=Bt(c.user_agent);o[d]=(o[d]??0)+1}return Object.entries(o).map(([c,d])=>({name:c,value:d}))},[p.data]),K=T.useMemo(()=>{const o={};for(const c of p.data??[]){const d=Mt(c.user_agent);o[d]=(o[d]??0)+1}return Object.entries(o).sort((c,d)=>d[1]-c[1]).map(([c,d])=>({name:c,value:d}))},[p.data]),k=T.useMemo(()=>{const o={};for(const c of x.data??[])o[c.status??"new"]=(o[c.status??"new"]??0)+1;return Object.entries(o).map(([c,d])=>({name:c,value:d}))},[x.data]),B=T.useMemo(()=>{const o={};for(const c of x.data??[]){const d=c.service_interest||"Unspecified";o[d]=(o[d]??0)+1}return Object.entries(o).sort((c,d)=>d[1]-c[1]).slice(0,8).map(([c,d])=>({name:c,value:d}))},[x.data]),I=((ve=p.data)==null?void 0:ve.length)??0,D=T.useMemo(()=>{const o=new Set;for(const c of p.data??[])o.add((c.user_agent??"")+"|"+(c.referrer??""));return o.size},[p.data]),V=((Ke=x.data)==null?void 0:Ke.length)??0,F=((dt=b.data)==null?void 0:dt.length)??0,X=I>0?(V/I*100).toFixed(2):"0.00",P=T.useMemo(()=>{const o={};for(const c of y.data??[])o[c.name]=(o[c.name]??0)+1;return Object.entries(o).sort((c,d)=>d[1]-c[1]).map(([c,d])=>({name:c,value:d}))},[y.data]),z=T.useMemo(()=>{var c;const o={};for(const d of y.data??[]){if(d.name!=="button_click")continue;const N=((c=d.props)==null?void 0:c.label)||"(unlabeled)";o[N]=(o[N]??0)+1}return Object.entries(o).sort((d,N)=>N[1]-d[1]).slice(0,10).map(([d,N])=>({name:d,value:N}))},[y.data]),H=T.useMemo(()=>{var c;const o={};for(const d of y.data??[]){if(d.name!=="outbound_click")continue;const N=((c=d.props)==null?void 0:c.href)||"â";o[N]=(o[N]??0)+1}return Object.entries(o).sort((d,N)=>N[1]-d[1]).slice(0,10).map(([d,N])=>({name:d,value:N}))},[y.data]),C=T.useMemo(()=>{const o={view:new Set,submit:new Set,lead:new Set};for(const M of y.data??[]){const re=M.session_id??`anon:${M.created_at}`;M.name==="page_view"?o.view.add(re):(M.name==="form_submit"||M.name==="form_submit_success"||M.name==="contact_submitted")&&o.submit.add(re),(M.name==="lead_created"||M.name==="contact_submitted")&&o.lead.add(re)}const c=o.view.size,d=o.submit.size,N=o.lead.size,_e=[{key:"view",label:"Visited site",count:c},{key:"submit",label:"Started / submitted form",count:d},{key:"lead",label:"Became a lead",count:N}],Be=_e[0].count||1;return _e.map((M,re)=>{const Qe=re===0?M.count:_e[re-1].count,mr=Be>0?M.count/Be*100:0,pt=Qe>0?M.count/Qe*100:0,pr=Qe>0?100-pt:0;return{...M,overallPct:mr,stepPct:pt,dropPct:pr}})},[y.data]),Y=[{label:"Page views",value:I,icon:hr,sub:`${Re[e]}`},{label:"Unique visitors",value:D,icon:vr,sub:"estimated"},{label:"New leads",value:V,icon:xr,sub:"captured"},{label:"Contact messages",value:F,icon:yr,sub:"received"},{label:"Lead conv. rate",value:`${X}%`,icon:gr,sub:"leads / views"},{label:"Top page",value:((ft=j[0])==null?void 0:ft.path)??"â",icon:br,sub:`${((mt=j[0])==null?void 0:mt.count)??0} views`,truncate:!0}],W=p.isLoading||x.isLoading;return n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[n.jsxs("div",{children:[n.jsx("h1",{className:"text-2xl font-semibold",children:"Analytics"}),n.jsx("p",{className:"text-sm text-muted-foreground",children:"Traffic, audience, content, and lead performance across your site."})]}),n.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[n.jsxs(Sr,{value:e,onValueChange:o=>t(o),children:[n.jsx(Pr,{className:"w-full sm:w-[160px] min-w-[140px]",children:n.jsx(_r,{})}),n.jsx(Er,{children:Object.keys(Re).map(o=>n.jsx(Tr,{value:o,children:Re[o]},o))})]}),n.jsxs($e,{variant:"outline",size:"sm",className:"shrink-0",onClick:()=>Vt(`analytics-pageviews-${e}d.csv`,(p.data??[]).map(o=>({created_at:o.created_at,path:o.path,referrer:o.referrer??"",device:Bt(o.user_agent),browser:Mt(o.user_agent)}))),children:[n.jsx(ht,{className:"h-4 w-4 mr-1.5"})," Export CSV"]})]})]}),n.jsx("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-6",children:Y.map(o=>n.jsxs(_,{children:[n.jsxs(R,{className:"pb-2 flex-row items-center justify-between space-y-0",children:[n.jsx($,{className:"text-[11px] font-medium uppercase tracking-wide text-muted-foreground",children:o.label}),n.jsx(o.icon,{className:"h-4 w-4 text-muted-foreground"})]}),n.jsxs(E,{children:[W?n.jsx(U,{className:"h-8 w-20"}):n.jsx("div",{className:`text-2xl font-semibold ${"truncate"in o&&o.truncate?"truncate text-base":""}`,children:o.value}),n.jsx("p",{className:"text-[11px] text-muted-foreground mt-1",children:o.sub})]})]},o.label))}),n.jsxs(Lr,{defaultValue:"traffic",children:[n.jsx("div",{className:"overflow-x-auto -mx-1 px-1",children:n.jsxs(Dr,{className:"w-max",children:[n.jsx(ye,{value:"traffic",children:"Traffic"}),n.jsx(ye,{value:"audience",children:"Audience"}),n.jsx(ye,{value:"content",children:"Content"}),n.jsx(ye,{value:"leads",children:"Leads"}),n.jsx(ye,{value:"funnel",children:"Funnel"}),n.jsx(ye,{value:"events",children:"Events"})]})}),n.jsxs(ge,{value:"traffic",className:"space-y-4",children:[n.jsxs(_,{children:[n.jsxs(R,{children:[n.jsx($,{className:"text-base",children:"Views & visitors"}),n.jsx(J,{children:"Daily page views and estimated unique visitors"})]}),n.jsx(E,{className:"h-[320px] min-w-0 overflow-hidden",children:W?n.jsx(U,{className:"h-full w-full"}):n.jsx(ne,{width:"100%",height:"100%",children:n.jsxs(Wr,{data:h,children:[n.jsxs("defs",{children:[n.jsxs("linearGradient",{id:"viewsFill",x1:"0",y1:"0",x2:"0",y2:"1",children:[n.jsx("stop",{offset:"0%",stopColor:"hsl(var(--primary))",stopOpacity:.5}),n.jsx("stop",{offset:"100%",stopColor:"hsl(var(--primary))",stopOpacity:0})]}),n.jsxs("linearGradient",{id:"visitorsFill",x1:"0",y1:"0",x2:"0",y2:"1",children:[n.jsx("stop",{offset:"0%",stopColor:"hsl(var(--muted-foreground))",stopOpacity:.35}),n.jsx("stop",{offset:"100%",stopColor:"hsl(var(--muted-foreground))",stopOpacity:0})]})]}),n.jsx(de,{strokeDasharray:"3 3",stroke:"hsl(var(--border))"}),n.jsx(oe,{dataKey:"day",stroke:"hsl(var(--muted-foreground))",fontSize:11}),n.jsx(le,{allowDecimals:!1,stroke:"hsl(var(--muted-foreground))",fontSize:11}),n.jsx(ae,{contentStyle:{background:"hsl(var(--popover))",border:"1px solid hsl(var(--border))",borderRadius:8,fontSize:12}}),n.jsx(et,{wrapperStyle:{fontSize:12}}),n.jsx(Nt,{type:"monotone",dataKey:"views",stroke:"hsl(var(--primary))",fill:"url(#viewsFill)",strokeWidth:2}),n.jsx(Nt,{type:"monotone",dataKey:"visitors",stroke:"hsl(var(--muted-foreground))",fill:"url(#visitorsFill)",strokeWidth:2})]})})})]}),n.jsxs("div",{className:"grid gap-4 lg:grid-cols-2 [&>*]:min-w-0",children:[n.jsxs(_,{children:[n.jsxs(R,{children:[n.jsx($,{className:"text-base",children:"Top referrers"}),n.jsx(J,{children:"Where your visitors are coming from"})]}),n.jsx(E,{className:"h-[300px] min-w-0 overflow-hidden",children:W?n.jsx(U,{className:"h-full w-full"}):A.length===0?n.jsx("p",{className:"text-sm text-muted-foreground",children:"No data."}):n.jsx(ne,{width:"100%",height:"100%",children:n.jsxs(De,{data:A,layout:"vertical",margin:{left:8},children:[n.jsx(de,{strokeDasharray:"3 3",stroke:"hsl(var(--border))",horizontal:!1}),n.jsx(oe,{type:"number",stroke:"hsl(var(--muted-foreground))",fontSize:11}),n.jsx(le,{type:"category",dataKey:"name",width:a?80:120,stroke:"hsl(var(--muted-foreground))",fontSize:11}),n.jsx(ae,{contentStyle:{background:"hsl(var(--popover))",border:"1px solid hsl(var(--border))",borderRadius:8,fontSize:12}}),n.jsx(Le,{dataKey:"value",fill:"hsl(var(--primary))",radius:[0,4,4,0]})]})})})]}),n.jsxs(_,{children:[n.jsxs(R,{children:[n.jsx($,{className:"text-base",children:"Top pages"}),n.jsx(J,{children:"Most visited URLs"})]}),n.jsxs(E,{children:[W&&n.jsx(U,{className:"h-48 w-full"}),!W&&j.length===0&&n.jsx("p",{className:"text-sm text-muted-foreground",children:"No page views yet."}),j.length>0&&n.jsx("div",{className:"space-y-1.5",children:j.map(o=>{const c=j[0].count,d=o.count/c*100;return n.jsxs(gt,{to:o.path,target:"_blank",rel:"noreferrer",className:"flex items-center gap-2 sm:gap-3 text-sm rounded px-1 py-0.5 hover:bg-muted/60",children:[n.jsx("div",{className:"w-2/5 sm:w-1/2 truncate font-mono text-xs",children:o.path}),n.jsx("div",{className:"flex-1 bg-muted rounded h-2 overflow-hidden min-w-[40px]",children:n.jsx("div",{className:"h-full bg-primary",style:{width:`${d}%`}})}),n.jsx("div",{className:"w-10 sm:w-12 text-right tabular-nums text-muted-foreground",children:o.count}),n.jsx(vt,{className:"h-3 w-3 text-muted-foreground shrink-0"})]},o.path)})})]})]})]})]}),n.jsxs(ge,{value:"audience",className:"space-y-4",children:[n.jsxs("div",{className:"grid gap-4 lg:grid-cols-2 [&>*]:min-w-0",children:[n.jsxs(_,{children:[n.jsxs(R,{children:[n.jsxs($,{className:"text-base flex items-center gap-2",children:[n.jsx(jr,{className:"h-4 w-4"})," Devices"]}),n.jsx(J,{children:"Visitor device breakdown"})]}),n.jsx(E,{className:"h-[300px] min-w-0 overflow-hidden",children:W?n.jsx(U,{className:"h-full w-full"}):S.length===0?n.jsx("p",{className:"text-sm text-muted-foreground",children:"No data."}):n.jsx(ne,{width:"100%",height:"100%",children:n.jsxs(Kt,{children:[n.jsx(te,{data:S,dataKey:"value",nameKey:"name",innerRadius:55,outerRadius:95,paddingAngle:2,children:S.map((o,c)=>n.jsx(rt,{fill:je[c%je.length]},c))}),n.jsx(ae,{contentStyle:{background:"hsl(var(--popover))",border:"1px solid hsl(var(--border))",borderRadius:8,fontSize:12}}),n.jsx(et,{wrapperStyle:{fontSize:12}})]})})})]}),n.jsxs(_,{children:[n.jsxs(R,{children:[n.jsxs($,{className:"text-base flex items-center gap-2",children:[n.jsx(wr,{className:"h-4 w-4"})," Browsers"]}),n.jsx(J,{children:"Top browsers by views"})]}),n.jsx(E,{className:"h-[300px] min-w-0 overflow-hidden",children:W?n.jsx(U,{className:"h-full w-full"}):K.length===0?n.jsx("p",{className:"text-sm text-muted-foreground",children:"No data."}):n.jsx(ne,{width:"100%",height:"100%",children:n.jsxs(De,{data:K,children:[n.jsx(de,{strokeDasharray:"3 3",stroke:"hsl(var(--border))"}),n.jsx(oe,{dataKey:"name",stroke:"hsl(var(--muted-foreground))",fontSize:11}),n.jsx(le,{allowDecimals:!1,stroke:"hsl(var(--muted-foreground))",fontSize:11}),n.jsx(ae,{contentStyle:{background:"hsl(var(--popover))",border:"1px solid hsl(var(--border))",borderRadius:8,fontSize:12}}),n.jsx(Le,{dataKey:"value",fill:"hsl(var(--primary))",radius:[4,4,0,0]})]})})})]})]}),n.jsxs(_,{children:[n.jsx(R,{children:n.jsxs($,{className:"text-base flex items-center gap-2",children:[n.jsx(Ar,{className:"h-4 w-4"})," Device + browser summary"]})}),n.jsx(E,{children:n.jsx("div",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-4",children:S.map((o,c)=>n.jsxs("div",{className:"rounded border p-3",children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("span",{className:"text-sm font-medium",children:o.name}),n.jsx(xe,{variant:"secondary",style:{backgroundColor:je[c%je.length],color:"white"},children:o.value})]}),n.jsxs("div",{className:"text-xs text-muted-foreground mt-1",children:[I>0?(o.value/I*100).toFixed(1):0,"% of views"]})]},o.name))})})]})]}),n.jsxs(ge,{value:"content",className:"space-y-4",children:[n.jsxs("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-4",children:[v.data&&Object.entries(v.data).map(([o,c])=>n.jsxs(_,{children:[n.jsx(R,{className:"pb-2",children:n.jsx($,{className:"text-xs uppercase tracking-wide text-muted-foreground",children:o.replace(/_/g," ")})}),n.jsx(E,{children:n.jsx("div",{className:"text-2xl font-semibold",children:c})})]},o)),!v.data&&Array.from({length:4}).map((o,c)=>n.jsx(_,{children:n.jsx(E,{className:"pt-6",children:n.jsx(U,{className:"h-10 w-20"})})},c))]}),n.jsxs(_,{children:[n.jsxs(R,{children:[n.jsx($,{className:"text-base",children:"Top content paths"}
6),n.jsx(J,{children:"Highest-traffic URLs in this period"})]}),n.jsx(E,{className:"h-[360px] min-w-0 overflow-hidden",children:W?n.jsx(U,{className:"h-full w-full"}):j.length===0?n.jsx("p",{className:"text-sm text-muted-foreground",children:"No views yet."}):n.jsx(ne,{width:"100%",height:"100%",children:n.jsxs(De,{data:j,layout:"vertical",margin:{left:8},children:[n.jsx(de,{strokeDasharray:"3 3",stroke:"hsl(var(--border))",horizontal:!1}),n.jsx(oe,{type:"number",stroke:"hsl(var(--muted-foreground))",fontSize:11}),n.jsx(le,{type:"category",dataKey:"path",width:a?110:200,stroke:"hsl(var(--muted-foreground))",fontSize:11,tickFormatter:o=>o.length>28?`â¦${o.slice(-26)}`:o}),n.jsx(ae,{contentStyle:{background:"hsl(var(--popover))",border:"1px solid hsl(var(--border))",borderRadius:8,fontSize:12}}),n.jsx(Le,{dataKey:"count",fill:"hsl(var(--primary))",radius:[0,4,4,0]})]})})})]})]}),n.jsxs(ge,{value:"leads",className:"space-y-4",children:[n.jsxs(_,{children:[n.jsx(R,{children:n.jsxs($,{className:"text-base flex items-center justify-between",children:["Leads over time",n.jsxs(gt,{to:"/admin/leads",className:"text-xs text-primary inline-flex items-center gap-1",children:["Open leads ",n.jsx(vt,{className:"h-3 w-3"})]})]})}),n.jsx(E,{className:"h-[280px] min-w-0 overflow-hidden",children:W?n.jsx(U,{className:"h-full w-full"}):n.jsx(ne,{width:"100%",height:"100%",children:n.jsxs(Qn,{data:w,children:[n.jsx(de,{strokeDasharray:"3 3",stroke:"hsl(var(--border))"}),n.jsx(oe,{dataKey:"day",stroke:"hsl(var(--muted-foreground))",fontSize:11}),n.jsx(le,{allowDecimals:!1,stroke:"hsl(var(--muted-foreground))",fontSize:11}),n.jsx(ae,{contentStyle:{background:"hsl(var(--popover))",border:"1px solid hsl(var(--border))",borderRadius:8,fontSize:12}}),n.jsx(ze,{type:"monotone",dataKey:"count",stroke:"hsl(var(--primary))",strokeWidth:2,dot:!1})]})})})]}),n.jsxs("div",{className:"grid gap-4 lg:grid-cols-2 [&>*]:min-w-0",children:[n.jsxs(_,{children:[n.jsx(R,{children:n.jsxs($,{className:"text-base flex items-center gap-2",children:[n.jsx(Or,{className:"h-4 w-4"})," Leads by status"]})}),n.jsx(E,{className:"h-[280px] min-w-0 overflow-hidden",children:W?n.jsx(U,{className:"h-full w-full"}):k.length===0?n.jsx("p",{className:"text-sm text-muted-foreground",children:"No leads yet."}):n.jsx(ne,{width:"100%",height:"100%",children:n.jsxs(Kt,{children:[n.jsx(te,{data:k,dataKey:"value",nameKey:"name",outerRadius:95,label:!0,children:k.map((o,c)=>n.jsx(rt,{fill:je[c%je.length]},c))}),n.jsx(ae,{contentStyle:{background:"hsl(var(--popover))",border:"1px solid hsl(var(--border))",borderRadius:8,fontSize:12}}),n.jsx(et,{wrapperStyle:{fontSize:12}})]})})})]}),n.jsxs(_,{children:[n.jsx(R,{children:n.jsx($,{className:"text-base",children:"Leads by service interest"})}),n.jsx(E,{className:"h-[280px] min-w-0 overflow-hidden",children:W?n.jsx(U,{className:"h-full w-full"}):B.length===0?n.jsx("p",{className:"text-sm text-muted-foreground",children:"No data."}):n.jsx(ne,{width:"100%",height:"100%",children:n.jsxs(De,{data:B,layout:"vertical",margin:{left:8},children:[n.jsx(de,{strokeDasharray:"3 3",stroke:"hsl(var(--border))",horizontal:!1}),n.jsx(oe,{type:"number",stroke:"hsl(var(--muted-foreground))",fontSize:11}),n.jsx(le,{type:"category",dataKey:"name",width:a?90:140,stroke:"hsl(var(--muted-foreground))",fontSize:11}),n.jsx(ae,{contentStyle:{background:"hsl(var(--popover))",border:"1px solid hsl(var(--border))",borderRadius:8,fontSize:12}}),n.jsx(Le,{dataKey:"value",fill:"hsl(var(--primary))",radius:[0,4,4,0]})]})})})]})]})]}),n.jsxs(ge,{value:"funnel",className:"space-y-4",children:[n.jsx(Wt,{start:s,end:i,onChange:(o,c)=>{l(o),u(c)},fallbackLabel:Re[e]}),n.jsxs(_,{children:[n.jsxs(R,{children:[n.jsx($,{className:"text-base",children:"Conversion funnel"}),n.jsx(J,{children:"Distinct visitor sessions reaching each step. Drop-off compares to the previous step."})]}),n.jsx(E,{className:"space-y-4",children:y.isLoading?n.jsx(U,{className:"h-48 w-full"}):C[0].count===0?n.jsx("p",{className:"text-sm text-muted-foreground",children:"No events yet for this period. Browse the site to generate data."}):n.jsx("div",{className:"space-y-3",children:C.map((o,c)=>n.jsxs("div",{className:"space-y-1.5",children:[n.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2 text-sm",children:[n.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[n.jsx("span",{className:"inline-flex h-5 w-5 items-center justify-center rounded-full bg-primary/15 text-primary text-[11px] font-semibold shrink-0",children:c+1}),n.jsx("span",{className:"font-medium truncate",children:o.label})]}),n.jsxs("div",{className:"flex flex-wrap items-center gap-1.5 text-xs text-muted-foreground tabular-nums",children:[n.jsx("span",{className:"font-semibold text-foreground",children:o.count.toLocaleStr
6ing()}),n.jsxs(xe,{variant:"secondary",children:[o.overallPct.toFixed(1),"% overall"]}),c>0&&n.jsxs(n.Fragment,{children:[n.jsxs(xe,{variant:"outline",children:[o.stepPct.toFixed(1),"% step"]}),n.jsxs(xe,{variant:o.dropPct>50?"destructive":"outline",children:["â",o.dropPct.toFixed(1),"% drop"]})]})]})]}),n.jsx("div",{className:"h-3 w-full bg-muted rounded overflow-hidden",children:n.jsx("div",{className:"h-full bg-primary transition-all",style:{width:`${Math.max(o.overallPct,1)}%`}})})]},o.key))})})]}),n.jsxs("div",{className:"grid gap-4 lg:grid-cols-3 [&>*]:min-w-0",children:[n.jsxs(_,{children:[n.jsx(R,{className:"pb-2",children:n.jsx($,{className:"text-xs uppercase tracking-wide text-muted-foreground",children:"Views â Submit"})}),n.jsxs(E,{children:[n.jsxs("div",{className:"text-2xl font-semibold",children:[C[1].count," / ",C[0].count]}),n.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:[C[1].stepPct.toFixed(2),"% of sessions reached a form submission."]})]})]}),n.jsxs(_,{children:[n.jsx(R,{className:"pb-2",children:n.jsx($,{className:"text-xs uppercase tracking-wide text-muted-foreground",children:"Submit â Lead"})}),n.jsxs(E,{children:[n.jsxs("div",{className:"text-2xl font-semibold",children:[C[2].count," / ",C[1].count||0]}),n.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:[C[2].stepPct.toFixed(2),"% of submitters became leads."]})]})]}),n.jsxs(_,{children:[n.jsx(R,{className:"pb-2",children:n.jsx($,{className:"text-xs uppercase tracking-wide text-muted-foreground",children:"Overall conversion"})}),n.jsxs(E,{children:[n.jsxs("div",{className:"text-2xl font-semibold",children:[C[2].overallPct.toFixed(2),"%"]}),n.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:["Of all visiting sessions, ",C[2].count," became leads."]})]})]})]})]}),n.jsxs(ge,{value:"events",className:"space-y-4",children:[n.jsx(Wt,{start:s,end:i,onChange:(o,c)=>{l(o),u(c)},fallbackLabel:Re[e]}),n.jsxs("div",{className:"grid gap-4 lg:grid-cols-2 [&>*]:min-w-0",children:[n.jsxs(_,{children:[n.jsxs(R,{children:[n.jsx($,{className:"text-base",children:"Events by type"}),n.jsx(J,{children:"Volume of each tracked event"})]}),n.jsx(E,{className:"h-[320px] min-w-0 overflow-hidden",children:y.isLoading?n.jsx(U,{className:"h-full w-full"}):P.length===0?n.jsx("p",{className:"text-sm text-muted-foreground",children:"No events yet."}):n.jsx(ne,{width:"100%",height:"100%",children:n.jsxs(De,{data:P,layout:"vertical",margin:{left:8},children:[n.jsx(de,{strokeDasharray:"3 3",stroke:"hsl(var(--border))",horizontal:!1}),n.jsx(oe,{type:"number",stroke:"hsl(var(--muted-foreground))",fontSize:11}),n.jsx(le,{type:"category",dataKey:"name",width:a?90:140,stroke:"hsl(var(--muted-foreground))",fontSize:11}),n.jsx(ae,{contentStyle:{background:"hsl(var(--popover))",border:"1px solid hsl(var(--border))",borderRadius:8,fontSize:12}}),n.jsx(Le,{dataKey:"value",fill:"hsl(var(--primary))",radius:[0,4,4,0]})]})})})]}),n.jsxs(_,{children:[n.jsxs(R,{children:[n.jsx($,{className:"text-base",children:"Top buttons clicked"}),n.jsx(J,{children:"Labels users interact with most"})]}),n.jsxs(E,{children:[y.isLoading&&n.jsx(U,{className:"h-48 w-full"}),!y.isLoading&&z.length===0&&n.jsx("p",{className:"text-sm text-muted-foreground",children:"No button clicks yet."}),z.length>0&&n.jsx("div",{className:"space-y-1.5",children:z.map(o=>{const c=z[0].value,d=o.value/c*100;return n.jsxs("div",{className:"flex items-center gap-3 text-sm",children:[n.jsx("div",{className:"w-1/2 truncate",children:o.name}),n.jsx("div",{className:"flex-1 bg-muted rounded h-2 overflow-hidden",children:n.jsx("div",{className:"h-full bg-primary",style:{width:`${d}%`}})}),n.jsx("div",{className:"w-10 text-right tabular-nums text-muted-foreground",children:o.value})]},o.name)})})]})]})]}),n.jsxs(_,{children:[n.jsxs(R,{children:[n.jsx($,{className:"text-base",children:"Top outbound links"}),n.jsx(J,{children:"External destinations visitors clicked"})]}),n.jsxs(E,{children:[y.isLoading&&n.jsx(U,{className:"h-32 w-full"}),!y.isLoading&&H.length===0&&n.jsx("p",{className:"text-sm text-muted-foreground",children:"No outbound clicks yet."}),H.length>0&&n.jsx("div",{className:"space-y-1",children:H.map(o=>n.jsxs("div",{className:"flex items-center justify-between text-sm border-b last:border-0 py-1.5",children:[n.jsx("a",{href:o.name,target:"_blank",rel:"noreferrer",className:"font-mono text-xs truncate text-primary hover:underline",children:o.name}),n.jsx(xe,{variant:"secondary",children:o.value})]},o.name))})]})]}),n.jsxs(_,{children:[n.jsxs(R,{className:"flex-col sm:flex-row sm:items-center sm:justify-between gap-2 space-y-0",children:[n.jsxs("div",{children:[n.jsx($,{className:"text-base",children:"Recent events"}),n.jsx(J,{children:"Latest 50 tracked actions"})]}),n.jsxs($e,{size:"sm",variant:"outline",className:"self-start sm:self-auto",onClick:()=>Vt(`analytics-events-${e}d.csv`,(y.data??[]).map(o=>({created_at:o.created_at,name:o.name,path:o.path??"",session_id:o.session_id??"",props:JSON.stringify(o.props??{})}))),children:[n.jsx(ht,{className:"h-4 w-4 mr-1.5"})," Export"]})]}),n.jsx(E,{children:n.jsxs("div",{className:"space-y-1 max-h-[480px] overflow-auto",children:[(y.data??[]).slice(0,50).map((o,c)=>n.jsxs("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1 text-xs border-b last:border-0 py-1.5",children:[n.jsx("span",{className:"text-muted-foreground tabular-nums w-32 shrink-0",children:new Date(o.created_at).toLocaleStr
6ing()}),n.jsx(xe,{variant:"outline",className:"shrink-0",children:o.name}),n.jsx("span",{className:"font-mono truncate flex-1 min-w-0 basis-full sm:basis-auto",children:o.path??"â"}),n.jsx("span",{className:"text-muted-foreground truncate hidden md:inline max-w-[40%]",children:Object.entries(o.props??{}).slice(0,3).map(([d,N])=>`${d}=${String(N).slice(0,30)}`).join(" · ")})]},c)),(y.data??[]).length===0&&!y.isLoading&&n.jsx("p",{className:"text-sm text-muted-foreground",children:"No events recorded yet."})]})})]})]})]})]})}export{ma 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.