import{R as m,r as se,a as c,j as w,F as le}from"./core.browser.esm-QYlOFUDS.js";import{l as he}from"./lodash-CliuttK4.js";import{T as me,a as ye,b as ve,c as be}from"./Tabs-tI1L9rXM.js";import"./_sentry-release-injection-file-DBidL4S7.js";import{G as ge,u as xe,i as J,c as C,d as V,m as K,e as T,h as H,A as Ae,j as F,k as ee,l as we,n as Oe,o as _e,a as Pe,p as te,q as re,D as De,g as Ee,X as ce,Y as ue,f as Ne,b as Se,C as je,T as Ie}from"./generateCategoricalChart-C_cIjrao.js";import{i as ne}from"./isEqual-CnmEmS-r.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="ddf7d58a-6cdb-49e5-9335-5ac8cb1d1261",e._sentryDebugIdIdentifier="sentry-dbid-ddf7d58a-6cdb-49e5-9335-5ac8cb1d1261")}catch{}})();(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="d687454d-97dc-4b3c-9b34-d0c46a793b97",e._sentryDebugIdIdentifier="sentry-dbid-d687454d-97dc-4b3c-9b34-d0c46a793b97")}catch{}})();(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="72c07a45-e8d2-4835-b885-08b70b5a8644",e._sentryDebugIdIdentifier="sentry-dbid-72c07a45-e8d2-4835-b885-08b70b5a8644")}catch{}})();(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="95694408-a57b-4b57-99bf-f28f77c04735",e._sentryDebugIdIdentifier="sentry-dbid-95694408-a57b-4b57-99bf-f28f77c04735")}catch{}})();var ke=["layout","type","stroke","connectNulls","isRange","ref"],de;function $(e){"@babel/helpers - typeof";return $=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},$(e)}function Re(e,t){if(e==null)return{};var a=Le(e,t),n,i;if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(i=0;i<r.length;i++)n=r[i],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}function Le(e,t){if(e==null)return{};var a={},n=Object.keys(e),i,r;for(r=0;r<n.length;r++)i=n[r],!(t.indexOf(i)>=0)&&(a[i]=e[i]);return a}function R(){return R=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},R.apply(this,arguments)}function ae(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),a.push.apply(a,n)}return a}function j(e){for(var t=1;t<arguments.length;t++){var a=arguments[t]!=null?arguments[t]:{};t%2?ae(Object(a),!0).forEach(function(n){D(e,n,a[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):ae(Object(a)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(a,n))})}return e}function Me(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function ie(e,t){for(var a=0;a<t.length;a++){var n=t[a];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,fe(n.key),n)}}function Ce(e,t,a){return t&&ie(e.prototype,t),a&&ie(e,a),Object.defineProperty(e,"prototype",{writable:!1}),e}function Fe(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&&Q(e,t)}function Q(e,t){return Q=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},Q(e,t)}function Te(e){var t=Be();return function(){var n=X(e),i;if(t){var r=X(this).constructor;i=Reflect.construct(n,arguments,r)}else i=n.apply(this,arguments);return $e(this,i)}}function $e(e,t){if(t&&($(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return z(e)}function z(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Be(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function X(e){return X=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(a){return a.__proto__||Object.getPrototypeOf(a)},X(e)}function D(e,t,a){return t=fe(t),t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function fe(e){var t=We(e,"string");return $(t)==="symbol"?t:String(t)}function We(e,t){if($(e)!=="object"||e===null)return e;var a=e[Symbol.toPrimitive];if(a!==void 0){var n=a.call(e,t||"default");if($(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var N=function(e){Fe(a,e);var t=Te(a);function a(){var n;Me(this,a);for(var i=arguments.length,r=new Array(i),o=0;o<i;o++)r[o]=arguments[o];return n=t.call.apply(t,[this].concat(r)),D(z(n),"state",{isAnimationFinished:!0}),D(z(n),"id",xe("recharts-area-")),D(z(n),"handleAnimationEnd",function(){var s=n.props.onAnimationEnd;n.setState({isAnimationFinished:!0}),J(s)&&s()}),D(z(n),"handleAnimationStart",function(){var s=n.props.onAnimationStart;n.setState({isAnimationFinished:!1}),J(s)&&s()}),n}return Ce(a,[{key:"renderDots",value:function(i,r,o){var s=this.props.isAnimationActive,u=this.state.isAnimationFinished;if(s&&!u)return null;var l=this.props,d=l.dot,p=l.points,f=l.dataKey,h=C(this.props),A=C(d,!0),O=p.map(function(b,E){var g=j(j(j({key:"dot-".concat(E),r:3},h),A),{},{dataKey:f,cx:b.x,cy:b.y,index:E,value:b.value,payload:b.payload});return a.renderDotItem(d,g)}),_={clipPath:i?"url(#clipPath-".concat(r?"":"dots-").concat(o,")"):null};return m.createElement(V,R({className:"recharts-area-dots"},_),O)}},{key:"renderHorizontalRect",value:function(i){var r=this.props,o=r.baseLine,s=r.points,u=r.strokeWidth,l=s[0].x,d=s[s.length-1].x,p=i*Math.abs(l-d),f=K(s.map(function(h){return h.y||0}));return T(o)&&typeof o=="number"?f=Math.max(o,f):o&&Array.isArray(o)&&o.length&&(f=Math.max(K(o.map(function(h){return h.y||0})),f)),T(f)?m.createElement("rect",{x:l<d?l:l-p,y:0,width:p,height:Math.floor(f+(u?parseInt("".concat(u),10):1))}):null}},{key:"renderVerticalRect",value:function(i){var r=this.props,o=r.baseLine,s=r.points,u=r.strokeWidth,l=s[0].y,d=s[s.length-1].y,p=i*Math.abs(l-d),f=K(s.map(function(h){return h.x||0}));return T(o)&&typeof o=="number"?f=Math.max(o,f):o&&Array.isArray(o)&&o.length&&(f=Math.max(K(o.map(function(h){return h.x||0})),f)),T(f)?m.createElement("rect",{x:0,y:l<d?l:l-p,width:f+(u?parseInt("".concat(u),10):1),height:Math.floor(p)}):null}},{key:"renderClipRect",value:function(i){var r=this.props.layout;return r==="vertical"?this.renderVerticalRect(i):this.renderHorizontalRect(i)}},{key:"renderAreaStatically",value:function(i,r,o,s){var u=this.props,l=u.layout,d=u.type,p=u.stroke,f=u.connectNulls,h=u.isRange;u.ref;var A=Re(u,ke);return m.createElement(V,{clipPath:o?"url(#clipPath-".concat(s,")"):null},m.createElement(H,R({},C(A,!0),{points:i,connectNulls:f,type:d,baseLine:r,layout:l,stroke:"none",className:"recharts-area-area"})),p!=="none"&&m.createElement(H,R({},C(this.props),{className:"recharts-area-curve",layout:l,type:d,connectNulls:f,fill:"none",points:i})),p!=="none"&&h&&m.createElement(H,R({},C(this.props),{className:"recharts-area-curve",layout:l,type:d,connectNulls:f,fill:"none",points:r})))}},{key:"renderAreaWithAnimation",value:function(i,r){var o=this,s=this.props,u=s.points,l=s.baseLine,d=s.isAnimationActive,p=s.animationBegin,f=s.animationDuration,h=s.animationEasing,A=s.animationId,O=this.state,_=O.prevPoints,b=O.prevBaseLine;return m.createElement(Ae,{begin:p,duration:f,isActive:d,easing:h,from:{t:0},to:{t:1},key:"area-".concat(A),onAnimationEnd:this.handleAnimationEnd,onAnimationStart:this.handleAnimationStart},function(E){var g=E.t;if(_){var v=_.length/u.length,x=u.map(function(P,M){var k=Math.floor(M*v);if(_[k]){var S=_[k],B=F(S.x,P.x),W=F(S.y,P.y);return j(j({},P),{},{x:B(g),y:W(g)})}return P}),y;if(T(l)&&typeof l=="number"){var I=F(b,l);y=I(g)}else if(ee(l)||we(l)){var L=F(b,0);y=L(g)}else y=l.map(function(P,M){var k=Math.floor(M*v);if(b[k]){var S=b[k],B=F(S.x,P.x),W=F(S.y,P.y);return j(j({},P),{},{x:B(g),y:W(g)})}return P});return o.renderAreaStatically(x,y,i,r)}return m.createElement(V,null,m.createElement("defs",null,m.createElement("clipPath",{id:"animationClipPath-".concat(r)},o.renderClipRect(g))),m.createElement(V,{clipPath:"url(#animationClipPath-".concat(r,")")},o.renderAreaStatically(u,l,i,r)))})}},{key:"renderArea",value:function(i,r){var o=this.props,s=o.points,u=o.baseLine,l=o.isAnimationActive,d=this.state,p=d.prevPoints,f=d.prevBaseLine,h=d.totalLength;return l&&s&&s.length&&(!p&&h>0||!ne(p,s)||!ne(f,u))?this.renderAreaWithAnimation(i,r):this.renderAreaStatically(s,u,i,r)}},{key:"render",value:function(){var i,r=this.props,o=r.hide,s=r.dot,u=r.points,l=r.className,d=r.top,p=r.left,f=r.xAxis,h=r.yAxis,A=r.width,O=r.height,_=r.isAnimationActive,b=r.id;if(o||!u||!u.length)return null;var E=this.state.isAnimationFinished,g=u.length===1,v=Oe("recharts-area",l),x=f&&f.allowDataOverflow,y=h&&h.allowDataOverflow,I=x||y,L=ee(b)?this.id:b,P=(i=C(s))!==null&&i!==void 0?i:{r:3,strokeWidth:2},M=P.r,k=M===void 0?3:M,S=P.strokeWidth,B=S===void 0?2:S,W=_e(s)?s:{},U=W.clipDot,Z=U===void 0?!0:U,G=k*2+B;return m.createElement(V,{className:v},x||y?m.createElement("defs",null,m.createElement("clipPath",{id:"clipPath-".concat(L)},m.createElement("rect",{x:x?p:p-A/2,y:y?d:d-O/2,width:x?A:A*2,height:y?O:O*2})),!Z&&m.createElement("clipPath",{id:"clipPath-dots-".concat(L)},m.createElement("rect",{x:p-G/2,y:d-G/2,width:A+G,height:O+G}))):null,g?null:this.renderArea(I,L),(s||g)&&this.renderDots(I,Z,L),(!_||E)&&Pe.renderCallByParent(this.props,u))}}],[{key:"getDerivedStateFromProps",value:function(i,r){return i.animationId!==r.prevAnimationId?{prevAnimationId:i.animationId,curPoints:i.points,curBaseLine:i.baseLine,prevPoints:r.curPoints,prevBaseLine:r.curBaseLine}:i.points!==r.curPoints||i.baseLine!==r.curBaseLine?{curPoints:i.points,curBaseLine:i.baseLine}:null}}]),a}(se.PureComponent);de=N;D(N,"displayName","Area");D(N,"defaultProps",{stroke:"#3182bd",fill:"#3182bd",fillOpacity:.6,xAxisId:0,yAxisId:0,legendType:"line",connectNulls:!1,points:[],dot:!1,activeDot:!0,hide:!1,isAnimationActive:!ge.isSsr,animationBegin:0,animationDuration:1500,animationEasing:"ease"});D(N,"getBaseValue",function(e,t,a,n){var i=e.layout,r=e.baseValue,o=t.props.baseValue,s=o??r;if(T(s)&&typeof s=="number")return s;var u=i==="horizontal"?n:a,l=u.scale.domain();if(u.type==="number"){var d=Math.max(l[0],l[1]),p=Math.min(l[0],l[1]);return s==="dataMin"?p:s==="dataMax"||d<0?d:Math.max(Math.min(l[0],l[1]),0)}return s==="dataMin"?l[0]:s==="dataMax"?l[1]:l[0]});D(N,"getComposedData",function(e){var t=e.props,a=e.item,n=e.xAxis,i=e.yAxis,r=e.xAxisTicks,o=e.yAxisTicks,s=e.bandSize,u=e.dataKey,l=e.stackedData,d=e.dataStartIndex,p=e.displayedData,f=e.offset,h=t.layout,A=l&&l.length,O=de.getBaseValue(t,a,n,i),_=h==="horizontal",b=!1,E=p.map(function(v,x){var y;A?y=l[d+x]:(y=te(v,u),Array.isArray(y)?b=!0:y=[O,y]);var I=y[1]==null||A&&te(v,u)==null;return _?{x:re({axis:n,ticks:r,bandSize:s,entry:v,index:x}),y:I?null:i.scale(y[1]),value:y,payload:v}:{x:I?null:n.scale(y[1]),y:re({axis:i,ticks:o,bandSize:s,entry:v,index:x}),value:y,payload:v}}),g;return A||b?g=E.map(function(v){var x=Array.isArray(v.value)?v.value[0]:null;return _?{x:v.x,y:x!=null&&v.y!=null?i.scale(x):null}:{x:x!=null?n.scale(x):null,y:v.y}}):g=_?i.scale(O):n.scale(O),j({points:E,baseLine:g,layout:h,isRange:b},f)});D(N,"renderDotItem",function(e,t){var a;return m.isValidElement(e)?a=m.cloneElement(e,t):J(e)?a=e(t):a=m.createElement(De,R({},t,{className:"recharts-area-dot"})),a});var Ve=Ee({chartName:"AreaChart",GraphicalChild:N,axisComponents:[{axisType:"xAxis",AxisComp:ce},{axisType:"yAxis",AxisComp:ue}],formatAxisMap:Ne});const oe=e=>new Date(e*1e3).toLocaleDateString(void 0,{month:"long",day:"numeric",year:"numeric"}),ze=({stat:e,name:t})=>{const[a,n]=se.useState(null);if(e.length===0)return c("div",{children:"No data."});const i=new Date(e[e.length-1].time_start*1e3),r=new Date(e[0].time_start*1e3);return w(le,{children:[w("div",{className:"mt-5 flex flex-wrap gap-x-6",children:[c(Ke,{stat:e,name:t}),c(Xe,{stat:e,name:t})]}),c(Y,{stat:"graph of views",name:t}),c("div",{children:c(Se,{width:"99%",height:300,children:w(Ve,{data:e,margin:{top:5,right:30,left:20,bottom:5},children:[w("defs",{children:[w("linearGradient",{id:"mainGradient",x1:"0",y1:"0",x2:"0",y2:"1",children:[c("stop",{offset:"5%",stopColor:"#F26522",stopOpacity:.8}),c("stop",{offset:"95%",stopColor:"#F26522",stopOpacity:0})]}),w("linearGradient",{id:"highlightedGradient",x1:"0",y1:"0",x2:"0",y2:"1",children:[c("stop",{offset:"5%",stopColor:"#5468FF",stopOpacity:.8}),c("stop",{offset:"95%",stopColor:"#5468FF",stopOpacity:0})]})]}),c(je,{horizontal:!1}),c(ce,{type:"number",dataKey:"time_start",tickFormatter:oe,domain:[Math.floor(r.valueOf()/1e3),Math.floor(i.valueOf()/1e3)],allowDataOverflow:!0}),c(ue,{allowDecimals:!1,domain:[0,"dataMax+1"],mirror:!0}),c(Ie,{wrapperStyle:{outline:"none"},cursor:{strokeDasharray:"3 3"},content:({active:o,payload:s,label:u})=>o&&s&&s.length&&w("div",{className:`rounded border-2 border-solid border-orange-600
                    bg-white/75 p-[5px]`,children:[c("div",{children:oe(u)}),w("div",{children:[s[0].value," view",s[0].value===1?"":"s"]})]})}),c(N,{type:"monotone",dataKey:o=>o.count||0,stroke:"#F26522",fill:"url(#mainGradient)",label:!1}),a&&c(N,{type:"monotone",dataKey:o=>he.get(o,a)||0,stroke:"#5468FF",fill:"url(#highlightedGradient)",label:a.split(".")[-1]})]})})}),c("div",{className:"flex flex-wrap gap-x-6",children:[...new Set(e.flatMap(o=>Object.keys(o.counts)))].filter(o=>o!=="batch"&&o!=="country").map(o=>c(Ge,{stat:e,selected:o,setHovered:n,name:t},o))})]})};let q=null;const pe=(e,t)=>{if(e==="country"){q||(q=new Intl.DisplayNames(["en"],{type:"region"}));try{const a=q.of(t);if(a)return c("span",{title:t,children:a},t)}catch{}}return e==="referer"&&t.startsWith("https://")?c("a",{href:t,children:t.replace("https://","").replace(/\/$/,"")},t):t},Ge=({stat:e,selected:t,setHovered:a,name:n})=>{if(t===null)return null;const i=e.reduce((r,o)=>r+o.count,0);return w("div",{children:[c(Y,{stat:t,name:n}),c("table",{className:"m-5",children:c("tbody",{children:Object.entries(e.map(r=>r.counts[t]).filter(r=>r).reduce((r,o)=>(Object.entries(o).forEach(([s,u])=>{r[s]=(r[s]||0)+u}),r),{})).sort(([,r],[,o])=>o-r).slice(0,6).map(([r,o])=>w("tr",{className:"border-b border-gray-400 last:border-b-0 hover:bg-indigo-500/50",onMouseEnter:()=>a(`counts.${t}.${r}`),onMouseLeave:()=>a(null),children:[c("td",{className:"px-3",children:o}),c("td",{className:"px-1",title:r,style:{background:`linear-gradient(to right, rgba(242, 101, 34, 0.2) ${100*o/i}%, rgba(255, 255, 255, 0.1) ${100*o/i}%)`},children:c("span",{className:"inline-block max-w-[40vw] overflow-hidden whitespace-nowrap text-right align-bottom",children:pe(t,r)})})]},r))})})]})},Ke=({stat:e,name:t})=>w("div",{children:[c(Y,{stat:"views",name:t}),c("div",{className:"mb-1 text-3xl font-bold text-brand xl:text-4xl",children:e.reduce((a,n)=>a+n.count,0)})]}),Xe=({stat:e,name:t})=>{const a=Object.entries(e.map(n=>n.counts.referer).reduce((n,i)=>(Object.entries(i||{}).forEach(([r,o])=>{n[r]=(n[r]||0)+o}),n),{})).sort(([,n],[,i])=>i-n)[0];return a?w("div",{children:[c(Y,{stat:"top referer",name:t}),c("div",{className:"mb-1 truncate text-xl font-bold text-brand",children:pe("referer",a[0])})]}):null},Y=({stat:e,name:t})=>w("h3",{className:"text-grey-700 mt-5",children:[c("span",{className:"uppercase",children:e})," - ",t]}),Ze=({stat:e})=>{if(e.days.length<2)return c("div",{children:"We're still collecting data! Please check back soon."});const t=Math.max(e.days[e.days.length-1].time_start,e.hours.length>0?e.hours[e.hours.length-1].time_start:0),a={days:e.days[0].time_start,hours:e.hours.length>0?e.hours[0].time_start:1/0},i=[["24 hours",t-86400],["7 days",t-7*86400],["30 days",t-30*86400],["90 days",t-90*86400],[`All time (${Math.floor((t-a.days)/86400)} days)`,0]].filter(([r,o])=>o===0||a.days<o);return i.length===0?c("div",{children:"We're still collecting data! Please check back soon."}):c(le,{children:w(be,{defaultValue:i[i.length-1][0],children:[c(me,{className:"gap-x-1",children:i.map(([r,o])=>c(ye,{value:r,className:"bg-neutral-200 data-[state=active]:bg-white",children:r},r))}),i.map(([r,o])=>c(ve,{value:r,children:c(ze,{stat:(a.hours<o?e.hours:e.days).filter(s=>s.time_start>o),name:r})},r))]})})};export{Ze as S};
