decocms
Version:
Deco CMS — Self-hostable MCP Gateway for managing AI connections and tools
3 lines • 567 kB
JavaScript
import{r as Z,fH as Jc,c as O,an as Yt,q as fs,i as ts,e as Et,K as Qe,b as ie,j as l,e3 as Ce,ad as Hn,m as ye,B as Se,L as As,b_ as _m,b$ as So,bZ as $m,bc as _a,a_ as ti,t as rt,aL as $a,aM as Ta,aN as Pa,aO as Ca,aP as Ea,aQ as Ma,aR as Ia,w as _n,x as $n,I as ds,y as Aa,v as Tn,D as Pn,av as La,by as Tm,_ as hn,X as gn,Z as vn,bz as Pm,c0 as Cm,c1 as e1,hR as Em,d as Cn,a6 as He,h as is,a as Mm,T as Im,dX as Am,ao as sa,aW as Da,ag as Oa,$ as Cs,gZ as t1,u as fr,aJ as Jt,aK as Ct,bF as Ms,hS as s1,b8 as Lm,J as si,bn as Qi,hK as Ra,n as We,bx as bn,hT as l1,gg as n1,P as i1,dZ as r1,a7 as Dm,hU as Om,ap as a1,Y as Es,ax as o1,a$ as Rm,hV as c1,gK as Js,F as Yn,dD as Fm,dB as zm,cs as _o,dR as Vm,dO as qm}from"./index-DoEtSiIe.js";import{ChatLayout as Km}from"./index-FcoC7l5_.js";import{j as pr,bq as Bm,e as d1,br as Hm,bg as xr,B as m1,r as jn,M as Wm,N as Um,O as Gm,K as Xi,bs as Ym,bt as Qm,b as Us,bo as Xm,$ as Zm,bu as Jm,bv as la,bw as eu,G as tu,bx as su,T as lu,a as nu}from"./agent-icon-DoabtHNW.js";import{E as Ke}from"./empty-state-UX_DOq42.js";import{P as li,a as ni,b as ii}from"./popover-mrQ4T9ru.js";import{r as Vi,f as iu,L as rs,C as Gs,u as ru,a as au,b as ou,l as zn,D as cu,c as du,d as mu,e as uu,g as fu,M as pu}from"./order-monitor-day-BjMh6dP-.js";import{i as hr}from"./AlertCircle-GoAGGV0G.js";import{i as Fa}from"./CheckCircle-vIQcB0iT.js";import{t as za}from"./task-key-CajjdR3t.js";import{u as u1}from"./useInfiniteQuery-9vIAXgqG.js";import{f as xu,O as hu}from"./watch-sse-pool-C0me6Edt.js";import{i as f1,n as gu}from"./ArrowUp-s5a8DQxj.js";import{k as vu,s as p1,h as bu}from"./UserSquare-dgrNjiXb.js";import{i as ju}from"./SearchMd-BGRe_18c.js";import{y as yu}from"./chat-context-vJ6R-Clt.js";import{a as wu,T as Nu}from"./use-voice-input-DJjQBO4e.js";import{u as ku}from"./use-ask-in-chat-CuhqUmC7.js";import{e as En,u as Su}from"./use-organization-settings-CgKOO7Ms.js";import{b as Va,d as gr}from"./repository-binding-BAQCDq-W.js";import{u as Wn}from"./useQueries-CuzZgNOl.js";import{B as Ye}from"./badge-DONoxQO7.js";import{S as _u,C as es,a as us,c as It,B as Qn,b as x1}from"./chart-BhhOak8o.js";import{s as qa}from"./Trash01-Ctp9Olbr.js";import{C as h1}from"./checkbox-CkODjqKt.js";import{L as Ns}from"./label-G4Rj_cXa.js";import{M as Me,A as mt}from"./analytics-sections-BjczT6mc.js";import{n as $u,a as g1,s as Tu,k as Pu}from"./UserCheck01-CA8kXGn8.js";import{t as Ka}from"./ChevronDown-Dm2xO7jf.js";import{s as ks}from"./Plus-BoPsX_T8.js";import{I as vr}from"./integration-icon-DvT6X8cI.js";import{P as Ba}from"./project-icon-BxqBM24K.js";import{u as Ha,a as Cu,b as Eu}from"./repository-picker-BBkgoOlP.js";import{o as Wa}from"./new-project-store-DYc4RZIM.js";import{C as Mu}from"./connect-source-dialog-F5S3IN4q.js";import{e as Iu}from"./use-connect-companion-CkgH2aNV.js";import{S as Zi,b as Ji,a as er,d as tr,c as sr}from"./select-OlcoUSVg.js";import{b as v1}from"./use-connection-BO-ZUzee.js";import{u as Au}from"./use-mcp-client-86j-Nolb.js";import{e as Lu}from"./extract-connection-data-DXA3Rt-s.js";import{T as dt,a as el,b as Ut,c as Le,d as tl,e as sl}from"./table-RDPVkrI6.js";import{c as Du,u as Ou,G as Ru,b as Fu,C as Ft,X as zt,Y as At}from"./CartesianChart-BFVvuNgw.js";import{a as Gt,A as ri}from"./AreaChart-BCH9fczV.js";import{b as zu,u as Vu}from"./companions-core-DhUD88pR.js";import{a as qu}from"./MessageCircle01-zc37Krdu.js";import{I as yn}from"./icon-button-DFliy54K.js";import{T as ll,a as nl,c as il}from"./tooltip-DhlWzeQv.js";import{C as Ku,b as $o,f as Bu,a as Hu,c as Wu}from"./command-D5O7M-Cf.js";import{i as b1}from"./ArrowLeft-DuGHc_Gh.js";import{C as j1}from"./combobox-B9eEiOM0.js";import{S as y1}from"./slider-c-3WdQpH.js";import{T as Uu,a as Gu,b as Yu}from"./tabs-Bh3jtZIY.js";import{C as Qu,R as Ls}from"./ReferenceLine-ChigmKEb.js";import{u as Ua,b as w1}from"./use-blocks-v8-project-BLAijVCk.js";import{a as N1}from"./shell-layout-596_q4a1.js";import{B as Ga,D as Ya,a5 as Xu,bG as Zu,bH as Ju,aU as ef,aI as Qa,F as lr,aX as To,Z as Xa,L as wn,ah as tf,aZ as sf,a_ as lf,a$ as ki,am as nf,c as k1,bI as rf,aw as S1,ax as _1,bJ as af,az as of,aH as cf,R as df,aJ as mf,aK as uf,z as $1,E as ff,H as pf,ar as An,bK as xf,h as qi,bF as Po,I as hf,J as gf,M as Si,Y as vf,aY as bf,aQ as jf,Q as yf,bL as wf,C as T1,V as Nf,X as kf,a1 as Sf,bM as _f,a2 as $f,ae as Tf}from"./CategoricalChart-iNQ2kTf5.js";import{p as Pf,E as Cf,b as P1,P as Ef}from"./experiments-tab-choice-loxGESO7.js";import{T as C1}from"./Tooltip-Vyb5xIGx.js";import{o as E1,p as M1,t as Mf,P as If}from"./named-rule-step-BAentWbs.js";import{i as Af}from"./Monitor01-DUhT2Mcw.js";import{d as Co}from"./SwitchHorizontal01-CHtrDs50.js";import{s as I1}from"./XClose-BUxhnZ3x.js";import{T as Lf}from"./textarea-CP9TQ5HN.js";import{S as Df}from"./search-toggle-CMYcoB9P.js";import{r as Of}from"./session-runtime-CZKHty5X.js";import{u as Rf}from"./use-task-board-item-prs-Db89Oevz.js";import{n as Ff}from"./ChevronUp-BKdcyIOm.js";import{S as zf}from"./search-input-wk0beNbE.js";import{b as Vf,S as qf,a as Kf,c as Bf}from"./sheet-De8qzGNI.js";import{S as A1}from"./switch-C5tCt-1T.js";import{u as Hf}from"./use-id-selection-2psZYBx1.js";import{u as Wf}from"./use-infinite-scroll-uxxC9xbL.js";import{S as Eo,c as Uf,C as Za,u as Gf,a as Yf,b as Qf}from"./tooltipContext-BkLzQGib.js";import{a as Xf,T as Mo}from"./toggle-group-CtXgLS7e.js";import{c as Zf}from"./use-entitlements-4v7LU4jM.js";import{u as Jf}from"./use-project-scope-AMUoXt2c.js";import"./use-mobile-BjsAkqwr.js";import"./thread-button-B51gC6ln.js";import"./use-sidebar-collapsed-iTcR18ZK.js";import"./use-chat-layout-state-x3sd6PWp.js";import"./use-panel-navigate-DHff9CS9.js";import"./thread-route-D-UE3Db_.js";import"./toolbar-icon-button-Ce7Zk4Z1.js";import"./use-in-settings-LMUeu63D.js";import"./resizable-DwqWjQSo.js";import"./route-page-header-nTLU5ayk.js";import"./LayoutLeft-owMYqid0.js";import"./use-current-view-C2fbVQ-O.js";import"./index-BFFHlwFA.js";import"./auth-IBAsOARn.js";import"./Tool01-D90Wr5xR.js";import"./ArrowRight-CMJyKdyB.js";import"./BookOpen01-DZs1-yi9.js";import"./Globe04-5yHQa01g.js";import"./ChevronSelectorVertical-Cvgyclsz.js";import"./LinkBroken01-CyjdgWmP.js";import"./CreditCard01-BUXydXso.js";import"./File02-Y4Nh84qP.js";import"./Eye-DwRCQHLk.js";import"./Fingerprint04-DlIWxzRc.js";import"./Image01-BRABRo3v.js";import"./Key01-DfLmV_su.js";import"./Minus-CFYZtYi9.js";import"./Sun-uwKn4QPm.js";import"./Play-C_9Fb_Ik.js";import"./ShoppingBag01-CoN4FBW5.js";import"./Upload01-DgxprpI7.js";import"./Users01-BasqfwpC.js";import"./Zap-CxPsn4FS.js";import"./calendar-BRx4DiEx.js";import"./infiniteQueryObserver-BRGiYBJv.js";import"./task-board-BRF3ZwKz.js";import"./schema-CG6ylG0z.js";import"./backoff-CrEUbyZT.js";import"./use-view-draft-kind-hbAZo1QG.js";import"./use-blog-view-DJnS2ipo.js";import"./thread-intent-R2KI8ie_.js";import"./delay-CnY5UFtP.js";import"./use-ai-providers-BwkzkRi2.js";import"./use-decopilot-events-DwNDOIa1.js";import"./use-org-fs-C62_MbqW.js";import"./drawer-DO0sMAej.js";import"./index-BVDmO57n.js";import"./ai-providers-logos-DD3qZ33J.js";import"./openai-compatible-presets-BKGfVqEx.js";import"./index-C_NkXLoh.js";import"./config-BOn4tvAD.js";import"./github-icon-YYYF_UPl.js";import"./collection-search-DL8nJQx4.js";import"./use-debounced-value-DqHSmPMR.js";import"./site-url-en5df9c-.js";import"./form-DwGozYbG.js";import"./github-repo-scope-C58hYmYC.js";import"./authenticate-and-persist-oauth-BmdGjqM8.js";import"./mcp-oauth-C4zfq49i.js";import"./mcp-oauth-BkAlBGe_.js";import"./track-xlpKzX88.js";import"./index-BdQq_4o_.js";import"./metadata-D72DunRR.js";import"./connection-BxF6Rdiu.js";import"./url-slug-CiUrNKts.js";import"./index-DRuy-mDa.js";import"./index-D4CqkEu4.js";import"./active-indicator-CCMhAsc_.js";import"./use-deployment-admin-Bh76rlF7.js";import"./admin-fetch-BhTJlAsX.js";import"./use-org-notice-BzvGZbQ2.js";import"./use-navigate-to-agent-C-BC28kE.js";import"./new-project-dialog-CT39WKMt.js";import"./legacy-admin-welcome-dialog-BYL3pyxT.js";import"./required-auth-layout-DPL2sBE1.js";import"./use-org-sso-CypQjzG8.js";import"./named-rule-view-B12Mihtd.js";import"./blocks-tab-states-CTy1iAF5.js";import"./site-editor-toast-B-FDGvtN.js";import"./content-changes-DXqxs3Wb.js";import"./sandbox-url-D3mC8qhT.js";import"./use-sandbox-events-A8aB0HnP.js";import"./utils-CzRFs-0R.js";import"./sandbox-git-api-DiUyKbJU.js";import"./empty-state-C4MgLcBg.js";import"./use-apply-named-rule-CaZ5oLnq.js";import"./hosted-reconcile-CTronLZo.js";import"./use-move-blocks-CCDsEu9Z.js";import"./view-header-CRFbPvFT.js";import"./site-draft-view-UnsYH70N.js";function Io(t,e){var s=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),s.push.apply(s,n)}return s}function Ao(t){for(var e=1;e<arguments.length;e++){var s=arguments[e]!=null?arguments[e]:{};e%2?Io(Object(s),!0).forEach(function(n){e2(t,n,s[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(s)):Io(Object(s)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(s,n))})}return t}function e2(t,e,s){return(e=t2(e))in t?Object.defineProperty(t,e,{value:s,enumerable:!0,configurable:!0,writable:!0}):t[e]=s,t}function t2(t){var e=s2(t,"string");return typeof e=="symbol"?e:e+""}function s2(t,e){if(typeof t!="object"||!t)return t;var s=t[Symbol.toPrimitive];if(s!==void 0){var n=s.call(t,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function nr(){return nr=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var s=arguments[e];for(var n in s)({}).hasOwnProperty.call(s,n)&&(t[n]=s[n])}return t},nr.apply(null,arguments)}var l2=(t,e,s,n,i,r,a)=>{var o,c,d,m,{x1:u,x2:f,y1:p,y2:x}=a;if(i==null||r==null)return null;var h=new Qu({x:i,y:r}),g={x:t?(o=i.map(u,{position:"start"}))!==null&&o!==void 0?o:null:i.rangeMin(),y:s?(c=r.map(p,{position:"start"}))!==null&&c!==void 0?c:null:r.rangeMin()},v={x:e?(d=i.map(f,{position:"end"}))!==null&&d!==void 0?d:null:i.rangeMax(),y:n?(m=r.map(x,{position:"end"}))!==null&&m!==void 0?m:null:r.rangeMax()};return a.ifOverflow==="discard"&&(!h.isInRange(g)||!h.isInRange(v))?null:Du(g,v)},n2=(t,e)=>{var s;return Z.isValidElement(t)?s=Z.cloneElement(t,e):typeof t=="function"?s=t(e):s=Z.createElement(nf,nr({},e,{className:"recharts-reference-area-rect"})),s};function i2(t){var e=Xu();return Z.useEffect(()=>(e(Zu(t)),()=>{e(Ju(t))})),null}function r2(t){var{x1:e,x2:s,y1:n,y2:i,className:r,shape:a,xAxisId:o,yAxisId:c}=t,d=ef(),m=Qa(),u=lr(j=>To(j,"xAxis",o,m)),f=lr(j=>To(j,"yAxis",c,m));if(u==null||f==null)return null;var p=ki(e),x=ki(s),h=ki(n),g=ki(i);if(!p&&!x&&!h&&!g&&!a)return null;var v=l2(p,x,h,g,u,f,t);if(!v&&!a)return null;var b=t.ifOverflow==="hidden",y=b?"url(#".concat(d,")"):void 0;return Z.createElement(Xa,{zIndex:t.zIndex},Z.createElement(wn,{className:Jc("recharts-reference-area",r)},n2(a,Ao(Ao({clipPath:y},tf(t)),v)),v!=null&&Z.createElement(sf,nr({},v,{lowerWidth:v.width,upperWidth:v.width}),Z.createElement(lf,{label:t.label}),t.children)))}var a2={ifOverflow:"discard",xAxisId:0,yAxisId:0,radius:0,fill:"#ccc",label:!1,fillOpacity:.5,stroke:"none",strokeWidth:1,zIndex:Ya.area};function na(t){var e=Ga(t,a2);return Z.createElement(Z.Fragment,null,Z.createElement(i2,{yAxisId:e.yAxisId,xAxisId:e.xAxisId,ifOverflow:e.ifOverflow,x1:e.x1,x2:e.x2,y1:e.y1,y2:e.y2}),Z.createElement(r2,e))}na.displayName="ReferenceArea";var o2=["option","isActive"];function Un(){return Un=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var s=arguments[e];for(var n in s)({}).hasOwnProperty.call(s,n)&&(t[n]=s[n])}return t},Un.apply(null,arguments)}function c2(t,e){if(t==null)return{};var s,n,i=d2(t,e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);for(n=0;n<r.length;n++)s=r[n],e.indexOf(s)===-1&&{}.propertyIsEnumerable.call(t,s)&&(i[s]=t[s])}return i}function d2(t,e){if(t==null)return{};var s={};for(var n in t)if({}.hasOwnProperty.call(t,n)){if(e.indexOf(n)!==-1)continue;s[n]=t[n]}return s}function m2(t){var{option:e,isActive:s}=t,n=c2(t,o2);return typeof e=="string"?Z.createElement(Eo,Un({option:Z.createElement(Uf,Un({type:e},n)),isActive:s,shapeType:"symbols"},n)):Z.createElement(Eo,Un({option:e,isActive:s,shapeType:"symbols"},n))}var u2=(t,e,s,n,i,r,a)=>S1(t,"xAxis",e,a),f2=(t,e,s,n,i,r,a)=>_1(t,"xAxis",e,a),p2=(t,e,s,n,i,r,a)=>S1(t,"yAxis",s,a),x2=(t,e,s,n,i,r,a)=>_1(t,"yAxis",s,a),h2=(t,e,s,n)=>af(t,"zAxis",n,!1),g2=(t,e,s,n,i)=>i,v2=(t,e,s,n,i,r)=>r,b2=(t,e,s,n,i,r,a)=>rf(t,void 0,void 0,a),j2=k1([of,g2],(t,e)=>t.filter(s=>s.type==="scatter").find(s=>s.id===e)),y2=k1([b2,u2,f2,p2,x2,h2,j2,v2],(t,e,s,n,i,r,a,o)=>{var{chartData:c,dataStartIndex:d,dataEndIndex:m}=t;if(a!=null){var u;if(a?.data!=null&&a.data.length>0?u=a.data:u=c?.slice(d,m+1),!(u==null||e==null||n==null||s==null||i==null||s?.length===0||i?.length===0))return L2({displayedData:u,xAxis:e,yAxis:n,zAxis:r,scatterSettings:a,xAxisTicks:s,yAxisTicks:i,cells:o})}}),w2=["id"],N2=["onMouseEnter","onClick","onMouseLeave"],k2=["animationBegin","animationDuration","animationEasing","hide","isAnimationActive","legendType","lineJointType","lineType","shape","xAxisId","yAxisId","zAxisId"];function ia(t,e){if(t==null)return{};var s,n,i=S2(t,e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);for(n=0;n<r.length;n++)s=r[n],e.indexOf(s)===-1&&{}.propertyIsEnumerable.call(t,s)&&(i[s]=t[s])}return i}function S2(t,e){if(t==null)return{};var s={};for(var n in t)if({}.hasOwnProperty.call(t,n)){if(e.indexOf(n)!==-1)continue;s[n]=t[n]}return s}function Ys(){return Ys=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var s=arguments[e];for(var n in s)({}).hasOwnProperty.call(s,n)&&(t[n]=s[n])}return t},Ys.apply(null,arguments)}function Lo(t,e){var s=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),s.push.apply(s,n)}return s}function Ht(t){for(var e=1;e<arguments.length;e++){var s=arguments[e]!=null?arguments[e]:{};e%2?Lo(Object(s),!0).forEach(function(n){_2(t,n,s[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(s)):Lo(Object(s)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(s,n))})}return t}function _2(t,e,s){return(e=$2(e))in t?Object.defineProperty(t,e,{value:s,enumerable:!0,configurable:!0,writable:!0}):t[e]=s,t}function $2(t){var e=T2(t,"string");return typeof e=="symbol"?e:e+""}function T2(t,e){if(typeof t!="object"||!t)return t;var s=t[Symbol.toPrimitive];if(s!==void 0){var n=s.call(t,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var P2=t=>{var{dataKey:e,name:s,fill:n,legendType:i,hide:r}=t;return[{inactive:r,dataKey:e,type:i,color:n,value:$1(s,e),payload:t}]},C2=Z.memo(t=>{var{dataKey:e,points:s,stroke:n,strokeWidth:i,fill:r,name:a,hide:o,tooltipType:c,id:d}=t,m={dataDefinedOnItem:s?.map(u=>u.tooltipPayload),getPosition:u=>{var f;return s==null||(f=s[Number(u)])===null||f===void 0?void 0:f.tooltipPosition},settings:{stroke:n,strokeWidth:i,fill:r,nameKey:void 0,dataKey:e,name:$1(a,e),hide:o,type:c,color:r,unit:"",graphicalItemId:d}};return Z.createElement(pf,{tooltipEntrySettings:m})});function E2(t){var{points:e,props:s}=t,{line:n,lineType:i,lineJointType:r}=s;if(!n)return null;var a=T1(s),o=Sf(n),c,d;if(i==="joint")c=e.map(g=>{var v,b;return{x:(v=g.cx)!==null&&v!==void 0?v:null,y:(b=g.cy)!==null&&b!==void 0?b:null}});else if(i==="fitting"){var{xmin:m,xmax:u,a:f,b:p}=_f(e),x=g=>f*g+p;c=[{x:m,y:x(m)},{x:u,y:x(u)}]}var h=Ht(Ht(Ht({},a),{},{fill:"none",stroke:a&&a.fill},o),{},{points:c});return Z.isValidElement(n)?d=Z.cloneElement(n,h):typeof n=="function"?d=n(h):d=Z.createElement($f,Ys({},h,{type:r})),Z.createElement(wn,{className:"recharts-scatter-line",key:"recharts-scatter-line"},d)}function M2(t){var{showLabels:e,points:s,children:n}=t,i=bf(),r=Z.useMemo(()=>s?.map(a=>{var o,c,d={x:(o=a.x)!==null&&o!==void 0?o:0,y:(c=a.y)!==null&&c!==void 0?c:0,width:a.width,height:a.height,lowerWidth:a.width,upperWidth:a.width};return Ht(Ht({},d),{},{value:void 0,payload:a.payload,viewBox:d,parentViewBox:i,fill:void 0})}),[i,s]);return Z.createElement(jf,{value:e?r:void 0},n)}function I2(t){var{points:e,allOtherScatterProps:s}=t,{shape:n,activeShape:i,dataKey:r}=s,{id:a}=s,o=ia(s,w2),c=lr(yf),{onMouseEnter:d,onClick:m,onMouseLeave:u}=s,f=ia(s,N2),p=Gf(d,r,a),x=Yf(u),h=Qf(m,r,a);if(!wf(e))return null;var g=T1(o);return Z.createElement(Z.Fragment,null,Z.createElement(E2,{points:e,props:o}),e.map((v,b)=>{var y=i!=null&&i!==!1,j=y&&c===String(b),N=y&&j?i:n,w=Ht(Ht(Ht({},g),v),{},{index:b,[Nf]:String(a)});return Z.createElement(Xa,{key:"symbol-".concat(v?.cx,"-").concat(v?.cy,"-").concat(v?.size,"-").concat(b),zIndex:j?Ya.activeDot:void 0},Z.createElement(wn,Ys({className:"recharts-scatter-symbol"},kf(f,v,b),{onMouseEnter:p(v,b),onMouseLeave:x(v,b),onClick:h(v,b)}),Z.createElement(m2,Ys({option:N,isActive:j},w))))}))}function A2(t){var{previousPointsRef:e,props:s}=t,{points:n,isAnimationActive:i,animationBegin:r,animationDuration:a,animationEasing:o}=s,c=e.current,d=hf(s,"recharts-scatter-"),[m,u]=Z.useState(!1),f=Z.useCallback(()=>{u(!1)},[]),p=Z.useCallback(()=>{u(!0)},[]),x=!m;return Z.createElement(M2,{showLabels:x,points:n},s.children,Z.createElement(gf,{animationId:d,begin:r,duration:a,isActive:i,easing:o,onAnimationEnd:f,onAnimationStart:p,key:d},h=>{var g=h===1?n:n?.map((v,b)=>{var y=c&&c[b];return y?Ht(Ht({},v),{},{cx:v.cx==null?void 0:Si(y.cx,v.cx,h),cy:v.cy==null?void 0:Si(y.cy,v.cy,h),size:Si(y.size,v.size,h)}):Ht(Ht({},v),{},{size:Si(0,v.size,h)})});return h>0&&(e.current=g),Z.createElement(wn,null,Z.createElement(I2,{points:g,allOtherScatterProps:s,showLabels:x}))}),Z.createElement(vf,{label:s.label}))}function L2(t){var{displayedData:e,xAxis:s,yAxis:n,zAxis:i,scatterSettings:r,xAxisTicks:a,yAxisTicks:o,cells:c}=t,d=An(s.dataKey)?r.dataKey:s.dataKey,m=An(n.dataKey)?r.dataKey:n.dataKey,u=i&&i.dataKey,f=i?i.range:xf.range,p=f&&f[0],x=s.scale.bandwidth?s.scale.bandwidth():0,h=n.scale.bandwidth?n.scale.bandwidth():0;return e.map((g,v)=>{var b=qi(g,d),y=qi(g,m),j=!An(u)&&qi(g,u)||"-",N=[{name:An(s.dataKey)?r.name:s.name||String(s.dataKey),unit:s.unit||"",value:b,payload:g,dataKey:d,type:r.tooltipType,graphicalItemId:r.id},{name:An(n.dataKey)?r.name:n.name||String(n.dataKey),unit:n.unit||"",value:y,payload:g,dataKey:m,type:r.tooltipType,graphicalItemId:r.id}];j!=="-"&&i!=null&&N.push({name:i.name||i.dataKey,unit:i.unit||"",value:j,payload:g,dataKey:u,type:r.tooltipType,graphicalItemId:r.id});var w=Po({axis:s,ticks:a,bandSize:x,entry:g,index:v,dataKey:d}),S=Po({axis:n,ticks:o,bandSize:h,entry:g,index:v,dataKey:m}),k=j!=="-"&&i!=null?i.scale.map(j):p,_=k==null?0:Math.sqrt(Math.max(k,0)/Math.PI);return Ht(Ht({},g),{},{cx:w,cy:S,x:w==null?void 0:w-_,y:S==null?void 0:S-_,width:2*_,height:2*_,size:k,node:{x:b,y,z:j},tooltipPayload:N,tooltipPosition:{x:w,y:S},payload:g},c&&c[v]&&c[v].props)})}var D2=(t,e,s)=>({x:t.cx,y:t.cy,value:Number(s==="x"?t.node.x:t.node.y),errorVal:qi(t,e)});function O2(t){var{hide:e,points:s,className:n,needClip:i,xAxisId:r,yAxisId:a,id:o}=t,c=Z.useRef(null);if(e)return null;var d=Jc("recharts-scatter",n),m=o;return Z.createElement(Xa,{zIndex:t.zIndex},Z.createElement(wn,{className:d,clipPath:i?"url(#clipPath-".concat(m,")"):void 0,id:o},i&&Z.createElement("defs",null,Z.createElement(Ru,{clipPathId:m,xAxisId:r,yAxisId:a})),Z.createElement(_u,{xAxisId:r,yAxisId:a,data:s,dataPointFormatter:D2,errorBarOffset:0},Z.createElement(wn,{key:"recharts-scatter-symbols"},Z.createElement(A2,{props:t,previousPointsRef:c})))))}var L1={xAxisId:0,yAxisId:0,zAxisId:0,label:!1,line:!1,legendType:"circle",lineType:"joint",lineJointType:"linear",shape:"circle",hide:!1,isAnimationActive:"auto",animationBegin:0,animationDuration:400,animationEasing:"linear",zIndex:Ya.scatter};function R2(t){var e=Ga(t,L1),{animationBegin:s,animationDuration:n,animationEasing:i,hide:r,isAnimationActive:a,legendType:o,lineJointType:c,lineType:d,shape:m,xAxisId:u,yAxisId:f,zAxisId:p}=e,x=ia(e,k2),{needClip:h}=Ou(u,f),g=Z.useMemo(()=>ff(t.children,Za),[t.children]),v=Qa(),b=lr(y=>y2(y,u,f,p,t.id,g,v));return h==null||b==null?null:Z.createElement(Z.Fragment,null,Z.createElement(C2,{dataKey:t.dataKey,points:b,stroke:t.stroke,strokeWidth:t.strokeWidth,fill:t.fill,name:t.name,hide:t.hide,tooltipType:t.tooltipType,id:t.id}),Z.createElement(O2,Ys({},x,{xAxisId:u,yAxisId:f,zAxisId:p,lineType:d,lineJointType:c,legendType:o,shape:m,hide:r,isAnimationActive:a,animationBegin:s,animationDuration:n,animationEasing:i,points:b,needClip:h})))}function F2(t){var e=Ga(t,L1),s=Qa();return Z.createElement(df,{id:e.id,type:"scatter"},n=>Z.createElement(Z.Fragment,null,Z.createElement(mf,{legendPayload:P2(e)}),Z.createElement(uf,{type:"scatter",id:n,data:e.data,xAxisId:e.xAxisId,yAxisId:e.yAxisId,zAxisId:e.zAxisId,dataKey:e.dataKey,hide:e.hide,name:e.name,tooltipType:e.tooltipType,isPanorama:s}),Z.createElement(R2,Ys({},e,{id:n}))))}var D1=Z.memo(F2,cf);D1.displayName="Scatter";var z2=["axis"],O1=Z.forwardRef((t,e)=>Z.createElement(Fu,{chartName:"LineChart",defaultTooltipEventType:"axis",validateTooltipEventTypes:z2,tooltipPayloadSearcher:Tf,categoricalChartProps:t,ref:e}));function V2(t,e,s){return e===0?"off":s?"partial":"live"}const Do={alert:3,warning:2,ready:1};function q2(t){return[...t].sort((e,s)=>Do[s.severity]-Do[e.severity]||s.since.localeCompare(e.since))}const Oo={alert:3,warning:2,ok:1,"low-volume":0};function R1(t){return t.reduce((e,s)=>Oo[s]>Oo[e]?s:e,"low-volume")}function K2(t){return t.rules.length===0?"low-volume":R1(t.rules.map(e=>e.status))}function B2(t,e){return e?{...t,stores:t.stores.filter(s=>s.store.agentIds.includes(e)),deploys:t.deploys?.filter(s=>s.projectId===e)??null,deployHistory:t.deployHistory?.filter(s=>s.projectId===e)??null,signals:t.signals.filter(s=>s.projectId===null||s.projectId===e),projects:t.projects.filter(s=>s.id===e),experiments:t.experiments?.filter(s=>s.projectId===e)??null}:t}const ra=t=>t.rules[0]?.verdict.timezone??Intl.DateTimeFormat().resolvedOptions().timeZone,nt=t=>t.reduce((e,s)=>e+(s??0),0),Ro=36e5,Fo=10,zo=.2;function H2(t,e){const s={verdict:"unmeasured",impact:[]};if(e.length===0)return s;let n=0,i=0,r=0,a=0,o=0;for(const d of e){const m=Math.floor((t-d.start)/Ro);if(m<1||m>22)return s;m+1>=Math.floor(d.done/4)&&(o=Math.max(o,d.start+(m+2)*Ro)),n+=d.today[m-1]??0,i+=d.today[m+1]??0,r+=d.w1[m-1]??0,a+=d.w1[m+1]??0}if(o>0)return{verdict:"settling",impact:[],settlesAt:new Date(o).toISOString()};if(n<Fo||r<Fo||a===0)return s;const c=i/n/(a/r)-1;return{verdict:c<=-zo?"regression":c>=zo?"improvement":"neutral",impact:[{metric:"orders",change:c}]}}const W2=5*6e4,U2=200,G2=25;function F1(t){const e=O.c(3),s=fs();let n;e[0]!==t||e[1]!==s?(n=i=>{if(!t)return X2;const r=()=>{s.invalidateQueries({queryKey:Qe.alertsAll(t)}),i()};return xu.subscribe(t,r,r)},e[0]=t,e[1]=s,e[2]=n):n=e[2],Z.useSyncExternalStore(n,Q2,Y2)}function Y2(){return 0}function Q2(){return 0}function X2(){}function Ja(t){const e=O.c(27),s=Yt(),n=fs();let i;e[0]!==t?(i=Qe.alerts(t,"open"),e[0]=t,e[1]=i):i=e[1];const r=i;let a;e[2]!==s?(a=async()=>(await s.call("ALERTS_LIST",{status:"open",limit:U2})).alerts,e[2]=s,e[3]=a):a=e[3];let o;e[4]!==r||e[5]!==a?(o={queryKey:r,queryFn:a,refetchInterval:W2},e[4]=r,e[5]=a,e[6]=o):o=e[6];const c=ts(o);F1(t);let d;e[7]!==s?(d=v=>s.call("ALERT_ACK",{id:v}),e[7]=s,e[8]=d):d=e[8];let m;e[9]!==n||e[10]!==r?(m=async v=>{await n.cancelQueries({queryKey:r}),n.setQueryData(r,b=>b?.filter(y=>y.id!==v))},e[9]=n,e[10]=r,e[11]=m):m=e[11];let u;e[12]!==t||e[13]!==n?(u=()=>n.invalidateQueries({queryKey:Qe.alertsAll(t)}),e[12]=t,e[13]=n,e[14]=u):u=e[14];let f;e[15]!==d||e[16]!==m||e[17]!==u?(f={mutationFn:d,onMutate:m,onSettled:u},e[15]=d,e[16]=m,e[17]=u,e[18]=f):f=e[18];const p=Et(f);let x;e[19]!==c.data?(x=c.data??[],e[19]=c.data,e[20]=x):x=e[20];let h;e[21]!==p?(h=v=>p.mutate(v),e[21]=p,e[22]=h):h=e[22];let g;return e[23]!==c.isLoading||e[24]!==x||e[25]!==h?(g={alerts:x,loading:c.isLoading,ack:h},e[23]=c.isLoading,e[24]=x,e[25]=h,e[26]=g):g=e[26],g}function Z2(t){const e=O.c(17),s=Yt();let n;e[0]!==t?(n=Qe.alerts(t,"acked"),e[0]=t,e[1]=n):n=e[1];let i;e[2]!==s?(i=m=>{const{pageParam:u}=m;return s.call("ALERTS_LIST",{status:"acked",limit:G2,...u?{cursor:u}:{}})},e[2]=s,e[3]=i):i=e[3];let r;e[4]!==n||e[5]!==i?(r={queryKey:n,queryFn:i,initialPageParam:void 0,getNextPageParam:ep},e[4]=n,e[5]=i,e[6]=r):r=e[6];const a=u1(r);F1(t);let o;e[7]!==a.data?.pages?(o=a.data?.pages.flatMap(J2)??[],e[7]=a.data?.pages,e[8]=o):o=e[8];let c;e[9]!==a?(c=()=>{a.hasNextPage&&!a.isFetchingNextPage&&a.fetchNextPage()},e[9]=a,e[10]=c):c=e[10];let d;return e[11]!==a.hasNextPage||e[12]!==a.isFetchingNextPage||e[13]!==a.isLoading||e[14]!==o||e[15]!==c?(d={alerts:o,loading:a.isLoading,hasMore:a.hasNextPage,loadingMore:a.isFetchingNextPage,loadMore:c},e[11]=a.hasNextPage,e[12]=a.isFetchingNextPage,e[13]=a.isLoading,e[14]=o,e[15]=c,e[16]=d):d=e[16],d}function J2(t){return t.alerts}function ep(t){return t.nextCursor??void 0}function tp(t){const e=O.c(22),s=Yt(),n=fs();let i;e[0]!==t?(i=Qe.alertRules(t),e[0]=t,e[1]=i):i=e[1];const r=i;let a;e[2]!==s?(a=async()=>(await s.call("ALERT_RULES_LIST",{})).rules,e[2]=s,e[3]=a):a=e[3];let o;e[4]!==r||e[5]!==a?(o={queryKey:r,queryFn:a},e[4]=r,e[5]=a,e[6]=o):o=e[6];const c=ts(o);let d;e[7]!==s?(d=h=>s.call("ALERT_RULE_UPDATE",h),e[7]=s,e[8]=d):d=e[8];let m;e[9]!==n||e[10]!==r?(m=()=>n.invalidateQueries({queryKey:r}),e[9]=n,e[10]=r,e[11]=m):m=e[11];let u;e[12]!==d||e[13]!==m?(u={mutationFn:d,onSettled:m},e[12]=d,e[13]=m,e[14]=u):u=e[14];const f=Et(u);let p;e[15]!==c.data?(p=c.data??[],e[15]=c.data,e[16]=p):p=e[16];let x;return e[17]!==c.isLoading||e[18]!==p||e[19]!==f.isPending||e[20]!==f.mutateAsync?(x={rules:p,loading:c.isLoading,save:f.mutateAsync,saving:f.isPending},e[17]=c.isLoading,e[18]=p,e[19]=f.isPending,e[20]=f.mutateAsync,e[21]=x):x=e[21],x}const sp="flex items-center gap-4 px-5 py-4",Vo="surface max-h-[26rem] divide-y divide-border/70 overflow-y-auto overscroll-contain";function Rr(t){const e=O.c(13),{title:s,count:n,hint:i,children:r}=t;let a;e[0]!==n?(a=n?l.jsx("span",{className:"ml-1.5 text-muted-foreground tabular-nums",children:n}):null,e[0]=n,e[1]=a):a=e[1];let o;e[2]!==a||e[3]!==s?(o=l.jsxs("h2",{className:"text-sm font-medium text-foreground",children:[s,a]}),e[2]=a,e[3]=s,e[4]=o):o=e[4];let c;e[5]!==i?(c=i&&l.jsx("p",{className:"text-meta",children:i}),e[5]=i,e[6]=c):c=e[6];let d;e[7]!==o||e[8]!==c?(d=l.jsxs("div",{className:"flex flex-col gap-0.5",children:[o,c]}),e[7]=o,e[8]=c,e[9]=d):d=e[9];let m;return e[10]!==r||e[11]!==d?(m=l.jsxs("section",{className:"flex flex-col gap-3",children:[d,r]}),e[10]=r,e[11]=d,e[12]=m):m=e[12],m}function qo(t){const e=O.c(2),{children:s}=t;let n;return e[0]!==s?(n=l.jsx("div",{className:"surface px-5 py-4 text-sm text-muted-foreground",children:s}),e[0]=s,e[1]=n):n=e[1],n}function Ko(t){const e=O.c(41),{alert:s,orgSlug:n,onOpenStore:i,onAck:r}=t,a=ie(),o=s.ackedAt!==null;let c;e[0]!==s.taskKeySeq||e[1]!==n?(c=s.taskKeySeq===null?null:za(n,s.taskKeySeq),e[0]=s.taskKeySeq,e[1]=n,e[2]=c):c=e[2];const d=c;let m;e[3]!==o||e[4]!==s.ackNote||e[5]!==s.ackedAt||e[6]!==s.ackedByName||e[7]!==s.body||e[8]!==s.createdAt||e[9]!==a?(m=o?[s.ackedByName?a("monitor.alerts.ackedBy",{ago:Hn(new Date(s.ackedAt)),name:s.ackedByName}):a("monitor.alerts.acked",{ago:Hn(new Date(s.ackedAt))}),s.ackNote]:[a("monitor.alerts.opened",{ago:Hn(new Date(s.createdAt))}),s.body],e[3]=o,e[4]=s.ackNote,e[5]=s.ackedAt,e[6]=s.ackedByName,e[7]=s.body,e[8]=s.createdAt,e[9]=a,e[10]=m):m=e[10];const u=m;let f;e[11]!==s.title?(f=l.jsx("span",{className:"truncate text-sm font-medium text-foreground",children:s.title}),e[11]=s.title,e[12]=f):f=e[12];const p=f,x=o?"bg-muted text-muted-foreground":"bg-destructive/10 text-destructive";let h;e[13]!==x?(h=ye("flex size-9 shrink-0 items-center justify-center rounded-full",x),e[13]=x,e[14]=h):h=e[14];let g;e[15]!==o?(g=o?l.jsx(Fa,{size:18}):l.jsx(hr,{size:18}),e[15]=o,e[16]=g):g=e[16];let v;e[17]!==h||e[18]!==g?(v=l.jsx("span",{className:h,children:g}),e[17]=h,e[18]=g,e[19]=v):v=e[19];let b;e[20]!==i||e[21]!==p?(b=i?l.jsx("button",{type:"button",onClick:i,className:"focus-ring min-w-0 truncate text-left hover:underline",children:p}):p,e[20]=i,e[21]=p,e[22]=b):b=e[22];let y;e[23]!==u?(y=u.filter(Boolean),e[23]=u,e[24]=y):y=e[24];const j=y.join(" · ");let N;e[25]!==j?(N=l.jsx("span",{className:"text-meta truncate",children:j}),e[25]=j,e[26]=N):N=e[26];let w;e[27]!==N||e[28]!==b?(w=l.jsxs("span",{className:"flex min-w-0 flex-1 flex-col gap-0.5",children:[b,N]}),e[27]=N,e[28]=b,e[29]=w):w=e[29];let S;e[30]!==d||e[31]!==n?(S=d&&l.jsx(As,{to:"/$org/t/$taskKey",params:{org:n,taskKey:d},className:"shrink-0 text-xs font-medium text-foreground underline-offset-2 hover:underline",children:d}),e[30]=d,e[31]=n,e[32]=S):S=e[32];let k;e[33]!==r||e[34]!==a?(k=r&&l.jsx(Se,{variant:"outline",size:"sm",className:"shrink-0",onClick:r,children:a("monitor.signal.ack")}),e[33]=r,e[34]=a,e[35]=k):k=e[35];let _;return e[36]!==w||e[37]!==S||e[38]!==k||e[39]!==v?(_=l.jsxs("li",{className:sp,children:[v,w,S,k]}),e[36]=w,e[37]=S,e[38]=k,e[39]=v,e[40]=_):_=e[40],_}const z1=t=>t==="orders_drop"||t==="visitors_drop"||t==="pageviews_drop";function Bo(t,e){switch(t){case"orders_drop":return{label:Vi(t,e),help:e("monitor.alerts.rules.dropHelp"),unit:e("monitor.alerts.rules.unitOrders")};case"denied_spike":return{label:Vi(t,e),help:e("monitor.alerts.rules.spikeHelp"),unit:e("monitor.alerts.rules.unitDenials")};case"cancel_spike":return{label:Vi(t,e),help:e("monitor.alerts.rules.spikeHelp"),unit:e("monitor.alerts.rules.unitCancellations")};case"visitors_drop":return{label:e("monitor.alerts.rules.visitors"),help:e("monitor.alerts.rules.visitorsHelp"),unit:e("monitor.alerts.rules.unitVisitors")};case"pageviews_drop":return{label:e("monitor.alerts.rules.pageviews"),help:e("monitor.alerts.rules.pageviewsHelp"),unit:e("monitor.alerts.rules.unitPageviews")};default:return t}}const lp=t=>Object.fromEntries(t.map(e=>[e.rule,{threshold:String(e.threshold),minVolume:String(e.minVolume)}]));function Ho(t,e){const s=Number(e.threshold),n=Number(e.minVolume);return e.threshold!==""&&e.minVolume!==""&&Number.isFinite(s)&&Number.isFinite(n)&&n>=0&&(z1(t.rule)?s>=1&&s<=99:s>1)?{threshold:s,minVolume:n}:null}function np(t){const e=O.c(72),{rules:s,saving:n,onSave:i}=t,r=ie();let a;e[0]!==s?(a=()=>lp(s),e[0]=s,e[1]=a):a=e[1];const[o,c]=Z.useState(a);let d,m,u,f,p,x,h,g,v;if(e[2]!==o||e[3]!==s||e[4]!==r){let P;e[14]!==o?(P=U=>{const q=o[U.rule],L=Ho(U,q);return{rule:U,d:q,next:L,dirty:!L||L.threshold!==U.threshold||L.minVolume!==U.minVolume}},e[14]=o,e[15]=P):P=e[15];const I=s.map(P);v=I.every(op),m=I.flatMap(ap);let C;e[16]!==s?(C=s.every(rp),e[16]=s,e[17]=C):C=e[17],d=C;let M;e[18]!==o?(M=(U,q,L)=>c({...o,[U]:{...o[U],[q]:L}}),e[18]=o,e[19]=M):M=e[19];const A=M;let F;e[20]!==o||e[21]!==A||e[22]!==r?(F=(U,q,L,B)=>{const Y=l.jsx(_m,{type:"number",inputMode:"decimal",min:0,"aria-invalid":B,"aria-label":`${Bo(U.rule,r).label}: ${L}`,value:o[U.rule][q],onChange:J=>A(U.rule,q,J.target.value),className:"tabular-nums"});return q==="threshold"?l.jsxs(So,{size:"sm",className:"w-full",children:[Y,l.jsx($m,{className:"text-xs",children:L})]}):l.jsxs("span",{className:"flex items-center gap-2",children:[l.jsx(So,{size:"sm",className:"w-20 shrink-0",children:Y}),l.jsx("span",{className:"truncate text-sm text-muted-foreground",children:L})]})},e[20]=o,e[21]=A,e[22]=r,e[23]=F):F=e[23];const E=F;g="surface overflow-hidden",u="grid grid-cols-[minmax(0,1fr)_7rem_13rem] items-center gap-x-4 gap-y-0";let z;e[24]!==r?(z=r("monitor.alerts.rules.colRule"),e[24]=r,e[25]=z):z=e[25],e[26]!==z?(f=l.jsx("span",{className:"text-meta px-5 pt-3 pb-2",children:z}),e[26]=z,e[27]=f):f=e[27];let R;e[28]!==r?(R=r("monitor.alerts.rules.colThreshold"),e[28]=r,e[29]=R):R=e[29],e[30]!==R?(p=l.jsx("span",{className:"text-meta pt-3 pb-2",children:R}),e[30]=R,e[31]=p):p=e[31];let V;e[32]!==r?(V=r("monitor.alerts.rules.colMinimum"),e[32]=r,e[33]=V):V=e[33],e[34]!==V?(x=l.jsx("span",{className:"text-meta pt-3 pr-5 pb-2",children:V}),e[34]=V,e[35]=x):x=e[35];let K;e[36]!==E||e[37]!==r?(K=U=>{const{rule:q,d:L}=U,B=Bo(q.rule,r),Y=z1(q.rule),J=Ho(q,L)===null;return l.jsxs("div",{className:"contents",children:[l.jsxs("span",{className:"flex min-w-0 flex-col gap-0.5 border-t border-border/70 px-5 py-3",children:[l.jsx("span",{className:"text-sm font-medium text-foreground",children:B.label}),l.jsx("span",{className:"text-meta",children:B.help})]}),l.jsx("span",{className:"flex h-full items-center border-t border-border/70 py-3",children:E(q,"threshold",Y?"%":"×",J)}),l.jsx("span",{className:"flex h-full items-center border-t border-border/70 py-3 pr-5",children:E(q,"minVolume",B.unit,L.minVolume===""||Number(L.minVolume)<0)})]},q.rule)},e[36]=E,e[37]=r,e[38]=K):K=e[38],h=I.map(K),e[2]=o,e[3]=s,e[4]=r,e[5]=d,e[6]=m,e[7]=u,e[8]=f,e[9]=p,e[10]=x,e[11]=h,e[12]=g,e[13]=v}else d=e[5],m=e[6],u=e[7],f=e[8],p=e[9],x=e[10],h=e[11],g=e[12],v=e[13];let b;e[39]!==u||e[40]!==f||e[41]!==p||e[42]!==x||e[43]!==h?(b=l.jsxs("div",{className:u,children:[f,p,x,h]}),e[39]=u,e[40]=f,e[41]=p,e[42]=x,e[43]=h,e[44]=b):b=e[44];let y;e[45]!==r?(y=r("monitor.alerts.rules.note"),e[45]=r,e[46]=y):y=e[46];let j;e[47]!==y?(j=l.jsx("span",{className:"text-meta mr-auto",children:y}),e[47]=y,e[48]=j):j=e[48];let N;e[49]!==d||e[50]!==i||e[51]!==s||e[52]!==n||e[53]!==r?(N=!d&&l.jsx(Se,{variant:"ghost",size:"sm",disabled:n,onClick:()=>i(s.map(ip)),children:r("monitor.alerts.rules.reset")}),e[49]=d,e[50]=i,e[51]=s,e[52]=n,e[53]=r,e[54]=N):N=e[54];const w=m.length===0||!v||n;let S;e[55]!==m||e[56]!==i?(S=()=>i(m),e[55]=m,e[56]=i,e[57]=S):S=e[57];let k;e[58]!==r?(k=r("monitor.alerts.rules.save"),e[58]=r,e[59]=k):k=e[59];let _;e[60]!==w||e[61]!==S||e[62]!==k?(_=l.jsx(Se,{size:"sm",disabled:w,onClick:S,children:k}),e[60]=w,e[61]=S,e[62]=k,e[63]=_):_=e[63];let $;e[64]!==j||e[65]!==N||e[66]!==_?($=l.jsxs("div",{className:"flex items-center justify-end gap-2 border-t border-border/70 px-5 py-3",children:[j,N,_]}),e[64]=j,e[65]=N,e[66]=_,e[67]=$):$=e[67];let T;return e[68]!==$||e[69]!==g||e[70]!==b?(T=l.jsxs("div",{className:g,children:[b,$]}),e[68]=$,e[69]=g,e[70]=b,e[71]=T):T=e[71],T}function ip(t){return{rule:t.rule,...t.defaults}}function rp(t){return t.threshold===t.defaults.threshold&&t.minVolume===t.defaults.minVolume}function ap(t){return t.dirty&&t.next?[{rule:t.rule.rule,...t.next}]:[]}function op(t){return t.next}function cp(t){const e=O.c(51),{orgSlug:s,stores:n,scoped:i,onOpenStore:r}=t,a=ie(),o=Ja(s),c=Z2(s),d=tp(s);let m;e[0]!==i||e[1]!==n?(m=j=>i?j.filter(N=>n.has(N.subjectId)):j,e[0]=i,e[1]=n,e[2]=m):m=e[2];const u=m;let f,p,x,h,g,v;if(e[3]!==c.alerts||e[4]!==c.hasMore||e[5]!==c.loadMore||e[6]!==c.loading||e[7]!==c.loadingMore||e[8]!==u||e[9]!==r||e[10]!==o||e[11]!==s||e[12]!==d||e[13]!==n||e[14]!==a){const j=u(o.alerts),N=u(c.alerts);let w;e[21]!==r||e[22]!==n?(w=I=>n.has(I.subjectId)?()=>r(I.subjectId):null,e[21]=r,e[22]=n,e[23]=w):w=e[23];const S=w;h="mx-auto flex w-full max-w-[1200px] flex-col gap-8 px-4 pt-6 pb-10 md:px-10";let k;e[24]!==a?(k=a("monitor.alerts.open"),e[24]=a,e[25]=k):k=e[25];const _=o.loading?l.jsx(Ce,{className:"h-24"}):j.length===0?l.jsx(qo,{children:a("monitor.alerts.openEmpty")}):l.jsx("ul",{className:Vo,children:j.map(I=>l.jsx(Ko,{alert:I,orgSlug:s,onOpenStore:S(I),onAck:()=>o.ack(I.id)},I.id))});e[26]!==j||e[27]!==k||e[28]!==_?(g=l.jsx(Rr,{title:k,count:j.length,children:_}),e[26]=j,e[27]=k,e[28]=_,e[29]=g):g=e[29];let $;e[30]!==a?($=a("monitor.alerts.rules.title"),e[30]=a,e[31]=$):$=e[31];let T;e[32]!==a?(T=a("monitor.alerts.rules.hint"),e[32]=a,e[33]=T):T=e[33];let P;e[34]!==d?(P=d.loading?l.jsx(Ce,{className:"h-40"}):l.jsx(np,{rules:d.rules,saving:d.saving,onSave:I=>{Promise.all(I.map(C=>d.save(C)))}},d.rules.map(dp).join("|")),e[34]=d,e[35]=P):P=e[35],e[36]!==$||e[37]!==T||e[38]!==P?(v=l.jsx(Rr,{title:$,hint:T,children:P}),e[36]=$,e[37]=T,e[38]=P,e[39]=v):v=e[39],f=Rr,e[40]!==a?(p=a("monitor.alerts.ackedTitle"),e[40]=a,e[41]=p):p=e[41],x=c.loading?l.jsx(Ce,{className:"h-24"}):N.length===0&&!c.hasMore?l.jsx(qo,{children:a("monitor.alerts.ackedEmpty")}):l.jsxs("ul",{className:Vo,children:[N.map(I=>l.jsx(Ko,{alert:I,orgSlug:s,onOpenStore:S(I),onAck:null},I.id)),c.hasMore&&l.jsx("li",{children:l.jsx("button",{type:"button",disabled:c.loadingMore,onClick:c.loadMore,className:"focus-ring w-full px-5 py-3 text-left text-sm text-muted-foreground transition-colors hover:bg-accent/30 hover:text-foreground disabled:opacity-60",children:a("monitor.alerts.loadMore")})})]}),e[3]=c.alerts,e[4]=c.hasMore,e[5]=c.loadMore,e[6]=c.loading,e[7]=c.loadingMore,e[8]=u,e[9]=r,e[10]=o,e[11]=s,e[12]=d,e[13]=n,e[14]=a,e[15]=f,e[16]=p,e[17]=x,e[18]=h,e[19]=g,e[20]=v}else f=e[15],p=e[16],x=e[17],h=e[18],g=e[19],v=e[20];let b;e[42]!==f||e[43]!==p||e[44]!==x?(b=l.jsx(f,{title:p,children:x}),e[42]=f,e[43]=p,e[44]=x,e[45]=b):b=e[45];let y;return e[46]!==h||e[47]!==g||e[48]!==v||e[49]!==b?(y=l.jsxs("div",{className:h,children:[g,v,b]}),e[46]=h,e[47]=g,e[48]=v,e[49]=b,e[50]=y):y=e[50],y}function dp(t){return`${t.rule}:${t.threshold}:${t.minVolume}`}function Wo(...t){return t.map(e=>e.trim()).filter(Boolean).join(" ")}function mp(t){const e=O.c(83),{project:s}=t,n=ie(),i=ku(),r=yu(),a=wu(),[o,c]=Z.useState(""),[d,m]=Z.useState(""),u=a.status==="recording";let f;e[0]!==u||e[1]!==o||e[2]!==d||e[3]!==a.interimTranscript||e[4]!==a.transcript?(f=u?Wo(d,a.transcript,a.interimTranscript):o,e[0]=u,e[1]=o,e[2]=d,e[3]=a.interimTranscript,e[4]=a.transcript,e[5]=f):f=e[5];const p=f;let x;e[6]!==p?(x=p.trim(),e[6]=p,e[7]=x):x=e[7];const h=x.length>0;let g;e[8]!==n?(g=n("monitor.ask.suggestion.today"),e[8]=n,e[9]=g):g=e[9];let v;e[10]!==g?(v={icon:pr,text:g},e[10]=g,e[11]=v):v=e[11];let b;e[12]!==n?(b=n("monitor.ask.suggestion.pages"),e[12]=n,e[13]=b):b=e[13];let y;e[14]!==b?(y={icon:Bm,text:b},e[14]=b,e[15]=y):y=e[15];let j;e[16]!==n?(j=n("monitor.ask.suggestion.errors"),e[16]=n,e[17]=j):j=e[17];let N;e[18]!==j?(N={icon:ju,text:j},e[18]=j,e[19]=N):N=e[19];let w;e[20]!==v||e[21]!==y||e[22]!==N?(w=[v,y,N],e[20]=v,e[21]=y,e[22]=N,e[23]=w):w=e[23];const S=w;let k;e[24]!==i?(k=G=>{const Q=G.trim();Q&&(i(Q),c(""))},e[24]=i,e[25]=k):k=e[25];const _=k;let $;e[26]!==d||e[27]!==a?($=()=>{const G=Wo(d,a.stopRecording());return c(G),G},e[26]=d,e[27]=a,e[28]=$):$=e[28];const T=$;let P;e[29]!==T||e[30]!==u||e[31]!==_||e[32]!==o?(P=G=>{G.preventDefault(),_(u?T():o)},e[29]=T,e[30]=u,e[31]=_,e[32]=o,e[33]=P):P=e[33];const I=P;let C;e[34]!==T||e[35]!==u||e[36]!==o||e[37]!==a?(C=()=>{if(u){T();return}m(o),a.startRecording()},e[34]=T,e[35]=u,e[36]=o,e[37]=a,e[38]=C):C=e[38];const M=C;let A;e[39]===Symbol.for("react.memo_cache_sentinel")?(A=l.jsx("div",{"aria-hidden":!0,className:"pointer-events-none absolute inset-x-10 top-1/2 -bottom-2 rounded-full bg-gradient-to-r from-brand-purple via-brand to-brand-yellow opacity-40 blur-xl dark:opacity-25"}),e[39]=A):A=e[39];let F;e[40]===Symbol.for("react.memo_cache_sentinel")?(F=G=>c(G.target.value),e[40]=F):F=e[40];let E;e[41]!==s||e[42]!==n?(E=s?n("monitor.ask.placeholderProject",{project:s}):n("monitor.ask.placeholder"),e[41]=s,e[42]=n,e[43]=E):E=e[43];let z;e[44]!==n?(z=n("monitor.ask.label"),e[44]=n,e[45]=z):z=e[45];let R;e[46]!==u||e[47]!==p||e[48]!==E||e[49]!==z?(R=l.jsx("input",{value:p,onChange:F,readOnly:u,placeholder:E,"aria-label":z,className:"h-8 min-w-0 flex-1 bg-transparent text-base outline-none placeholder:text-muted-foreground/50"}),e[46]=u,e[47]=p,e[48]=E,e[49]=z,e[50]=R):R=e[50];let V;e[51]!==r?(V=r&&l.jsx(Nu,{}),e[51]=r,e[52]=V):V=e[52];let K;e[53]!==M||e[54]!==u||e[55]!==n||e[56]!==a.isSupported?(K=a.isSupported&&l.jsx(Se,{type:"button",variant:"ghost",size:"icon","aria-pressed":u,onClick:M,title:n(u?"monitor.ask.stopDictating":"monitor.ask.dictate"),"aria-label":n(u?"monitor.ask.stopDictating":"monitor.ask.dictate"),className:ye("text-muted-foreground hover:text-foreground",u&&"bg-destructive/10 text-destructive hover:text-destructive"),children:l.jsx(vu,{size:18})}),e[53]=M,e[54]=u,e[55]=n,e[56]=a.isSupported,e[57]=K):K=e[57];const U=h?"default":"ghost",q=!h;let L;e[58]!==n?(L=n("monitor.ask.send"),e[58]=n,e[59]=L):L=e[59];let B;e[60]!==n?(B=n("monitor.ask.send"),e[60]=n,e[61]=B):B=e[61];const Y=!h&&"bg-muted text-muted-foreground disabled:opacity-100";let J;e[62]!==Y?(J=ye("size-8 shrink-0",Y),e[62]=Y,e[63]=J):J=e[63];let X;e[64]===Symbol.for("react.memo_cache_sentinel")?(X=l.jsx(f1,{size:20}),e[64]=X):X=e[64];let ee;e[65]!==U||e[66]!==q||e[67]!==L||e[68]!==B||e[69]!==J?(ee=l.jsx(Se,{type:"submit",size:"icon",variant:U,disabled:q,"aria-label":L,title:B,className:J,children:X}),e[65]=U,e[66]=q,e[67]=L,e[68]=B,e[69]=J,e[70]=ee):ee=e[70];let te;e[71]!==I||e[72]!==R||e[73]!==V||e[74]!==K||e[75]!==ee?(te=l.jsxs("div",{className:"relative",children:[A,l.jsxs("form",{onSubmit:I,className:"@container/chat-bottom focus-within-ring relative flex items-center gap-1.5 rounded-2xl bg-card p-2.5 pl-[18px] shadow-edge dark:bg-muted",children:[R,V,K,ee]})]}),e[71]=I,e[72]=R,e[73]=V,e[74]=K,e[75]=ee,e[76]=te):te=e[76];let D;e[77]!==_||e[78]!==S?(D=l.jsx("ul",{className:"flex flex-col",children:S.map(G=>{const{icon:Q,text:re}=G;return l.jsx("li",{children:l.jsxs("button",{type:"button",onClick:()=>_(re),className:"focus-ring flex w-full cursor-pointer items-center gap-3 rounded-xl px-[18px] py-3 text-left text-sm text-muted-foreground transition-colors hover:bg-accent hover:text-foreground",children:[l.jsx(Q,{size:16,className:"shrink-0"}),re]})},re)})}),e[77]=_,e[78]=S,e[79]=D):D=e[79];let W;return e[80]!==te||e[81]!==D?(W=l.jsxs("div",{className:"flex flex-col gap-4",children:[te,D]}),e[80]=te,e[81]=D,e[82]=W):W=e[82],W}const up=["24h","7d","30d"];function wt(t){const e=typeof t=="number"?t:Number(t);return Number.isFinite(e)?new Intl.NumberFormat().format(e):"—"}function Qs(t){const e=typeof t=="number"?t:Number(t);if(!Number.isFinite(e)||e<=0)return"0 B";const s=["B","KB","MB","GB","TB","PB"],n=Math.min(Math.floor(Math.log(e)/Math.log(1024)),s.length-1);return`${(e/1024**n).toFixed(n===0?0:1)} ${s[n]}`}function V1(t){const e=typeof t=="number"?t:Number(t);return Number.isFinite(e)?`${e.toFixed(1)}%`:"—"}const fp={hit:"bg-success",dynamic:"bg-notice",bypass:"bg-project-purple",miss:"bg-warning",expired:"bg-project-red",stale:"bg-project-amber",revalidated:"bg-chart-5",updating:"bg-subtle-foreground",none:"bg-muted-foreground"};function pp(t){return fp[t.toLowerCase()]??"bg-muted-foreground"}function xp(t){const e=Number(t);return e>=200&&e<300?"bg-success":e>=300&&e<400?"bg-notice":e>=400&&e<500?"bg-warning":e>=500?"bg-destructive":"bg-muted-foreground"}const hp={200:"200 OK",201:"201 Created",204:"204 No Content",206:"206 Partial Content",301:"301 Moved Permanently",302:"302 Found",304:"304 Not Modified",307:"307 Temporary Redirect",308:"308 Permanent Redirect",400:"400 Bad Request",401:"401 Unauthorized",403:"403 Forbidden",404:"404 Not Found",410:"410 Gone",429:"429 Too Many Requests",499:"499 Client Closed Request",500:"500 Internal Server Error",502:"502 Bad Gateway",503:"503 Service Unavailable",504:"504 Gateway Timeout"};function gp(t){return hp[t]??t}async function q1(t){const e=await fetch(t),s=await e.json().catch(()=>({}));if(!e.ok){const n=s&&typeof s=="object"&&"error"in s?String(s.error):`request failed (${e.status})`;throw new Error(n)}return s}const vp=(()=>{try{return new Intl.DisplayNames(void 0,{type:"region"})}catch{return null}})();function eo(t){if(!t)return"—";const e=t.toUpperCase();if(e.length!==2)return t;try{return vp?.of(e)??t}catch{return t}}const bp=[{key:"core",labelKey:"mainPanelTabs.analyticsTab.moduleCore",hintKey:"mainPanelTabs.analyticsTab.moduleCoreHint"},{key:"commerce",labelKey:"mainPanelTabs.analyticsTab.moduleCommerce",hintKey:"mainPanelTabs.analyticsTab.moduleCommerceHint"},{key:"vitals",labelKey:"mainPanelTabs.analyticsTab.moduleVitals",hintKey:"mainPanelTabs.analyticsTab.moduleVitalsHint"},{key:"errors",labelKey:"mainPanelTabs.analyticsTab.moduleErrors",hintKey:"mainPanelTabs.analyticsTab.moduleErrorsHint"},{key:"engagement",labelKey:"mainPanelTabs.analyticsTab.moduleEngagement",hintKey:"mainPanelTabs.analyticsTab.moduleEngagementHint"},{key:"heatmap",labelKey:"mainPanelTabs.analyticsTab.moduleHeatmap",hintKey:"mainPanelTabs.analyticsTab.moduleHeatmapHint"}],jp=["5m","15m","30m","1h","24h","7d","30d"];class K1 extends Error{constructor(e,s){super(e),this.status=s}status}function to(t){const e=t instanceof Error?t.message.toLowerCase():"";return e.includes("not_configured")||e.includes("not configured")}function br(t){return t instanceof Error?t.message:String(t)}async function ai(t){const e=await fetch(t),s=await e.json().catch(()=>({}));if(!e.ok){const n=s&&typeof s=="object"&&"error"in s?String(s.error):`request failed (${e.status})`;throw new K1(n,e.status)}return s}async function Ki(t,e,s){const n=await fetch(t,{method:e,headers:s!==void 0?{"Content-Type":"application/json"}:{},body:s!==void 0?JSON.stringify(s):void 0}),i=await n.json().catch(()=>({}));if(!n.ok){const r=i&&typeof i=="object"&&"error"in i?String(i.error):`request failed (${n.status})`;throw new K1(r,n.status)}return i}function B1(t){const e=O.c(12),{title:s,action:n,children:i}=t;let r;e[0]!==s?(r=l.jsx("h3",{className:"text-sm font-medium text-foreground",children:s}),e[0]=s,e[1]=r):r=e[1];let a;e[2]!==n?(a=n&&l.jsx("div",{className:"ml-auto",children:n}),e[2]=n,e[3]=a):a=e[3];let o;e[4]!==r||e[5]!==a?(o=l.jsxs("header",{className:"flex items-center gap-2 px-4 py-3 border-b border-border",children:[r,a]}),e[4]=r,e[5]=a,e[6]=o):o=e[6];let c;e[7]!==i?(c=l.jsx("div",{className:"p-4",children:i}),e[7]=i,e[8]=c):c=e[8];let d;return e[9]!==o||e[10]!==c?(d=l.jsxs("section",{className:"surface overflow-hidden",children:[o,c]}),e[9]=o,e[10]=c,e[11]=d):d=e[11],d}function yp(t){const e=O.c(53),{status:s}=t,n=ie(),i=s.config?.id??"",r=s.key??null,a=`<script async src="https://analytics.decocdn.com/_dq/a.js?k=${r??"YOUR_TOKEN"}"><\/script>`;let o;e[0]!==n?(o=n("mainPanelTabs.analyticsTab.installTitle"),e[0]=n,e[1]=o):o=e[1];let c;e[2]!==n?(c=n("mainPanelTabs.analyticsTab.installHow"),e[2]=n,e[3]=c):c=e[3];let d;e[4]!==c?(d=l.jsx("p",{className:"text-sm text-muted-foreground",children:c}),e[4]=c,e[5]=d):d=e[5];let m;e[6]!==n?(m=n("mainPanelTabs.analyticsTab.installHostTitle"),e[6]=n,e[7]=m):m=e[7];let u;e[8]!==m?(u=l.jsx("span",{className:"text-2xs font-medium text-muted-foreground",children:m}),e[8]=m,e[9]=u):u=e[9];let f;e[10]!==n?(f=n("mainPanelTabs.analyticsTab.installAuto"),e[10]=n,e[11]=f):f=e[11];let p;e[12]!==f?(p=l.jsx("p",{className:"text-xs text-muted-foreground",children:f}),e[12]=f,e[13]=p):p=e[13];let x;e[14]!==u||e[15]!==p?(x=l.jsxs("div",{className:"flex flex-col gap-1.5",children:[u,p]}),e[14]=u,e[15]=p,e[16]=x):x=e[16];let h;e[17]!==n?(h=n("mainPanelTabs.analyticsTab.installKeyTitle"),e[17]=n,e[18]=h):h=e[18];let g;e[19]!==h?(g=l.jsx("span",{className:"text-2xs font-medium text-muted-foreground",children:h}),e[19]=h,e[20]=g):g=e[20];let v;e[21]!==r?(v=r&&l.jsxs("div",{className:"flex items-center justify-between gap-3 rounded-lg border border-border bg-muted/30 px-3 py-1.5",children:[l.jsx("code",{className:"overflow-x-auto text-xs text-foreground",children:r}),l.jsx(ir,{text:r})]}),e[21]=r,e[22]=v):v=e[22];let b;e[23]!==a?(b=l.jsxs("div",{className:"flex items-start justify-between gap-3 rounded-lg border border-border bg-muted/30 px-3 py-2",children:[l.jsx("code",{className:"overflow-x-auto whitespace-pre-wrap break-all text-xs text-muted-foreground",children:a}),l.jsx(ir,{text:a})]}),e[23]=a,e[24]=b):b=e[24];let y;e[25]!==n||e[26]!==r?(y=!r&&l.jsx("span",{className:"text-xs text-muted-foreground",children:n("mainPanelTabs.analyticsTab.installTokenNote")}),e[25]=n,e[26]=r,e[27]=y):y=e[27];let j;e[28]!==g||e[29]!==v||e[30]!==b||e[31]!==y?(j=l.jsxs("div",{className:"flex flex-col gap-1.5",children:[g,v,b,y]}),e[28]=g,e[29]=v,e[30]=b,e[31]=y,e[32]=j):j=e[32];let N;e[33]!==n?(N=n("mainPanelTabs.analyticsTab.installTrackPrefix"),e[33]=n,e[34]=N):N=e[34];let w;e[35]===Symbol.for("react.memo_cache_sentinel")?(w=l.jsx("span",{className:"font-mono",children:"window.__dq"}),e[35]=w):w=e[35];let S;e[36]===Symbol.for("react.memo_cache_sentinel")?(S=l.jsx("span",{className:"font-mono",children:"pageview()"}),e[36]=S):S=e[36];let k;e[37]===Symbol.for("react.memo_cache_sentinel")?(k=l.jsx("span",{className:"font-mono",children:"track(name, props)"}),e[37]=k):k=e[37];let _;e[38]===Symbol.for("react.memo_cache_sentinel")?(_=l.jsx("span",{className:"font-mono",children:"purchase({…})"}),e[38]=_):_=e[38];let $;e[39]!==N?($=l.jsxs("p",{className:"text-xs text-muted-foreground",children:[N,w," —"," ",S,","," ",k,","," ",_,"."]}),e[39]=N,e[40]=$):$=e[40];let T;e[41]!==i||e[42]!==n?(T=i&&l.jsxs("p",{className:"text-xs text-muted-foreground",children:[n("mainPanelTabs.analyticsTab.installSiteId"),":"," ",l.jsx("span",{className:"font-mono text-foreground",children:i})]}),e[41]=i,e[42]=n,e[43]=T):T=e[43];let P;e[44]!==j||e[45]!==$||e[46]!==T||e[47]!==d||e[48]!==x?(P=l.jsxs("div",{className:"flex flex-col gap-4",children:[d,x,j,$,T]}),e[44]=j,e[45]=$,e[46]=T,e[47]=d,e[48]=x,e[49]=P):P=e[49];let I;return e[50]!==o||e[51]!==P?(I=l.jsx(B1,{title:o,children:P}),e[50]=o,e[51]=P,e[52]=I):I=e[52],I}function ir(t){const e=O.c(11),{text:s}=t,n=ie(),[i,r]=Z.useState(!1);let a;e[0]!==s?(a=()=>{navigator.clipboard?.writeText(s)?.then(()=>{r(!0),setTimeout(()=>r(!1),1500)},wp)},e[0]=s,e[1]=a):a=e[1];let o;e[2]!==i?(o=i?l.jsx(ti,{className:"size-4"}):l.jsx(d1,{className:"size-4"}),e[2]=i,e[3]=o):o=e[3];let c;e[4]!==i||e[5]!==n?(c=n(i?"mainPanelTabs.analyticsTab.copied":"mainPanelTabs.analyticsTab.copy"),e[4]=i,e[5]=n,e[6]=c):c=e[6];let d;return e[7]!==a||e[8]!==o||e[9]!==c?(d=l.jsxs(Se,{variant:"ghost",size:"sm",onClick:a,children:[o,c]}),e[7]=a,e[8]=o,e[9]=c,e[10]=d):d=e[10],d}function wp(){}function Np(t){const e=O.c(27),{result:s,onDismiss:n}=t,i=ie();let r;e[0]!==s.notes?(r=s.notes??[],e[0]=s.notes,e[1]=r):r=e[1];const a=r,o=!!s.key;if(!o&&!s.snippet&&a.length===0)return null;let c;e[2]!==o||e[3]!==i?(c=i(o?"mainPanelTabs.analyticsTab.tokenTitle":"mainPanelTabs.analyticsTab.registeredOk"),e[2]=o,e[3]=i,e[4]=c):c=e[4];let d;e[5]!==c?(d=l.jsx("h3",{className:"text-sm font-medium text-foreground",children:c}),e[5]=c,e[6]=d):d=e[6];let m;e[7]!==i?(m=i("mainPanelTabs.analyticsTab.dismiss"),e[7]=i,e[8]=m):m=e[8];let u;e[9]!==n||e[10]!==m?(u=l.jsx(Se,{variant:"ghost",size:"sm",onClick:n,children:m}),e[9]=n,e[10]=m,e[11]=u):u=e[11];let f;e[12]!==d||e[13]!==u?(f=l.jsxs("div",{className:"flex items-start justify-between gap-4",children:[d,u]}),e[12]=d,e[13]=u,e[14]=f):f=e[14];let p;e[15]!==o||e[16]!==i?(p=o&&l.jsx("p",{className:"text-xs text-muted-foreground",children:i("mainPanelTabs.analyticsTab.tokenOnce")}),e[15]=o,e[16]=i,e[17]=p):p=e[17];let x;e[18]!==s.snippet?(x=s.snippet&&l.jsxs("div",{className:"flex items-start justify-between gap-3 rounded-lg border border-border bg-muted/30 px-3 py-2",children:[l.jsx("code",{className:"overflow-x-auto whitespace-pre-wrap break-all text-xs text-muted-foreground",children:s.snippet}),l.jsx(ir,{text:s.snippet})]}),e[18]=s.snippet,e[19]=x):x=e[19];let h;e[20]!==a?(h=a.length>0&&l.jsx("ul",{className:"flex flex-col gap-1.5",children:a.map(kp)}),e[20]=a,e[21]=h):h=e[21];let g;return e[22]!==f||e[23]!==p||e[24]!==x||e[25]!==h?(g=l.jsxs("section",{className:"flex flex-col gap-3 rounded-xl border border-primary/30 bg-primary/5 p-4",children:[f,p,x,h]}),e[22]=f,e[23]=p,e[24]=x,e[25]=h,e[26]=g):g=e[26],g}function kp(t,e){return l.jsx("li",{className:"rounded-md border border-warning/30 bg-warning/5 px-3 py-2 text-xs text-warning",children:t},e)}function Sp(t){const e=O.c(108),{base:s,orgSlug:n,site:i,config:r,open:a,onOpenChange:o}=t,c=ie(),d=fs();let m;e[0]!==r.modules?(m=r.modules??["core"],e[0]=r.modules,e[1]=m):m=e[1];let u;e[2]!==m?(u=new Set(m),e[2]=m,e[3]=u):u=e[3];const[f,p]=Z.useState(u);let x;e[4]!==r.sampling?(x=Math.round((r.sampling??1)*100),e[4]=r.sampling,e[5]=x):x=e[5];const[h,g]=Z.useState(String(x)),[v,b]=Z.useState(typeof r.quota=="number"&&r.quota>0?String(r.quota):"");let y;e[6]!==s?(y=ve=>Ki(`${s}/analytics/config`,"PUT",ve),e[6]=s,e[7]=y):y=e[7];let j;e[8]!==o||e[9]!==n||e[10]!==d||e[11]!==i||e[12]!==c?(j=()=>{d.invalidateQueries({queryKey:Qe.analyticsStatus(n,i)}),rt.success(c("mainPanelTabs.analyticsTab.toastCollectionUpdated")),o(!1)},e[8]=o,e[9]=n,e[10]=d,e[11]=i,e[12]=c,e[13]=j):j=e[13];let N;e[14]!==y||e[15]!==j?(N={mutationFn:y,onSuccess:j,onError:_p},e[14]=y,e[15]=j,e[16]=N):N=e[16];const w=Et(N);let S;e[17]===Symbol.for("react.memo_cache_sentinel")?(S=ve=>{ve!=="core"&&p(be=>{const we=new Set(be);return we.has(ve)?we.delete(ve):we.add(ve),we})},e[17]=S):S=e[17];const k=S;let _;e[18]!==v?(_=v.trim()===""?null:Number(v),e[18]=v,e[19]=_):_=e[19];const $=_,T=$!==null&&(!Number.isInteger($)||$<1)?"Quota must be a positive whole number of events.":null;let P;e[20]!==r.quota||e[21]!==v?(P=v.trim()===""&&typeof r.quota=="number"&&r.quota>0,e[20]=r.quota,e[21]=v,e[22]=P):P=e[22];const I=P;let C;e[23]!==T||e[24]!==$||e[25]!==h||e[26]!==w||e[27]!==f?(C=()=>{if(T)return;const ve=Number(h),be=Number.isFinite(ve)&&ve>0?Math.min(ve,100)/100:1;w.mutate({modules:[...f],sampling:be,...$!==null?{quota:$}:{}})},e[23]=T,e[24]=$,e[25]=h,e[26]=w,e[27]=f,e[28]=C):C=e[28];const M=C;let A;e[29]!==c?(A=c("mainPanelTabs.analyticsTab.editTitle"),e[29]=c,e[30]=A):A=e[30];let F;e[31]!==A?(F=l.jsx(_n,{children:l.jsx($n,{children:A})}),e[31]=A,e[32]=F):F=e[32];let E;e[33]!==c?(E=c("mainPanelTabs.analyticsTab.editModules"),e[33]=c,e[34]=E):E=e[34];let z;e[35]!==E?(z=l.jsx(Ns,{children:E}),e[35]=E,e[36]=z):z=e[36];let R;e[37]!==f||e[38]!==c?(R=bp.map(ve=>{const be=ve.key==="core",we=be||f.has(ve.key);return l.jsxs("label",{className:"flex cursor-pointer items-center gap-2.5 rounded-lg border border-border px-3 py-2 hover:border-border/70",children:[l.jsx(h1,{checked:we,disabled:be,onCheckedChange:()=>k(ve.key)}),l.jsx("span",{className:"text-sm text-foreground",children:c(ve.labelKey)})]},ve.key)}),e[37]=f,e[38]=c,e[39]=R):R=e[39];let V;e[40]!==R?(V=l.jsx("div",{className:"grid grid-cols-1 gap-2",children:R}),e[40]=R,e[41]=V):V=e[41];let K;e[42]!==z||e[43]!==V?(K=l.jsxs("div",{className:"flex flex-col gap-2",children:[z,V]}),e[42]=z,e[43]=V,e[44]=K):K=e[44];let U;e[45]!==c?(U=c("mainPanelTabs.analyticsTab.editSampling"),e[45]=c,e[46]=U):U=e[46];let q;e[47]!==U?(q=l.jsx(Ns,{htmlFor:"analytics-sampling",children:U}),e[47]=U,e[48]=q):q=e[48];let L;e[49]===Symbol.for("react.memo_cache_sentinel")?(L=ve=>g(ve.target.value),e[49]=L):L=e[49];let B;e[50]!==h?(B=l.jsx(ds,{id:"analytics-sampling",type:"number",min:1,max:100,value:h,onChange:L,className:"font-mono text-xs"}),e[50]=h,e[51]=B):B=e[51];let Y;e[52]!==c?(Y=c("mainPanelTabs.analyticsTab.editSamplingHint"),e[52]=c,e[53]=Y):Y=e[53];let J;e[54]!==Y?(J=l.jsx("span",{className:"text-xs text-muted-foreground",children:Y}),e[54]=Y,e[55]=J):J=e[55];let X;e[56]!==q||e[57]!==B||e[58]!==J?(X=l.jsxs("div",{className:"flex flex-col gap-1.5",children:[q,B,J]}),e[56]=q,e[57]=B,e[58]=J,e[59]=X):X=e[59];let ee;e[60]!==c?(ee=c("mainPanelTabs.analyticsTab.monthlyQuota"),e[60]=c,e[61]=ee):ee=e[61];let te;e[62]!==ee?(te=l.jsx(Ns,{htmlFor:"analytics-quota",children:ee}),e[62]=ee,e[63]=te):te=e[63];let D;e[64]!==c?(D=c("mainPanelTabs.analyticsTab.uncapped"),e[64]=c,e[65]=D):D=e[65];let W;e[66]===Symbol.for("react.memo_cache_sentinel")?(W=ve=>b(ve.target.value),e[66]=W):W=e[66];const G=T!=null;let Q;e[67]!==v||e[68]!==D||e[69]!==G?(Q=l.jsx(ds,{id:"analytics-quota",type:"number",min:1,value:v,placeholder:D,onChange:W,"aria-invalid":G,className:"font-mono text-xs"}),e[67]=v,e[68]=D,e[69]=G,e[70]=Q):Q=e[70];let re;e[71]!==I||e[72]!==T?(re=T?l.jsx("span",{className:"text-xs text-destructive",children:T}):I?l.jsx("span",{className:"text-xs text-warning",children:"Leaving this blank keeps the current cap — clearing a quota isn't a patch. Unregister + re-register to make it uncapped."}):l.jsx("span",{className:"text-xs text-muted-foreground",children:"Accepted events per calendar month. Once the reconciler flags the site as over, the collector drops further events. Blank = uncapped."}),e[71]=I,e[72]=T,e[73]=re):re=e[73];let ce;e[74]!==te||e[75]!==Q||e[76]!==re?(ce=l.jsxs("div",{className:"flex flex-col gap-1.5",children:[te,Q,re]}),e[74]=te,e[75]=Q,e[76]=re,e[77]=ce):ce=e[77];let ae;e[78]!==K||e[79]!==X||e[80]!==ce?(ae=l.jsxs("div",{className:"flex flex-col gap-4",children:[K,X,ce]}),e[78]=K,e[79]=X,e[80]=ce,e[81]=ae):ae=e[81];let fe;e[82]!==o?(fe=()=>o(!1),e[82]=o,e[83]=fe):fe=e[83];const de=w.isPending;let se;e[84]!==c?(se=c("mainPanelTabs.analyticsTab.cancel"),e[84]=c,e[85]=se):se=e[85];let H;e[86]!==w.isPending||e[87]!==fe||e[88]!==se?(H=l.jsx(Se,{variant:"outline",type:"button",onClick:fe,disabled:de,children:se}),e[86]=w.isPending,e[87]=fe,e[88]=se,e[89]=H):H=e[89];const oe=w.isPending||T!=null;let he;e[90]!==w.isPending||e[91]!==c?(he=w.isPending?c("mainPanelTabs.analyticsTab.saving"):c("mainPanelTabs.analyticsTab.save"),e[90]=w.isPending,e[91]=c,e[92]=he):he=e[92];let le;e[93]!==M||e[94]!==oe||e[95]!==he?(le=l.jsx(Se,{type:"button",onClick:M,disabled:oe,children:he}),e[93]=M,e[94]=oe,e[95]=he,e[96]=le):le=e[96];let ne;e[97]!==H||e[98]!==le?(ne=l.jsxs(Aa,{children:[H,le]}),e[97]=H,e[98]=le,e[99]=ne):ne=e[99];let me;e[100]!==F||e[101]!==ae||e[102]!==ne?(me=l.jsxs(Tn,{className:"sm:max-w-md",children:[F,ae,ne]}),e[100]=F,e[101]=ae,e[102]=ne,e[103]=me):me=e[103];let ge;return e[104]!==o||e[105]!==a||e[106]!==me?(ge=l.jsx(Pn,{open:a,onOpenChange:o,children:me}),e[104]=o,e[105]=a,e[106]=me,e[107]=ge):ge=e[107],ge}function _p(t){return rt.error(br(t))}function $p(t){const e=O.c(151),{base:s,orgSlug:n,site:i,status:r}=t,a=ie(),o=fs(),c=r.config??{},d=c.enabled!==!1,[m,u]=Z.useState(!1),[f,p]=Z.useState(!1),[x,h]=Z.useState(null),g=(c.domains?.length??0)>0;let v;e[0]!==n||e[1]!==o||e[2]!==i?(v=()=>o.invalidateQueries({queryKey:Qe.analyticsStatus(n,i)}),e[0]=n,e[1]=o,e[2]=i,e[3]=v):v=e[3];const b=v;let y;e[4]!==s?(y=()=>Ki(`${s}/analytics/rotate-key`,"POST"),e[4]=s,e[5]=y):y=e[5];let j;e[6]!==b||e[7]!==a?(j=Je=>{b(),h(Je),rt.success(a("mainPanelTabs.analyticsTab.toastTokenRotated"))},e[6]=b,e[7]=a,e[8]=j):j=e[8];let N;e[9]!==y||e[10]!==j?(N={mutationFn:y,onSuccess:j,onError:Ep},e[9]=y,e[10]=j,e[11]=N):N=e[11];const w=Et(N);let S;e[12]!==s?(S=Je=>Ki(`${s}/analytics/disable`,"PUT",{enabled:Je}),e[12]=s,e[13]=S):S=e[13];let k;e[14]!==b||e[15]!==a?(k=()=>{b(),rt.success(a("mainPanelTabs.analyticsTab.toastCollectionUpdated"))},e[14]=b,e[15]=a,e[16]=k):k=e[16];let _;e[17]!==S||e[18]!==k?(_={mutationFn:S,onSuccess:k,onError:Cp},e[17]=S,e[18]=k,e[19]=_):_=e[19];const $=Et(_);let T;e[20]!==s?(T=()=>Ki(`${s}/analytics`,"DELETE"),e[20]=s,e[21]=T):T=e[21];let P;e[22]!==b||e[23]!==p||e[24]!==a?(P=()=>{b(),rt.success(a("mainPanelTabs.analyticsTab.toastUnregistered")),p(!1)},e[22]=b,e[23]=p,e[24]=a,e[25]=P):P=e[25];let I;e[26]!==T||e[27]!==P?(I={mutationFn:T,onSuccess:P,onError:Pp},e[26]=T,e[27]=P,e[28]=I):I=e[28];const C=Et(I),M=c.modules??["core"],A="flex flex-col gap-6";let F;e[29]!==x?(F=x&&l.jsx(Np,{result:x,onDismiss:()=>h(null)}),e[29]=x,e[30]=F):F=e[30];const E=B1;let z;e[31]!==a?(z=a("mainPanelTabs.analyticsTab.collection"),e[31]=a,e[32]=z):z=e[32];const R=d?"outline":"default";let V;e[33]!==d||e[34]!==$?(V=()=>$.mutate(!d),e[33]=d,e[34]=$,e[35]=V):V=e[35];let K;e[36]===Symbol.for("react.memo_cache_sentinel")?(K=l.jsx(Hm,{className:"size-4"}),e[36]=K):K=e[36];let U;e[37]!==d||e[38]!==a?(U=a(d?"mainPanelTabs.analyticsTab.pause":"mainPanelTabs.analyticsTab.resume"),e[37]=d,e[38]=a,e[39]=U):U=e[39];let q;e[40]!==R||e[41]!==V||e[42]!==U||e[43]!==$.isPending?(q=l.jsxs(Se,{size:"sm",variant:R,disabled:$.isPending,onClick:V,children:[K,U]}),e[40]=R,e[41]=V,e[42]=U,e[43]=$.isPending,e[44]=q):q=e[44];let L;e[45]!==u?(L=()=>u(!0),e[45]=u,e[46]=L):L=e[46];let B;e[47]===Symbol.for("react.memo_cache_sentinel")?(B=l.jsx(xr,{className:"size-4"}),e[47]=B):B=e[47];let Y;e[48]!==a?(Y=a("mainPanelTabs.analyticsTab.edit"),e[48]=a,e[49]=Y):Y=e[49];let J;e[50]!==L||e[51]!==Y?(J=l.jsxs(Se,{size:"sm",variant:"ghost",onClick:L,children:[B,Y]}),e[50]=L,e[51]=Y,e[52]=J):J=e[52];let X;e[53]!==g||e[54]!==w?(X=g&&l.jsxs(Se,{size:"sm",variant:"ghost",disabled:w.isPending,onClick:()=>w.mutate(),children:[l.jsx(d1,{className:"size-4"}),w.isPending?"Rotating…":"Rotate token"]}),e[53]=g,e[54]=w,e[55]=X):X=e[55];let ee;e[56]!==a?(ee=a("mainPanelTabs.analyticsTab.unregister"),e[56]=a,e[57]=ee):ee=e[57];let te;e[58]!==p?(te=()=>p(!0),e[58]=p,e[59]=te):te=e[59];let D;e[60]===Symbol.for("react.memo_cache_sentinel")?(D=l.jsx(qa,{className:"size-4"}),e[60]=D):D=e[60];let W;e[61]!==ee||e[62]!==te?(W=l.jsx(Se,{size:"icon-sm",variant:"ghost-destructive","aria-label":ee,onClick:te,children:D}),e[61]=ee,e[62]=te,e[63]=W):W=e[63];let G;e[64]!==q||e[65]!==J||e[66]!==X||e[67]!==W?(G=l.jsxs("div",{className:"flex items-center gap-1.5",children:[q,J,X,W]}),e[64]=q,e[65]=J,e[66]=X,e[67]=W,e[68]=G):G=e[68];const Q="flex flex-col gap-3",re="flex flex-wrap items-center gap-2",ce=d?"success":"outline";let ae;e[69]!==d||e[70]!==a?(ae=a(d?"mainPanelTabs.analyticsTab.active":"mainPanelTabs.analyticsTab.paused"),e[69]=d,e[70]=a,e[71]=ae):ae=e[71];let fe;e[72]!==ce||e[73]!==ae?(fe=l.jsx(Ye,{variant:ce,children:ae}),e[72]=ce,e[73]=ae,e[74]=fe):fe=e[74];const de=r.host??"—";let se;e[75]!==a||e[76]!==de?(se=a("mainPanelTabs.analyticsTab.collectingUnder",{host:de}),e[75]=a,e[76]=de,e[77]=se):se=e[77];let H;e[78]!==se?(H=l.jsx("span",{className:"text-sm text-muted-foreground",children:se}),e[78]=se,e[79]=H):H=e[79];const oe=c.id&&l.jsx("span",{className:"font-mono text-xs text-muted-foreground/80",children:a("mainPanelTabs.analyticsTab.idLabel",{id:c.id})});let he;e[80]!==fe||e[81]!==H||e[82]!==oe?(he=l.jsxs("div",{className:re,children:[fe,H,oe]}),e[80]=fe,e[81]=H,e[82]=oe,e[83]=he):he=e[83];let le;e[84]!==M?(le=M.map(Tp),e[84]=M,e[85]=le):le=e[85];let ne;e[86]!==c.sampling||e[87]!==a?(ne=typeof c.sampling=="number"&&c.sampling<1&&l.jsx(Ye,{variant:"outline",children:a("mainPanelTabs.analyticsTab.sampling",{percent:String(Math.round(c.sampling*100))})}),e[86]=c.sampling,e[87]=a,e[88]=ne):ne=e[88];let me;e[89]!==le||e[90]!==ne?(me=l.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[le,ne]}),e[89]=le,e[90]=ne,e[91]=me):me=e[91];let ge;e[92]!==he||e[93]!==me?(ge=l.jsxs("div",{className:Q,children:[he,me]}),e[92]=he,e[93]=me,e[94]=ge):ge=e[94];let ve;e[95]!==E||e[96]!==z||e[97]!==G||e[98]!==ge?(ve=l.jsx(E,{title:z,action:G,children:ge}),e[95]=E,e[96]=z,e[97]=G,e[98]=ge,e[99]=ve):ve=e[99];let be;e[100]!==r?(be=l.jsx(yp,{status:r}),e[100]=r,e[101]=be):be=e[101];let we;e[102]!==s||e[103]!==c||e[104]!==m||e[105]!==n||e[106]!==u||e[107]!==i?(we=m&&l.jsx(Sp,{base:s,orgSlug:n,site:i,config:c,open:!0,onOpenChange:u}),e[102]=s,e[103]=c,e[104]=m,e[105]=n,e[106]=u,e[107]=i,e[108]=we):we=e[108];let $e;e[109]!==a?($e=a("mainPanelTabs.analyticsTab.unregisterTitle"),e[109]=a,e[110]=$e):$e=e[110];let je;e[111]!==$e?(je=l.jsx($a,{children:$e}),e[111]=$e,e[112]=je):je=e[112];let xe;e[113]!==i||e[114]!==a?(xe=a("mainPanelTabs.analyticsTab.unregisterDescription",{site:i}),e[113]=i,e[114]=a,e[115]=xe):xe=e[115];let ke;e[116]!==xe?(ke=l.jsx(Ta,{children:xe}),e[116]=xe,e[117]=ke):ke=e[117];let _e;e[118]!==je||e[119]!==ke?(_e=l.jsxs(Pa,{children:[je,ke]}),e[118]=je,e[119]=ke,e[120]=_e):_e=e[120];const Ae=C.isPending;let Pe;e[121]!==a?(Pe=a("mainPanelTabs.analyticsTab.cancel"),e[121]=a,e[122]=Pe):Pe=e[122];let Be;e[123]!==C.isPending||e[124]!==Pe?(Be=l.jsx(Ca,{disabled:Ae,children:Pe}),e[123]=C.isPending,e[124]=Pe,e[125]=Be):Be=e[125];let Xe;e[126]!==C?(Xe=Je=>{Je.preventDefault(),C.mutate()},e[126]=C,e[127]=Xe):Xe=e[127];let st;e[128]!==C.isPending||e[129]!==a?(st=C.isPending?a("mainPanelTabs.analyticsTab.unregistering"):a("mainPanelTabs.analyticsTab.unregister"),e[128]=C.isPending,e[129]=a,e[130]=st):st=e[130];let Ze;e[131]!==C.isPending||e[132]!==Xe||e[133]!==st?(Ze=l.jsx(_a,{variant:"destructive",onClick:Xe,disabled:C.isPending,children:st}),e[131]=C.isPending,e[132]=Xe,e[133]=st,e[134]=Ze):Ze=e[134];let lt;e[135]!==Be||e[136]!==Ze?(lt=l.jsxs(Ea,{children:[Be,Ze]}),e[135]=Be,e[136]=Ze,e[137]=lt):lt=e[137];let Ie;e[138]!==_e||e[139]!==lt?(Ie=l.jsxs(Ma,{children:[_e,lt]}),e[138]=_e,e[139]=lt,e[140]=Ie):Ie=e[140];let Oe;e[141]!==f||e[142]!==p||e[143]!==Ie?(Oe=l.jsx(Ia,{open:f,onOpenChange:p,children:Ie}),e[141]=f,e[142]=p,e[143]=Ie,e[144]=Oe):Oe=e[144];let Ue;return e[145]!==F||e[146]!==ve||e[147]!==be||e[148]!==we||e[149]!==Oe?(Ue=l.jsxs("div",{className:A,children:[F,ve,be,we,Oe]}),e[145]=F,e[146]=ve,e[147]=be,e[148]=we,e[149]=Oe,e[150]=Ue):Ue=e[150],Ue}function Tp(t){return l.jsx(Ye,{variant:"secondary",children:t},t)}function Pp(t){return rt.error(br(t))}function Cp(t){return rt.error(br(t))}function Ep(t){return rt.error(br(t))}function Mp(){const t=O.c(36),e=ie(),s=Ip;let n;t[0]===Symbol.for("react.memo_cache_sentinel")?(n=l.jsx(La,{className:"size-4 text-muted-foreground transition-transform group-open:rotate-90"}),t[0]=n):n=t[0];let i;t[1]!==e?(i=e("mainPanelTabs.analyticsTab.eventsHelp.title"),t[1]=e,t[2]=i):i=t[2];let r;t[3]!==i?(r=l.jsxs("summary",{className:"flex cursor-pointer list-none items-center gap-2 px-4 py-3 text-sm font-medium text-foreground hover:bg-accent",children:[n,i]}),t[3]=i,t[4]=r):r=t[4];let a;t[5]!==e?(a=e("mainPanelTabs.analyticsTab.eventsHelp.intro"),t[5]=e,t[6]=a):a=t[6];let o;t[7]===Symbol.for("react.memo_cache_sentinel")?(o=s("window.__dq"),t[7]=o):o=t[7];let c;t[8]!==a?(c=l.jsxs("p",{children:[a," ",o,":"]}),t[8]=a,t[9]=c):c=t[9];let d;t[10]===Symbol.for("react.memo_cache_sentinel")?(d=l.jsx("dt",{className:"font-mono text-xs text-foreground",children:"pageview()"}),t[10]=d):d=t[10];let m;t[11]!==e?(m=e("mainPanelTabs.analyticsTab.eventsHelp.pageview"),t[11]=e,t[12]=m):m=t[12];let u;t[13]!==m?(u=l.jsxs("div",{className:"flex flex-col gap-0.5",children:[d,l.jsx("dd",{className:"text-xs",children:m})]}),t[13]=m,t[14]=u):u=t[14];let f;t[15]===Symbol.for("react.memo_cache_sentinel")?(f=l.jsx("dt",{className:"font-mono text-xs text-foreground",children:"track(name, props?)"}),t[15]=f):f=t[15];let p;t[16]!==e?(p=e("mainPanelTabs.analyticsTab.eventsHelp.track"),t[16]=e,t[17]=p):p=t[17];let x;t[18]!==p?(x=l.jsxs("div",{className:"flex flex-col gap-0.5",children:[f,l.jsx("dd",{className:"text-xs",children:p})]}),t[18]=p,t[19]=x):x=t[19];let h;t[20]===Symbol.for("react.memo_cache_sentinel")?(h=l.jsx("dt",{className:"font-mono text-xs text-foreground",children:"purchase({ transactionId, value, currency, items, itemIds })"}),t[20]=h):h=t[20];let g;t[21]!==e?(g=e("mainPanelTabs.analyticsTab.eventsHelp.purchase"),t[21]=e,t[22]=g):g=t[22];let v;t[23]!==g?(v=l.jsxs("div",{className:"flex flex-col gap-0.5",children:[h,l.jsx("dd",{className:"text-xs",children:g})]}),t[23]=g,t[24]=v):v=t[24];let b;t[25]!==x||t[26]!==v||t[27]!==u?(b=l.jsxs("dl",{className:"flex flex-col gap-2",children:[u,x,v]}),t[25]=x,t[26]=v,t[27]=u,t[28]=b):b=t[28];let y;t[29]===Symbol.for("react.memo_cache_sentinel")?(y=l.jsx("div",{className:"rounded-lg border border-border bg-muted/30 px-3 py-2",children:l.jsx("code",{className:"whitespace-pre-wrap break-all text-xs text-muted-foreground",children:`window.__dq.track("newsletter_signup", { plan: "pro" })
window.__dq.purchase({ transactionId: "A123", value: 99.9, currency: "BRL" })`})}),t[29]=y):y=t[29];let j;t[30]!==b||t[31]!==c?(j=l.jsxs("div",{className:"flex flex-col gap-3 border-t border-border px-4 py-4 text-sm text-muted-foreground",children:[c,b,y]}),t[30]=b,t[31]=c,t[32]=j):j=t[32];let N;return t[33]!==j||t[34]!==r?(N=l.jsxs("details",{className:"group surface",children:[r,j]}),t[33]=j,t[34]=r,t[35]=N):N=t[35],N}function Ip(t){return l.jsx("span",{className:"font-mono text-foreground",children:t})}const Uo=["1h","24h","7d"];function ot(t,e){return t===null||e===null||e===0?null:(t-e)/e}function oi(t,e){return t===null||e==="none"||Math.abs(t)<.01?"neutral":t>0==(e==="up")?"good":"bad"}function Xs(t){return t===null||!Number.isFinite(t)?"—":t>=1e4?`${(t/1e3).toFixed(0)} s`:t>=1e3?`${(t/1e3).toFixed(1)} s`:`${Math.round(t)} ms`}function Xn(t){if(t===null||!Number.isFinite(t))return"—";const e=t*100;return e===0?"0%":e<.1?"<0.1%":e<10?`${e.toFixed(1)}%`:`${Math.round(e)}%`}function Rt(t){return new Intl.NumberFormat(void 0,{notation:t>=1e4?"compact":"standard",maximumFractionDigits:1}).format(t)}function Ap(t){if(t>=1)return{value:Rt(Math.round(t)),unit:"s"};const e=t*60;return{value:e>=10||e===0?Rt(Math.round(e)):e.toFixed(1),unit:"min"}}function Fr(t,e,s){return new Intl.DateTimeFormat(s,e==="7d"?{weekday:"short",hour:"2-digit",minute:"2-digit"}:{hour:"2-digit",minute:"2-digit"}).format(new Date(t))}function H1(t,e){if(t<e.startMs||t>=e.endMs)return null;const s=e.stepS*1e3;return e.startMs+Math.floor((t-e.startMs)/s)*s}function Lp(t){return t.slice(0,7)}function Dp(t,e){const s=Math.floor((e-t)/6e4);if(s<1)return{count:0,unit:"now"};if(s<60)return{count:s,unit:"min"};const n=Math.floor(s/60);return n<24?{count:n,unit:"h"}:{count:Math.floor(n/24),unit:"d"}}function ns(t){const e=O.c(41),{label:s,value:n,options:i,onChange:r,period:a}=t,o=a===void 0?!1:a,c=ie();let d,m,u,f,p,x,h,g;if(e[0]!==s||e[1]!==i||e[2]!==c||e[3]!==n){let $;e[12]!==n?($=T=>T.value===n,e[12]=n,e[13]=$):$=e[13],f=i.find($),u=hn,m=gn,g=!0,d=Se,p="outline",x="sm",h=c("monitor.select.current",{label:s,value:f?.label??n}),e[0]=s,e[1]=i,e[2]=c,e[3]=n,e[4]=d,e[5]=m,e[6]=u,e[7]=f,e[8]=p,e[9]=x,e[10]=h,e[11]=g}else d=e[4],m=e[5],u=e[6],f=e[7],p=e[8],x=e[9],h=e[10],g=e[11];let v;e[14]!==o?(v=o&&l.jsx($u,{size:14}),e[14]=o,e[15]=v):v=e[15];const b=f?.label??n;let y;e[16]===Symbol.for("react.memo_cache_sentinel")?(y=l.jsx(Ka,{size:14,className:"text-muted-foreground"}),e[16]=y):y=e[16];let j;e[17]!==d||e[18]!==p||e[19]!==x||e[20]!==h||e[21]!==v||e[22]!==b?(j=l.jsxs(d,{variant:p,size:x,"aria-label":h,className:"gap-1 font-normal",children:[v,b,y]}),e[17]=d,e[18]=p,e[19]=x,e[20]=h,e[21]=v,e[22]=b,e[23]=j):j=e[23];let N;e[24]!==m||e[25]!==g||e[26]!==j?(N=l.jsx(m,{asChild:g,children:j}),e[24]=m,e[25]=g,e[26]=j,e[27]=N):N=e[27];let w;e[28]!==r||e[29]!==i?(w=$=>{const T=i.find(P=>P.value===$);T&&r(T.value)},e[28]=r,e[29]=i,e[30]=w):w=e[30];let S;e[31]!==i?(S=i.map(Op),e[31]=i,e[32]=S):S=e[32];let k;e[33]!==w||e[34]!==S||e[35]!==n?(k=l.jsx(vn,{align:"end",children:l.jsx(Pm,{value:n,onValueChange:w,children:S})}),e[33]=w,e[34]=S,e[35]=n,e[36]=k):k=e[36];let _;return e[37]!==u||e[38]!==N||e[39]!==k?(_=l.jsxs(u,{children:[N,k]}),e[37]=u,e[38]=N,e[39]=k,e[40]=_):_=e[40],_}function Op(t){return l.jsx(Tm,{value:t.value,children:t.label},t.value)}function rr(t){const e=t.reduce((s,n)=>s+n.weight,0);return e<=0?null:t.reduce((s,n)=>s+n.value*n.weight,0)/e}function Rp(t,e,s){const n=t.filter(o=>o.weight>0);if(n.length<2)return null;if(n.length<=3)return{kind:"all",items:n.map(o=>`${o.title} ${e(o.value)}`)};const i=[...n].sort((o,c)=>s?o.value-c.value:c.value-o.value),r=i[0],a=i.at(-1);return!r||!a?null:{kind:"range",best:`${r.title} ${e(r.value)}`,worst:`${a.title} ${e(a.value)}`}}const Fp=e1("flex w-full min-w-0 items-center gap-3",{variants:{variant:{default:"py-2",divided:"border-b py-2.5 last:border-b-0"},interactive:{true:"hover:bg-accent aria-[current=true]:bg-accent aria-[current=page]:bg-accent focus-ring cursor-pointer px-2 text-left transition-colors",false:""}},compoundVariants:[{variant:"default",interactive:!0,class:"rounded-[0.625rem]"}],defaultVariants:{variant:"default",interactive:!1}}),zp=e1("bg-muted flex shrink-0 items-center justify-center overflow-hidden [&_svg]:shrink-0",{variants:{variant:{default:"size-8 rounded-[0.625rem] [&_svg]:size-4",divided:"size-7 rounded-full [&_svg]:size-3.5"}},defaultVariants:{variant:"default"}});function Mn(t){const e=O.c(43);let s,n,i,r,a,o,c,d,m,u,f;e[0]!==t?({lead:r,title:m,meta:a,trailing:u,variant:f,interactive:i,selected:c,asChild:d,className:n,children:s,...o}=t,e[0]=t,e[1]=s,e[2]=n,e[3]=i,e[4]=r,e[5]=a,e[6]=o,e[7]=c,e[8]=d,e[9]=m,e[10]=u,e[11]=f):(s=e[1],n=e[2],i=e[3],r=e[4],a=e[5],o=e[6],c=e[7],d=e[8],m=e[9],u=e[10],f=e[11]);const p=d===void 0?!1:d,x=p?Cm:"div",h=c||void 0;let g;e[12]!==p||e[13]!==n||e[14]!==i||e[15]!==f?(g=ye(Fp({variant:f,interactive:i??p}),n),e[12]=p,e[13]=n,e[14]=i,e[15]=f,e[16]=g):g=e[16];let v;e[17]!==r||e[18]!==f?(v=r&&l.jsx("span",{className:zp({variant:f}),children:r}),e[17]=r,e[18]=f,e[19]=v):v=e[19];const b=f==="divided"&&"font-medium";let y;e[20]!==b?(y=ye("truncate text-sm",b),e[20]=b,e[21]=y):y=e[21];let j;e[22]!==y||e[23]!==m?(j=l.jsx("span",{className:y,children:m}),e[22]=y,e[23]=m,e[24]=j):j=e[24];let N;e[25]!==a||e[26]!==f?(N=a&&l.jsx("span",{className:ye("truncate text-xs",f==="divided"?"text-muted-foreground":"text-subtle-foreground"),children:a}),e[25]=a,e[26]=f,e[27]=N):N=e[27];let w;e[28]!==j||e[29]!==N?(w=l.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-0.5",children:[j,N]}),e[28]=j,e[29]=N,e[30]=w):w=e[30];let S;e[31]!==p||e[32]!==s?(S=p&&l.jsx(Em,{children:s}),e[31]=p,e[32]=s,e[33]=S):S=e[33];let k;return e[34]!==x||e[35]!==o||e[36]!==S||e[37]!==h||e[38]!==g||e[39]!==v||e[40]!==w||e[41]!==u?(k=l.jsxs(x,{"data-slot":"list-row","aria-current":h,className:g,...o,children:[v,w,u,S]}),e[34]=x,e[35]=o,e[36]=S,e[37]=h,e[38]=g,e[39]=v,e[40]=w,e[41]=u,e[42]=k):k=e[42],k}function Vp(){const t=O.c(11),e=ie(),s=Yt(),n=Cn(),i=fs(),{org:r,locator:a}=He();let o;t[0]!==s?(o=m=>s.call("ANALYTICS_INSTALL",m),t[0]=s,t[1]=o):o=t[1];let c;t[2]!==a||t[3]!==n||t[4]!==r||t[5]!==i||t[6]!==e?(c=m=>{if(m.status!=="needs_domain"){if(i.invalidateQueries({queryKey:Qe.taskBoardItems(a)}),!m.taskKey){rt.success(e("monitor.analyticsGuide.installSent"));return}n({to:"/$org/tasks/{-$taskKey}",params:{org:r.slug,taskKey:m.taskKey}})}},t[2]=a,t[3]=n,t[4]=r,t[5]=i,t[6]=e,t[7]=c):c=t[7];let d;return t[8]!==o||t[9]!==c?(d={mutationFn:o,onSuccess:c,onError:qp},t[8]=o,t[9]=c,t[10]=d):d=t[10],Et(d)}function qp(t){return rt.error(t.message)}function Kp(t){try{const e=new URL(t.url);if(e.protocol!=="https:"&&e.protocol!=="http:")return null;const s=e.pathname.replace(/\/+$/,"").replace(/\.git$/i,"");return s?{host:e.host.toLowerCase(),path:s.slice(1)}:null}catch{return null}}function Go(t){const e=Kp(t);return e?`${e.host}/${e.path}`.toLowerCase():null}function W1(t,e){if(t.repositoryId&&e.repositoryId)return t.repositoryId===e.repositoryId;const s=Go(t);return s!==null&&s===Go(e)}const U1="deco/vtex",Bp="VTEX::credential:configuration:read",Hp=t=>t.app_name==="vtex"||t.app_id===U1,G1=t=>!!t?.configuration_state?.accountName&&!!t.configuration_state.appKey&&!!t.configuration_state.appToken,Y1=t=>{const e=t.configuration_state?.VTEX;return e&&typeof e=="object"&&"value"in e?e.value:void 0},Wp=t=>(t instanceof Error?t.message:String(t)).replace(/^Streamable HTTP error: Error POSTing to endpoint: /,"");class Q1 extends Error{}function X1(){const t=O.c(17),e=ie(),{org:s}=He(),{data:n}=Mm.useSession(),i=v1();let r;t[0]!==s.id||t[1]!==s.slug?(r={connectionId:Im,orgId:s.id,orgSlug:s.slug},t[0]=s.id,t[1]=s.slug,t[2]=r):r=t[2];let a;t[3]===Symbol.for("react.memo_cache_sentinel")?(a={silent:!0},t[3]=a):a=t[3];const o=Am(s.id,"CONNECTIONS",Au(r),a),c=fs();let d;t[4]!==i?(d=i.filter(Hp),t[4]=i,t[5]=d):d=t[5];const m=d;let u;t[6]!==o||t[7]!==s.id||t[8]!==s.slug||t[9]!==c||t[10]!==n?.user?.id||t[11]!==e||t[12]!==m?(u={mutationFn:async x=>{const{vtexId:h,keys:g}=x,v=await iu(s.slug);if(!v)throw new Error(e("monitor.vtex.unavailable"));let b=h;if(!b){const{item:w}=await sa(s.slug,"COLLECTION_REGISTRY_APP_GET",{name:U1});if(!w)throw new Error(e("monitor.vtex.unavailable"));const S=Lu(w,s.id,n?.user?.id??"",{remoteIndex:0});b=(await o.create.mutateAsync(S)).id}if(g){const w=m.find(S=>S.id===b)?.configuration_state;await o.update.mutateAsync({id:b,data:{configuration_state:{...w??{},...g}}})}const{items:y}=await sa(s.slug,"COLLECTION_CONNECTIONS_LIST",{where:{field:["connection_url"],operator:"eq",value:v}}),j=y.find(w=>Y1(w)===b)??y.find(Up),N=j??await o.create.mutateAsync({title:"VTEX order monitoring",connection_type:"HTTP",connection_url:v});try{await o.update.mutateAsync({id:N.id,data:{configuration_state:{VTEX:{__type:"vtex",value:b}},configuration_scopes:[Bp]}})}catch(w){const S=w;j||await o.delete.mutateAsync(N.id);const k=Wp(S);throw/^VTEX 40[13]\b/.test(k)?new Q1(e("monitor.vtex.rejected")):new Error(k)}await c.invalidateQueries({queryKey:Qe.orderMonitor(s.slug)})}},t[6]=o,t[7]=s.id,t[8]=s.slug,t[9]=c,t[10]=n?.user?.id,t[11]=e,t[12]=m,t[13]=u):u=t[13];const f=Et(u);let p;return t[14]!==f||t[15]!==m?(p={vtex:m,install:f},t[14]=f,t[15]=m,t[16]=p):p=t[16],p}function Up(t){return Y1(t)===void 0}function Gp(t){const e=O.c(22),{label:s,className:n,variant:i}=t,{vtex:r,install:a}=X1(),[o,c]=Z.useState(!1),[d,m]=Z.useState();let u;e[0]!==r[0]||e[1]!==r.length?(u=r.length===1&&G1(r[0]),e[0]=r[0],e[1]=r.length,e[2]=u):u=e[2];const f=u;let p;e[3]!==f||e[4]!==a||e[5]!==r[0]?.id?(p=()=>f?a.mutate({vtexId:r[0]?.id},{onError:b=>{if(!(b instanceof Q1)){rt.error(b.message);return}m(b.message),c(!0)}}):c(!0),e[3]=f,e[4]=a,e[5]=r[0]?.id,e[6]=p):p=e[6];let x;e[7]!==a.isPending?(x=a.isPending?l.jsx(is,{className:"size-3.5"}):l.jsx(ks,{size:14}),e[7]=a.isPending,e[8]=x):x=e[8];let h;e[9]!==n||e[10]!==a.isPending||e[11]!==s||e[12]!==p||e[13]!==x||e[14]!==i?(h=l.jsxs(Se,{size:"sm",variant:i,className:n,disabled:a.isPending,onClick:p,children:[x,s]}),e[9]=n,e[10]=a.isPending,e[11]=s,e[12]=p,e[13]=x,e[14]=i,e[15]=h):h=e[15];let g;e[16]!==o||e[17]!==d?(g=o&&l.jsx(Yp,{rejected:d,onClose:()=>{c(!1),m(void 0)}}),e[16]=o,e[17]=d,e[18]=g):g=e[18];let v;return e[19]!==h||e[20]!==g?(v=l.jsxs(l.Fragment,{children:[h,g]}),e[19]=h,e[20]=g,e[21]=v):v=e[21],v}function Yp(t){const e=O.c(70),{rejected:s,onClose:n}=t,i=ie(),{vtex:r,install:a}=X1(),[o,c]=Z.useState();let d;e[0]!==o||e[1]!==r?(d=r.find(L=>L.id===o)??r[0],e[0]=o,e[1]=r,e[2]=d):d=e[2];const m=d;let u;e[3]!==m||e[4]!==s?(u=!!s||!G1(m),e[3]=m,e[4]=s,e[5]=u):u=e[5];const f=u,p=String(m?.configuration_state?.accountName??"");let x;e[6]!==p?(x={accountName:p,appKey:"",appToken:""},e[6]=p,e[7]=x):x=e[7];const[h,g]=Z.useState(x),v=f&&(!h.accountName||!h.appKey||!h.appToken),b=a.error?.message??s;let y;e[8]!==a.isPending||e[9]!==h||e[10]!==i?(y=(L,B,Y)=>{const J=Y===void 0?!1:Y;return l.jsxs("div",{className:"flex flex-col gap-1.5",children:[l.jsx(Ns,{htmlFor:`vtex-${L}`,children:B}),J?l.jsx(Iu,{id:`vtex-${L}`,showLabel:i("common.show"),hideLabel:i("common.hide"),copyLabel:i("common.copy"),copiedLabel:i("common.copied"),value:h[L],onChange:X=>g({...h,[L]:X.target.value}),disabled:a.isPending}):l.jsx(ds,{id:`vtex-${L}`,value:h[L],onChange:X=>g({...h,[L]:X.target.value}),disabled:a.isPending})]})},e[8]=a.isPending,e[9]=h,e[10]=i,e[11]=y):y=e[11];const j=y;let N;e[12]!==a.isPending||e[13]!==n?(N=L=>!L&&!a.isPending&&n(),e[12]=a.isPending,e[13]=n,e[14]=N):N=e[14];let w;e[15]!==i?(w=i("monitor.connect.orders"),e[15]=i,e[16]=w):w=e[16];let S;e[17]!==w?(S=l.jsx($n,{children:w}),e[17]=w,e[18]=S):S=e[18];let k;e[19]!==m||e[20]!==i?(k=i(m?"monitor.vtex.existing":"monitor.vtex.description"),e[19]=m,e[20]=i,e[21]=k):k=e[21];let _;e[22]!==k?(_=l.jsx(Da,{children:k}),e[22]=k,e[23]=_):_=e[23];let $;e[24]!==_||e[25]!==S?($=l.jsxs(_n,{children:[S,_]}),e[24]=_,e[25]=S,e[26]=$):$=e[26];let T;e[27]!==f||e[28]!==a||e[29]!==m?.id||e[30]!==h||e[31]!==n?(T=L=>{L.preventDefault(),a.mutate({vtexId:m?.id,keys:f?h:void 0},{onSuccess:n})},e[27]=f,e[28]=a,e[29]=m?.id,e[30]=h,e[31]=n,e[32]=T):T=e[32];let P;e[33]!==a.isPending||e[34]!==m?.id||e[35]!==r?(P=r.length>1&&l.jsxs(Zi,{value:m?.id,onValueChange:L=>{c(L),g({accountName:String(r.find(B=>B.id===L)?.configuration_state?.accountName??""),appKey:"",appToken:""})},disabled:a.isPending,children:[l.jsx(Ji,{children:l.jsx(er,{})}),l.jsx(tr,{children:r.map(Qp)})]}),e[33]=a.isPending,e[34]=m?.id,e[35]=r,e[36]=P):P=e[36];let I;e[37]!==f||e[38]!==j||e[39]!==i?(I=f&&l.jsxs(l.Fragment,{children:[j("accountName",i("monitor.vtex.account")),j("appKey",i("monitor.vtex.appKey"),!0),j("appToken",i("monitor.vtex.appToken"),!0)]}),e[37]=f,e[38]=j,e[39]=i,e[40]=I):I=e[40];let C;e[41]!==b?(C=b&&l.jsx("p",{role:"alert",className:"text-sm text-destructive",children:b}),e[41]=b,e[42]=C):C=e[42];const M=a.isPending;let A;e[43]!==i?(A=i("reportsOnboarding.vtexConfigForm.cancelButton"),e[43]=i,e[44]=A):A=e[44];let F;e[45]!==a.isPending||e[46]!==n||e[47]!==A?(F=l.jsx(Se,{type:"button",variant:"outline",onClick:n,disabled:M,children:A}),e[45]=a.isPending,e[46]=n,e[47]=A,e[48]=F):F=e[48];const E=v||a.isPending;let z;e[49]!==a.isPending||e[50]!==i?(z=a.isPending?i("monitor.vtex.connecting"):i("monitor.connect.short"),e[49]=a.isPending,e[50]=i,e[51]=z):z=e[51];let R;e[52]!==E||e[53]!==z?(R=l.jsx(Se,{type:"submit",disabled:E,children:z}),e[52]=E,e[53]=z,e[54]=R):R=e[54];let V;e[55]!==F||e[56]!==R?(V=l.jsxs(Aa,{children:[F,R]}),e[55]=F,e[56]=R,e[57]=V):V=e[57];let K;e[58]!==T||e[59]!==P||e[60]!==I||e[61]!==C||e[62]!==V?(K=l.jsxs("form",{className:"flex flex-col gap-4",onSubmit:T,children:[P,I,C,V]}),e[58]=T,e[59]=P,e[60]=I,e[61]=C,e[62]=V,e[63]=K):K=e[63];let U;e[64]!==$||e[65]!==K?(U=l.jsxs(Tn,{className:"sm:max-w-lg",children:[$,K]}),e[64]=$,e[65]=K,e[66]=U):U=e[66];let q;return e[67]!==U||e[68]!==N?(q=l.jsx(Pn,{open:!0,onOpenChange:N,children:U}),e[67]=U,e[68]=N,e[69]=q):q=e[69],q}function Qp(t){return l.jsx(sr,{value:t.id,children:t.title},t.id)}function aa(t,e){switch(t){case"orders":return e("monitor.platform.orders");case"site":return e("monitor.platform.site");case"deploys":return e("monitor.platform.deploys");case"analytics":return e("monitor.platform.analytics");case"search":return e("monitor.platform.search");default:return t}}function Xp(t,e){switch(t){case"orders":return e("monitor.powers.orders");case"site":return e("monitor.powers.site");case"deploys":return e("monitor.powers.deploys");case"analytics":return e("monitor.powers.analytics");case"search":return e("monitor.powers.search");default:return t}}function Zp(t){const e=O.c(17),{status:s}=t,n=ie();switch(s){case"ok":{let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=l.jsx("span",{className:"size-1.5 rounded-full bg-success"}),e[0]=i):i=e[0];let r;e[1]!==n?(r=n("monitor.statusOk"),e[1]=n,e[2]=r):r=e[2];let a;return e[3]!==r?(a=l.jsxs("span",{className:"flex items-center gap-1.5 text-meta",children:[i,r]}),e[3]=r,e[4]=a):a=e[4],a}case"low-volume":{let i;e[5]!==n?(i=n("orderMonitor.status.lowVolume"),e[5]=n,e[6]=i):i=e[6];let r;return e[7]!==i?(r=l.jsx(Ye,{variant:"muted",children:i}),e[7]=i,e[8]=r):r=e[8],r}case"warning":{let i;e[9]!==n?(i=n("orderMonitor.status.warning"),e[9]=n,e[10]=i):i=e[10];let r;return e[11]!==i?(r=l.jsx(Ye,{variant:"warning",children:i}),e[11]=i,e[12]=r):r=e[12],r}case"alert":{let i;e[13]!==n?(i=n("orderMonitor.status.alert"),e[13]=n,e[14]=i):i=e[14];let r;return e[15]!==i?(r=l.jsx(Ye,{variant:"destructive",children:i}),e[15]=i,e[16]=r):r=e[16],r}default:return s}}const Jp={good:"text-success",bad:"text-destructive",neutral:"text-muted-foreground"};function Z1(t){const e=Math.round(t*100);return`${e>0?"+":e<0?"−":""}${Math.abs(e)}%`}function J1(t){const e=O.c(15),{change:s,better:n,children:i}=t;if(s===null)return null;let r;e[0]!==n||e[1]!==s?(r=oi(s,n),e[0]=n,e[1]=s,e[2]=r):r=e[2];const a=r;let o,c,d;if(e[3]!==s||e[4]!==i||e[5]!==a){const f=Z1(s);d="text-meta tnum",o=Jp[a],c=i?i(f):f,e[3]=s,e[4]=i,e[5]=a,e[6]=o,e[7]=c,e[8]=d}else o=e[6],c=e[7],d=e[8];let m;e[9]!==o||e[10]!==c?(m=l.jsx("span",{className:o,children:c}),e[9]=o,e[10]=c,e[11]=m):m=e[11];let u;return e[12]!==d||e[13]!==m?(u=l.jsx("span",{className:d,children:m}),e[12]=d,e[13]=m,e[14]=u):u=e[14],u}function Zs(t,e,s){const n={org:t,agentId:e};switch(s){case"monitoring":return{to:Cs.monitoring,params:n};case"releases":return{to:Cs.releases,params:n};case"experiments":return{to:Cs.monitoring,params:n,search:{view:"experiments"}};case"experimentsApp":return{to:Cs.experiments,params:n};case"connectSources":return{to:Cs.connectSources,params:n};default:return s}}const Vn=t=>`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,"0")}-${String(t.getDate()).padStart(2,"0")}`;function Ss(t,e){return e?Zs(t,e,"connectSources"):{to:Oa.library,params:{org:t}}}function St(t){const e=O.c(15),{change:s,better:n,reference:i}=t,r=ie();if(s===null)return null;let a;e[0]!==n||e[1]!==s?(a=oi(s,n),e[0]=n,e[1]=s,e[2]=a):a=e[2];const o=a;let c;e[3]!==s?(c=Math.abs(Math.round(s*100)),e[3]=s,e[4]=c):c=e[4];const d=c;let m;e[5]!==s||e[6]!==d||e[7]!==r||e[8]!==o?(m=d===0?r("monitor.unchanged"):l.jsxs("span",{className:ye("tnum inline-flex items-center gap-0.5 font-medium",o==="good"&&"text-success",o==="bad"&&"text-destructive"),children:[s>0?l.jsx(f1,{size:12}):l.jsx(gu,{size:12}),d,"%"]}),e[5]=s,e[6]=d,e[7]=r,e[8]=o,e[9]=m):m=e[9];let u;e[10]!==i?(u=l.jsx("span",{children:i}),e[10]=i,e[11]=u):u=e[11];let f;return e[12]!==m||e[13]!==u?(f=l.jsxs("span",{className:"text-meta inline-flex items-center gap-1",children:[m,u]}),e[12]=m,e[13]=u,e[14]=f):f=e[14],f}function ar(t){const e=O.c(10),{values:s,format:n,lowerIsBetter:i}=t,r=ie();let a,o,c;if(e[0]!==n||e[1]!==i||e[2]!==r||e[3]!==s){c=Symbol.for("react.early_return_sentinel");e:{const m=Rp(s,n,i);if(!m){c=null;break e}a="text-meta truncate",o=m.kind==="all"?m.items.join(" · "):r("monitor.spread.range",{best:m.best,worst:m.worst})}e[0]=n,e[1]=i,e[2]=r,e[3]=s,e[4]=a,e[5]=o,e[6]=c}else a=e[4],o=e[5],c=e[6];if(c!==Symbol.for("react.early_return_sentinel"))return c;let d;return e[7]!==a||e[8]!==o?(d=l.jsx("span",{className:a,children:o}),e[7]=a,e[8]=o,e[9]=d):d=e[9],d}function so(t,e){switch(t){case"improvement":return e("monitor.verdict.improvement");case"neutral":return e("monitor.verdict.neutral");case"regression":return e("monitor.verdict.regression");case"settling":return e("monitor.verdict.settling");case"unmeasured":return e("monitor.verdict.unmeasured");default:return t}}const ex=t=>new Date(t).toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit"}),tx=t=>Math.max(0,Math.round((Date.now()-Date.parse(t))/6e4)),sx=t=>Math.round((Date.parse(t)-Date.now())/6e4),Bi=100,cn=32,Yo=2,lx={neutral:"text-chart-1",good:"text-success",bad:"text-destructive",warning:"text-warning"};function Qo(t,e,s){const n=Bi/Math.max(1,s-1);return t.flatMap((i,r)=>i===null?[]:[{x:r*n,y:cn-Yo-i/e*(cn-Yo*2)}])}const zr=t=>t.map((e,s)=>`${s===0?"M":"L"}${e.x.toFixed(1)} ${e.y.toFixed(1)}`).join(" ");function Nn(t){const e=O.c(35),{values:s,reference:n,tone:i,marker:r,className:a}=t,o=i===void 0?"neutral":i,c=Math.max(s.length,n?.length??0);let d;e[0]!==n||e[1]!==s?(d=Math.max(1,...s.map(ix),...(n??[]).map(nx)),e[0]=n,e[1]=s,e[2]=d):d=e[2];const m=d;let u,f,p,x,h,g,v;if(e[3]!==a||e[4]!==c||e[5]!==r||e[6]!==m||e[7]!==n||e[8]!==o||e[9]!==s){const y=Qo(s,m,c),j=y.at(-1);u=!0,f=`0 0 ${Bi} ${cn}`,p="none";const N=lx[o];e[17]!==a||e[18]!==N?(x=ye("h-8 w-full overflow-visible",N,a),e[17]=a,e[18]=N,e[19]=x):x=e[19],e[20]!==c||e[21]!==r?(h=r!==void 0&&l.jsx("line",{x1:r*Bi/Math.max(1,c-1),x2:r*Bi/Math.max(1,c-1),y1:0,y2:cn,className:"stroke-foreground/40",strokeWidth:1,strokeDasharray:"2 2",vectorEffect:"non-scaling-stroke"}),e[20]=c,e[21]=r,e[22]=h):h=e[22],e[23]!==c||e[24]!==m||e[25]!==n?(g=n&&l.jsx("path",{d:zr(Qo(n,m,c)),fill:"none",className:"stroke-muted-foreground/40",strokeWidth:1,strokeDasharray:"2 2",vectorEffect:"non-scaling-stroke"}),e[23]=c,e[24]=m,e[25]=n,e[26]=g):g=e[26],v=j&&l.jsxs(l.Fragment,{children:[l.jsx("path",{d:`${zr(y)} L${j.x.toFixed(1)} ${cn} L0 ${cn} Z`,className:"fill-current opacity-10"}),l.jsx("path",{d:zr(y),fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinejoin:"round",strokeLinecap:"round",vectorEffect:"non-scaling-stroke"})]}),e[3]=a,e[4]=c,e[5]=r,e[6]=m,e[7]=n,e[8]=o,e[9]=s,e[10]=u,e[11]=f,e[12]=p,e[13]=x,e[14]=h,e[15]=g,e[16]=v}else u=e[10],f=e[11],p=e[12],x=e[13],h=e[14],g=e[15],v=e[16];let b;return e[27]!==u||e[28]!==f||e[29]!==p||e[30]!==x||e[31]!==h||e[32]!==g||e[33]!==v?(b=l.jsxs("svg",{"aria-hidden":u,viewBox:f,preserveAspectRatio:p,className:x,children:[h,g,v]}),e[27]=u,e[28]=f,e[29]=p,e[30]=x,e[31]=h,e[32]=g,e[33]=v,e[34]=b):b=e[34],b}function nx(t){return t??0}function ix(t){return t??0}const rx={total_requests:0,total_bandwidth_bytes:0,cache_hit_ratio:0,avg_latency_ms:0,status_2xx_count:0,status_4xx_count:0,status_5xx_count:0,unique_countries:0,pageviews:0};function oa(t){const e=t.reduce((n,i)=>({total_requests:n.total_requests+i.total_requests,total_bandwidth_bytes:n.total_bandwidth_bytes+i.total_bandwidth_bytes,cache_hit_ratio:n.cache_hit_ratio+i.cache_hit_ratio*i.total_requests,avg_latency_ms:n.avg_latency_ms+i.avg_latency_ms*i.total_requests,status_2xx_count:n.status_2xx_count+i.status_2xx_count,status_4xx_count:n.status_4xx_count+i.status_4xx_count,status_5xx_count:n.status_5xx_count+i.status_5xx_count,unique_countries:Math.max(n.unique_countries,i.unique_countries),pageviews:n.pageviews+i.pageviews}),rx),s=e.total_requests||1;return{...e,cache_hit_ratio:e.cache_hit_ratio/s,avg_latency_ms:e.avg_latency_ms/s}}function Xo(t){const e=new Map;for(const s of t.flat()){const n=e.get(s.bucket);if(!n){e.set(s.bucket,{...s});continue}const i=n.requests+s.requests;e.set(s.bucket,{bucket:s.bucket,requests:i,bandwidth_bytes:n.bandwidth_bytes+s.bandwidth_bytes,pageviews:n.pageviews+s.pageviews,cache_hit_ratio:i===0?0:(n.cache_hit_ratio*n.requests+s.cache_hit_ratio*s.requests)/i})}return[...e.values()].sort((s,n)=>s.bucket.localeCompare(n.bucket))}const ax=["requests","bandwidth","cache"],_i="var(--chart-1)",Zo="var(--muted-foreground)",Jo={fontSize:11,fill:"var(--muted-foreground)"},Hi=(t,e)=>t==="pageviews"?e.pageviews>0:e.total_requests>0,ox={pageviews:"up",requests:"none",bandwidth:"none",cache:"up"};function ed(t,e){switch(t){case"pageviews":return e.pageviews;case"requests":return e.total_requests;case"bandwidth":return e.total_bandwidth_bytes;case"cache":return e.cache_hit_ratio;default:return t}}function ca(t,e){switch(t){case"pageviews":return e.pageviews;case"requests":return e.requests;case"bandwidth":return e.bandwidth_bytes;case"cache":return e.cache_hit_ratio;default:return t}}function td(t,e){switch(t){case"pageviews":case"requests":return wt(e);case"bandwidth":return Qs(e);case"cache":return V1(e);default:return t}}const cx=new Intl.NumberFormat(void 0,{notation:"compact",maximumFractionDigits:1});function dx(t,e){switch(t){case"pageviews":case"requests":return cx.format(e);case"bandwidth":return Qs(e);case"cache":return`${Math.round(e*100)}%`;default:return t}}const mx=t=>t.length>10?t.slice(11,16):t.slice(5,10);function sd(){const t=O.c(2),e=ie();let s;return t[0]!==e?(s=n=>{switch(n){case"pageviews":return e("mainPanelTabs.cdnTab.pageviews");case"requests":return e("mainPanelTabs.cdnTab.requests");case"bandwidth":return e("mainPanelTabs.cdnTab.bandwidth");case"cache":return e("mainPanelTabs.cdnTab.cacheHit");default:return n}},t[0]=e,t[1]=s):s=t[1],s}function ux(t){const e=O.c(50),{id:s,timeline:n,previousTimeline:i,currentLabel:r,tall:a}=t,o=ie(),c=sd(),d=`sites-${s}`;let m;if(e[0]!==s||e[1]!==i||e[2]!==n){let E;e[4]!==s||e[5]!==i?(E=(z,R)=>{const V=i[R];return{bucket:mx(z.bucket),value:ca(s,z),reference:V?ca(s,V):null}},e[4]=s,e[5]=i,e[6]=E):E=e[6],m=n.map(E),e[0]=s,e[1]=i,e[2]=n,e[3]=m}else m=e[3];const u=m;let f;e[7]!==s||e[8]!==c?(f=c(s),e[7]=s,e[8]=c,e[9]=f):f=e[9];const p=a?"h-[150px] md:h-[170px]":"h-[110px]";let x;e[10]!==p?(x=ye("w-full",p),e[10]=p,e[11]=x):x=e[11];let h;e[12]!==r?(h={label:r,color:_i},e[12]=r,e[13]=h):h=e[13];let g;e[14]!==o?(g=o("monitor.compare.w1"),e[14]=o,e[15]=g):g=e[15];let v;e[16]!==g?(v={label:g,color:Zo},e[16]=g,e[17]=v):v=e[17];let b;e[18]!==h||e[19]!==v?(b={value:h,reference:v},e[18]=h,e[19]=v,e[20]=b):b=e[20];let y;e[21]===Symbol.for("react.memo_cache_sentinel")?(y={left:0,right:0,top:4},e[21]=y):y=e[21];let j,N;e[22]===Symbol.for("react.memo_cache_sentinel")?(j=l.jsx("stop",{offset:"0%",stopColor:_i,stopOpacity:.18}),N=l.jsx("stop",{offset:"100%",stopColor:_i,stopOpacity:0}),e[22]=j,e[23]=N):(j=e[22],N=e[23]);let w;e[24]!==d?(w=l.jsx("defs",{children:l.jsxs("linearGradient",{id:d,x1:"0",y1:"0",x2:"0",y2:"1",children:[j,N]})}),e[24]=d,e[25]=w):w=e[25];let S,k;e[26]===Symbol.for("react.memo_cache_sentinel")?(S=l.jsx(Ft,{strokeDasharray:"4 4",stroke:"var(--border)",strokeOpacity:.5,vertical:!1}),k=l.jsx(zt,{dataKey:"bucket",axisLine:!1,tickLine:!1,tick:Jo,tickMargin:8,minTickGap:24}),e[26]=S,e[27]=k):(S=e[26],k=e[27]);let _;e[28]!==s?(_=l.jsx(At,{orientation:"right",axisLine:!1,tickLine:!1,tick:Jo,width:52,tickCount:4,tickFormatter:E=>dx(s,E)}),e[28]=s,e[29]=_):_=e[29];let $;e[30]===Symbol.for("react.memo_cache_sentinel")?($={stroke:"var(--border)",strokeDasharray:"4 4"},e[30]=$):$=e[30];let T;e[31]!==r||e[32]!==s||e[33]!==o?(T=l.jsx(es,{cursor:$,content:l.jsx(us,{formatter:(E,z)=>l.jsxs("span",{className:"flex w-full items-center justify-between gap-3",children:[l.jsx("span",{className:"text-muted-foreground",children:z==="reference"?o("monitor.compare.w1"):r}),l.jsx("span",{className:"tnum text-foreground",children:td(s,Number(E))})]})})}),e[31]=r,e[32]=s,e[33]=o,e[34]=T):T=e[34];let P;e[35]===Symbol.for("react.memo_cache_sentinel")?(P=l.jsx(rs,{type:"monotone",dataKey:"reference",stroke:Zo,strokeOpacity:.55,strokeWidth:1.25,strokeDasharray:"4 4",dot:!1,activeDot:!1,isAnimationActive:!1}),e[35]=P):P=e[35];const I=`url(#${d})`;let C;e[36]===Symbol.for("react.memo_cache_sentinel")?(C={r:3,stroke:"var(--background)",strokeWidth:2},e[36]=C):C=e[36];let M;e[37]!==I?(M=l.jsx(Gt,{type:"monotone",dataKey:"value",stroke:_i,strokeWidth:2,fill:I,dot:!1,activeDot:C,isAnimationActive:!1}),e[37]=I,e[38]=M):M=e[38];let A;e[39]!==u||e[40]!==w||e[41]!==_||e[42]!==T||e[43]!==M?(A=l.jsxs(Gs,{data:u,margin:y,children:[w,S,k,_,T,P,M]}),e[39]=u,e[40]=w,e[41]=_,e[42]=T,e[43]=M,e[44]=A):A=e[44];let F;return e[45]!==f||e[46]!==A||e[47]!==x||e[48]!==b?(F=l.jsx(It,{role:"img","aria-label":f,className:x,config:b,children:A}),e[45]=f,e[46]=A,e[47]=x,e[48]=b,e[49]=F):F=e[49],F}function fx(t,e){if(e.timeline.length===0)return e.previous?ed(t,e.previous):null;const s=e.previousTimeline.slice(0,e.timeline.length);if(s.length===0)return null;if(t==="cache"){const n=s.reduce((i,r)=>i+r.requests,0);return n===0?null:s.reduce((i,r)=>i+r.cache_hit_ratio*r.requests,0)/n}return s.reduce((n,i)=>n+ca(t,i),0)}function ec(t){const e=O.c(44),{id:s,data:n,tall:i}=t,r=i===void 0?!1:i,a=ie(),o=sd();let c,d,m,u,f,p;if(e[0]!==n||e[1]!==s||e[2]!==o||e[3]!==a){p=Symbol.for("react.early_return_sentinel");e:{const y=ed(s,n.summary);if(!Hi(s,n.summary)){let j;e[10]!==s||e[11]!==o?(j=o(s),e[10]=s,e[11]=o,e[12]=j):j=e[12];let N;e[13]===Symbol.for("react.memo_cache_sentinel")?(N=l.jsx(da,{className:"text-base"}),e[13]=N):N=e[13];const w=s==="pageviews"?"monitor.orgAnalytics.noTag":"monitor.orgAnalytics.noCdn";let S;e[14]!==a||e[15]!==w?(S=a(w),e[14]=a,e[15]=w,e[16]=S):S=e[16];let k;e[17]!==S?(k=l.jsx("span",{className:"text-meta",children:S}),e[17]=S,e[18]=k):k=e[18];let _;e[19]!==k||e[20]!==j?(_=l.jsx(Me,{title:j,value:N,caption:k}),e[19]=k,e[20]=j,e[21]=_):_=e[21],p=_;break e}d=Me,e[22]!==s||e[23]!==o?(u=o(s),e[22]=s,e[23]=o,e[24]=u):u=e[24],f=td(s,y),c=St,m=ot(y,fx(s,n))}e[0]=n,e[1]=s,e[2]=o,e[3]=a,e[4]=c,e[5]=d,e[6]=m,e[7]=u,e[8]=f,e[9]=p}else c=e[4],d=e[5],m=e[6],u=e[7],f=e[8],p=e[9];if(p!==Symbol.for("react.early_return_sentinel"))return p;const x=ox[s];let h;e[25]!==a?(h=a("monitor.compare.vs",{ref:a("monitor.compare.w1")}),e[25]=a,e[26]=h):h=e[26];let g;e[27]!==c||e[28]!==m||e[29]!==x||e[30]!==h?(g=l.jsx(c,{change:m,better:x,reference:h}),e[27]=c,e[28]=m,e[29]=x,e[30]=h,e[31]=g):g=e[31];let v;e[32]!==n.currentLabel||e[33]!==n.previousTimeline||e[34]!==n.timeline||e[35]!==s||e[36]!==r?(v=n.timeline.length>0&&l.jsx(ux,{id:s,timeline:n.timeline,previousTimeline:n.previousTimeline,currentLabel:n.currentLabel,tall:r}),e[32]=n.currentLabel,e[33]=n.previousTimeline,e[34]=n.timeline,e[35]=s,e[36]=r,e[37]=v):v=e[37];let b;return e[38]!==d||e[39]!==u||e[40]!==f||e[41]!==g||e[42]!==v?(b=l.jsx(d,{title:u,value:f,caption:g,children:v}),e[38]=d,e[39]=u,e[40]=f,e[41]=g,e[42]=v,e[43]=b):b=e[43],b}const px=l.jsx("span",{className:"text-meta",children:"–"});function da(t){const e=O.c(7),{className:s}=t,n=ie();let i;e[0]!==s?(i=ye("text-muted-foreground",s),e[0]=s,e[1]=i):i=e[1];let r;e[2]!==n?(r=n("monitor.orgAnalytics.notInstrumented"),e[2]=n,e[3]=r):r=e[3];let a;return e[4]!==i||e[5]!==r?(a=l.jsx("span",{className:i,children:r}),e[4]=i,e[5]=r,e[6]=a):a=e[6],a}function xx(t){const e=O.c(42),{sites:s}=t,n=ie(),i=Cn();let r;e[0]!==n?(r=n("monitor.orgAnalytics.sites"),e[0]=n,e[1]=r):r=e[1];let a;e[2]!==n?(a=n("monitor.filter.project"),e[2]=n,e[3]=a):a=e[3];let o;e[4]!==a?(o=l.jsx(dt,{className:"pl-4",children:a}),e[4]=a,e[5]=o):o=e[5];let c;e[6]!==n?(c=n("mainPanelTabs.cdnTab.pageviews"),e[6]=n,e[7]=c):c=e[7];let d;e[8]!==c?(d=l.jsx(dt,{children:c}),e[8]=c,e[9]=d):d=e[9];let m;e[10]===Symbol.for("react.memo_cache_sentinel")?(m=l.jsx(dt,{className:"w-28"}),e[10]=m):m=e[10];let u;e[11]!==n?(u=n("mainPanelTabs.cdnTab.requests"),e[11]=n,e[12]=u):u=e[12];let f;e[13]!==u?(f=l.jsx(dt,{children:u}),e[13]=u,e[14]=f):f=e[14];let p;e[15]!==n?(p=n("mainPanelTabs.cdnTab.bandwidth"),e[15]=n,e[16]=p):p=e[16];let x;e[17]!==p?(x=l.jsx(dt,{children:p}),e[17]=p,e[18]=x):x=e[18];let h;e[19]!==n?(h=n("mainPanelTabs.cdnTab.cacheHit"),e[19]=n,e[20]=h):h=e[20];let g;e[21]!==h?(g=l.jsx(dt,{className:"pr-4 text-right",children:h}),e[21]=h,e[22]=g):g=e[22];let v;e[23]!==x||e[24]!==g||e[25]!==o||e[26]!==d||e[27]!==f?(v=l.jsx(el,{children:l.jsxs(Ut,{children:[o,d,m,f,x,g]})}),e[23]=x,e[24]=g,e[25]=o,e[26]=d,e[27]=f,e[28]=v):v=e[28];let b;if(e[29]!==i||e[30]!==s){let w;e[32]!==i?(w=S=>l.jsxs(Ut,{className:ye(S.link&&"cursor-pointer"),onClick:()=>S.link&&void i(S.link),children:[l.jsx(Le,{className:"pl-4 text-sm font-medium text-foreground",children:S.name}),l.jsx(Le,{children:Hi("pageviews",S.summary)?l.jsxs("span",{className:"flex items-baseline gap-2",children:[l.jsx("span",{className:"text-sm tnum text-foreground",children:wt(S.summary.pageviews)}),l.jsx(J1,{change:ot(S.summary.pageviews,S.previousSeries.length>0?S.previousSeries.slice(0,S.series.length).reduce(hx,0):S.previous?.pageviews??null),better:"up"})]}):l.jsx(da,{className:"text-sm"})}),l.jsx(Le,{children:Hi("pageviews",S.summary)&&S.series.length>1?l.jsx(Nn,{values:S.series,reference:S.previousSeries,className:"h-6 w-24"}):px}),Hi("requests",S.summary)?l.jsxs(l.Fragment,{children:[l.jsx(Le,{className:"text-sm tnum text-foreground",children:wt(S.summary.total_requests)}),l.jsx(Le,{className:"text-sm tnum text-foreground",children:Qs(S.summary.total_bandwidth_bytes)}),l.jsx(Le,{className:"pr-4 text-right text-sm tnum text-foreground",children:V1(S.summary.cache_hit_ratio)})]}):l.jsx(Le,{colSpan:3,className:"pr-4",children:l.jsx(da,{className:"text-sm"})})]},S.id),e[32]=i,e[33]=w):w=e[33],b=s.map(w),e[29]=i,e[30]=s,e[31]=b}else b=e[31];let y;e[34]!==b?(y=l.jsx(tl,{children:b}),e[34]=b,e[35]=y):y=e[35];let j;e[36]!==v||e[37]!==y?(j=l.jsx("div",{className:"surface overflow-x-auto",children:l.jsxs(sl,{variant:"flush",children:[v,y]})}),e[36]=v,e[37]=y,e[38]=j):j=e[38];let N;return e[39]!==r||e[40]!==j?(N=l.jsx(t1,{title:r,children:j}),e[39]=r,e[40]=j,e[41]=N):N=e[41],N}function hx(t,e){return t+e}function gx(t){const e=O.c(12),{data:s}=t;let n;e[0]!==s?(n=l.jsx(ec,{id:"pageviews",data:s,tall:!0}),e[0]=s,e[1]=n):n=e[1];let i;e[2]!==s?(i=ax.map(c=>l.jsx(ec,{id:c,data:s},c)),e[2]=s,e[3]=i):i=e[3];let r;e[4]!==i?(r=l.jsx("div",{className:"grid gap-4 md:grid-cols-3",children:i}),e[4]=i,e[5]=r):r=e[5];let a;e[6]!==s.sites?(a=s.sites.length>0&&l.jsx("div",{className:"mt-6",children:l.jsx(xx,{sites:s.sites})}),e[6]=s.sites,e[7]=a):a=e[7];let o;return e[8]!==n||e[9]!==r||e[10]!==a?(o=l.jsxs("div",{className:"flex flex-col gap-4",children:[n,r,a]}),e[8]=n,e[9]=r,e[10]=a,e[11]=o):o=e[11],o}const tc={orders:"deco/vtex",site:null,deploys:"deco/github-mcp",analytics:"deco/google-analytics",search:"deco/google-search-console"},vx={orders:"https://raw.githubusercontent.com/deco-cx/apps/main/vtex/logo.png",site:"/favicon.svg",deploys:"/connections/github.png",analytics:null,search:null},bx=t=>t?.server?.icons?.[0]?.src??null;function ld(t,e){const s=O.c(13);let n;s[0]===Symbol.for("react.memo_cache_sentinel")?(n=Object.values(tc).filter(yx),s[0]=n):n=s[0];const i=n;let r;s[1]!==t?(r=Qe.monitorSourceIcons(t),s[1]=t,s[2]=r):r=s[2];let a;s[3]!==t?(a=async()=>{const f=zu(i,[]),p=await sa(t,"COLLECTION_REGISTRY_APP_LIST",{...f?{where:f}:{},limit:i.length});return Vu(p).items},s[3]=t,s[4]=a):a=s[4];let o;s[5]!==r||s[6]!==a?(o={queryKey:r,queryFn:a,staleTime:Number.POSITIVE_INFINITY,retry:!1},s[5]=r,s[6]=a,s[7]=o):o=s[7];const c=ts(o);let d;s[8]!==c.data?(d=new Map((c.data??[]).map(jx)),s[8]=c.data,s[9]=d):d=s[9];const m=d;let u;return s[10]!==m||s[11]!==e?(u=f=>{const p=e.find(h=>h.id===f)?.icon,x=tc[f];return p??bx(x?m.get(x):void 0)??vx[f]},s[10]=m,s[11]=e,s[12]=u):u=s[12],u}function jx(t){return[t.id,t]}function yx(t){return t!==null}const lo="flex max-h-[min(22rem,45vh)] flex-col overflow-y-auto",wx="pointer-events-none flex flex-col gap-4 opacity-15 grayscale select-none",Nx={deploys:"github",analytics:"ga4",search:"gsc"};function kx(t){const e=O.c(27),{label:s,link:n,source:i,quiet:r}=t,a=r===void 0?!1:r;let o;e[0]!==a?(o=a?{variant:"outline",className:"gap-1"}:{className:"gap-1 shadow-sm"},e[0]=a,e[1]=o):o=e[1];const c=o,[d,m]=Z.useState(!1),u=i?Nx[i]:void 0;if(i==="site"){let v;e[2]===Symbol.for("react.memo_cache_sentinel")?(v=l.jsx(ks,{size:14}),e[2]=v):v=e[2];let b;return e[3]!==s||e[4]!==c?(b=l.jsxs(Se,{size:"sm",...c,onClick:Sx,children:[v,s]}),e[3]=s,e[4]=c,e[5]=b):b=e[5],b}if(i==="orders"){let v;return e[6]!==s||e[7]!==c?(v=l.jsx(Gp,{label:s,...c}),e[6]=s,e[7]=c,e[8]=v):v=e[8],v}if(!u){let v;e[9]===Symbol.for("react.memo_cache_sentinel")?(v=l.jsx(ks,{size:14}),e[9]=v):v=e[9];let b;e[10]!==s||e[11]!==n?(b=l.jsxs(As,{...n,children:[v,s]}),e[10]=s,e[11]=n,e[12]=b):b=e[12];let y;return e[13]!==c||e[14]!==b?(y=l.jsx(Se,{asChild:!0,size:"sm",...c,children:b}),e[13]=c,e[14]=b,e[15]=y):y=e[15],y}let f,p;e[16]===Symbol.for("react.memo_cache_sentinel")?(f=()=>m(!0),p=l.jsx(ks,{size:14}),e[16]=f,e[17]=p):(f=e[16],p=e[17]);let x;e[18]!==s||e[19]!==c?(x=l.jsxs(Se,{size:"sm",...c,onClick:f,children:[p,s]}),e[18]=s,e[19]=c,e[20]=x):x=e[20];let h;e[21]!==u||e[22]!==d?(h=d&&l.jsx(Mu,{field:u,onClose:()=>m(!1)}),e[21]=u,e[22]=d,e[23]=h):h=e[23];let g;return e[24]!==x||e[25]!==h?(g=l.jsxs(l.Fragment,{children:[x,h]}),e[24]=x,e[25]=h,e[26]=g):g=e[26],g}function Sx(){return Wa("monitor")}function _x(t){const e=O.c(2),{kind:s}=t;switch(s){case"metrics":{let n;return e[0]===Symbol.for("react.memo_cache_sentinel")?(n=l.jsxs(l.Fragment,{children:[l.jsx("defs",{children:l.jsxs("linearGradient",{id:"vig-metrics",x1:"0",y1:"0",x2:"0",y2:"1",children:[l.jsx("stop",{offset:"0%",stopColor:"var(--chart-1)",stopOpacity:.28}),l.jsx("stop",{offset:"100%",stopColor:"var(--chart-1)",stopOpacity:0})]})}),l.jsx("line",{x1:4,x2:156,y1:66,y2:66,className:"stroke-border"}),l.jsx("path",{d:"M4 58 C26 57 38 50 54 38 S80 18 98 24",fill:"none",className:"stroke-muted-foreground/35",strokeWidth:1.5,strokeLinecap:"round"}),l.jsx("path",{d:"M4 60 C26 59 38 53 54 42 S80 26 98 32 L98 66 L4 66 Z",fill:"url(#vig-metrics)"}),l.jsx("path",{d:"M4 60 C26 59 38 53 54 42 S80 26 98 32",fill:"none",className:"stroke-chart-1",strokeWidth:2.5,strokeLinecap:"round"}),l.jsx("path",{d:"M98 32 C116 38 128 22 156 14",fill:"none",className:"stroke-chart-1/55",strokeWidth:2.5,strokeLinecap:"round",strokeDasharray:"1 6"}),l.jsx("circle",{cx:98,cy:32,r:9,className:"fill-chart-1/15"}),l.jsx("circle",{cx:98,cy:32,r:4,className:"fill-chart-1 stroke-background",strokeWidth:2})]}),e[0]=n):n=e[0],n}case"analytics":{let n;return e[1]===Symbol.for("react.memo_cache_sentinel")?(n=l.jsxs(l.Fragment,{children:[l.jsx("defs",{children:l.jsxs("linearGradient",{id:"vig-analytics",x1:"0",y1:"0",x2:"0",y2:"1",children:[l.jsx("stop",{offset:"0%",stopColor:"var(--chart-1)",stopOpacity:.3}),l.jsx("stop",{offset:"100%",stopColor:"var(--chart-1)",stopOpacity:0})]})}),l.jsx("path",{d:"M4 34 C24 24 36 12 56 18 S88 38 108 22 S144 10 156 16 L156 44 L4 44 Z",fill:"url(#vig-analytics)"}),l.jsx("path",{d:"M4 34 C24 24 36 12 56 18 S88 38 108 22 S144 10 156 16",fill:"none",className:"stroke-chart-1",strokeWidth:2.5,strokeLinecap:"round"}),[112,80,48].map($x)]}),e[1]=n):n=e[1],n}default:return s}}function $x(t,e){return l.jsx("rect",{x:80-t/2,y:50+e*7,width:t,height:4,rx:2,className:ye(e===0&&"fill-chart-1/60",e===1&&"fill-chart-1/40",e===2&&"fill-chart-1/25")},t)}function Tx(t){const e=O.c(2),{kind:s}=t;let n;return e[0]!==s?(n=l.jsx("svg",{"aria-hidden":!0,viewBox:"0 0 160 72",className:"h-[4.5rem] w-40 self-center overflow-visible",children:l.jsx(_x,{kind:s})}),e[0]=s,e[1]=n):n=e[1],n}const Px=[];function nd(t){const e=O.c(14),{steps:s,link:n}=t,i=ie(),{org:r}=He();let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a=[],e[0]=a):a=e[0];const o=ld(r.slug,a);let c;e[1]!==s?(c=s.find(Cx),e[1]=s,e[2]=c):c=e[2];const d=c;let m;if(e[3]!==o||e[4]!==d||e[5]!==n||e[6]!==s||e[7]!==i){let u;e[9]!==o||e[10]!==d||e[11]!==n||e[12]!==i?(u=f=>l.jsx(Mn,{variant:"divided",lead:l.jsx(vr,{icon:o(f.source),name:aa(f.source,i),size:"xs",fit:"contain"}),title:aa(f.source,i),meta:f.meta??Xp(f.source,i),trailing:f.state!=="live"?l.jsx(kx,{label:f.label??i("monitor.connect.short"),link:f.link??n,source:f.link?void 0:f.source,quiet:f!==d}):l.jsxs("span",{className:"flex shrink-0 items-center gap-1 text-xs text-muted-foreground",children:[l.jsx(ti,{size:14,className:"text-success"}),i("monitor.connect.done")]})},f.source+(f.label??"")),e[9]=o,e[10]=d,e[11]=n,e[12]=i,e[13]=u):u=e[13],m=s.map(u),e[3]=o,e[4]=d,e[5]=n,e[6]=s,e[7]=i,e[8]=m}else m=e[8];return m}function Cx(t){return t.state!=="live"}function Ex(t){const e=O.c(12),{steps:s,link:n}=t,i=ie();let r;e[0]!==s?(r=s.filter(Mx),e[0]=s,e[1]=r):r=e[1];const a=r;if(a.length===0)return null;let o;e[2]!==i?(o=i("monitor.connect.more"),e[2]=i,e[3]=o):o=e[3];let c;e[4]!==o?(c=l.jsx("h2",{className:"text-sm font-medium text-foreground",children:o}),e[4]=o,e[5]=c):c=e[5];let d;e[6]!==n||e[7]!==a?(d=l.jsx("div",{className:"surface px-4 py-1",children:l.jsx(nd,{steps:a,link:n})}),e[6]=n,e[7]=a,e[8]=d):d=e[8];let m;return e[9]!==c||e[10]!==d?(m=l.jsxs("section",{className:"flex flex-col gap-3",children:[c,d]}),e[9]=c,e[10]=d,e[11]=m):m=e[11],m}function Mx(t){return t.state!=="live"}function Ds(t){const e=O.c(18),{kind:s,title:n,steps:i,guide:r,link:a,children:o}=t,c=i===void 0?Px:i;let d;e[0]===Symbol.for("react.memo_cache_sentinel")?(d=ye(wx,"[mask-image:linear-gradient(to_bottom,black_70%,transparent)]"),e[0]=d):d=e[0];let m;e[1]!==o?(m=l.jsx("div",{"aria-hidden":!0,className:d,children:o}),e[1]=o,e[2]=m):m=e[2];let u;e[3]!==s?(u=l.jsx(Tx,{kind:s}),e[3]=s,e[4]=u):u=e[4];let f;e[5]!==n?(f=l.jsx("div",{className:"flex flex-col gap-1",children:l.jsx("p",{className:"text-[1.375rem] leading-tight font-medium tracking-[-0.02em] text-foreground",children:n})}),e[5]=n,e[6]=f):f=e[6];let p;e[7]!==a||e[8]!==c?(p=c.length>0&&l.jsx("div",{className:lo,children:l.jsx(nd,{steps:c,link:a})}),e[7]=a,e[8]=c,e[9]=p):p=e[9];let x;e[10]!==r||e[11]!==u||e[12]!==f||e[13]!==p?(x=l.jsx("div",{className:"absolute inset-0 flex items-center justify-center p-4",children:l.jsxs("div",{className:"glass flex max-h-full w-full max-w-md flex-col gap-5 overflow-y-auto rounded-2xl p-6",children:[u,f,r,p]})}),e[10]=r,e[11]=u,e[12]=f,e[13]=p,e[14]=x):x=e[14];let h;return e[15]!==m||e[16]!==x?(h=l.jsxs("div",{className:"relative h-[calc(100dvh-11rem)] min-h-[520px] overflow-hidden",children:[m,x]}),e[15]=m,e[16]=x,e[17]=h):h=e[17],h}const sc=[];function lc(t){const e=O.c(7),s=Ha();if(s.isLoading)return null;let n;e[0]!==s.data?(n=s.data??[],e[0]=s.data,e[1]=n):n=e[1];const i=n;let r;if(e[2]!==t||e[3]!==i){let a;e[5]!==i?(a=o=>o.repository&&i.some(c=>W1(o.repository,{repositoryId:c.id,url:c.webUrl})),e[5]=i,e[6]=a):a=e[6],r=t.filter(a),e[2]=t,e[3]=i,e[4]=r}else r=e[4];return r}function id(t){const e=O.c(45),{projects:s,more:n}=t,i=s===void 0?sc:s,r=n===void 0?sc:n,a=ie(),o=Vp(),c=lc(i),d=lc(r),[m,u]=Z.useState(""),[f,p]=Z.useState(null),x=o.isPending?o.variables?.site:null;if(!c)return null;if(c.length===0){let k;e[0]!==a?(k=a("monitor.analyticsGuide.introEmpty"),e[0]=a,e[1]=k):k=e[1];let _;e[2]!==k?(_=l.jsx("p",{className:"text-sm text-muted-foreground",children:k}),e[2]=k,e[3]=_):_=e[3];let $;e[4]===Symbol.for("react.memo_cache_sentinel")?($=l.jsx(ks,{size:14}),e[4]=$):$=e[4];let T;e[5]!==a?(T=a("monitor.analyticsGuide.add"),e[5]=a,e[6]=T):T=e[6];let P;e[7]!==T?(P=l.jsxs(Se,{size:"sm",className:"gap-1 self-center shadow-sm",onClick:Ax,children:[$,T]}),e[7]=T,e[8]=P):P=e[8];let I;return e[9]!==_||e[10]!==P?(I=l.jsxs("div",{className:"flex flex-col gap-4",children:[_,P]}),e[9]=_,e[10]=P,e[11]=I):I=e[11],I}let h;e[12]!==a?(h=a("monitor.analyticsGuide.intro"),e[12]=a,e[13]=h):h=e[13];let g;e[14]!==h?(g=l.jsx("p",{className:"text-sm text-muted-foreground",children:h}),e[14]=h,e[15]=g):g=e[15];let v;if(e[16]!==f||e[17]!==m||e[18]!==o||e[19]!==c||e[20]!==x||e[21]!==a){let k;e[23]!==f||e[24]!==m||e[25]!==o||e[26]!==x||e[27]!==a?(k=_=>f===_.site?l.jsxs("form",{className:"flex flex-col gap-2 border-b border-border py-3",onSubmit:$=>{$.preventDefault(),o.mutate({site:_.site,domain:m},{onSuccess:T=>{T.status==="needs_domain"&&rt.error(a("monitor.analyticsGuide.domainInvalid"))}})},children:[l.jsx("label",{htmlFor:"analytics-domain",className:"text-sm text-foreground",children:a("monitor.analyticsGuide.domain",{site:_.title})}),l.jsxs("div",{className:"flex gap-2",children:[l.jsx(ds,{id:"analytics-domain",autoFocus:!0,inputMode:"url",placeholder:"www.example.com",value:m,onChange:$=>u($.target.value)}),l.jsx(Se,{type:"submit",size:"sm",className:"shrink-0",disabled:!m.trim()||o.isPending,children:x===_.site?a("monitor.analyticsGuide.installing"):a("monitor.analyticsGuide.install")})]})]},_.id):l.jsx(Mn,{variant:"divided",lead:l.jsx(Ba,{icon:_.icon,name:_.title}),title:_.title,meta:_.site,trailing:l.jsx(Se,{size:"sm",variant:"outline",className:"shrink-0",disabled:o.isPending,onClick:()=>{u(""),o.mutate({site:_.site},{onSuccess:$=>p($.status==="needs_domain"?_.site:null)})},children:x===_.site?a("monitor.analyticsGuide.installing"):a("monitor.analyticsGuide.install")})},_.id),e[23]=f,e[24]=m,e[25]=o,e[26]=x,e[27]=a,e[28]=k):k=e[28],v=c.map(k),e[16]=f,e[17]=m,e[18]=o,e[19]=c,e[20]=x,e[21]=a,e[22]=v}else v=e[22];let b;e[29]!==v?(b=l.jsx("div",{className:lo,children:v}),e[29]=v,e[30]=b):b=e[30];let y;e[31]!==a?(y=a("monitor.analyticsGuide.manual"),e[31]=a,e[32]=y):y=e[32];let j;e[33]!==y?(j=l.jsx("p",{className:"text-xs text-muted-foreground",children:y}),e[33]=y,e[34]=j):j=e[34];let N;e[35]!==d||e[36]!==a?(N=d&&d.length>0?l.jsxs(li,{children:[l.jsx(ni,{asChild:!0,children:l.jsxs(Se,{size:"sm",variant:"ghost",className:"shrink-0 gap-1",children:[l.jsx(ks,{size:14}),a("monitor.analyticsGuide.addAnother")]})}),l.jsx(ii,{align:"end",className:"w-96",children:l.jsx(id,{projects:d})})]}):l.jsxs(Se,{size:"sm",variant:"ghost",className:"shrink-0 gap-1",onClick:Ix,children:[l.jsx(ks,{size:14}),a("monitor.analyticsGuide.addAnother")]}),e[35]=d,e[36]=a,e[37]=N):N=e[37];let w;e[38]!==j||e[39]!==N?(w=l.jsxs("div",{className:"flex items-center justify-between gap-3",children:[j,N]}),e[38]=j,e[39]=N,e[40]=w):w=e[40];let S;return e[41]!==w||e[42]!==g||e[43]!==b?(S=l.jsxs("div",{className:"flex flex-col gap-4",children:[g,b,w]}),e[41]=w,e[42]=g,e[43]=b,e[44]=S):S=e[44],S}function Ix(){return Wa("monitor")}function Ax(){return Wa("monitor")}function nc(t,e){return Array.from({length:24},(s,n)=>{const i=Math.max(.15,Math.sin((n-5)/24*Math.PI*2)),r=Math.round(t*i*(1+e*(n%3)));return{bucket:`2026-01-01 ${String(n).padStart(2,"0")}:00:00`,requests:r,pageviews:Math.round(r/26),bandwidth_bytes:r*28e3,cache_hit_ratio:.82+i*.06}})}function Vr(t,e,s){const n=nc(e,s),i=nc(e*.9,s/2),r=a=>oa(a.map(o=>({total_requests:o.requests,total_bandwidth_bytes:o.bandwidth_bytes,cache_hit_ratio:o.cache_hit_ratio,avg_latency_ms:42,status_2xx_count:o.requests,status_4xx_count:0,status_5xx_count:0,unique_countries:12,pageviews:o.pageviews})));return{id:t,name:t,summary:r(n),previous:r(i),series:n.map(a=>a.pageviews),previousSeries:i.map(a=>a.pageviews),timeline:n,previousTimeline:i}}const Ln=[Vr("Site",42e3,.06),Vr("App",15e3,.04),Vr("Blog",3800,.02)],Lx={summary:oa(Ln.map(t=>t.summary)),previous:oa(Ln.flatMap(t=>t.previous?[t.previous]:[])),timeline:Xo(Ln.map(t=>t.timeline)),previousTimeline:Xo(Ln.map(t=>t.previousTimeline)),sites:Ln};function no(){const t=O.c(4),e=ie();let s;t[0]!==e?(s=e("monitor.chart.today"),t[0]=e,t[1]=s):s=t[1];let n;return t[2]!==s?(n=l.jsx(gx,{data:{...Lx,currentLabel:s}}),t[2]=s,t[3]=n):n=t[3],n}function rd(t){const e=O.c(18),{projects:s,onProject:n,children:i}=t,r=ie(),{org:a}=He();let o;e[0]!==r?(o=r("monitor.deco.pickProject"),e[0]=r,e[1]=o):o=e[1];let c;e[2]!==a.slug?(c=Ss(a.slug,null),e[2]=a.slug,e[3]=c):c=e[3];let d;if(e[4]!==n||e[5]!==s||e[6]!==r){let f;e[8]!==n||e[9]!==r?(f=(p,x)=>l.jsx(Mn,{variant:"divided",lead:l.jsx(Ba,{icon:p.icon,name:p.title}),title:p.title,meta:p.site,trailing:l.jsx(Se,{size:"sm",variant:x===0?"default":"outline",className:"shrink-0",onClick:()=>n(p.id),children:r("monitor.pickProject.open")})},p.id),e[8]=n,e[9]=r,e[10]=f):f=e[10],d=s.map(f),e[4]=n,e[5]=s,e[6]=r,e[7]=d}else d=e[7];let m;e[11]!==d?(m=l.jsx("div",{className:lo,children:d}),e[11]=d,e[12]=m):m=e[12];let u;return e[13]!==i||e[14]!==o||e[15]!==c||e[16]!==m?(u=l.jsx(Ds,{kind:"analytics",title:o,link:c,guide:m,children:i}),e[13]=i,e[14]=o,e[15]=c,e[16]=m,e[17]=u):u=e[17],u}function io(){const t=O.c(26),e=ie(),{org:s}=He();let n;t[0]!==e?(n=e("monitor.analyticsSoon.title"),t[0]=e,t[1]=n):n=t[1];let i;t[2]!==s.slug?(i=Ss(s.slug,null),t[2]=s.slug,t[3]=i):i=t[3];let r;t[4]!==e?(r=e("monitor.audience.source.decoAnalytics"),t[4]=e,t[5]=r):r=t[5];let a;t[6]!==r?(a=l.jsx(vr,{icon:"/logos/deco%20logo.svg",name:r,size:"xs",fit:"contain"}),t[6]=r,t[7]=a):a=t[7];let o;t[8]!==e?(o=e("monitor.audience.source.decoAnalytics"),t[8]=e,t[9]=o):o=t[9];let c;t[10]!==e?(c=e("monitor.analyticsSoon.powers"),t[10]=e,t[11]=c):c=t[11];let d;t[12]!==e?(d=e("monitor.analyticsSoon.badge"),t[12]=e,t[13]=d):d=t[13];let m;t[14]!==d?(m=l.jsx(Ye,{variant:"outline",className:"shrink-0",children:d}),t[14]=d,t[15]=m):m=t[15];let u;t[16]!==a||t[17]!==o||t[18]!==c||t[19]!==m?(u=l.jsx("div",{children:l.jsx(Mn,{variant:"divided",lead:a,title:o,meta:c,trailing:m})}),t[16]=a,t[17]=o,t[18]=c,t[19]=m,t[20]=u):u=t[20];let f;t[21]===Symbol.for("react.memo_cache_sentinel")?(f=l.jsx(no,{}),t[21]=f):f=t[21];let p;return t[22]!==n||t[23]!==i||t[24]!==u?(p=l.jsx(Ds,{kind:"analytics",title:n,link:i,guide:u,children:f}),t[22]=n,t[23]=i,t[24]=u,t[25]=p):p=t[25],p}function ad(t,e){return`/api/${t}/hosting/${encodeURIComponent(e.analyticsSite)}`}function Dx(t,e){return{queryKey:Qe.analyticsStatus(t,e.analyticsSite),queryFn:async()=>await ai(`${ad(t,e)}/analytics/status`),retry:!1,staleTime:3e4}}function jr(t,e,s){const n=O.c(6),i=s===void 0?!0:s;let r;n[0]!==t||n[1]!==e?(r=Dx(t,e),n[0]=t,n[1]=e,n[2]=r):r=n[2];let a;return n[3]!==i||n[4]!==r?(a={...r,enabled:i},n[3]=i,n[4]=r,n[5]=a):a=n[5],ts(a)}function od(t){const e=O.c(19),{orgSlug:s,project:n,status:i,open:r,onOpenChange:a}=t,o=ie();let c;e[0]!==o?(c=o("mainPanelTabs.analyticsTab.configSectionTitle"),e[0]=o,e[1]=c):c=e[1];let d;e[2]!==c?(d=l.jsx(_n,{children:l.jsx($n,{children:c})}),e[2]=c,e[3]=d):d=e[3];let m;e[4]!==s||e[5]!==n?(m=ad(s,n),e[4]=s,e[5]=n,e[6]=m):m=e[6];let u;e[7]!==s||e[8]!==n.analyticsSite||e[9]!==i||e[10]!==m?(u=l.jsx($p,{base:m,orgSlug:s,site:n.analyticsSite,status:i}),e[7]=s,e[8]=n.analyticsSite,e[9]=i,e[10]=m,e[11]=u):u=e[11];let f;e[12]!==d||e[13]!==u?(f=l.jsxs(Tn,{className:"max-h-[85vh] overflow-y-auto sm:max-w-lg",children:[d,u]}),e[12]=d,e[13]=u,e[14]=f):f=e[14];let p;return e[15]!==a||e[16]!==r||e[17]!==f?(p=l.jsx(Pn,{open:r,onOpenChange:a,children:f}),e[15]=a,e[16]=r,e[17]=f,e[18]=p):p=e[18],p}function cd(t){const e=O.c(6),{onClick:s}=t,n=ie();let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=l.jsx(g1,{size:14}),e[0]=i):i=e[0];let r;e[1]!==n?(r=n("mainPanelTabs.analyticsTab.configSectionTitle"),e[1]=n,e[2]=r):r=e[2];let a;return e[3]!==s||e[4]!==r?(a=l.jsxs(Se,{variant:"outline",size:"sm",className:"font-normal",onClick:s,children:[i,r]}),e[3]=s,e[4]=r,e[5]=a):a=e[5],a}const ma=["is","not","has","starts"],ua=["path","source","channel","utmSource","utmMedium","utmCampaign","country","region","city","device","browser","os","name","prop","exp","flag"],Ox={filters:[]};function ro(t){return`${t.d}:${t.op}:${t.v}`}function Rx(t){const[e,s,...n]=t.split(":"),i=n.join(":"),r=ua.find(o=>o===e),a=ma.find(o=>o===s);return r&&a&&i?{d:r,op:a,v:i}:null}function qr(t,e){return t.d===e.d&&t.op===e.op&&t.v===e.v}function Fx(t){const e=new URLSearchParams;for(const s of t.filters)e.append("f",ro(s));return t.currency&&e.set("currency",t.currency),t.prop&&e.set("prop",t.prop),e}function zx(t){const e=t.f,s=Array.isArray(e)?e:typeof e=="string"?[e]:[],n=i=>typeof i=="string"&&i?i:void 0;return{filters:s.flatMap(i=>{const r=typeof i=="string"?Rx(i):null;return r?[r]:[]}),currency:n(t.currency),prop:n(t.prop)}}const Vx=["f","currency","prop"];function In(){const t=O.c(20);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e={strict:!1},t[0]=e):e=t[0];const s=fr(e),n=Cn();let i;t[1]!==s?(i=zx(s),t[1]=s,t[2]=i):i=t[2];const r=i;let a;t[3]!==n?(a=p=>{n({to:".",search:x=>({...x,f:p.filters.length?p.filters.map(ro):void 0,currency:p.currency||void 0,prop:p.prop||void 0})})},t[3]=n,t[4]=a):a=t[4];const o=a;let c,d;t[5]!==r||t[6]!==o?(c=p=>o({...r,...p}),d=p=>o({...r,filters:r.filters.some(x=>qr(x,p))?r.filters.filter(x=>!qr(x,p)):[...r.filters,p]}),t[5]=r,t[6]=o,t[7]=c,t[8]=d):(c=t[7],d=t[8]);let m;t[9]!==r?(m=p=>r.filters.some(x=>qr(x,p)),t[9]=r,t[10]=m):m=t[10];let u;t[11]!==r||t[12]!==o?(u=()=>o({...r,filters:[]}),t[11]=r,t[12]=o,t[13]=u):u=t[13];let f;return t[14]!==r||t[15]!==c||t[16]!==d||t[17]!==m||t[18]!==u?(f={segment:r,setSegment:c,toggleFilter:d,hasFilter:m,clearFilters:u},t[14]=r,t[15]=c,t[16]=d,t[17]=m,t[18]=u,t[19]=f):f=t[19],f}function yr(t){const e=O.c(18),s=t.view==="live";let n,i,r;if(e[0]!==t.orgSlug||e[1]!==t.range||e[2]!==t.segment||e[3]!==t.site||e[4]!==t.view){const u=Fx(t.segment);u.set("view",t.view),u.set("range",t.range),n=u.toString(),r=ts,i=Qe.analyticsView(t.orgSlug,t.site,n),e[0]=t.orgSlug,e[1]=t.range,e[2]=t.segment,e[3]=t.site,e[4]=t.view,e[5]=n,e[6]=i,e[7]=r}else n=e[5],i=e[6],r=e[7];let a;e[8]!==t.orgSlug||e[9]!==t.site||e[10]!==n?(a=async()=>await ai(`/api/${t.orgSlug}/hosting/${encodeURIComponent(t.site)}/analytics/data?${n}`),e[8]=t.orgSlug,e[9]=t.site,e[10]=n,e[11]=a):a=e[11];const o=t.enabled??!0,c=s?0:3e4,d=s?5e3:!1;let m;return e[12]!==i||e[13]!==a||e[14]!==o||e[15]!==c||e[16]!==d?(m={queryKey:i,queryFn:a,enabled:o,retry:!1,staleTime:c,refetchInterval:d,placeholderData:qx},e[12]=i,e[13]=a,e[14]=o,e[15]=c,e[16]=d,e[17]=m):m=e[17],r(m)}function qx(t){return t}function Kx(t){const e=O.c(14);let s;e[0]!==t.dim||e[1]!==t.orgSlug||e[2]!==t.range||e[3]!==t.site?(s=Qe.analyticsValues(t.orgSlug,t.site,t.dim??"",t.range),e[0]=t.dim,e[1]=t.orgSlug,e[2]=t.range,e[3]=t.site,e[4]=s):s=e[4];let n;e[5]!==t.dim||e[6]!==t.orgSlug||e[7]!==t.range||e[8]!==t.site?(n=async()=>(await ai(`/api/${t.orgSlug}/hosting/${encodeURIComponent(t.site)}/analytics/values?dim=${t.dim}&range=${encodeURIComponent(t.range)}`)).values??[],e[5]=t.dim,e[6]=t.orgSlug,e[7]=t.range,e[8]=t.site,e[9]=n):n=e[9];const i=!!t.dim;let r;return e[10]!==s||e[11]!==n||e[12]!==i?(r={queryKey:s,queryFn:n,enabled:i,retry:!1,staleTime:6e4},e[10]=s,e[11]=n,e[12]=i,e[13]=r):r=e[13],ts(r)}function ao(t,e){switch(t){case"path":return e("monitor.analytics.filters.dim.path");case"source":return e("monitor.analytics.filters.dim.source");case"channel":return e("monitor.analytics.filters.dim.channel");case"utmSource":return e("monitor.analytics.filters.dim.utmSource");case"utmMedium":return e("monitor.analytics.filters.dim.utmMedium");case"utmCampaign":return e("monitor.analytics.filters.dim.utmCampaign");case"country":return e("monitor.analytics.filters.dim.country");case"region":return e("monitor.analytics.filters.dim.region");case"city":return e("monitor.analytics.filters.dim.city");case"device":return e("monitor.analytics.filters.dim.device");case"browser":return e("monitor.analytics.filters.dim.browser");case"os":return e("monitor.analytics.filters.dim.os");case"name":return e("monitor.analytics.filters.dim.name");case"prop":return e("monitor.analytics.filters.dim.prop");case"exp":return e("monitor.analytics.filters.dim.exp");case"flag":return e("monitor.analytics.filters.dim.flag");default:return t}}function oo(t,e){switch(t){case"is":return e("monitor.analytics.filters.op.is");case"not":return e("monitor.analytics.filters.op.not");case"has":return e("monitor.analytics.filters.op.has");case"starts":return e("monitor.analytics.filters.op.starts");default:return t}}function Bx(t,e){return`${ao(t.d,e)} ${oo(t.op,e)} ${t.v}`}const Hx=Jt({currencies:Ms(Jt({k:Ct(),revenue:s1().catch(0)})).catch([]),currency:Ct().nullish().catch(null)});function Wx(t){const e=O.c(102),{orgSlug:s,site:n,range:i,onApply:r}=t,a=ie(),[o,c]=Z.useState("path"),[d,m]=Z.useState("is"),[u,f]=Z.useState("");let p;e[0]!==o||e[1]!==s||e[2]!==i||e[3]!==n?(p={orgSlug:s,site:n,dim:o,range:i},e[0]=o,e[1]=s,e[2]=i,e[3]=n,e[4]=p):p=e[4];const x=Kx(p);let h,g,v,b,y,j,N,w,S,k,_,$;if(e[5]!==o||e[6]!==r||e[7]!==d||e[8]!==x.data||e[9]!==x.isLoading||e[10]!==a||e[11]!==u){_=u.trim();let z;e[24]!==o||e[25]!==r||e[26]!==d?(z=ae=>{ae.trim()&&r({d:o,op:d,v:ae.trim()})},e[24]=o,e[25]=r,e[26]=d,e[27]=z):z=e[27],v=z;let R;e[28]!==x.data?(R=x.data??[],e[28]=x.data,e[29]=R):R=e[29],$=R;const V=_!==""&&!$.some(ae=>ae.k===_);S="flex flex-col gap-3";let K;e[30]===Symbol.for("react.memo_cache_sentinel")?(K=ae=>{const fe=ua.find(de=>de===ae);fe&&(c(fe),f(""))},e[30]=K):K=e[30];let U;e[31]!==a?(U=a("monitor.analytics.filters.field"),e[31]=a,e[32]=U):U=e[32];let q;e[33]===Symbol.for("react.memo_cache_sentinel")?(q=l.jsx(er,{}),e[33]=q):q=e[33];let L;e[34]!==U?(L=l.jsx(Ji,{size:"sm","aria-label":U,className:"flex-1",children:q}),e[34]=U,e[35]=L):L=e[35];let B;e[36]!==a?(B=ua.map(ae=>l.jsx(sr,{value:ae,children:ao(ae,a)},ae)),e[36]=a,e[37]=B):B=e[37];let Y;e[38]!==B?(Y=l.jsx(tr,{children:B}),e[38]=B,e[39]=Y):Y=e[39];let J;e[40]!==o||e[41]!==L||e[42]!==Y?(J=l.jsxs(Zi,{value:o,onValueChange:K,children:[L,Y]}),e[40]=o,e[41]=L,e[42]=Y,e[43]=J):J=e[43];let X;e[44]===Symbol.for("react.memo_cache_sentinel")?(X=ae=>{const fe=ma.find(de=>de===ae);fe&&m(fe)},e[44]=X):X=e[44];let ee;e[45]!==a?(ee=a("monitor.analytics.filters.operator"),e[45]=a,e[46]=ee):ee=e[46];let te;e[47]===Symbol.for("react.memo_cache_sentinel")?(te=l.jsx(er,{}),e[47]=te):te=e[47];let D;e[48]!==ee?(D=l.jsx(Ji,{size:"sm","aria-label":ee,children:te}),e[48]=ee,e[49]=D):D=e[49];let W;e[50]!==a?(W=ma.map(ae=>l.jsx(sr,{value:ae,children:oo(ae,a)},ae)),e[50]=a,e[51]=W):W=e[51];let G;e[52]!==W?(G=l.jsx(tr,{children:W}),e[52]=W,e[53]=G):G=e[53];let Q;e[54]!==d||e[55]!==D||e[56]!==G?(Q=l.jsxs(Zi,{value:d,onValueChange:X,children:[D,G]}),e[54]=d,e[55]=D,e[56]=G,e[57]=Q):Q=e[57],e[58]!==J||e[59]!==Q?(k=l.jsxs("div",{className:"flex gap-2",children:[J,Q]}),e[58]=J,e[59]=Q,e[60]=k):k=e[60],g=Bu,N="bg-transparent";let re;e[61]!==a?(re=a("monitor.analytics.filters.value"),e[61]=a,e[62]=re):re=e[62];let ce;e[63]!==a?(ce=a("monitor.analytics.filters.search"),e[63]=a,e[64]=ce):ce=e[64],e[65]!==re||e[66]!==ce||e[67]!==u?(w=l.jsx(Hu,{size:"sm",variant:"boxed","aria-label":re,placeholder:ce,value:u,onValueChange:f}),e[65]=re,e[66]=ce,e[67]=u,e[68]=w):w=e[68],h=Wu,b="mt-1 max-h-60",e[69]!==x.isLoading||e[70]!==a?(y=!x.isLoading&&l.jsx(Ku,{className:"text-meta px-2 py-3 text-center",children:a("monitor.analytics.filters.noValues")}),e[69]=x.isLoading,e[70]=a,e[71]=y):y=e[71],j=V&&l.jsx($o,{value:_,onSelect:()=>v(_),children:l.jsx("span",{className:"truncate",children:a("monitor.analytics.filters.use",{value:_})})}),e[5]=o,e[6]=r,e[7]=d,e[8]=x.data,e[9]=x.isLoading,e[10]=a,e[11]=u,e[12]=h,e[13]=g,e[14]=v,e[15]=b,e[16]=y,e[17]=j,e[18]=N,e[19]=w,e[20]=S,e[21]=k,e[22]=_,e[23]=$}else h=e[12],g=e[13],v=e[14],b=e[15],y=e[16],j=e[17],N=e[18],w=e[19],S=e[20],k=e[21],_=e[22],$=e[23];let T;if(e[72]!==v||e[73]!==$){let z;e[75]!==v?(z=R=>l.jsxs($o,{value:R.k,onSelect:()=>v(R.k),children:[l.jsx("span",{className:"min-w-0 flex-1 truncate",children:R.k}),l.jsx("span",{className:"text-meta tnum",children:R.n.toLocaleString()})]},R.k),e[75]=v,e[76]=z):z=e[76],T=$.map(z),e[72]=v,e[73]=$,e[74]=T}else T=e[74];let P;e[77]!==h||e[78]!==b||e[79]!==y||e[80]!==j||e[81]!==T?(P=l.jsxs(h,{className:b,children:[y,j,T]}),e[77]=h,e[78]=b,e[79]=y,e[80]=j,e[81]=T,e[82]=P):P=e[82];let I;e[83]!==g||e[84]!==P||e[85]!==N||e[86]!==w?(I=l.jsxs(g,{className:N,children:[w,P]}),e[83]=g,e[84]=P,e[85]=N,e[86]=w,e[87]=I):I=e[87];const C=!_;let M;e[88]!==v||e[89]!==_?(M=()=>v(_),e[88]=v,e[89]=_,e[90]=M):M=e[90];let A;e[91]!==a?(A=a("monitor.analytics.filters.apply"),e[91]=a,e[92]=A):A=e[92];let F;e[93]!==C||e[94]!==M||e[95]!==A?(F=l.jsx(Se,{size:"sm",disabled:C,onClick:M,children:A}),e[93]=C,e[94]=M,e[95]=A,e[96]=F):F=e[96];let E;return e[97]!==I||e[98]!==F||e[99]!==S||e[100]!==k?(E=l.jsxs("div",{className:S,children:[k,I,F]}),e[97]=I,e[98]=F,e[99]=S,e[100]=k,e[101]=E):E=e[101],E}function Ux(t){const e=O.c(33),{orgSlug:s,site:n,range:i,segment:r}=t,a=ie(),{setSegment:o,hasFilter:c,toggleFilter:d}=In(),[m,u]=Z.useState(!1);let f;e[0]!==s||e[1]!==i||e[2]!==r||e[3]!==n?(f={orgSlug:s,site:n,view:"overview",range:i,segment:r},e[0]=s,e[1]=i,e[2]=r,e[3]=n,e[4]=f):f=e[4];const p=yr(f);let x;if(e[5]!==c||e[6]!==m||e[7]!==s||e[8]!==i||e[9]!==r.currency||e[10]!==o||e[11]!==n||e[12]!==a||e[13]!==d||e[14]!==p.data?.data){const h=Hx.safeParse(p.data?.data??{}),g=h.success?h.data:{currencies:[],currency:null},v=g.currencies.filter(Yx),b=r.currency??g.currency??v[0]?.k;let y;e[16]===Symbol.for("react.memo_cache_sentinel")?(y=l.jsx(m1,{size:14,className:"text-muted-foreground"}),e[16]=y):y=e[16];let j;e[17]!==a?(j=a("monitor.analytics.filters.add"),e[17]=a,e[18]=j):j=e[18];let N;e[19]!==j?(N=l.jsx(ni,{asChild:!0,children:l.jsxs(Se,{variant:"outline",size:"sm",className:"gap-1.5 font-normal",children:[y,j]})}),e[19]=j,e[20]=N):N=e[20];let w;e[21]!==c||e[22]!==d?(w=_=>{c(_)||d(_),u(!1)},e[21]=c,e[22]=d,e[23]=w):w=e[23];let S;e[24]!==s||e[25]!==i||e[26]!==n||e[27]!==w?(S=l.jsx(ii,{align:"end",className:"w-80 p-3",children:l.jsx(Wx,{orgSlug:s,site:n,range:i,onApply:w})}),e[24]=s,e[25]=i,e[26]=n,e[27]=w,e[28]=S):S=e[28];let k;e[29]!==m||e[30]!==N||e[31]!==S?(k=l.jsxs(li,{open:m,onOpenChange:u,children:[N,S]}),e[29]=m,e[30]=N,e[31]=S,e[32]=k):k=e[32],x=l.jsxs(l.Fragment,{children:[k,v.length>1&&b&&l.jsx(ns,{label:a("monitor.analytics.filters.currency"),value:b,options:v.map(Gx),onChange:_=>o({currency:_})})]}),e[5]=c,e[6]=m,e[7]=s,e[8]=i,e[9]=r.currency,e[10]=o,e[11]=n,e[12]=a,e[13]=d,e[14]=p.data?.data,e[15]=x}else x=e[15];return x}function Gx(t){return{value:t.k,label:t.k}}function Yx(t){return t.k!=="(none)"&&t.revenue>0}function dd(){const t=O.c(14),e=ie(),{segment:s,toggleFilter:n,clearFilters:i}=In();if(s.filters.length===0)return null;let r;if(t[0]!==s.filters||t[1]!==e||t[2]!==n){let c;t[4]!==e||t[5]!==n?(c=d=>l.jsxs(Ye,{size:"segmented",className:"text-sm",children:[l.jsx("span",{className:"pl-2.5 text-muted-foreground",children:ao(d.d,e)}),l.jsx("span",{className:"px-1 text-muted-foreground",children:oo(d.op,e)}),l.jsx("span",{className:"max-w-64 truncate pr-1 font-medium text-foreground",children:d.v}),l.jsx("button",{type:"button","aria-label":e("monitor.analytics.filters.remove",{filter:Bx(d,e)}),onClick:()=>n(d),className:"focus-ring flex h-full items-center rounded-r-lg px-1.5 text-muted-foreground transition-colors hover:bg-accent hover:text-foreground",children:l.jsx(Lm,{size:14})})]},ro(d)),t[4]=e,t[5]=n,t[6]=c):c=t[6],r=s.filters.map(c),t[0]=s.filters,t[1]=e,t[2]=n,t[3]=r}else r=t[3];let a;t[7]!==i||t[8]!==s.filters.length||t[9]!==e?(a=s.filters.length>1&&l.jsx(Se,{variant:"ghost",size:"sm",className:"font-normal text-muted-foreground",onClick:i,children:e("monitor.analytics.filters.clear")}),t[7]=i,t[8]=s.filters.length,t[9]=e,t[10]=a):a=t[10];let o;return t[11]!==r||t[12]!==a?(o=l.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[r,a]}),t[11]=r,t[12]=a,t[13]=o):o=t[13],o}function md(){const t=O.c(3),{toggleFilter:e,hasFilter:s}=In();let n;return t[0]!==s||t[1]!==e?(n=(i,r)=>{const a={d:i,op:"is",v:r};return{role:"button",tabIndex:0,"aria-pressed":s(a),onClick:()=>e(a),onKeyDown:o=>{(o.key==="Enter"||o.key===" ")&&(o.preventDefault(),e(a))}}},t[0]=s,t[1]=e,t[2]=n):n=t[2],n}function Ve(t,e){const s=t?.[e];return Array.isArray(s)?s.filter(n=>typeof n=="object"&&n!==null):[]}function fn(t,e){return Ve(t,e)[0]??null}function qe(t){if(t==null||t==="")return null;const e=Number(t);return Number.isFinite(e)?e:null}const gt=t=>qe(t)??0,tt=t=>t==null?"":String(t);function Ot(t){return t.map(e=>({k:tt(e.k),n:gt(e.n)}))}function wr(t,e){const s=O.c(10);let n;s[0]!==t.orgSlug||s[1]!==t.range||s[2]!==t.segment||s[3]!==t.site||s[4]!==e?(n={orgSlug:t.orgSlug,site:t.site,view:e,range:t.range,segment:t.segment},s[0]=t.orgSlug,s[1]=t.range,s[2]=t.segment,s[3]=t.site,s[4]=e,s[5]=n):n=s[5];const i=yr(n),r=i.data?.data;let a;return s[6]!==i.error||s[7]!==i.isLoading||s[8]!==r?(a={data:r,isLoading:i.isLoading,error:i.error},s[6]=i.error,s[7]=i.isLoading,s[8]=r,s[9]=a):a=s[9],a}function Qx(t){const e=typeof t?.currency=="string"?t.currency:null,s=Array.isArray(t?.goals)?t.goals:[],n=typeof t?.goal=="string"?t.goal:"purchase",i=s.find(r=>typeof r=="object"&&r!==null&&"id"in r&&r.id===n);return{currency:e,hasRevenue:i?!!i.revenue:!0}}function ze(t){const e=qe(t);return e===null?"—":new Intl.NumberFormat().format(Math.round(e))}function Os(t,e=1){return t===null||!Number.isFinite(t)?"—":`${new Intl.NumberFormat(void 0,{minimumFractionDigits:e,maximumFractionDigits:e}).format(t)}%`}function Xx(t,e){return e>0?100*t/e:null}function Zx(t,e,s=0){const n=qe(t);if(n===null)return"—";if(!e)return new Intl.NumberFormat(void 0,{maximumFractionDigits:2}).format(n);try{return new Intl.NumberFormat(void 0,{style:"currency",currency:e,maximumFractionDigits:s}).format(n)}catch{return`${new Intl.NumberFormat().format(Math.round(n))} ${e}`}}function Jx(t){const e=qe(t);if(e===null)return"—";const s=Math.round(e),n=Math.floor(s/60),i=s%60;return n>0?`${n}m ${i}s`:`${i}s`}function ud(t){const e=qe(t);return e===null?"—":e>=1e3?`${new Intl.NumberFormat(void 0,{maximumFractionDigits:2}).format(e/1e3)} s`:`${Math.round(e)} ms`}function eh(t){const e=tt(t);if(!e)return null;const s=e.length===10?`${e}T00:00:00Z`:`${e.replace(" ","T")}Z`,n=new Date(s);return Number.isNaN(n.getTime())?null:n}function fd(t){const e=eh(t);return e?t.length>10?e.toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit"}):e.toLocaleDateString(void 0,{month:"short",day:"numeric"}):t}function th(t){return/^[A-Za-z]{2}$/.test(t)?String.fromCodePoint(...[...t.toUpperCase()].map(e=>127397+e.charCodeAt(0))):""}function sh(t){const e=th(t);return l.jsxs(l.Fragment,{children:[e&&l.jsxs("span",{"aria-hidden":!0,children:[e," "]}),eo(t)]})}const lh=t=>t&&t.charAt(0).toUpperCase()+t.slice(1);function Nr(t){const e=O.c(6),{tiles:s}=t,n=s===void 0?0:s;let i;e[0]!==n?(i=n>0&&l.jsx("div",{className:"grid grid-cols-2 gap-4 lg:grid-cols-5",children:Array.from({length:n},nh)}),e[0]=n,e[1]=i):i=e[1];let r;e[2]===Symbol.for("react.memo_cache_sentinel")?(r=l.jsx(Ce,{className:"h-64"}),e[2]=r):r=e[2];let a;e[3]===Symbol.for("react.memo_cache_sentinel")?(a=l.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[l.jsx(Ce,{className:"h-56"}),l.jsx(Ce,{className:"h-56"})]}),e[3]=a):a=e[3];let o;return e[4]!==i?(o=l.jsxs(l.Fragment,{children:[i,r,a]}),e[4]=i,e[5]=o):o=e[5],o}function nh(t,e){return l.jsx(Ce,{className:"h-28"},e)}function kr(t){const e=O.c(6),{error:s}=t,n=ie();let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=l.jsx(jn,{size:20}),e[0]=i):i=e[0];let r;e[1]!==n?(r=n("monitor.analytics.panels.error"),e[1]=n,e[2]=r):r=e[2];let a;return e[3]!==s.message||e[4]!==r?(a=l.jsx(Ke,{icon:i,title:r,description:s.message}),e[3]=s.message,e[4]=r,e[5]=a):a=e[5],a}function fa(t){const e=O.c(4),{icon:s,title:n,description:i}=t;let r;return e[0]!==i||e[1]!==s||e[2]!==n?(r=l.jsx("div",{className:"surface",children:l.jsx(Ke,{size:"inline",icon:s,title:n,description:i})}),e[0]=i,e[1]=s,e[2]=n,e[3]=r):r=e[3],r}function pd(){const t=O.c(4),e=ie();let s;t[0]!==e?(s=e("monitor.analytics.panels.empty"),t[0]=e,t[1]=s):s=t[1];let n;return t[2]!==s?(n=l.jsx("p",{className:"text-meta",children:s}),t[2]=s,t[3]=n):n=t[3],n}function Zn(t){const e=O.c(7),{label:s,tip:n}=t;let i;e[0]!==s?(i=l.jsx(ll,{asChild:!0,children:l.jsx(Ye,{variant:"warning",className:"cursor-default",children:s})}),e[0]=s,e[1]=i):i=e[1];let r;e[2]!==n?(r=l.jsx(nl,{className:"max-w-72",children:n}),e[2]=n,e[3]=r):r=e[3];let a;return e[4]!==i||e[5]!==r?(a=l.jsxs(il,{children:[i,r]}),e[4]=i,e[5]=r,e[6]=a):a=e[6],a}function Mt(t){const e=O.c(36),s=ie(),[n,i]=Z.useState(!1);if(!t.children||t.onClick){let j;return e[0]!==t?(j=l.jsx(Me,{...t}),e[0]=t,e[1]=j):j=e[1],j}const r=t.aside;let a;e[2]!==s?(a=s("monitor.analytics.panels.expand"),e[2]=s,e[3]=a):a=e[3];let o,c;e[4]===Symbol.for("react.memo_cache_sentinel")?(o=()=>i(!0),c=l.jsx(qu,{}),e[4]=o,e[5]=c):(o=e[4],c=e[5]);let d;e[6]!==a?(d=l.jsx(yn,{label:a,onClick:o,children:c}),e[6]=a,e[7]=d):d=e[7];let m;e[8]!==t.aside||e[9]!==d?(m=l.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[r,d]}),e[8]=t.aside,e[9]=d,e[10]=m):m=e[10];let u;e[11]!==t||e[12]!==m?(u=l.jsx(Me,{...t,aside:m}),e[11]=t,e[12]=m,e[13]=u):u=e[13];let f;e[14]!==t.title?(f=l.jsx($n,{className:"text-sm font-normal text-foreground/70",children:t.title}),e[14]=t.title,e[15]=f):f=e[15];let p;e[16]!==t.value?(p=t.value!==void 0&&l.jsx("span",{className:"tnum text-4xl font-normal text-foreground",children:t.value}),e[16]=t.value,e[17]=p):p=e[17];let x;e[18]!==t.caption||e[19]!==f||e[20]!==p?(x=l.jsxs("div",{className:"flex min-w-0 flex-col gap-1",children:[f,p,t.caption]}),e[18]=t.caption,e[19]=f,e[20]=p,e[21]=x):x=e[21];let h;e[22]!==t.aside||e[23]!==x?(h=l.jsxs(_n,{className:"flex-row items-start justify-between gap-4 pr-10",children:[x,t.aside]}),e[22]=t.aside,e[23]=x,e[24]=h):h=e[24];let g;e[25]!==t.children?(g=l.jsx("div",{className:"min-h-0 flex-1 overflow-auto [&_[data-slot=chart]]:h-[min(60vh,40rem)]!",children:t.children}),e[25]=t.children,e[26]=g):g=e[26];let v;e[27]!==h||e[28]!==g?(v=l.jsxs(Tn,{"aria-describedby":void 0,className:"flex h-[90vh] flex-col gap-6 sm:max-w-[min(1400px,calc(100%-4rem))]",children:[h,g]}),e[27]=h,e[28]=g,e[29]=v):v=e[29];let b;e[30]!==n||e[31]!==v?(b=l.jsx(Pn,{open:n,onOpenChange:i,children:v}),e[30]=n,e[31]=v,e[32]=b):b=e[32];let y;return e[33]!==b||e[34]!==u?(y=l.jsxs(l.Fragment,{children:[u,b]}),e[33]=b,e[34]=u,e[35]=y):y=e[35],y}function dn(t){const e=O.c(5),{title:s,children:n}=t;let i;e[0]!==s?(i=l.jsx("h2",{className:"text-sm font-medium text-foreground",children:s}),e[0]=s,e[1]=i):i=e[1];let r;return e[2]!==n||e[3]!==i?(r=l.jsxs("section",{className:"flex flex-col gap-3 pt-2",children:[i,n]}),e[2]=n,e[3]=i,e[4]=r):r=e[4],r}function ih(t){const e=O.c(33),{current:s,previous:n,covered:i,better:r,points:a}=t,o=a===void 0?!1:a,c=ie();if(s===null||n===null)return null;if(i!==null&&i<.9){let j;e[0]!==i||e[1]!==c?(j=c("monitor.analytics.panels.prev.partial",{pct:Math.round(100*i)}),e[0]=i,e[1]=c,e[2]=j):j=e[2];let N;e[3]!==c?(N=c("monitor.analytics.panels.prev.partialTip"),e[3]=c,e[4]=N):N=e[4];let w;return e[5]!==j||e[6]!==N?(w=l.jsx(Zn,{label:j,tip:N}),e[5]=j,e[6]=N,e[7]=w):w=e[7],w}if(!o&&!n)return null;const d=o?s-n:100*(s-n)/n;let m,u,f;if(e[8]!==r||e[9]!==d||e[10]!==o||e[11]!==c){u=Symbol.for("react.early_return_sentinel");e:{const j=Math.round(d);if(j===0){let S;e[15]!==c?(S=c("monitor.analytics.panels.prev.flat"),e[15]=c,e[16]=S):S=e[16];let k;e[17]!==S?(k=l.jsx("span",{className:"text-meta",children:S}),e[17]=S,e[18]=k):k=e[18],u=k;break e}const N=d/100;let w;e[19]!==r||e[20]!==N?(w=oi(N,r),e[19]=r,e[20]=N,e[21]=w):w=e[21],f=w,m=o?c("monitor.analytics.panels.prev.points",{n:`${j>0?"+":"−"}${Math.abs(j)}`}):`${j>0?"+":"−"}${Math.abs(j)}%`}e[8]=r,e[9]=d,e[10]=o,e[11]=c,e[12]=m,e[13]=u,e[14]=f}else m=e[12],u=e[13],f=e[14];if(u!==Symbol.for("react.early_return_sentinel"))return u;const p=m,x=f==="good"&&"text-success",h=f==="bad"&&"text-destructive";let g;e[22]!==x||e[23]!==h?(g=ye("font-medium",x,h),e[22]=x,e[23]=h,e[24]=g):g=e[24];let v;e[25]!==g||e[26]!==p?(v=l.jsx("span",{className:g,children:p}),e[25]=g,e[26]=p,e[27]=v):v=e[27];let b;e[28]!==c?(b=c("monitor.analytics.panels.prev.vsPrior"),e[28]=c,e[29]=b):b=e[29];let y;return e[30]!==v||e[31]!==b?(y=l.jsxs("span",{className:"text-meta tnum inline-flex items-center gap-1",children:[v,b]}),e[30]=v,e[31]=b,e[32]=y):y=e[32],y}function ht(t){const e=O.c(10);let s,n,i;e[0]!==t?({title:i,aside:s,...n}=t,e[0]=t,e[1]=s,e[2]=n,e[3]=i):(s=e[1],n=e[2],i=e[3]);let r;e[4]!==n?(r=l.jsx(rh,{...n}),e[4]=n,e[5]=r):r=e[5];let a;return e[6]!==s||e[7]!==r||e[8]!==i?(a=l.jsx(Mt,{title:i,aside:s,children:r}),e[6]=s,e[7]=r,e[8]=i,e[9]=a):a=e[9],a}function rh(t){const e=O.c(41),{rows:s,dim:n,filterValue:i,label:r,extra:a,format:o,dot:c,limit:d,expandable:m,share:u}=t,f=o===void 0?ze:o,p=d===void 0?8:d,x=m===void 0?!0:m,h=u===void 0?!0:u,g=ie(),v=md(),[b,y]=Z.useState(!1);let j,N,w,S,k;if(e[0]!==b||e[1]!==n||e[2]!==c||e[3]!==a||e[4]!==i||e[5]!==f||e[6]!==r||e[7]!==p||e[8]!==v||e[9]!==s||e[10]!==h){k=Symbol.for("react.early_return_sentinel");e:{j=s.filter(dh);const P=b?j:j.slice(0,p),I=Math.max(1,...P.map(ch)),C=s.reduce(oh,0);if(P.length===0){let A;e[16]===Symbol.for("react.memo_cache_sentinel")?(A=l.jsx(pd,{}),e[16]=A):A=e[16],k=A;break e}S="flex flex-col gap-2",N="flex flex-col gap-1";let M;e[17]!==n||e[18]!==c||e[19]!==a||e[20]!==i||e[21]!==f||e[22]!==r||e[23]!==I||e[24]!==v||e[25]!==h||e[26]!==C?(M=A=>{const F=n?v(n,i?i(A.k):A.k):null;return l.jsxs("li",{...F,className:ye("group relative flex items-center rounded-md",F&&"focus-ring cursor-pointer hover:bg-accent/60 aria-pressed:bg-accent"),children:[l.jsx("span",{className:"surface-inset absolute inset-y-0 left-0 group-aria-pressed:bg-foreground/10",style:{width:`${A.n/I*100}%`}}),l.jsxs("span",{className:"relative flex min-w-0 flex-1 items-center gap-1.5 px-2 py-1 text-sm text-foreground",children:[c&&l.jsx("span",{className:ye("size-2 shrink-0 rounded-full",c(A.k))}),l.jsx("span",{className:"truncate",children:r?r(A.k):A.k}),F&&l.jsx(ti,{size:14,className:"hidden shrink-0 text-foreground group-aria-pressed:block"})]}),a&&l.jsx("span",{className:"tnum relative px-2 text-sm text-muted-foreground",children:a(A)}),h&&l.jsx("span",{className:"text-meta tnum relative w-12 shrink-0 text-right",children:C>0?Os(100*A.n/C,0):""}),l.jsx("span",{className:"tnum relative min-w-20 shrink-0 px-2 text-right text-sm whitespace-nowrap text-foreground",children:f(A.n)})]},A.k)},e[17]=n,e[18]=c,e[19]=a,e[20]=i,e[21]=f,e[22]=r,e[23]=I,e[24]=v,e[25]=h,e[26]=C,e[27]=M):M=e[27],w=P.map(M)}e[0]=b,e[1]=n,e[2]=c,e[3]=a,e[4]=i,e[5]=f,e[6]=r,e[7]=p,e[8]=v,e[9]=s,e[10]=h,e[11]=j,e[12]=N,e[13]=w,e[14]=S,e[15]=k}else j=e[11],N=e[12],w=e[13],S=e[14],k=e[15];if(k!==Symbol.for("react.early_return_sentinel"))return k;let _;e[28]!==N||e[29]!==w?(_=l.jsx("ul",{className:N,children:w}),e[28]=N,e[29]=w,e[30]=_):_=e[30];let $;e[31]!==b||e[32]!==x||e[33]!==p||e[34]!==j||e[35]!==g?($=x&&j.length>p&&l.jsx("button",{type:"button",onClick:()=>y(ah),className:"text-meta self-start px-2 hover:text-foreground",children:g(b?"mainPanelTabs.cdnTab.showLess":"mainPanelTabs.cdnTab.showAll")}),e[31]=b,e[32]=x,e[33]=p,e[34]=j,e[35]=g,e[36]=$):$=e[36];let T;return e[37]!==$||e[38]!==S||e[39]!==_?(T=l.jsxs("div",{className:S,children:[_,$]}),e[37]=$,e[38]=S,e[39]=_,e[40]=T):T=e[40],T}function ah(t){return!t}function oh(t,e){return t+e.n}function ch(t){return t.n}function dh(t){return t.k!==""}function rl(t){const e=O.c(21),{columns:s,rows:n,rowKey:i,filter:r}=t,a=md();if(n.length===0){let f;return e[0]===Symbol.for("react.memo_cache_sentinel")?(f=l.jsx(pd,{}),e[0]=f):f=e[0],f}let o;e[1]!==s?(o=s.map(mh),e[1]=s,e[2]=o):o=e[2];let c;e[3]!==o?(c=l.jsx(el,{children:l.jsx(Ut,{className:"hover:bg-transparent",children:o})}),e[3]=o,e[4]=c):c=e[4];let d;if(e[5]!==s||e[6]!==r||e[7]!==a||e[8]!==i||e[9]!==n){let f;e[11]!==s||e[12]!==r||e[13]!==a||e[14]!==i?(f=(p,x)=>{const h=r?.(p)??null,g=h?a(h.d,h.v):null;return l.jsx(Ut,{...g,className:ye("group hover:bg-transparent aria-pressed:bg-transparent",g&&"cursor-pointer outline-none"),children:s.map(v=>l.jsx(Le,{className:ye("px-2 py-2 text-sm text-foreground first:rounded-l-md last:rounded-r-md",g&&"group-hover:bg-accent/60 group-focus-visible:bg-accent/60 group-aria-pressed:bg-accent",v.numeric&&"tnum text-right",v.className),children:v.cell(p)},v.id))},i(p,x))},e[11]=s,e[12]=r,e[13]=a,e[14]=i,e[15]=f):f=e[15],d=n.map(f),e[5]=s,e[6]=r,e[7]=a,e[8]=i,e[9]=n,e[10]=d}else d=e[10];let m;e[16]!==d?(m=l.jsx(tl,{children:d}),e[16]=d,e[17]=m):m=e[17];let u;return e[18]!==c||e[19]!==m?(u=l.jsx("div",{className:"overflow-x-auto",children:l.jsxs(sl,{variant:"flush",className:"border-separate border-spacing-0",children:[c,m]})}),e[18]=c,e[19]=m,e[20]=u):u=e[20],u}function mh(t){return l.jsx(dt,{className:ye("h-8 whitespace-nowrap border-b border-border px-2 text-xs font-normal text-muted-foreground",t.numeric&&"text-right"),children:t.header},t.id)}function ci(t){const e=O.c(5),{children:s}=t;let n;e[0]!==s?(n=l.jsx("span",{className:"truncate",children:s}),e[0]=s,e[1]=n):n=e[1];let i;e[2]===Symbol.for("react.memo_cache_sentinel")?(i=l.jsx(ti,{size:14,className:"hidden shrink-0 group-aria-pressed:block"}),e[2]=i):i=e[2];let r;return e[3]!==n?(r=l.jsxs("span",{className:"flex min-w-0 items-center gap-1.5",children:[n,i]}),e[3]=n,e[4]=r):r=e[4],r}function uh(t){const e=O.c(6),{label:s,className:n,children:i}=t;let r;e[0]!==n?(r=ye("flex min-w-0 items-center gap-1",n),e[0]=n,e[1]=r):r=e[1];let a;return e[2]!==i||e[3]!==s||e[4]!==r?(a=l.jsx("div",{role:"group","aria-label":s,className:r,children:i}),e[2]=i,e[3]=s,e[4]=r,e[5]=a):a=e[5],a}function fh(t){const e=O.c(12);let s,n,i,r;e[0]!==t?({pressed:n,icon:r,className:s,...i}=t,e[0]=t,e[1]=s,e[2]=n,e[3]=i,e[4]=r):(s=e[1],n=e[2],i=e[3],r=e[4]);const o=(r===void 0?!1:r)?"icon-sm":"sm";let c;e[5]!==s?(c=ye("shrink-0",s),e[5]=s,e[6]=c):c=e[6];let d;return e[7]!==n||e[8]!==i||e[9]!==o||e[10]!==c?(d=l.jsx(Se,{...i,type:"button",variant:"tab",size:o,"aria-pressed":n,className:c}),e[7]=n,e[8]=i,e[9]=o,e[10]=c,e[11]=d):d=e[11],d}const ct=Object.assign(uh,{Item:fh}),ph=["desktop","tablet","mobile"],xh=["24h","7d","30d"],ic=["clicks","value","scroll","attention","sections"],xd=["all","rage","dead","error","first"],Te=t=>{const e=Number(t);return Number.isFinite(e)?e:0},Wt=t=>typeof t=="string"?t:String(t??""),ls=t=>Array.isArray(t)?t.filter(e=>!!e&&typeof e=="object"):[],hh=["viewed","carted","checkout","bought"],gh=t=>t==="desktop"||t==="tablet"||t==="mobile";function vh(t){const e=ls(t.hmSummary)[0]??{},s=Te(e.views),n=r=>r==null||!s?null:Te(r),i=new Map;for(const r of ls(t.hmPages)){const a=Wt(r.page_key);i.set(a,(i.get(a)??0)+Te(r.views))}return{views:s,scale:Te(e.scale)||1,clicks:Te(e.clicks),rage:Te(e.rage),dead:Te(e.dead),error:Te(e.error),avgDepth:n(e.avg_depth),avgFold:n(e.avg_fold),activeS:n(e.active_s),smallSample:Te(e.small_sample)===1,pages:[...i].map(([r,a])=>({page:r,views:a})).sort((r,a)=>a.views-r.views),devices:ls(t.hmDevices).flatMap(r=>gh(r.device)?[{device:r.device,views:Te(r.views),meanVw:Te(r.mean_vw)||null}]:[]),elements:ls(t.hmElements).map(r=>{const a=Wt(r.root),o=Wt(r.el),c={};if(r.cells&&typeof r.cells=="object")for(const[d,m]of Object.entries(r.cells))c[d]=Te(m);return{key:`${a}|${o}`,root:a,el:o,clicks:Te(r.clicks),views:Te(r.views),rage:Te(r.rage),dead:Te(r.dead),error:Te(r.error),first:Te(r.first),cells:c}}),grid:ls(t.hmGrid).map(r=>({fixed:Te(r.fixed)===1||r.fixed===!0,xb:Te(r.xb),yb:Te(r.yb),clicks:Te(r.clicks)})),scroll:ls(t.hmScroll).map(r=>({depth:Te(r.depth),views:Te(r.views),reachPct:Te(r.reach_pct)})),attention:ls(t.hmAttention).map(r=>({band:Te(r.band),ds:Te(r.ds)})),sections:ls(t.hmSections).map(r=>({root:Wt(r.root),seenViews:Te(r.seen_views),reachPct:Te(r.reach_pct),avgS:Te(r.avg_s),ctrPct:Te(r.ctr_pct),clicks:Te(r.clicks)})),value:new Map(ls(t.hmValue).map(r=>{const a=ac(r);return[a.key,a]})),valueSummary:yh(ls(t.hmValueSummary)[0]),valueLeaks:ls(t.hmValueLeaks).map(ac),valueModel:wh(t.heatmapValue),...bh(ls(t.hmFunnel))}}function bh(t){const e=new Map;let s=null;for(const n of t){const i={visitors:Te(n.visitors),viewed:Te(n.viewed),carted:Te(n.carted),checkout:Te(n.checkout),bought:Te(n.bought)};!Wt(n.root)&&Wt(n.el)==="0"?s=i.visitors?i:null:e.set(`${Wt(n.root)}|${Wt(n.el)}`,i)}return{funnel:e,pageFunnel:s}}const rc=100;function jh(t,e){const s=e.root&&t.sections.find(n=>n.root===e.root)?.seenViews||t.views;return{ctr:s?Math.min(1,e.views/s):0,seen:s}}const ac=t=>({key:`${Wt(t.root)}|${Wt(t.el)}`,clicks:Te(t.clicks),clickVisitors:Te(t.click_visitors),convVisitors:Te(t.conv_visitors),orders:Te(t.orders),revenue:Te(t.revenue),cvrPct:Te(t.cvr_pct),revPerVisitor:Te(t.rev_per_visitor),cvrIndex:Te(t.cvr_index),rpvIndex:Te(t.rpv_index),smallSample:Te(t.small_sample)===1}),yh=t=>!t||!Te(t.visitors)?null:{visitors:Te(t.visitors),convVisitors:Te(t.conv_visitors),orders:Te(t.orders),revenue:Te(t.revenue),cvrPct:Te(t.cvr_pct),revPerVisitor:Te(t.rev_per_visitor),smallSample:Te(t.small_sample)===1},wh=t=>{if(!t||typeof t!="object")return null;const e=t;return{goal:Wt(e.goal),unit:Wt(e.unit),attribution:Wt(e.attribution),windowMinutes:Te(e.windowMinutes),minSample:Te(e.minSample),summable:e.summable===!0,sampled:e.sampled!==!1,causal:e.causal===!0,currency:typeof e.currency=="string"&&e.currency?e.currency:null,supported:e.supported!==!1}};function Ts(t,e){return e==="all"?t.clicks:t[e]}function oc(t,e){if(e<=0)return 1;const s=t.find(n=>n.depth>=e);return s?s.reachPct/100:0}const Nh=[1280,1366,1440,1536,1920];function kh(t,e){return t==="mobile"?390:t==="tablet"?e&&e>=768&&e<1024?Math.round(e):820:!e||e<1024?1440:Nh.reduce((s,n)=>Math.abs(n-e)<Math.abs(s-e)?n:s)}const Sh={thermal:[[0,0,40,255,0],[.08,20,70,255,.28],[.25,0,185,255,.5],[.45,30,220,110,.62],[.65,250,232,40,.74],[.82,255,140,0,.82],[1,225,18,30,.9]],inferno:[[0,0,0,4,0],[.1,40,11,84,.3],[.3,101,21,110,.5],[.5,159,42,99,.64],[.7,212,72,66,.74],[.85,245,125,21,.84],[1,252,255,164,.92]]};function cc(t,e,s){const n=Sh[t],i=Math.min(1,Math.max(0,e)),r=Math.max(1,n.findIndex(m=>m[0]>=i)),a=n[r-1],o=n[r];if(!a||!o)return"transparent";const c=o[0]>a[0]?(i-a[0])/(o[0]-a[0]):0,d=m=>a[m]+(o[m]-a[m])*c;return`rgba(${Math.round(d(1))},${Math.round(d(2))},${Math.round(d(3))},${s??+d(4).toFixed(3)})`}function _h(t){const e=t?.trim();if(!e)return null;try{const s=new URL(/^https?:\/\//i.test(e)?e:`https://${e}`);return s.protocol==="https:"||s.hostname==="localhost"?s.origin:null}catch{return null}}function $h(t,e){if(!e.startsWith("/")||e.includes(":"))return null;const s=new URL(e,t);return s.origin!==t?null:(s.searchParams.set("dq_view","1"),s.href)}const hd=1;function Th(t,e,s){if(!e||t.source!==e||!s.includes(t.origin))return null;const n=t.data;if(!n||typeof n!="object"||n.dq!=="hm"||n.v!==hd)return null;switch(n.t){case"ready":return{t:"ready",url:Wt(n.url),anchors:Te(n.anchors)};case"placed":return Array.isArray(n.items)&&Array.isArray(n.blocks)?n:null;case"hover":return{t:"hover",key:typeof n.key=="string"?n.key:null,label:typeof n.label=="string"?n.label:null,x:typeof n.x=="number"?n.x:void 0,y:typeof n.y=="number"?n.y:void 0,pct:typeof n.pct=="number"?n.pct:void 0};case"select":return typeof n.key=="string"?{t:"select",key:n.key}:null;default:return null}}function Ph(t,e){return{mode:e.mode,elements:t.elements.flatMap(s=>{const n=Ts(s,e.type);return n>0?[{root:s.root,el:s.el,clicks:n,cells:s.cells}]:[]}),grid:e.type==="all"?t.grid:[],depth:t.scroll.map(s=>({depth:s.depth,views:s.views})),attention:t.attention,sections:t.sections.map(s=>({root:s.root,reach_pct:s.reachPct,avg_s:s.avgS,clicks:s.clicks})),views:t.views,avgFold:t.avgFold,scale:t.scale,ramp:e.ramp,opacity:e.opacity,radius:e.device==="desktop"?28:36}}function $i(t){if(!t)return null;if(t.startsWith("#"))return t;const e=t.lastIndexOf("#"),s=e>=0?t.slice(0,e):t,n=e>=0?Number(t.slice(e+1)):0,i=s.startsWith("fs:")?s.slice(3).replace(/-/g," ").replace(/^./,r=>r.toUpperCase()):(s.split("/").pop()??s).replace(/\.tsx?$/,"");return n>0?`${i} ${n+1}`:i}const Ch="mainPanelTabs.analyticsTab.heatmap",ue=t=>`${Ch}.${t}`,Eh={desktop:Gm,tablet:Um,mobile:Wm},Mh=2e4;function Ih(t){const e=O.c(69),{base:s,orgSlug:n,site:i,modules:r,domains:a,onConfigure:o,fill:c}=t,d=c===void 0?!1:c,m=ie(),[u]=si(),f=u.language,[p,x]=Z.useState("/"),[h,g]=Z.useState("desktop"),[v,b]=Z.useState("7d"),[y,j]=Z.useState("clicks"),[N,w]=Z.useState("all"),[S,k]=Z.useState("");let _;e[0]!==r?(_=r.includes("heatmap"),e[0]=r,e[1]=_):_=e[1];const $=_,T=[...new Set(a.flatMap(Lh))],P=T[0];let I;e[2]!==h||e[3]!==n||e[4]!==p||e[5]!==v||e[6]!==i?(I=Qe.analyticsHeatmap(n,i,v,p,h),e[2]=h,e[3]=n,e[4]=p,e[5]=v,e[6]=i,e[7]=I):I=e[7];let C;e[8]!==s||e[9]!==h||e[10]!==p||e[11]!==v?(C=()=>ai(`${s}/analytics/data?view=heatmap&range=${v}&page=${encodeURIComponent(p)}&device=${h}`),e[8]=s,e[9]=h,e[10]=p,e[11]=v,e[12]=C):C=e[12];const M=$&&!!P;let A;e[13]!==I||e[14]!==C||e[15]!==M?(A={queryKey:I,queryFn:C,enabled:M,retry:!1,staleTime:6e4,placeholderData:Ah},e[13]=I,e[14]=C,e[15]=M,e[16]=A):A=e[16];const F=ts(A);if(!$){let le;e[17]===Symbol.for("react.memo_cache_sentinel")?(le=l.jsx(Xi,{}),e[17]=le):le=e[17];let ne;e[18]!==m?(ne=m(ue("offTitle")),e[18]=m,e[19]=ne):ne=e[19];let me;e[20]!==m?(me=m(ue("offDescription")),e[20]=m,e[21]=me):me=e[21];let ge;e[22]!==o||e[23]!==m?(ge=o?l.jsxs(Se,{size:"sm",variant:"outline",onClick:o,children:[l.jsx(g1,{className:"size-4"}),m(ue("openConfig"))]}):void 0,e[22]=o,e[23]=m,e[24]=ge):ge=e[24];let ve;return e[25]!==ge||e[26]!==ne||e[27]!==me?(ve=l.jsx(Ke,{icon:le,title:ne,description:me,buttonComponent:ge}),e[25]=ge,e[26]=ne,e[27]=me,e[28]=ve):ve=e[28],ve}if(!P){let le;e[29]===Symbol.for("react.memo_cache_sentinel")?(le=l.jsx(Xi,{}),e[29]=le):le=e[29];let ne;e[30]!==m?(ne=m(ue("noDomainTitle")),e[30]=m,e[31]=ne):ne=e[31];let me;e[32]!==m?(me=m(ue("noDomainDescription")),e[32]=m,e[33]=me):me=e[33];let ge;return e[34]!==ne||e[35]!==me?(ge=l.jsx(Ke,{icon:le,title:ne,description:me}),e[34]=ne,e[35]=me,e[36]=ge):ge=e[36],ge}const E=F.data??null,z=E?.data?vh(E.data):null;let R;e[37]!==p?(R=p.includes(":"),e[37]=p,e[38]=R):R=e[38];const V=R,K=V?S:p,U=K?$h(P,K):null,q=z?.devices.find(le=>le.device===h)?.meanVw,L=kh(h,q),B={all:0,rage:0,dead:0,error:0,first:0};for(const le of z?.elements??[])for(const ne of xd)B[ne]=B[ne]+Ts(le,ne);let Y;e[39]!==m?(Y=m(ue("page")),e[39]=m,e[40]=Y):Y=e[40];let J;e[41]!==m?(J=m(ue("pageSearch")),e[41]=m,e[42]=J):J=e[42];let X;e[43]!==m?(X=m(ue("pageEmpty")),e[43]=m,e[44]=X):X=e[44];let ee;e[45]===Symbol.for("react.memo_cache_sentinel")?(ee=le=>{x(le),k("")},e[45]=ee):ee=e[45];const te=ct;let D;e[46]!==m?(D=m(ue("device")),e[46]=m,e[47]=D):D=e[47];const W=ph.map(le=>{const ne=Eh[le],me=z?.devices.find(ge=>ge.device===le)?.views??0;return l.jsx(ct.Item,{icon:!0,pressed:le===h,onClick:()=>g(le),"aria-label":m(ue(le)),title:m(ue("deviceViews"),{device:m(ue(le)),views:Fe(me,f)}),children:l.jsx(ne,{className:"size-3.5"})},le)});let G;e[48]!==te||e[49]!==D||e[50]!==W?(G=l.jsx(te,{label:D,children:W}),e[48]=te,e[49]=D,e[50]=W,e[51]=G):G=e[51];let Q;e[52]!==m?(Q=m(ue("range")),e[52]=m,e[53]=Q):Q=e[53];let re;e[54]!==m?(re=xh.map(le=>({value:le,label:m(ue(`range${le}`))})),e[54]=m,e[55]=re):re=e[55];let ce;e[56]!==v||e[57]!==Q||e[58]!==re?(ce=l.jsx(ns,{label:Q,value:v,options:re,onChange:b}),e[56]=v,e[57]=Q,e[58]=re,e[59]=ce):ce=e[59];let ae;e[60]!==z||e[61]!==F.isFetching?(ae=F.isFetching&&z&&l.jsx(is,{size:"xs"}),e[60]=z,e[61]=F.isFetching,e[62]=ae):ae=e[62];const fe=l.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[l.jsx(Dh,{value:p,pages:z?.pages??[],label:Y,search:J,empty:X,locale:f,onChange:ee}),G,ce,ae]}),de=d&&"min-h-0 flex-1";let se;e[63]!==de?(se=ye("flex min-w-0 flex-col gap-4",de),e[63]=de,e[64]=se):se=e[64];const H=!z&&fe,oe=F.isLoading?l.jsxs("div",{className:"flex flex-col gap-3",children:[l.jsx(Ce,{className:"h-10 w-full"}),l.jsx(Ce,{className:"h-[520px] w-full"})]}):F.error?l.jsx("p",{className:"text-sm text-muted-foreground",children:to(F.error)?m("mainPanelTabs.analyticsTab.dataNotConfiguredDescription"):m("mainPanelTabs.analyticsTab.dataLoadError")}):z?l.jsx(Rh,{t:m,locale:f,model:z,origins:T,src:U,templatePage:V?p:null,onSample:k,width:L,device:h,mode:y,onMode:j,clickType:N,onClickType:w,counts:B,controls:fe,fill:d},`${h}|${U??p}|${T.join(" ")}`):l.jsx("p",{className:"text-sm text-muted-foreground",children:m("mainPanelTabs.analyticsTab.emptyView")});let he;return e[65]!==se||e[66]!==H||e[67]!==oe?(he=l.jsxs("div",{className:se,children:[H,oe]}),e[65]=se,e[66]=H,e[67]=oe,e[68]=he):he=e[68],he}function Ah(t){return t}function Lh(t){return _h(t)??[]}function Dh(t){const e=O.c(22),{value:s,pages:n,label:i,search:r,empty:a,locale:o,onChange:c}=t,[d,m]=Z.useState("");let u;if(e[0]!==n||e[1]!==d){const g=d.trim(),v=n.some(b=>b.page===g);u=g.startsWith("/")&&g.length<=512&&!v?[{value:g,label:g,views:null}]:[],e[0]=n,e[1]=d,e[2]=u}else u=e[2];let f;if(e[3]!==n||e[4]!==u||e[5]!==s){if(f=[...u,...n.map(Oh)],!f.some(g=>g.value===s)){let g;e[7]!==s?(g={value:s,label:s,views:null},e[7]=s,e[8]=g):g=e[8],f.push(g)}e[3]=n,e[4]=u,e[5]=s,e[6]=f}else f=e[6];let p;e[9]!==c||e[10]!==s?(p=g=>{g&&g!==s&&c(g)},e[9]=c,e[10]=s,e[11]=p):p=e[11];let x;e[12]!==o?(x=(g,v)=>l.jsxs("span",{className:"flex w-full min-w-0 items-center gap-2",children:[l.jsx("span",{className:"truncate",children:g.label}),typeof g.views=="number"&&l.jsx("span",{className:"text-meta tnum ml-auto shrink-0",children:Fe(g.views,o)}),l.jsx(ti,{className:ye("size-3.5 shrink-0",typeof g.views!="number"&&"ml-auto",v?"opacity-100":"opacity-0")})]}),e[12]=o,e[13]=x):x=e[13];let h;return e[14]!==a||e[15]!==i||e[16]!==f||e[17]!==r||e[18]!==p||e[19]!==x||e[20]!==s?(h=l.jsx("div",{className:"min-w-0 max-sm:basis-full sm:w-48",children:l.jsx(j1,{ariaLabel:i,options:f,value:s,onChange:p,onSearchChange:m,searchPlaceholder:r,emptyMessage:a,width:"w-full",triggerClassName:"h-8 px-3 text-sm font-normal",contentClassName:"min-w-64",renderItem:x})}),e[14]=a,e[15]=i,e[16]=f,e[17]=r,e[18]=p,e[19]=x,e[20]=s,e[21]=h):h=e[21],h}function Oh(t){return{value:t.page,label:t.page,views:t.views}}function Fe(t,e){return Math.round(t).toLocaleString(e)}function gd(t,e,s){return e?t.toLocaleString(s,{style:"currency",currency:e,maximumFractionDigits:0}):Fe(t,s)}function xt(t,e,s=0){return t==null?"—":`${(t*100).toLocaleString(e,{maximumFractionDigits:s,minimumFractionDigits:s})}%`}function Ti(t,e){return t==null?"—":`${t.toLocaleString(e,{maximumFractionDigits:t<10?1:0})} s`}function Rh(t){const e=O.c(327),{t:s,locale:n,model:i,origins:r,src:a,templatePage:o,onSample:c,width:d,device:m,mode:u,onMode:f,clickType:p,onClickType:x,counts:h,controls:g,fill:v}=t,[b,y]=Z.useState("thermal"),[j,N]=Z.useState(.85),[w,S]=Z.useState("fit"),[k,_]=Z.useState("loading"),[$,T]=Z.useState(0),[P,I]=Z.useState(null),[C,M]=Z.useState(null),[A,F]=Z.useState(null),[E,z]=Z.useState(null),[R,V]=Z.useState(!1),[K,U]=Z.useState("clicks");let q;e[0]===Symbol.for("react.memo_cache_sentinel")?(q={w:1e3,h:640},e[0]=q):q=e[0];const[L,B]=Z.useState(q);let Y;e[1]!==r?(Y=()=>{let Ie=null,Oe=0,Ue=null;const Je=Ge=>{const Ee=Ue?[Ue]:Ge.t==="init"?r:[];for(const vt of Ee)Ie?.contentWindow?.postMessage({dq:"hm",v:hd,...Ge},vt)},ut=Ge=>{const Ee=Th(Ge,Ie?.contentWindow,Ue?[Ue]:r);!Ee||!Ue&&Ee.t!=="ready"||(Ee.t==="ready"?(Ue=Ge.origin,window.clearInterval(Oe),_("ready")):Ee.t==="placed"?I(Ee):Ee.t==="hover"?M(Ee.x==null?null:{key:Ee.key,label:Ee.label??null,x:Ee.x,y:Ee.y??0,pct:Ee.pct}):(z(Ee.key),V(!0),requestAnimationFrame(()=>document.querySelector(`[data-hm-key="${CSS.escape(Ee.key)}"]`)?.scrollIntoView({block:"nearest"}))))};return{frameRef:Ge=>{Ie=Ge,window.addEventListener("message",ut);const Ee=Date.now();return Oe=window.setInterval(()=>{Date.now()-Ee>Mh&&_(Gh),Je({t:"init"})},400),()=>{Ie=null,window.clearInterval(Oe),window.removeEventListener("message",ut)}},stageRef:Ge=>{const Ee=new ResizeObserver(vt=>{const[Nt]=vt;Nt&&B({w:Nt.contentRect.width,h:Nt.contentRect.height})});return Ee.observe(Ge),()=>Ee.disconnect()},post:Je}},e[1]=r,e[2]=Y):Y=e[2];const[J]=Z.useState(Y),{frameRef:X,stageRef:ee,post:te}=J;let D;e[3]!==p||e[4]!==m||e[5]!==u||e[6]!==i||e[7]!==j||e[8]!==b?(D=Ph(i,{mode:u,type:p,ramp:b,opacity:j,device:m}),e[3]=p,e[4]=m,e[5]=u,e[6]=i,e[7]=j,e[8]=b,e[9]=D):D=e[9];const W=D;let G,Q;e[10]!==W||e[11]!==te||e[12]!==k?(G=()=>{k==="ready"&&te({t:"data",d:W})},Q=[k,W,te],e[10]=W,e[11]=te,e[12]=k,e[13]=G,e[14]=Q):(G=e[13],Q=e[14]),Z.useEffect(G,Q);let re;e[15]!==te?(re=(Ie,Oe)=>te({t:"highlight",key:Ie,scroll:Oe}),e[15]=te,e[16]=re):re=e[16];const ce=re;let ae;e[17]!==ce||e[18]!==E?(ae=Ie=>{const Oe=E===Ie?null:Ie;z(Oe),ce(Oe,Oe!=null)},e[17]=ce,e[18]=E,e[19]=ae):ae=e[19];const fe=ae;let de;e[20]!==ce?(de=Ie=>{F(Ie),ce(Ie,!1)},e[20]=ce,e[21]=de):de=e[21];const se=de;let H;e[22]!==ce||e[23]!==E?(H=()=>{F(null),ce(E,!1)},e[22]=ce,e[23]=E,e[24]=H):H=e[24];const oe=H;let he;e[25]!==ce||e[26]!==f?(he=Ie=>{f(Ie),z(null),ce(null,!1)},e[25]=ce,e[26]=f,e[27]=he):he=e[27];const le=he,ne=Math.min(1,(L.w-2)/d),me=w==="fit"?ne:1,ge=Math.max(320,L.h/me),ve=Math.max(0,(L.w-d*me)/2),be=i.scale||1;let we,$e,je,xe,ke,_e,Ae,Pe,Be;if(e[28]!==$||e[29]!==L.w||e[30]!==le||e[31]!==p||e[32]!==g||e[33]!==h||e[34]!==m||e[35]!==se||e[36]!==be||e[37]!==v||e[38]!==ge||e[39]!==X||e[40]!==C||e[41]!==oe||e[42]!==ve||e[43]!==n||e[44]!==u||e[45]!==i||e[46]!==x||e[47]!==c||e[48]!==j||e[49]!==fe||e[50]!==E||e[51]!==P||e[52]!==R||e[53]!==b||e[54]!==K||e[55]!==A||e[56]!==me||e[57]!==a||e[58]!==ee||e[59]!==k||e[60]!==s||e[61]!==o||e[62]!==d||e[63]!==w){const Ie=new Map((P?.items??[]).map(Uh)),Oe=new Map(i.elements.map(Wh)),Ue=h[p]||1;let Je;e[73]!==p?(Je=pe=>Ts(pe,p)>0,e[73]=p,e[74]=Je):Je=e[74];let ut;e[75]!==p?(ut=(pe,De)=>Ts(De,p)-Ts(pe,p),e[75]=p,e[76]=ut):ut=e[76];const _t=i.elements.filter(Je).sort(ut),ft=K==="ctr"&&p==="all";let Ge;e[77]!==i?(Ge=pe=>[pe.key,jh(i,pe)],e[77]=i,e[78]=Ge):Ge=e[78];const Ee=new Map(i.elements.map(Ge)),vt=ft?_t.filter(pe=>(Ee.get(pe.key)?.seen??0)>=rc).sort((pe,De)=>(Ee.get(De.key)?.ctr??0)-(Ee.get(pe.key)?.ctr??0)):_t,Nt=ft?Ee.get(vt[0]?.key??"")?.ctr??0:0,Vt=vt.filter(pe=>Ie.get(pe.key)?.found!=="none"),$t=_t.filter(pe=>Ie.get(pe.key)?.found==="none"),kt=P?.stats.total?P.stats.matched/P.stats.total:null,Tt=A??E,Lt=pe=>Ie.get(pe.key)?.label||null,Pt=pe=>Lt(pe)||$i(pe.root)||s(ue("noText"));let bt;e[79]!==i.sections?(bt=new Map(i.sections.map(Hh)),e[79]=i.sections,e[80]=bt):bt=e[80];const qt=bt;let jt;e[81]!==i.funnel||e[82]!==E?(jt=E?i.funnel.get(E):void 0,e[81]=i.funnel,e[82]=E,e[83]=jt):jt=e[83];const Dt=jt,ps=E?Oe.get(E):void 0,Re=u==="clicks"||u==="value"?ps:void 0,xs=[...i.value.values()].filter(Bh).sort(Kh).slice(0,60),pt=C?.key?Oe.get(C.key):void 0,Qt=C?.key?.startsWith("blk:")?P?.blocks.find(pe=>`blk:${pe.key}`===C.key):void 0;let ys;e[84]!==be||e[85]!==n||e[86]!==u||e[87]!==P||e[88]!==s?(ys=u==="clicks"?[s(ue("legendFewer")),P?.legend[2]?s(ue("legendClicks"),{n:Fe(P.legend[2]*be,n)}):s(ue("legendMore"))]:u==="scroll"?[s(ue("legendNobody")),s(ue("legendEveryone"))]:u==="attention"?[s(ue("legendLittle")),s(ue("legendMoreTime"))]:[s(ue("legendFewer")),s(ue("legendMore"))],e[84]=be,e[85]=n,e[86]=u,e[87]=P,e[88]=s,e[89]=ys):ys=e[89];const Xt=ys;let as;e[90]!==u||e[91]!==b?(as=Array.from({length:11},(pe,De)=>cc(b,De/10,u==="clicks"?void 0:.35+.65*(De/10))),e[90]=u,e[91]=b,e[92]=as):as=e[92];const hs=`linear-gradient(90deg, ${as.join(",")})`;let os;e[93]!==u?(os=(pe,De)=>u==="sections"?De.clicks-pe.clicks:(De.seconds??0)-(pe.seconds??0),e[93]=u,e[94]=os):os=e[94];const gs=[...P?.blocks??[]].sort(os);let cs;e[95]!==u?(cs=pe=>u==="sections"?pe.clicks:pe.seconds??0,e[95]=u,e[96]=cs):cs=e[96];const _s=Math.max(1e-9,...gs.map(cs)),vs=v&&"min-h-0 flex-1";e[97]!==vs?(Pe=ye("@container flex min-w-0 flex-col gap-3",vs),e[97]=vs,e[98]=Pe):Pe=e[98];let Ne;e[99]!==le?(Ne=pe=>{const De=ic.find(Fs=>Fs===pe);De&&le(De)},e[99]=le,e[100]=Ne):Ne=e[100];let et;e[101]!==s?(et=s(ue("map")),e[101]=s,e[102]=et):et=e[102];let ss;e[103]!==s?(ss=ic.map(pe=>l.jsx(Uu,{value:pe,variant:"underline",title:s(ue(`${pe}Hint`)),children:s(ue(pe))},pe)),e[103]=s,e[104]=ss):ss=e[104];let at;e[105]!==et||e[106]!==ss?(at=l.jsx(Gu,{variant:"underline","aria-label":et,children:ss}),e[105]=et,e[106]=ss,e[107]=at):at=e[107];let ol;e[108]!==u||e[109]!==Ne||e[110]!==at?(ol=l.jsx(Yu,{value:u,onValueChange:Ne,variant:"underline",children:at}),e[108]=u,e[109]=Ne,e[110]=at,e[111]=ol):ol=e[111];let cl;e[112]!==p||e[113]!==h||e[114]!==be||e[115]!==n||e[116]!==u||e[117]!==x||e[118]!==s?(cl=u==="clicks"&&l.jsx(ns,{label:s(ue("clickType")),value:p,options:xd.filter(pe=>pe==="all"||h[pe]>0).map(pe=>({value:pe,label:pe==="all"?s(ue("allClicks")):`${s(ue(`type_${pe}`))} · ${Fe(h[pe]*be,n)}`})),onChange:pe=>{x(pe),z(null)}}),e[112]=p,e[113]=h,e[114]=be,e[115]=n,e[116]=u,e[117]=x,e[118]=s,e[119]=cl):cl=e[119];let dl;e[120]!==g?(dl=l.jsx("div",{className:"ml-auto max-sm:ml-0",children:g}),e[120]=g,e[121]=dl):dl=e[121],e[122]!==ol||e[123]!==cl||e[124]!==dl?(Be=l.jsxs("div",{className:"flex flex-wrap items-center gap-x-4 gap-y-2",children:[ol,cl,dl]}),e[122]=ol,e[123]=cl,e[124]=dl,e[125]=Be):Be=e[125];const _r=v&&"min-h-0 flex-1";e[126]!==_r?(_e=ye("surface grid grid-cols-1 overflow-hidden @4xl:grid-cols-[minmax(0,1fr)_340px]",_r),e[126]=_r,e[127]=_e):_e=e[127];const $r=v?"h-full min-h-[520px]":"h-[clamp(520px,78vh,980px)]";let ml;e[128]!==$r?(ml=ye("surface-inset relative flex min-w-0 flex-col rounded-none px-5 pt-4 max-sm:h-[72vh] max-sm:min-h-[460px] max-sm:px-2 max-sm:pt-2",$r),e[128]=$r,e[129]=ml):ml=e[129];const Tr=m==="desktop"?void 0:d+2;let fi;e[130]!==Tr?(fi={maxWidth:Tr},e[130]=Tr,e[131]=fi):fi=e[131];const Pr=w==="fit"?"overflow-x-hidden":"overflow-x-auto";let pi;e[132]!==Pr?(pi=ye("relative min-h-0 flex-1 overflow-y-hidden bg-background",Pr),e[132]=Pr,e[133]=pi):pi=e[133];let xi;e[134]!==d||e[135]!==w?(xi=w!=="fit"&&l.jsx("div",{style:{width:d,height:1}}),e[134]=d,e[135]=w,e[136]=xi):xi=e[136];let hi;e[137]!==$||e[138]!==ge||e[139]!==X||e[140]!==ve||e[141]!==c||e[142]!==me||e[143]!==a||e[144]!==k||e[145]!==s||e[146]!==o||e[147]!==d?(hi=a?l.jsx("iframe",{ref:X,title:s(ue("frameTitle")),src:a,sandbox:"allow-scripts allow-same-origin",referrerPolicy:"strict-origin-when-cross-origin",className:"absolute top-0 border-0 bg-background transition-opacity",style:{width:d,height:ge,left:ve,transform:`scale(${me})`,transformOrigin:"0 0",opacity:k==="ready"?1:.35}},$):l.jsx(t0,{t:s,page:o??"",onPick:c}),e[137]=$,e[138]=ge,e[139]=X,e[140]=ve,e[141]=c,e[142]=me,e[143]=a,e[144]=k,e[145]=s,e[146]=o,e[147]=d,e[148]=hi):hi=e[148];let gi;e[149]!==a||e[150]!==k||e[151]!==s?(gi=a&&k==="loading"&&l.jsx(Wi,{children:l.jsxs("span",{className:"flex items-center gap-2",children:[l.jsx(is,{size:"xs"})," ",s(ue("frameLoading"))]})}),e[149]=a,e[150]=k,e[151]=s,e[152]=gi):gi=e[152];let vi;e[153]!==a||e[154]!==k||e[155]!==s?(vi=a&&k==="timeout"&&l.jsxs(Wi,{title:s(ue("timeoutTitle")),children:[l.jsx("span",{className:"block",children:s(ue("timeoutHint"))}),l.jsx("span",{className:"pointer-events-auto mt-3 flex items-center justify-center gap-2",children:l.jsx(Se,{size:"sm",variant:"outline",onClick:()=>{_("loading"),T(qh)},children:s(ue("timeoutRetry"))})}),l.jsxs("details",{className:"pointer-events-auto mt-3 text-left text-xs",children:[l.jsx("summary",{className:"cursor-pointer text-center",children:s(ue("timeoutWhy"))}),l.jsx("p",{className:"mt-2",children:s(ue("timeoutDescription"))})]})]}),e[153]=a,e[154]=k,e[155]=s,e[156]=vi):vi=e[156];let bi;e[157]!==m||e[158]!==i.views||e[159]!==a||e[160]!==k||e[161]!==s?(bi=a&&k==="ready"&&i.views===0&&l.jsx(Wi,{title:s(ue("noViewsTitle")),children:s(ue("noViewsDescription"),{device:s(ue(m)).toLowerCase()})}),e[157]=m,e[158]=i.views,e[159]=a,e[160]=k,e[161]=s,e[162]=bi):bi=e[162];const Cr=l.jsx("div",{className:"relative mx-auto flex min-h-0 w-full flex-1 flex-col overflow-hidden rounded-t-lg border border-b-0 border-border bg-background",style:fi,children:l.jsxs("div",{ref:ee,className:pi,children:[xi,hi,gi,vi,bi,C&&(pt||Qt||C.pct!=null)&&l.jsxs("div",{className:"pointer-events-none absolute z-10 min-w-48 max-w-72 rounded-lg bg-foreground px-3 py-2.5 text-xs leading-relaxed text-background shadow-lg",style:{left:Math.min(ve+C.x*me+14,L.w-200),top:C.y*me+14},children:[pt&&l.jsxs(l.Fragment,{children:[l.jsx("strong",{className:"mb-1 block text-sm",children:C.label||Pt(pt)}),l.jsx(ws,{label:s(ue("tipClicks")),value:Fe(pt.clicks*be,n)}),l.jsx(ws,{label:s(ue("tipShare")),value:xt(pt.clicks/Math.max(1,h.all),n,1)}),l.jsx(ws,{label:s(ue("tipVisits")),value:xt(pt.views/Math.max(1,i.views),n,1)}),pt.rage>0&&l.jsx(ws,{label:s(ue("type_rage")),value:Fe(pt.rage*be,n)}),pt.dead>0&&l.jsx(ws,{label:s(ue("type_dead")),value:Fe(pt.dead*be,n)}),pt.error>0&&l.jsx(ws,{label:s(ue("type_error")),value:Fe(pt.error*be,n)})]}),Qt&&l.jsxs(l.Fragment,{children:[l.jsx("strong",{className:"mb-1 block text-sm",children:Qt.name}),Qt.heading&&l.jsx("div",{className:"mb-1 opacity-80",children:Qt.heading}),l.jsx(ws,{label:s(ue("tipClicks")),value:Fe(Qt.clicks*be,n)}),l.jsx(ws,{label:s(ue("tipSaw")),value:xt(Qt.reach,n)}),l.jsx(ws,{label:s(ue("tipTime")),value:Ti(Qt.seconds,n)})]}),C.pct!=null&&u==="scroll"&&l.jsxs(l.Fragment,{children:[l.jsx("strong",{className:"block text-sm",children:s(ue("tipReach"),{pct:xt(oc(i.scroll,Math.floor(C.pct*100)),n)})}),s(ue("tipReachSub"))]}),C.pct!=null&&u==="attention"&&l.jsxs(l.Fragment,{children:[l.jsx("strong",{className:"block text-sm",children:s(ue("tipAttention"),{s:Ti(Yh(i,C.pct),n)})}),s(ue("tipAttentionSub"))]})]})]})});let ul;e[163]!==hs?(ul=l.jsx("div",{className:"h-2 rounded-full border border-border",style:{backgroundImage:hs}}),e[163]=hs,e[164]=ul):ul=e[164];let fl;e[165]!==Xt[0]?(fl=l.jsx("span",{children:Xt[0]}),e[165]=Xt[0],e[166]=fl):fl=e[166];let pl;e[167]!==Xt[1]?(pl=l.jsx("span",{children:Xt[1]}),e[167]=Xt[1],e[168]=pl):pl=e[168];let xl;e[169]!==fl||e[170]!==pl?(xl=l.jsxs("div",{className:"text-meta flex justify-between gap-3",children:[fl,pl]}),e[169]=fl,e[170]=pl,e[171]=xl):xl=e[171];let hl;e[172]!==ul||e[173]!==xl?(hl=l.jsxs("div",{className:"flex min-w-44 flex-col gap-1 max-sm:min-w-0 max-sm:basis-full",children:[ul,xl]}),e[172]=ul,e[173]=xl,e[174]=hl):hl=e[174];let ji;e[175]===Symbol.for("react.memo_cache_sentinel")?(ji=l.jsx(Ym,{className:"size-3.5"}),e[175]=ji):ji=e[175];let gl;e[176]!==s?(gl=s(ue("display")),e[176]=s,e[177]=gl):gl=e[177];let vl;e[178]!==gl?(vl=l.jsx(ni,{asChild:!0,children:l.jsxs(Se,{variant:"ghost",size:"sm",className:"gap-1.5 font-normal text-muted-foreground",children:[ji,gl]})}),e[178]=gl,e[179]=vl):vl=e[179];let bl;e[180]!==u||e[181]!==j||e[182]!==s?(bl=u!=="sections"&&l.jsxs("label",{className:"flex flex-col gap-2",children:[l.jsx("span",{className:"text-meta",children:s(ue("opacity"))}),l.jsx(y1,{thumbLabel:s(ue("opacity")),min:.2,max:1,step:.05,value:[j],onValueChange:pe=>{const[De]=pe;return De!==void 0&&N(De)}})]}),e[180]=u,e[181]=j,e[182]=s,e[183]=bl):bl=e[183];let jl;e[184]!==s?(jl=s(ue("colors")),e[184]=s,e[185]=jl):jl=e[185];let yl;e[186]!==jl?(yl=l.jsx("span",{className:"text-meta",children:jl}),e[186]=jl,e[187]=yl):yl=e[187];let wl;e[188]!==s?(wl=s(ue("colors")),e[188]=s,e[189]=wl):wl=e[189];let Nl;e[190]!==b||e[191]!==s?(Nl=["thermal","inferno"].map(pe=>l.jsx(ct.Item,{pressed:pe===b,onClick:()=>y(pe),title:pe==="inferno"?s(ue("infernoHint")):void 0,children:s(ue(pe))},pe)),e[190]=b,e[191]=s,e[192]=Nl):Nl=e[192];let kl;e[193]!==wl||e[194]!==Nl?(kl=l.jsx(ct,{label:wl,children:Nl}),e[193]=wl,e[194]=Nl,e[195]=kl):kl=e[195];let Sl;e[196]!==yl||e[197]!==kl?(Sl=l.jsxs("div",{className:"flex flex-col gap-2",children:[yl,kl]}),e[196]=yl,e[197]=kl,e[198]=Sl):Sl=e[198];let _l;e[199]!==s?(_l=s(ue("zoom")),e[199]=s,e[200]=_l):_l=e[200];let $l;e[201]!==_l?($l=l.jsx("span",{className:"text-meta",children:_l}),e[201]=_l,e[202]=$l):$l=e[202];let Tl;e[203]!==s?(Tl=s(ue("zoom")),e[203]=s,e[204]=Tl):Tl=e[204];const Er=w==="fit";let yi;e[205]===Symbol.for("react.memo_cache_sentinel")?(yi=()=>S("fit"),e[205]=yi):yi=e[205];let Pl;e[206]!==s?(Pl=s(ue("fit")),e[206]=s,e[207]=Pl):Pl=e[207];let Cl;e[208]!==Er||e[209]!==Pl?(Cl=l.jsx(ct.Item,{pressed:Er,onClick:yi,children:Pl}),e[208]=Er,e[209]=Pl,e[210]=Cl):Cl=e[210];const Mr=w===1;let wi;e[211]===Symbol.for("react.memo_cache_sentinel")?(wi=()=>S(1),e[211]=wi):wi=e[211];const Ir=`${d} px`;let El;e[212]!==Mr||e[213]!==Ir?(El=l.jsx(ct.Item,{pressed:Mr,onClick:wi,children:Ir}),e[212]=Mr,e[213]=Ir,e[214]=El):El=e[214];let Ml;e[215]!==Tl||e[216]!==Cl||e[217]!==El?(Ml=l.jsxs(ct,{label:Tl,children:[Cl,El]}),e[215]=Tl,e[216]=Cl,e[217]=El,e[218]=Ml):Ml=e[218];let Il;e[219]!==$l||e[220]!==Ml?(Il=l.jsxs("div",{className:"flex flex-col gap-2 max-sm:hidden",children:[$l,Ml]}),e[219]=$l,e[220]=Ml,e[221]=Il):Il=e[221];let Al;e[222]!==bl||e[223]!==Sl||e[224]!==Il?(Al=l.jsxs(ii,{align:"start",className:"flex w-64 flex-col gap-4 p-4",children:[bl,Sl,Il]}),e[222]=bl,e[223]=Sl,e[224]=Il,e[225]=Al):Al=e[225];let Ll;e[226]!==vl||e[227]!==Al?(Ll=l.jsxs(li,{children:[vl,Al]}),e[226]=vl,e[227]=Al,e[228]=Ll):Ll=e[228];let Dl;e[229]!==hl||e[230]!==Ll?(Dl=l.jsxs("div",{className:"surface absolute bottom-4 left-8 z-10 flex max-w-[calc(100%-4rem)] flex-wrap items-center gap-x-4 gap-y-2 px-3 py-2 max-sm:inset-x-4 max-sm:max-w-none",children:[hl,Ll]}),e[229]=hl,e[230]=Ll,e[231]=Dl):Dl=e[231],e[232]!==ml||e[233]!==Cr||e[234]!==Dl?(Ae=l.jsxs("div",{className:ml,children:[Cr,Dl]}),e[232]=ml,e[233]=Cr,e[234]=Dl,e[235]=Ae):Ae=e[235];const Ar=!v&&"@4xl:h-[clamp(520px,78vh,980px)]";e[236]!==Ar?(je=ye("flex min-h-0 flex-col border-border @max-4xl:border-t @4xl:border-l",Ar),e[236]=Ar,e[237]=je):je=e[237];let Ol;e[238]!==n||e[239]!==i.views||e[240]!==s?(Ol=s(ue("views"),{n:Fe(i.views,n)}),e[238]=n,e[239]=i.views,e[240]=s,e[241]=Ol):Ol=e[241];let Rl;e[242]!==s?(Rl=s(ue("viewsHint")),e[242]=s,e[243]=Rl):Rl=e[243];let Fl;e[244]!==Ol||e[245]!==Rl?(Fl={text:Ol,hint:Rl},e[244]=Ol,e[245]=Rl,e[246]=Fl):Fl=e[246];let zl;e[247]!==be||e[248]!==n||e[249]!==s?(zl=be>1.05&&{text:s(ue("scale"),{n:Fe(be,n)}),hint:s(ue("scaleHint"))},e[247]=be,e[248]=n,e[249]=s,e[250]=zl):zl=e[250];let Vl;e[251]!==n||e[252]!==kt||e[253]!==s?(Vl=kt!=null&&kt<.8&&{text:s(ue("match"),{pct:xt(kt,n)}),hint:s(ue("matchHint"))},e[251]=n,e[252]=kt,e[253]=s,e[254]=Vl):Vl=e[254];let ql;e[255]!==Fl||e[256]!==zl||e[257]!==Vl?(ql=[Fl,zl,Vl].filter(Vh).map(zh),e[255]=Fl,e[256]=zl,e[257]=Vl,e[258]=ql):ql=e[258];let Kl;e[259]!==i.smallSample||e[260]!==i.views||e[261]!==s?(Kl=i.smallSample&&i.views>0&&l.jsx(Ye,{variant:"warning",size:"sm",title:s(ue("smallSampleHint")),children:s(ue("smallSample"))}),e[259]=i.smallSample,e[260]=i.views,e[261]=s,e[262]=Kl):Kl=e[262];let Bl;e[263]!==ql||e[264]!==Kl?(Bl=l.jsxs("div",{className:"text-meta flex flex-wrap items-center gap-x-1.5 gap-y-1",children:[ql,Kl]}),e[263]=ql,e[264]=Kl,e[265]=Bl):Bl=e[265];let Hl;e[266]!==s?(Hl=s(ue("statClicks")),e[266]=s,e[267]=Hl):Hl=e[267];const Lr=i.clicks*be;let Wl;e[268]!==n||e[269]!==Lr?(Wl=Fe(Lr,n),e[268]=n,e[269]=Lr,e[270]=Wl):Wl=e[270];let Ul;e[271]!==Hl||e[272]!==Wl?(Ul=l.jsx(Ws,{label:Hl,value:Wl}),e[271]=Hl,e[272]=Wl,e[273]=Ul):Ul=e[273];let Gl;e[274]!==s?(Gl=s(ue("statDepth")),e[274]=s,e[275]=Gl):Gl=e[275];const Dr=i.avgDepth==null?null:i.avgDepth/100;let Yl;e[276]!==n||e[277]!==Dr?(Yl=xt(Dr,n),e[276]=n,e[277]=Dr,e[278]=Yl):Yl=e[278];let Ql;e[279]!==n||e[280]!==i.avgFold||e[281]!==s?(Ql=i.avgFold!=null?s(ue("statFold"),{pct:xt(i.avgFold/100,n)}):void 0,e[279]=n,e[280]=i.avgFold,e[281]=s,e[282]=Ql):Ql=e[282];let Xl;e[283]!==Gl||e[284]!==Yl||e[285]!==Ql?(Xl=l.jsx(Ws,{label:Gl,value:Yl,title:Ql}),e[283]=Gl,e[284]=Yl,e[285]=Ql,e[286]=Xl):Xl=e[286];let Zl;e[287]!==s?(Zl=s(ue("statActive")),e[287]=s,e[288]=Zl):Zl=e[288];let Jl;e[289]!==n||e[290]!==i.activeS?(Jl=Ti(i.activeS,n),e[289]=n,e[290]=i.activeS,e[291]=Jl):Jl=e[291];let en;e[292]!==Zl||e[293]!==Jl?(en=l.jsx(Ws,{label:Zl,value:Jl}),e[292]=Zl,e[293]=Jl,e[294]=en):en=e[294];let tn;e[295]!==en||e[296]!==Ul||e[297]!==Xl?(tn=l.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[Ul,Xl,en]}),e[295]=en,e[296]=Ul,e[297]=Xl,e[298]=tn):tn=e[298],e[299]!==tn||e[300]!==Bl?(xe=l.jsxs("div",{className:"flex flex-col gap-4 border-b border-border px-4 pt-4 pb-5",children:[Bl,tn]}),e[299]=tn,e[300]=Bl,e[301]=xe):xe=e[301];let Ni;e[302]===Symbol.for("react.memo_cache_sentinel")?(Ni=()=>V(Fh),e[302]=Ni):Ni=e[302];let sn;e[303]!==u||e[304]!==R||e[305]!==s?(sn=s(ue(R?"hideList":u==="sections"||u==="attention"?"showSections":u==="scroll"?"showReach":"showElements")),e[303]=u,e[304]=R,e[305]=s,e[306]=sn):sn=e[306],e[307]!==sn?(ke=l.jsx("button",{type:"button",className:"focus-ring border-b border-border px-4 py-3 text-left text-sm font-medium text-foreground hover:bg-accent/50 @4xl:hidden",onClick:Ni,children:sn}),e[307]=sn,e[308]=ke):ke=e[308];const Or=R?"flex":"hidden @4xl:flex";e[309]!==Or?(we=ye("min-h-0 flex-1 flex-col @max-4xl:max-h-[60vh]",Or),e[309]=Or,e[310]=we):we=e[310],$e=Re?l.jsx(Qh,{t:s,locale:n,mode:u,label:Pt(Re),section:Lt(Re)?$i(Re.root):null,el:Re,est:be,ctr:Ee.get(Re.key),value:i.value.get(Re.key),currency:i.valueModel?.currency,funnel:Dt,page:i.pageFunnel,onBack:()=>fe(Re.key)}):l.jsxs(l.Fragment,{children:[u==="clicks"&&l.jsxs(l.Fragment,{children:[l.jsx(Pi,{title:p!=="all"?s(ue("topOfType"),{type:s(ue(`type_${p}`)).toLowerCase()}):s(ue(ft?"topCtr":"topElements")),aside:p==="all"&&l.jsx(ct,{label:s(ue("rankBy")),children:["clicks","ctr"].map(pe=>l.jsx(ct.Item,{pressed:pe===K,onClick:()=>U(pe),title:pe==="ctr"?s(ue("ctrHint")):void 0,children:s(ue(pe==="ctr"?"rankCtr":"rankClicks"))},pe))})}),l.jsxs("div",{className:"flex min-h-0 flex-1 flex-col gap-1.5 overflow-y-auto px-2 pb-3",children:[ft&&l.jsx("p",{className:"px-2 pb-1 text-meta",children:s(ue("ctrMinNote"),{n:Fe(rc,n)})}),Vt.slice(0,60).map(pe=>{const De=Ts(pe,p),Fs=De/Ue,ln=Ee.get(pe.key),Sm=ft?(ln?.ctr??0)/(Nt||1):Fs;return l.jsxs(Ci,{id:pe.key,label:Pt(pe),value:ft?xt(ln?.ctr??0,n,1):Fe(De*be,n),meter:Math.max(.02,Sm),active:Tt===pe.key,onEnter:()=>se(pe.key),onLeave:oe,onPick:()=>fe(pe.key),sub:[Lt(pe)?$i(pe.root):null,ft?s(ue("ctrSeen"),{n:Fe((ln?.seen??0)*be,n)}):ln&&ln.seen?s(ue("ctrSub"),{pct:xt(ln.ctr,n,1)}):""].filter(Boolean).join(", "),children:[Ie.get(pe.key)?.found==="sec"&&l.jsx(qn,{title:s(ue("inSectionHint")),children:s(ue("inSection"))}),pe.rage>0&&l.jsx(qn,{children:s(ue("badgeRage"),{n:Fe(pe.rage*be,n)})}),pe.dead>0&&l.jsx(qn,{children:s(ue("badgeDead"),{n:Fe(pe.dead*be,n)})}),pe.error>0&&l.jsx(qn,{children:s(ue("badgeError"),{n:Fe(pe.error*be,n)})})]},pe.key)}),!Vt.length&&P&&l.jsx("p",{className:"px-2 py-3 text-meta",children:s(ue("noneOfType"))}),$t.length>0&&l.jsxs("details",{className:"mx-2 mt-2 border-t border-dashed border-border pt-2",children:[l.jsx("summary",{className:"cursor-pointer py-1 text-meta",children:s(ue("offPage"),{n:Fe($t.length,n),pct:xt($t.reduce((pe,De)=>pe+Ts(De,p),0)/Ue,n)})}),$t.slice(0,40).map(pe=>l.jsxs("div",{className:"flex justify-between gap-2 px-2 py-1.5 text-xs",children:[l.jsx("span",{className:"truncate",children:$i(pe.root)??s(ue("outsideSections"))}),l.jsx("span",{className:"tnum text-foreground",children:Fe(Ts(pe,p)*be,n)})]},pe.key))]})]})]}),u==="value"&&l.jsxs(l.Fragment,{children:[l.jsx(Pi,{title:s(ue("valueTitle"))}),l.jsx("div",{className:"flex min-h-0 flex-1 flex-col gap-1.5 overflow-y-auto px-2 pb-3",children:i.valueModel&&!i.valueModel.supported?l.jsx("p",{className:"px-2 py-3 text-meta",children:s(ue("valueOtherGoal"))}):i.valueSummary?l.jsxs(l.Fragment,{children:[l.jsx("p",{className:"px-2 pb-1 text-meta",children:s(ue("valueBaseline"),{cvr:xt(i.valueSummary.cvrPct/100,n,1),people:Fe(i.valueSummary.visitors,n)})}),xs.map(pe=>{const De=Oe.get(pe.key),Fs=xs[0]?.revenue||1;return l.jsxs(Ci,{id:pe.key,label:De?Pt(De):s(ue("noText")),value:gd(pe.revenue,i.valueModel?.currency,n),meter:Math.max(.02,pe.revenue/Fs),active:Tt===pe.key,onEnter:()=>se(pe.key),onLeave:oe,onPick:()=>fe(pe.key),sub:s(ue("valueRowSub"),{people:Fe(pe.clickVisitors,n),cvr:xt(pe.cvrPct/100,n,1)}),children:[!pe.smallSample&&pe.rpvIndex>0&&l.jsxs("span",{title:s(ue("valueIndexHint")),className:ye("shrink-0",pe.rpvIndex>=1?"text-success":"text-warning"),children:["· ",s(ue("valueIndex"),{x:pe.rpvIndex.toLocaleString(n,{maximumFractionDigits:2})})]}),pe.smallSample&&l.jsxs("span",{title:s(ue("valueSmallHint")),className:"shrink-0",children:["· ",s(ue("valueSmall"))]})]},pe.key)}),i.valueLeaks.length>0&&l.jsxs(l.Fragment,{children:[l.jsx("h3",{className:"mt-3 border-t border-border px-2 pt-4 pb-1 text-sm font-medium text-foreground",children:s(ue("valueLeaksTitle"))}),i.valueLeaks.map(pe=>{const De=Oe.get(pe.key);return l.jsx(Ci,{id:pe.key,label:De?Pt(De):s(ue("noText")),value:Fe(pe.clickVisitors,n),meter:.02,active:Tt===pe.key,onEnter:()=>se(pe.key),onLeave:oe,onPick:()=>fe(pe.key),sub:s(ue("valueLeakSub"),{conv:Fe(pe.convVisitors,n)})},`leak:${pe.key}`)})]}),l.jsx("p",{className:"px-2 pt-3 text-meta",children:s(ue("valueCaveat"),{minutes:i.valueModel?.windowMinutes??30})})]}):l.jsx("p",{className:"px-2 py-3 text-meta",children:s(ue("valueNone"))})})]}),u==="scroll"&&l.jsxs(l.Fragment,{children:[l.jsx(Pi,{title:s(ue("reachTitle")),aside:s(ue("reachAside"))}),l.jsxs("div",{className:"min-h-0 flex-1 overflow-y-auto px-4 pb-3",children:[l.jsx("table",{className:"tnum w-full text-sm",children:l.jsx("tbody",{children:[10,25,50,75,90,100].map(pe=>{const De=oc(i.scroll,pe);return l.jsxs("tr",{className:"border-b border-border",children:[l.jsxs("td",{className:"py-2",children:[l.jsx("i",{className:"mr-2 inline-block size-2.5 rounded-sm align-[-1px]",style:{background:cc(b,De,.9)}}),s(ue("reachRow"),{d:String(pe)})]}),l.jsx("td",{className:"py-2 text-right text-foreground",children:xt(De,n)})]},pe)})})}),l.jsx("p",{className:"mt-3 text-meta",children:s(ue("foldNote"))})]})]}),(u==="sections"||u==="attention")&&l.jsxs(l.Fragment,{children:[l.jsx(Pi,{title:s(ue(u==="sections"?"sectionsByClicks":"sectionsByTime")),aside:s(ue("nSections"),{n:Fe(gs.length,n)})}),l.jsx("div",{className:"flex min-h-0 flex-1 flex-col gap-1.5 overflow-y-auto px-2 pb-3",children:gs.map(pe=>{const De=`blk:${pe.key}`,Fs=u==="sections"?pe.clicks:pe.seconds??0;return l.jsx(Ci,{id:De,label:pe.name,value:u==="sections"?Fe(pe.clicks*be,n):Ti(pe.seconds,n),meter:Fs/_s,active:Tt===De,onEnter:()=>se(De),onLeave:oe,onPick:()=>fe(De),sub:[pe.heading,pe.reach!=null?s(ue("saw"),{pct:xt(pe.reach,n)}):"",qt.get(pe.key)?.seenViews?s(ue("ctrSub"),{pct:xt((qt.get(pe.key)?.ctrPct??0)/100,n,1)}):""].filter(Boolean).join(", ")},De)})})]})]}),e[28]=$,e[29]=L.w,e[30]=le,e[31]=p,e[32]=g,e[33]=h,e[34]=m,e[35]=se,e[36]=be,e[37]=v,e[38]=ge,e[39]=X,e[40]=C,e[41]=oe,e[42]=ve,e[43]=n,e[44]=u,e[45]=i,e[46]=x,e[47]=c,e[48]=j,e[49]=fe,e[50]=E,e[51]=P,e[52]=R,e[53]=b,e[54]=K,e[55]=A,e[56]=me,e[57]=a,e[58]=ee,e[59]=k,e[60]=s,e[61]=o,e[62]=d,e[63]=w,e[64]=we,e[65]=$e,e[66]=je,e[67]=xe,e[68]=ke,e[69]=_e,e[70]=Ae,e[71]=Pe,e[72]=Be}else we=e[64],$e=e[65],je=e[66],xe=e[67],ke=e[68],_e=e[69],Ae=e[70],Pe=e[71],Be=e[72];let Xe;e[311]!==we||e[312]!==$e?(Xe=l.jsx("div",{className:we,children:$e}),e[311]=we,e[312]=$e,e[313]=Xe):Xe=e[313];let st;e[314]!==je||e[315]!==xe||e[316]!==ke||e[317]!==Xe?(st=l.jsxs("aside",{className:je,children:[xe,ke,Xe]}),e[314]=je,e[315]=xe,e[316]=ke,e[317]=Xe,e[318]=st):st=e[318];let Ze;e[319]!==_e||e[320]!==Ae||e[321]!==st?(Ze=l.jsxs("div",{className:_e,children:[Ae,st]}),e[319]=_e,e[320]=Ae,e[321]=st,e[322]=Ze):Ze=e[322];let lt;return e[323]!==Pe||e[324]!==Be||e[325]!==Ze?(lt=l.jsxs("div",{className:Pe,children:[Be,Ze]}),e[323]=Pe,e[324]=Be,e[325]=Ze,e[326]=lt):lt=e[326],lt}function Fh(t){return!t}function zh(t,e){return l.jsxs("span",{title:t.hint,children:[e>0&&l.jsx("span",{"aria-hidden":!0,children:"· "}),t.text]},t.text)}function Vh(t){return t!==!1}function qh(t){return t+1}function Kh(t,e){return e.revenue-t.revenue}function Bh(t){return t.revenue>0||t.clickVisitors>0}function Hh(t){return[t.root,t]}function Wh(t){return[t.key,t]}function Uh(t){return[t.key,t]}function Gh(t){return t==="ready"?t:"timeout"}function Yh(t,e){if(!t.views)return null;const s=Math.min(39,Math.floor(e*40));return(t.attention.find(n=>n.band===s)?.ds??0)/10/t.views}function qn(t){const e=O.c(3),{title:s,children:n}=t;let i;return e[0]!==n||e[1]!==s?(i=l.jsx(Ye,{variant:"muted",size:"sm",title:s,children:n}),e[0]=n,e[1]=s,e[2]=i):i=e[2],i}function Ws(t){const e=O.c(11),{label:s,value:n,sub:i,title:r}=t;let a;e[0]!==s?(a=l.jsx("span",{className:"text-meta",children:s}),e[0]=s,e[1]=a):a=e[1];let o;e[2]!==n?(o=l.jsx("span",{className:"font-display tnum text-2xl text-foreground",children:n}),e[2]=n,e[3]=o):o=e[3];let c;e[4]!==i?(c=i&&l.jsx("span",{className:"text-meta",children:i}),e[4]=i,e[5]=c):c=e[5];let d;return e[6]!==a||e[7]!==o||e[8]!==c||e[9]!==r?(d=l.jsxs("div",{className:"flex min-w-0 flex-col gap-1",title:r,children:[a,o,c]}),e[6]=a,e[7]=o,e[8]=c,e[9]=r,e[10]=d):d=e[10],d}function Qh(t){const e=O.c(62),{t:s,locale:n,mode:i,label:r,section:a,el:o,est:c,ctr:d,value:m,currency:u,funnel:f,page:p,onBack:x}=t;let h;e[0]!==o.rage||e[1]!==c||e[2]!==n||e[3]!==s?(h=o.rage>0&&s(ue("badgeRage"),{n:Fe(o.rage*c,n)}),e[0]=o.rage,e[1]=c,e[2]=n,e[3]=s,e[4]=h):h=e[4];let g;e[5]!==o.dead||e[6]!==c||e[7]!==n||e[8]!==s?(g=o.dead>0&&s(ue("badgeDead"),{n:Fe(o.dead*c,n)}),e[5]=o.dead,e[6]=c,e[7]=n,e[8]=s,e[9]=g):g=e[9];let v;e[10]!==o.error||e[11]!==c||e[12]!==n||e[13]!==s?(v=o.error>0&&s(ue("badgeError"),{n:Fe(o.error*c,n)}),e[10]=o.error,e[11]=c,e[12]=n,e[13]=s,e[14]=v):v=e[14];let b;e[15]!==h||e[16]!==g||e[17]!==v?(b=[h,g,v].filter(Zh),e[15]=h,e[16]=g,e[17]=v,e[18]=b):b=e[18];const y=b;let j;e[19]===Symbol.for("react.memo_cache_sentinel")?(j=l.jsx(b1,{size:14}),e[19]=j):j=e[19];let N;e[20]!==s?(N=s(ue("backToList")),e[20]=s,e[21]=N):N=e[21];let w;e[22]!==x||e[23]!==N?(w=l.jsx("div",{className:"px-2 pt-3",children:l.jsxs(Se,{variant:"ghost",size:"sm",onClick:x,className:"gap-1 font-normal text-muted-foreground",children:[j,N]})}),e[22]=x,e[23]=N,e[24]=w):w=e[24];let S;e[25]!==r?(S=l.jsx("h3",{className:"truncate text-sm font-medium text-foreground",title:r,children:r}),e[25]=r,e[26]=S):S=e[26];let k;e[27]!==a?(k=a&&l.jsx("span",{className:"text-meta truncate",children:a}),e[27]=a,e[28]=k):k=e[28];let _;e[29]!==S||e[30]!==k?(_=l.jsxs("div",{className:"flex min-w-0 flex-col gap-1",children:[S,k]}),e[29]=S,e[30]=k,e[31]=_):_=e[31];let $;e[32]!==d||e[33]!==u||e[34]!==o.clicks||e[35]!==c||e[36]!==n||e[37]!==i||e[38]!==s||e[39]!==m?($=i==="value"&&m?l.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[l.jsx(Ws,{label:s(ue("value")),value:gd(m.revenue,u,n)}),l.jsx(Ws,{label:s(ue("funnel_bought")),value:xt(m.cvrPct/100,n,1),sub:s(ue("funnelPeople"),{n:Fe(m.clickVisitors,n)})})]}):l.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[l.jsx(Ws,{label:s(ue("statClicks")),value:Fe(o.clicks*c,n)}),l.jsx(Ws,{label:s(ue("rankCtr")),value:d?.seen?xt(d.ctr,n,1):"—"})]}),e[32]=d,e[33]=u,e[34]=o.clicks,e[35]=c,e[36]=n,e[37]=i,e[38]=s,e[39]=m,e[40]=$):$=e[40];let T;e[41]!==n||e[42]!==i||e[43]!==s||e[44]!==m?(T=i==="value"&&m&&!m.smallSample&&m.rpvIndex>0&&l.jsx("span",{title:s(ue("valueIndexHint")),className:ye("text-sm",m.rpvIndex>=1?"text-success":"text-warning"),children:s(ue("valueIndex"),{x:m.rpvIndex.toLocaleString(n,{maximumFractionDigits:2})})}),e[41]=n,e[42]=i,e[43]=s,e[44]=m,e[45]=T):T=e[45];let P;e[46]!==y?(P=y.length>0&&l.jsx("div",{className:"flex flex-wrap gap-1.5",children:y.map(Xh)}),e[46]=y,e[47]=P):P=e[47];let I;e[48]!==_||e[49]!==$||e[50]!==T||e[51]!==P?(I=l.jsxs("div",{className:"flex flex-col gap-5 border-b border-border px-4 pt-3 pb-5",children:[_,$,T,P]}),e[48]=_,e[49]=$,e[50]=T,e[51]=P,e[52]=I):I=e[52];let C;e[53]!==f||e[54]!==n||e[55]!==p||e[56]!==s?(C=f&&l.jsx(Jh,{t:s,locale:n,f,page:p}),e[53]=f,e[54]=n,e[55]=p,e[56]=s,e[57]=C):C=e[57];let M;return e[58]!==I||e[59]!==C||e[60]!==w?(M=l.jsxs("div",{className:"flex min-h-0 flex-1 flex-col overflow-y-auto",children:[w,I,C]}),e[58]=I,e[59]=C,e[60]=w,e[61]=M):M=e[61],M}function Xh(t){return l.jsx(qn,{children:t},t)}function Zh(t){return!!t}function Jh(t){const e=O.c(27),{t:s,locale:n,f:i,page:r}=t,a=e0;let o;e[0]!==s?(o=s(ue("funnelTitle")),e[0]=s,e[1]=o):o=e[1];let c;e[2]!==o?(c=l.jsx("h4",{className:"text-sm text-foreground/70",children:o}),e[2]=o,e[3]=c):c=e[3];let d;e[4]!==i.visitors||e[5]!==n||e[6]!==s?(d=s(ue("funnelPeople"),{n:Fe(i.visitors,n)}),e[4]=i.visitors,e[5]=n,e[6]=s,e[7]=d):d=e[7];let m;e[8]!==i.visitors||e[9]!==s?(m=i.visitors<30?` · ${s(ue("valueSmall"))}`:"",e[8]=i.visitors,e[9]=s,e[10]=m):m=e[10];let u;e[11]!==d||e[12]!==m?(u=l.jsxs("span",{className:"text-meta tnum",children:[d,m]}),e[11]=d,e[12]=m,e[13]=u):u=e[13];let f;e[14]!==c||e[15]!==u?(f=l.jsxs("div",{className:"flex items-baseline justify-between gap-2",children:[c,u]}),e[14]=c,e[15]=u,e[16]=f):f=e[16];let p;e[17]!==i||e[18]!==n||e[19]!==r||e[20]!==s?(p=hh.map(g=>{const v=a(i[g],i.visitors),b=r?a(r[g],r.visitors):null;return l.jsxs("li",{className:"flex flex-col gap-1.5",children:[l.jsxs("div",{className:"flex items-baseline justify-between gap-3 text-sm text-foreground",children:[l.jsx("span",{className:"truncate",children:s(ue(`funnel_${g}`))}),l.jsx("span",{className:"tnum shrink-0",children:xt(v,n,1)})]}),l.jsx("div",{className:"surface-inset h-1.5 overflow-hidden rounded-full",children:l.jsx("div",{className:"h-full rounded-full bg-chart-1",style:{width:`${Math.min(100,v*100)}%`}})}),b!=null&&l.jsx("span",{className:"text-meta tnum",children:l.jsx("span",{className:ye(v>=b?"text-success":"text-warning"),children:s(ue("funnelVsPage"),{pct:xt(b,n,1)})})})]},g)}),e[17]=i,e[18]=n,e[19]=r,e[20]=s,e[21]=p):p=e[21];let x;e[22]!==p?(x=l.jsx("ol",{className:"flex flex-col gap-4",children:p}),e[22]=p,e[23]=x):x=e[23];let h;return e[24]!==f||e[25]!==x?(h=l.jsxs("section",{className:"flex flex-col gap-4 px-4 py-5",children:[f,x]}),e[24]=f,e[25]=x,e[26]=h):h=e[26],h}function e0(t,e){return e?t/e:0}function Pi(t){const e=O.c(7),{title:s,aside:n}=t;let i;e[0]!==s?(i=l.jsx("h3",{className:"text-sm font-medium text-foreground",children:s}),e[0]=s,e[1]=i):i=e[1];let r;e[2]!==n?(r=typeof n=="string"?l.jsx("span",{className:"text-meta",children:n}):n,e[2]=n,e[3]=r):r=e[3];let a;return e[4]!==i||e[5]!==r?(a=l.jsxs("div",{className:"flex min-h-12 items-center justify-between gap-2 px-4 pt-4 pb-2",children:[i,r]}),e[4]=i,e[5]=r,e[6]=a):a=e[6],a}function Ci(t){const e=O.c(24),s=t.id,n=t.active,i=t.onEnter,r=t.onLeave,a=t.onEnter,o=t.onLeave,c=t.onPick,d=t.active&&"bg-accent";let m;e[0]!==d?(m=ye("focus-ring flex w-full flex-col gap-1 rounded-md py-1 text-left hover:bg-accent/60",d),e[0]=d,e[1]=m):m=e[1];const u=`${Math.min(100,t.meter*100)}%`;let f;e[2]!==u?(f=l.jsx("span",{className:"surface-inset absolute inset-y-0 left-0 rounded-md",style:{width:u}}),e[2]=u,e[3]=f):f=e[3];let p;e[4]!==t.label?(p=l.jsx("span",{className:"relative min-w-0 flex-1 truncate",title:t.label,children:t.label}),e[4]=t.label,e[5]=p):p=e[5];let x;e[6]!==t.value?(x=l.jsx("span",{className:"tnum relative shrink-0",children:t.value}),e[6]=t.value,e[7]=x):x=e[7];let h;e[8]!==f||e[9]!==p||e[10]!==x?(h=l.jsxs("span",{className:"relative flex items-center gap-2 rounded-md px-2 py-1 text-sm text-foreground",children:[f,p,x]}),e[8]=f,e[9]=p,e[10]=x,e[11]=h):h=e[11];let g;e[12]!==t.children||e[13]!==t.sub?(g=(t.sub||t.children)&&l.jsxs("span",{className:"text-meta flex min-w-0 items-center gap-1.5 px-2",children:[l.jsx("span",{className:"truncate",children:t.sub}),t.children]}),e[12]=t.children,e[13]=t.sub,e[14]=g):g=e[14];let v;return e[15]!==t.active||e[16]!==t.id||e[17]!==t.onEnter||e[18]!==t.onLeave||e[19]!==t.onPick||e[20]!==h||e[21]!==g||e[22]!==m?(v=l.jsxs("button",{type:"button","data-hm-key":s,"aria-current":n,onMouseEnter:i,onMouseLeave:r,onFocus:a,onBlur:o,onClick:c,className:m,children:[h,g]}),e[15]=t.active,e[16]=t.id,e[17]=t.onEnter,e[18]=t.onLeave,e[19]=t.onPick,e[20]=h,e[21]=g,e[22]=m,e[23]=v):v=e[23],v}function ws(t){const e=O.c(7),{label:s,value:n}=t;let i;e[0]!==s?(i=l.jsx("span",{children:s}),e[0]=s,e[1]=i):i=e[1];let r;e[2]!==n?(r=l.jsx("span",{children:n}),e[2]=n,e[3]=r):r=e[3];let a;return e[4]!==i||e[5]!==r?(a=l.jsxs("div",{className:"flex justify-between gap-3.5 tabular-nums opacity-90",children:[i,r]}),e[4]=i,e[5]=r,e[6]=a):a=e[6],a}function Wi(t){const e=O.c(5),{title:s,children:n}=t;let i;e[0]!==s?(i=s&&l.jsx("h3",{className:"mb-1 font-medium text-foreground",children:s}),e[0]=s,e[1]=i):i=e[1];let r;return e[2]!==n||e[3]!==i?(r=l.jsx("div",{className:"pointer-events-none absolute inset-0 z-[5] flex items-center justify-center p-6 text-center",children:l.jsxs("div",{className:"surface max-w-sm px-5 py-4 text-sm text-muted-foreground",children:[i,n]})}),e[2]=n,e[3]=i,e[4]=r):r=e[4],r}function t0(t){const e=O.c(26),{t:s,page:n,onPick:i}=t,[r,a]=Z.useState("");let o;e[0]!==s?(o=s(ue("sampleTitle")),e[0]=s,e[1]=o):o=e[1];let c;e[2]!==n||e[3]!==s?(c=s(ue("sampleDescription"),{page:n}),e[2]=n,e[3]=s,e[4]=c):c=e[4];let d;e[5]!==i||e[6]!==r?(d=v=>{v.preventDefault(),r.trim().startsWith("/")&&!r.includes(":")&&i(r.trim())},e[5]=i,e[6]=r,e[7]=d):d=e[7];let m;e[8]!==s?(m=s(ue("samplePlaceholder")),e[8]=s,e[9]=m):m=e[9];let u;e[10]===Symbol.for("react.memo_cache_sentinel")?(u=v=>a(v.target.value),e[10]=u):u=e[10];let f;e[11]!==m||e[12]!==r?(f=l.jsx(ds,{value:r,placeholder:m,onChange:u,className:"h-8 flex-1 font-mono text-xs"}),e[11]=m,e[12]=r,e[13]=f):f=e[13];let p;e[14]!==s?(p=s(ue("sampleShow")),e[14]=s,e[15]=p):p=e[15];let x;e[16]!==p?(x=l.jsx(Se,{type:"submit",size:"sm",children:p}),e[16]=p,e[17]=x):x=e[17];let h;e[18]!==d||e[19]!==f||e[20]!==x?(h=l.jsxs("form",{className:"mt-2.5 flex gap-1.5",onSubmit:d,children:[f,x]}),e[18]=d,e[19]=f,e[20]=x,e[21]=h):h=e[21];let g;return e[22]!==o||e[23]!==c||e[24]!==h?(g=l.jsxs(Wi,{title:o,children:[c,h]}),e[22]=o,e[23]=c,e[24]=h,e[25]=g):g=e[25],g}function s0(t){const e=O.c(148),s=ie(),n=wr(t,"behaviour");if(n.isLoading){let le;return e[0]===Symbol.for("react.memo_cache_sentinel")?(le=l.jsx(Nr,{}),e[0]=le):le=e[0],le}if(n.error){let le;return e[1]!==n.error?(le=l.jsx(kr,{error:n.error}),e[1]=n.error,e[2]=le):le=e[2],le}const i=n.data;let r;e[3]!==s?(r=s("monitor.analytics.panels.group.acquisition"),e[3]=s,e[4]=r):r=e[4];let a;e[5]!==s?(a=s("monitor.analytics.panels.channels"),e[5]=s,e[6]=a):a=e[6];let o;e[7]!==i?(o=Ot(Ve(i,"channels")),e[7]=i,e[8]=o):o=e[8];let c;e[9]!==a||e[10]!==o?(c=l.jsx(ht,{title:a,rows:o,dim:"channel"}),e[9]=a,e[10]=o,e[11]=c):c=e[11];let d;e[12]!==s?(d=s("monitor.analytics.panels.sources"),e[12]=s,e[13]=d):d=e[13];let m;e[14]!==i?(m=Ot(Ve(i,"sources")),e[14]=i,e[15]=m):m=e[15];let u;e[16]!==d||e[17]!==m?(u=l.jsx(ht,{title:d,rows:m,dim:"source"}),e[16]=d,e[17]=m,e[18]=u):u=e[18];let f;e[19]!==s?(f=s("monitor.analytics.panels.campaigns"),e[19]=s,e[20]=f):f=e[20];let p;e[21]!==i?(p=Ot(Ve(i,"campaigns")),e[21]=i,e[22]=p):p=e[22];let x;e[23]!==f||e[24]!==p?(x=l.jsx(ht,{title:f,rows:p}),e[23]=f,e[24]=p,e[25]=x):x=e[25];let h;e[26]!==s?(h=s("monitor.analytics.panels.campaignNames"),e[26]=s,e[27]=h):h=e[27];let g;e[28]!==i?(g=Ve(i,"campaignNames").map(l0),e[28]=i,e[29]=g):g=e[29];let v;e[30]!==s?(v=le=>"converters"in le?s("monitor.analytics.panels.convertersShort",{n:ze(le.converters)}):null,e[30]=s,e[31]=v):v=e[31];let b;e[32]!==h||e[33]!==g||e[34]!==v?(b=l.jsx(ht,{title:h,rows:g,dim:"utmCampaign",extra:v}),e[32]=h,e[33]=g,e[34]=v,e[35]=b):b=e[35];let y;e[36]!==b||e[37]!==c||e[38]!==u||e[39]!==x?(y=l.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[c,u,x,b]}),e[36]=b,e[37]=c,e[38]=u,e[39]=x,e[40]=y):y=e[40];let j;e[41]!==i?(j=Ve(i,"attribution"),e[41]=i,e[42]=j):j=e[42];let N;e[43]!==j?(N=l.jsx(n0,{rows:j}),e[43]=j,e[44]=N):N=e[44];let w;e[45]!==i?(w=Ve(i,"channelConversion"),e[45]=i,e[46]=w):w=e[46];let S;e[47]!==i?(S=Qx(i),e[47]=i,e[48]=S):S=e[48];let k;e[49]!==w||e[50]!==S?(k=l.jsx(u0,{rows:w,money:S}),e[49]=w,e[50]=S,e[51]=k):k=e[51];let _;e[52]!==r||e[53]!==y||e[54]!==N||e[55]!==k?(_=l.jsxs(dn,{title:r,children:[y,N,k]}),e[52]=r,e[53]=y,e[54]=N,e[55]=k,e[56]=_):_=e[56];let $;e[57]!==s?($=s("monitor.analytics.panels.group.pages"),e[57]=s,e[58]=$):$=e[58];let T;e[59]!==s?(T=s("monitor.analytics.panels.pages"),e[59]=s,e[60]=T):T=e[60];let P;e[61]!==s?(P=s("monitor.analytics.panels.kpi.pageviews"),e[61]=s,e[62]=P):P=e[62];let I;e[63]!==P?(I=l.jsx("span",{className:"text-meta",children:P}),e[63]=P,e[64]=I):I=e[64];let C;e[65]!==i?(C=Ot(Ve(i,"pages")),e[65]=i,e[66]=C):C=e[66];let M;e[67]!==T||e[68]!==I||e[69]!==C?(M=l.jsx(ht,{title:T,aside:I,rows:C,dim:"path"}),e[67]=T,e[68]=I,e[69]=C,e[70]=M):M=e[70];let A;e[71]!==s?(A=s("monitor.analytics.panels.entryPages"),e[71]=s,e[72]=A):A=e[72];let F;e[73]!==i?(F=Ot(Ve(i,"entryPages")),e[73]=i,e[74]=F):F=e[74];let E;e[75]!==A||e[76]!==F?(E=l.jsx(ht,{title:A,rows:F,dim:"path"}),e[75]=A,e[76]=F,e[77]=E):E=e[77];let z;e[78]!==s?(z=s("monitor.analytics.panels.exitPages"),e[78]=s,e[79]=z):z=e[79];let R;e[80]!==i?(R=Ot(Ve(i,"exitPages")),e[80]=i,e[81]=R):R=e[81];let V;e[82]!==z||e[83]!==R?(V=l.jsx(ht,{title:z,rows:R,dim:"path"}),e[82]=z,e[83]=R,e[84]=V):V=e[84];let K;e[85]!==M||e[86]!==E||e[87]!==V?(K=l.jsxs("div",{className:"grid gap-4 lg:grid-cols-3",children:[M,E,V]}),e[85]=M,e[86]=E,e[87]=V,e[88]=K):K=e[88];let U;e[89]!==$||e[90]!==K?(U=l.jsx(dn,{title:$,children:K}),e[89]=$,e[90]=K,e[91]=U):U=e[91];let q;e[92]!==i||e[93]!==s?(q=Ve(i,"products").length>0&&l.jsx(dn,{title:s("monitor.analytics.panels.group.products"),children:l.jsx(b0,{rows:Ve(i,"products")})}),e[92]=i,e[93]=s,e[94]=q):q=e[94];let L;e[95]!==s?(L=s("monitor.analytics.panels.group.audience"),e[95]=s,e[96]=L):L=e[96];let B;e[97]!==s?(B=s("monitor.analytics.panels.devices"),e[97]=s,e[98]=B):B=e[98];let Y;e[99]!==i?(Y=Ot(Ve(i,"devices")),e[99]=i,e[100]=Y):Y=e[100];let J;e[101]!==B||e[102]!==Y?(J=l.jsx(ht,{title:B,rows:Y}),e[101]=B,e[102]=Y,e[103]=J):J=e[103];let X;e[104]!==s?(X=s("monitor.analytics.panels.os"),e[104]=s,e[105]=X):X=e[105];let ee;e[106]!==i?(ee=Ot(Ve(i,"os")),e[106]=i,e[107]=ee):ee=e[107];let te;e[108]!==X||e[109]!==ee?(te=l.jsx(ht,{title:X,rows:ee,dim:"os"}),e[108]=X,e[109]=ee,e[110]=te):te=e[110];let D;e[111]!==s?(D=s("monitor.analytics.panels.countries"),e[111]=s,e[112]=D):D=e[112];let W;e[113]!==i?(W=Ot(Ve(i,"countries")),e[113]=i,e[114]=W):W=e[114];let G;e[115]!==D||e[116]!==W?(G=l.jsx(ht,{title:D,rows:W,dim:"country",label:sh}),e[115]=D,e[116]=W,e[117]=G):G=e[117];let Q;e[118]!==J||e[119]!==te||e[120]!==G?(Q=l.jsxs("div",{className:"grid gap-4 lg:grid-cols-3",children:[J,te,G]}),e[118]=J,e[119]=te,e[120]=G,e[121]=Q):Q=e[121];let re;e[122]!==s?(re=s("monitor.analytics.panels.regions"),e[122]=s,e[123]=re):re=e[123];let ce;e[124]!==i?(ce=Ot(Ve(i,"regions")),e[124]=i,e[125]=ce):ce=e[125];let ae;e[126]!==re||e[127]!==ce?(ae=l.jsx(ht,{title:re,rows:ce,dim:"region"}),e[126]=re,e[127]=ce,e[128]=ae):ae=e[128];let fe;e[129]!==s?(fe=s("monitor.analytics.panels.cities"),e[129]=s,e[130]=fe):fe=e[130];let de;e[131]!==i?(de=Ot(Ve(i,"cities")),e[131]=i,e[132]=de):de=e[132];let se;e[133]!==fe||e[134]!==de?(se=l.jsx(ht,{title:fe,rows:de,dim:"city"}),e[133]=fe,e[134]=de,e[135]=se):se=e[135];let H;e[136]!==ae||e[137]!==se?(H=l.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[ae,se]}),e[136]=ae,e[137]=se,e[138]=H):H=e[138];let oe;e[139]!==L||e[140]!==Q||e[141]!==H?(oe=l.jsxs(dn,{title:L,children:[Q,H]}),e[139]=L,e[140]=Q,e[141]=H,e[142]=oe):oe=e[142];let he;return e[143]!==_||e[144]!==U||e[145]!==q||e[146]!==oe?(he=l.jsxs(l.Fragment,{children:[_,U,q,oe]}),e[143]=_,e[144]=U,e[145]=q,e[146]=oe,e[147]=he):he=e[147],he}function l0(t){return{k:tt(t.k),n:gt(t.n),converters:gt(t.converters)}}function n0(t){const e=O.c(36),{rows:s}=t,n=ie();if(s.length===0)return null;let i;e[0]!==s?(i=Math.max(1,...s.map(m0)),e[0]=s,e[1]=i):i=e[1];const r=i;let a;e[2]!==n?(a=n("monitor.analytics.panels.col.channel"),e[2]=n,e[3]=a):a=e[3];let o;e[4]!==a?(o={id:"k",header:a,cell:d0},e[4]=a,e[5]=o):o=e[5];let c;e[6]===Symbol.for("react.memo_cache_sentinel")?(c=l.jsx("span",{className:"size-2 rounded-full bg-chart-4"}),e[6]=c):c=e[6];let d;e[7]!==n?(d=n("monitor.analytics.panels.col.firstTouch"),e[7]=n,e[8]=d):d=e[8];let m;e[9]!==d?(m={id:"first",header:l.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[c,d]}),numeric:!0,cell:c0},e[9]=d,e[10]=m):m=e[10];let u;e[11]===Symbol.for("react.memo_cache_sentinel")?(u=l.jsx("span",{className:"size-2 rounded-full bg-chart-1"}),e[11]=u):u=e[11];let f;e[12]!==n?(f=n("monitor.analytics.panels.col.lastTouch"),e[12]=n,e[13]=f):f=e[13];let p;e[14]!==f?(p={id:"last",header:l.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[u,f]}),numeric:!0,cell:o0},e[14]=f,e[15]=p):p=e[15];let x;e[16]!==n?(x=n("monitor.analytics.panels.col.shift"),e[16]=n,e[17]=x):x=e[17];let h;e[18]!==x?(h={id:"shift",header:x,numeric:!0,cell:a0},e[18]=x,e[19]=h):h=e[19];let g;e[20]!==r?(g={id:"bar",header:"",className:"w-[34%]",cell:w=>l.jsxs("div",{className:"flex flex-col gap-1",children:[l.jsx("div",{className:"h-1.5 rounded-full bg-chart-4",style:{width:`${100*gt(w.first_touch)/r}%`}}),l.jsx("div",{className:"h-1.5 rounded-full bg-chart-1",style:{width:`${100*gt(w.last_touch)/r}%`}})]})},e[20]=r,e[21]=g):g=e[21];let v;e[22]!==h||e[23]!==g||e[24]!==o||e[25]!==m||e[26]!==p?(v=[o,m,p,h,g],e[22]=h,e[23]=g,e[24]=o,e[25]=m,e[26]=p,e[27]=v):v=e[27];const b=v;let y;e[28]!==n?(y=n("monitor.analytics.panels.attribution"),e[28]=n,e[29]=y):y=e[29];let j;e[30]!==b||e[31]!==s?(j=l.jsx(rl,{columns:b,rows:s,rowKey:r0,filter:i0}),e[30]=b,e[31]=s,e[32]=j):j=e[32];let N;return e[33]!==y||e[34]!==j?(N=l.jsx(Mt,{title:y,children:j}),e[33]=y,e[34]=j,e[35]=N):N=e[35],N}function i0(t){return{d:"channel",v:tt(t.k)}}function r0(t){return tt(t.k)}function a0(t){const e=gt(t.last_touch)-gt(t.first_touch);return e===0?l.jsx("span",{className:"text-muted-foreground",children:"—"}):l.jsxs("span",{className:ye(e>0?"text-success":"text-destructive"),children:[e>0?"+":"−",ze(Math.abs(e))]})}function o0(t){return ze(t.last_touch)}function c0(t){return ze(t.first_touch)}function d0(t){return l.jsx(ci,{children:tt(t.k)})}function m0(t){return Math.max(gt(t.first_touch),gt(t.last_touch))}function u0(t){const e=O.c(39),{rows:s,money:n}=t,i=ie();if(s.length===0)return null;let r;e[0]!==i?(r=i("monitor.analytics.panels.col.channel"),e[0]=i,e[1]=r):r=e[1];let a;e[2]!==r?(a={id:"k",header:r,cell:v0},e[2]=r,e[3]=a):a=e[3];let o;e[4]!==i?(o=i("monitor.analytics.panels.col.visitors"),e[4]=i,e[5]=o):o=e[5];let c;e[6]!==o?(c={id:"visitors",header:o,numeric:!0,cell:g0},e[6]=o,e[7]=c):c=e[7];let d;e[8]!==i?(d=i("monitor.analytics.panels.col.converters"),e[8]=i,e[9]=d):d=e[9];let m;e[10]!==d?(m={id:"converters",header:d,numeric:!0,cell:h0},e[10]=d,e[11]=m):m=e[11];let u;e[12]!==i?(u=i("monitor.analytics.panels.col.conversion"),e[12]=i,e[13]=u):u=e[13];let f;e[14]!==u?(f={id:"cr",header:u,numeric:!0,cell:x0},e[14]=u,e[15]=f):f=e[15];let p;e[16]!==n.currency||e[17]!==i?(p=n.currency?i("monitor.analytics.panels.col.revenueIn",{currency:n.currency}):i("monitor.analytics.panels.col.revenue"),e[16]=n.currency,e[17]=i,e[18]=p):p=e[18];let x;e[19]!==n.currency||e[20]!==n.hasRevenue?(x=N=>n.hasRevenue?Zx(N.revenue,n.currency):"—",e[19]=n.currency,e[20]=n.hasRevenue,e[21]=x):x=e[21];let h;e[22]!==x||e[23]!==p?(h={id:"revenue",header:p,numeric:!0,cell:x},e[22]=x,e[23]=p,e[24]=h):h=e[24];let g;e[25]!==h||e[26]!==a||e[27]!==c||e[28]!==m||e[29]!==f?(g=[a,c,m,f,h],e[25]=h,e[26]=a,e[27]=c,e[28]=m,e[29]=f,e[30]=g):g=e[30];const v=g;let b;e[31]!==i?(b=i("monitor.analytics.panels.channelPerformance"),e[31]=i,e[32]=b):b=e[32];let y;e[33]!==v||e[34]!==s?(y=l.jsx(rl,{columns:v,rows:s,rowKey:p0,filter:f0}),e[33]=v,e[34]=s,e[35]=y):y=e[35];let j;return e[36]!==b||e[37]!==y?(j=l.jsx(Mt,{title:b,children:y}),e[36]=b,e[37]=y,e[38]=j):j=e[38],j}function f0(t){return{d:"channel",v:tt(t.k)}}function p0(t){return tt(t.k)}function x0(t){return Os(qe(t.cr),2)}function h0(t){return ze(t.converters)}function g0(t){return ze(t.visitors)}function v0(t){return l.jsx(ci,{children:tt(t.k)})}function b0(t){const e=O.c(61),{rows:s}=t,n=ie(),i=$0,r=_0;let a;if(e[0]!==s){let A;e[2]===Symbol.for("react.memo_cache_sentinel")?(A=F=>!i(F)||!r(F),e[2]=A):A=e[2],a=s.filter(A),e[0]=s,e[1]=a}else a=e[1];const o=a.length;let c;e[3]!==n?(c=(A,F,E)=>F?Os(qe(A),1):l.jsx(Zn,{label:n("monitor.analytics.panels.withheld"),tip:E}),e[3]=n,e[4]=c):c=e[4];const d=c;let m;e[5]!==n?(m=n("monitor.analytics.panels.col.item"),e[5]=n,e[6]=m):m=e[6];let u;e[7]!==m?(u={id:"k",header:m,className:"font-mono text-xs",cell:S0},e[7]=m,e[8]=u):u=e[8];let f;e[9]!==n?(f=n("monitor.analytics.panels.col.viewed"),e[9]=n,e[10]=f):f=e[10];let p;e[11]!==f?(p={id:"viewed",header:f,numeric:!0,cell:k0},e[11]=f,e[12]=p):p=e[12];let x;e[13]!==n?(x=n("monitor.analytics.panels.col.carted"),e[13]=n,e[14]=x):x=e[14];let h;e[15]!==x?(h={id:"carted",header:x,numeric:!0,cell:N0},e[15]=x,e[16]=h):h=e[16];let g;e[17]!==n?(g=n("monitor.analytics.panels.col.bought"),e[17]=n,e[18]=g):g=e[18];let v;e[19]!==g?(v={id:"bought",header:g,numeric:!0,cell:w0},e[19]=g,e[20]=v):v=e[20];let b;e[21]!==n?(b=n("monitor.analytics.panels.col.orders"),e[21]=n,e[22]=b):b=e[22];let y;e[23]!==b?(y={id:"orders",header:b,numeric:!0,cell:y0},e[23]=b,e[24]=y):y=e[24];let j;e[25]!==n?(j=n("monitor.analytics.panels.col.viewToCart"),e[25]=n,e[26]=j):j=e[26];let N;e[27]!==d||e[28]!==n?(N=A=>d(A.to_cart,i(A),n("monitor.analytics.panels.products.noViewTip")),e[27]=d,e[28]=n,e[29]=N):N=e[29];let w;e[30]!==j||e[31]!==N?(w={id:"toCart",header:j,numeric:!0,cell:N},e[30]=j,e[31]=N,e[32]=w):w=e[32];let S;e[33]!==n?(S=n("monitor.analytics.panels.col.cartToBuy"),e[33]=n,e[34]=S):S=e[34];let k;e[35]!==d||e[36]!==n?(k=A=>d(A.to_buy,r(A),n("monitor.analytics.panels.products.noCartTip")),e[35]=d,e[36]=n,e[37]=k):k=e[37];let _;e[38]!==S||e[39]!==k?(_={id:"toBuy",header:S,numeric:!0,cell:k},e[38]=S,e[39]=k,e[40]=_):_=e[40];let $;e[41]!==v||e[42]!==y||e[43]!==w||e[44]!==_||e[45]!==u||e[46]!==p||e[47]!==h?($=[u,p,h,v,y,w,_],e[41]=v,e[42]=y,e[43]=w,e[44]=_,e[45]=u,e[46]=p,e[47]=h,e[48]=$):$=e[48];const T=$;let P;e[49]!==n?(P=n("monitor.analytics.panels.productFunnel"),e[49]=n,e[50]=P):P=e[50];let I;e[51]!==o||e[52]!==n?(I=o>0&&l.jsx(Zn,{label:n("monitor.analytics.panels.products.withheldCount",{n:o}),tip:n("monitor.analytics.panels.products.withheldTip")}),e[51]=o,e[52]=n,e[53]=I):I=e[53];let C;e[54]!==T||e[55]!==s?(C=l.jsx(rl,{columns:T,rows:s,rowKey:j0}),e[54]=T,e[55]=s,e[56]=C):C=e[56];let M;return e[57]!==P||e[58]!==I||e[59]!==C?(M=l.jsx(Mt,{title:P,aside:I,children:C}),e[57]=P,e[58]=I,e[59]=C,e[60]=M):M=e[60],M}function j0(t){return tt(t.k)}function y0(t){return ze(t.orders)}function w0(t){return ze(t.bought)}function N0(t){return ze(t.carted)}function k0(t){return ze(t.viewed)}function S0(t){return tt(t.k)}function _0(t){return gt(t.bought)<=gt(t.carted)}function $0(t){return gt(t.carted)<=gt(t.viewed)}function T0(t){const e=O.c(31),s=ie(),n=wr(t,"events");if(n.isLoading){let w;return e[0]===Symbol.for("react.memo_cache_sentinel")?(w=l.jsx(Nr,{}),e[0]=w):w=e[0],w}if(n.error){let w;return e[1]!==n.error?(w=l.jsx(kr,{error:n.error}),e[1]=n.error,e[2]=w):w=e[2],w}const i=n.data;let r;e[3]!==i?(r=Ot(Ve(i,"scrollDepth")),e[3]=i,e[4]=r):r=e[4];const a=r;let o;e[5]!==i?(o=Ve(i,"searches").map(C0),e[5]=i,e[6]=o):o=e[6];const c=o;let d;e[7]!==i?(d=Ot(Ve(i,"outbound")),e[7]=i,e[8]=d):d=e[8];const m=d;let u;e[9]!==i?(u=Ot(Ve(i,"downloads")),e[9]=i,e[10]=u):u=e[10];const f=u,p=a.length+c.length+m.length+f.length>0;let x;e[11]!==t.status.config?.modules?(x=t.status.config?.modules?.includes("engagement")??!1,e[11]=t.status.config?.modules,e[12]=x):x=e[12];const h=x,g=P0;let v;e[13]!==s?(v=s("monitor.analytics.panels.events"),e[13]=s,e[14]=v):v=e[14];let b;e[15]!==i?(b=Ot(Ve(i,"events")),e[15]=i,e[16]=b):b=e[16];let y;e[17]!==v||e[18]!==b?(y=l.jsx(ht,{title:v,rows:b,dim:"name",limit:12}),e[17]=v,e[18]=b,e[19]=y):y=e[19];let j;e[20]!==f||e[21]!==p||e[22]!==h||e[23]!==m||e[24]!==a||e[25]!==c||e[26]!==s?(j=p?l.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[l.jsx(ht,{title:s("monitor.analytics.panels.scrollDepth"),rows:a,dim:"prop",filterValue:g("depth"),label:w=>s("monitor.analytics.panels.scrollReached",{pct:w}),share:!1}),l.jsx(ht,{title:s("monitor.analytics.panels.searches"),rows:c,dim:"prop",filterValue:g("term"),extra:w=>"visitors"in w?s("monitor.analytics.panels.visitorsShort",{n:ze(w.visitors)}):null}),l.jsx(ht,{title:s("monitor.analytics.panels.outbound"),rows:m,dim:"prop",filterValue:g("target")}),l.jsx(ht,{title:s("monitor.analytics.panels.downloads"),rows:f,dim:"prop",filterValue:g("target")})]}):h?l.jsx(fa,{icon:l.jsx(Xi,{size:20}),title:s("monitor.analytics.panels.engagementEmpty"),description:s("monitor.analytics.panels.engagementEmptyDesc")}):l.jsx(fa,{icon:l.jsx(Xi,{size:20}),title:s("monitor.analytics.panels.engagementOff"),description:s("monitor.analytics.panels.engagementOffDesc")}),e[20]=f,e[21]=p,e[22]=h,e[23]=m,e[24]=a,e[25]=c,e[26]=s,e[27]=j):j=e[27];let N;return e[28]!==y||e[29]!==j?(N=l.jsxs(l.Fragment,{children:[y,j]}),e[28]=y,e[29]=j,e[30]=N):N=e[30],N}function P0(t){return e=>`${t}=${e}`}function C0(t){return{k:tt(t.k),n:gt(t.n),visitors:gt(t.visitors)}}const E0=[];function vd(t){const e=O.c(30),{points:s,metric:n,label:i,color:r,format:a,thresholds:o}=t,c=r===void 0?"var(--chart-1)":r,d=a===void 0?ze:a,m=o===void 0?E0:o;let u;if(e[0]!==n||e[1]!==s){let k;e[3]!==n?(k=_=>({t:String(_.t??""),[n]:qe(_[n])}),e[3]=n,e[4]=k):k=e[4],u=s.map(k),e[0]=n,e[1]=s,e[2]=u}else u=e[2];const f=u;let p;e[5]!==c||e[6]!==i?(p={label:i,color:c},e[5]=c,e[6]=i,e[7]=p):p=e[7];let x;e[8]!==n||e[9]!==p?(x={[n]:p},e[8]=n,e[9]=p,e[10]=x):x=e[10];let h,g,v;e[11]===Symbol.for("react.memo_cache_sentinel")?(h={left:0,right:0,top:4},g=l.jsx(Ft,{strokeDasharray:"4 4",stroke:"var(--border)",strokeOpacity:.5,vertical:!1}),v=l.jsx(zt,{dataKey:"t",axisLine:!1,tickLine:!1,tick:mt,tickMargin:8,minTickGap:32,tickFormatter:fd}),e[11]=h,e[12]=g,e[13]=v):(h=e[11],g=e[12],v=e[13]);let b;e[14]!==d?(b=l.jsx(At,{orientation:"right",axisLine:!1,tickLine:!1,tick:mt,width:52,tickCount:4,allowDecimals:!1,tickFormatter:k=>d(k)}),e[14]=d,e[15]=b):b=e[15];let y;e[16]===Symbol.for("react.memo_cache_sentinel")?(y=l.jsx(es,{content:l.jsx(us,{labelFormatter:I0})}),e[16]=y):y=e[16];let j;e[17]!==m?(j=m.map(M0),e[17]=m,e[18]=j):j=e[18];let N;e[19]!==c||e[20]!==n?(N=l.jsx(Gt,{dataKey:n,type:"monotone",fill:c,fillOpacity:.15,stroke:c,strokeWidth:1.5,isAnimationActive:!1}),e[19]=c,e[20]=n,e[21]=N):N=e[21];let w;e[22]!==f||e[23]!==b||e[24]!==j||e[25]!==N?(w=l.jsxs(ri,{data:f,margin:h,children:[g,v,b,y,j,N]}),e[22]=f,e[23]=b,e[24]=j,e[25]=N,e[26]=w):w=e[26];let S;return e[27]!==w||e[28]!==x?(S=l.jsx(It,{config:x,className:"h-[170px] w-full",children:w}),e[27]=w,e[28]=x,e[29]=S):S=e[29],S}function M0(t){return l.jsx(Ls,{y:t.value,stroke:`var(--${t.tone})`,strokeDasharray:"3 3",strokeOpacity:.7,ifOverflow:"extendDomain"},t.value)}function I0(t){return fd(String(t))}const A0=["visitors","pageviews","events"];function Kr(t,e){switch(t){case"visitors":return e("monitor.analytics.panels.kpi.visitors");case"pageviews":return e("monitor.analytics.panels.kpi.pageviews");case"events":return e("monitor.analytics.panels.kpi.events");default:return t}}function L0(t){const e=O.c(17),s=ie(),n=wr(t,"overview"),[i,r]=Z.useState("visitors");if(n.isLoading){let f;return e[0]===Symbol.for("react.memo_cache_sentinel")?(f=l.jsx(Nr,{tiles:5}),e[0]=f):f=e[0],f}if(n.error){let f;return e[1]!==n.error?(f=l.jsx(kr,{error:n.error}),e[1]=n.error,e[2]=f):f=e[2],f}const a=n.data;let o,c,d;if(e[3]!==a||e[4]!==i||e[5]!==s){const f=fn(a,"kpis")??{},p=fn(a,"kpisPrev")??{},x=qe(p.covered),h=(qe(f.sessions_built)??1)>0,g=qe(f.min_sampling),v=Ve(a,"series"),b=A0.filter(w=>v.some(S=>w in S)),y=b.includes(i)?i:b[0]??"visitors",j=[{key:"visitors",title:s("monitor.analytics.panels.kpi.visitors"),value:ze(f.visitors),current:qe(f.visitors),previous:qe(p.visitors),better:"up",chart:"visitors"},{key:"pageviews",title:s("monitor.analytics.panels.kpi.pageviews"),value:ze(f.pageviews),current:qe(f.pageviews),previous:qe(p.pageviews),better:"up",chart:"pageviews"},{key:"sessions",title:s("monitor.analytics.panels.kpi.sessions"),value:h?ze(f.sessions):"—",current:h?qe(f.sessions):null,previous:qe(p.sessions),better:"up"},{key:"bounce",title:s("monitor.analytics.panels.kpi.bounce"),value:!h||qe(f.bounce_pct)===null?"—":Os(qe(f.bounce_pct),0),current:h?qe(f.bounce_pct):null,previous:qe(p.bounce_pct),better:"down",points:!0},{key:"duration",title:s("monitor.analytics.panels.kpi.duration"),value:h?Jx(f.duration_s):"—",current:h?qe(f.duration_s):null,previous:qe(p.duration_s),better:"up"}];let N;e[9]!==a?(N=fn(a,"funnel"),e[9]=a,e[10]=N):N=e[10],o=N,c=l.jsx("div",{className:"grid grid-cols-2 gap-4 lg:grid-cols-5",children:j.map(w=>l.jsx(Mt,{title:w.title,value:w.value,caption:l.jsx(ih,{current:w.current,previous:w.previous,covered:x,better:w.better,points:w.points}),onClick:w.chart&&b.includes(w.chart)?()=>r(w.chart??"visitors"):void 0},w.key))}),d=v.length>1&&l.jsx(Mt,{title:Kr(y,s),aside:l.jsxs("div",{className:"flex items-center gap-2",children:[g!==null&&g<1&&l.jsx(Zn,{label:s("monitor.analytics.panels.sampled",{pct:Math.round(100*g)}),tip:s("monitor.analytics.panels.sampledTip")}),b.length>1&&l.jsx(ct,{label:s("monitor.analytics.panels.chartMetric"),children:b.map(w=>l.jsx(ct.Item,{pressed:w===y,onClick:()=>r(w),children:Kr(w,s)},w))})]}),children:l.jsx(vd,{points:v,metric:y,label:Kr(y,s)})}),e[3]=a,e[4]=i,e[5]=s,e[6]=o,e[7]=c,e[8]=d}else o=e[6],c=e[7],d=e[8];let m;e[11]!==o?(m=o&&l.jsx(D0,{row:o}),e[11]=o,e[12]=m):m=e[12];let u;return e[13]!==c||e[14]!==d||e[15]!==m?(u=l.jsxs(l.Fragment,{children:[c,d,m]}),e[13]=c,e[14]=d,e[15]=m,e[16]=u):u=e[16],u}function D0(t){const e=O.c(19),{row:s}=t,n=ie();let i,r,a,o,c;if(e[0]!==s||e[1]!==n){const u=[{key:"viewed",label:n("monitor.analytics.panels.funnel.viewed")},{key:"view_item",label:n("monitor.analytics.panels.funnel.viewItem")},{key:"add_to_cart",label:n("monitor.analytics.panels.funnel.addToCart")},{key:"purchase",label:n("monitor.analytics.panels.funnel.purchase")}].filter(g=>g.key in s).map(g=>({...g,n:qe(s[g.key])??0})),f=Math.max(1,u[0]?.n??0),p=u.find(R0)?.n??0,x=u.find(O0)?.n??null,h=x!==null&&x<=p&&p>0?100*x/p:null;i=Mt,e[7]!==n?(o=n("monitor.analytics.panels.funnel.title"),e[7]=n,e[8]=o):o=e[8],e[9]!==h?(c=Os(h,1),e[9]=h,e[10]=c):c=e[10],r="flex flex-col gap-3",a=u.map((g,v)=>{const b=v>0?u[v-1]?.n??0:null,y=b!==null&&g.n>b;return l.jsxs("li",{className:"flex flex-col gap-1.5",children:[l.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[l.jsx("span",{className:"min-w-0 flex-1 truncate text-foreground",children:g.label}),b===null?null:y?l.jsx(Zn,{label:n("monitor.analytics.panels.funnel.wider"),tip:n("monitor.analytics.panels.funnel.widerTip")}):l.jsx("span",{className:"text-meta tnum",children:n("monitor.analytics.panels.funnel.ofPrev",{pct:Os(b?100*g.n/b:null,1)})}),l.jsx("span",{className:"tnum w-16 text-right text-foreground",children:ze(g.n)})]}),l.jsx("div",{className:"surface-inset h-2 overflow-hidden rounded-full",children:l.jsx("div",{className:"h-full rounded-full bg-chart-1",style:{width:`${Math.min(100,Math.max(.5,100*g.n/f))}%`}})})]},g.key)}),e[0]=s,e[1]=n,e[2]=i,e[3]=r,e[4]=a,e[5]=o,e[6]=c}else i=e[2],r=e[3],a=e[4],o=e[5],c=e[6];let d;e[11]!==r||e[12]!==a?(d=l.jsx("ol",{className:r,children:a}),e[11]=r,e[12]=a,e[13]=d):d=e[13];let m;return e[14]!==i||e[15]!==o||e[16]!==c||e[17]!==d?(m=l.jsx(i,{title:o,value:c,children:d}),e[14]=i,e[15]=o,e[16]=c,e[17]=d,e[18]=m):m=e[18],m}function O0(t){return t.key==="purchase"}function R0(t){return t.key==="viewed"}const F0="mainPanelTabs.analyticsTab.globe",Kt=t=>`${F0}.${t}`,dc=5e3,mc=2e3,z0=3,Br=[];function V0(t){return window.DQGlobe?Promise.resolve(window.DQGlobe):new Promise((e,s)=>{const n=document.createElement("script");n.src=t,n.async=!0,n.onload=()=>{const i=window.DQGlobe;i?e(i):s(new Error("globe bundle loaded without DQGlobe"))},n.onerror=()=>s(new Error("globe bundle failed to load")),document.head.appendChild(n)})}const q0={places:0,approximate:0,unplaced:0},uc="inline-flex items-center rounded-md px-2.5 py-1 text-xs font-medium transition-colors",fc="bg-background text-foreground shadow-xs",pc="text-muted-foreground hover:text-foreground",K0=[{kind:"visit",label:"legendVisits"},{kind:"cart",label:"legendCarts"},{kind:"goal",label:"legendConversions"}];function B0(t){const e=O.c(13),{kind:s}=t,n=`var(--globe-${s})`;let i;e[0]!==n||e[1]!==s?(i=s==="visit"&&l.jsx("circle",{cx:"8",cy:"8",r:"3.6",fill:n}),e[0]=n,e[1]=s,e[2]=i):i=e[2];let r;e[3]!==n||e[4]!==s?(r=s==="cart"&&l.jsx("path",{d:"M8 3.4 12.6 8 8 12.6 3.4 8Z",fill:n}),e[3]=n,e[4]=s,e[5]=r):r=e[5];let a;e[6]!==n||e[7]!==s?(a=s==="goal"&&l.jsxs(l.Fragment,{children:[l.jsx("circle",{cx:"8",cy:"8",r:"6",fill:"none",stroke:n,strokeWidth:"1.4"}),l.jsx("circle",{cx:"8",cy:"8",r:"2.8",fill:n})]}),e[6]=n,e[7]=s,e[8]=a):a=e[8];let o;return e[9]!==i||e[10]!==r||e[11]!==a?(o=l.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",className:"size-3.5 shrink-0",children:[i,r,a]}),e[9]=i,e[10]=r,e[11]=a,e[12]=o):o=e[12],o}function H0(t){const e=O.c(97),{base:s,orgSlug:n,site:i,rows:r,history:a,rangeLabel:o,title:c}=t,d=a===void 0?Br:a,m=ie(),[u]=si(),f=u.language,p=Z.useRef(null),x=Z.useRef(null),h=Z.useRef(0),[g,v]=Z.useState(null);let b;e[0]!==n||e[1]!==i?(b=Qe.analyticsGlobeBundle(n,i),e[0]=n,e[1]=i,e[2]=b):b=e[2];let y;e[3]!==s?(y=()=>V0(`${s}/analytics/globe.js`),e[3]=s,e[4]=y):y=e[4];let j;e[5]!==b||e[6]!==y?(j={queryKey:b,queryFn:y,retry:!1,staleTime:1/0,gcTime:1/0},e[5]=b,e[6]=y,e[7]=j):j=e[7];const N=ts(j),w=N.data??null,S=r.length?r:Br,k=d.length?d:Br,_=S.length===0&&k.length>0,$=_?k:S,T=w&&$.length?w.buildPoints($):q0,P=new Intl.NumberFormat(f);let I;e[8]!==m?(I=m(Kt("visitor")),e[8]=m,e[9]=I):I=e[9];let C;e[10]!==m?(C=m(Kt("cart")),e[10]=m,e[11]=C):C=e[11];let M;e[12]!==m?(M=m(Kt("conversion")),e[12]=m,e[13]=M):M=e[13];let A;e[14]!==m?(A=m(Kt("countryLevel")),e[14]=m,e[15]=A):A=e[15];let F;e[16]!==I||e[17]!==C||e[18]!==M||e[19]!==A?(F={visitor:I,cart:C,conversion:M,countryLevel:A},e[16]=I,e[17]=C,e[18]=M,e[19]=A,e[20]=F):F=e[20];const E=F,z=E.visitor;let R;e[21]!==m?(R=m(Kt("visitorPlural")),e[21]=m,e[22]=R):R=e[22];const V=E.cart;let K;e[23]!==m?(K=m(Kt("cartPlural")),e[23]=m,e[24]=K):K=e[24];const U=E.conversion;let q;e[25]!==m?(q=m(Kt("conversionPlural")),e[25]=m,e[26]=q):q=e[26];let L;e[27]!==E.cart||e[28]!==E.conversion||e[29]!==E.visitor||e[30]!==R||e[31]!==K||e[32]!==q?(L={[z]:R,[V]:K,[U]:q},e[27]=E.cart,e[28]=E.conversion,e[29]=E.visitor,e[30]=R,e[31]=K,e[32]=q,e[33]=L):L=e[33];const B=L;let Y;e[34]!==w||e[35]!==E||e[36]!==S||e[37]!==f||e[38]!==g||e[39]!==B?(Y=()=>{const je=p.current;if(!w||!je)return;const xe=w.mount(je,{mode:g??w.defaultMode(),locale:f,labels:E,plural:(ke,_e)=>ke===1?_e:B[_e]??_e});return x.current=xe,xe.update(S,dc),()=>{xe.destroy(),x.current=null}},e[34]=w,e[35]=E,e[36]=S,e[37]=f,e[38]=g,e[39]=B,e[40]=Y):Y=e[40];let J;e[41]!==w||e[42]!==f?(J=[w,f],e[41]=w,e[42]=f,e[43]=J):J=e[43],Z.useEffect(Y,J);let X;e[44]!==S||e[45]!==k||e[46]!==_?(X=()=>{if(!_){x.current?.update(S,dc);return}const je=()=>{const ke=[];for(let _e=0;_e<Math.min(z0,k.length);_e++){const Ae=k[(h.current+_e)%k.length];Ae&&ke.push(Ae)}h.current=(h.current+1)%k.length,x.current?.update(ke,mc)};je();const xe=setInterval(je,mc);return()=>clearInterval(xe)},e[44]=S,e[45]=k,e[46]=_,e[47]=X):X=e[47];let ee;e[48]!==w||e[49]!==S||e[50]!==k||e[51]!==_?(ee=[w,S,k,_],e[48]=w,e[49]=S,e[50]=k,e[51]=_,e[52]=ee):ee=e[52],Z.useEffect(X,ee);let te;e[53]===Symbol.for("react.memo_cache_sentinel")?(te=je=>{v(je),x.current?.setMode(je)},e[53]=te):te=e[53];const D=te;let W;e[54]!==w||e[55]!==g?(W=g??w?.defaultMode()??"globe",e[54]=w,e[55]=g,e[56]=W):W=e[56];const G=W;let Q;e[57]===Symbol.for("react.memo_cache_sentinel")?(Q=()=>D("globe"),e[57]=Q):Q=e[57];const re=G==="globe",ce=G==="globe"?fc:pc;let ae;e[58]!==ce?(ae=ye(uc,ce),e[58]=ce,e[59]=ae):ae=e[59];let fe;e[60]!==m?(fe=m(Kt("modeGlobe")),e[60]=m,e[61]=fe):fe=e[61];let de;e[62]!==re||e[63]!==ae||e[64]!==fe?(de=l.jsx("button",{type:"button",onClick:Q,"aria-pressed":re,className:ae,children:fe}),e[62]=re,e[63]=ae,e[64]=fe,e[65]=de):de=e[65];let se;e[66]===Symbol.for("react.memo_cache_sentinel")?(se=()=>D("map"),e[66]=se):se=e[66];const H=G==="map",oe=G==="map"?fc:pc;let he;e[67]!==oe?(he=ye(uc,oe),e[67]=oe,e[68]=he):he=e[68];let le;e[69]!==m?(le=m(Kt("modeMap")),e[69]=m,e[70]=le):le=e[70];let ne;e[71]!==H||e[72]!==he||e[73]!==le?(ne=l.jsx("button",{type:"button",onClick:se,"aria-pressed":H,className:he,children:le}),e[71]=H,e[72]=he,e[73]=le,e[74]=ne):ne=e[74];let me;e[75]!==de||e[76]!==ne?(me=l.jsxs("div",{className:"flex items-center gap-0.5 rounded-lg border border-border bg-background/80 p-0.5 backdrop-blur",children:[de,ne]}),e[75]=de,e[76]=ne,e[77]=me):me=e[77];const ge=me,ve=N.error?l.jsx("p",{className:"text-xs text-muted-foreground",children:m(Kt("loadError"))}):l.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-x-4 gap-y-2",children:[l.jsx("ul",{"aria-label":m(Kt("legend")),className:"flex flex-wrap items-center gap-x-4 gap-y-1",children:K0.map(je=>{const{kind:xe,label:ke}=je;return l.jsxs("li",{className:"flex items-center gap-1.5 text-xs",children:[l.jsx(B0,{kind:xe}),m(Kt(ke))]},xe)})}),l.jsxs("div",{className:"flex flex-wrap items-baseline gap-x-2 gap-y-1",children:[_&&l.jsx("p",{className:"text-xs text-muted-foreground",children:m(Kt("replaying"),{range:o??""})}),l.jsx("p",{className:"text-xs text-muted-foreground tabular-nums",children:m(Kt("caption"),{places:P.format(T.places),approximate:P.format(T.approximate),unplaced:P.format(T.unplaced)})})]})]});if(c){let je;e[78]===Symbol.for("react.memo_cache_sentinel")?(je=l.jsx("div",{ref:p,className:"globe-wrap globe-bleed"}),e[78]=je):je=e[78];let xe;e[79]!==c?(xe=l.jsx("h3",{className:"text-sm text-foreground/70",children:c}),e[79]=c,e[80]=xe):xe=e[80];let ke;e[81]!==ge?(ke=l.jsx("div",{className:"pointer-events-auto",children:ge}),e[81]=ge,e[82]=ke):ke=e[82];let _e;e[83]!==xe||e[84]!==ke?(_e=l.jsxs("div",{className:"pointer-events-none absolute inset-x-0 top-0 flex items-start justify-between gap-4 p-4",children:[xe,ke]}),e[83]=xe,e[84]=ke,e[85]=_e):_e=e[85];let Ae;e[86]!==ve?(Ae=l.jsx("div",{className:"pointer-events-none absolute inset-x-0 bottom-0 p-4",children:ve}),e[86]=ve,e[87]=Ae):Ae=e[87];let Pe;return e[88]!==_e||e[89]!==Ae?(Pe=l.jsxs("section",{className:"surface relative h-full overflow-hidden",children:[je,_e,Ae]}),e[88]=_e,e[89]=Ae,e[90]=Pe):Pe=e[90],Pe}let be;e[91]===Symbol.for("react.memo_cache_sentinel")?(be=l.jsx("div",{ref:p,className:"globe-wrap"}),e[91]=be):be=e[91];let we;e[92]!==ge?(we=l.jsxs("div",{className:"relative",children:[be,l.jsx("div",{className:"absolute top-3 right-3",children:ge})]}),e[92]=ge,e[93]=we):we=e[93];let $e;return e[94]!==ve||e[95]!==we?($e=l.jsxs("div",{className:"flex flex-col gap-2",children:[we,ve]}),e[94]=ve,e[95]=we,e[96]=$e):$e=e[96],$e}const zs=s1().catch(0),nn=Ct().catch(""),W0=Jt({liveVisitors:Ms(Jt({visitors:zs,pageviews:zs,events:zs,last_event:Ct().nullable().catch(null)})).catch([]),livePages:Ms(Jt({k:nn,n:zs})).catch([]),liveByMinute:Ms(Jt({t:nn,visitors:zs,events:zs})).catch([]),liveGeo:Ms(Jt({kind:nn,country:nn,region:nn,city:nn,lat:Qi().nullable().catch(null),lng:Qi().nullable().catch(null),visitors:zs})).catch([])});function xc(t){if(!t||t.startsWith("1970-01-01"))return null;const e=t.replace(" ","T"),s=new Date(/(Z|[+-]\d\d:?\d\d)$/.test(e)?e:`${e}Z`);return Number.isNaN(s.getTime())?null:s}function U0(t){const e=O.c(75),{orgSlug:s,site:n,segment:i}=t,r=ie(),[a]=si(),o=Ra[a.language];let c;e[0]!==s||e[1]!==i||e[2]!==n?(c={orgSlug:s,site:n,view:"live",range:"5m",segment:i},e[0]=s,e[1]=i,e[2]=n,e[3]=c):c=e[3];const d=yr(c);if(d.isLoading){let L;return e[4]===Symbol.for("react.memo_cache_sentinel")?(L=l.jsxs("div",{className:"flex flex-col gap-4",children:[l.jsx("div",{className:"grid grid-cols-2 gap-3 lg:grid-cols-4",children:[0,1,2,3].map(Y0)}),l.jsx(Ce,{className:"h-[28rem] rounded-xl"})]}),e[4]=L):L=e[4],L}if(d.error){let L;e[5]!==d.error||e[6]!==r?(L=to(d.error)?r("monitor.analytics.live.notConfigured"):r("monitor.analytics.live.loadError"),e[5]=d.error,e[6]=r,e[7]=L):L=e[7];let B;return e[8]!==L?(B=l.jsx("p",{className:"text-sm text-muted-foreground",children:L}),e[8]=L,e[9]=B):B=e[9],B}let m,u,f,p,x;if(e[10]!==d.data?.data||e[11]!==r||e[12]!==o){u=W0.parse(d.data?.data??{}),p=new Intl.NumberFormat(o);let L;e[18]!==o?(L=new Intl.NumberFormat(o,{notation:"compact"}),e[18]=o,e[19]=L):L=e[19],m=L;const B=new Intl.DateTimeFormat(o,{hour:"2-digit",minute:"2-digit",second:"2-digit"}),Y=u.liveVisitors[0],J=xc(Y?.last_event??null);f=[[r("monitor.analytics.live.visitorsNow"),p.format(Y?.visitors??0),!0],[r("monitor.analytics.live.pageviews"),p.format(Y?.pageviews??0),!1],[r("monitor.analytics.live.events"),p.format(Y?.events??0),!1],[r("monitor.analytics.live.lastEvent"),J?B.format(J):"—",!1]],x=u.liveByMinute.map(X=>{const ee=xc(X.t);return{label:ee?B.format(ee):X.t,visitors:X.visitors}}),e[10]=d.data?.data,e[11]=r,e[12]=o,e[13]=m,e[14]=u,e[15]=f,e[16]=p,e[17]=x}else m=e[13],u=e[14],f=e[15],p=e[16],x=e[17];const h=x;let g;e[20]!==f||e[21]!==r?(g=l.jsx("div",{className:"grid grid-cols-2 gap-3 lg:grid-cols-4",children:f.map(L=>{const[B,Y,J]=L;return l.jsxs("section",{className:"surface @container flex min-w-0 flex-col gap-1 px-4 pt-4 pb-5",children:[l.jsxs("h3",{className:"flex items-center gap-2 text-sm text-foreground/70",children:[J&&l.jsx(Q0,{label:r("monitor.analytics.live.live")}),B]}),l.jsx("span",{className:"tnum whitespace-nowrap text-4xl font-normal text-foreground @max-xs:text-3xl",children:Y})]},B)})}),e[20]=f,e[21]=r,e[22]=g):g=e[22];const v=`/api/${s}/hosting/${encodeURIComponent(n)}`,b=u.liveGeo;let y;e[23]!==r?(y=r("monitor.analytics.live.title"),e[23]=r,e[24]=y):y=e[24];let j;e[25]!==u.liveGeo||e[26]!==s||e[27]!==n||e[28]!==v||e[29]!==y?(j=l.jsx("div",{className:"xl:col-span-2",children:l.jsx(H0,{base:v,orgSlug:s,site:n,rows:b,title:y})}),e[25]=u.liveGeo,e[26]=s,e[27]=n,e[28]=v,e[29]=y,e[30]=j):j=e[30];let N;e[31]!==r?(N=r("monitor.analytics.live.trendTitle"),e[31]=r,e[32]=N):N=e[32];let w;e[33]!==r?(w=r("monitor.analytics.live.trendVisitors"),e[33]=r,e[34]=w):w=e[34];let S;e[35]!==w?(S={visitors:{label:w,color:"var(--chart-2)"}},e[35]=w,e[36]=S):S=e[36];let k,_,$;e[37]===Symbol.for("react.memo_cache_sentinel")?(k={top:4,right:-8,bottom:0,left:0},_=l.jsx(Ft,{strokeDasharray:"4 4",stroke:"var(--border)",strokeOpacity:.5,vertical:!1}),$=l.jsx(zt,{dataKey:"label",axisLine:!1,tickLine:!1,tick:mt,tickMargin:6,minTickGap:32,interval:"preserveStartEnd",tickFormatter:G0}),e[37]=k,e[38]=_,e[39]=$):(k=e[37],_=e[38],$=e[39]);let T;e[40]!==m?(T=l.jsx(At,{orientation:"right",axisLine:!1,tickLine:!1,tick:mt,tickFormatter:L=>m.format(L),width:52,tickCount:4}),e[40]=m,e[41]=T):T=e[41];let P;e[42]===Symbol.for("react.memo_cache_sentinel")?(P=l.jsx(es,{cursor:{fill:"var(--muted)"},content:l.jsx(us,{})}),e[42]=P):P=e[42];let I;e[43]===Symbol.for("react.memo_cache_sentinel")?(I=l.jsx(Qn,{dataKey:"visitors",fill:"var(--color-visitors)",radius:[3,3,0,0],isAnimationActive:!1}),e[43]=I):I=e[43];let C;e[44]!==T||e[45]!==h?(C=l.jsxs(x1,{data:h,margin:k,children:[_,$,T,P,I]}),e[44]=T,e[45]=h,e[46]=C):C=e[46];let M;e[47]!==S||e[48]!==C?(M=l.jsx(It,{config:S,className:"h-40 w-full",children:C}),e[47]=S,e[48]=C,e[49]=M):M=e[49];let A;e[50]!==M||e[51]!==N?(A=l.jsx(Mt,{title:N,children:M}),e[50]=M,e[51]=N,e[52]=A):A=e[52];let F;e[53]!==r?(F=r("monitor.analytics.live.pagesTitle"),e[53]=r,e[54]=F):F=e[54];let E;e[55]!==r?(E=r("monitor.analytics.live.pagesVisitors"),e[55]=r,e[56]=E):E=e[56];let z;e[57]!==E?(z=l.jsx("span",{className:"text-meta",children:E}),e[57]=E,e[58]=z):z=e[58];let R;e[59]!==p?(R=L=>p.format(L),e[59]=p,e[60]=R):R=e[60];let V;e[61]!==u.livePages||e[62]!==F||e[63]!==z||e[64]!==R?(V=l.jsx("div",{className:"flex-1",children:l.jsx(ht,{title:F,aside:z,rows:u.livePages,format:R,share:!1})}),e[61]=u.livePages,e[62]=F,e[63]=z,e[64]=R,e[65]=V):V=e[65];let K;e[66]!==A||e[67]!==V?(K=l.jsxs("div",{className:"flex flex-col gap-4",children:[A,V]}),e[66]=A,e[67]=V,e[68]=K):K=e[68];let U;e[69]!==K||e[70]!==j?(U=l.jsxs("div",{className:"grid gap-4 xl:grid-cols-3",children:[j,K]}),e[69]=K,e[70]=j,e[71]=U):U=e[71];let q;return e[72]!==U||e[73]!==g?(q=l.jsxs("div",{className:"flex flex-col gap-4",children:[g,U]}),e[72]=U,e[73]=g,e[74]=q):q=e[74],q}function G0(t){return t.slice(0,5)}function Y0(t){return l.jsx(Ce,{className:"h-24 rounded-xl"},t)}function Q0(t){const e=O.c(4),{label:s}=t;let n,i;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=l.jsx("span",{className:"absolute inline-flex size-full animate-ping rounded-full bg-brand opacity-75 motion-reduce:animate-none"}),i=l.jsx("span",{className:"relative inline-flex size-2 rounded-full bg-brand"}),e[0]=n,e[1]=i):(n=e[0],i=e[1]);let r;return e[2]!==s?(r=l.jsxs("span",{className:"relative flex size-2",role:"img","aria-label":s,children:[n,i]}),e[2]=s,e[3]=r):r=e[3],r}const or=["lcp","inp","cls","ttfb","fcp"],cr=["lcp","inp","cls"],mn={lcp:{good:2500,poor:4e3,unit:"ms",label:"LCP"},inp:{good:200,poor:500,unit:"ms",label:"INP"},cls:{good:.1,poor:.25,unit:"",label:"CLS"},ttfb:{good:800,poor:1800,unit:"ms",label:"TTFB"},fcp:{good:1800,poor:3e3,unit:"ms",label:"FCP"}},Gn=["good","needs work","poor"];function bd(t){return Gn.find(e=>e===t)??null}function X0(t){return or.find(e=>e===t)??null}function dr(t,e){if(e===null||!Number.isFinite(e))return null;const s=mn[t];return e<=s.good?"good":e<=s.poor?"needs work":"poor"}function Z0(t){const e=cr.filter(n=>dr(n,t[n])===null);return e.length?{verdict:"incomplete",missing:e}:{verdict:cr.every(n=>dr(n,t[n])==="good")?"passing":"failing",missing:e}}function J0(t){const e=Object.fromEntries(or.map(s=>[s,{good:0,"needs work":0,poor:0}]));for(const s of t){const n=X0(s.metric),i=bd(s.band),r=Number(s.n);n&&i&&Number.isFinite(r)&&(e[n][i]+=r)}return e}const Jn={good:"bg-success","needs work":"bg-warning",poor:"bg-destructive"};function jd(t,e){switch(t){case"good":return e("monitor.analytics.panels.vitals.good");case"needs work":return e("monitor.analytics.panels.vitals.needsWork");case"poor":return e("monitor.analytics.panels.vitals.poor");default:return t}}function e3(t,e){switch(t){case"lcp":return e("monitor.analytics.panels.vitals.lcp");case"inp":return e("monitor.analytics.panels.vitals.inp");case"cls":return e("monitor.analytics.panels.vitals.cls");case"ttfb":return e("monitor.analytics.panels.vitals.ttfb");case"fcp":return e("monitor.analytics.panels.vitals.fcp");default:return t}}function pa(t,e){const s=qe(e);return s===null?"—":mn[t].unit==="ms"?ud(s):new Intl.NumberFormat(void 0,{minimumFractionDigits:2,maximumFractionDigits:3}).format(s)}function al(t){const e=O.c(11),{vital:s,value:n}=t;let i;e[0]!==n||e[1]!==s?(i=dr(s,qe(n)),e[0]=n,e[1]=s,e[2]=i):i=e[2];const r=i;let a;e[3]!==r?(a=r&&l.jsx("span",{className:ye("size-1.5 rounded-full",Jn[r])}),e[3]=r,e[4]=a):a=e[4];let o;e[5]!==n||e[6]!==s?(o=pa(s,n),e[5]=n,e[6]=s,e[7]=o):o=e[7];let c;return e[8]!==a||e[9]!==o?(c=l.jsxs("span",{className:"inline-flex items-center justify-end gap-1.5",children:[a,o]}),e[8]=a,e[9]=o,e[10]=c):c=e[10],c}function t3(t){const e=O.c(12),{verdict:s}=t,n=ie();switch(s){case"passing":{let i;e[0]!==n?(i=n("monitor.analytics.panels.vitals.passing"),e[0]=n,e[1]=i):i=e[1];let r;return e[2]!==i?(r=l.jsx(Ye,{variant:"success",size:"lg",children:i}),e[2]=i,e[3]=r):r=e[3],r}case"failing":{let i;e[4]!==n?(i=n("monitor.analytics.panels.vitals.failing"),e[4]=n,e[5]=i):i=e[5];let r;return e[6]!==i?(r=l.jsx(Ye,{variant:"destructive",size:"lg",children:i}),e[6]=i,e[7]=r):r=e[7],r}case"incomplete":{let i;e[8]!==n?(i=n("monitor.analytics.panels.vitals.incomplete"),e[8]=n,e[9]=i):i=e[9];let r;return e[10]!==i?(r=l.jsx(Ye,{variant:"warning",size:"lg",children:i}),e[10]=i,e[11]=r):r=e[11],r}default:return s}}function s3(t){const e=O.c(20),{counts:s}=t,n=ie();let i;e[0]!==s?(i=(u,f)=>u+s[f],e[0]=s,e[1]=i):i=e[1];const r=Gn.reduce(i,0);if(!r){let u;e[2]!==n?(u=n("monitor.analytics.panels.vitals.noSamples"),e[2]=n,e[3]=u):u=e[3];let f;return e[4]!==u?(f=l.jsx("span",{className:"text-meta",children:u}),e[4]=u,e[5]=f):f=e[5],f}let a;e[6]!==s||e[7]!==r?(a=Gn.map(u=>s[u]?l.jsx("div",{className:Jn[u],style:{width:`${100*s[u]/r}%`}},u):null),e[6]=s,e[7]=r,e[8]=a):a=e[8];let o;e[9]!==a?(o=l.jsx("div",{className:"flex h-2 gap-0.5 overflow-hidden rounded-full",children:a}),e[9]=a,e[10]=o):o=e[10];let c;e[11]!==s||e[12]!==n||e[13]!==r?(c=Gn.map(u=>l.jsxs("span",{className:"inline-flex items-center gap-1",children:[l.jsx("span",{className:ye("size-1.5 rounded-full",Jn[u])}),jd(u,n)," ",Os(100*s[u]/r,0)]},u)),e[11]=s,e[12]=n,e[13]=r,e[14]=c):c=e[14];let d;e[15]!==c?(d=l.jsx("div",{className:"text-meta tnum flex flex-wrap gap-x-3 gap-y-1",children:c}),e[15]=c,e[16]=d):d=e[16];let m;return e[17]!==o||e[18]!==d?(m=l.jsxs("div",{className:"flex flex-col gap-2",children:[o,d]}),e[17]=o,e[18]=d,e[19]=m):m=e[19],m}function l3(t){const e=O.c(67),s=ie(),n=wr(t,"vitals");if(n.isLoading){let _;return e[0]===Symbol.for("react.memo_cache_sentinel")?(_=l.jsx(Nr,{tiles:5}),e[0]=_):_=e[0],_}if(n.error){let _;return e[1]!==n.error?(_=l.jsx(kr,{error:n.error}),e[1]=n.error,e[2]=_):_=e[2],_}const i=n.data;let r,a,o,c,d;if(e[3]!==i||e[4]!==s){c=Symbol.for("react.early_return_sentinel");e:{const _=fn(i,"vitals");if(!_||!gt(_.samples)){let E;e[10]===Symbol.for("react.memo_cache_sentinel")?(E=l.jsx(Qm,{size:20}),e[10]=E):E=e[10];let z;e[11]!==s?(z=s("monitor.analytics.panels.vitals.empty"),e[11]=s,e[12]=z):z=e[12];let R;e[13]!==s?(R=s("monitor.analytics.panels.vitals.emptyDesc"),e[13]=s,e[14]=R):R=e[14];let V;e[15]!==z||e[16]!==R?(V=l.jsx(fa,{icon:E,title:z,description:R}),e[15]=z,e[16]=R,e[17]=V):V=e[17],c=V;break e}const $=Object.fromEntries(or.map(E=>[E,qe(_[`${E}_p75`])])),{verdict:T}=Z0($);let P;e[18]!==i?(P=J0(Ve(i,"vitalsBands").map(i3)),e[18]=i,e[19]=P):P=e[19];const I=P;let C;e[20]!==i?(C=Ve(i,"vitalsTrend"),e[20]=i,e[21]=C):C=e[21],d=C;let M;e[22]!==s?(M=s("monitor.analytics.panels.vitals.assessment"),e[22]=s,e[23]=M):M=e[23];const A=l.jsx("span",{className:"text-meta tnum",children:s("monitor.analytics.panels.vitals.loads",{n:ze(_.samples)})}),F=l.jsxs("div",{className:"flex flex-wrap items-center gap-x-6 gap-y-3",children:[l.jsx(t3,{verdict:T}),l.jsx("div",{className:"flex flex-wrap gap-2",children:cr.map(E=>{const z=dr(E,$[E]);return l.jsxs(Ye,{variant:"outline",className:"gap-1.5",children:[l.jsx("span",{className:ye("size-1.5 rounded-full",z?Jn[z]:"bg-muted-foreground/40")}),mn[E].label,l.jsx("span",{className:"tnum text-muted-foreground",children:pa(E,$[E])})]},E)})})]});e[24]!==M||e[25]!==A||e[26]!==F?(o=l.jsx(Mt,{title:M,aside:A,children:F}),e[24]=M,e[25]=A,e[26]=F,e[27]=o):o=e[27],r="grid grid-cols-2 gap-4 lg:grid-cols-5",a=or.map(E=>l.jsx(Mt,{title:mn[E].label,value:l.jsx("span",{className:"whitespace-nowrap",children:pa(E,$[E])}),caption:l.jsxs("span",{className:"flex min-w-0 items-center gap-1.5",children:[l.jsx("span",{className:"text-meta truncate",children:e3(E,s)}),!cr.includes(E)&&l.jsx(Ye,{variant:"muted",size:"sm",children:s("monitor.analytics.panels.vitals.supporting")})]}),children:l.jsx(s3,{counts:I[E]})},E))}e[3]=i,e[4]=s,e[5]=r,e[6]=a,e[7]=o,e[8]=c,e[9]=d}else r=e[5],a=e[6],o=e[7],c=e[8],d=e[9];if(c!==Symbol.for("react.early_return_sentinel"))return c;let m;e[28]!==r||e[29]!==a?(m=l.jsx("div",{className:r,children:a}),e[28]=r,e[29]=a,e[30]=m):m=e[30];let u;e[31]!==s||e[32]!==d?(u=d.length>1&&l.jsx(Mt,{title:s("monitor.analytics.panels.vitals.trend"),children:l.jsx(vd,{points:d,metric:"lcp",label:s("monitor.analytics.panels.vitals.lcpP75"),format:n3,thresholds:[{value:mn.lcp.good,tone:"warning"},{value:mn.lcp.poor,tone:"destructive"}]})}),e[31]=s,e[32]=d,e[33]=u):u=e[33];let f;e[34]!==i?(f=Ve(i,"vitalsByDevice"),e[34]=i,e[35]=f):f=e[35];let p;e[36]!==f?(p=l.jsx(r3,{rows:f}),e[36]=f,e[37]=p):p=e[37];let x;e[38]!==i?(x=Ve(i,"vitalsByPage"),e[38]=i,e[39]=x):x=e[39];let h;e[40]!==x?(h=l.jsx(p3,{rows:x}),e[40]=x,e[41]=h):h=e[41];let g;e[42]!==p||e[43]!==h?(g=l.jsxs("div",{className:"grid gap-4 lg:grid-cols-2",children:[p,h]}),e[42]=p,e[43]=h,e[44]=g):g=e[44];let v;e[45]!==s?(v=s("monitor.analytics.panels.vitals.business"),e[45]=s,e[46]=v):v=e[46];let b;e[47]!==i?(b=Ve(i,"vitalsByVariant"),e[47]=i,e[48]=b):b=e[48];let y;e[49]!==b?(y=l.jsx(y3,{rows:b}),e[49]=b,e[50]=y):y=e[50];let j;e[51]!==i?(j=Ve(i,"conversionBySpeed"),e[51]=i,e[52]=j):j=e[52];let N;e[53]!==j?(N=l.jsx(P3,{rows:j}),e[53]=j,e[54]=N):N=e[54];let w;e[55]!==y||e[56]!==N?(w=l.jsxs("div",{className:"grid gap-4 lg:grid-cols-2",children:[y,N]}),e[55]=y,e[56]=N,e[57]=w):w=e[57];let S;e[58]!==v||e[59]!==w?(S=l.jsx(dn,{title:v,children:w}),e[58]=v,e[59]=w,e[60]=S):S=e[60];let k;return e[61]!==g||e[62]!==S||e[63]!==o||e[64]!==m||e[65]!==u?(k=l.jsxs(l.Fragment,{children:[o,m,u,g,S]}),e[61]=g,e[62]=S,e[63]=o,e[64]=m,e[65]=u,e[66]=k):k=e[66],k}function n3(t){return ud(t)}function i3(t){return{metric:t.metric,band:t.band,n:t.n}}function r3(t){const e=O.c(22),{rows:s}=t,n=ie();if(s.length===0)return null;let i;e[0]!==n?(i=n("monitor.analytics.panels.col.device"),e[0]=n,e[1]=i):i=e[1];let r;e[2]!==i?(r={id:"k",header:i,cell:f3},e[2]=i,e[3]=r):r=e[3];let a,o,c;e[4]===Symbol.for("react.memo_cache_sentinel")?(a={id:"lcp",header:"LCP p75",numeric:!0,cell:u3},o={id:"inp",header:"INP p75",numeric:!0,cell:m3},c={id:"cls",header:"CLS p75",numeric:!0,cell:d3},e[4]=a,e[5]=o,e[6]=c):(a=e[4],o=e[5],c=e[6]);let d;e[7]!==n?(d=n("monitor.analytics.panels.col.samples"),e[7]=n,e[8]=d):d=e[8];let m;e[9]!==d?(m={id:"n",header:d,numeric:!0,cell:c3},e[9]=d,e[10]=m):m=e[10];let u;e[11]!==r||e[12]!==m?(u=[r,a,o,c,m],e[11]=r,e[12]=m,e[13]=u):u=e[13];const f=u;let p;e[14]!==n?(p=n("monitor.analytics.panels.vitals.byDevice"),e[14]=n,e[15]=p):p=e[15];let x;e[16]!==f||e[17]!==s?(x=l.jsx(rl,{columns:f,rows:s,rowKey:o3,filter:a3}),e[16]=f,e[17]=s,e[18]=x):x=e[18];let h;return e[19]!==x||e[20]!==p?(h=l.jsx(Mt,{title:p,children:x}),e[19]=x,e[20]=p,e[21]=h):h=e[21],h}function a3(t){return{d:"device",v:tt(t.k)}}function o3(t){return tt(t.k)}function c3(t){return ze(t.n)}function d3(t){return l.jsx(al,{vital:"cls",value:t.cls})}function m3(t){return l.jsx(al,{vital:"inp",value:t.inp})}function u3(t){return l.jsx(al,{vital:"lcp",value:t.lcp})}function f3(t){return l.jsx(ci,{children:lh(tt(t.k))})}function p3(t){const e=O.c(21),{rows:s}=t,n=ie();if(s.length===0)return null;let i;e[0]!==n?(i=n("monitor.analytics.panels.col.page"),e[0]=n,e[1]=i):i=e[1];let r;e[2]!==i?(r={id:"k",header:i,className:"max-w-0 w-full",cell:j3},e[2]=i,e[3]=r):r=e[3];let a,o;e[4]===Symbol.for("react.memo_cache_sentinel")?(a={id:"lcp",header:"LCP p75",numeric:!0,cell:b3},o={id:"cls",header:"CLS p75",numeric:!0,cell:v3},e[4]=a,e[5]=o):(a=e[4],o=e[5]);let c;e[6]!==n?(c=n("monitor.analytics.panels.col.samples"),e[6]=n,e[7]=c):c=e[7];let d;e[8]!==c?(d={id:"n",header:c,numeric:!0,cell:g3},e[8]=c,e[9]=d):d=e[9];let m;e[10]!==r||e[11]!==d?(m=[r,a,o,d],e[10]=r,e[11]=d,e[12]=m):m=e[12];const u=m;let f;e[13]!==n?(f=n("monitor.analytics.panels.vitals.slowest"),e[13]=n,e[14]=f):f=e[14];let p;e[15]!==u||e[16]!==s?(p=l.jsx(rl,{columns:u,rows:s,rowKey:h3,filter:x3}),e[15]=u,e[16]=s,e[17]=p):p=e[17];let x;return e[18]!==f||e[19]!==p?(x=l.jsx(Mt,{title:f,children:p}),e[18]=f,e[19]=p,e[20]=x):x=e[20],x}function x3(t){return{d:"path",v:tt(t.k)}}function h3(t){return tt(t.k)}function g3(t){return ze(t.measured??t.n)}function v3(t){return l.jsx(al,{vital:"cls",value:t.cls})}function b3(t){return l.jsx(al,{vital:"lcp",value:t.lcp})}function j3(t){return l.jsx(ci,{children:tt(t.k)})}function y3(t){const e=O.c(26),{rows:s}=t,n=ie();let i;e[0]!==n?(i=n("monitor.analytics.panels.vitals.byVariant"),e[0]=n,e[1]=i):i=e[1];const r=i;let a;e[2]!==n?(a=n("monitor.analytics.panels.col.experiment"),e[2]=n,e[3]=a):a=e[3];let o;e[4]!==a?(o={id:"exp",header:a,cell:T3},e[4]=a,e[5]=o):o=e[5];let c;e[6]!==n?(c=n("monitor.analytics.panels.exp.variant"),e[6]=n,e[7]=c):c=e[7];let d;e[8]!==c?(d={id:"variant",header:c,cell:$3},e[8]=c,e[9]=d):d=e[9];let m,u;e[10]===Symbol.for("react.memo_cache_sentinel")?(m={id:"lcp",header:"LCP p75",numeric:!0,cell:_3},u={id:"cls",header:"CLS p75",numeric:!0,cell:S3},e[10]=m,e[11]=u):(m=e[10],u=e[11]);let f;e[12]!==n?(f=n("monitor.analytics.panels.col.samples"),e[12]=n,e[13]=f):f=e[13];let p;e[14]!==f?(p={id:"n",header:f,numeric:!0,cell:k3},e[14]=f,e[15]=p):p=e[15];let x;e[16]!==o||e[17]!==d||e[18]!==p?(x=[o,d,m,u,p],e[16]=o,e[17]=d,e[18]=p,e[19]=x):x=e[19];const h=x;let g;e[20]!==h||e[21]!==s?(g=l.jsx(rl,{columns:h,rows:s,rowKey:N3,filter:w3}),e[20]=h,e[21]=s,e[22]=g):g=e[22];let v;return e[23]!==g||e[24]!==r?(v=l.jsx(Mt,{title:r,children:g}),e[23]=g,e[24]=r,e[25]=v):v=e[25],v}function w3(t){return{d:"exp",v:`${tt(t.experiment)}=${tt(t.variant)}`}}function N3(t){return`${tt(t.experiment)}=${tt(t.variant)}`}function k3(t){return ze(t.n)}function S3(t){return l.jsx(al,{vital:"cls",value:t.cls})}function _3(t){return l.jsx(al,{vital:"lcp",value:t.lcp})}function $3(t){return l.jsx(ci,{children:l.jsx("span",{className:"font-mono text-xs",children:tt(t.variant)})})}function T3(t){return tt(t.experiment)}function P3(t){const e=O.c(34),{rows:s}=t,n=ie();let i;e[0]!==s?(i=Gn.flatMap(j=>{const N=s.find(w=>bd(w.k)===j);return N?[{band:j,row:N}]:[]}),e[0]=s,e[1]=i):i=e[1];const r=i;let a;e[2]!==n?(a=n("monitor.analytics.panels.vitals.lcpBand"),e[2]=n,e[3]=a):a=e[3];let o;e[4]!==n?(o=j=>{const{band:N}=j;return l.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[l.jsx("span",{className:ye("size-1.5 rounded-full",Jn[N])}),jd(N,n)]})},e[4]=n,e[5]=o):o=e[5];let c;e[6]!==a||e[7]!==o?(c={id:"band",header:a,cell:o},e[6]=a,e[7]=o,e[8]=c):c=e[8];let d;e[9]!==n?(d=n("monitor.analytics.panels.col.visitors"),e[9]=n,e[10]=d):d=e[10];let m;e[11]!==d?(m={id:"visitors",header:d,numeric:!0,cell:I3},e[11]=d,e[12]=m):m=e[12];let u;e[13]!==n?(u=n("monitor.analytics.panels.col.converters"),e[13]=n,e[14]=u):u=e[14];let f;e[15]!==u?(f={id:"converters",header:u,numeric:!0,cell:M3},e[15]=u,e[16]=f):f=e[16];let p;e[17]!==n?(p=n("monitor.analytics.panels.col.conversion"),e[17]=n,e[18]=p):p=e[18];let x;e[19]!==p?(x={id:"cr",header:p,numeric:!0,cell:E3},e[19]=p,e[20]=x):x=e[20];let h;e[21]!==x||e[22]!==c||e[23]!==m||e[24]!==f?(h=[c,m,f,x],e[21]=x,e[22]=c,e[23]=m,e[24]=f,e[25]=h):h=e[25];const g=h;let v;e[26]!==n?(v=n("monitor.analytics.panels.vitals.bySpeed"),e[26]=n,e[27]=v):v=e[27];let b;e[28]!==g||e[29]!==r?(b=l.jsx(rl,{columns:g,rows:r,rowKey:C3}),e[28]=g,e[29]=r,e[30]=b):b=e[30];let y;return e[31]!==v||e[32]!==b?(y=l.jsx(Mt,{title:v,children:b}),e[31]=v,e[32]=b,e[33]=y):y=e[33],y}function C3(t){return t.band}function E3(t){const{row:e}=t;return Os(Xx(gt(e.converters),gt(e.visitors)),2)}function M3(t){const{row:e}=t;return ze(e.converters)}function I3(t){const{row:e}=t;return ze(e.visitors)}function co(t){const e=O.c(29);let s,n,i;switch(e[0]!==t?({section:i,onConfigure:s,...n}=t,e[0]=t,e[1]=s,e[2]=n,e[3]=i):(s=e[1],n=e[2],i=e[3]),i){case"overview":{let r;return e[4]!==n?(r=l.jsx(L0,{...n}),e[4]=n,e[5]=r):r=e[5],r}case"live":{let r;return e[6]!==n?(r=l.jsx(U0,{...n}),e[6]=n,e[7]=r):r=e[7],r}case"behaviour":{let r;return e[8]!==n?(r=l.jsx(s0,{...n}),e[8]=n,e[9]=r):r=e[9],r}case"events":{let r;e[10]!==n?(r=l.jsx(T0,{...n}),e[10]=n,e[11]=r):r=e[11];let a;e[12]===Symbol.for("react.memo_cache_sentinel")?(a=l.jsx(Mp,{}),e[12]=a):a=e[12];let o;return e[13]!==r?(o=l.jsxs(l.Fragment,{children:[r,a]}),e[13]=r,e[14]=o):o=e[14],o}case"vitals":{let r;return e[15]!==n?(r=l.jsx(l3,{...n}),e[15]=n,e[16]=r):r=e[16],r}case"heatmap":{const r=`/api/${n.orgSlug}/hosting/${encodeURIComponent(n.site)}`;let a;e[17]!==n.status.config?.modules?(a=n.status.config?.modules??["core"],e[17]=n.status.config?.modules,e[18]=a):a=e[18];let o;e[19]!==n.status.config||e[20]!==n.status.host?(o=n.status.config?.domains?.length?n.status.config.domains:n.status.host?[n.status.host]:[],e[19]=n.status.config,e[20]=n.status.host,e[21]=o):o=e[21];const c=n.status.external?void 0:s;let d;return e[22]!==n.orgSlug||e[23]!==n.site||e[24]!==r||e[25]!==a||e[26]!==o||e[27]!==c?(d=l.jsx(Ih,{base:r,orgSlug:n.orgSlug,site:n.site,modules:a,domains:o,onConfigure:c,fill:!0}),e[22]=n.orgSlug,e[23]=n.site,e[24]=r,e[25]=a,e[26]=o,e[27]=c,e[28]=d):d=e[28],d}default:return i}}const Hr="var(--chart-1)";function yd(t,e,s,n,i){const r=new URLSearchParams({view:s,range:n});return e.analyticsSite!==e.site&&r.set("trafficSite",e.analyticsSite),i&&r.set("source",i),{queryKey:Qe.monitorAudience(t,e.site,e.analyticsSite,s,n,i??"auto"),queryFn:async()=>await q1(`/api/${t}/monitor/${encodeURIComponent(e.site)}/audience?${r}`),retry:!1,staleTime:6e4}}function kn(t,e,s,n,i,r){const a=O.c(9),o=i===void 0?!0:i;let c;a[0]!==t||a[1]!==e||a[2]!==n||a[3]!==r||a[4]!==s?(c=yd(t,e,s,n,r),a[0]=t,a[1]=e,a[2]=n,a[3]=r,a[4]=s,a[5]=c):c=a[5];let d;return a[6]!==o||a[7]!==c?(d={...c,enabled:o},a[6]=o,a[7]=c,a[8]=d):d=a[8],ts(d)}function wd(t,e){switch(t){case"deco-analytics":return e("monitor.audience.source.decoAnalytics");case"onedollar":return e("monitor.audience.source.onedollar");default:return t}}function Nd(t,e){switch(t){case"24h":return e("monitor.audience.range.today");case"7d":return e("monitor.audience.range.7d");case"30d":return e("monitor.audience.range.30d");default:return t}}function A3(t,e){switch(t){case"5m":return e("monitor.audience.rightNow");case"15m":return e("monitor.audience.range.15m");case"30m":return e("monitor.audience.range.30m");case"1h":return e("monitor.audience.range.1h");case"24h":return e("monitor.audience.range.24h");case"7d":case"30d":return Nd(t,e);default:return t}}function kd(t){const e=O.c(9),{value:s,onChange:n,hideRange:i,lead:r,children:a}=t,o=i===void 0?!1:i,c=ie();let d;e[0]!==o||e[1]!==n||e[2]!==c||e[3]!==s?(d=!o&&l.jsx(ns,{label:c("monitor.audience.range"),period:!0,value:s,options:up.map(u=>({value:u,label:Nd(u,c)})),onChange:n}),e[0]=o,e[1]=n,e[2]=c,e[3]=s,e[4]=d):d=e[4];let m;return e[5]!==a||e[6]!==r||e[7]!==d?(m=l.jsxs(We.Actions,{children:[r,d,a]}),e[5]=a,e[6]=r,e[7]=d,e[8]=m):m=e[8],m}function Ui(t){const e=Math.round(t),s=Math.floor(e/60),n=e%60;return s>0?`${s}m ${n}s`:`${n}s`}function Bs(t,e){return e?ot(t,e):null}function Sd(t){return!t?.available||t.data.view!=="summary"?null:t.window.kind==="calendar"&&t.window.since===t.window.until?{...t.data,previous:null}:t.data}function L3(t){const e=O.c(73),{summary:s,previous:n,onChart:i}=t,r=ie();let a;e[0]!==r?(a=r("monitor.audience.visitors"),e[0]=r,e[1]=a):a=e[1];let o;e[2]!==s.visitors?(o=wt(s.visitors),e[2]=s.visitors,e[3]=o):o=e[3];const c=n?.visitors;let d;e[4]!==s.visitors||e[5]!==c?(d=Bs(s.visitors,c),e[4]=s.visitors,e[5]=c,e[6]=d):d=e[6];let m;e[7]!==a||e[8]!==o||e[9]!==d?(m={key:"visitors",title:a,value:o,change:d,better:"up",chart:"visitors"},e[7]=a,e[8]=o,e[9]=d,e[10]=m):m=e[10];let u;e[11]!==r?(u=r("monitor.audience.pageviews"),e[11]=r,e[12]=u):u=e[12];let f;e[13]!==s.pageviews?(f=wt(s.pageviews),e[13]=s.pageviews,e[14]=f):f=e[14];const p=n?.pageviews;let x;e[15]!==s.pageviews||e[16]!==p?(x=Bs(s.pageviews,p),e[15]=s.pageviews,e[16]=p,e[17]=x):x=e[17];let h;e[18]!==u||e[19]!==f||e[20]!==x?(h={key:"pageviews",title:u,value:f,change:x,better:"up",chart:"pageviews"},e[18]=u,e[19]=f,e[20]=x,e[21]=h):h=e[21];let g;if(e[22]!==n?.bounceRate||e[23]!==n?.sessions||e[24]!==n?.visitDurationS||e[25]!==s.bounceRate||e[26]!==s.sessions||e[27]!==s.visitDurationS||e[28]!==r||e[29]!==h||e[30]!==m){if(g=[m,h],s.sessions!==null){let N;e[32]!==r?(N=r("monitor.audience.sessions"),e[32]=r,e[33]=N):N=e[33];let w;e[34]!==s.sessions?(w=wt(s.sessions),e[34]=s.sessions,e[35]=w):w=e[35];const S=n?.sessions;let k;e[36]!==s.sessions||e[37]!==S?(k=Bs(s.sessions,S),e[36]=s.sessions,e[37]=S,e[38]=k):k=e[38];let _;e[39]!==N||e[40]!==w||e[41]!==k?(_={key:"sessions",title:N,value:w,change:k,better:"up"},e[39]=N,e[40]=w,e[41]=k,e[42]=_):_=e[42],g.push(_)}if(s.bounceRate!==null){let N;e[43]!==r?(N=r("monitor.audience.bounceRate"),e[43]=r,e[44]=N):N=e[44];let w;e[45]!==s.bounceRate?(w=Math.round(s.bounceRate),e[45]=s.bounceRate,e[46]=w):w=e[46];const S=`${w}%`,k=n?.bounceRate;let _;e[47]!==s.bounceRate||e[48]!==k?(_=Bs(s.bounceRate,k),e[47]=s.bounceRate,e[48]=k,e[49]=_):_=e[49];let $;e[50]!==N||e[51]!==S||e[52]!==_?($={key:"bounce",title:N,value:S,change:_,better:"down"},e[50]=N,e[51]=S,e[52]=_,e[53]=$):$=e[53],g.push($)}if(s.visitDurationS!==null){let N;e[54]!==r?(N=r("monitor.audience.visitDuration"),e[54]=r,e[55]=N):N=e[55];let w;e[56]!==s.visitDurationS?(w=Ui(s.visitDurationS),e[56]=s.visitDurationS,e[57]=w):w=e[57];const S=n?.visitDurationS;let k;e[58]!==s.visitDurationS||e[59]!==S?(k=Bs(s.visitDurationS,S),e[58]=s.visitDurationS,e[59]=S,e[60]=k):k=e[60];let _;e[61]!==N||e[62]!==w||e[63]!==k?(_={key:"duration",title:N,value:w,change:k,better:"up"},e[61]=N,e[62]=w,e[63]=k,e[64]=_):_=e[64],g.push(_)}e[22]=n?.bounceRate,e[23]=n?.sessions,e[24]=n?.visitDurationS,e[25]=s.bounceRate,e[26]=s.sessions,e[27]=s.visitDurationS,e[28]=r,e[29]=h,e[30]=m,e[31]=g}else g=e[31];const v=g.length>4?"lg:grid-cols-5":"lg:grid-cols-4";let b;e[65]!==v?(b=ye("grid grid-cols-2 gap-4",v),e[65]=v,e[66]=b):b=e[66];let y;e[67]!==g||e[68]!==i?(y=g.map(N=>{const{chart:w,...S}=N;return l.jsx(Me,{title:S.title,value:S.value,caption:l.jsx(St,{change:S.change,better:S.better,reference:""}),onClick:w?()=>i(w):void 0},S.key)}),e[67]=g,e[68]=i,e[69]=y):y=e[69];let j;return e[70]!==b||e[71]!==y?(j=l.jsx("div",{className:b,children:y}),e[70]=b,e[71]=y,e[72]=j):j=e[72],j}function D3(t){const e=O.c(27),{points:s,metric:n}=t,i=n===void 0?"visitors":n,r=ie();let a;e[0]!==i||e[1]!==r?(a=r(i==="visitors"?"monitor.audience.overTime":"monitor.audience.pageviewsOverTime"),e[0]=i,e[1]=r,e[2]=a):a=e[2];let o;e[3]!==i||e[4]!==r?(o=r(i==="visitors"?"monitor.audience.visitors":"monitor.audience.pageviews"),e[3]=i,e[4]=r,e[5]=o):o=e[5];let c;e[6]!==o?(c={label:o,color:Hr},e[6]=o,e[7]=c):c=e[7];let d;e[8]!==i||e[9]!==c?(d={[i]:c},e[8]=i,e[9]=c,e[10]=d):d=e[10];let m,u,f,p;e[11]===Symbol.for("react.memo_cache_sentinel")?(m={left:0,right:0,top:4},u=l.jsx(Ft,{strokeDasharray:"4 4",stroke:"var(--border)",strokeOpacity:.5,vertical:!1}),f=l.jsx(zt,{dataKey:"t",axisLine:!1,tickLine:!1,tick:mt,tickMargin:8,minTickGap:32,tickFormatter:R3}),p=l.jsx(At,{orientation:"right",axisLine:!1,tickLine:!1,tick:mt,width:44,tickCount:4,allowDecimals:!1,tickFormatter:O3}),e[11]=m,e[12]=u,e[13]=f,e[14]=p):(m=e[11],u=e[12],f=e[13],p=e[14]);let x;e[15]===Symbol.for("react.memo_cache_sentinel")?(x=l.jsx(es,{content:l.jsx(us,{})}),e[15]=x):x=e[15];let h;e[16]!==i?(h=l.jsx(Gt,{dataKey:i,type:"monotone",fill:Hr,fillOpacity:.15,stroke:Hr,strokeWidth:1.5,isAnimationActive:!1}),e[16]=i,e[17]=h):h=e[17];let g;e[18]!==s||e[19]!==h?(g=l.jsxs(ri,{data:s,margin:m,children:[u,f,p,x,h]}),e[18]=s,e[19]=h,e[20]=g):g=e[20];let v;e[21]!==g||e[22]!==d?(v=l.jsx(It,{config:d,className:"h-[170px] w-full",children:g}),e[21]=g,e[22]=d,e[23]=v):v=e[23];let b;return e[24]!==v||e[25]!==a?(b=l.jsx(Me,{title:a,children:v}),e[24]=v,e[25]=a,e[26]=b):b=e[26],b}function O3(t){return wt(t)}function R3(t){return t.length>10?t.slice(11,16):t.slice(5)}function _d(t){const e=O.c(4),{title:s,rows:n}=t,i=ie();let r;if(e[0]!==n||e[1]!==i||e[2]!==s){const a=n.slice(0,8),o=Math.max(1,...a.map(F3));r=l.jsx(Me,{title:s,children:a.length===0?l.jsx("p",{className:"text-meta",children:i("monitor.audience.noRows")}):l.jsx("ul",{className:"flex flex-col gap-1",children:a.map(c=>l.jsxs("li",{className:"relative flex items-center",children:[l.jsx("span",{className:"surface-inset absolute inset-y-0 left-0",style:{width:`${c.count/o*100}%`}}),l.jsx("span",{className:"relative min-w-0 flex-1 truncate px-2 py-1 text-sm text-foreground",children:c.key}),l.jsx("span",{className:"tnum relative px-2 text-sm text-muted-foreground",children:wt(c.count)})]},c.key))})}),e[0]=n,e[1]=i,e[2]=s,e[3]=r}else r=e[3];return r}function F3(t){return t.count}function Ei(t){const e=O.c(14),{orgSlug:s,project:n,view:i,range:r,title:a,source:o}=t,c=ie(),d=kn(s,n,i,r,!0,o);if(d.isLoading){let x;return e[0]===Symbol.for("react.memo_cache_sentinel")?(x=l.jsx(Ce,{className:"h-64"}),e[0]=x):x=e[0],x}if(d.error){let x;e[1]!==c?(x=c("monitor.audience.error"),e[1]=c,e[2]=x):x=e[2];let h;e[3]!==x?(h=l.jsx("p",{className:"text-meta",children:x}),e[3]=x,e[4]=h):h=e[4];let g;return e[5]!==h||e[6]!==a?(g=l.jsx(Me,{title:a,children:h}),e[5]=h,e[6]=a,e[7]=g):g=e[7],g}const m=d.data;let u;e[8]!==m||e[9]!==i?(u=m?.available&&"rows"in m.data?m.data.rows.map(x=>({...x,key:$d(i,x.key)})):[],e[8]=m,e[9]=i,e[10]=u):u=e[10];const f=u;let p;return e[11]!==f||e[12]!==a?(p=l.jsx(_d,{title:a,rows:f}),e[11]=f,e[12]=a,e[13]=p):p=e[13],p}function hc(t){const e=O.c(2),{children:s}=t;let n;return e[0]!==s?(n=l.jsx("div",{className:"flex h-full min-h-0 flex-col overflow-auto",children:l.jsx("div",{className:"mx-auto flex w-full max-w-[1200px] flex-col gap-4 px-4 pt-6 pb-10 md:px-10",children:s})}),e[0]=s,e[1]=n):n=e[1],n}function $d(t,e){return t==="countries"?e.length===2?eo(e):e:t==="sources"||t==="devices"?e.charAt(0).toUpperCase()+e.slice(1):e}function z3(t){const e=O.c(60),{project:s,range:n,empty:i,source:r}=t,a=ie(),{org:o}=He(),c=kn(o.slug,s,"summary",n,!0,r),d=kn(o.slug,s,"timeline",n,!0,r),[m,u]=Z.useState("visitors");if(c.isLoading){let F;return e[0]===Symbol.for("react.memo_cache_sentinel")?(F=l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"grid grid-cols-2 gap-4 lg:grid-cols-4",children:[0,1,2,3].map(V3)}),l.jsx(Ce,{className:"h-64"})]}),e[0]=F):F=e[0],F}if(c.error){let F;e[1]===Symbol.for("react.memo_cache_sentinel")?(F=l.jsx(jn,{size:20}),e[1]=F):F=e[1];let E;e[2]!==a?(E=a("monitor.audience.error"),e[2]=a,e[3]=E):E=e[3];let z;return e[4]!==c.error.message||e[5]!==E?(z=l.jsx(Ke,{icon:F,title:E,description:c.error.message}),e[4]=c.error.message,e[5]=E,e[6]=z):z=e[6],z}const f=c.data;if(!f?.available)return i;let p;e[7]!==f?(p=Sd(f),e[7]=f,e[8]=p):p=e[8];const x=p;let h;e[9]!==d.data?(h=d.data?.available&&d.data.data.view==="timeline"?d.data.data.points:[],e[9]=d.data,e[10]=h):h=e[10];const g=h;let v;e[11]!==x?(v=x&&l.jsx(L3,{summary:x.summary,previous:x.previous,onChart:u}),e[11]=x,e[12]=v):v=e[12];let b;e[13]!==m||e[14]!==g||e[15]!==a||e[16]!==d.error||e[17]!==d.isLoading?(b=d.isLoading?l.jsx(Ce,{className:"h-64"}):d.error?l.jsx(Me,{title:a("monitor.audience.overTime"),children:l.jsx("p",{className:"text-meta",children:a("monitor.audience.error")})}):g.length>1&&l.jsx(D3,{points:g,metric:m}),e[13]=m,e[14]=g,e[15]=a,e[16]=d.error,e[17]=d.isLoading,e[18]=b):b=e[18];const y=o.slug;let j;e[19]!==a?(j=a("monitor.audience.pages"),e[19]=a,e[20]=j):j=e[20];let N;e[21]!==o.slug||e[22]!==s||e[23]!==n||e[24]!==r||e[25]!==j?(N=l.jsx(Ei,{orgSlug:y,project:s,source:r,view:"pages",range:n,title:j}),e[21]=o.slug,e[22]=s,e[23]=n,e[24]=r,e[25]=j,e[26]=N):N=e[26];const w=o.slug;let S;e[27]!==a?(S=a("monitor.audience.sources"),e[27]=a,e[28]=S):S=e[28];let k;e[29]!==o.slug||e[30]!==s||e[31]!==n||e[32]!==r||e[33]!==S?(k=l.jsx(Ei,{orgSlug:w,project:s,source:r,view:"sources",range:n,title:S}),e[29]=o.slug,e[30]=s,e[31]=n,e[32]=r,e[33]=S,e[34]=k):k=e[34];const _=o.slug;let $;e[35]!==a?($=a("monitor.audience.countries"),e[35]=a,e[36]=$):$=e[36];let T;e[37]!==o.slug||e[38]!==s||e[39]!==n||e[40]!==r||e[41]!==$?(T=l.jsx(Ei,{orgSlug:_,project:s,source:r,view:"countries",range:n,title:$}),e[37]=o.slug,e[38]=s,e[39]=n,e[40]=r,e[41]=$,e[42]=T):T=e[42];const P=o.slug;let I;e[43]!==a?(I=a("monitor.audience.devices"),e[43]=a,e[44]=I):I=e[44];let C;e[45]!==o.slug||e[46]!==s||e[47]!==n||e[48]!==r||e[49]!==I?(C=l.jsx(Ei,{orgSlug:P,project:s,source:r,view:"devices",range:n,title:I}),e[45]=o.slug,e[46]=s,e[47]=n,e[48]=r,e[49]=I,e[50]=C):C=e[50];let M;e[51]!==k||e[52]!==T||e[53]!==C||e[54]!==N?(M=l.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[N,k,T,C]}),e[51]=k,e[52]=T,e[53]=C,e[54]=N,e[55]=M):M=e[55];let A;return e[56]!==M||e[57]!==v||e[58]!==b?(A=l.jsxs(l.Fragment,{children:[v,b,M]}),e[56]=M,e[57]=v,e[58]=b,e[59]=A):A=e[59],A}function V3(t){return l.jsx(Ce,{className:"h-28"},t)}function q3(t){const e=O.c(51),{project:s,range:n,onRange:i}=t,r=ie(),{org:a}=He(),o=jr(a.slug,s),[c,d]=Z.useState(null),[m,u]=Z.useState("24h"),{segment:f}=In(),p=o.data?.registered?o.data:void 0,x=!!p&&!p.external,h=kn(a.slug,s,"summary",n,!!p,"onedollar").data,g=!!p&&h?.available===!0&&h.source==="onedollar",[v,b]=Z.useState("deco-analytics"),y=!!p&&(!g||v==="deco-analytics");let j;e[0]!==g||e[1]!==v||e[2]!==r?(j=g&&l.jsx(ns,{label:r("monitor.audience.sourceLabel"),value:v,options:["deco-analytics","onedollar"].map(C=>({value:C,label:wd(C,r)})),onChange:b}),e[0]=g,e[1]=v,e[2]=r,e[3]=j):j=e[3];let N;e[4]!==m||e[5]!==y||e[6]!==r?(N=y&&l.jsx(ns,{label:r("monitor.audience.range"),period:!0,value:m,options:jp.map(C=>({value:C,label:A3(C,r)})),onChange:u}),e[4]=m,e[5]=y,e[6]=r,e[7]=N):N=e[7];let w;e[8]!==m||e[9]!==y||e[10]!==a.slug||e[11]!==s||e[12]!==f?(w=y&&l.jsx(Ux,{orgSlug:a.slug,site:s.analyticsSite,range:m,segment:f}),e[8]=m,e[9]=y,e[10]=a.slug,e[11]=s,e[12]=f,e[13]=w):w=e[13];let S;e[14]!==o.data?.config?.enabled||e[15]!==r?(S=o.data?.config?.enabled===!1&&l.jsx(Ye,{variant:"outline",children:r("monitor.audience.paused")}),e[14]=o.data?.config?.enabled,e[15]=r,e[16]=S):S=e[16];let k;e[17]!==x?(k=x&&l.jsx(cd,{onClick:()=>d("configure")}),e[17]=x,e[18]=k):k=e[18];let _;e[19]!==y||e[20]!==i||e[21]!==n||e[22]!==j||e[23]!==N||e[24]!==w||e[25]!==S||e[26]!==k?(_=l.jsxs(kd,{value:n,onChange:i,hideRange:y,lead:j,children:[N,w,S,k]}),e[19]=y,e[20]=i,e[21]=n,e[22]=j,e[23]=N,e[24]=w,e[25]=S,e[26]=k,e[27]=_):_=e[27];let $;e[28]!==y?($=y&&l.jsx(dd,{}),e[28]=y,e[29]=$):$=e[29];let T;e[30]!==g||e[31]!==p||e[32]!==m||e[33]!==y||e[34]!==a.slug||e[35]!==s||e[36]!==n||e[37]!==f||e[38]!==r?(T=y&&p?l.jsx(l.Fragment,{children:[m==="5m"?"live":"overview","behaviour","events"].map(C=>{const M=l.jsx(co,{orgSlug:a.slug,site:s.analyticsSite,status:p,segment:f,section:C,range:C==="live"?"5m":m,onConfigure:()=>d("configure")});return C==="events"?l.jsx(dn,{title:r("mainPanelTabs.analyticsTab.viewEvents"),children:M},C):l.jsx(Z.Fragment,{children:M},C)})}):l.jsx(z3,{project:s,range:n,empty:l.jsx(io,{}),source:g?"onedollar":void 0}),e[30]=g,e[31]=p,e[32]=m,e[33]=y,e[34]=a.slug,e[35]=s,e[36]=n,e[37]=f,e[38]=r,e[39]=T):T=e[39];let P;e[40]!==x||e[41]!==p||e[42]!==c||e[43]!==a.slug||e[44]!==s?(P=p&&x&&l.jsx(od,{orgSlug:a.slug,project:s,status:p,open:c==="configure",onOpenChange:C=>d(C?"configure":null)}),e[40]=x,e[41]=p,e[42]=c,e[43]=a.slug,e[44]=s,e[45]=P):P=e[45];let I;return e[46]!==_||e[47]!==$||e[48]!==T||e[49]!==P?(I=l.jsxs(l.Fragment,{children:[_,$,T,P]}),e[46]=_,e[47]=$,e[48]=T,e[49]=P,e[50]=I):I=e[50],I}const gc=["var(--chart-1)","var(--chart-2)","var(--chart-3)","var(--chart-4)","var(--chart-5)"];function K3(t,e){return e==="24h"?t.slice(0,13):t.slice(0,10)}function B3(t){const e=O.c(33),{sites:s,range:n}=t,i=ie();let r;if(e[0]!==n||e[1]!==s){const w=new Map;for(const{project:k,points:_}of s)for(const $ of _){const T=K3($.t,n),P=w.get(T)??{t:T};P[k.id]=(Number(P[k.id])||0)+$.visitors,w.set(T,P)}const S=[...w.values()].filter(k=>s.every(_=>{const{project:$}=_;return $.id in k}));r=(S.length>1?S:[...w.values()]).sort(G3),e[0]=n,e[1]=s,e[2]=r}else r=e[2];const a=r,o=U3;let c;e[3]!==i?(c=i("monitor.audience.overTime"),e[3]=i,e[4]=c):c=e[4];let d;if(e[5]!==s){let w;e[7]===Symbol.for("react.memo_cache_sentinel")?(w=(S,k)=>{const{project:_}=S;return l.jsxs("li",{className:"flex items-center gap-2 text-sm",children:[l.jsx("span",{className:"size-2 rounded-full",style:{backgroundColor:o(k)}}),_.title]},_.id)},e[7]=w):w=e[7],d=s.map(w),e[5]=s,e[6]=d}else d=e[6];let m;e[8]!==d?(m=l.jsx("ul",{className:"flex flex-wrap gap-x-5 gap-y-1",children:d}),e[8]=d,e[9]=m):m=e[9];let u;if(e[10]!==s){let w;e[12]===Symbol.for("react.memo_cache_sentinel")?(w=(S,k)=>{const{project:_}=S;return[_.id,{label:_.title,color:o(k)}]},e[12]=w):w=e[12],u=Object.fromEntries(s.map(w)),e[10]=s,e[11]=u}else u=e[11];let f,p,x,h;e[13]===Symbol.for("react.memo_cache_sentinel")?(f={left:0,right:0,top:4},p=l.jsx(Ft,{strokeDasharray:"4 4",stroke:"var(--border)",strokeOpacity:.5,vertical:!1}),x=l.jsx(zt,{dataKey:"t",axisLine:!1,tickLine:!1,tick:mt,tickMargin:8,minTickGap:32,tickFormatter:W3}),h=l.jsx(At,{orientation:"right",axisLine:!1,tickLine:!1,tick:mt,width:44,tickCount:4,allowDecimals:!1,tickFormatter:H3}),e[13]=f,e[14]=p,e[15]=x,e[16]=h):(f=e[13],p=e[14],x=e[15],h=e[16]);let g;e[17]===Symbol.for("react.memo_cache_sentinel")?(g=l.jsx(es,{content:l.jsx(us,{})}),e[17]=g):g=e[17];let v;if(e[18]!==s){let w;e[20]===Symbol.for("react.memo_cache_sentinel")?(w=(S,k)=>{const{project:_}=S;return l.jsx(Gt,{dataKey:_.id,stackId:"sites",type:"monotone",fill:o(k),fillOpacity:.2,stroke:o(k),strokeWidth:1.5,isAnimationActive:!1},_.id)},e[20]=w):w=e[20],v=s.map(w),e[18]=s,e[19]=v}else v=e[19];let b;e[21]!==a||e[22]!==v?(b=l.jsxs(ri,{data:a,margin:f,children:[p,x,h,g,v]}),e[21]=a,e[22]=v,e[23]=b):b=e[23];let y;e[24]!==b||e[25]!==u?(y=l.jsx(It,{config:u,className:"h-[170px] w-full",children:b}),e[24]=b,e[25]=u,e[26]=y):y=e[26];let j;e[27]!==y||e[28]!==m?(j=l.jsxs("div",{className:"flex flex-col gap-3",children:[m,y]}),e[27]=y,e[28]=m,e[29]=j):j=e[29];let N;return e[30]!==j||e[31]!==c?(N=l.jsx(Me,{title:c,children:j}),e[30]=j,e[31]=c,e[32]=N):N=e[32],N}function H3(t){return wt(t)}function W3(t){return t.length>10?`${t.slice(11,13)}:00`:t.slice(5)}function U3(t){return gc[t%gc.length]}function G3(t,e){return String(t.t).localeCompare(String(e.t))}function Dn(t,e,s,n){const i=O.c(11);let r;if(i[0]!==t||i[1]!==e||i[2]!==n||i[3]!==s){let o;i[5]!==t||i[6]!==n||i[7]!==s?(o=c=>yd(t,c,s,n),i[5]=t,i[6]=n,i[7]=s,i[8]=o):o=i[8],r=e.map(o),i[0]=t,i[1]=e,i[2]=n,i[3]=s,i[4]=r}else r=i[4];let a;return i[9]!==r?(a={queries:r},i[9]=r,i[10]=a):a=i[10],Wn(a)}const Y3={sources:"monitor.audience.sources",countries:"monitor.audience.countries",devices:"monitor.audience.devices"};function Q3(t,e){const s=new Map;for(const n of e)if(!(!n?.available||!("rows"in n.data)))for(const i of n.data.rows){const r=$d(t,i.key);s.set(r,(s.get(r)??0)+i.count)}return[...s].map(([n,i])=>({key:n,count:i})).sort((n,i)=>i.count-n.count)}function X3(t){const e=O.c(87),{projects:s,range:n,onRange:i,onProject:r}=t,a=ie(),{org:o}=He(),c=Dn(o.slug,s,"summary",n),d=Dn(o.slug,s,"timeline",n),m=Dn(o.slug,s,"sources",n),u=Dn(o.slug,s,"countries",n),f=Dn(o.slug,s,"devices",n);let p,x,h,g,v,b,y,j,N;if(e[0]!==r||e[1]!==i||e[2]!==s||e[3]!==n||e[4]!==c||e[5]!==a||e[6]!==m||e[7]!==u||e[8]!==f||e[9]!==d){h=Symbol.for("react.early_return_sentinel");e:{const $={sources:m,countries:u,devices:f};let T;e[19]!==c?(T=(se,H)=>{const oe=c[H]?.data;return{project:se,loading:c[H]?.isLoading??!1,data:oe,summary:Sd(oe)}},e[19]=c,e[20]=T):T=e[20];const P=s.map(T).sort(o4),I=P.filter(a4),C=se=>I.reduce((H,oe)=>H+(oe.summary?se(oe.summary.summary):0),0),M=I.every(r4)?se=>I.reduce((H,oe)=>H+(oe.summary?.previous?se(oe.summary.previous):0),0):null,A=P.some(i4),F=se=>I.flatMap(H=>{const oe=H.summary?.summary,he=oe?se(oe):null;return oe&&he!==null?[{title:H.project.title,value:he,weight:oe.sessions??oe.visitors}]:[]}),E=F(n4),z=F(l4);let R;if(e[21]!==s||e[22]!==d){let se;e[24]!==d?(se=(H,oe)=>{const he=d[oe]?.data;return he?.available&&he.data.view==="timeline"?[{project:H,points:he.data.points}]:[]},e[24]=d,e[25]=se):se=e[25],R=s.flatMap(se),e[21]=s,e[22]=d,e[23]=R}else R=e[23];const V=R;let K;e[26]!==i||e[27]!==n?(K=l.jsx(kd,{value:n,onChange:i}),e[26]=i,e[27]=n,e[28]=K):K=e[28];const U=K;if(!A&&I.length===0){let se;e[29]===Symbol.for("react.memo_cache_sentinel")?(se=l.jsx(io,{}),e[29]=se):se=e[29];let H;e[30]!==U?(H=l.jsxs(l.Fragment,{children:[U,se]}),e[30]=U,e[31]=H):H=e[31],h=H;break e}const q=(se,H)=>l.jsx(Me,{title:se,value:A&&I.length===0?l.jsx(Ce,{className:"h-9 w-24"}):wt(C(H)),caption:M&&l.jsx(St,{change:Bs(C(H),M(H)),better:"up",reference:""})});j=U;let L;e[32]!==a?(L=a("monitor.audience.visitors"),e[32]=a,e[33]=L):L=e[33];const B=q(L,s4);let Y;e[34]!==a?(Y=a("monitor.audience.pageviews"),e[34]=a,e[35]=Y):Y=e[35];const J=l.jsxs("div",{className:"grid grid-cols-2 gap-4 lg:grid-cols-4",children:[B,q(Y,t4),E.length>0&&l.jsx(Me,{title:a("monitor.audience.bounceRate"),value:`${Math.round(rr(E)??0)}%`,caption:l.jsx(ar,{values:E,format:e4,lowerIsBetter:!0})}),z.length>0&&l.jsx(Me,{title:a("monitor.audience.visitDuration"),value:Ui(rr(z)??0),caption:l.jsx(ar,{values:z,format:Ui,lowerIsBetter:!1})})]});e[36]!==J?(N=l.jsx("div",{className:"flex flex-col gap-2",children:J}),e[36]=J,e[37]=N):N=e[37],e[38]!==n||e[39]!==V?(p=V.length>0&&l.jsx(B3,{sites:V,range:n}),e[38]=n,e[39]=V,e[40]=p):p=e[40];const X=["sources","countries","devices"].map(se=>$[se].some(J3)?l.jsx(Ce,{className:"h-64"},se):l.jsx(_d,{title:a(Y3[se]),rows:Q3(se,$[se].map(Z3))},se));e[41]!==X?(x=l.jsx("div",{className:"grid gap-4 md:grid-cols-3",children:X}),e[41]=X,e[42]=x):x=e[42],y="surface shrink-0 overflow-hidden",v="w-full text-sm";let ee;e[43]!==a?(ee=a("monitor.audience.org.site"),e[43]=a,e[44]=ee):ee=e[44];let te;e[45]!==ee?(te=l.jsx("th",{className:"px-4 py-2 font-normal",children:ee}),e[45]=ee,e[46]=te):te=e[46];let D;e[47]!==a?(D=a("monitor.audience.org.source"),e[47]=a,e[48]=D):D=e[48];let W;e[49]!==D?(W=l.jsx("th",{className:"px-4 py-2 font-normal",children:D}),e[49]=D,e[50]=W):W=e[50];let G;e[51]!==a?(G=a("monitor.audience.visitors"),e[51]=a,e[52]=G):G=e[52];let Q;e[53]!==G?(Q=l.jsx("th",{className:"px-4 py-2 text-right font-normal",children:G}),e[53]=G,e[54]=Q):Q=e[54];let re;e[55]!==a?(re=a("monitor.audience.bounceRate"),e[55]=a,e[56]=re):re=e[56];let ce;e[57]!==re?(ce=l.jsx("th",{className:"px-4 py-2 text-right font-normal",children:re}),e[57]=re,e[58]=ce):ce=e[58];let ae;e[59]!==a?(ae=a("monitor.audience.visitDuration"),e[59]=a,e[60]=ae):ae=e[60];let fe;e[61]!==ae?(fe=l.jsx("th",{className:"px-4 py-2 text-right font-normal",children:ae}),e[61]=ae,e[62]=fe):fe=e[62],e[63]!==te||e[64]!==W||e[65]!==Q||e[66]!==ce||e[67]!==fe?(b=l.jsx("thead",{className:"text-meta border-b border-border text-left",children:l.jsxs("tr",{children:[te,W,Q,ce,fe]})}),e[63]=te,e[64]=W,e[65]=Q,e[66]=ce,e[67]=fe,e[68]=b):b=e[68];let de;e[69]!==r||e[70]!==a?(de=se=>{const{project:H,loading:oe,data:he,summary:le}=se;return l.jsxs("tr",{tabIndex:0,onClick:()=>r(H.id),onKeyDown:ne=>{(ne.key==="Enter"||ne.key===" ")&&(ne.preventDefault(),r(H.id))},className:"cursor-pointer border-b border-border last:border-0 hover:bg-muted/50",children:[l.jsx("td",{className:"px-4 py-2.5 text-foreground",children:H.title}),l.jsx("td",{className:"px-4 py-2.5",children:oe?l.jsx(Ce,{className:"h-5 w-24"}):he?.available?l.jsx(Ye,{variant:"muted",children:wd(he.source,a)}):l.jsx("span",{className:"text-meta",children:a(he?"monitor.audience.org.noSource":"monitor.audience.org.failed")})}),l.jsx("td",{className:"tnum px-4 py-2.5 text-right",children:le?l.jsxs("span",{className:"inline-flex items-center gap-2",children:[wt(le.summary.visitors),l.jsx(St,{change:Bs(le.summary.visitors,le.previous?.visitors),better:"up",reference:""})]}):"—"}),l.jsx("td",{className:"tnum px-4 py-2.5 text-right",children:le?.summary.bounceRate!=null?`${Math.round(le.summary.bounceRate)}%`:"—"}),l.jsx("td",{className:"tnum px-4 py-2.5 text-right",children:le?.summary.visitDurationS!=null?Ui(le.summary.visitDurationS):"—"})]},H.id)},e[69]=r,e[70]=a,e[71]=de):de=e[71],g=P.map(de)}e[0]=r,e[1]=i,e[2]=s,e[3]=n,e[4]=c,e[5]=a,e[6]=m,e[7]=u,e[8]=f,e[9]=d,e[10]=p,e[11]=x,e[12]=h,e[13]=g,e[14]=v,e[15]=b,e[16]=y,e[17]=j,e[18]=N}else p=e[10],x=e[11],h=e[12],g=e[13],v=e[14],b=e[15],y=e[16],j=e[17],N=e[18];if(h!==Symbol.for("react.early_return_sentinel"))return h;let w;e[72]!==g?(w=l.jsx("tbody",{children:g}),e[72]=g,e[73]=w):w=e[73];let S;e[74]!==w||e[75]!==v||e[76]!==b?(S=l.jsxs("table",{className:v,children:[b,w]}),e[74]=w,e[75]=v,e[76]=b,e[77]=S):S=e[77];let k;e[78]!==S||e[79]!==y?(k=l.jsx("section",{className:y,children:S}),e[78]=S,e[79]=y,e[80]=k):k=e[80];let _;return e[81]!==p||e[82]!==x||e[83]!==k||e[84]!==j||e[85]!==N?(_=l.jsxs(l.Fragment,{children:[j,N,p,x,k]}),e[81]=p,e[82]=x,e[83]=k,e[84]=j,e[85]=N,e[86]=_):_=e[86],_}function Z3(t){return t.data}function J3(t){return t.isLoading}function e4(t){return`${Math.round(t)}%`}function t4(t){return t.pageviews}function s4(t){return t.visitors}function l4(t){return t.visitDurationS}function n4(t){return t.bounceRate}function i4(t){return t.loading}function r4(t){return t.summary?.previous}function a4(t){return t.summary}function o4(t,e){return(e.summary?.summary.visitors??-1)-(t.summary?.summary.visitors??-1)}function c4(t){const e=O.c(15),{projects:s,scopeId:n,onOpen:i}=t,r=ie(),[a,o]=Z.useState("7d");let c;if(e[0]!==s||e[1]!==n){let u;e[3]!==n?(u=f=>f.id===n,e[3]=n,e[4]=u):u=e[4],c=s.find(u),e[0]=s,e[1]=n,e[2]=c}else c=e[2];const d=c;if(n&&!d){let u;e[5]===Symbol.for("react.memo_cache_sentinel")?(u=l.jsx(jn,{size:20}),e[5]=u):u=e[5];let f;e[6]!==r?(f=r("mainPanelTabs.cdnTab.noSiteTitle"),e[6]=r,e[7]=f):f=e[7];let p;return e[8]!==f?(p=l.jsx(hc,{children:l.jsx(Ke,{icon:u,title:f})}),e[8]=f,e[9]=p):p=e[9],p}let m;return e[10]!==i||e[11]!==d||e[12]!==s||e[13]!==a?(m=l.jsx(hc,{children:d?l.jsx(q3,{project:d,range:a,onRange:o},d.id):l.jsx(X3,{projects:s,range:a,onRange:o,onProject:u=>i({project:u})})}),e[10]=i,e[11]=d,e[12]=s,e[13]=a,e[14]=m):m=e[14],m}function d4(t){const e=O.c(7),{project:s,section:n,range:i}=t,{org:r}=He(),a=jr(r.slug,s),{segment:o}=In();if(!a.data?.registered)return null;let c;return e[0]!==r.slug||e[1]!==s.analyticsSite||e[2]!==i||e[3]!==n||e[4]!==o||e[5]!==a.data?(c=l.jsx(co,{orgSlug:r.slug,site:s.analyticsSite,status:a.data,segment:o,section:n,range:i,onConfigure:m4}),e[0]=r.slug,e[1]=s.analyticsSite,e[2]=i,e[3]=n,e[4]=o,e[5]=a.data,e[6]=c):c=e[6],c}function m4(){}function u4(t){const e=O.c(32),{project:s,projects:n,onProject:i}=t,r=ie(),{org:a}=He(),[o,c]=Z.useState(!1),d=s?.analyticsSite??"";let m;e[0]!==d?(m={analyticsSite:d},e[0]=d,e[1]=m):m=e[1];const u=jr(a.slug,m,s!==void 0),{segment:f}=In(),p=u.data?.registered===!0&&!u.data.external;let x;if(s)if(u.isLoading){let v;e[6]===Symbol.for("react.memo_cache_sentinel")?(v=l.jsx(Ce,{className:"h-64"}),e[6]=v):v=e[6],x=v}else if(u.error){let v;e[7]!==u.error||e[8]!==r?(v=to(u.error)?l.jsx(Ke,{icon:l.jsx(jn,{size:20}),title:r("mainPanelTabs.analyticsTab.backendNotConfiguredTitle"),description:r("mainPanelTabs.analyticsTab.backendNotConfiguredDescription")}):l.jsx(Ke,{icon:l.jsx(jn,{size:20}),title:r("mainPanelTabs.analyticsTab.statusError")}),e[7]=u.error,e[8]=r,e[9]=v):v=e[9],x=v}else if(u.data?.registered){let v;e[11]===Symbol.for("react.memo_cache_sentinel")?(v=()=>c(!0),e[11]=v):v=e[11];let b;e[12]!==a.slug||e[13]!==s.analyticsSite||e[14]!==f||e[15]!==u.data?(b=l.jsx(co,{orgSlug:a.slug,site:s.analyticsSite,status:u.data,segment:f,section:"heatmap",range:"7d",onConfigure:v}),e[12]=a.slug,e[13]=s.analyticsSite,e[14]=f,e[15]=u.data,e[16]=b):b=e[16];let y;e[17]!==p||e[18]!==o||e[19]!==a.slug||e[20]!==s||e[21]!==u.data?(y=p&&l.jsx(od,{orgSlug:a.slug,project:s,status:u.data,open:o,onOpenChange:c}),e[17]=p,e[18]=o,e[19]=a.slug,e[20]=s,e[21]=u.data,e[22]=y):y=e[22];let j;e[23]!==b||e[24]!==y?(j=l.jsxs(l.Fragment,{children:[b,y]}),e[23]=b,e[24]=y,e[25]=j):j=e[25],x=j}else{let v;e[10]===Symbol.for("react.memo_cache_sentinel")?(v=l.jsx(io,{}),e[10]=v):v=e[10],x=v}else{let v;e[2]===Symbol.for("react.memo_cache_sentinel")?(v=l.jsx(no,{}),e[2]=v):v=e[2];let b;e[3]!==i||e[4]!==n?(b=l.jsx(rd,{projects:n,onProject:i,children:v}),e[3]=i,e[4]=n,e[5]=b):b=e[5],x=b}let h;e[26]!==p||e[27]!==s?(h=s&&p&&l.jsx(We.Actions,{children:l.jsx(cd,{onClick:()=>c(!0)})}),e[26]=p,e[27]=s,e[28]=h):h=e[28];let g;return e[29]!==x||e[30]!==h?(g=l.jsx("div",{className:"flex h-full min-h-0 flex-col overflow-auto",children:l.jsxs("div",{className:"mx-auto flex h-full min-h-0 w-full max-w-[1200px] flex-col gap-4 px-4 pt-6 pb-6 md:px-10",children:[h,x]})}),e[29]=x,e[30]=h,e[31]=g):g=e[31],g}const vc="decoAnalytics",f4=Jt({id:Ct().min(1),key:Ct().min(1)});function p4(t){if(!t||typeof t!="object"||!(vc in t))return null;const e=f4.safeParse(t[vc]);return e.success?e.data:null}const Wr=[{key:"2xx",color:"var(--chart-1)"},{key:"3xx",color:"var(--chart-5)"},{key:"4xx",color:"var(--warning)"},{key:"5xx",color:"var(--destructive)"}],bc="var(--chart-1)";async function x4(t){const e=await fetch(t),s=await e.json().catch(()=>({}));if(!e.ok)throw new Error(s.error??`request failed (${e.status})`);return s}function un(t,e,s){const n=O.c(12);let i;n[0]!==t||n[1]!==s||n[2]!==e?(i=Qe.siteMonitorData(t,e,s),n[0]=t,n[1]=s,n[2]=e,n[3]=i):i=n[3];let r;n[4]!==t||n[5]!==s||n[6]!==e?(r=()=>x4(`${t}/site/data?view=${e}&range=${s}`),n[4]=t,n[5]=s,n[6]=e,n[7]=r):r=n[7];const a=s==="1h"?6e4:!1;let o;return n[8]!==i||n[9]!==r||n[10]!==a?(o={queryKey:i,queryFn:r,retry:1,staleTime:3e4,refetchInterval:a},n[8]=i,n[9]=r,n[10]=a,n[11]=o):o=n[11],ts(o)}function ei(t){const e=O.c(15),{title:s,subtitle:n,children:i,className:r}=t;let a;e[0]!==r?(a=ye("surface min-w-0 overflow-hidden",r),e[0]=r,e[1]=a):a=e[1];let o;e[2]!==s?(o=l.jsx("h3",{className:"text-sm font-medium text-foreground",children:s}),e[2]=s,e[3]=o):o=e[3];let c;e[4]!==n?(c=n&&l.jsx("p",{className:"text-xs text-muted-foreground",children:n}),e[4]=n,e[5]=c):c=e[5];let d;e[6]!==o||e[7]!==c?(d=l.jsxs("header",{className:"border-b border-border px-4 py-3",children:[o,c]}),e[6]=o,e[7]=c,e[8]=d):d=e[8];let m;e[9]!==i?(m=l.jsx("div",{className:"p-4",children:i}),e[9]=i,e[10]=m):m=e[10];let u;return e[11]!==a||e[12]!==d||e[13]!==m?(u=l.jsxs("section",{className:a,children:[d,m]}),e[11]=a,e[12]=d,e[13]=m,e[14]=u):u=e[14],u}function jc(t){const e=O.c(10),{label:s,value:n,options:i,onChange:r}=t;let a;if(e[0]!==r||e[1]!==i||e[2]!==n){let c;e[4]!==r||e[5]!==n?(c=d=>l.jsx("button",{type:"button",role:"tab","aria-selected":n===d.key,onClick:()=>r(d.key),className:ye("rounded-lg px-3 py-1 text-xs font-medium transition-colors",n===d.key?"bg-muted text-foreground":"text-muted-foreground hover:text-foreground"),children:d.label},d.key),e[4]=r,e[5]=n,e[6]=c):c=e[6],a=i.map(c),e[0]=r,e[1]=i,e[2]=n,e[3]=a}else a=e[3];let o;return e[7]!==s||e[8]!==a?(o=l.jsx("div",{role:"tablist","aria-label":s,className:"flex items-center gap-0.5 rounded-lg border border-border p-0.5",children:a}),e[7]=s,e[8]=a,e[9]=o):o=e[9],o}function Mi(t){const e=O.c(20),{current:s,previous:n,better:i}=t,r=ie();let a,o,c,d;if(e[0]!==i||e[1]!==s||e[2]!==n){c=Symbol.for("react.early_return_sentinel");e:{if(a=ot(s,n),a===null){c=null;break e}d=oi(a,i),o=Math.abs(a)}e[0]=i,e[1]=s,e[2]=n,e[3]=a,e[4]=o,e[5]=c,e[6]=d}else a=e[3],o=e[4],c=e[5],d=e[6];if(c!==Symbol.for("react.early_return_sentinel"))return c;const m=o*100;let u;e[7]!==r?(u=r("mainPanelTabs.monitorV8.delta.title"),e[7]=r,e[8]=u):u=e[8];const f=d==="good"&&"text-success",p=d==="bad"&&"text-destructive",x=d==="neutral"&&"text-muted-foreground";let h;e[9]!==f||e[10]!==p||e[11]!==x?(h=ye("text-xs font-medium tabular-nums",f,p,x),e[9]=f,e[10]=p,e[11]=x,e[12]=h):h=e[12];const g=a>=0?"↑":"↓";let v;e[13]!==m?(v=m<10?m.toFixed(1):Math.round(m),e[13]=m,e[14]=v):v=e[14];let b;return e[15]!==u||e[16]!==h||e[17]!==g||e[18]!==v?(b=l.jsxs("span",{title:u,className:h,children:[g," ",v,"%"]}),e[15]=u,e[16]=h,e[17]=g,e[18]=v,e[19]=b):b=e[19],b}function Ii(t){const e=O.c(13),{label:s,value:n,hint:i,delta:r}=t;let a;e[0]!==s?(a=l.jsx("div",{className:"text-xs text-muted-foreground",children:s}),e[0]=s,e[1]=a):a=e[1];let o;e[2]!==n?(o=l.jsx("span",{className:"whitespace-nowrap text-2xl font-semibold tabular-nums text-foreground",children:n}),e[2]=n,e[3]=o):o=e[3];let c;e[4]!==r||e[5]!==o?(c=l.jsxs("div",{className:"mt-1 flex flex-wrap items-baseline gap-x-2",children:[o,r]}),e[4]=r,e[5]=o,e[6]=c):c=e[6];let d;e[7]!==i?(d=l.jsx("div",{className:"truncate text-xs text-muted-foreground",children:i}),e[7]=i,e[8]=d):d=e[8];let m;return e[9]!==a||e[10]!==c||e[11]!==d?(m=l.jsxs("div",{className:"surface min-w-0 px-4 py-3",children:[a,c,d]}),e[9]=a,e[10]=c,e[11]=d,e[12]=m):m=e[12],m}function h4(t){const e=O.c(71),{summary:s}=t,n=ie(),{current:i,previous:r}=s;let a,o,c,d,m;if(e[0]!==i.requests||e[1]!==s.perSecond||e[2]!==n){const I=Ap(s.perSecond);m="grid grid-cols-2 gap-3 lg:grid-cols-4",a=Ii,e[8]!==n?(o=n("mainPanelTabs.monitorV8.tile.requests"),e[8]=n,e[9]=o):o=e[9],e[10]!==i.requests?(c=Rt(i.requests),e[10]=i.requests,e[11]=c):c=e[11],d=n(I.unit==="s"?"mainPanelTabs.monitorV8.tile.perSecond":"mainPanelTabs.monitorV8.tile.perMinute",{value:I.value}),e[0]=i.requests,e[1]=s.perSecond,e[2]=n,e[3]=a,e[4]=o,e[5]=c,e[6]=d,e[7]=m}else a=e[3],o=e[4],c=e[5],d=e[6],m=e[7];let u;e[12]!==i.requests||e[13]!==r.requests?(u=l.jsx(Mi,{current:i.requests,previous:r.requests,better:"none"}),e[12]=i.requests,e[13]=r.requests,e[14]=u):u=e[14];let f;e[15]!==a||e[16]!==o||e[17]!==c||e[18]!==d||e[19]!==u?(f=l.jsx(a,{label:o,value:c,hint:d,delta:u}),e[15]=a,e[16]=o,e[17]=c,e[18]=d,e[19]=u,e[20]=f):f=e[20];let p;e[21]!==n?(p=n("mainPanelTabs.monitorV8.tile.errors"),e[21]=n,e[22]=p):p=e[22];let x;e[23]!==i.errorRate?(x=Xn(i.errorRate),e[23]=i.errorRate,e[24]=x):x=e[24];let h;e[25]!==i.errors5xx||e[26]!==n?(h=n("mainPanelTabs.monitorV8.tile.errorsCount",{count:Rt(i.errors5xx)}),e[25]=i.errors5xx,e[26]=n,e[27]=h):h=e[27];let g;e[28]!==i.errorRate||e[29]!==r.errorRate?(g=l.jsx(Mi,{current:i.errorRate,previous:r.errorRate,better:"down"}),e[28]=i.errorRate,e[29]=r.errorRate,e[30]=g):g=e[30];let v;e[31]!==g||e[32]!==p||e[33]!==x||e[34]!==h?(v=l.jsx(Ii,{label:p,value:x,hint:h,delta:g}),e[31]=g,e[32]=p,e[33]=x,e[34]=h,e[35]=v):v=e[35];let b;e[36]!==n?(b=n("mainPanelTabs.monitorV8.tile.p95"),e[36]=n,e[37]=b):b=e[37];let y;e[38]!==i.p95Ms?(y=Xs(i.p95Ms),e[38]=i.p95Ms,e[39]=y):y=e[39];let j;e[40]!==i.p50Ms||e[41]!==n?(j=n("mainPanelTabs.monitorV8.tile.p50",{value:Xs(i.p50Ms)}),e[40]=i.p50Ms,e[41]=n,e[42]=j):j=e[42];let N;e[43]!==i.p95Ms||e[44]!==r.p95Ms?(N=l.jsx(Mi,{current:i.p95Ms,previous:r.p95Ms,better:"down"}),e[43]=i.p95Ms,e[44]=r.p95Ms,e[45]=N):N=e[45];let w;e[46]!==b||e[47]!==y||e[48]!==j||e[49]!==N?(w=l.jsx(Ii,{label:b,value:y,hint:j,delta:N}),e[46]=b,e[47]=y,e[48]=j,e[49]=N,e[50]=w):w=e[50];let S;e[51]!==n?(S=n("mainPanelTabs.monitorV8.tile.cacheHits"),e[51]=n,e[52]=S):S=e[52];let k;e[53]!==i.cacheHitRate?(k=Xn(i.cacheHitRate),e[53]=i.cacheHitRate,e[54]=k):k=e[54];let _;e[55]!==n?(_=n("mainPanelTabs.monitorV8.tile.cacheHitsHint"),e[55]=n,e[56]=_):_=e[56];let $;e[57]!==i.cacheHitRate||e[58]!==r.cacheHitRate?($=l.jsx(Mi,{current:i.cacheHitRate,previous:r.cacheHitRate,better:"up"}),e[57]=i.cacheHitRate,e[58]=r.cacheHitRate,e[59]=$):$=e[59];let T;e[60]!==S||e[61]!==k||e[62]!==_||e[63]!==$?(T=l.jsx(Ii,{label:S,value:k,hint:_,delta:$}),e[60]=S,e[61]=k,e[62]=_,e[63]=$,e[64]=T):T=e[64];let P;return e[65]!==v||e[66]!==w||e[67]!==T||e[68]!==m||e[69]!==f?(P=l.jsxs("div",{className:m,children:[f,v,w,T]}),e[65]=v,e[66]=w,e[67]=T,e[68]=m,e[69]=f,e[70]=P):P=e[70],P}function yc({releases:t,window:e}){return t.map(s=>{const n=H1(s.firstSeenMs,e);return n===null?null:l.jsx(Ls,{x:n,stroke:"var(--muted-foreground)",strokeDasharray:"3 3",ifOverflow:"extendDomain"},s.release)})}function Td(t){const e=O.c(11),{color:s,label:n,dashed:i}=t,r=i&&"h-0 border-t border-dashed";let a;e[0]!==r?(a=ye("h-2 w-3 shrink-0 rounded-[2px]",r),e[0]=r,e[1]=a):a=e[1];let o;e[2]!==s||e[3]!==i?(o=i?{borderColor:s}:{backgroundColor:s},e[2]=s,e[3]=i,e[4]=o):o=e[4];let c;e[5]!==a||e[6]!==o?(c=l.jsx("span",{className:a,style:o}),e[5]=a,e[6]=o,e[7]=c):c=e[7];let d;return e[8]!==n||e[9]!==c?(d=l.jsxs("span",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[c,n]}),e[8]=n,e[9]=c,e[10]=d):d=e[10],d}function g4(t){const e=O.c(89),{points:s,releases:n,window:i,range:r}=t,a=ie(),o=i.endMs-i.stepS*1e3;let c;e[0]!==o||e[1]!==i.startMs?(c=[i.startMs,o],e[0]=o,e[1]=i.startMs,e[2]=c):c=e[2];let d;e[3]!==r?(d=R=>Fr(R,r),e[3]=r,e[4]=d):d=e[4];let m;e[5]!==c||e[6]!==d?(m=l.jsx(zt,{dataKey:"t",type:"number",scale:"time",domain:c,tickLine:!1,axisLine:!1,tickMargin:8,minTickGap:40,tickFormatter:d}),e[5]=c,e[6]=d,e[7]=m):m=e[7];const u=m;let f;e[8]!==r?(f=(R,V)=>{const K=V?.[0]?.payload?.t;return typeof K=="number"?Fr(K,r):""},e[8]=r,e[9]=f):f=e[9];const p=f;let x,h,g,v,b,y,j;if(e[10]!==p||e[11]!==s||e[12]!==r||e[13]!==n||e[14]!==a||e[15]!==i||e[16]!==u){let R;e[24]!==i?(R=D=>H1(D.firstSeenMs,i)!==null,e[24]=i,e[25]=R):R=e[25];const V=n.filter(R);g="flex flex-col gap-4",x=ei,e[26]!==a?(v=a("mainPanelTabs.monitorV8.chart.requests"),e[26]=a,e[27]=v):v=e[27];const K=`mainPanelTabs.monitorV8.chart.step.${r}`;e[28]!==a||e[29]!==K?(b=a(K),e[28]=a,e[29]=K,e[30]=b):b=e[30];let U;e[31]===Symbol.for("react.memo_cache_sentinel")?(U=Wr.map(N4),e[31]=U):U=e[31];const q=V.length>0&&l.jsx(Td,{color:"var(--muted-foreground)",label:a("mainPanelTabs.monitorV8.chart.releaseLegend"),dashed:!0});e[32]!==q?(y=l.jsxs("div",{className:"mb-2 flex flex-wrap items-center gap-x-4 gap-y-1",children:[U,q]}),e[32]=q,e[33]=y):y=e[33];let L;e[34]===Symbol.for("react.memo_cache_sentinel")?(L=Object.fromEntries(Wr.map(w4)),e[34]=L):L=e[34];let B,Y;e[35]===Symbol.for("react.memo_cache_sentinel")?(B={top:12,right:8,bottom:0,left:0},Y=l.jsx(Ft,{vertical:!1}),e[35]=B,e[36]=Y):(B=e[35],Y=e[36]);let J;e[37]===Symbol.for("react.memo_cache_sentinel")?(J=l.jsx(At,{tickLine:!1,axisLine:!1,width:48,allowDecimals:!1,tickFormatter:y4}),e[37]=J):J=e[37];let X;e[38]!==p?(X=l.jsx(es,{content:l.jsx(us,{labelFormatter:p})}),e[38]=p,e[39]=X):X=e[39];let ee;e[40]===Symbol.for("react.memo_cache_sentinel")?(ee=Wr.map(j4),e[40]=ee):ee=e[40];let te;e[41]!==n||e[42]!==i?(te=yc({releases:n,window:i}),e[41]=n,e[42]=i,e[43]=te):te=e[43],e[44]!==s||e[45]!==X||e[46]!==te||e[47]!==u?(j=l.jsx(It,{config:L,className:"aspect-auto h-56 w-full",children:l.jsxs(ri,{data:s,margin:B,children:[Y,u,J,X,ee,te]})}),e[44]=s,e[45]=X,e[46]=te,e[47]=u,e[48]=j):j=e[48],h=V.length>0&&l.jsx("ul",{className:"mt-3 flex flex-wrap gap-x-4 gap-y-1 text-xs text-muted-foreground",children:V.map(D=>l.jsxs("li",{title:D.release,children:[l.jsx("span",{className:"font-mono",children:a("mainPanelTabs.monitorV8.chart.release",{id:Lp(D.release)})})," · ",Fr(D.firstSeenMs,r)]},D.release))}),e[10]=p,e[11]=s,e[12]=r,e[13]=n,e[14]=a,e[15]=i,e[16]=u,e[17]=x,e[18]=h,e[19]=g,e[20]=v,e[21]=b,e[22]=y,e[23]=j}else x=e[17],h=e[18],g=e[19],v=e[20],b=e[21],y=e[22],j=e[23];let N;e[49]!==x||e[50]!==h||e[51]!==v||e[52]!==b||e[53]!==y||e[54]!==j?(N=l.jsxs(x,{title:v,subtitle:b,children:[y,j,h]}),e[49]=x,e[50]=h,e[51]=v,e[52]=b,e[53]=y,e[54]=j,e[55]=N):N=e[55];let w;e[56]!==a?(w=a("mainPanelTabs.monitorV8.chart.p95"),e[56]=a,e[57]=w):w=e[57];let S;e[58]!==a?(S=a("mainPanelTabs.monitorV8.chart.p95Subtitle"),e[58]=a,e[59]=S):S=e[59];let k;e[60]!==a?(k=a("mainPanelTabs.monitorV8.tile.p95"),e[60]=a,e[61]=k):k=e[61];let _;e[62]!==k?(_={p95Ms:{label:k,color:bc}},e[62]=k,e[63]=_):_=e[63];let $,T;e[64]===Symbol.for("react.memo_cache_sentinel")?($={top:12,right:8,bottom:0,left:0},T=l.jsx(Ft,{vertical:!1}),e[64]=$,e[65]=T):($=e[64],T=e[65]);let P;e[66]===Symbol.for("react.memo_cache_sentinel")?(P=l.jsx(At,{tickLine:!1,axisLine:!1,width:56,tickFormatter:b4}),e[66]=P):P=e[66];let I;e[67]!==p?(I=l.jsx(es,{content:l.jsx(us,{labelFormatter:p,formatter:v4})}),e[67]=p,e[68]=I):I=e[68];let C;e[69]===Symbol.for("react.memo_cache_sentinel")?(C=l.jsx(rs,{dataKey:"p95Ms",type:"monotone",stroke:bc,strokeWidth:2,dot:!1,connectNulls:!0,isAnimationActive:!1}),e[69]=C):C=e[69];let M;e[70]!==n||e[71]!==i?(M=yc({releases:n,window:i}),e[70]=n,e[71]=i,e[72]=M):M=e[72];let A;e[73]!==s||e[74]!==I||e[75]!==M||e[76]!==u?(A=l.jsxs(O1,{data:s,margin:$,children:[T,u,P,I,C,M]}),e[73]=s,e[74]=I,e[75]=M,e[76]=u,e[77]=A):A=e[77];let F;e[78]!==_||e[79]!==A?(F=l.jsx(It,{config:_,className:"aspect-auto h-36 w-full",children:A}),e[78]=_,e[79]=A,e[80]=F):F=e[80];let E;e[81]!==w||e[82]!==S||e[83]!==F?(E=l.jsx(ei,{title:w,subtitle:S,children:F}),e[81]=w,e[82]=S,e[83]=F,e[84]=E):E=e[84];let z;return e[85]!==g||e[86]!==N||e[87]!==E?(z=l.jsxs("div",{className:g,children:[N,E]}),e[85]=g,e[86]=N,e[87]=E,e[88]=z):z=e[88],z}function v4(t){return Xs(Number(t))}function b4(t){return t>=1e3?`${t/1e3}s`:`${t}ms`}function j4(t){return l.jsx(Gt,{dataKey:t.key,stackId:"status",type:"monotone",fill:t.color,fillOpacity:.2,stroke:t.color,strokeWidth:2,isAnimationActive:!1},t.key)}function y4(t){return Rt(t)}function w4(t){return[t.key,{label:t.key,color:t.color}]}function N4(t){return l.jsx(Td,{color:t.color,label:t.key},t.key)}function Pd(t){const e=O.c(14),{head:s,rows:n}=t;let i;e[0]!==s?(i=s.map(k4),e[0]=s,e[1]=i):i=e[1];let r;e[2]!==i?(r=l.jsx("thead",{children:l.jsx("tr",{className:"border-b border-border",children:i})}),e[2]=i,e[3]=r):r=e[3];let a;if(e[4]!==s||e[5]!==n){let d;e[7]!==s?(d=m=>l.jsx("tr",{children:m.cells.map((u,f)=>l.jsx("td",{className:ye("px-4 py-2 tabular-nums",s[f]?.align==="right"?"text-right whitespace-nowrap":"w-full min-w-36 max-w-0 truncate"),children:u},f))},m.key),e[7]=s,e[8]=d):d=e[8],a=n.map(d),e[4]=s,e[5]=n,e[6]=a}else a=e[6];let o;e[9]!==a?(o=l.jsx("tbody",{className:"divide-y divide-border/60",children:a}),e[9]=a,e[10]=o):o=e[10];let c;return e[11]!==r||e[12]!==o?(c=l.jsx("div",{className:"-mx-4 -my-4 overflow-x-auto",children:l.jsxs("table",{className:"w-full text-sm",children:[r,o]})}),e[11]=r,e[12]=o,e[13]=c):c=e[13],c}function k4(t){return l.jsx("th",{className:ye("px-4 py-2 text-xs font-medium text-muted-foreground",t.align==="right"?"text-right":"text-left"),children:t.label},t.label)}function S4(t){const e=O.c(26),{routes:s}=t,n=ie();let i;if(e[0]!==s||e[1]!==n){const r=[...s].sort(_4);let a;e[3]!==n?(a=n("mainPanelTabs.monitorV8.routes.route"),e[3]=n,e[4]=a):a=e[4];let o;e[5]!==a?(o={label:a},e[5]=a,e[6]=o):o=e[6];let c;e[7]!==n?(c=n("mainPanelTabs.monitorV8.routes.p95"),e[7]=n,e[8]=c):c=e[8];let d;e[9]!==c?(d={label:c,align:"right"},e[9]=c,e[10]=d):d=e[10];let m;e[11]!==n?(m=n("mainPanelTabs.monitorV8.routes.requests"),e[11]=n,e[12]=m):m=e[12];let u;e[13]!==m?(u={label:m,align:"right"},e[13]=m,e[14]=u):u=e[14];let f;e[15]!==n?(f=n("mainPanelTabs.monitorV8.routes.errors"),e[15]=n,e[16]=f):f=e[16];let p;e[17]!==f?(p={label:f,align:"right"},e[17]=f,e[18]=p):p=e[18];let x;e[19]!==o||e[20]!==d||e[21]!==u||e[22]!==p?(x=[o,d,u,p],e[19]=o,e[20]=d,e[21]=u,e[22]=p,e[23]=x):x=e[23];let h;e[24]!==n?(h=g=>({key:g.route,cells:[g.route==="unmatched"||g.route==="redirect"?l.jsx("span",{className:"text-xs text-muted-foreground",children:n(`mainPanelTabs.monitorV8.routes.${g.route}`)},"r"):l.jsx("span",{className:"font-mono text-xs",title:g.route,children:g.route},"r"),Xs(g.p95Ms),Rt(g.requests),l.jsx("span",{className:ye((g.errorRate??0)>=.01&&"text-destructive"),children:Xn(g.errorRate)},"e")]}),e[24]=n,e[25]=h):h=e[25],i=l.jsx(Pd,{head:x,rows:r.map(h)}),e[0]=s,e[1]=n,e[2]=i}else i=e[2];return i}function _4(t,e){return(e.p95Ms??0)-(t.p95Ms??0)}function $4(t){const e=O.c(16),{reason:s,onSeeUpstreams:n}=t,i=ie();let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r={server_metric_missing:"serverMetricMissing",no_telemetry:"noTelemetry",no_requests:"noRequests"},e[0]=r):r=e[0];const o=r[s]??"noRequests";let c;e[1]===Symbol.for("react.memo_cache_sentinel")?(c=l.jsx(pr,{className:"size-5"}),e[1]=c):c=e[1];const d=`mainPanelTabs.monitorV8.empty.${o}.title`;let m;e[2]!==i||e[3]!==d?(m=i(d),e[2]=i,e[3]=d,e[4]=m):m=e[4];const u=`mainPanelTabs.monitorV8.empty.${o}.body`;let f;e[5]!==i||e[6]!==u?(f=i(u),e[5]=i,e[6]=u,e[7]=f):f=e[7];let p;e[8]!==n||e[9]!==s||e[10]!==i?(p=s==="server_metric_missing"?{variant:"outline",children:i("mainPanelTabs.monitorV8.empty.seeUpstreams"),onClick:n}:void 0,e[8]=n,e[9]=s,e[10]=i,e[11]=p):p=e[11];let x;return e[12]!==m||e[13]!==f||e[14]!==p?(x=l.jsx(Ke,{icon:c,title:m,description:f,buttonProps:p}),e[12]=m,e[13]=f,e[14]=p,e[15]=x):x=e[15],x}function mo(){const t=O.c(8),e=ie();let s;t[0]===Symbol.for("react.memo_cache_sentinel")?(s=l.jsx(Us,{className:"size-5"}),t[0]=s):s=t[0];let n;t[1]!==e?(n=e("mainPanelTabs.cdnTab.unconfiguredTitle"),t[1]=e,t[2]=n):n=t[2];let i;t[3]!==e?(i=e("mainPanelTabs.cdnTab.unconfiguredBody"),t[3]=e,t[4]=i):i=t[4];let r;return t[5]!==n||t[6]!==i?(r=l.jsx(Ke,{icon:s,title:n,description:i}),t[5]=n,t[6]=i,t[7]=r):r=t[7],r}function uo(t){const e=O.c(14),{onRetry:s}=t,n=ie();let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=l.jsx(hr,{className:"size-5"}),e[0]=i):i=e[0];let r;e[1]!==n?(r=n("mainPanelTabs.monitorV8.loadError.title"),e[1]=n,e[2]=r):r=e[2];let a;e[3]!==n?(a=n("mainPanelTabs.monitorV8.loadError.body"),e[3]=n,e[4]=a):a=e[4];let o;e[5]!==n?(o=n("mainPanelTabs.monitorV8.loadError.retry"),e[5]=n,e[6]=o):o=e[6];let c;e[7]!==s||e[8]!==o?(c={variant:"outline",children:o,onClick:s},e[7]=s,e[8]=o,e[9]=c):c=e[9];let d;return e[10]!==r||e[11]!==a||e[12]!==c?(d=l.jsx(Ke,{icon:i,title:r,description:a,buttonProps:c}),e[10]=r,e[11]=a,e[12]=c,e[13]=d):d=e[13],d}function T4(t){const e=O.c(32),{base:s,range:n,onSeeUpstreams:i}=t,r=ie(),a=un(s,"summary",n),o=un(s,"timeline",n),c=un(s,"routes",n),d=un(s,"releases",n);if(a.isError){let y;return e[0]!==a?(y=l.jsx(uo,{onRetry:()=>a.refetch()}),e[0]=a,e[1]=y):y=e[1],y}if(a.data?.available===!1){let y;return e[2]===Symbol.for("react.memo_cache_sentinel")?(y=l.jsx(mo,{}),e[2]=y):y=e[2],y}if(a.isLoading||!a.data){let y;return e[3]===Symbol.for("react.memo_cache_sentinel")?(y=l.jsxs("div",{className:"flex flex-col gap-4",children:[l.jsx("div",{className:"grid grid-cols-2 gap-3 lg:grid-cols-4",children:[0,1,2,3].map(P4)}),l.jsx(Ce,{className:"h-72 w-full rounded-xl"})]}),e[3]=y):y=e[3],y}if(a.data.reason||!a.data.data){const y=a.data.reason??"no_requests";let j;return e[4]!==i||e[5]!==y?(j=l.jsx($4,{reason:y,onSeeUpstreams:i}),e[4]=i,e[5]=y,e[6]=j):j=e[6],j}const m=o.data?.window;let u;e[7]!==a.data.data?(u=l.jsx(h4,{summary:a.data.data}),e[7]=a.data.data,e[8]=u):u=e[8];let f;e[9]!==n||e[10]!==d||e[11]!==o.data||e[12]!==m?(f=o.data?.data&&m?l.jsx(g4,{points:o.data.data,releases:d.data?.data??[],window:m,range:n}):l.jsx(Ce,{className:"h-96 w-full rounded-xl"}),e[9]=n,e[10]=d,e[11]=o.data,e[12]=m,e[13]=f):f=e[13];let p;e[14]!==r?(p=r("mainPanelTabs.monitorV8.routes.title"),e[14]=r,e[15]=p):p=e[15];let x;e[16]!==r?(x=r("mainPanelTabs.monitorV8.routes.subtitle"),e[16]=r,e[17]=x):x=e[17];let h;e[18]!==c.data||e[19]!==c.isLoading||e[20]!==r?(h=c.data?.data?l.jsx(S4,{routes:c.data.data}):c.isLoading?l.jsx(Ce,{className:"h-40 w-full"}):l.jsx("p",{className:"text-sm text-muted-foreground",children:r("mainPanelTabs.monitorV8.empty.noRequests.title")}),e[18]=c.data,e[19]=c.isLoading,e[20]=r,e[21]=h):h=e[21];let g;e[22]!==p||e[23]!==x||e[24]!==h?(g=l.jsx(ei,{title:p,subtitle:x,children:h}),e[22]=p,e[23]=x,e[24]=h,e[25]=g):g=e[25];let v;e[26]!==f||e[27]!==g?(v=l.jsxs("div",{className:"grid grid-cols-1 gap-4 xl:grid-cols-[minmax(0,3fr)_minmax(0,2fr)]",children:[f,g]}),e[26]=f,e[27]=g,e[28]=v):v=e[28];let b;return e[29]!==u||e[30]!==v?(b=l.jsxs("div",{className:"flex flex-col gap-4",children:[u,v]}),e[29]=u,e[30]=v,e[31]=b):b=e[31],b}function P4(t){return l.jsx(Ce,{className:"h-24 w-full rounded-xl"},t)}function C4(t){const e=O.c(53),{base:s,range:n}=t,i=ie(),r=un(s,"upstreams",n);if(r.isError){let k;return e[0]!==r?(k=l.jsx(uo,{onRetry:()=>r.refetch()}),e[0]=r,e[1]=k):k=e[1],k}if(r.data?.available===!1){let k;return e[2]===Symbol.for("react.memo_cache_sentinel")?(k=l.jsx(mo,{}),e[2]=k):k=e[2],k}if(r.isLoading){let k;return e[3]===Symbol.for("react.memo_cache_sentinel")?(k=l.jsx(Ce,{className:"h-64 w-full rounded-xl"}),e[3]=k):k=e[3],k}let a;e[4]!==r.data?.data?(a=r.data?.data??[],e[4]=r.data?.data,e[5]=a):a=e[5];const o=a;if(o.length===0){let k;e[6]===Symbol.for("react.memo_cache_sentinel")?(k=l.jsx(pr,{className:"size-5"}),e[6]=k):k=e[6];let _;e[7]!==i?(_=i("mainPanelTabs.monitorV8.empty.upstreams.title"),e[7]=i,e[8]=_):_=e[8];let $;e[9]!==i?($=i("mainPanelTabs.monitorV8.empty.upstreams.body"),e[9]=i,e[10]=$):$=e[10];let T;return e[11]!==_||e[12]!==$?(T=l.jsx(Ke,{icon:k,title:_,description:$}),e[11]=_,e[12]=$,e[13]=T):T=e[13],T}let c;e[14]!==i?(c=i("mainPanelTabs.monitorV8.upstreams.title"),e[14]=i,e[15]=c):c=e[15];let d;e[16]!==i?(d=i("mainPanelTabs.monitorV8.upstreams.subtitle"),e[16]=i,e[17]=d):d=e[17];let m;e[18]!==i?(m=i("mainPanelTabs.monitorV8.upstreams.call"),e[18]=i,e[19]=m):m=e[19];let u;e[20]!==m?(u={label:m},e[20]=m,e[21]=u):u=e[21];let f;e[22]!==i?(f=i("mainPanelTabs.monitorV8.upstreams.calls"),e[22]=i,e[23]=f):f=e[23];let p;e[24]!==f?(p={label:f,align:"right"},e[24]=f,e[25]=p):p=e[25];let x;e[26]!==i?(x=i("mainPanelTabs.monitorV8.upstreams.p95"),e[26]=i,e[27]=x):x=e[27];let h;e[28]!==x?(h={label:x,align:"right"},e[28]=x,e[29]=h):h=e[29];let g;e[30]!==i?(g=i("mainPanelTabs.monitorV8.upstreams.errors"),e[30]=i,e[31]=g):g=e[31];let v;e[32]!==g?(v={label:g,align:"right"},e[32]=g,e[33]=v):v=e[33];let b;e[34]!==i?(b=i("mainPanelTabs.monitorV8.upstreams.cached"),e[34]=i,e[35]=b):b=e[35];let y;e[36]!==b?(y={label:b,align:"right"},e[36]=b,e[37]=y):y=e[37];let j;e[38]!==v||e[39]!==y||e[40]!==u||e[41]!==p||e[42]!==h?(j=[u,p,h,v,y],e[38]=v,e[39]=y,e[40]=u,e[41]=p,e[42]=h,e[43]=j):j=e[43];let N;e[44]!==o?(N=o.map(E4),e[44]=o,e[45]=N):N=e[45];let w;e[46]!==j||e[47]!==N?(w=l.jsx(Pd,{head:j,rows:N}),e[46]=j,e[47]=N,e[48]=w):w=e[48];let S;return e[49]!==w||e[50]!==c||e[51]!==d?(S=l.jsx(ei,{title:c,subtitle:d,children:w}),e[49]=w,e[50]=c,e[51]=d,e[52]=S):S=e[52],S}function E4(t){return{key:`${t.provider}·${t.operation}`,cells:[l.jsxs("span",{title:`${t.provider} · ${t.operation}`,children:[l.jsx("span",{className:"text-muted-foreground",children:t.provider})," · ",l.jsx("span",{className:"font-medium text-foreground",children:t.operation})]},"c"),Rt(t.calls),Xs(t.p95Ms),l.jsx("span",{className:ye((t.errorRate??0)>=.01&&"text-destructive"),children:Xn(t.errorRate)},"e"),Xn(t.cachedRate)]}}function M4(t){const e=O.c(31),{base:s,range:n}=t,i=ie(),r=un(s,"errors",n),a=N1(6e4);if(r.isError){let x;return e[0]!==r?(x=l.jsx(uo,{onRetry:()=>r.refetch()}),e[0]=r,e[1]=x):x=e[1],x}if(r.data?.available===!1){let x;return e[2]===Symbol.for("react.memo_cache_sentinel")?(x=l.jsx(mo,{}),e[2]=x):x=e[2],x}if(r.isLoading){let x;return e[3]===Symbol.for("react.memo_cache_sentinel")?(x=l.jsx(Ce,{className:"h-64 w-full rounded-xl"}),e[3]=x):x=e[3],x}let o;e[4]!==r.data?.data?(o=r.data?.data??[],e[4]=r.data?.data,e[5]=o):o=e[5];const c=o;if(c.length===0){let x;e[6]===Symbol.for("react.memo_cache_sentinel")?(x=l.jsx(hr,{className:"size-5"}),e[6]=x):x=e[6];let h;e[7]!==i?(h=i("mainPanelTabs.monitorV8.empty.errors.title"),e[7]=i,e[8]=h):h=e[8];let g;e[9]!==i?(g=i("mainPanelTabs.monitorV8.empty.errors.body"),e[9]=i,e[10]=g):g=e[10];let v;return e[11]!==h||e[12]!==g?(v=l.jsx(Ke,{icon:x,title:h,description:g}),e[11]=h,e[12]=g,e[13]=v):v=e[13],v}let d;e[14]!==i?(d=i("mainPanelTabs.monitorV8.errors.title"),e[14]=i,e[15]=d):d=e[15];let m;e[16]!==i?(m=i("mainPanelTabs.monitorV8.errors.subtitle"),e[16]=i,e[17]=m):m=e[17];let u;if(e[18]!==a||e[19]!==c||e[20]!==i){let x;e[22]!==a||e[23]!==i?(x=h=>{const g=Dp(h.lastSeenMs,a);return l.jsxs("li",{className:"flex items-start gap-3 py-2.5",children:[l.jsx("span",{className:"mt-0.5 shrink-0 rounded-md bg-destructive/10 px-1.5 py-0.5 text-xs font-medium tabular-nums text-destructive",children:i("mainPanelTabs.monitorV8.errors.times",{count:Rt(h.count)})}),l.jsxs("div",{className:"min-w-0 flex-1",children:[l.jsx("p",{className:"break-words font-mono text-xs text-foreground",children:h.message}),l.jsxs("p",{className:"mt-0.5 flex flex-wrap gap-x-2 text-xs text-muted-foreground",children:[h.code&&l.jsx("span",{className:"font-mono",children:h.code}),h.source&&l.jsx("span",{children:h.source}),h.route&&l.jsx("span",{children:i("mainPanelTabs.monitorV8.errors.on",{route:h.route})}),l.jsx("span",{children:i("mainPanelTabs.monitorV8.errors.lastSeen",{when:i(`mainPanelTabs.monitorV8.errors.since.${g.unit}`,{count:g.count})})})]})]})]},`${h.message}\0${h.route}`)},e[22]=a,e[23]=i,e[24]=x):x=e[24],u=c.map(x),e[18]=a,e[19]=c,e[20]=i,e[21]=u}else u=e[21];let f;e[25]!==u?(f=l.jsx("ul",{className:"-my-2 divide-y divide-border/60",children:u}),e[25]=u,e[26]=f):f=e[26];let p;return e[27]!==d||e[28]!==m||e[29]!==f?(p=l.jsx(ei,{title:d,subtitle:m,children:f}),e[27]=d,e[28]=m,e[29]=f,e[30]=p):p=e[30],p}function I4(t){const e=O.c(60),{base:s,site:n,embedded:i}=t,r=i===void 0?!1:i,a=ie(),[o,c]=Z.useState("site"),[d,m]=Z.useState("24h");let u;e[0]!==s||e[1]!==d||e[2]!==o?(u=o==="site"?l.jsx(T4,{base:s,range:d,onSeeUpstreams:()=>c("upstreams")}):o==="upstreams"?l.jsx(C4,{base:s,range:d}):l.jsx(M4,{base:s,range:d}),e[0]=s,e[1]=d,e[2]=o,e[3]=u):u=e[3];const f=u;if(r){let $;e[4]!==a?($=a("mainPanelTabs.monitorV8.range.label"),e[4]=a,e[5]=$):$=e[5];let T;e[6]!==a?(T=Uo.map(z=>({value:z,label:a(`mainPanelTabs.monitorV8.range.${z}`)})),e[6]=a,e[7]=T):T=e[7];let P;e[8]!==d||e[9]!==$||e[10]!==T?(P=l.jsx(We.Actions,{children:l.jsx(ns,{label:$,period:!0,value:d,options:T,onChange:m})}),e[8]=d,e[9]=$,e[10]=T,e[11]=P):P=e[11];let I;e[12]!==a?(I=a("mainPanelTabs.monitorV8.title"),e[12]=a,e[13]=I):I=e[13];let C;e[14]===Symbol.for("react.memo_cache_sentinel")?(C=["site","upstreams","errors"],e[14]=C):C=e[14];let M;e[15]!==o||e[16]!==a?(M=C.map(z=>l.jsx(ct.Item,{pressed:o===z,onClick:()=>c(z),children:a(`mainPanelTabs.monitorV8.section.${z}`)},z)),e[15]=o,e[16]=a,e[17]=M):M=e[17];let A;e[18]!==I||e[19]!==M?(A=l.jsx(ct,{label:I,children:M}),e[18]=I,e[19]=M,e[20]=A):A=e[20];let F;e[21]!==f||e[22]!==A?(F=l.jsxs("div",{className:"mx-auto flex w-full max-w-[1200px] flex-col gap-4 px-4 pt-6 pb-10 md:px-10",children:[A,f]}),e[21]=f,e[22]=A,e[23]=F):F=e[23];let E;return e[24]!==F||e[25]!==P?(E=l.jsxs("div",{className:"flex h-full min-h-0 flex-col overflow-auto",children:[P,F]}),e[24]=F,e[25]=P,e[26]=E):E=e[26],E}let p;e[27]!==a?(p=a("mainPanelTabs.monitorV8.title"),e[27]=a,e[28]=p):p=e[28];let x;e[29]!==p?(x=l.jsx("h2",{className:"text-base font-semibold text-foreground",children:p}),e[29]=p,e[30]=x):x=e[30];let h;e[31]!==n?(h=l.jsx("p",{className:"font-mono text-xs text-muted-foreground",children:n}),e[31]=n,e[32]=h):h=e[32];let g;e[33]!==x||e[34]!==h?(g=l.jsxs("div",{children:[x,h]}),e[33]=x,e[34]=h,e[35]=g):g=e[35];let v;e[36]!==a?(v=a("mainPanelTabs.monitorV8.title"),e[36]=a,e[37]=v):v=e[37];let b;e[38]===Symbol.for("react.memo_cache_sentinel")?(b=["site","upstreams","errors"],e[38]=b):b=e[38];let y;e[39]!==a?(y=b.map($=>({key:$,label:a(`mainPanelTabs.monitorV8.section.${$}`)})),e[39]=a,e[40]=y):y=e[40];let j;e[41]!==o||e[42]!==v||e[43]!==y?(j=l.jsx(jc,{label:v,value:o,onChange:c,options:y}),e[41]=o,e[42]=v,e[43]=y,e[44]=j):j=e[44];let N;e[45]!==a?(N=a("mainPanelTabs.monitorV8.range.label"),e[45]=a,e[46]=N):N=e[46];let w;e[47]!==a?(w=Uo.map($=>({key:$,label:a(`mainPanelTabs.monitorV8.range.${$}`)})),e[47]=a,e[48]=w):w=e[48];let S;e[49]!==d||e[50]!==N||e[51]!==w?(S=l.jsx(jc,{label:N,value:d,onChange:m,options:w}),e[49]=d,e[50]=N,e[51]=w,e[52]=S):S=e[52];let k;e[53]!==j||e[54]!==S?(k=l.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[j,S]}),e[53]=j,e[54]=S,e[55]=k):k=e[55];let _;return e[56]!==f||e[57]!==k||e[58]!==g?(_=l.jsxs("div",{className:"flex h-full flex-col gap-4 overflow-auto p-4",children:[g,k,f]}),e[56]=f,e[57]=k,e[58]=g,e[59]=_):_=e[59],_}const A4=["today","yesterday","7d","30d","90d"],L4={today:1,yesterday:1,"7d":7,"30d":30,"90d":90},D4="var(--chart-1)";function O4(t,e){switch(t){case"today":return e("mainPanelTabs.cdnTab.today");case"yesterday":return e("mainPanelTabs.cdnTab.yesterday");case"7d":return e("mainPanelTabs.cdnTab.last7d");case"30d":return e("mainPanelTabs.cdnTab.last30d");case"90d":return e("mainPanelTabs.cdnTab.last90d");default:return t}}const Ur=t=>new Date(t).toISOString().slice(0,10);function Cd(t){const e=L4[t];if(e===1)return null;const s=Date.parse(`${Ur(Date.now())}T00:00:00Z`),n=864e5;return{since:Ur(s-(2*e-1)*n),until:Ur(s-e*n)}}function Gi(t,e,s,n=""){return{queryKey:Qe.cdnData(t,`cdn:${e}${n}`,s),queryFn:async()=>{const i=await q1(`${t}/cdn/data?view=${e}&range=${s}${n}`);if(i.available===!1)throw new Error(i.error);return i.data??null},retry:!1,staleTime:3e4}}function Vs(t,e,s,n,i){const r=O.c(8),a=n===void 0?"":n,o=i===void 0?!0:i;let c;r[0]!==t||r[1]!==a||r[2]!==s||r[3]!==e?(c=Gi(t,e,s,a),r[0]=t,r[1]=a,r[2]=s,r[3]=e,r[4]=c):c=r[4];let d;return r[5]!==o||r[6]!==c?(d={...c,enabled:o},r[5]=o,r[6]=c,r[7]=d):d=r[7],ts(d)}function Ed(t){const e=O.c(9),{value:s,onChange:n}=t,i=ie();let r;e[0]!==i?(r=i("monitor.audience.range"),e[0]=i,e[1]=r):r=e[1];let a;e[2]!==i?(a=A4.map(c=>({value:c,label:O4(c,i)})),e[2]=i,e[3]=a):a=e[3];let o;return e[4]!==n||e[5]!==r||e[6]!==a||e[7]!==s?(o=l.jsx(We.Actions,{children:l.jsx(ns,{label:r,period:!0,value:s,options:a,onChange:n})}),e[4]=n,e[5]=r,e[6]=a,e[7]=s,e[8]=o):o=e[8],o}function Md(t){return t.length>10?t.slice(11,16):t.slice(5)}const wc=t=>t&&t.pageviews>0?{requests:t.total_requests/t.pageviews,bytesPer10k:t.total_bandwidth_bytes/(t.pageviews/1e4)}:null;function R4(t){const e=O.c(4),{summary:s,previous:n}=t,i=ie();let r;if(e[0]!==n||e[1]!==s||e[2]!==i){const a=wc(s),o=wc(n),c=[{title:i("mainPanelTabs.cdnTab.requests"),value:wt(s.total_requests),current:s.total_requests,prior:n?.total_requests,better:"none"},{title:i("mainPanelTabs.cdnTab.pageviews"),value:wt(s.pageviews),current:s.pageviews,prior:n?.pageviews,better:"up"},{title:i("mainPanelTabs.cdnTab.bandwidth"),value:Qs(s.total_bandwidth_bytes),current:s.total_bandwidth_bytes,prior:n?.total_bandwidth_bytes,better:"none"},{title:i("mainPanelTabs.cdnTab.cacheHit"),value:Yi(s.cache_hit_ratio),current:s.cache_hit_ratio,prior:n?.cache_hit_ratio,better:"up"},{title:i("mainPanelTabs.cdnTab.requestsPerPageview"),value:a?mr.format(a.requests):"—",current:a?.requests,prior:o?.requests,better:"down"},{title:i("mainPanelTabs.cdnTab.bandwidthPer10k"),value:a?Qs(a.bytesPer10k):"—",current:a?.bytesPer10k,prior:o?.bytesPer10k,better:"down"},{title:i("mainPanelTabs.cdnTab.avgLatency"),value:`${Math.round(s.avg_latency_ms)} ms`,current:s.avg_latency_ms,prior:n?.avg_latency_ms,better:"down"},{title:i("mainPanelTabs.cdnTab.errors5xx"),value:wt(s.status_5xx_count),caption:l.jsx("span",{className:"text-meta",children:i("monitor.performance.errorShare",{share:xa(s.status_5xx_count,s.total_requests)})})}];r=l.jsx("div",{className:"grid grid-cols-2 gap-4 lg:grid-cols-4",children:c.map(F4)}),e[0]=n,e[1]=s,e[2]=i,e[3]=r}else r=e[3];return r}function F4(t){return l.jsx(Me,{title:t.title,value:t.value,caption:t.caption??l.jsx(St,{change:t.current!==void 0&&t.prior!==void 0?ot(t.current,t.prior):null,better:t.better??"none",reference:""})},t.title)}const fo=["requests","pageviews","bandwidth_bytes"],z4=["all",...fo],On={requests:D4,pageviews:"var(--chart-2)",bandwidth_bytes:"var(--chart-4)"};function Gr(t,e){switch(t){case"all":return e("monitor.performance.allUsage");case"requests":return e("mainPanelTabs.cdnTab.requests");case"pageviews":return e("mainPanelTabs.cdnTab.pageviews");case"bandwidth_bytes":return e("mainPanelTabs.cdnTab.bandwidth");default:return t}}const V4=new Intl.NumberFormat(void 0,{notation:"compact"}),Nc=(t,e)=>t==="bandwidth_bytes"?Qs(e):V4.format(e),q4=t=>fo.some(e=>e===t);function K4(t){const e=O.c(61),{points:s}=t,n=ie(),[i,r]=Z.useState("all");let a,o,c,d,m,u,f,p,x,h,g,v,b,y;if(e[0]!==s||e[1]!==n||e[2]!==i){const S=i==="all"?fo:[i];let k;e[17]!==i?(k=M=>i==="all"&&M==="bandwidth_bytes"?"bytes":"main",e[17]=i,e[18]=k):k=e[18];const _=k,$=(M,A)=>l.jsx(At,{yAxisId:M,orientation:A,axisLine:!1,tickLine:!1,tick:mt,width:56,tickCount:4,allowDecimals:!1,tickFormatter:F=>Nc(M==="bytes"?"bandwidth_bytes":S[0]??"requests",F)});c=Me,e[19]!==n?(m=n("mainPanelTabs.cdnTab.usageOverTime"),e[19]=n,e[20]=m):m=e[20];let T;e[21]!==n?(T=n("mainPanelTabs.cdnTab.usageOverTime"),e[21]=n,e[22]=T):T=e[22];let P;e[23]!==n||e[24]!==i?(P=z4.map(M=>l.jsxs(ct.Item,{pressed:M===i,onClick:()=>r(M),children:[M!=="all"&&l.jsx("span",{className:"size-2 rounded-full",style:{background:On[M]}}),Gr(M,n)]},M)),e[23]=n,e[24]=i,e[25]=P):P=e[25],e[26]!==T||e[27]!==P?(u=l.jsx(ct,{label:T,children:P}),e[26]=T,e[27]=P,e[28]=u):u=e[28],o=It;let I;e[29]!==n?(I=M=>[M,{label:Gr(M,n),color:On[M]}],e[29]=n,e[30]=I):I=e[30],b=Object.fromEntries(S.map(I)),y="h-[220px] w-full",a=Gs,d=s,e[31]===Symbol.for("react.memo_cache_sentinel")?(f={left:0,right:0,top:4},p=l.jsx(Ft,{strokeDasharray:"4 4",stroke:"var(--border)",strokeOpacity:.5,vertical:!1}),x=l.jsx(zt,{dataKey:"bucket",axisLine:!1,tickLine:!1,tick:mt,tickMargin:8,minTickGap:32,tickFormatter:Md}),e[31]=f,e[32]=p,e[33]=x):(f=e[31],p=e[32],x=e[33]),e[34]!==i||e[35]!==$?(h=i==="all"?l.jsxs(l.Fragment,{children:[$("main","left"),$("bytes","right")]}):$("main","right"),e[34]=i,e[35]=$,e[36]=h):h=e[36],e[37]!==n?(g=l.jsx(es,{content:l.jsx(us,{formatter:(M,A)=>q4(A)&&l.jsxs("span",{className:"flex w-full items-center justify-between gap-3",children:[l.jsx("span",{className:"text-muted-foreground",children:Gr(A,n)}),l.jsx("span",{className:"tnum text-foreground",children:Nc(A,Number(M))})]})})}),e[37]=n,e[38]=g):g=e[38];let C;e[39]!==_||e[40]!==i?(C=M=>M==="requests"||i!=="all"?l.jsx(Gt,{yAxisId:_(M),dataKey:M,type:"monotone",fill:On[M],fillOpacity:.15,stroke:On[M],strokeWidth:1.5,isAnimationActive:!1},M):l.jsx(rs,{yAxisId:_(M),dataKey:M,type:"monotone",stroke:On[M],strokeWidth:1.5,dot:!1,isAnimationActive:!1},M),e[39]=_,e[40]=i,e[41]=C):C=e[41],v=S.map(C),e[0]=s,e[1]=n,e[2]=i,e[3]=a,e[4]=o,e[5]=c,e[6]=d,e[7]=m,e[8]=u,e[9]=f,e[10]=p,e[11]=x,e[12]=h,e[13]=g,e[14]=v,e[15]=b,e[16]=y}else a=e[3],o=e[4],c=e[5],d=e[6],m=e[7],u=e[8],f=e[9],p=e[10],x=e[11],h=e[12],g=e[13],v=e[14],b=e[15],y=e[16];let j;e[42]!==a||e[43]!==d||e[44]!==f||e[45]!==p||e[46]!==x||e[47]!==h||e[48]!==g||e[49]!==v?(j=l.jsxs(a,{data:d,margin:f,children:[p,x,h,g,v]}),e[42]=a,e[43]=d,e[44]=f,e[45]=p,e[46]=x,e[47]=h,e[48]=g,e[49]=v,e[50]=j):j=e[50];let N;e[51]!==o||e[52]!==j||e[53]!==b||e[54]!==y?(N=l.jsx(o,{config:b,className:y,children:j}),e[51]=o,e[52]=j,e[53]=b,e[54]=y,e[55]=N):N=e[55];let w;return e[56]!==c||e[57]!==m||e[58]!==u||e[59]!==N?(w=l.jsx(c,{title:m,aside:u,children:N}),e[56]=c,e[57]=m,e[58]=u,e[59]=N,e[60]=w):w=e[60],w}function B4(t){const e=O.c(99),{base:s,after:n}=t,i=ie(),[r,a]=Z.useState("7d");let o;e[0]!==r?(o=Cd(r),e[0]=r,e[1]=o):o=e[1];const c=o,d=Vs(s,"summary",r),m=Vs(s,"summary","custom",c?`&since=${c.since}&until=${c.until}`:"",c!==null),u=Vs(s,"timeline",r),[f,p]=Z.useState("requests"),[x,h]=Z.useState(!0),g=Vs(s,"top-paths",r,x?"&groupByPath=1":""),v=Vs(s,"status-codes",r),b=Vs(s,"cache-status",r),y=Vs(s,"top-countries",r);let j;e[2]!==r?(j=l.jsx(Ed,{value:r,onChange:a}),e[2]=r,e[3]=j):j=e[3];const N=j;if(d.isError){let te;e[4]===Symbol.for("react.memo_cache_sentinel")?(te=l.jsx(Us,{className:"size-5"}),e[4]=te):te=e[4];let D;e[5]!==i?(D=i("mainPanelTabs.cdnTab.errorTitle"),e[5]=i,e[6]=D):D=e[6];const W=d.error;let G;e[7]!==D||e[8]!==W.message?(G=l.jsx(Ke,{icon:te,title:D,description:W.message}),e[7]=D,e[8]=W.message,e[9]=G):G=e[9];let Q;return e[10]!==N||e[11]!==G?(Q=l.jsxs(l.Fragment,{children:[N,G]}),e[10]=N,e[11]=G,e[12]=Q):Q=e[12],Q}if(d.data===null||d.data!==void 0&&d.data.total_requests===0&&!u.data?.some(U4)){let te;e[13]!==i?(te=i("monitor.performance.offCdn"),e[13]=i,e[14]=te):te=e[14];let D;e[15]!==te?(D=l.jsx("p",{className:"text-meta",children:te}),e[15]=te,e[16]=D):D=e[16];let W;e[17]!==n||e[18]!==r?(W=n?.(r),e[17]=n,e[18]=r,e[19]=W):W=e[19];let G;return e[20]!==N||e[21]!==D||e[22]!==W?(G=l.jsxs(l.Fragment,{children:[N,D,W]}),e[20]=N,e[21]=D,e[22]=W,e[23]=G):G=e[23],G}let S;e[24]!==f?(S=(te,D,W)=>{const G=W===void 0?{}:W;return te.isLoading?l.jsx(Ce,{className:"h-64"}):l.jsx(ht,{title:D,aside:G.aside,rows:(te.data??[]).map(Q=>({k:Q.key,n:f==="requests"?Q.total_requests:Q.total_bandwidth_bytes})).sort(W4),label:G.label,dot:G.dot,format:f==="requests"?wt:Qs,limit:10,expandable:!0})},e[24]=f,e[25]=S):S=e[25];const k=S;let _;e[26]!==c||e[27]!==m||e[28]!==d.data||e[29]!==d.isLoading?(_=d.isLoading||!d.data?l.jsx("div",{className:"grid grid-cols-2 gap-4 lg:grid-cols-4",children:[0,1,2,3].map(H4)}):l.jsx("div",{className:"flex flex-col gap-2",children:l.jsx(R4,{summary:d.data,previous:c?m.data??null:null})}),e[26]=c,e[27]=m,e[28]=d.data,e[29]=d.isLoading,e[30]=_):_=e[30];let $;e[31]!==u.data||e[32]!==u.isLoading?($=u.isLoading?l.jsx(Ce,{className:"h-64"}):(u.data?.length??0)>1&&l.jsx(K4,{points:u.data??[]}),e[31]=u.data,e[32]=u.isLoading,e[33]=$):$=e[33];let T;e[34]!==i?(T=i("mainPanelTabs.cdnTab.measureBy"),e[34]=i,e[35]=T):T=e[35];let P;e[36]!==T?(P=l.jsx("span",{className:"text-meta",children:T}),e[36]=T,e[37]=P):P=e[37];let I;e[38]!==i?(I=i("mainPanelTabs.cdnTab.measureBy"),e[38]=i,e[39]=I):I=e[39];const C=f==="requests";let M;e[40]===Symbol.for("react.memo_cache_sentinel")?(M=()=>p("requests"),e[40]=M):M=e[40];let A;e[41]!==i?(A=i("mainPanelTabs.cdnTab.requests"),e[41]=i,e[42]=A):A=e[42];let F;e[43]!==A||e[44]!==C?(F=l.jsx(ct.Item,{pressed:C,onClick:M,children:A}),e[43]=A,e[44]=C,e[45]=F):F=e[45];const E=f==="bandwidth";let z;e[46]===Symbol.for("react.memo_cache_sentinel")?(z=()=>p("bandwidth"),e[46]=z):z=e[46];let R;e[47]!==i?(R=i("mainPanelTabs.cdnTab.bandwidth"),e[47]=i,e[48]=R):R=e[48];let V;e[49]!==E||e[50]!==R?(V=l.jsx(ct.Item,{pressed:E,onClick:z,children:R}),e[49]=E,e[50]=R,e[51]=V):V=e[51];let K;e[52]!==F||e[53]!==V||e[54]!==I?(K=l.jsxs(ct,{label:I,children:[F,V]}),e[52]=F,e[53]=V,e[54]=I,e[55]=K):K=e[55];let U;e[56]!==K||e[57]!==P?(U=l.jsxs("div",{className:"flex items-center gap-2",children:[P,K]}),e[56]=K,e[57]=P,e[58]=U):U=e[58];let q;e[59]!==b||e[60]!==k||e[61]!==i?(q=k(b,i("mainPanelTabs.cdnTab.cacheStatus"),{dot:pp}),e[59]=b,e[60]=k,e[61]=i,e[62]=q):q=e[62];let L;e[63]!==k||e[64]!==v||e[65]!==i?(L=k(v,i("mainPanelTabs.cdnTab.statusCodes"),{label:gp,dot:xp}),e[63]=k,e[64]=v,e[65]=i,e[66]=L):L=e[66];let B;if(e[67]!==x||e[68]!==k||e[69]!==g||e[70]!==i){const te=i("mainPanelTabs.cdnTab.topPaths");let D;e[72]===Symbol.for("react.memo_cache_sentinel")?(D=re=>h(re===!0),e[72]=D):D=e[72];let W;e[73]!==x?(W=l.jsx(h1,{checked:x,onCheckedChange:D}),e[73]=x,e[74]=W):W=e[74];let G;e[75]!==i?(G=i("mainPanelTabs.cdnTab.ignoreQueryString"),e[75]=i,e[76]=G):G=e[76];let Q;e[77]!==W||e[78]!==G?(Q=l.jsxs("label",{className:"text-meta flex cursor-pointer items-center gap-1.5",children:[W,G]}),e[77]=W,e[78]=G,e[79]=Q):Q=e[79],B=k(g,te,{aside:Q}),e[67]=x,e[68]=k,e[69]=g,e[70]=i,e[71]=B}else B=e[71];let Y;e[80]!==y||e[81]!==k||e[82]!==i?(Y=k(y,i("mainPanelTabs.cdnTab.topCountries"),{label:eo}),e[80]=y,e[81]=k,e[82]=i,e[83]=Y):Y=e[83];let J;e[84]!==q||e[85]!==L||e[86]!==B||e[87]!==Y?(J=l.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[q,L,B,Y]}),e[84]=q,e[85]=L,e[86]=B,e[87]=Y,e[88]=J):J=e[88];let X;e[89]!==n||e[90]!==r?(X=n?.(r),e[89]=n,e[90]=r,e[91]=X):X=e[91];let ee;return e[92]!==N||e[93]!==U||e[94]!==J||e[95]!==X||e[96]!==_||e[97]!==$?(ee=l.jsxs(l.Fragment,{children:[N,_,$,U,J,X]}),e[92]=N,e[93]=U,e[94]=J,e[95]=X,e[96]=_,e[97]=$,e[98]=ee):ee=e[98],ee}function H4(t){return l.jsx(Ce,{className:"h-28"},t)}function W4(t,e){return e.n-t.n}function U4(t){return t.requests>0}const G4={today:"24h",yesterday:"24h","7d":"7d","30d":"30d","90d":"30d"};function Y4(t){const e=O.c(34),{projectId:s,project:n}=t,i=ie(),{org:r}=He(),a=Va(s),o=Ua(s);if(p4(a?.metadata)){let p;e[0]===Symbol.for("react.memo_cache_sentinel")?(p=l.jsx(Us,{className:"size-5"}),e[0]=p):p=e[0];let x;e[1]!==i?(x=i("monitor.performance.external"),e[1]=i,e[2]=x):x=e[2];let h;return e[3]!==x?(h=l.jsx(Kn,{children:l.jsx(Ke,{icon:p,title:x})}),e[3]=x,e[4]=h):h=e[4],h}if(o){let p;e[5]!==a?(p=bn(a),e[5]=a,e[6]=p):p=e[6];const x=p;if(!x){let v;e[7]===Symbol.for("react.memo_cache_sentinel")?(v=l.jsx(Us,{className:"size-5"}),e[7]=v):v=e[7];let b;e[8]!==i?(b=i("mainPanelTabs.cdnTab.noSiteTitle"),e[8]=i,e[9]=b):b=e[9];let y;e[10]!==i?(y=i("mainPanelTabs.monitorV8.noSiteBody"),e[10]=i,e[11]=y):y=e[11];let j;return e[12]!==b||e[13]!==y?(j=l.jsx(Kn,{children:l.jsx(Ke,{icon:v,title:b,description:y})}),e[12]=b,e[13]=y,e[14]=j):j=e[14],j}const h=`/api/${r.slug}/monitor/${encodeURIComponent(x)}`;let g;return e[15]!==h||e[16]!==x?(g=l.jsx(I4,{base:h,site:x,embedded:!0},x),e[15]=h,e[16]=x,e[17]=g):g=e[17],g}let c;e[18]!==a?(c=l1(a),e[18]=a,e[19]=c):c=e[19];const d=c;if(!d){let p;e[20]===Symbol.for("react.memo_cache_sentinel")?(p=l.jsx(Us,{className:"size-5"}),e[20]=p):p=e[20];let x;e[21]!==i?(x=i("mainPanelTabs.cdnTab.noSiteTitle"),e[21]=i,e[22]=x):x=e[22];let h;e[23]!==i?(h=i("mainPanelTabs.cdnTab.noSiteBody"),e[23]=i,e[24]=h):h=e[24];let g;return e[25]!==x||e[26]!==h?(g=l.jsx(Kn,{children:l.jsx(Ke,{icon:p,title:x,description:h})}),e[25]=x,e[26]=h,e[27]=g):g=e[27],g}const m=`/api/${r.slug}/monitor/${encodeURIComponent(d)}`;let u;e[28]!==n?(u=p=>n&&l.jsxs(l.Fragment,{children:[l.jsx(dd,{}),l.jsx(d4,{project:n,section:"vitals",range:G4[p]})]}),e[28]=n,e[29]=u):u=e[29];let f;return e[30]!==d||e[31]!==m||e[32]!==u?(f=l.jsx(Kn,{children:l.jsx(B4,{base:m,after:u},d)}),e[30]=d,e[31]=m,e[32]=u,e[33]=f):f=e[33],f}function Kn(t){const e=O.c(2),{children:s}=t;let n;return e[0]!==s?(n=l.jsx("div",{className:"flex h-full min-h-0 flex-col overflow-auto",children:l.jsx("div",{className:"mx-auto flex w-full max-w-[1200px] flex-col gap-4 px-4 pt-6 pb-10 md:px-10",children:s})}),e[0]=s,e[1]=n):n=e[1],n}const kc=["var(--chart-1)","var(--chart-2)","var(--chart-3)","var(--chart-4)","var(--chart-5)"],Yr=t=>`${Math.round(t)} ms`,mr=new Intl.NumberFormat(void 0,{minimumFractionDigits:1,maximumFractionDigits:1}),Yi=t=>`${mr.format(t)}%`;function Q4(t){const e=O.c(32),{sites:s}=t,n=ie();let i;if(e[0]!==s){const N=new Map;for(const{project:w,points:S}of s)for(const k of S){const _=N.get(k.bucket)??{bucket:k.bucket};_[w.id]=(Number(_[w.id])||0)+k.requests,N.set(k.bucket,_)}i=[...N.values()].sort(J4),e[0]=s,e[1]=i}else i=e[1];const r=i,a=Z4;let o;e[2]!==n?(o=n("monitor.performance.overTime"),e[2]=n,e[3]=o):o=e[3];let c;if(e[4]!==s){let N;e[6]===Symbol.for("react.memo_cache_sentinel")?(N=(w,S)=>{const{project:k}=w;return l.jsxs("li",{className:"flex items-center gap-2 text-sm",children:[l.jsx("span",{className:"size-2 rounded-full",style:{backgroundColor:a(S)}}),k.title]},k.id)},e[6]=N):N=e[6],c=s.map(N),e[4]=s,e[5]=c}else c=e[5];let d;e[7]!==c?(d=l.jsx("ul",{className:"flex flex-wrap gap-x-5 gap-y-1",children:c}),e[7]=c,e[8]=d):d=e[8];let m;if(e[9]!==s){let N;e[11]===Symbol.for("react.memo_cache_sentinel")?(N=(w,S)=>{const{project:k}=w;return[k.id,{label:k.title,color:a(S)}]},e[11]=N):N=e[11],m=Object.fromEntries(s.map(N)),e[9]=s,e[10]=m}else m=e[10];let u,f,p,x;e[12]===Symbol.for("react.memo_cache_sentinel")?(u={left:0,right:0,top:4},f=l.jsx(Ft,{strokeDasharray:"4 4",stroke:"var(--border)",strokeOpacity:.5,vertical:!1}),p=l.jsx(zt,{dataKey:"bucket",axisLine:!1,tickLine:!1,tick:mt,tickMargin:8,minTickGap:32,tickFormatter:Md}),x=l.jsx(At,{orientation:"right",axisLine:!1,tickLine:!1,tick:mt,width:44,tickCount:4,allowDecimals:!1,tickFormatter:X4}),e[12]=u,e[13]=f,e[14]=p,e[15]=x):(u=e[12],f=e[13],p=e[14],x=e[15]);let h;e[16]===Symbol.for("react.memo_cache_sentinel")?(h=l.jsx(es,{content:l.jsx(us,{})}),e[16]=h):h=e[16];let g;if(e[17]!==s){let N;e[19]===Symbol.for("react.memo_cache_sentinel")?(N=(w,S)=>{const{project:k}=w;return l.jsx(Gt,{dataKey:k.id,stackId:"sites",type:"monotone",fill:a(S),fillOpacity:.2,stroke:a(S),strokeWidth:1.5,isAnimationActive:!1},k.id)},e[19]=N):N=e[19],g=s.map(N),e[17]=s,e[18]=g}else g=e[18];let v;e[20]!==r||e[21]!==g?(v=l.jsxs(ri,{data:r,margin:u,children:[f,p,x,h,g]}),e[20]=r,e[21]=g,e[22]=v):v=e[22];let b;e[23]!==v||e[24]!==m?(b=l.jsx(It,{config:m,className:"h-[170px] w-full",children:v}),e[23]=v,e[24]=m,e[25]=b):b=e[25];let y;e[26]!==b||e[27]!==d?(y=l.jsxs("div",{className:"flex flex-col gap-3",children:[d,b]}),e[26]=b,e[27]=d,e[28]=y):y=e[28];let j;return e[29]!==y||e[30]!==o?(j=l.jsx(Me,{title:o,children:y}),e[29]=y,e[30]=o,e[31]=j):j=e[31],j}function X4(t){return new Intl.NumberFormat(void 0,{notation:"compact"}).format(t)}function Z4(t){return kc[t%kc.length]}function J4(t,e){return String(t.bucket).localeCompare(String(e.bucket))}function eg(t){const e=O.c(61),{projects:s,onProject:n}=t,i=ie(),{org:r}=He(),[a,o]=Z.useState("7d");let c;e[0]!==a?(c=Cd(a),e[0]=a,e[1]=c):c=e[1];const d=c,m=gr();let u;e[2]!==m?(u=de=>w1(m.find(se=>se.id===de.id)),e[2]=m,e[3]=u):u=e[3];const f=s.map(u),p=s.filter((de,se)=>!f[se]);let x;e[4]!==r?(x=de=>`/api/${r.slug}/monitor/${encodeURIComponent(de.analyticsSite)}`,e[4]=r,e[5]=x):x=e[5];const h=x;let g;e[6]!==h||e[7]!==a?(g=de=>Gi(h(de),"summary",a),e[6]=h,e[7]=a,e[8]=g):g=e[8];const v=Wn({queries:p.map(g)});let b;e[9]!==h||e[10]!==d?(b=de=>({...Gi(h(de),"summary","custom",d?`&since=${d.since}&until=${d.until}`:""),enabled:d!==null}),e[9]=h,e[10]=d,e[11]=b):b=e[11];const y=Wn({queries:p.map(b)});let j;e[12]!==h||e[13]!==a?(j=de=>Gi(h(de),"timeline",a),e[12]=h,e[13]=a,e[14]=j):j=e[14];const N=Wn({queries:p.map(j)});let w;e[15]!==a?(w=l.jsx(Ed,{value:a,onChange:o}),e[15]=a,e[16]=w):w=e[16];const S=w,k=v.some(ug),_=s.map((de,se)=>{const H=p.indexOf(de);return{project:de,v8:f[se],loading:!!v[H]?.isLoading,error:v[H]?.error??null,summary:v[H]?.data??null,previous:y[H]?.data??null}}).sort(mg),$=_.filter(dg);if(!k&&$.length===0){const de=_.find(cg)?.error,se=de?l.jsx(Ke,{icon:l.jsx(Us,{className:"size-5"}),tone:"error",title:i("mainPanelTabs.cdnTab.errorTitle"),description:de.message}):l.jsx(Ke,{icon:l.jsx(Us,{className:"size-5"}),title:i("monitor.performance.org.emptyTitle"),description:i("monitor.performance.org.emptyDesc")});let H;return e[17]!==S||e[18]!==se?(H=l.jsxs(l.Fragment,{children:[S,se]}),e[17]=S,e[18]=se,e[19]=H):H=e[19],H}const T=(de,se)=>$.reduce((H,oe)=>H+(oe[se]?de(oe[se]):0),0),P=d!==null&&$.every(og),I=T(ag,"summary"),C=T(rg,"summary"),M=de=>$.map(se=>({title:se.project.title,value:se.summary?de(se.summary):0,weight:se.summary?.total_requests??0})),A=M(ig),F=M(ng);let E;e[20]!==N?(E=(de,se)=>{const H=N[se]?.data;return H&&H.some(lg)?[{project:de,points:H}]:[]},e[20]=N,e[21]=E):E=e[21];const z=p.flatMap(E),R=k&&$.length===0?l.jsx("div",{className:"grid grid-cols-2 gap-4 lg:grid-cols-4",children:[0,1,2,3].map(sg)}):l.jsx("div",{className:"flex flex-col gap-2",children:l.jsxs("div",{className:"grid grid-cols-2 gap-4 lg:grid-cols-4",children:[l.jsx(Me,{title:i("mainPanelTabs.cdnTab.requests"),value:wt(I),caption:P&&l.jsx(St,{change:ot(I,T(tg,"previous")),better:"none",reference:""})}),l.jsx(Me,{title:i("mainPanelTabs.cdnTab.cacheHit"),value:Yi(rr(A)??0),caption:l.jsx(ar,{values:A,format:Yi,lowerIsBetter:!1})}),l.jsx(Me,{title:i("mainPanelTabs.cdnTab.avgLatency"),value:Yr(rr(F)??0),caption:l.jsx(ar,{values:F,format:Yr,lowerIsBetter:!0})}),l.jsx(Me,{title:i("mainPanelTabs.cdnTab.errors5xx"),value:wt(C),caption:l.jsx("span",{className:"text-meta",children:i("monitor.performance.errorShare",{share:xa(C,I)})})})]})}),V=z.length>0&&l.jsx(Q4,{sites:z}),K="surface shrink-0 overflow-hidden",U="w-full text-sm";let q;e[22]!==i?(q=i("monitor.projectFilter.label"),e[22]=i,e[23]=q):q=e[23];let L;e[24]!==q?(L=l.jsx("th",{className:"px-4 py-2 font-normal",children:q}),e[24]=q,e[25]=L):L=e[25];let B;e[26]!==i?(B=i("mainPanelTabs.cdnTab.requests"),e[26]=i,e[27]=B):B=e[27];let Y;e[28]!==B?(Y=l.jsx("th",{className:"px-4 py-2 text-right font-normal",children:B}),e[28]=B,e[29]=Y):Y=e[29];let J;e[30]!==i?(J=i("mainPanelTabs.cdnTab.cacheHit"),e[30]=i,e[31]=J):J=e[31];let X;e[32]!==J?(X=l.jsx("th",{className:"px-4 py-2 text-right font-normal",children:J}),e[32]=J,e[33]=X):X=e[33];let ee;e[34]!==i?(ee=i("mainPanelTabs.cdnTab.avgLatency"),e[34]=i,e[35]=ee):ee=e[35];let te;e[36]!==ee?(te=l.jsx("th",{className:"px-4 py-2 text-right font-normal",children:ee}),e[36]=ee,e[37]=te):te=e[37];let D;e[38]!==i?(D=i("mainPanelTabs.cdnTab.errors5xx"),e[38]=i,e[39]=D):D=e[39];let W;e[40]!==D?(W=l.jsx("th",{className:"px-4 py-2 text-right font-normal",children:D}),e[40]=D,e[41]=W):W=e[41];let G;e[42]!==L||e[43]!==Y||e[44]!==X||e[45]!==te||e[46]!==W?(G=l.jsx("thead",{className:"text-meta border-b border-border text-left",children:l.jsxs("tr",{children:[L,Y,X,te,W]})}),e[42]=L,e[43]=Y,e[44]=X,e[45]=te,e[46]=W,e[47]=G):G=e[47];let Q;e[48]!==n||e[49]!==i?(Q=de=>{const se=de.summary,H=se&&se.total_requests>0;return l.jsxs("tr",{tabIndex:0,onClick:()=>n(de.project.id),onKeyDown:oe=>{(oe.key==="Enter"||oe.key===" ")&&(oe.preventDefault(),n(de.project.id))},className:"cursor-pointer border-b border-border last:border-0 hover:bg-muted/50",children:[l.jsx("td",{className:"px-4 py-2.5 text-foreground",children:de.project.title}),de.loading?l.jsx("td",{colSpan:4,className:"px-4 py-2.5",children:l.jsx(Ce,{className:"ml-auto h-5 w-48"})}):H?l.jsxs(l.Fragment,{children:[l.jsx("td",{className:"tnum px-4 py-2.5 text-right",children:l.jsxs("span",{className:"inline-flex items-center gap-2",children:[wt(se.total_requests),de.previous&&l.jsx(St,{change:ot(se.total_requests,de.previous.total_requests),better:"none",reference:""})]})}),l.jsx("td",{className:"tnum px-4 py-2.5 text-right",children:Yi(se.cache_hit_ratio)}),l.jsx("td",{className:"tnum px-4 py-2.5 text-right",children:Yr(se.avg_latency_ms)}),l.jsx("td",{className:"tnum px-4 py-2.5 text-right",children:xa(se.status_5xx_count,se.total_requests)})]}):l.jsx("td",{colSpan:4,className:ye("text-meta px-4 py-2.5 text-right",de.error&&"text-destructive"),children:de.v8?i("monitor.performance.org.blocks8"):de.error?i("mainPanelTabs.cdnTab.errorTitle"):i("monitor.performance.org.noCdn")})]},de.project.id)},e[48]=n,e[49]=i,e[50]=Q):Q=e[50];const re=_.map(Q);let ce;e[51]!==re?(ce=l.jsx("tbody",{children:re}),e[51]=re,e[52]=ce):ce=e[52];let ae;e[53]!==G||e[54]!==ce?(ae=l.jsx("section",{className:K,children:l.jsxs("table",{className:U,children:[G,ce]})}),e[53]=G,e[54]=ce,e[55]=ae):ae=e[55];let fe;return e[56]!==S||e[57]!==V||e[58]!==ae||e[59]!==R?(fe=l.jsxs(l.Fragment,{children:[S,R,V,ae]}),e[56]=S,e[57]=V,e[58]=ae,e[59]=R,e[60]=fe):fe=e[60],fe}function tg(t){return t.total_requests}function sg(t){return l.jsx(Ce,{className:"h-28"},t)}function lg(t){return t.requests>0}function ng(t){return t.avg_latency_ms}function ig(t){return t.cache_hit_ratio}function rg(t){return t.status_5xx_count}function ag(t){return t.total_requests}function og(t){return t.previous}function cg(t){return t.error}function dg(t){return(t.summary?.total_requests??0)>0}function mg(t,e){return(e.summary?.total_requests??-1)-(t.summary?.total_requests??-1)}function ug(t){return t.isLoading}function xa(t,e){if(e<=0)return"—";const s=t/e*100;return s>0&&s<.1?`<${mr.format(.1)}%`:`${mr.format(s)}%`}function fg(t){const e=O.c(11),{projects:s,scopeId:n,onProject:i}=t;if(n){let a;if(e[0]!==s||e[1]!==n){let c;e[3]!==n?(c=d=>d.id===n,e[3]=n,e[4]=c):c=e[4],a=s.find(c),e[0]=s,e[1]=n,e[2]=a}else a=e[2];let o;return e[5]!==n||e[6]!==a?(o=l.jsx(Y4,{projectId:n,project:a},n),e[5]=n,e[6]=a,e[7]=o):o=e[7],o}let r;return e[8]!==i||e[9]!==s?(r=l.jsx(Kn,{children:l.jsx(eg,{projects:s,onProject:i})}),e[8]=i,e[9]=s,e[10]=r):r=e[10],r}const Id=["metrics","alerts","performance","logs","deploys","experiments","audience","heatmap"];function pg(t,e){switch(t){case"metrics":return e("monitor.view.metrics");case"alerts":return e("monitor.view.alerts");case"performance":return e("monitor.view.performance");case"logs":return e("monitor.view.logs");case"deploys":return e("monitor.view.deploys");case"experiments":return e("monitor.view.experiments");case"audience":return e("monitor.view.audience");case"heatmap":return e("monitor.view.heatmap");default:return t}}function xg(t){const e=O.c(6),{view:s,onView:n}=t,i=ie();let r;e[0]!==n||e[1]!==i||e[2]!==s?(r=Id.map(o=>l.jsx(We.Tab,{active:s===o,onClick:()=>n(o),children:pg(o,i)},o)),e[0]=n,e[1]=i,e[2]=s,e[3]=r):r=e[3];let a;if(e[4]!==r){const o=l.jsx(We.Tabs,{children:r});a=l.jsx(i1.Toolbar.Left.Portal,{fallback:o,children:o}),e[4]=r,e[5]=a}else a=e[5];return a}function Rs(){const t=O.c(2),e=gr();let s;return t[0]!==e?(s=e.flatMap(hg),t[0]=e,t[1]=s):s=t[1],s}function hg(t){const s=n1(t.id)||t.metadata?.type==="commerce-discovery"?null:bn(t),n=l1(t);return s&&n?[{id:t.id,title:t.title,icon:t.icon,site:s,analyticsSite:n,repository:t.metadata?.repository??null}]:[]}function Sr(t){const e=O.c(13),{scopeId:s,enabled:n,children:i}=t,r=ie(),{org:a}=He(),o=Rs();if(!n||!s&&o.length===0){let d;e[0]!==r?(d=r("monitor.locked.analytics.title"),e[0]=r,e[1]=d):d=e[1];let m;e[2]===Symbol.for("react.memo_cache_sentinel")?(m=l.jsx(id,{}),e[2]=m):m=e[2];let u;e[3]!==a.slug||e[4]!==s?(u=Ss(a.slug,s),e[3]=a.slug,e[4]=s,e[5]=u):u=e[5];let f;e[6]===Symbol.for("react.memo_cache_sentinel")?(f=l.jsx(no,{}),e[6]=f):f=e[6];let p;return e[7]!==d||e[8]!==u?(p=l.jsx("div",{className:"px-4 pt-6 pb-10 md:px-10",children:l.jsx(Ds,{kind:"analytics",title:d,guide:m,link:u,children:f})}),e[7]=d,e[8]=u,e[9]=p):p=e[9],p}if(!s)return i;let c;return e[10]!==i||e[11]!==s?(c=l.jsx("div",{className:"flex h-full min-h-0 flex-col",children:i},s),e[10]=i,e[11]=s,e[12]=c):c=e[12],c}function Ad(){const t=O.c(5),e=ie();let s;t[0]===Symbol.for("react.memo_cache_sentinel")?(s=l.jsx(jn,{size:20}),t[0]=s):s=t[0];let n;t[1]!==e?(n=e("mainPanelTabs.cdnTab.noSiteTitle"),t[1]=e,t[2]=n):n=t[2];let i;return t[3]!==n?(i=l.jsx(Ke,{icon:s,title:n}),t[3]=n,t[4]=i):i=t[4],i}function gg(t){const e=O.c(8),{scopeId:s,onProject:n}=t,i=En(),r=r1(),a=Rs(),o=i.monitor&&(r.monitorEnabled===!0||r.auth.localMode===!0);let c;e[0]!==n||e[1]!==a||e[2]!==s?(c=l.jsx(fg,{projects:a,scopeId:s,onProject:n}),e[0]=n,e[1]=a,e[2]=s,e[3]=c):c=e[3];let d;return e[4]!==s||e[5]!==o||e[6]!==c?(d=l.jsx(Sr,{scopeId:s,enabled:o,children:c}),e[4]=s,e[5]=o,e[6]=c,e[7]=d):d=e[7],d}function vg(t){const e=O.c(14),{scopeId:s,onProject:n}=t,i=En(),r=Rs();let a;if(e[0]!==r||e[1]!==s){let m;e[3]!==s?(m=u=>u.id===s,e[3]=s,e[4]=m):m=e[4],a=r.find(m),e[0]=r,e[1]=s,e[2]=a}else a=e[2];const o=a;let c;e[5]!==n||e[6]!==o||e[7]!==r||e[8]!==s?(c=s&&!o?l.jsx("div",{className:"mx-auto w-full max-w-[1200px] px-4 pt-6 pb-10 md:px-10",children:l.jsx(Ad,{})}):l.jsx(u4,{project:o,projects:r,onProject:n}),e[5]=n,e[6]=o,e[7]=r,e[8]=s,e[9]=c):c=e[9];let d;return e[10]!==s||e[11]!==c||e[12]!==i.monitor?(d=l.jsx(Sr,{scopeId:s,enabled:i.monitor,children:c}),e[10]=s,e[11]=c,e[12]=i.monitor,e[13]=d):d=e[13],d}function bg(t){const e=O.c(8),{scopeId:s,onOpen:n}=t,i=En(),r=Rs();let a;e[0]!==n||e[1]!==r||e[2]!==s?(a=l.jsx(c4,{projects:r,scopeId:s,onOpen:n}),e[0]=n,e[1]=r,e[2]=s,e[3]=a):a=e[3];let o;return e[4]!==s||e[5]!==a||e[6]!==i.monitor?(o=l.jsx(Sr,{scopeId:s,enabled:i.monitor,children:a}),e[4]=s,e[5]=a,e[6]=i.monitor,e[7]=o):o=e[7],o}const Ai=864e5,Sc=14,jg=["improvement","neutral","regression","settling","unmeasured"],_c={improvement:"bg-success",neutral:"bg-chart-1",regression:"bg-destructive",settling:"bg-muted-foreground",unmeasured:"bg-muted-foreground/40"},yg=t=>{const e=new Date(t);return e.setHours(0,0,0,0),e.getTime()};function wg(t){const e=O.c(21),{deploy:s,showProject:n}=t,i=ie();let r;e[0]!==s.at?(r=new Date(s.at).toLocaleString(void 0,{weekday:"short",day:"numeric",month:"short",hour:"2-digit",minute:"2-digit"}),e[0]=s.at,e[1]=r):r=e[1];const a=r;let o;e[2]!==s.kind||e[3]!==i?(o=s.kind==="rollout"?i("monitor.chart.rollout"):i("monitor.chart.deploy"),e[2]=s.kind,e[3]=i,e[4]=o):o=e[4];let c;e[5]!==o||e[6]!==a?(c=l.jsxs("span",{className:"text-xs text-muted-foreground",children:[o," ","· ",a]}),e[5]=o,e[6]=a,e[7]=c):c=e[7];let d;e[8]!==s.message?(d=l.jsx("span",{className:"text-sm font-medium",children:s.message}),e[8]=s.message,e[9]=d):d=e[9];const m=s.author,u=n&&` · ${s.projectTitle}`;let f;e[10]!==s.verdict||e[11]!==i?(f=so(s.verdict,i),e[10]=s.verdict,e[11]=i,e[12]=f):f=e[12];let p;e[13]!==s.author||e[14]!==u||e[15]!==f?(p=l.jsxs("span",{className:"text-xs text-muted-foreground",children:[m,u," ·"," ",f]}),e[13]=s.author,e[14]=u,e[15]=f,e[16]=p):p=e[16];let x;return e[17]!==c||e[18]!==d||e[19]!==p?(x=l.jsxs("div",{className:"flex max-w-72 flex-col gap-0.5",children:[c,d,p]}),e[17]=c,e[18]=d,e[19]=p,e[20]=x):x=e[20],x}function Ng(t){const e=O.c(60),{deploys:s,showProject:n}=t,i=ie(),[r]=Z.useState(_g),a=yg(r)-(Sc-1)*Ai,o=r-a;let c;e[0]!==o||e[1]!==a?(c=_=>`${(_-a)/o*100}%`,e[0]=o,e[1]=a,e[2]=c):c=e[2];const d=c;let m,u,f,p,x,h,g,v,b,y,j;if(e[3]!==s||e[4]!==n||e[5]!==o||e[6]!==a||e[7]!==i||e[8]!==d){let _;e[20]!==a?(_=V=>Date.parse(V.at)>=a,e[20]=a,e[21]=_):_=e[21];const $=s.filter(_),T=n?[...new Set($.map(Sg))]:[""],P=Array.from({length:Sc},(V,K)=>a+K*Ai),I=$.filter(kg).length,C=$.length?`${Math.round(100*I/$.length)}%`:"0%",M=l.jsx(l.Fragment,{children:P.map(V=>{const K=[0,6].includes(new Date(V).getDay());return l.jsx("span",{"aria-hidden":!0,className:ye("absolute inset-y-0 border-l border-dashed border-border/60",K&&"bg-muted/40"),style:{left:d(V),width:`${Ai/o*100}%`}},V)})});m=Me,e[22]!==i?(y=i("monitor.deploys.history"),e[22]=i,e[23]=y):y=e[23],j=$.length;let A;e[24]!==C||e[25]!==I||e[26]!==i?(A=i("monitor.deploys.historyCaption",{count:I,pct:C}),e[24]=C,e[25]=I,e[26]=i,e[27]=A):A=e[27],e[28]!==A?(u=l.jsx("span",{className:"text-meta",children:A}),e[28]=A,e[29]=u):u=e[29];let F;e[30]!==i?(F=jg.map(V=>l.jsxs("li",{className:"text-meta flex items-center gap-1.5",children:[l.jsx("span",{className:ye("size-2 rounded-full",_c[V])}),so(V,i)]},V)),e[30]=i,e[31]=F):F=e[31];let E;e[32]===Symbol.for("react.memo_cache_sentinel")?(E=l.jsx("span",{className:"size-2 rotate-45 rounded-[1px] bg-foreground"}),e[32]=E):E=e[32];let z;e[33]!==i?(z=i("monitor.chart.rollout"),e[33]=i,e[34]=z):z=e[34];let R;e[35]!==z?(R=l.jsxs("li",{className:"text-meta flex items-center gap-1.5",children:[E,z]}),e[35]=z,e[36]=R):R=e[36],e[37]!==F||e[38]!==R?(f=l.jsxs("ul",{className:"flex flex-wrap justify-end gap-x-3 gap-y-1",children:[F,R]}),e[37]=F,e[38]=R,e[39]=f):f=e[39],v="flex flex-col",b=T.map(V=>l.jsxs("div",{className:"flex h-10 items-center gap-3 border-b border-border/50",children:[n&&l.jsx("span",{className:"w-32 shrink-0 truncate text-sm text-muted-foreground",children:V}),l.jsxs("div",{className:"relative h-full flex-1",children:[M,$.filter(K=>!n||K.projectTitle===V).map(K=>l.jsxs(il,{children:[l.jsx(ll,{asChild:!0,children:l.jsx("button",{type:"button","aria-label":K.message,className:ye("focus-ring absolute top-1/2 -translate-x-1/2 -translate-y-1/2 border-2 border-background transition-transform hover:scale-150",K.kind==="rollout"?"size-3 rotate-45 rounded-[2px] bg-foreground hover:rotate-45":ye("size-3 rounded-full",_c[K.verdict])),style:{left:d(Date.parse(K.at))}})}),l.jsx(nl,{children:l.jsx(wg,{deploy:K,showProject:n})})]},K.id))]})]},V)),h="flex h-6 items-end gap-3",e[40]!==n?(g=n&&l.jsx("span",{className:"w-32 shrink-0"}),e[40]=n,e[41]=g):g=e[41],p="relative h-full flex-1",x=P.map((V,K)=>K%2===0||P.length<=7?l.jsx("span",{className:"text-meta absolute bottom-0 -translate-x-1/2 whitespace-nowrap",style:{left:d(V+Ai/2)},children:new Date(V).toLocaleDateString(void 0,{month:"short",day:"numeric"})},V):null),e[3]=s,e[4]=n,e[5]=o,e[6]=a,e[7]=i,e[8]=d,e[9]=m,e[10]=u,e[11]=f,e[12]=p,e[13]=x,e[14]=h,e[15]=g,e[16]=v,e[17]=b,e[18]=y,e[19]=j}else m=e[9],u=e[10],f=e[11],p=e[12],x=e[13],h=e[14],g=e[15],v=e[16],b=e[17],y=e[18],j=e[19];let N;e[42]!==p||e[43]!==x?(N=l.jsx("div",{className:p,children:x}),e[42]=p,e[43]=x,e[44]=N):N=e[44];let w;e[45]!==N||e[46]!==h||e[47]!==g?(w=l.jsxs("div",{className:h,children:[g,N]}),e[45]=N,e[46]=h,e[47]=g,e[48]=w):w=e[48];let S;e[49]!==w||e[50]!==v||e[51]!==b?(S=l.jsxs("div",{className:v,children:[b,w]}),e[49]=w,e[50]=v,e[51]=b,e[52]=S):S=e[52];let k;return e[53]!==m||e[54]!==u||e[55]!==f||e[56]!==S||e[57]!==y||e[58]!==j?(k=l.jsx(m,{title:y,value:j,caption:u,aside:f,children:S}),e[53]=m,e[54]=u,e[55]=f,e[56]=S,e[57]=y,e[58]=j,e[59]=k):k=e[59],k}function kg(t){return t.verdict==="regression"}function Sg(t){return t.projectTitle}function _g(){return Date.now()}function Ld(t,e){switch(t){case"orders":return e("monitor.metric.orders");case"errors":return e("monitor.metric.errors");case"latency":return e("monitor.metric.latency");default:return t}}const $g={alert:{icon:hr,tone:"text-destructive",mark:"bg-destructive/10"},warning:{icon:Dm,tone:"text-warning",mark:"bg-warning/10"},ready:{icon:Fa,tone:"text-success",mark:"bg-success/10"}};function Tg(t,e){switch(t){case"alert":return e("orderMonitor.status.alert");case"warning":return e("orderMonitor.status.warning");case"ready":return e("monitor.severity.ready");default:return t}}function Pg(t,e,s,n,i){const r=e("orderMonitor.since",{ago:Hn(new Date(t.since))}),a=o=>{const c=o===void 0?null:za(s,o);return c?{link:{to:"/$org/t/$taskKey",params:{org:s,taskKey:c}}}:null};switch(t.kind){case"alert":return{title:t.title,reason:r,place:"",go:t.storeId?{onClick:()=>i(t.storeId)}:{href:t.link}};case"deploy":return{title:e("monitor.signal.deploy",{metric:Ld(t.metric,e),pct:Z1(t.change)}),reason:`“${t.message}” · ${r}`,place:t.projectTitle,go:a(t.task?.keySeq)??{link:Zs(s,t.projectId,"releases")}};case"experiment":return{title:e("monitor.signal.experiment",{title:t.title}),reason:e("monitor.signal.experimentDetail",{pct:`${Math.round(t.probability*100)}%`,count:Rt(t.participants)}),place:"",go:{link:Zs(s,t.projectId,"experiments")}};case"source":return{title:e("monitor.signal.source"),reason:e("monitor.signal.sourceDetail",{minutes:t.minutes}),place:Cg(t.title),go:{link:Ss(s,n)}};default:return t}}const Cg=t=>t.replace(/\s·\s(VTEX|Shopify)$/i,""),Eg=5,Li="focus-ring group flex w-full items-center gap-4 px-5 py-4 text-left transition-colors hover:bg-accent/30";function Mg(t){const e=O.c(33),{signals:s,orgSlug:n,scopeId:i,onOpenStore:r}=t,a=ie(),[o,c]=Z.useState(!1),{ack:d}=Ja(n);let m;e[0]!==o||e[1]!==s?(m=o?s:s.slice(0,Eg),e[0]=o,e[1]=s,e[2]=m):m=e[2];const u=m,f=s.length-u.length;let p;e[3]!==a?(p=a("monitor.signals.title"),e[3]=a,e[4]=p):p=e[4];let x;e[5]!==p?(x=l.jsx("h2",{className:"text-sm font-medium text-foreground",children:p}),e[5]=p,e[6]=x):x=e[6];const h=o?"max-h-[28rem] overflow-y-auto overscroll-contain":"overflow-hidden";let g;e[7]!==h?(g=ye("surface divide-y divide-border/70",h),e[7]=h,e[8]=g):g=e[8];let v;if(e[9]!==d||e[10]!==r||e[11]!==n||e[12]!==i||e[13]!==u||e[14]!==a){let N;e[16]!==d||e[17]!==r||e[18]!==n||e[19]!==i||e[20]!==a?(N=w=>{const S=Pg(w,a,n,i,r),{icon:k,tone:_,mark:$}=$g[w.severity],T=l.jsxs(l.Fragment,{children:[l.jsx("span",{role:"img","aria-label":Tg(w.severity,a),className:ye("flex size-9 shrink-0 items-center justify-center rounded-full",$,_),children:l.jsx(k,{size:18})}),l.jsxs("span",{className:"flex min-w-0 flex-1 flex-col gap-0.5",children:[l.jsx("span",{className:"truncate text-sm font-medium text-foreground",children:S.title}),l.jsx("span",{className:"text-meta truncate",children:[S.place,S.reason].filter(Boolean).join(" · ")})]}),l.jsx(La,{size:16,className:"shrink-0 text-muted-foreground transition-transform group-hover:translate-x-0.5"})]}),P=S.go;return l.jsxs("li",{className:"flex items-center",children:["link"in P?l.jsx(As,{...P.link,className:Li,children:T}):"href"in P?P.href?l.jsx("a",{href:P.href,className:Li,children:T}):l.jsx("div",{className:Li,children:T}):l.jsx("button",{type:"button",onClick:P.onClick,className:Li,children:T}),w.kind==="alert"&&l.jsx(Se,{variant:"outline",size:"sm",className:"mr-5 shrink-0",onClick:()=>d(w.id),children:a("monitor.signal.ack")})]},w.id)},e[16]=d,e[17]=r,e[18]=n,e[19]=i,e[20]=a,e[21]=N):N=e[21],v=u.map(N),e[9]=d,e[10]=r,e[11]=n,e[12]=i,e[13]=u,e[14]=a,e[15]=v}else v=e[15];let b;e[22]!==f||e[23]!==o||e[24]!==a?(b=(f>0||o)&&l.jsx("li",{children:l.jsx("button",{type:"button",onClick:()=>c(!o),className:"focus-ring w-full px-5 py-3 text-left text-sm text-muted-foreground transition-colors hover:bg-accent/30 hover:text-foreground",children:o?a("monitor.signals.less"):a("monitor.signals.more",{count:f})})}),e[22]=f,e[23]=o,e[24]=a,e[25]=b):b=e[25];let y;e[26]!==g||e[27]!==v||e[28]!==b?(y=l.jsxs("ul",{className:g,children:[v,b]}),e[26]=g,e[27]=v,e[28]=b,e[29]=y):y=e[29];let j;return e[30]!==x||e[31]!==y?(j=l.jsxs("section",{className:"flex flex-col gap-3",children:[x,y]}),e[30]=x,e[31]=y,e[32]=j):j=e[32],j}function Ig(){const t=O.c(12),e=ie();let s;t[0]===Symbol.for("react.memo_cache_sentinel")?(s=l.jsx("span",{className:"flex size-9 shrink-0 items-center justify-center rounded-full bg-success/10 text-success",children:l.jsx(Fa,{size:18})}),t[0]=s):s=t[0];let n;t[1]!==e?(n=e("monitor.signals.allClear"),t[1]=e,t[2]=n):n=t[2];let i;t[3]!==n?(i=l.jsx("span",{className:"text-sm font-medium text-foreground",children:n}),t[3]=n,t[4]=i):i=t[4];let r;t[5]!==e?(r=e("monitor.signals.watching"),t[5]=e,t[6]=r):r=t[6];let a;t[7]!==r?(a=l.jsx("span",{className:"text-meta",children:r}),t[7]=r,t[8]=a):a=t[8];let o;return t[9]!==i||t[10]!==a?(o=l.jsxs("div",{className:"surface flex items-center gap-4 px-5 py-4",children:[s,l.jsxs("span",{className:"flex min-w-0 flex-col gap-0.5",children:[i,a]})]}),t[9]=i,t[10]=a,t[11]=o):o=t[11],o}const Ag={orders:"up",errors:"down",latency:"down"};function Lg(t){const e=O.c(20),{verdict:s}=t,n=ie();switch(s){case"regression":{let i;e[0]!==n?(i=n("monitor.verdict.regression"),e[0]=n,e[1]=i):i=e[1];let r;return e[2]!==i?(r=l.jsx(Ye,{variant:"destructive",children:i}),e[2]=i,e[3]=r):r=e[3],r}case"improvement":{let i;e[4]!==n?(i=n("monitor.verdict.improvement"),e[4]=n,e[5]=i):i=e[5];let r;return e[6]!==i?(r=l.jsx(Ye,{variant:"success",children:i}),e[6]=i,e[7]=r):r=e[7],r}case"neutral":{let i;e[8]!==n?(i=n("monitor.verdict.neutral"),e[8]=n,e[9]=i):i=e[9];let r;return e[10]!==i?(r=l.jsx(Ye,{variant:"muted",children:i}),e[10]=i,e[11]=r):r=e[11],r}case"settling":{let i;e[12]!==n?(i=n("monitor.verdict.settling"),e[12]=n,e[13]=i):i=e[13];let r;return e[14]!==i?(r=l.jsx(Ye,{variant:"muted",children:i}),e[14]=i,e[15]=r):r=e[15],r}case"unmeasured":{let i;e[16]!==n?(i=n("monitor.verdict.unmeasured"),e[16]=n,e[17]=i):i=e[17];let r;return e[18]!==i?(r=l.jsx(Ye,{variant:"muted",children:i}),e[18]=i,e[19]=r):r=e[19],r}default:return s}}function Dg(t){const e=O.c(17),{deploy:s,orgSlug:n}=t,i=ie();let r;e[0]!==s.task||e[1]!==n?(r=s.task?za(n,s.task.keySeq):null,e[0]=s.task,e[1]=n,e[2]=r):r=e[2];const a=r;if(a){let o;e[3]!==a||e[4]!==n?(o={org:n,taskKey:a},e[3]=a,e[4]=n,e[5]=o):o=e[5];let c;return e[6]!==a||e[7]!==o?(c=l.jsx(Se,{asChild:!0,variant:"secondary",size:"sm",children:l.jsx(As,{to:"/$org/t/$taskKey",params:o,children:a})}),e[6]=a,e[7]=o,e[8]=c):c=e[8],c}if(s.verdict==="regression"&&s.projectId){let o;e[9]!==s.projectId||e[10]!==n?(o=Zs(n,s.projectId,"releases"),e[9]=s.projectId,e[10]=n,e[11]=o):o=e[11];let c;e[12]!==i?(c=i("monitor.action.revert"),e[12]=i,e[13]=c):c=e[13];let d;return e[14]!==o||e[15]!==c?(d=l.jsx(Se,{asChild:!0,variant:"secondary",size:"sm",children:l.jsx(As,{...o,children:c})}),e[14]=o,e[15]=c,e[16]=d):d=e[16],d}return null}function Og(t){const e=O.c(10),{deploys:s,orgSlug:n,showProject:i}=t,r=ie();let a;e[0]!==r?(a=r("monitor.deploys.caption"),e[0]=r,e[1]=a):a=e[1];let o;e[2]!==s||e[3]!==n||e[4]!==i||e[5]!==r?(o=s.length===0?l.jsx("p",{className:"surface px-4 py-4 text-sm text-muted-foreground",children:r("monitor.deploys.empty")}):l.jsx("div",{className:"surface overflow-x-auto",children:l.jsxs(sl,{variant:"flush",children:[l.jsx(el,{children:l.jsxs(Ut,{children:[l.jsx(dt,{className:"pl-4",children:r("monitor.deploys.when")}),i&&l.jsx(dt,{children:r("monitor.deploys.project")}),l.jsx(dt,{children:r("monitor.deploys.change")}),l.jsx(dt,{children:r("monitor.deploys.effect")}),l.jsx(dt,{children:r("monitor.deploys.verdict")}),l.jsx(dt,{className:"pr-4"})]})}),l.jsx(tl,{children:s.map(d=>l.jsxs(Ut,{children:[l.jsx(Le,{className:"pl-4 align-top",children:l.jsx("span",{className:"whitespace-nowrap text-sm tnum text-foreground",title:ex(d.at),children:Hn(new Date(d.at))})}),i&&l.jsx(Le,{className:"align-top text-sm text-foreground",children:d.projectTitle}),l.jsx(Le,{className:"max-w-80 align-top",children:l.jsxs("div",{className:"flex flex-col",children:[l.jsx("span",{className:"truncate text-sm font-medium text-foreground",children:d.message}),l.jsx("span",{className:"text-meta",children:d.kind==="rollout"?`${r("monitor.chart.rollout")} · ${d.author}`:d.author})]})}),l.jsx(Le,{className:"align-top",children:d.verdict==="settling"?l.jsx("span",{className:"text-meta",children:r("monitor.deploys.measuring",{minutes:Math.max(1,d.settlesAt?sx(d.settlesAt):60-tx(d.at))})}):l.jsxs("div",{className:"flex items-center gap-4",children:[d.around&&l.jsx(Nn,{values:d.around,marker:Math.floor(d.around.length/2),tone:d.verdict==="regression"?"bad":"neutral",className:"h-7 w-24 shrink-0"}),l.jsx("div",{className:"flex flex-wrap gap-x-3 gap-y-0.5",children:d.impact.map(m=>l.jsxs("span",{className:"flex items-baseline gap-1",children:[l.jsx("span",{className:"text-meta",children:Ld(m.metric,r)}),l.jsx(J1,{change:m.change,better:Ag[m.metric]})]},m.metric))})]})}),l.jsx(Le,{className:"align-top",children:l.jsx(Lg,{verdict:d.verdict})}),l.jsx(Le,{className:"pr-4 text-right align-top",children:l.jsx(Dg,{deploy:d,orgSlug:n})})]},d.id))})]})}),e[2]=s,e[3]=n,e[4]=i,e[5]=r,e[6]=o):o=e[6];let c;return e[7]!==a||e[8]!==o?(c=l.jsx(t1,{description:a,children:o}),e[7]=a,e[8]=o,e[9]=c):c=e[9],c}function $c(t){const e=O.c(38),{deploys:s,history:n,orgSlug:i,scopeId:r}=t,a=ie();let o;e[0]!==s?(o=s.filter(Fg),e[0]=s,e[1]=o):o=e[1];const c=o.length;let d;e[2]!==s?(d=s.filter(Rg),e[2]=s,e[3]=d):d=e[3];const m=d.length;let u;e[4]!==a?(u=a("monitor.deploys.title"),e[4]=a,e[5]=u):u=e[5];let f;e[6]!==s.length||e[7]!==u?(f=l.jsx(Me,{title:u,value:s.length}),e[6]=s.length,e[7]=u,e[8]=f):f=e[8];let p;e[9]!==a?(p=a("monitor.deploys.regressions"),e[9]=a,e[10]=p):p=e[10];let x;e[11]!==c||e[12]!==a?(x=c>0&&l.jsx("span",{className:"text-meta text-destructive",children:a("monitor.deploys.regressionsHint")}),e[11]=c,e[12]=a,e[13]=x):x=e[13];let h;e[14]!==c||e[15]!==p||e[16]!==x?(h=l.jsx(Me,{title:p,value:c,caption:x}),e[14]=c,e[15]=p,e[16]=x,e[17]=h):h=e[17];let g;e[18]!==a?(g=a("monitor.deploys.measuringCount"),e[18]=a,e[19]=g):g=e[19];let v;e[20]!==m||e[21]!==g?(v=l.jsx(Me,{title:g,value:m}),e[20]=m,e[21]=g,e[22]=v):v=e[22];let b;e[23]!==f||e[24]!==h||e[25]!==v?(b=l.jsxs("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-3",children:[f,h,v]}),e[23]=f,e[24]=h,e[25]=v,e[26]=b):b=e[26];let y;e[27]!==n||e[28]!==r?(y=n&&l.jsx(Ng,{deploys:n,showProject:!r}),e[27]=n,e[28]=r,e[29]=y):y=e[29];const j=!r;let N;e[30]!==s||e[31]!==i||e[32]!==j?(N=l.jsx("div",{className:"mt-6",children:l.jsx(Og,{deploys:s,orgSlug:i,showProject:j})}),e[30]=s,e[31]=i,e[32]=j,e[33]=N):N=e[33];let w;return e[34]!==b||e[35]!==y||e[36]!==N?(w=l.jsxs("div",{className:"flex flex-col gap-4",children:[b,y,N]}),e[34]=b,e[35]=y,e[36]=N,e[37]=w):w=e[37],w}function Rg(t){return t.verdict==="settling"}function Fg(t){return t.verdict==="regression"}function Dd(t,e,s){return Om({queryKey:Qe.experiments(t,s),queryFn:async()=>{const{experiments:n}=await e.call("EXPERIMENT_LIST",{site:s});return n},enabled:!!s,staleTime:3e4})}function Od(t){const e=O.c(4),{locator:s}=He(),n=Yt();let i;return e[0]!==s||e[1]!==t||e[2]!==n?(i=Dd(s,n,t),e[0]=s,e[1]=t,e[2]=n,e[3]=i):i=e[3],ts(i)}function zg(t){const e=O.c(3),s=Yt();let n;return e[0]!==t||e[1]!==s?(n={mutationFn:async i=>await s.call("EXPERIMENT_PREVIEW_SYNC_LOCAL",{site:t,...i})},e[0]=t,e[1]=s,e[2]=n):n=e[2],Et(n)}function Vg(t){const e=O.c(3),s=Yt();let n;return e[0]!==t||e[1]!==s?(n={mutationFn:async i=>await s.call("EXPERIMENT_IMPLEMENT_LOCAL",{site:t,...i}),onSuccess:Kg,onError:qg},e[0]=t,e[1]=s,e[2]=n):n=e[2],Et(n)}function qg(t){return rt.error(t instanceof Error?t.message:"Failed to implement this experiment locally")}function Kg(t){t.implemented?rt.success(`Wired into ${t.cssFile} locally.`):rt.warning(`Didn't implement it automatically (${t.reason??"unknown reason"}) — the experiment was still created.`)}function po(t){const e=O.c(10),s=fs(),{locator:n}=He(),i=Yt();let r;e[0]!==t||e[1]!==i?(r=async c=>{const{experiment:d}=await i.call("EXPERIMENT_CREATE",{site:t,...c});return d},e[0]=t,e[1]=i,e[2]=r):r=e[2];let a;e[3]!==n||e[4]!==s||e[5]!==t?(a=()=>s.invalidateQueries({queryKey:Qe.experiments(n,t)}),e[3]=n,e[4]=s,e[5]=t,e[6]=a):a=e[6];let o;return e[7]!==r||e[8]!==a?(o={mutationFn:r,onSuccess:a,onError:Bg},e[7]=r,e[8]=a,e[9]=o):o=e[9],Et(o)}function Bg(t){return rt.error(t instanceof Error?t.message:"Failed to create experiment")}function Rd(t){const e=O.c(3),s=Yt();let n;return e[0]!==t||e[1]!==s?(n={mutationFn:async i=>await s.call("EXPERIMENT_SUGGEST",{site:t,prompt:i}),onError:Hg},e[0]=t,e[1]=s,e[2]=n):n=e[2],Et(n)}function Hg(t){return rt.error(t instanceof Error?t.message:"Failed to suggest experiment")}function xo(t,e){const s=O.c(15);let n;s[0]!==e?(n=e===void 0?{}:e,s[0]=e,s[1]=n):n=s[1];const{openCard:i}=n,r=i===void 0?!0:i,a=Yt(),o=Cn(),c=fs(),{org:d,locator:m}=He();let u;s[2]!==t||s[3]!==a?(u=async x=>await a.call("EXPERIMENT_IMPLEMENT",{site:t,key:x}),s[2]=t,s[3]=a,s[4]=u):u=s[4];let f;s[5]!==m||s[6]!==o||s[7]!==r||s[8]!==d||s[9]!==c||s[10]!==t?(f=x=>{if(c.invalidateQueries({queryKey:Qe.experiments(m,t)}),c.invalidateQueries({queryKey:Qe.taskBoardItems(m)}),!r||!x.taskKey){rt.success("Sent to the Super Agent — it's writing the code and will open a PR.");return}o({to:"/$org/tasks/{-$taskKey}",params:{org:d.slug,taskKey:x.taskKey}})},s[5]=m,s[6]=o,s[7]=r,s[8]=d,s[9]=c,s[10]=t,s[11]=f):f=s[11];let p;return s[12]!==u||s[13]!==f?(p={mutationFn:u,onSuccess:f,onError:Wg},s[12]=u,s[13]=f,s[14]=p):p=s[14],Et(p)}function Wg(t){return rt.error(t instanceof Error?t.message:"Failed to start implementing this experiment")}function Ug(t){const e=O.c(4),s=po(t);let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n={openCard:!1},e[0]=n):n=e[0];const i=xo(t,n);let r;return e[1]!==s||e[2]!==i?(r={mutationFn:async a=>{const o=await s.mutateAsync(a);return await i.mutateAsync(o.key).catch(Gg),o}},e[1]=s,e[2]=i,e[3]=r):r=e[3],Et(r)}function Gg(){}function ho(t){const e=O.c(10),s=fs(),{locator:n}=He(),i=Yt();let r;e[0]!==t||e[1]!==i?(r=async c=>{const{experiment:d}=await i.call("EXPERIMENT_UPDATE",{site:t,...c});return d},e[0]=t,e[1]=i,e[2]=r):r=e[2];let a;e[3]!==n||e[4]!==s||e[5]!==t?(a=()=>s.invalidateQueries({queryKey:Qe.experiments(n,t)}),e[3]=n,e[4]=s,e[5]=t,e[6]=a):a=e[6];let o;return e[7]!==r||e[8]!==a?(o={mutationFn:r,onSuccess:a,onError:Yg},e[7]=r,e[8]=a,e[9]=o):o=e[9],Et(o)}function Yg(t){return rt.error(t instanceof Error?t.message:"Failed to update experiment")}function Qg(t,e){const s=O.c(12),{locator:n}=He(),i=Yt();let r;s[0]!==e||s[1]!==n||s[2]!==t?(r=Qe.experimentResults(n,t,e),s[0]=e,s[1]=n,s[2]=t,s[3]=r):r=s[3];let a;s[4]!==e||s[5]!==t||s[6]!==i?(a=async()=>await i.call("EXPERIMENT_RESULTS",{site:t,key:e}),s[4]=e,s[5]=t,s[6]=i,s[7]=a):a=s[7];const o=!!t&&!!e;let c;return s[8]!==r||s[9]!==a||s[10]!==o?(c={queryKey:r,queryFn:a,enabled:o,staleTime:6e4},s[8]=r,s[9]=a,s[10]=o,s[11]=c):c=s[11],ts(c)}function Fd(t){const e=O.c(10),s=fs(),{locator:n}=He(),i=Yt();let r;e[0]!==t||e[1]!==i?(r=async c=>{await i.call("EXPERIMENT_DELETE",{site:t,key:c})},e[0]=t,e[1]=i,e[2]=r):r=e[2];let a;e[3]!==n||e[4]!==s||e[5]!==t?(a=()=>s.invalidateQueries({queryKey:Qe.experiments(n,t)}),e[3]=n,e[4]=s,e[5]=t,e[6]=a):a=e[6];let o;return e[7]!==r||e[8]!==a?(o={mutationFn:r,onSuccess:a,onError:Xg},e[7]=r,e[8]=a,e[9]=o):o=e[9],Et(o)}function Xg(t){return rt.error(t instanceof Error?t.message:"Failed to delete experiment")}const zd=100,Vd=10,go=1.3,ms=-.02,qd=.1,vo=1.959964,ha=1.644854;function Zg(t){const e=Math.abs(t)/Math.SQRT2,s=1/(1+.3275911*e),n=1-((((1.061405429*s-1.453152027)*s+1.421413741)*s-.284496736)*s+.254829592)*s*Math.exp(-e*e);return t>=0?.5*(1+n):.5*(1-n)}function Kd(t,e,s,n=go){return Math.sqrt(n*((1-t)/t)*(1/e+1/s))}function Jg(t,e,s,n,i=go){return Math.sqrt(i*((1-s)/(n*s)+(1-t)/(e*t)))}function e5(t,e,s=vo){const n=Math.log(1+t);return[Math.exp(n-s*e)-1,Math.exp(n+s*e)-1]}function Tc(t,e,s){const n=Math.log(1+t)-Math.log(1+e);return s===0?n>0?1:n<0?0:.5:Zg(n/s)}function Pc(t){return ms+ha*t}function t5(t){return(1/t+1/(1-t))/4}const ga=t=>t.total>0?t.successes/t.total:0,s5=(t,e)=>Math.min(t.total,e.total)<zd||Math.min(t.successes,e.successes)<Vd;function bo(t,e){const s=ga(t),n=ga(e),i={controlRate:s,treatmentRate:n,lift:null,low:null,high:null,margin:null,notWorseAt:null,pBetter:null,pBetterTarget:null,safety:null,significant:!1,verdict:"few"};if(s===0||e.total===0)return i;const r=n/s-1,a=Kd(s,t.total,e.total),o=r-ha*a>0,c=r<-ha*a?"worse":r>=Pc(a)?"notWorse":"open",d=n>0?Jg(s,t.total,n,e.total):null,m=d===null?null:e5(r,d),u=s5(t,e)?"few":o?"better":c==="worse"?"worse":c==="notWorse"?"notWorse":"unclear";return{controlRate:s,treatmentRate:n,lift:r,low:m?.[0]??null,high:m?.[1]??null,margin:vo*a,notWorseAt:Pc(a),pBetter:d===null?null:Tc(r,0,d),pBetterTarget:d===null?null:Tc(r,qd,d),safety:c,significant:o,verdict:u}}function l5(t,e,s,n){const i=ga(t);if(s<=0||i===0||e.total===0)return null;const r=vo*Kd(i,t.total,e.total),a=s*(r/n)**2,o=Math.max(0,Math.ceil(a-s)),c=e.total/(t.total+e.total);return{days:o,exposed:Math.round((t.total+e.total)/s*o),evenSplitDays:Math.max(0,Math.ceil((a-s)/t5(c)))}}function n5(t,e){const s=[...new Set([...t,...e].map(i=>i.date))].sort(),n={c:{successes:0,total:0},t:{successes:0,total:0}};return s.map(i=>{for(const[a,o]of[[n.c,t],[n.t,e]]){const c=o.find(d=>d.date===i);a.successes+=c?.counts.successes??0,a.total+=c?.counts.total??0}const r=bo(n.c,n.t);return{date:i,lift:r.lift,low:r.low,high:r.high}})}const Cc=[.01,.02,.05,.1,.2,.25,.5,1,2,5];function Bd(t){const e=[...t,0,ms],s=(Math.max(...e)-Math.min(...e))*.04,n=Math.min(...e)-s,i=Math.max(...e)+s,r=Cc.find(d=>(i-n)/d<=6)??Cc.at(-1)??1,a=Math.floor(n/r),o=Math.ceil(i/r),c=d=>Math.round(d*r*1e9)/1e9||0;return{min:c(a),max:c(o),ticks:Array.from({length:o-a+1},(d,m)=>c(a+m))}}function i5(t,e){const s=Date.parse(t??"");return!Number.isFinite(s)||s>e?0:Math.max(1,Math.ceil((e-s)/864e5))}const r5=["draft","running","paused","ended"],Ec=[{id:"control",weight:"50",role:"control"},{id:"variant-b",weight:"50",role:"treatment"}];function Hd(t){const e=O.c(4),{variants:s}=t;let n;e[0]!==s?(n=s.map(a5),e[0]=s,e[1]=n):n=e[1];let i;return e[2]!==n?(i=l.jsx("div",{className:"flex flex-wrap gap-1",children:n}),e[2]=n,e[3]=i):i=e[3],i}function a5(t){return l.jsxs("span",{className:"rounded bg-muted px-1.5 py-0.5 font-mono text-2xs text-muted-foreground",children:[t.id," ",t.weight,"%"]},t.id)}function o5(t){const e=O.c(131),{site:s,open:n,onOpenChange:i}=t,r=ie(),a=po(s),[o,c]=Z.useState(""),[d,m]=Z.useState(""),[u,f]=Z.useState(Ec);let p,x,h,g,v,b,y,j,N,w,S,k,_,$,T,P,I,C;if(e[0]!==a||e[1]!==o||e[2]!==d||e[3]!==i||e[4]!==n||e[5]!==r||e[6]!==u){const W=u.reduce(m5,0);let G;e[25]===Symbol.for("react.memo_cache_sentinel")?(G=(be,we)=>f($e=>$e.map((je,xe)=>xe===be?{...je,...we}:je)),e[25]=G):G=e[25],g=G;let Q;e[26]!==a||e[27]!==o||e[28]!==d||e[29]!==i||e[30]!==u?(Q=()=>{a.mutate({key:o.trim(),name:d.trim(),variants:u.map(d5)},{onSuccess:()=>{c(""),m(""),f(Ec),i(!1)}})},e[26]=a,e[27]=o,e[28]=d,e[29]=i,e[30]=u,e[31]=Q):Q=e[31],v=Q,h=Pn,N=n,w=i,x=Tn,y="max-w-md";let re;e[32]!==r?(re=r("experiments.dialog.newTitle"),e[32]=r,e[33]=re):re=e[33];let ce;e[34]!==re?(ce=l.jsx($n,{children:re}),e[34]=re,e[35]=ce):ce=e[35];let ae;e[36]!==r?(ae=r("experiments.subtitle"),e[36]=r,e[37]=ae):ae=e[37];let fe;e[38]!==ae?(fe=l.jsx(Da,{children:ae}),e[38]=ae,e[39]=fe):fe=e[39],e[40]!==ce||e[41]!==fe?(j=l.jsxs(_n,{children:[ce,fe]}),e[40]=ce,e[41]=fe,e[42]=j):j=e[42],I="flex flex-col gap-3";let de;e[43]!==r?(de=r("experiments.legacy.dialog.key"),e[43]=r,e[44]=de):de=e[44];let se;e[45]!==de?(se=l.jsx(Ns,{className:"text-xs",children:de}),e[45]=de,e[46]=se):se=e[46];let H;e[47]===Symbol.for("react.memo_cache_sentinel")?(H=be=>c(be.target.value),e[47]=H):H=e[47];let oe;e[48]!==o?(oe=l.jsx(ds,{value:o,onChange:H,placeholder:"Cross Sell Bag"}),e[48]=o,e[49]=oe):oe=e[49];let he;e[50]!==se||e[51]!==oe?(he=l.jsxs("div",{className:"flex flex-col gap-1",children:[se,oe]}),e[50]=se,e[51]=oe,e[52]=he):he=e[52];let le;e[53]!==r?(le=r("experiments.dialog.name"),e[53]=r,e[54]=le):le=e[54];let ne;e[55]!==le?(ne=l.jsx(Ns,{className:"text-xs",children:le}),e[55]=le,e[56]=ne):ne=e[56];let me;e[57]===Symbol.for("react.memo_cache_sentinel")?(me=be=>m(be.target.value),e[57]=me):me=e[57];let ge;e[58]!==d?(ge=l.jsx(ds,{value:d,onChange:me,placeholder:"PLP ranking"}),e[58]=d,e[59]=ge):ge=e[59];let ve;e[60]!==ne||e[61]!==ge?(ve=l.jsxs("div",{className:"flex flex-col gap-1",children:[ne,ge]}),e[60]=ne,e[61]=ge,e[62]=ve):ve=e[62],e[63]!==he||e[64]!==ve?(C=l.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[he,ve]}),e[63]=he,e[64]=ve,e[65]=C):C=e[65],P="flex flex-col gap-1.5",T="flex items-center justify-between",p=Ns,b="text-xs",e[66]!==r?(S=r("experiments.dialog.variants"),e[66]=r,e[67]=S):S=e[67],k=" —",_=" ",$=r("experiments.dialog.weightSum",{sum:W}),e[0]=a,e[1]=o,e[2]=d,e[3]=i,e[4]=n,e[5]=r,e[6]=u,e[7]=p,e[8]=x,e[9]=h,e[10]=g,e[11]=v,e[12]=b,e[13]=y,e[14]=j,e[15]=N,e[16]=w,e[17]=S,e[18]=k,e[19]=_,e[20]=$,e[21]=T,e[22]=P,e[23]=I,e[24]=C}else p=e[7],x=e[8],h=e[9],g=e[10],v=e[11],b=e[12],y=e[13],j=e[14],N=e[15],w=e[16],S=e[17],k=e[18],_=e[19],$=e[20],T=e[21],P=e[22],I=e[23],C=e[24];let M;e[68]!==p||e[69]!==b||e[70]!==S||e[71]!==k||e[72]!==_||e[73]!==$?(M=l.jsxs(p,{className:b,children:[S,k,_,$]}),e[68]=p,e[69]=b,e[70]=S,e[71]=k,e[72]=_,e[73]=$,e[74]=M):M=e[74];let A;e[75]===Symbol.for("react.memo_cache_sentinel")?(A=()=>f(c5),e[75]=A):A=e[75];let F;e[76]!==r?(F=r("experiments.dialog.addVariant"),e[76]=r,e[77]=F):F=e[77];let E;e[78]!==F?(E=l.jsx(Se,{variant:"ghost",size:"sm",onClick:A,children:F}),e[78]=F,e[79]=E):E=e[79];let z;e[80]!==M||e[81]!==E||e[82]!==T?(z=l.jsxs("div",{className:T,children:[M,E]}),e[80]=M,e[81]=E,e[82]=T,e[83]=z):z=e[83];let R;if(e[84]!==g||e[85]!==u){let W;e[87]!==g?(W=(G,Q)=>l.jsxs("div",{className:"flex items-center gap-1.5",children:[l.jsx(ds,{value:G.id,onChange:re=>g(Q,{id:re.target.value}),placeholder:"id",size:"sm",className:"flex-1"}),l.jsx(ds,{value:G.weight,onChange:re=>g(Q,{weight:re.target.value}),inputMode:"numeric",size:"sm",className:"w-16"}),l.jsxs("select",{value:G.role,onChange:re=>g(Q,{role:re.target.value}),className:"h-8 rounded-md border border-border bg-background px-2 text-xs",children:[l.jsx("option",{value:"",children:"role…"}),l.jsx("option",{value:"control",children:"control"}),l.jsx("option",{value:"treatment",children:"treatment"})]})]},Q),e[87]=g,e[88]=W):W=e[88],R=u.map(W),e[84]=g,e[85]=u,e[86]=R}else R=e[86];let V;e[89]!==z||e[90]!==R||e[91]!==P?(V=l.jsxs("div",{className:P,children:[z,R]}),e[89]=z,e[90]=R,e[91]=P,e[92]=V):V=e[92];let K;e[93]!==a.error?(K=a.error&&l.jsx("p",{className:"text-xs text-destructive",children:a.error instanceof Error?a.error.message:"Error"}),e[93]=a.error,e[94]=K):K=e[94];let U;e[95]!==V||e[96]!==K||e[97]!==I||e[98]!==C?(U=l.jsxs("div",{className:I,children:[C,V,K]}),e[95]=V,e[96]=K,e[97]=I,e[98]=C,e[99]=U):U=e[99];let q;e[100]!==i?(q=()=>i(!1),e[100]=i,e[101]=q):q=e[101];let L;e[102]!==r?(L=r("experiments.dialog.cancel"),e[102]=r,e[103]=L):L=e[103];let B;e[104]!==q||e[105]!==L?(B=l.jsx(Se,{variant:"outline",onClick:q,children:L}),e[104]=q,e[105]=L,e[106]=B):B=e[106];let Y;e[107]!==a.isPending||e[108]!==o||e[109]!==d?(Y=a.isPending||!o.trim()||!d.trim(),e[107]=a.isPending,e[108]=o,e[109]=d,e[110]=Y):Y=e[110];let J;e[111]!==r?(J=r("experiments.dialog.create"),e[111]=r,e[112]=J):J=e[112];let X;e[113]!==v||e[114]!==Y||e[115]!==J?(X=l.jsx(Se,{onClick:v,disabled:Y,children:J}),e[113]=v,e[114]=Y,e[115]=J,e[116]=X):X=e[116];let ee;e[117]!==B||e[118]!==X?(ee=l.jsxs(Aa,{children:[B,X]}),e[117]=B,e[118]=X,e[119]=ee):ee=e[119];let te;e[120]!==x||e[121]!==y||e[122]!==j||e[123]!==U||e[124]!==ee?(te=l.jsxs(x,{className:y,children:[j,U,ee]}),e[120]=x,e[121]=y,e[122]=j,e[123]=U,e[124]=ee,e[125]=te):te=e[125];let D;return e[126]!==h||e[127]!==N||e[128]!==w||e[129]!==te?(D=l.jsx(h,{open:N,onOpenChange:w,children:te}),e[126]=h,e[127]=N,e[128]=w,e[129]=te,e[130]=D):D=e[130],D}function c5(t){return[...t,{id:"",weight:"0",role:""}]}function d5(t){return{id:t.id.trim(),weight:Number(t.weight)||0,role:t.role||null}}function m5(t,e){return t+(Number(e.weight)||0)}const u5={purchase:"experiments.results.goalName.purchase",experience_impression:"experiments.results.goalName.experience_impression",visitors:"experiments.results.visitors"};function Wd(t,e){const s=u5[t];return s?e(s):t}const Ud={draft:"experiments.status.draft",running:"experiments.status.running",paused:"experiments.status.paused",ended:"experiments.status.ended"},Gd={few:"text-muted-foreground",unclear:"text-foreground",notWorse:"text-foreground",better:"text-success",worse:"text-destructive"},di=(t,e)=>new Intl.NumberFormat(void 0,e).format(t),Is=t=>di(t,{maximumFractionDigits:0}),va=t=>di(t,{minimumFractionDigits:1,maximumFractionDigits:1}),Bt=(t,e=1)=>di(t,{style:"percent",minimumFractionDigits:e,maximumFractionDigits:e}),it=(t,e=1)=>di(t,{style:"percent",signDisplay:"exceptZero",minimumFractionDigits:e,maximumFractionDigits:e}),Qr=(t,e)=>di(t,{style:"currency",currency:e}),Mc=(t,e)=>t!==null&&e?t/e:null;function f5(t,e){const s=Math.round(t);return s>=60?e("experiments.results.minutes",{m:Math.floor(s/60),s:s%60}):e("experiments.results.seconds",{s})}const p5=40;function Ic(t,e){const s=t.find(n=>n.id===e)?.description?.trim();return s&&s.length<=p5&&!/[\r\n]/.test(s)?s:e}function x5(t,e){const s=t.arms??[],n=d=>e.find(m=>m.id===d)?.weight??null;if(s.length===0){const d=t.goals.find(u=>u.goal!=="visitors"),m=u=>{const f=e.find(p=>u==="default"?p.role==="control":p.role==="treatment");return{id:f?.id??u,name:Ic(e,f?.id??u),role:u==="default"?"control":"test",weight:f?.weight??null,visitors:t.visitors[u],exposed:null,counts:{successes:d?.[u]??0,total:t.visitors[u]},purchases:null,revenue:null,behaviour:null,daily:[]}};return[m("default"),m("variant")]}const i=e.find(d=>d.role==="control")?.id??s[0]?.id,r=e.find(d=>d.role==="treatment")?.id??s.find(d=>d.id!==i)?.id,a=s.some(d=>(d.exposed??0)>0),o=d=>a?{successes:d.convertersAmongExposed??0,total:d.exposed??0}:{successes:d.converters,total:d.visitors},c=d=>d===i?0:d===r?1:2;return[...s].sort((d,m)=>c(d.id)-c(m.id)).map(d=>({id:d.id,name:Ic(e,d.id),role:d.id===i?"control":d.id===r?"test":null,weight:n(d.id),visitors:d.visitors,exposed:d.exposed,counts:o(d),purchases:d.purchases,revenue:d.revenue,behaviour:d.behaviour,daily:d.daily.map(m=>({date:m.date,counts:o(m)}))}))}function mi(t){const e=O.c(7),{title:s,children:n}=t;let i;e[0]!==s?(i=l.jsx("h3",{className:"border-b border-border px-4 py-3 text-sm font-medium text-foreground",children:s}),e[0]=s,e[1]=i):i=e[1];let r;e[2]!==n?(r=l.jsx("div",{className:"overflow-x-auto",children:n}),e[2]=n,e[3]=r):r=e[3];let a;return e[4]!==i||e[5]!==r?(a=l.jsxs("section",{className:"surface overflow-hidden",children:[i,r]}),e[4]=i,e[5]=r,e[6]=a):a=e[6],a}function yt(t){const e=O.c(15),{label:s,hint:n,left:i}=t,r=!i&&"text-right";let a;e[0]!==r?(a=ye("whitespace-nowrap",r),e[0]=r,e[1]=a):a=e[1];const o=a;if(!n){let f;return e[2]!==o||e[3]!==s?(f=l.jsx(dt,{className:o,children:s}),e[2]=o,e[3]=s,e[4]=f):f=e[4],f}let c;e[5]!==s?(c=l.jsx(ll,{asChild:!0,children:l.jsx("span",{className:"cursor-help underline decoration-dotted underline-offset-4",children:s})}),e[5]=s,e[6]=c):c=e[6];let d;e[7]!==n?(d=l.jsx(nl,{className:"max-w-64",children:n}),e[7]=n,e[8]=d):d=e[8];let m;e[9]!==c||e[10]!==d?(m=l.jsxs(il,{children:[c,d]}),e[9]=c,e[10]=d,e[11]=m):m=e[11];let u;return e[12]!==o||e[13]!==m?(u=l.jsx(dt,{className:o,children:m}),e[12]=o,e[13]=m,e[14]=u):u=e[14],u}function h5(t){const e=O.c(16),{arm:s}=t,n=ie();let i;e[0]!==s.name?(i=l.jsx("span",{className:"font-medium",children:s.name}),e[0]=s.name,e[1]=i):i=e[1];let r;e[2]!==s.id||e[3]!==s.name?(r=s.name!==s.id&&l.jsx("span",{className:"font-mono text-xs text-muted-foreground",children:s.id}),e[2]=s.id,e[3]=s.name,e[4]=r):r=e[4];let a;e[5]!==s.role||e[6]!==n?(a=s.role&&l.jsx(Ye,{variant:s.role==="control"?"outline":"secondary",children:n(s.role==="control"?"experiments.results.control":"experiments.results.test")}),e[5]=s.role,e[6]=n,e[7]=a):a=e[7];let o;e[8]!==s.weight||e[9]!==n?(o=s.weight!==null&&l.jsx("span",{className:"text-xs text-muted-foreground",children:n("experiments.results.weight",{weight:s.weight})}),e[8]=s.weight,e[9]=n,e[10]=o):o=e[10];let c;return e[11]!==i||e[12]!==r||e[13]!==a||e[14]!==o?(c=l.jsxs("div",{className:"flex items-center gap-2 whitespace-nowrap",children:[i,r,a,o]}),e[11]=i,e[12]=r,e[13]=a,e[14]=o,e[15]=c):c=e[15],c}const ba="",Ac=t=>`${ba}${t}${ba}`;function Lc(t,e){return t.split(ba).map((s,n)=>n%2===1?l.jsx(Z.Fragment,{children:e[s]},s):s)}function Xr(t){const e=O.c(7),{label:s,hint:n}=t;let i;e[0]!==s?(i=l.jsx(ll,{asChild:!0,children:l.jsx("span",{tabIndex:0,className:"cursor-help underline decoration-muted-foreground/60 decoration-dotted underline-offset-4",children:s})}),e[0]=s,e[1]=i):i=e[1];let r;e[2]!==n?(r=l.jsx(nl,{className:"max-w-72",children:n}),e[2]=n,e[3]=r):r=e[3];let a;return e[4]!==i||e[5]!==r?(a=l.jsxs(il,{children:[i,r]}),e[4]=i,e[5]=r,e[6]=a):a=e[6],a}function g5(){const t=O.c(25),e=ie();let s;t[0]!==e?(s=e("experiments.results.glossary.significant"),t[0]=e,t[1]=s):s=t[1];let n;t[2]!==e?(n=e("experiments.results.glossary.significantHint"),t[2]=e,t[3]=n):n=t[3];let i;t[4]!==s||t[5]!==n?(i=l.jsx(Xr,{label:s,hint:n}),t[4]=s,t[5]=n,t[6]=i):i=t[6];let r;t[7]!==e?(r=e("experiments.results.glossary.exposed"),t[7]=e,t[8]=r):r=t[8];let a;t[9]!==e?(a=e("experiments.results.glossary.exposedHint"),t[9]=e,t[10]=a):a=t[10];let o;t[11]!==r||t[12]!==a?(o=l.jsx(Xr,{label:r,hint:a}),t[11]=r,t[12]=a,t[13]=o):o=t[13];let c;t[14]!==e?(c=e("experiments.results.glossary.margin"),t[14]=e,t[15]=c):c=t[15];let d;t[16]!==e?(d=e("experiments.results.glossary.marginHint"),t[16]=e,t[17]=d):d=t[17];let m;t[18]!==c||t[19]!==d?(m=l.jsx(Xr,{label:c,hint:d}),t[18]=c,t[19]=d,t[20]=m):m=t[20];let u;return t[21]!==i||t[22]!==o||t[23]!==m?(u={significant:i,exposed:o,margin:m},t[21]=i,t[22]=o,t[23]=m,t[24]=u):u=t[24],u}function Dc(t,e){return t>=.995?e("experiments.results.chanceAbove"):t<.005?e("experiments.results.chanceBelow"):Bt(t,0)}const qs=t=>Bt(Math.abs(t),0),ja="repeating-linear-gradient(to bottom, var(--muted-foreground) 0 4px, transparent 4px 7px)",v5=[.1,.05,.02],Di={few:"bg-muted-foreground",unclear:"bg-foreground",notWorse:"bg-foreground",better:"bg-success",worse:"bg-destructive"};function b5(t){const e=O.c(131),{c:s,test:n,control:i}=t,r=ie();if(s.lift===null||s.low===null||s.high===null)return null;const{lift:a,low:o,high:c}=s;let d,m,u,f,p;if(e[0]!==s.verdict||e[1]!==i||e[2]!==c||e[3]!==a||e[4]!==o||e[5]!==r||e[6]!==n){const C=Bd([o,c]),M=ke=>(ke-C.min)/(C.max-C.min)*100,A=M(c)-M(o)<22,F=C.ticks.indexOf(0);let E;e[12]!==i||e[13]!==c||e[14]!==a||e[15]!==o||e[16]!==r||e[17]!==n?(E=r("experiments.results.range",{low:it(o,0),high:it(c,0)}),u="flex flex-col gap-1.5",f=r("experiments.results.chart.aria",{test:n,control:i,lift:it(a),range:E}),e[12]=i,e[13]=c,e[14]=a,e[15]=o,e[16]=r,e[17]=n,e[18]=E,e[19]=u,e[20]=f):(E=e[18],u=e[19],f=e[20]);const z=`${M(0)}%`;let R;e[21]!==z?(R=l.jsx("div",{className:"absolute inset-y-0 left-0 rounded-l-md",style:{width:z,background:"color-mix(in oklch, var(--destructive) 7%, transparent)"}}),e[21]=z,e[22]=R):R=e[22];const V=`${M(0)}%`;let K;e[23]!==V?(K=l.jsx("div",{className:"absolute inset-y-0 right-0 rounded-r-md",style:{left:V,background:"color-mix(in oklch, var(--success) 7%, transparent)"}}),e[23]=V,e[24]=K):K=e[24];let U;e[25]!==r?(U=r("experiments.results.chart.worse"),e[25]=r,e[26]=U):U=e[26];let q;e[27]!==U?(q=l.jsx("span",{className:"absolute top-2 left-2.5 text-xs text-muted-foreground",children:U}),e[27]=U,e[28]=q):q=e[28];let L;e[29]!==r?(L=r("experiments.results.chart.better"),e[29]=r,e[30]=L):L=e[30];let B;e[31]!==L?(B=l.jsx("span",{className:"absolute top-2 right-2.5 text-xs text-muted-foreground",children:L}),e[31]=L,e[32]=B):B=e[32];const Y=`${M(ms)}%`;let J;e[33]!==Y?(J=l.jsx("div",{className:"absolute inset-y-0 w-px -translate-x-1/2",style:{left:Y,background:ja}}),e[33]=Y,e[34]=J):J=e[34];const X=`${M(ms)}%`;let ee;e[35]!==X?(ee={left:X},e[35]=X,e[36]=ee):ee=e[36];let te;e[37]===Symbol.for("react.memo_cache_sentinel")?(te=it(ms,0),e[37]=te):te=e[37];let D;e[38]!==ee?(D=l.jsx("span",{className:"absolute bottom-1.5 -translate-x-full pr-1.5 text-xs tabular-nums text-muted-foreground",style:ee,children:te}),e[38]=ee,e[39]=D):D=e[39];const W=`${M(0)}%`;let G;e[40]!==W?(G=l.jsx("div",{className:"absolute inset-y-0 w-px -translate-x-1/2",style:{left:W,background:"var(--foreground)",opacity:.5}}),e[40]=W,e[41]=G):G=e[41];const Q=`${M(o)}%`,re=`${M(c)-M(o)}%`;let ce;e[42]!==Q||e[43]!==re?(ce={left:Q,width:re},e[42]=Q,e[43]=re,e[44]=ce):ce=e[44];const ae=Di[s.verdict];let fe;e[45]!==ae?(fe=ye("absolute inset-x-0 top-1/2 h-1.5 -translate-y-1/2 rounded-full",ae),e[45]=ae,e[46]=fe):fe=e[46];let de;e[47]!==fe?(de=l.jsx("span",{className:fe}),e[47]=fe,e[48]=de):de=e[48];let se;e[49]!==E||e[50]!==ce||e[51]!==de?(se=l.jsx(ll,{asChild:!0,children:l.jsx("button",{type:"button","aria-label":E,className:"absolute top-1/2 h-6 -translate-y-1/2 cursor-help rounded-full outline-none focus-visible:ring-2 focus-visible:ring-ring",style:ce,children:de})}),e[49]=E,e[50]=ce,e[51]=de,e[52]=se):se=e[52];let H;e[53]!==a||e[54]!==E||e[55]!==r?(H=r("experiments.results.chart.tooltip",{lift:it(a),range:E}),e[53]=a,e[54]=E,e[55]=r,e[56]=H):H=e[56];let oe;e[57]!==H?(oe=l.jsx(nl,{className:"max-w-64",children:H}),e[57]=H,e[58]=oe):oe=e[58];let he;e[59]!==se||e[60]!==oe?(he=l.jsxs(il,{children:[se,oe]}),e[59]=se,e[60]=oe,e[61]=he):he=e[61];const le=Di[s.verdict];let ne;e[62]!==le?(ne=ye("pointer-events-none absolute top-1/2 size-3.5 -translate-x-1/2 -translate-y-1/2 rounded-full ring-2 ring-card",le),e[62]=le,e[63]=ne):ne=e[63];const me=`${M(a)}%`;let ge;e[64]!==me?(ge={left:me},e[64]=me,e[65]=ge):ge=e[65];let ve;e[66]!==ne||e[67]!==ge?(ve=l.jsx("span",{className:ne,style:ge}),e[66]=ne,e[67]=ge,e[68]=ve):ve=e[68];const be=`${M(a)}%`;let we;e[69]!==be?(we={left:be},e[69]=be,e[70]=we):we=e[70];let $e;e[71]!==a?($e=it(a),e[71]=a,e[72]=$e):$e=e[72];let je;e[73]!==we||e[74]!==$e?(je=l.jsx("span",{className:"absolute top-[calc(50%-1.75rem)] -translate-x-1/2 text-sm font-semibold tabular-nums text-foreground",style:we,children:$e}),e[73]=we,e[74]=$e,e[75]=je):je=e[75];let xe;e[76]!==M||e[77]!==c||e[78]!==a||e[79]!==o||e[80]!==A||e[81]!==E?(xe=A?l.jsx("span",{className:"absolute top-[calc(50%+0.75rem)] -translate-x-1/2 whitespace-nowrap text-xs tabular-nums text-muted-foreground",style:{left:`${M(a)}%`},children:E}):l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"absolute top-[calc(50%+0.75rem)] text-xs tabular-nums text-muted-foreground",style:{left:`${M(o)}%`},children:it(o,0)}),l.jsx("span",{className:"absolute top-[calc(50%+0.75rem)] -translate-x-full text-xs tabular-nums text-muted-foreground",style:{left:`${M(c)}%`},children:it(c,0)})]}),e[76]=M,e[77]=c,e[78]=a,e[79]=o,e[80]=A,e[81]=E,e[82]=xe):xe=e[82],e[83]!==q||e[84]!==B||e[85]!==J||e[86]!==D||e[87]!==G||e[88]!==he||e[89]!==ve||e[90]!==je||e[91]!==xe||e[92]!==R||e[93]!==K?(p=l.jsxs("div",{className:"relative h-24 select-none",children:[R,K,q,B,J,D,G,he,ve,je,xe]}),e[83]=q,e[84]=B,e[85]=J,e[86]=D,e[87]=G,e[88]=he,e[89]=ve,e[90]=je,e[91]=xe,e[92]=R,e[93]=K,e[94]=p):p=e[94],d="relative h-4 text-xs tabular-nums text-muted-foreground",m=C.ticks.map((ke,_e)=>l.jsx("span",{className:ye("absolute",(_e-F)%2!==0&&"max-sm:hidden",_e===0?"":_e===C.ticks.length-1?"-translate-x-full":"-translate-x-1/2"),style:{left:`${M(ke)}%`},children:it(ke,0)},ke)),e[0]=s.verdict,e[1]=i,e[2]=c,e[3]=a,e[4]=o,e[5]=r,e[6]=n,e[7]=d,e[8]=m,e[9]=u,e[10]=f,e[11]=p}else d=e[7],m=e[8],u=e[9],f=e[10],p=e[11];let x;e[95]!==d||e[96]!==m?(x=l.jsx("div",{className:d,children:m}),e[95]=d,e[96]=m,e[97]=x):x=e[97];const h=Di[s.verdict];let g;e[98]!==h?(g=ye("size-2.5 rounded-full",h),e[98]=h,e[99]=g):g=e[99];let v;e[100]!==g?(v=l.jsx("span",{className:g}),e[100]=g,e[101]=v):v=e[101];let b;e[102]!==r?(b=r("experiments.results.chart.measured"),e[102]=r,e[103]=b):b=e[103];let y;e[104]!==b||e[105]!==v?(y=l.jsxs("span",{className:"flex items-center gap-1.5",children:[v,b]}),e[104]=b,e[105]=v,e[106]=y):y=e[106];const j=Di[s.verdict];let N;e[107]!==j?(N=ye("h-1.5 w-4 rounded-full",j),e[107]=j,e[108]=N):N=e[108];let w;e[109]!==N?(w=l.jsx("span",{className:N}),e[109]=N,e[110]=w):w=e[110];let S;e[111]!==r?(S=r("experiments.results.chart.range"),e[111]=r,e[112]=S):S=e[112];let k;e[113]!==w||e[114]!==S?(k=l.jsxs("span",{className:"flex items-center gap-1.5",children:[w,S]}),e[113]=w,e[114]=S,e[115]=k):k=e[115];let _;e[116]===Symbol.for("react.memo_cache_sentinel")?(_=l.jsx("span",{className:"h-3 w-px",style:{background:ja}}),e[116]=_):_=e[116];let $;e[117]!==r?($=r("experiments.results.chart.bar",{bar:it(ms,0)}),e[117]=r,e[118]=$):$=e[118];let T;e[119]!==$?(T=l.jsxs("span",{className:"flex items-center gap-1.5",children:[_,$]}),e[119]=$,e[120]=T):T=e[120];let P;e[121]!==y||e[122]!==k||e[123]!==T?(P=l.jsxs("figcaption",{className:"flex flex-wrap gap-x-4 gap-y-1 pt-1 text-xs text-muted-foreground",children:[y,k,T]}),e[121]=y,e[122]=k,e[123]=T,e[124]=P):P=e[124];let I;return e[125]!==P||e[126]!==u||e[127]!==f||e[128]!==p||e[129]!==x?(I=l.jsxs("figure",{className:u,"aria-label":f,children:[p,x,P]}),e[125]=P,e[126]=u,e[127]=f,e[128]=p,e[129]=x,e[130]=I):I=e[130],I}function Oi(t){const e=O.c(10),{label:s,value:n,note:i}=t;let r;e[0]!==s?(r=l.jsx("dt",{className:"text-sm text-muted-foreground",children:s}),e[0]=s,e[1]=r):r=e[1];let a;e[2]!==n?(a=l.jsx("dd",{className:"text-base font-semibold tabular-nums text-foreground",children:n}),e[2]=n,e[3]=a):a=e[3];let o;e[4]!==i?(o=i&&l.jsx("dd",{className:"text-xs text-muted-foreground",children:i}),e[4]=i,e[5]=o):o=e[5];let c;return e[6]!==r||e[7]!==a||e[8]!==o?(c=l.jsxs("div",{className:"flex flex-col gap-0.5 border-t border-border py-3",children:[r,a,o]}),e[6]=r,e[7]=a,e[8]=o,e[9]=c):c=e[9],c}function j5(){const t=O.c(37),e=ie();let s;t[0]!==e?(s=e("experiments.results.howTo.title"),t[0]=e,t[1]=s):s=t[1];let n;t[2]!==s?(n=l.jsx("summary",{className:"cursor-pointer select-none font-medium text-foreground outline-none focus-visible:underline",children:s}),t[2]=s,t[3]=n):n=t[3];let i;t[4]!==e?(i=e("experiments.results.howTo.range"),t[4]=e,t[5]=i):i=t[5];let r;t[6]!==i?(r=l.jsx("p",{children:i}),t[6]=i,t[7]=r):r=t[7];let a;t[8]!==e?(a=e("experiments.results.howTo.early"),t[8]=e,t[9]=a):a=t[9];let o;t[10]!==a?(o=l.jsx("p",{children:a}),t[10]=a,t[11]=o):o=t[11];let c;t[12]!==e?(c=e("experiments.results.howTo.looks"),t[12]=e,t[13]=c):c=t[13];let d;t[14]!==c?(d=l.jsx("p",{children:c}),t[14]=c,t[15]=d):d=t[15];let m;t[16]!==e?(m=e("experiments.results.howTo.calendar"),t[16]=e,t[17]=m):m=t[17];let u;t[18]!==m?(u=l.jsx("p",{children:m}),t[18]=m,t[19]=u):u=t[19];let f;t[20]===Symbol.for("react.memo_cache_sentinel")?(f=["margin","significant","exposed"],t[20]=f):f=t[20];let p;t[21]!==e?(p=l.jsx("dl",{className:"grid gap-x-4 gap-y-1.5 pt-1 sm:grid-cols-[max-content_1fr]",children:f.map(b=>l.jsxs(Z.Fragment,{children:[l.jsx("dt",{className:"font-medium text-foreground",children:e(`experiments.results.glossary.${b}Title`)}),l.jsx("dd",{children:e(`experiments.results.glossary.${b}Hint`)})]},b))}),t[21]=e,t[22]=p):p=t[22];let x;t[23]!==e?(x=e("experiments.results.howTo.method",{deff:va(go),bar:it(ms,0)}),t[23]=e,t[24]=x):x=t[24];let h;t[25]!==x?(h=l.jsx("p",{className:"text-xs",children:x}),t[25]=x,t[26]=h):h=t[26];let g;t[27]!==p||t[28]!==h||t[29]!==r||t[30]!==o||t[31]!==d||t[32]!==u?(g=l.jsxs("div",{className:"flex max-w-3xl flex-col gap-2 pt-3 text-muted-foreground",children:[r,o,d,u,p,h]}),t[27]=p,t[28]=h,t[29]=r,t[30]=o,t[31]=d,t[32]=u,t[33]=g):g=t[33];let v;return t[34]!==n||t[35]!==g?(v=l.jsxs("details",{className:"group rounded-md border border-border px-4 py-3 text-sm",children:[n,g]}),t[34]=n,t[35]=g,t[36]=v):v=t[36],v}function y5(t){const e=O.c(36),{control:s,test:n,exposure:i,days:r}=t,a=ie(),o=g5();let c,d,m,u,f,p,x,h;if(e[0]!==s.counts||e[1]!==s.name||e[2]!==r||e[3]!==i||e[4]!==a||e[5]!==o||e[6]!==n.counts||e[7]!==n.name){const j=bo(s.counts,n.counts),N={arm:n.name,test:n.name,control:s.name},w=j.verdict==="few"||j.verdict==="unclear"?a(`experiments.results.verdict.${j.verdict}`):a(`experiments.results.verdict.${j.verdict}`,N),S=[];if(j.lift===null)S.push(a("experiments.results.verdict.noBase"));else{if(S.push(Lc(a(i?"experiments.results.verdict.compareExposed":"experiments.results.verdict.compareVisitors",{...N,testRate:Bt(j.treatmentRate),controlRate:Bt(j.controlRate),exposed:Ac("exposed")}),o)),j.verdict==="few")S.push(a("experiments.results.verdict.fewHint",{total:zd,successes:Vd}));else{const C=j.verdict==="better"?"experiments.results.claim.better":j.verdict==="worse"?"experiments.results.claim.worse":j.verdict==="notWorse"?"experiments.results.claim.notWorse":j.lift<0?"experiments.results.claim.lower":j.lift>0?"experiments.results.claim.higher":"experiments.results.claim.even";S.push(Lc(a(C,{...N,significant:Ac("significant"),bar:qs(ms)}),o))}j.low!==null&&j.high!==null&&S.push(j.low<0&&j.high>0?a("experiments.results.range.cross",{low:qs(j.low),high:qs(j.high)}):j.low>=0?a("experiments.results.range.above",{near:qs(j.low),far:qs(j.high)}):a("experiments.results.range.below",{near:qs(j.high),far:qs(j.low)}))}const k=j.margin,_=k===null?void 0:v5.find(C=>C<k),$=_===void 0?null:l5(s.counts,n.counts,r,_),T=j.verdict!=="few"&&j.pBetter!==null;c=[r>0&&a(r===1?"experiments.results.progress.runningOne":"experiments.results.progress.running",{days:r}),$&&_!==void 0&&$.evenSplitDays<$.days&&a($.evenSplitDays===1?"experiments.results.progress.evenSplitOne":"experiments.results.progress.evenSplit",{days:Is($.evenSplitDays),margin:Bt(_,0)})].filter(Boolean),p="surface flex flex-col gap-5 p-5 md:p-6";const P=Gd[j.verdict];let I;e[16]!==P?(I=ye("text-2xl font-semibold text-balance",P),e[16]=P,e[17]=I):I=e[17],x=l.jsxs("div",{className:"flex flex-col gap-2",children:[l.jsx("h3",{className:I,children:w}),l.jsx("p",{className:"max-w-3xl text-sm leading-relaxed text-foreground",children:S.map(w5)})]}),h=l.jsx(b5,{c:j,test:n.name,control:s.name}),d="grid gap-x-8 sm:grid-cols-2",m=T&&j.pBetter!==null&&j.pBetterTarget!==null&&l.jsxs(l.Fragment,{children:[l.jsx(Oi,{label:a("experiments.results.fact.better",N),value:Dc(j.pBetter,a)}),l.jsx(Oi,{label:a("experiments.results.fact.target",{target:Bt(qd,0)}),value:Dc(j.pBetterTarget,a)})]}),e[18]!==j||e[19]!==T||e[20]!==a?(u=T&&j.safety&&j.notWorseAt!==null&&l.jsx(Oi,{label:a("experiments.results.fact.safety",{bar:it(ms,0)}),value:a(`experiments.results.safety.${j.safety}`),note:j.safety==="open"?a("experiments.results.safety.openNote",{bar:it(j.notWorseAt)}):void 0}),e[18]=j,e[19]=T,e[20]=a,e[21]=u):u=e[21],f=k!==null&&l.jsx(Oi,{label:o.margin,value:`±${Bt(k,0)}`,note:_===void 0?void 0:$===null?a("experiments.results.forecast.unknown"):$.days===0?a("experiments.results.forecast.reached",{margin:Bt(_,0)}):a($.days===1?"experiments.results.forecast.leftOne":"experiments.results.forecast.left",{margin:Bt(_,0),days:Is($.days),exposed:Is($.exposed)})}),e[0]=s.counts,e[1]=s.name,e[2]=r,e[3]=i,e[4]=a,e[5]=o,e[6]=n.counts,e[7]=n.name,e[8]=c,e[9]=d,e[10]=m,e[11]=u,e[12]=f,e[13]=p,e[14]=x,e[15]=h}else c=e[8],d=e[9],m=e[10],u=e[11],f=e[12],p=e[13],x=e[14],h=e[15];let g;e[22]!==d||e[23]!==m||e[24]!==u||e[25]!==f?(g=l.jsxs("dl",{className:d,children:[m,u,f]}),e[22]=d,e[23]=m,e[24]=u,e[25]=f,e[26]=g):g=e[26];let v;e[27]!==c?(v=c.length>0&&l.jsx("p",{className:"text-xs text-muted-foreground",children:c.join(" ")}),e[27]=c,e[28]=v):v=e[28];let b;e[29]===Symbol.for("react.memo_cache_sentinel")?(b=l.jsx(j5,{}),e[29]=b):b=e[29];let y;return e[30]!==p||e[31]!==x||e[32]!==h||e[33]!==g||e[34]!==v?(y=l.jsxs("section",{className:p,children:[x,h,g,v,b]}),e[30]=p,e[31]=x,e[32]=h,e[33]=g,e[34]=v,e[35]=y):y=e[35],y}function w5(t,e){return l.jsxs(Z.Fragment,{children:[e>0&&" ",t]},e)}const N5=t=>new Date(`${t}T00:00:00Z`).toLocaleDateString(void 0,{day:"2-digit",month:"2-digit",timeZone:"UTC"});function k5(t){const e=O.c(70),{control:s,test:n}=t,i=ie();let r,a,o;if(e[0]!==s.daily||e[1]!==n.daily){o=Symbol.for("react.early_return_sentinel");e:{const B=n5(s.daily,n.daily).filter(T5);if(B.length<2){o=null;break e}r=Bd(B.flatMap($5)),a=B.map(_5)}e[0]=s.daily,e[1]=n.daily,e[2]=r,e[3]=a,e[4]=o}else r=e[2],a=e[3],o=e[4];if(o!==Symbol.for("react.early_return_sentinel"))return o;const c=a;let d;e[5]!==i?(d=i("experiments.results.chart.measured"),e[5]=i,e[6]=d):d=e[6];let m;e[7]!==d?(m={label:d,color:"var(--chart-1)"},e[7]=d,e[8]=m):m=e[8];let u;e[9]!==i?(u=i("experiments.results.chart.range"),e[9]=i,e[10]=u):u=e[10];let f;e[11]!==u?(f={label:u,color:"var(--chart-1)"},e[11]=u,e[12]=f):f=e[12];let p;e[13]!==m||e[14]!==f?(p={lift:m,band:f},e[13]=m,e[14]=f,e[15]=p):p=e[15];const x=p;let h;e[16]!==i?(h=i("experiments.results.liftTrend"),e[16]=i,e[17]=h):h=e[17];let g;e[18]!==i?(g=i("experiments.results.liftTrendHint"),e[18]=i,e[19]=g):g=e[19];let v;e[20]!==g?(v=l.jsx("p",{className:"max-w-3xl text-sm text-muted-foreground",children:g}),e[20]=g,e[21]=v):v=e[21];let b;e[22]===Symbol.for("react.memo_cache_sentinel")?(b=l.jsx("span",{className:"h-0.5 w-4 rounded-full",style:{background:"var(--chart-1)"}}),e[22]=b):b=e[22];let y;e[23]!==i?(y=i("experiments.results.chart.measuredTotal"),e[23]=i,e[24]=y):y=e[24];let j;e[25]!==y?(j=l.jsxs("span",{className:"flex items-center gap-1.5",children:[b,y]}),e[25]=y,e[26]=j):j=e[26];let N;e[27]===Symbol.for("react.memo_cache_sentinel")?(N=l.jsx("span",{className:"h-3 w-4 rounded-sm",style:{background:"color-mix(in oklch, var(--chart-1) 25%, transparent)"}}),e[27]=N):N=e[27];let w;e[28]!==i?(w=i("experiments.results.chart.range"),e[28]=i,e[29]=w):w=e[29];let S;e[30]!==w?(S=l.jsxs("span",{className:"flex items-center gap-1.5",children:[N,w]}),e[30]=w,e[31]=S):S=e[31];let k;e[32]===Symbol.for("react.memo_cache_sentinel")?(k=l.jsx("span",{className:"h-3 w-px",style:{background:ja}}),e[32]=k):k=e[32];let _;e[33]!==i?(_=i("experiments.results.chart.bar",{bar:it(ms,0)}),e[33]=i,e[34]=_):_=e[34];let $;e[35]!==_?($=l.jsxs("span",{className:"flex items-center gap-1.5",children:[k,_]}),e[35]=_,e[36]=$):$=e[36];let T;e[37]!==j||e[38]!==S||e[39]!==$?(T=l.jsxs("div",{className:"flex flex-wrap gap-4 text-xs text-muted-foreground",children:[j,S,$]}),e[37]=j,e[38]=S,e[39]=$,e[40]=T):T=e[40];let P,I;e[41]===Symbol.for("react.memo_cache_sentinel")?(P={top:8,right:8,bottom:0,left:0},I=l.jsx(Ft,{vertical:!1,strokeDasharray:"4 4"}),e[41]=P,e[42]=I):(P=e[41],I=e[42]);let C;e[43]===Symbol.for("react.memo_cache_sentinel")?(C=l.jsx(zt,{dataKey:"label",tickLine:!1,axisLine:!1,tickMargin:10,padding:{left:16,right:16}}),e[43]=C):C=e[43];let M;e[44]!==r.max||e[45]!==r.min?(M=[r.min,r.max],e[44]=r.max,e[45]=r.min,e[46]=M):M=e[46];let A;e[47]!==r.ticks||e[48]!==M?(A=l.jsx(At,{tickLine:!1,axisLine:!1,width:52,ticks:r.ticks,domain:M,tickFormatter:S5}),e[47]=r.ticks,e[48]=M,e[49]=A):A=e[49];let F,E;e[50]===Symbol.for("react.memo_cache_sentinel")?(F=l.jsx(Ls,{y:0,stroke:"var(--foreground)",strokeOpacity:.45}),E=l.jsx(Ls,{y:ms,stroke:"var(--muted-foreground)",strokeDasharray:"4 4"}),e[50]=F,e[51]=E):(F=e[50],E=e[51]);let z;e[52]!==i?(z=l.jsx(C1,{content:B=>{const{active:Y,payload:J,label:X}=B,ee=J?.[0]?.payload;return!Y||!ee||ee.lift===null?null:l.jsxs("div",{className:"surface flex flex-col gap-0.5 px-3 py-2 text-xs shadow-md",children:[l.jsx("span",{className:"font-medium text-foreground",children:X}),l.jsx("span",{className:"tabular-nums text-foreground",children:i("experiments.results.chart.tooltipDay",{lift:it(ee.lift)})}),l.jsx("span",{className:"tabular-nums text-muted-foreground",children:i("experiments.results.range",{low:it(ee.band[0]??0,0),high:it(ee.band[1]??0,0)})})]})}}),e[52]=i,e[53]=z):z=e[53];let R;e[54]===Symbol.for("react.memo_cache_sentinel")?(R=l.jsx(Gt,{dataKey:"band",type:"monotone",stroke:"none",fill:"var(--chart-1)",fillOpacity:.18,isAnimationActive:!1}),e[54]=R):R=e[54];let V;e[55]===Symbol.for("react.memo_cache_sentinel")?(V=l.jsx(rs,{dataKey:"lift",type:"monotone",stroke:"var(--chart-1)",strokeWidth:2,dot:{r:3},isAnimationActive:!1}),e[55]=V):V=e[55];let K;e[56]!==c||e[57]!==A||e[58]!==z?(K=l.jsxs(Gs,{data:c,margin:P,children:[I,C,A,F,E,z,R,V]}),e[56]=c,e[57]=A,e[58]=z,e[59]=K):K=e[59];let U;e[60]!==x||e[61]!==K?(U=l.jsx(It,{config:x,className:"aspect-auto h-60 w-full",children:K}),e[60]=x,e[61]=K,e[62]=U):U=e[62];let q;e[63]!==v||e[64]!==T||e[65]!==U?(q=l.jsxs("div",{className:"flex flex-col gap-3 p-4",children:[v,T,U]}),e[63]=v,e[64]=T,e[65]=U,e[66]=q):q=e[66];let L;return e[67]!==q||e[68]!==h?(L=l.jsx(mi,{title:h,children:q}),e[67]=q,e[68]=h,e[69]=L):L=e[69],L}function S5(t){return it(t,0)}function _5(t){return{label:N5(t.date),lift:t.lift,band:[t.low,t.high]}}function $5(t){return[t.low??0,t.high??0]}function T5(t){return t.lift!==null&&t.low!==null&&t.high!==null}function P5(t){const e=O.c(69),{arms:s,exposure:n,goal:i,currency:r}=t,a=ie();let o,c,d,m,u,f,p;if(e[0]!==s||e[1]!==r||e[2]!==n||e[3]!==i||e[4]!==a){const v=s.find(E5);let b;e[12]!==s?(b=s.some(C5),e[12]=s,e[13]=b):b=e[13];const y=b;let j;e[14]===Symbol.for("react.memo_cache_sentinel")?(j=l.jsx("span",{className:"text-muted-foreground",children:"—"}),e[14]=j):j=e[14];const N=j;d=mi,e[15]!==a?(p=a("experiments.results.armsTitle"),e[15]=a,e[16]=p):p=e[16],c=sl,u="flush";let w;e[17]!==a?(w=a("experiments.results.arm"),e[17]=a,e[18]=w):w=e[18];let S;e[19]!==w?(S=l.jsx(yt,{left:!0,label:w}),e[19]=w,e[20]=S):S=e[20];let k;e[21]!==a?(k=a("experiments.results.visitors"),e[21]=a,e[22]=k):k=e[22];let _;e[23]!==a?(_=a("experiments.results.visitorsHint"),e[23]=a,e[24]=_):_=e[24];let $;e[25]!==_||e[26]!==k?($=l.jsx(yt,{label:k,hint:_}),e[25]=_,e[26]=k,e[27]=$):$=e[27];let T;e[28]!==n||e[29]!==a?(T=n&&l.jsx(yt,{label:a("experiments.results.exposed"),hint:a("experiments.results.exposedHint")}),e[28]=n,e[29]=a,e[30]=T):T=e[30];let P;e[31]!==a?(P=a("experiments.results.conversion"),e[31]=a,e[32]=P):P=e[32];const I=n?"experiments.results.conversionHintExposed":"experiments.results.conversionHintVisitors";let C;e[33]!==i||e[34]!==a||e[35]!==I?(C=a(I,{goal:Wd(i,a)}),e[33]=i,e[34]=a,e[35]=I,e[36]=C):C=e[36];let M;e[37]!==P||e[38]!==C?(M=l.jsx(yt,{label:P,hint:C}),e[37]=P,e[38]=C,e[39]=M):M=e[39];let A;e[40]!==a?(A=a("experiments.results.difference"),e[40]=a,e[41]=A):A=e[41];let F;e[42]!==a?(F=a("experiments.results.differenceHint"),e[42]=a,e[43]=F):F=e[43];let E;e[44]!==A||e[45]!==F?(E=l.jsx(yt,{label:A,hint:F}),e[44]=A,e[45]=F,e[46]=E):E=e[46];let z;e[47]!==y||e[48]!==a?(z=y&&l.jsxs(l.Fragment,{children:[l.jsx(yt,{label:a("experiments.results.orders")}),l.jsx(yt,{label:a("experiments.results.revenue")}),l.jsx(yt,{label:a("experiments.results.revenuePerVisitor")}),l.jsx(yt,{label:a("experiments.results.averageOrder")})]}),e[47]=y,e[48]=a,e[49]=z):z=e[49],e[50]!==$||e[51]!==T||e[52]!==M||e[53]!==E||e[54]!==z||e[55]!==S?(f=l.jsx(el,{children:l.jsxs(Ut,{children:[S,$,T,M,E,z]})}),e[50]=$,e[51]=T,e[52]=M,e[53]=E,e[54]=z,e[55]=S,e[56]=f):f=e[56],o=tl,m=s.map(R=>{const V=v&&R!==v?bo(v.counts,R.counts):null,K=Mc(R.revenue,R.visitors),U=Mc(R.revenue,R.purchases);return l.jsxs(Ut,{children:[l.jsx(Le,{children:l.jsx(h5,{arm:R})}),l.jsx(Le,{className:"text-right tabular-nums",children:Is(R.visitors)}),n&&l.jsx(Le,{className:"text-right tabular-nums",children:Is(R.exposed??0)}),l.jsx(Le,{className:"text-right font-semibold tabular-nums",children:R.counts.total>0?Bt(R.counts.successes/R.counts.total):N}),l.jsx(Le,{className:"whitespace-nowrap text-right tabular-nums",children:V?V.lift===null||V.low===null||V.high===null?N:l.jsxs("div",{className:"flex flex-col items-end",children:[l.jsx("span",{className:ye("font-medium",Gd[V.verdict]),children:it(V.lift)}),l.jsx("span",{className:"text-xs text-muted-foreground",children:a("experiments.results.range",{low:it(V.low,0),high:it(V.high,0)})})]}):l.jsx("span",{className:"text-xs text-muted-foreground",children:a("experiments.results.reference")})}),y&&l.jsxs(l.Fragment,{children:[l.jsx(Le,{className:"text-right tabular-nums",children:R.purchases===null?N:Is(R.purchases)}),l.jsx(Le,{className:"whitespace-nowrap text-right tabular-nums",children:R.revenue===null?N:Qr(R.revenue,r)}),l.jsx(Le,{className:"whitespace-nowrap text-right tabular-nums",children:K===null?N:Qr(K,r)}),l.jsx(Le,{className:"whitespace-nowrap text-right tabular-nums",children:U===null?N:Qr(U,r)})]})]},R.id)}),e[0]=s,e[1]=r,e[2]=n,e[3]=i,e[4]=a,e[5]=o,e[6]=c,e[7]=d,e[8]=m,e[9]=u,e[10]=f,e[11]=p}else o=e[5],c=e[6],d=e[7],m=e[8],u=e[9],f=e[10],p=e[11];let x;e[57]!==o||e[58]!==m?(x=l.jsx(o,{children:m}),e[57]=o,e[58]=m,e[59]=x):x=e[59];let h;e[60]!==c||e[61]!==u||e[62]!==f||e[63]!==x?(h=l.jsxs(c,{variant:u,children:[f,x]}),e[60]=c,e[61]=u,e[62]=f,e[63]=x,e[64]=h):h=e[64];let g;return e[65]!==d||e[66]!==p||e[67]!==h?(g=l.jsx(d,{title:p,children:h}),e[65]=d,e[66]=p,e[67]=h,e[68]=g):g=e[68],g}function C5(t){return t.revenue!==null}function E5(t){return t.role==="control"}function M5(t){const e=O.c(56),{arms:s}=t,n=ie();let i,r,a;if(e[0]!==s){a=Symbol.for("react.early_return_sentinel");e:{const C=[...new Set(s.flatMap(A5))].sort();if(C.length<2){a=null;break e}i=C.map(M=>{const A={label:new Date(`${M}T00:00:00Z`).toLocaleDateString(void 0,{day:"2-digit",month:"2-digit",timeZone:"UTC"})};for(const F of s){const E=F.daily.find(z=>z.date===M);A[F.id]=E&&E.counts.total>0?E.counts.successes/E.counts.total:null}return A}),r=Math.max(0,...i.flatMap(M=>s.map(A=>Number(M[A.id])||0)))}e[0]=s,e[1]=i,e[2]=r,e[3]=a}else i=e[1],r=e[2],a=e[3];if(a!==Symbol.for("react.early_return_sentinel"))return a;const o=r;let c;e[4]!==o?(c=[.001,.002,.005,.01,.02,.05,.1,.2,.25].find(C=>o/C<=4)??.25,e[4]=o,e[5]=c):c=e[5];const d=c;let m;if(e[6]!==d||e[7]!==o){let C;e[9]!==d?(C=(M,A)=>A*d,e[9]=d,e[10]=C):C=e[10],m=Array.from({length:Math.ceil(o/d)+1},C),e[6]=d,e[7]=o,e[8]=m}else m=e[8];const u=m;let f;e[11]!==s?(f=Object.fromEntries(s.map(I5)),e[11]=s,e[12]=f):f=e[12];const p=f;let x;e[13]!==n?(x=n("experiments.results.trend"),e[13]=n,e[14]=x):x=e[14];let h;if(e[15]!==s||e[16]!==p){let C;e[18]!==p?(C=M=>l.jsxs("span",{className:"flex items-center gap-1.5",children:[l.jsx("span",{className:"size-2 rounded-full",style:{backgroundColor:p[M.id]?.color}}),M.name]},M.id),e[18]=p,e[19]=C):C=e[19],h=s.map(C),e[15]=s,e[16]=p,e[17]=h}else h=e[17];let g;e[20]!==h?(g=l.jsx("div",{className:"flex flex-wrap gap-4 text-xs text-muted-foreground",children:h}),e[20]=h,e[21]=g):g=e[21];let v,b;e[22]===Symbol.for("react.memo_cache_sentinel")?(b={top:8,right:8,bottom:0,left:0},v=l.jsx(Ft,{vertical:!1,strokeDasharray:"4 4"}),e[22]=v,e[23]=b):(v=e[22],b=e[23]);let y;e[24]===Symbol.for("react.memo_cache_sentinel")?(y=l.jsx(zt,{dataKey:"label",tickLine:!1,axisLine:!1,tickMargin:10,padding:{left:16,right:16}}),e[24]=y):y=e[24];let j;e[25]!==u?(j=u.at(-1)??1,e[25]=u,e[26]=j):j=e[26];let N;e[27]!==j?(N=[0,j],e[27]=j,e[28]=N):N=e[28];let w;e[29]!==d?(w=C=>Bt(C,d<.01?1:0),e[29]=d,e[30]=w):w=e[30];let S;e[31]!==N||e[32]!==w||e[33]!==u?(S=l.jsx(At,{tickLine:!1,axisLine:!1,width:48,ticks:u,domain:N,tickFormatter:w}),e[31]=N,e[32]=w,e[33]=u,e[34]=S):S=e[34];let k;e[35]!==p?(k=l.jsx(C1,{content:l.jsx(us,{formatter:(C,M)=>`${p[String(M)]?.label??M} ${Bt(Number(C))}`})}),e[35]=p,e[36]=k):k=e[36];let _;if(e[37]!==s||e[38]!==p){let C;e[40]!==p?(C=M=>l.jsx(rs,{dataKey:M.id,type:"monotone",stroke:p[M.id]?.color,strokeWidth:2,dot:{r:3},connectNulls:!0,isAnimationActive:!1},M.id),e[40]=p,e[41]=C):C=e[41],_=s.map(C),e[37]=s,e[38]=p,e[39]=_}else _=e[39];let $;e[42]!==i||e[43]!==S||e[44]!==k||e[45]!==_?($=l.jsxs(O1,{data:i,margin:b,children:[v,y,S,k,_]}),e[42]=i,e[43]=S,e[44]=k,e[45]=_,e[46]=$):$=e[46];let T;e[47]!==p||e[48]!==$?(T=l.jsx(It,{config:p,className:"h-56 w-full",children:$}),e[47]=p,e[48]=$,e[49]=T):T=e[49];let P;e[50]!==T||e[51]!==g?(P=l.jsxs("div",{className:"flex flex-col gap-3 p-4",children:[g,T]}),e[50]=T,e[51]=g,e[52]=P):P=e[52];let I;return e[53]!==P||e[54]!==x?(I=l.jsx(mi,{title:x,children:P}),e[53]=P,e[54]=x,e[55]=I):I=e[55],I}function I5(t,e){return[t.id,{label:t.name,color:`var(--chart-${e%5+1})`}]}function A5(t){return t.daily.map(L5)}function L5(t){return t.date}function D5(t){const e=O.c(72),{arms:s}=t,n=ie();let i,r,a,o,c,d,m,u;if(e[0]!==s||e[1]!==n){u=Symbol.for("react.early_return_sentinel");e:{const h=s.filter(O5);if(h.length===0){u=null;break e}a=mi,e[10]!==n?(m=n("experiments.results.behaviour"),e[10]=n,e[11]=m):m=e[11],r=sl,c="flush";let g;e[12]!==n?(g=n("experiments.results.arm"),e[12]=n,e[13]=g):g=e[13];let v;e[14]!==g?(v=l.jsx(yt,{left:!0,label:g}),e[14]=g,e[15]=v):v=e[15];let b;e[16]!==n?(b=n("experiments.results.pageviews"),e[16]=n,e[17]=b):b=e[17];let y;e[18]!==n?(y=n("experiments.results.pageviewsHint"),e[18]=n,e[19]=y):y=e[19];let j;e[20]!==b||e[21]!==y?(j=l.jsx(yt,{label:b,hint:y}),e[20]=b,e[21]=y,e[22]=j):j=e[22];let N;e[23]!==n?(N=n("experiments.results.activeTime"),e[23]=n,e[24]=N):N=e[24];let w;e[25]!==n?(w=n("experiments.results.activeTimeHint"),e[25]=n,e[26]=w):w=e[26];let S;e[27]!==N||e[28]!==w?(S=l.jsx(yt,{label:N,hint:w}),e[27]=N,e[28]=w,e[29]=S):S=e[29];let k;e[30]!==n?(k=n("experiments.results.clicks"),e[30]=n,e[31]=k):k=e[31];let _;e[32]!==n?(_=n("experiments.results.clicksHint"),e[32]=n,e[33]=_):_=e[33];let $;e[34]!==k||e[35]!==_?($=l.jsx(yt,{label:k,hint:_}),e[34]=k,e[35]=_,e[36]=$):$=e[36];let T;e[37]!==n?(T=n("experiments.results.scroll"),e[37]=n,e[38]=T):T=e[38];let P;e[39]!==n?(P=n("experiments.results.scrollHint"),e[39]=n,e[40]=P):P=e[40];let I;e[41]!==T||e[42]!==P?(I=l.jsx(yt,{label:T,hint:P}),e[41]=T,e[42]=P,e[43]=I):I=e[43];let C;e[44]!==n?(C=n("experiments.results.jsErrors"),e[44]=n,e[45]=C):C=e[45];let M;e[46]!==n?(M=n("experiments.results.jsErrorsHint"),e[46]=n,e[47]=M):M=e[47];let A;e[48]!==C||e[49]!==M?(A=l.jsx(yt,{label:C,hint:M}),e[48]=C,e[49]=M,e[50]=A):A=e[50],e[51]!==j||e[52]!==S||e[53]!==$||e[54]!==I||e[55]!==A||e[56]!==v?(d=l.jsx(el,{children:l.jsxs(Ut,{children:[v,j,S,$,I,A]})}),e[51]=j,e[52]=S,e[53]=$,e[54]=I,e[55]=A,e[56]=v,e[57]=d):d=e[57],i=tl;let F;e[58]!==n?(F=E=>{const{id:z,name:R,behaviour:V}=E;return l.jsxs(Ut,{children:[l.jsx(Le,{className:"font-medium",children:R}),l.jsx(Le,{className:"text-right tabular-nums",children:va(V.pageviewsPerVisitor)}),l.jsx(Le,{className:"whitespace-nowrap text-right tabular-nums",children:f5(V.activeSecondsPerVisitor,n)}),l.jsx(Le,{className:"text-right tabular-nums",children:va(V.clicksPerVisitor)}),l.jsx(Le,{className:"text-right tabular-nums",children:Bt(V.medianScrollDepth/100)}),l.jsx(Le,{className:"text-right tabular-nums",children:Bt(V.errorPct/100)})]},z)},e[58]=n,e[59]=F):F=e[59],o=h.map(F)}e[0]=s,e[1]=n,e[2]=i,e[3]=r,e[4]=a,e[5]=o,e[6]=c,e[7]=d,e[8]=m,e[9]=u}else i=e[2],r=e[3],a=e[4],o=e[5],c=e[6],d=e[7],m=e[8],u=e[9];if(u!==Symbol.for("react.early_return_sentinel"))return u;let f;e[60]!==i||e[61]!==o?(f=l.jsx(i,{children:o}),e[60]=i,e[61]=o,e[62]=f):f=e[62];let p;e[63]!==r||e[64]!==c||e[65]!==d||e[66]!==f?(p=l.jsxs(r,{variant:c,children:[d,f]}),e[63]=r,e[64]=c,e[65]=d,e[66]=f,e[67]=p):p=e[67];let x;return e[68]!==a||e[69]!==m||e[70]!==p?(x=l.jsx(a,{title:m,children:p}),e[68]=a,e[69]=m,e[70]=p,e[71]=x):x=e[71],x}function O5(t){return t.behaviour!==null}function R5(t){const e=O.c(43),{goals:s,control:n,test:i}=t,r=ie();let a,o,c,d,m,u,f,p;if(e[0]!==n||e[1]!==s||e[2]!==r||e[3]!==i){p=Symbol.for("react.early_return_sentinel");e:{const v=s.filter(F5);if(v.length===0){p=null;break e}c=mi,e[12]!==r?(f=r("experiments.results.goals"),e[12]=r,e[13]=f):f=e[13],o=sl,m="flush";let b;e[14]!==r?(b=r("experiments.results.goal"),e[14]=r,e[15]=b):b=e[15];let y;e[16]!==r?(y=r("experiments.results.goalsHint"),e[16]=r,e[17]=y):y=e[17];let j;e[18]!==b||e[19]!==y?(j=l.jsx(yt,{left:!0,label:b,hint:y}),e[18]=b,e[19]=y,e[20]=j):j=e[20];let N;e[21]!==n?(N=l.jsx(yt,{label:n}),e[21]=n,e[22]=N):N=e[22];let w;e[23]!==i?(w=l.jsx(yt,{label:i}),e[23]=i,e[24]=w):w=e[24],e[25]!==w||e[26]!==j||e[27]!==N?(u=l.jsx(el,{children:l.jsxs(Ut,{children:[j,N,w]})}),e[25]=w,e[26]=j,e[27]=N,e[28]=u):u=e[28],a=tl;let S;e[29]!==r?(S=k=>l.jsxs(Ut,{children:[l.jsx(Le,{children:Wd(k.goal,r)}),l.jsx(Le,{className:"text-right tabular-nums",children:Is(k.default)}),l.jsx(Le,{className:"text-right tabular-nums",children:Is(k.variant)})]},k.goal),e[29]=r,e[30]=S):S=e[30],d=v.map(S)}e[0]=n,e[1]=s,e[2]=r,e[3]=i,e[4]=a,e[5]=o,e[6]=c,e[7]=d,e[8]=m,e[9]=u,e[10]=f,e[11]=p}else a=e[4],o=e[5],c=e[6],d=e[7],m=e[8],u=e[9],f=e[10],p=e[11];if(p!==Symbol.for("react.early_return_sentinel"))return p;let x;e[31]!==a||e[32]!==d?(x=l.jsx(a,{children:d}),e[31]=a,e[32]=d,e[33]=x):x=e[33];let h;e[34]!==o||e[35]!==m||e[36]!==u||e[37]!==x?(h=l.jsxs(o,{variant:m,children:[u,x]}),e[34]=o,e[35]=m,e[36]=u,e[37]=x,e[38]=h):h=e[38];let g;return e[39]!==c||e[40]!==f||e[41]!==h?(g=l.jsx(c,{title:f,children:h}),e[39]=c,e[40]=f,e[41]=h,e[42]=g):g=e[42],g}function F5(t){return t.goal!=="visitors"}function z5(t){const e=O.c(53),{data:s,experiment:n}=t,i=ie(),r=N1(36e5);if(!s?.available){let k;e[0]!==s||e[1]!==i?(k=s?.reason==="no_site_data"?i("experiments.results.noSiteData",{site:s.analyticsSite}):i("experiments.results.unavailable"),e[0]=s,e[1]=i,e[2]=k):k=e[2];let _;return e[3]!==k?(_=l.jsx("div",{className:"rounded-lg border border-dashed border-border p-4 text-sm text-muted-foreground",children:k}),e[3]=k,e[4]=_):_=e[4],_}const a=s.results;if(!a||a.stats.totalParticipants===0){let k;e[5]!==i?(k=i("experiments.results.empty"),e[5]=i,e[6]=k):k=e[6];let _;return e[7]!==k?(_=l.jsx("div",{className:"rounded-lg border border-dashed border-border p-4 text-sm text-muted-foreground",children:k}),e[7]=k,e[8]=_):_=e[8],_}let o,c,d,m,u,f,p;if(e[9]!==n.startedAt||e[10]!==n.variants||e[11]!==r||e[12]!==a){o=x5(a,n.variants),c=o.find(U5),p=o.find(W5),d=o.some(H5);const k=i5(n.startedAt,r)||new Set(o.flatMap(K5)).size;m=a.statsGoal??a.goals.find(q5)?.goal??"",u="flex flex-col gap-4",f=c&&p&&l.jsx(y5,{control:c,test:p,exposure:d&&o.some(V5),days:k}),e[9]=n.startedAt,e[10]=n.variants,e[11]=r,e[12]=a,e[13]=o,e[14]=c,e[15]=d,e[16]=m,e[17]=u,e[18]=f,e[19]=p}else o=e[13],c=e[14],d=e[15],m=e[16],u=e[17],f=e[18],p=e[19];const x=a.currency??"BRL";let h;e[20]!==o||e[21]!==d||e[22]!==m||e[23]!==x?(h=l.jsx(P5,{arms:o,exposure:d,goal:m,currency:x}),e[20]=o,e[21]=d,e[22]=m,e[23]=x,e[24]=h):h=e[24];let g;e[25]!==c||e[26]!==p?(g=c&&p&&l.jsx(k5,{control:c,test:p}),e[25]=c,e[26]=p,e[27]=g):g=e[27];let v,b;e[28]!==o?(v=l.jsx(M5,{arms:o}),b=l.jsx(D5,{arms:o}),e[28]=o,e[29]=v,e[30]=b):(v=e[29],b=e[30]);let y;e[31]!==c?.name||e[32]!==i?(y=c?.name??i("experiments.results.control"),e[31]=c?.name,e[32]=i,e[33]=y):y=e[33];let j;e[34]!==i||e[35]!==p?.name?(j=p?.name??i("experiments.results.variant"),e[34]=i,e[35]=p?.name,e[36]=j):j=e[36];let N;e[37]!==a.goals||e[38]!==y||e[39]!==j?(N=l.jsx(R5,{goals:a.goals,control:y,test:j}),e[37]=a.goals,e[38]=y,e[39]=j,e[40]=N):N=e[40];let w;e[41]!==s.source||e[42]!==i?(w=s.source==="deco-analytics"&&l.jsx("span",{className:"text-xs text-muted-foreground",children:i("experiments.results.sourceDeco")}),e[41]=s.source,e[42]=i,e[43]=w):w=e[43];let S;return e[44]!==u||e[45]!==N||e[46]!==w||e[47]!==f||e[48]!==h||e[49]!==g||e[50]!==v||e[51]!==b?(S=l.jsxs("div",{className:u,children:[f,h,g,v,b,N,w]}),e[44]=u,e[45]=N,e[46]=w,e[47]=f,e[48]=h,e[49]=g,e[50]=v,e[51]=b,e[52]=S):S=e[52],S}function V5(t){return(t.exposed??0)>0}function q5(t){return t.goal!=="visitors"}function K5(t){return t.daily.map(B5)}function B5(t){return t.date}function H5(t){return t.exposed!==null}function W5(t){return t.role==="test"}function U5(t){return t.role==="control"}function G5(t){const e=O.c(4),{site:s,experiment:n}=t,{data:i,isLoading:r}=Qg(s,n.key);if(r){let o;return e[0]===Symbol.for("react.memo_cache_sentinel")?(o=l.jsx("div",{className:"flex justify-center p-8",children:l.jsx(is,{})}),e[0]=o):o=e[0],o}let a;return e[1]!==i||e[2]!==n?(a=l.jsx(z5,{data:i,experiment:n}),e[1]=i,e[2]=n,e[3]=a):a=e[3],a}function Y5(t){const e=O.c(38),{site:s,experiment:n,onBack:i}=t,r=ie();let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a=l.jsx(b1,{size:14}),e[0]=a):a=e[0];let o;e[1]!==r?(o=r("experiments.action.back"),e[1]=r,e[2]=o):o=e[2];let c;e[3]!==i||e[4]!==o?(c=l.jsxs(Se,{variant:"ghost",size:"sm",onClick:i,children:[a,o]}),e[3]=i,e[4]=o,e[5]=c):c=e[5];let d;e[6]!==n.name?(d=l.jsx("span",{className:"text-lg font-semibold",children:n.name}),e[6]=n.name,e[7]=d):d=e[7];const m=Ud[n.status];let u;e[8]!==r||e[9]!==m?(u=r(m),e[8]=r,e[9]=m,e[10]=u):u=e[10];let f;e[11]!==u?(f=l.jsx(Ye,{children:u}),e[11]=u,e[12]=f):f=e[12];let p;e[13]!==c||e[14]!==d||e[15]!==f?(p=l.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[c,d,f]}),e[13]=c,e[14]=d,e[15]=f,e[16]=p):p=e[16];let x;e[17]!==r?(x=r("experiments.col.variants"),e[17]=r,e[18]=x):x=e[18];let h;e[19]!==x?(h=l.jsx("div",{className:"mb-2 text-xs text-muted-foreground",children:x}),e[19]=x,e[20]=h):h=e[20];let g;e[21]!==n.variants?(g=l.jsx(Hd,{variants:n.variants}),e[21]=n.variants,e[22]=g):g=e[22];let v;e[23]!==h||e[24]!==g?(v=l.jsxs("div",{className:"rounded-lg border border-border p-4",children:[h,g]}),e[23]=h,e[24]=g,e[25]=v):v=e[25];let b;e[26]!==r?(b=r("experiments.results.title"),e[26]=r,e[27]=b):b=e[27];let y;e[28]!==b?(y=l.jsx("div",{className:"text-sm font-semibold",children:b}),e[28]=b,e[29]=y):y=e[29];let j;e[30]!==n||e[31]!==s?(j=l.jsx(G5,{site:s,experiment:n}),e[30]=n,e[31]=s,e[32]=j):j=e[32];let N;return e[33]!==v||e[34]!==y||e[35]!==j||e[36]!==p?(N=l.jsxs("div",{className:"flex flex-col gap-4 p-4",children:[p,v,y,j]}),e[33]=v,e[34]=y,e[35]=j,e[36]=p,e[37]=N):N=e[37],N}function Q5(t){const e=O.c(46),{virtualMcpId:s}=t,n=ie(),i=Va(s);let r;e[0]!==i?(r=bn(i),e[0]=i,e[1]=r):r=e[1];const a=r,[o,c]=Z.useState(!1),[d,m]=Z.useState(null),{data:u,isLoading:f}=Od(a??""),p=ho(a??""),x=Fd(a??"");if(!a){let T;e[2]!==n?(T=n("experiments.title"),e[2]=n,e[3]=T):T=e[3];let P;e[4]!==n?(P=n("experiments.noSite"),e[4]=n,e[5]=P):P=e[5];let I;return e[6]!==T||e[7]!==P?(I=l.jsx("div",{className:"p-8",children:l.jsx(Ke,{title:T,description:P})}),e[6]=T,e[7]=P,e[8]=I):I=e[8],I}let h;e[9]!==u||e[10]!==d?(h=u?.find(T=>T.key===d)??null,e[9]=u,e[10]=d,e[11]=h):h=e[11];const g=h;if(g){let T;e[12]===Symbol.for("react.memo_cache_sentinel")?(T=()=>m(null),e[12]=T):T=e[12];let P;return e[13]!==g||e[14]!==a?(P=l.jsx(Y5,{site:a,experiment:g,onBack:T}),e[13]=g,e[14]=a,e[15]=P):P=e[15],P}let v;e[16]!==n?(v=n("experiments.title"),e[16]=n,e[17]=v):v=e[17];let b;e[18]!==v?(b=l.jsx("h2",{className:"text-lg font-semibold",children:v}),e[18]=v,e[19]=b):b=e[19];let y;e[20]!==n?(y=n("experiments.subtitle"),e[20]=n,e[21]=y):y=e[21];let j;e[22]!==y?(j=l.jsx("p",{className:"max-w-2xl text-sm text-muted-foreground",children:y}),e[22]=y,e[23]=j):j=e[23];let N;e[24]!==b||e[25]!==j?(N=l.jsxs("div",{children:[b,j]}),e[24]=b,e[25]=j,e[26]=N):N=e[26];let w;e[27]!==u||e[28]!==n?(w=u&&u.length>0&&l.jsx(Se,{onClick:()=>c(!0),children:n("experiments.new")}),e[27]=u,e[28]=n,e[29]=w):w=e[29];let S;e[30]!==N||e[31]!==w?(S=l.jsxs("div",{className:"flex items-center justify-between",children:[N,w]}),e[30]=N,e[31]=w,e[32]=S):S=e[32];let k;e[33]!==x||e[34]!==u||e[35]!==f||e[36]!==n||e[37]!==p?(k=f?l.jsx("div",{className:"flex justify-center p-12",children:l.jsx(is,{})}):!u||u.length===0?l.jsx(Ke,{title:n("experiments.empty.title"),description:n("experiments.empty.desc"),buttonProps:{children:n("experiments.new"),onClick:()=>c(!0)}}):l.jsx("div",{className:"rounded-lg border border-border",children:l.jsxs(sl,{children:[l.jsx(el,{children:l.jsxs(Ut,{children:[l.jsx(dt,{children:n("experiments.col.name")}),l.jsx(dt,{children:n("experiments.col.key")}),l.jsx(dt,{children:n("experiments.col.status")}),l.jsx(dt,{children:n("experiments.col.variants")}),l.jsx(dt,{})]})}),l.jsx(tl,{children:u.map(T=>l.jsxs(Ut,{children:[l.jsx(Le,{children:l.jsx("button",{type:"button",className:"text-sm underline-offset-4 hover:underline",onClick:()=>m(T.key),children:T.name})}),l.jsx(Le,{className:"font-mono text-xs text-muted-foreground",children:T.key}),l.jsx(Le,{children:l.jsxs(Zi,{value:T.status,onValueChange:P=>p.mutate({key:T.key,status:P}),children:[l.jsx(Ji,{size:"sm",className:"w-28",children:l.jsx(er,{})}),l.jsx(tr,{children:r5.map(P=>l.jsx(sr,{value:P,children:n(Ud[P])},P))})]})}),l.jsx(Le,{children:l.jsx(Hd,{variants:T.variants})}),l.jsx(Le,{className:"text-right",children:l.jsx(Se,{variant:"ghost",size:"sm",onClick:()=>{window.confirm(n("experiments.deleteConfirm",{key:T.key}))&&x.mutate(T.key)},children:n("experiments.action.delete")})})]},T.key))})]})}),e[33]=x,e[34]=u,e[35]=f,e[36]=n,e[37]=p,e[38]=k):k=e[38];let _;e[39]!==o||e[40]!==a?(_=l.jsx(o5,{site:a,open:o,onOpenChange:c}),e[39]=o,e[40]=a,e[41]=_):_=e[41];let $;return e[42]!==k||e[43]!==_||e[44]!==S?($=l.jsxs("div",{className:"flex flex-col gap-4 p-4",children:[S,k,_]}),e[42]=k,e[43]=_,e[44]=S,e[45]=$):$=e[45],$}const ya=["running","paused","draft","ended"],Yd={running:"bg-success",paused:"bg-warning",draft:"bg-muted-foreground/60",ended:"bg-muted-foreground/40"};function Qd(){const t=O.c(2),e=ie();let s;return t[0]!==e?(s=n=>{switch(n){case"running":return e("experiments.status.running");case"paused":return e("experiments.status.paused");case"draft":return e("experiments.status.draft");case"ended":return e("experiments.status.ended");default:return n}},t[0]=e,t[1]=s):s=t[1],s}function Xd(t){const e=O.c(10),{status:s}=t,n=Qd(),i=Yd[s];let r;e[0]!==i?(r=ye("size-1.5 rounded-full",i),e[0]=i,e[1]=r):r=e[1];let a;e[2]!==r?(a=l.jsx("span",{className:r}),e[2]=r,e[3]=a):a=e[3];let o;e[4]!==n||e[5]!==s?(o=n(s),e[4]=n,e[5]=s,e[6]=o):o=e[6];let c;return e[7]!==a||e[8]!==o?(c=l.jsxs(Ye,{variant:"secondary",children:[a,o]}),e[7]=a,e[8]=o,e[9]=c):c=e[9],c}function Zd(){const t=O.c(22),e=ie();let s;t[0]!==e?(s=e("experiments.action.start"),t[0]=e,t[1]=s):s=t[1];let n;t[2]!==s?(n={to:"running",label:s,icon:Xm},t[2]=s,t[3]=n):n=t[3];const i=n;let r;t[4]!==e?(r=e("experiments.action.resume"),t[4]=e,t[5]=r):r=t[5];let a;t[6]!==i||t[7]!==r?(a={...i,label:r},t[6]=i,t[7]=r,t[8]=a):a=t[8];const o=a;let c;t[9]!==e?(c=e("experiments.action.pause"),t[9]=e,t[10]=c):c=t[10];let d;t[11]!==c?(d={to:"paused",label:c,icon:Zm},t[11]=c,t[12]=d):d=t[12];const m=d;let u;t[13]!==e?(u=e("experiments.action.end"),t[13]=e,t[14]=u):u=t[14];let f;t[15]!==u?(f={to:"ended",label:u,icon:Jm},t[15]=u,t[16]=f):f=t[16];const p=f;let x;return t[17]!==p||t[18]!==m||t[19]!==o||t[20]!==i?(x=h=>{switch(h){case"draft":return[i];case"running":return[m,p];case"paused":return[o,p];case"ended":return[];default:return h}},t[17]=p,t[18]=m,t[19]=o,t[20]=i,t[21]=x):x=t[21],x}function X5(t){return Math.floor((Date.now()-new Date(t).getTime())/864e5)}function Jd(){const t=O.c(5),e=ie();let s;t[0]!==e?(s=r=>{const a=X5(r);return a===0?e("experiments.meta.today"):e("experiments.meta.daysAgo",{days:a})},t[0]=e,t[1]=s):s=t[1];const n=s;let i;return t[2]!==e||t[3]!==n?(i=r=>r.status==="ended"&&r.endedAt?e("experiments.meta.ended",{when:n(r.endedAt)}):r.startedAt&&r.status!=="draft"?e("experiments.meta.started",{when:n(r.startedAt)}):e("experiments.meta.created",{when:n(r.createdAt)}),t[2]=e,t[3]=n,t[4]=i):i=t[4],i}function wa(t){return t.map(e=>({id:e.id,role:e.role??null,description:e.description??"",weight:e.weight}))}function Na(t){return t.map(e=>({id:e.id.trim(),weight:e.weight,role:e.role,description:e.description.trim()||null}))}const Z5=[{id:"control",role:"control",description:"",weight:50},{id:"variant-b",role:"treatment",description:"",weight:50}];function bs(t,e){return e.role==="control"?t("experiments.preview.control"):e.id}function J5(t,e,s){const n=100-s,i=t.reduce((d,m,u)=>u===e?d:d+m,0),r=t.map((d,m)=>m===e?s:i>0?d/i*n:n/(t.length-1)),a=r.map((d,m)=>m===e?s:Math.floor(d));let o=100-a.reduce((d,m)=>d+m,0);const c=r.map((d,m)=>({i:m,frac:d-Math.floor(d)})).filter(({i:d})=>d!==e).sort((d,m)=>m.frac-d.frac);for(const{i:d}of c){if(o<=0)break;a[d]=(a[d]??0)+1,o-=1}return a}function Oc(t,e,s,n){if(t.length<2)return[100];if(n<0||e===n)return J5(t,e,s);const i=t.map((o,c)=>c===e?s:o);let r=i.reduce((o,c)=>o+c,0)-100;if(r<=0)return i[n]=(i[n]??0)-r,i;const a=[n,...t.map((o,c)=>c).filter(o=>o!==e&&o!==n).reverse()];for(const o of a){const c=Math.min(i[o]??0,r);if(i[o]=(i[o]??0)-c,r-=c,r===0)break}return i}function ev(t){const e=O.c(21),{value:s,label:n,onCommit:i}=t,r=ie(),[a,o]=Z.useState(null);let c;e[0]!==a||e[1]!==i?(c=()=>{const x=Math.round(Number(a));a!==null&&a.trim()!==""&&Number.isFinite(x)&&i(Math.min(100,Math.max(0,x))),o(null)},e[0]=a,e[1]=i,e[2]=c):c=e[2];const d=c;if(a!==null){let x;e[3]===Symbol.for("react.memo_cache_sentinel")?(x=v=>o(v.target.value.replace(/[^0-9]/g,"")),e[3]=x):x=e[3];let h;e[4]!==d?(h=v=>{v.key==="Enter"&&d(),v.key==="Escape"&&o(null)},e[4]=d,e[5]=h):h=e[5];let g;return e[6]!==d||e[7]!==a||e[8]!==n||e[9]!==h?(g=l.jsxs("span",{className:"flex items-center text-xl font-medium tabular-nums",children:[l.jsx("input",{value:a,onChange:x,onBlur:d,onKeyDown:h,onFocus:tv,inputMode:"numeric","aria-label":n,autoFocus:!0,className:"field-sizing-content min-w-[2ch] bg-transparent text-right outline-none"}),"%"]}),e[6]=d,e[7]=a,e[8]=n,e[9]=h,e[10]=g):g=e[10],g}let m;e[11]!==s?(m=()=>o(String(s)),e[11]=s,e[12]=m):m=e[12];let u;e[13]!==n||e[14]!==r?(u=r("experiments.split.editPercent",{label:n}),e[13]=n,e[14]=r,e[15]=u):u=e[15];let f;e[16]===Symbol.for("react.memo_cache_sentinel")?(f=l.jsx(xr,{size:14,className:"text-muted-foreground transition-colors group-hover/percent:text-foreground"}),e[16]=f):f=e[16];let p;return e[17]!==m||e[18]!==u||e[19]!==s?(p=l.jsxs("button",{type:"button",onClick:m,"aria-label":u,className:"group/percent flex items-center gap-1.5 rounded-md text-xl font-medium tabular-nums focus-ring",children:[f,s,"%"]}),e[17]=m,e[18]=u,e[19]=s,e[20]=p):p=e[20],p}function tv(t){return t.target.select()}function Zr(t){const e=Math.floor(100/t);return Array.from({length:t},(s,n)=>n===0?100-e*(t-1):e)}function em(t){const e=O.c(67),{arms:s,onChange:n,structureEditable:i}=t,r=ie();let a;e[0]!==s?(a=M1(s),e[0]=s,e[1]=a):a=e[1];const o=a;let c,d,m,u,f;if(e[2]!==s||e[3]!==o||e[4]!==n||e[5]!==i||e[6]!==r){const h=s.map(iv),g=s.findIndex(nv);let v;e[12]!==s?(v=s.reduce(lv,0),e[12]=s,e[13]=v):v=e[13];const b=v;let y;e[14]!==s||e[15]!==n?(y=q=>n(s.map((L,B)=>({...L,weight:q[B]??0}))),e[14]=s,e[15]=n,e[16]=y):y=e[16];const j=y;let N;e[17]!==s||e[18]!==n?(N=(q,L)=>n(s.map((B,Y)=>Y===q?{...B,...L}:B)),e[17]=s,e[18]=n,e[19]=N):N=e[19];const w=N,S=Zr(s.length),k=S.every((q,L)=>q===h[L]);let _;e[20]!==s||e[21]!==n?(_=()=>{const q=[...s,{id:`variant-${String.fromCharCode(97+s.length)}`,role:"treatment",description:"",weight:0}],L=Zr(q.length);n(q.map((B,Y)=>({...B,weight:L[Y]??0})))},e[20]=s,e[21]=n,e[22]=_):_=e[22];const $=_;let T;e[23]!==s||e[24]!==n?(T=q=>{const L=s.filter((Y,J)=>J!==q),B=Zr(L.length);n(L.map((Y,J)=>({...Y,weight:B[J]??0})))},e[23]=s,e[24]=n,e[25]=T):T=e[25];const P=T;c=Js,u="flex-col items-center gap-10 p-8 md:flex-row";let I;e[26]!==s?(I=l.jsx(E1,{arms:s,size:240,thickness:30}),e[26]=s,e[27]=I):I=e[27];let C;e[28]!==b?(C=l.jsxs("span",{className:"text-4xl font-medium tabular-nums",children:[b,"%"]}),e[28]=b,e[29]=C):C=e[29];let M;e[30]!==r?(M=r("experiments.split.seeChange"),e[30]=r,e[31]=M):M=e[31];let A;e[32]!==M?(A=l.jsx("span",{className:"text-xs text-muted-foreground",children:M}),e[32]=M,e[33]=A):A=e[33];let F;e[34]!==C||e[35]!==A?(F=l.jsxs("div",{className:"pointer-events-none absolute inset-0 flex flex-col items-center justify-center",children:[C,A]}),e[34]=C,e[35]=A,e[36]=F):F=e[36];let E;e[37]!==I||e[38]!==F?(E=l.jsxs("div",{className:"relative",children:[I,F]}),e[37]=I,e[38]=F,e[39]=E):E=e[39];let z;e[40]!==S||e[41]!==j?(z=()=>j(S),e[40]=S,e[41]=j,e[42]=z):z=e[42];let R;e[43]!==r?(R=r("experiments.split.even"),e[43]=r,e[44]=R):R=e[44];let V;e[45]!==k||e[46]!==z||e[47]!==R?(V=l.jsx(Se,{variant:"tab",size:"sm","aria-pressed":k,onClick:z,children:R}),e[45]=k,e[46]=z,e[47]=R,e[48]=V):V=e[48];let K;e[49]!==$||e[50]!==i||e[51]!==r?(K=i&&l.jsxs(Se,{variant:"ghost",size:"sm",onClick:$,children:[l.jsx(ks,{size:14}),r("experiments.split.addVariant")]}),e[49]=$,e[50]=i,e[51]=r,e[52]=K):K=e[52];let U;e[53]!==V||e[54]!==K?(U=l.jsxs("div",{className:"flex items-center gap-1",children:[V,K]}),e[53]=V,e[54]=K,e[55]=U):U=e[55],e[56]!==E||e[57]!==U?(f=l.jsxs("div",{className:"flex flex-shrink-0 flex-col items-center gap-4",children:[E,U]}),e[56]=E,e[57]=U,e[58]=f):f=e[58],d="flex w-full min-w-0 flex-1 flex-col gap-7",m=s.map((q,L)=>l.jsxs("div",{className:"group flex flex-col gap-2.5",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("span",{className:"size-2.5 flex-shrink-0 rounded-full",style:{backgroundColor:o[L]}}),i&&q.role!=="control"?l.jsx("input",{value:q.id,onChange:B=>w(L,{id:B.target.value}),"aria-label":r("experiments.split.variantName"),className:"min-w-0 flex-1 bg-transparent text-sm font-medium outline-none"}):l.jsx("span",{className:"min-w-0 flex-1 truncate text-sm font-medium",children:bs(r,q)}),i&&q.role!=="control"&&l.jsx(yn,{label:r("experiments.split.removeVariant"),onClick:()=>P(L),className:"opacity-0 transition-opacity group-hover:opacity-100 focus-visible:opacity-100",children:l.jsx(I1,{size:14})}),l.jsx(ev,{value:q.weight,label:bs(r,q),onCommit:B=>j(Oc(h,L,B,g))})]}),l.jsx(y1,{value:[q.weight],max:100,step:1,onValueChange:B=>{const[Y]=B;return j(Oc(h,L,Y??0,g))},"aria-label":bs(r,q),style:o[L]===If?void 0:{"--primary":o[L]}}),l.jsx("textarea",{value:q.description,onChange:B=>{w(L,{description:B.target.value}),B.target.style.height="auto",B.target.style.height=`${B.target.scrollHeight}px`},ref:sv,rows:1,placeholder:r("experiments.dialog.variantDescriptionPlaceholder"),className:"w-full resize-none overflow-hidden bg-transparent text-sm text-muted-foreground outline-none placeholder:text-muted-foreground/50"})]},L)),e[2]=s,e[3]=o,e[4]=n,e[5]=i,e[6]=r,e[7]=c,e[8]=d,e[9]=m,e[10]=u,e[11]=f}else c=e[7],d=e[8],m=e[9],u=e[10],f=e[11];let p;e[59]!==d||e[60]!==m?(p=l.jsx("div",{className:d,children:m}),e[59]=d,e[60]=m,e[61]=p):p=e[61];let x;return e[62]!==c||e[63]!==u||e[64]!==f||e[65]!==p?(x=l.jsxs(c,{className:u,children:[f,p]}),e[62]=c,e[63]=u,e[64]=f,e[65]=p,e[66]=x):x=e[66],x}function sv(t){t&&(t.style.height="auto",t.style.height=`${t.scrollHeight}px`)}function lv(t,e){return e.role==="control"?t:t+e.weight}function nv(t){return t.role==="control"}function iv(t){return t.weight}function rv(t){const e=O.c(115),{site:s,open:n,onOpenChange:i,onCreated:r,onManual:a}=t,o=ie(),c=Rd(s),d=Ug(s),[m,u]=Z.useState(""),f=Z.useRef(null),p=c.isPending||d.isPending;let x;e[0]!==d||e[1]!==i||e[2]!==c?(x=oe=>{i(oe),oe||(u(""),c.reset(),d.reset())},e[0]=d,e[1]=i,e[2]=c,e[3]=x):x=e[3];const h=x;let g;e[4]!==p||e[5]!==h||e[6]!==d||e[7]!==r||e[8]!==m||e[9]!==c?(g=()=>{!m.trim()||p||c.mutate(m.trim(),{onSuccess:oe=>{d.mutate({key:oe.key,name:oe.name,variants:oe.variants},{onSuccess:he=>{h(!1),r(he.key)}})}})},e[4]=p,e[5]=h,e[6]=d,e[7]=r,e[8]=m,e[9]=c,e[10]=g):g=e[10];const v=g;let b;e[11]!==o?(b=o("experiments.prompt.example1"),e[11]=o,e[12]=b):b=e[12];let y;e[13]!==b?(y={icon:su,text:b},e[13]=b,e[14]=y):y=e[14];let j;e[15]!==o?(j=o("experiments.prompt.example2"),e[15]=o,e[16]=j):j=e[16];let N;e[17]!==j?(N={icon:lu,text:j},e[17]=j,e[18]=N):N=e[18];let w;e[19]!==o?(w=o("experiments.prompt.example3"),e[19]=o,e[20]=w):w=e[20];let S;e[21]!==w?(S={icon:Tu,text:w},e[21]=w,e[22]=S):S=e[22];let k;e[23]!==y||e[24]!==N||e[25]!==S?(k=[y,N,S],e[23]=y,e[24]=N,e[25]=S,e[26]=k):k=e[26];const _=k;let $;e[27]!==o?($=o("experiments.prompt.title"),e[27]=o,e[28]=$):$=e[28];let T;e[29]!==$?(T=l.jsx($n,{children:$}),e[29]=$,e[30]=T):T=e[30];let P;e[31]!==o?(P=o("experiments.prompt.subtitle"),e[31]=o,e[32]=P):P=e[32];let I;e[33]!==P?(I=l.jsx(Da,{children:P}),e[33]=P,e[34]=I):I=e[34];let C;e[35]!==T||e[36]!==I?(C=l.jsxs(_n,{className:"px-6 pt-6",children:[T,I]}),e[35]=T,e[36]=I,e[37]=C):C=e[37];let M;e[38]===Symbol.for("react.memo_cache_sentinel")?(M=oe=>u(oe.target.value),e[38]=M):M=e[38];let A;e[39]!==v?(A=oe=>{oe.key==="Enter"&&(oe.metaKey||oe.ctrlKey)&&(oe.preventDefault(),v())},e[39]=v,e[40]=A):A=e[40];let F;e[41]!==o?(F=o("experiments.prompt.placeholder"),e[41]=o,e[42]=F):F=e[42];let E;e[43]!==o?(E=o("experiments.prompt.title"),e[43]=o,e[44]=E):E=e[44];let z;e[45]!==p||e[46]!==m||e[47]!==A||e[48]!==F||e[49]!==E?(z=l.jsx("textarea",{ref:f,value:m,onChange:M,onKeyDown:A,placeholder:F,"aria-label":E,readOnly:p,rows:4,autoFocus:!0,className:"block w-full resize-none bg-transparent px-4 pt-4 text-base leading-relaxed outline-none placeholder:text-muted-foreground/60"}),e[45]=p,e[46]=m,e[47]=A,e[48]=F,e[49]=E,e[50]=z):z=e[50];let R;e[51]!==d.isPending||e[52]!==c.isPending||e[53]!==o?(R=d.isPending?o("experiments.prompt.creating"):c.isPending?o("experiments.prompt.generating"):o("experiments.prompt.shortcut"),e[51]=d.isPending,e[52]=c.isPending,e[53]=o,e[54]=R):R=e[54];let V;e[55]!==R?(V=l.jsx("span",{className:"text-xs text-muted-foreground",children:R}),e[55]=R,e[56]=V):V=e[56];let K;e[57]!==p||e[58]!==m?(K=p||!m.trim(),e[57]=p,e[58]=m,e[59]=K):K=e[59];let U;e[60]!==p?(U=p?l.jsx(is,{size:"2xs"}):l.jsx(p1,{size:14}),e[60]=p,e[61]=U):U=e[61];let q;e[62]!==o?(q=o("experiments.prompt.generate"),e[62]=o,e[63]=q):q=e[63];let L;e[64]!==v||e[65]!==K||e[66]!==U||e[67]!==q?(L=l.jsxs(Se,{size:"sm",onClick:v,disabled:K,children:[U,q]}),e[64]=v,e[65]=K,e[66]=U,e[67]=q,e[68]=L):L=e[68];let B;e[69]!==V||e[70]!==L?(B=l.jsxs("div",{className:"flex items-center justify-end gap-2 px-3 pb-3",children:[V,L]}),e[69]=V,e[70]=L,e[71]=B):B=e[71];let Y;e[72]!==z||e[73]!==B?(Y=l.jsxs("div",{className:"rounded-xl bg-[var(--studio-input-background)] shadow-edge focus-within-ring",children:[z,B]}),e[72]=z,e[73]=B,e[74]=Y):Y=e[74];let J;e[75]!==o?(J=o("experiments.prompt.tryOne"),e[75]=o,e[76]=J):J=e[76];let X;e[77]!==J?(X=l.jsx("span",{className:"text-xs text-muted-foreground",children:J}),e[77]=J,e[78]=X):X=e[78];let ee;e[79]!==p||e[80]!==_?(ee=l.jsx("div",{className:"flex flex-wrap gap-2",children:_.map(oe=>{const{icon:he,text:le}=oe;return l.jsxs(Se,{variant:"outline",size:"sm",onClick:()=>{u(le),f.current?.focus()},disabled:p,children:[l.jsx(he,{size:14}),le]},le)})}),e[79]=p,e[80]=_,e[81]=ee):ee=e[81];let te;e[82]!==X||e[83]!==ee?(te=l.jsxs("div",{className:"flex flex-col gap-2",children:[X,ee]}),e[82]=X,e[83]=ee,e[84]=te):te=e[84];let D;e[85]!==c.error?(D=c.error&&l.jsx("p",{className:"text-xs text-destructive",children:c.error instanceof Error?c.error.message:"Error"}),e[85]=c.error,e[86]=D):D=e[86];let W;e[87]!==Y||e[88]!==te||e[89]!==D?(W=l.jsxs("div",{className:"flex flex-col gap-4 px-6 pt-5 pb-6",children:[Y,te,D]}),e[87]=Y,e[88]=te,e[89]=D,e[90]=W):W=e[90];let G;e[91]!==o?(G=o("experiments.prompt.willGenerate"),e[91]=o,e[92]=G):G=e[92];let Q;e[93]!==G?(Q=l.jsx("span",{className:"text-xs text-muted-foreground",children:G}),e[93]=G,e[94]=Q):Q=e[94];let re;e[95]!==h||e[96]!==a?(re=()=>{h(!1),a(null)},e[95]=h,e[96]=a,e[97]=re):re=e[97];let ce;e[98]===Symbol.for("react.memo_cache_sentinel")?(ce=l.jsx(xr,{size:14}),e[98]=ce):ce=e[98];let ae;e[99]!==o?(ae=o("experiments.prompt.editManually"),e[99]=o,e[100]=ae):ae=e[100];let fe;e[101]!==re||e[102]!==ae?(fe=l.jsxs(Se,{variant:"ghost",size:"sm",onClick:re,children:[ce,ae]}),e[101]=re,e[102]=ae,e[103]=fe):fe=e[103];let de;e[104]!==Q||e[105]!==fe?(de=l.jsxs("div",{className:"flex items-center justify-between border-t border-border px-6 py-3",children:[Q,fe]}),e[104]=Q,e[105]=fe,e[106]=de):de=e[106];let se;e[107]!==C||e[108]!==W||e[109]!==de?(se=l.jsxs(Tn,{className:"gap-0 overflow-hidden p-0 sm:max-w-xl",children:[C,W,de]}),e[107]=C,e[108]=W,e[109]=de,e[110]=se):se=e[110];let H;return e[111]!==h||e[112]!==n||e[113]!==se?(H=l.jsx(Pn,{open:n,onOpenChange:h,children:se}),e[111]=h,e[112]=n,e[113]=se,e[114]=H):H=e[114],H}function av(t,e,s){try{const n=new URL(t);return n.searchParams.set("__ab",`${e}:${s}`),n.href}catch{return t}}function Rc(t){const e=O.c(3),{src:s,title:n}=t;let i;return e[0]!==s||e[1]!==n?(i=l.jsx("iframe",{src:s,title:n,sandbox:"allow-scripts allow-same-origin allow-forms allow-popups allow-popups-to-escape-sandbox",className:"h-full w-full border-0 bg-background"}),e[0]=s,e[1]=n,e[2]=i):i=e[2],i}function tm(t){const e=O.c(38),{baseUrl:s,treatmentUrl:n,testKey:i,arms:r,reloadNonce:a}=t,o=a===void 0?0:a,c=ie(),d=M1(r),m=r.find(dv)??r[0],u=r.filter(H=>H!==m),[f,p]=Z.useState(u[0]?.id),x=u.find(H=>H.id===f)??u[0]??m,[h,g]=Z.useState("compare"),[v,b]=Z.useState("desktop"),[y,j]=Z.useState(50),[N,w]=Z.useState(!1),S=Z.useRef(null);if(!m||!x)return null;const k=H=>d[r.findIndex(oe=>oe.id===H.id)]??Mf,_=H=>av(H.id===m.id?s:n??s,i,H.id),$=h==="control"?100:h==="treatment"?0:y;let T;e[0]===Symbol.for("react.memo_cache_sentinel")?(T=H=>{const oe=S.current?.getBoundingClientRect();if(!oe)return;const he=(H-oe.left)/oe.width*100;j(Math.min(100,Math.max(0,he)))},e[0]=T):T=e[0];const P=T,I=H=>{if(H.id===m.id)return g("control");p(H.id),g("treatment")},C=H=>H.id===m.id?h==="control":h==="treatment"&&H.id===x.id,M=h==="compare";let A,F;e[1]===Symbol.for("react.memo_cache_sentinel")?(A=()=>g("compare"),F=l.jsx(Co,{size:14}),e[1]=A,e[2]=F):(A=e[1],F=e[2]);let E;e[3]!==c?(E=c("experiments.compare.compare"),e[3]=c,e[4]=E):E=e[4];let z;e[5]!==M||e[6]!==E?(z=l.jsxs(Se,{variant:"tab",size:"sm","aria-pressed":M,onClick:A,children:[F,E]}),e[5]=M,e[6]=E,e[7]=z):z=e[7];const R=v==="desktop";let V;e[8]!==c?(V=c("experiments.compare.desktop"),e[8]=c,e[9]=V):V=e[9];let K,U;e[10]===Symbol.for("react.memo_cache_sentinel")?(K=()=>b("desktop"),U=l.jsx(Af,{size:14}),e[10]=K,e[11]=U):(K=e[10],U=e[11]);let q;e[12]!==R||e[13]!==V?(q=l.jsx(Se,{variant:"tab",size:"icon-sm","aria-pressed":R,"aria-label":V,onClick:K,children:U}),e[12]=R,e[13]=V,e[14]=q):q=e[14];const L=v==="mobile";let B;e[15]!==c?(B=c("experiments.compare.mobile"),e[15]=c,e[16]=B):B=e[16];let Y,J;e[17]===Symbol.for("react.memo_cache_sentinel")?(Y=()=>b("mobile"),J=l.jsx(tu,{size:14}),e[17]=Y,e[18]=J):(Y=e[17],J=e[18]);let X;e[19]!==L||e[20]!==B?(X=l.jsx(Se,{variant:"tab",size:"icon-sm","aria-pressed":L,"aria-label":B,onClick:Y,children:J}),e[19]=L,e[20]=B,e[21]=X):X=e[21];const ee=h==="compare"?l.jsxs(hn,{modal:!1,children:[l.jsx(gn,{asChild:!0,children:l.jsx(Se,{variant:"ghost",size:"icon-sm","aria-label":c("experiments.preview.openPage"),children:l.jsx(Yn,{size:14})})}),l.jsx(vn,{align:"end",children:[m,x].map(H=>l.jsx(Es,{asChild:!0,children:l.jsxs("a",{href:_(H),target:"_blank",rel:"noopener noreferrer",children:[l.jsx("span",{className:"size-2 rounded-full",style:{backgroundColor:k(H)}}),c("experiments.compare.openArm",{arm:bs(c,H)})]})},H.id))})]}):l.jsx(yn,{label:c("experiments.compare.openArm",{arm:bs(c,h==="treatment"?x:m)}),asChild:!0,children:l.jsx("a",{href:_(h==="treatment"?x:m),target:"_blank",rel:"noopener noreferrer",children:l.jsx(Yn,{size:14})})});let te;e[22]!==q||e[23]!==X||e[24]!==ee?(te=l.jsxs("div",{className:"flex items-center gap-1",children:[q,X,ee]}),e[22]=q,e[23]=X,e[24]=ee,e[25]=te):te=e[25];const D=v==="mobile"?"mx-auto w-[390px] max-w-full":"w-full";let W;e[26]!==D?(W=ye("relative h-[min(720px,75vh)] overflow-hidden rounded-lg bg-background shadow-edge transition-[width] duration-300 ease-out",D),e[26]=D,e[27]=W):W=e[27];let G;e[28]!==N?(G=N?H=>P(H.clientX):void 0,e[28]=N,e[29]=G):G=e[29];let Q,re;e[30]===Symbol.for("react.memo_cache_sentinel")?(Q=()=>w(!1),re=()=>w(!1),e[30]=Q,e[31]=re):(Q=e[30],re=e[31]);const ce=!N&&"transition-[clip-path] duration-300 ease-out";let ae;e[32]!==ce?(ae=ye("absolute inset-0",ce),e[32]=ce,e[33]=ae):ae=e[33];const fe=`inset(0 ${100-$}% 0 0)`;let de;e[34]!==fe?(de={clipPath:fe},e[34]=fe,e[35]=de):de=e[35];let se;return e[36]!==N?(se=N&&l.jsx("div",{className:"absolute inset-0 z-10 cursor-ew-resize"}),e[36]=N,e[37]=se):se=e[37],l.jsxs(Js,{className:"gap-4 p-3",children:[l.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[l.jsxs("div",{className:"flex items-center gap-1",children:[z,r.map(H=>l.jsxs(Se,{variant:"tab",size:"sm","aria-pressed":C(H),onClick:()=>I(H),children:[l.jsx("span",{className:"size-2 rounded-full",style:{backgroundColor:k(H)}}),bs(c,H)]},H.id))]}),te]}),l.jsxs("div",{ref:S,className:W,onPointerMove:G,onPointerUp:Q,onPointerLeave:re,children:[l.jsx("div",{className:"absolute inset-0",children:l.jsx(Rc,{src:_(x),title:bs(c,x)},`${x.id}-${o}`)}),l.jsx("div",{className:ae,style:de,children:l.jsx(Rc,{src:_(m),title:bs(c,m)},`${m.id}-${o}`)}),se,h==="compare"&&l.jsxs(l.Fragment,{children:[[m,x].map((H,oe)=>{const he=l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"size-2 rounded-full",style:{backgroundColor:k(H)}}),bs(c,H)]}),le=ye("absolute bottom-3 z-20 flex items-center gap-1.5 rounded-full bg-card px-2.5 py-1 text-xs font-medium shadow-edge transition-opacity",oe===0?"left-3":"right-3",(oe===0?y<15:y>85)&&"pointer-events-none opacity-0");return oe===0||u.length<2?l.jsx("span",{className:ye(le,"pointer-events-none"),children:he},H.id):l.jsxs(hn,{modal:!1,children:[l.jsxs(gn,{className:ye(le,"hover:bg-accent"),"aria-label":c("experiments.compare.pickVariant"),children:[he,l.jsx(Ka,{size:12,className:"text-muted-foreground"})]}),l.jsx(vn,{align:"end",side:"top",children:u.map(ne=>l.jsxs(c1,{checked:ne.id===x.id,onCheckedChange:()=>p(ne.id),children:[l.jsx("span",{className:"size-2 rounded-full",style:{backgroundColor:k(ne)}}),bs(c,ne)]},ne.id))})]},H.id)}),l.jsxs("div",{className:"absolute inset-y-0 z-20 flex w-6 -translate-x-1/2 cursor-ew-resize justify-center",style:{left:`${y}%`},onPointerDown:H=>{H.preventDefault(),w(!0)},children:[l.jsx("div",{className:"h-full w-0.5 bg-card shadow-edge"}),l.jsx("button",{type:"button",role:"slider","aria-label":c("experiments.compare.handle"),"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":Math.round(y),onKeyDown:H=>{H.key==="ArrowLeft"&&j(cv),H.key==="ArrowRight"&&j(ov)},className:ye("absolute top-1/2 left-1/2 flex size-9 -translate-x-1/2 -translate-y-1/2 cursor-ew-resize items-center justify-center rounded-full bg-card text-foreground shadow-edge transition-transform hover:scale-110 focus-ring",N&&"scale-110"),children:l.jsx(Co,{size:16})})]})]})]})]})}function ov(t){return Math.min(100,t+5)}function cv(t){return Math.max(0,t-5)}function dv(t){return t.role==="control"}function mv(t){const e=O.c(4),{data:s}=Rf(t.taskBoardItemId??void 0),n=s?.[0]??null,i=n?.merged?null:n?.previewUrl??null,r=t.taskBoardItemId?n?n.merged?"merged":i?"ready":"deploying":"writing":"none";let a;return e[0]!==n||e[1]!==i||e[2]!==r?(a={pr:n,previewUrl:i,stage:r},e[0]=n,e[1]=i,e[2]=r,e[3]=a):a=e[3],a}function uv(t){const e=O.c(21),{experiment:s,org:n,implementation:i,onImplement:r}=t,a=ie(),{pr:o,stage:c}=i,d=o?.number??0;let m;e[0]!==d||e[1]!==c||e[2]!==a?(m=c==="none"?a("experiments.implementation.notDelegated"):c==="writing"?a("experiments.implementation.writing"):c==="merged"?a("experiments.implementation.merged",{number:d}):c==="ready"?a("experiments.implementation.ready",{number:d}):a("experiments.implementation.deploying",{number:d}),e[0]=d,e[1]=c,e[2]=a,e[3]=m):m=e[3];const u=m;let f;e[4]!==c?(f=c==="writing"||c==="deploying"?l.jsx(is,{size:"2xs"}):l.jsx(la,{size:16,className:"text-muted-foreground"}),e[4]=c,e[5]=f):f=e[5];let p;e[6]!==u?(p=l.jsx("span",{className:"text-sm text-muted-foreground",children:u}),e[6]=u,e[7]=p):p=e[7];let x;e[8]!==f||e[9]!==p?(x=l.jsxs("div",{className:"flex min-w-0 items-center gap-2.5",children:[f,p]}),e[8]=f,e[9]=p,e[10]=x):x=e[10];let h;e[11]!==s||e[12]!==r||e[13]!==n||e[14]!==o||e[15]!==c||e[16]!==a?(h=l.jsx("div",{className:"flex items-center gap-2",children:c==="none"?l.jsxs(Se,{variant:"secondary",size:"sm",onClick:r,children:[l.jsx(la,{size:14}),a("experiments.implementation.delegate")]}):l.jsxs(l.Fragment,{children:[o&&l.jsx(Se,{variant:"secondary",size:"sm",asChild:!0,children:l.jsxs("a",{href:o.url,target:"_blank",rel:"noopener noreferrer",children:[l.jsx(Yn,{size:14}),a("experiments.implementation.viewPr")]})}),s.taskKey&&l.jsx(Se,{variant:"secondary",size:"sm",asChild:!0,children:l.jsxs(As,{to:"/$org/tasks/{-$taskKey}",params:{org:n,taskKey:s.taskKey},children:[l.jsx(eu,{size:14}),a("experiments.implementation.viewImplementation")]})})]})}),e[11]=s,e[12]=r,e[13]=n,e[14]=o,e[15]=c,e[16]=a,e[17]=h):h=e[17];let g;return e[18]!==x||e[19]!==h?(g=l.jsxs(Js,{className:"flex-row flex-wrap items-center justify-between gap-3 p-4",children:[x,h]}),e[18]=x,e[19]=h,e[20]=g):g=e[20],g}function fv(t,e){return JSON.stringify(t)===JSON.stringify(e)}function pv(t){const e=O.c(129),{site:s,experiment:n,baseUrl:i,org:r,agentId:a,onBack:o,actions:c}=t,d=ie(),m=ho(s),u=mv(n),f=Jd(),p=Zd();let x;e[0]!==n.status||e[1]!==p?(x=p(n.status),e[0]=n.status,e[1]=p,e[2]=x):x=e[2];let h,g;e[3]!==x?([h,...g]=x,e[3]=x,e[4]=h,e[5]=g):(h=e[4],g=e[5]);let v;e[6]!==n.variants?(v=wa(n.variants),e[6]=n.variants,e[7]=v):v=e[7];const b=v,[y,j]=Z.useState(b),[N,w]=Z.useState(!1),[S,k]=Z.useState(n.name);let _;e[8]!==y||e[9]!==b?(_=fv(y,b),e[8]=y,e[9]=b,e[10]=_):_=e[10];const $=!_;let T;e[11]!==y?(T=y.reduce(gv,0)===100&&y.every(hv)&&new Set(y.map(xv)).size===y.length,e[11]=y,e[12]=T):T=e[12];const P=T;let I;e[13]!==y||e[14]!==n.key||e[15]!==m?(I=()=>m.mutate({key:n.key,variants:Na(y)}),e[13]=y,e[14]=n.key,e[15]=m,e[16]=I):I=e[16];const C=I;let M;e[17]!==n.key||e[18]!==n.name||e[19]!==S||e[20]!==m?(M=()=>{w(!1);const Pe=S.trim();Pe&&Pe!==n.name?m.mutate({key:n.key,name:Pe}):k(n.name)},e[17]=n.key,e[18]=n.name,e[19]=S,e[20]=m,e[21]=M):M=e[21];const A=M;let F;e[22]!==d?(F=d("experiments.title"),e[22]=d,e[23]=F):F=e[23];let E;e[24]!==o||e[25]!==F?(E={label:F,onSelect:o},e[24]=o,e[25]=F,e[26]=E):E=e[26];let z;e[27]!==A||e[28]!==n.name||e[29]!==S||e[30]!==N||e[31]!==d?(z=N?l.jsx("input",{value:S,onChange:Pe=>k(Pe.target.value),onBlur:A,onKeyDown:Pe=>{Pe.key==="Enter"&&A(),Pe.key==="Escape"&&(k(n.name),w(!1))},"aria-label":d("experiments.action.rename"),autoFocus:!0,className:"field-sizing-content min-w-24 max-w-md bg-transparent outline-none"}):n.name,e[27]=A,e[28]=n.name,e[29]=S,e[30]=N,e[31]=d,e[32]=z):z=e[32];let R;e[33]!==z?(R=[{key:"experiment",label:z}],e[33]=z,e[34]=R):R=e[34];let V;e[35]!==R||e[36]!==E?(V=l.jsx(We.Breadcrumbs,{after:"page",parent:E,items:R}),e[35]=R,e[36]=E,e[37]=V):V=e[37];let K;e[38]!==n||e[39]!==f?(K=f(n),e[38]=n,e[39]=f,e[40]=K):K=e[40];let U;e[41]!==K?(U=l.jsx("span",{className:"hidden text-xs text-muted-foreground @lg/panel-header:inline",children:K}),e[41]=K,e[42]=U):U=e[42];let q;e[43]!==n.status?(q=l.jsx(Xd,{status:n.status}),e[43]=n.status,e[44]=q):q=e[44];let L;e[45]!==U||e[46]!==q?(L=l.jsxs(l.Fragment,{children:[U,q]}),e[45]=U,e[46]=q,e[47]=L):L=e[47];let B;e[48]!==c||e[49]!==$||e[50]!==h||e[51]!==C||e[52]!==b||e[53]!==d||e[54]!==m.isPending||e[55]!==P?(B=$?l.jsxs(l.Fragment,{children:[l.jsx(Se,{variant:"outline",size:"sm",onClick:()=>j(b),children:d("experiments.split.reset")}),l.jsxs(Se,{size:"sm",onClick:C,disabled:!P||m.isPending,children:[m.isPending&&l.jsx(is,{size:"2xs"}),d("experiments.preview.saveChanges")]})]}):h&&l.jsxs(Se,{size:"sm",onClick:()=>c.onStatusChange(h.to),disabled:m.isPending,children:[l.jsx(h.icon,{size:14}),h.label]}),e[48]=c,e[49]=$,e[50]=h,e[51]=C,e[52]=b,e[53]=d,e[54]=m.isPending,e[55]=P,e[56]=B):B=e[56];let Y;e[57]!==d?(Y=d("experiments.action.more"),e[57]=d,e[58]=Y):Y=e[58];let J;e[59]===Symbol.for("react.memo_cache_sentinel")?(J=l.jsx(a1,{size:16}),e[59]=J):J=e[59];let X;e[60]!==Y?(X=l.jsx(gn,{asChild:!0,children:l.jsx(Se,{variant:"outline",size:"icon-sm","aria-label":Y,children:J})}),e[60]=Y,e[61]=X):X=e[61];let ee,te;e[62]===Symbol.for("react.memo_cache_sentinel")?(ee=()=>w(!0),te=l.jsx(xr,{}),e[62]=ee,e[63]=te):(ee=e[62],te=e[63]);let D;e[64]!==d?(D=d("experiments.action.rename"),e[64]=d,e[65]=D):D=e[65];let W;e[66]!==D?(W=l.jsxs(Es,{onSelect:ee,children:[te,D]}),e[66]=D,e[67]=W):W=e[67];let G;e[68]!==c||e[69]!==g?(G=g.map(Pe=>l.jsxs(Es,{onSelect:()=>c.onStatusChange(Pe.to),children:[l.jsx(Pe.icon,{}),Pe.label]},Pe.to)),e[68]=c,e[69]=g,e[70]=G):G=e[70];const Q=c.onImplement;let re;e[71]===Symbol.for("react.memo_cache_sentinel")?(re=l.jsx(la,{}),e[71]=re):re=e[71];let ce;e[72]!==d?(ce=d("experiments.action.implement"),e[72]=d,e[73]=ce):ce=e[73];let ae;e[74]!==c.onImplement||e[75]!==ce?(ae=l.jsxs(Es,{onSelect:Q,children:[re,ce]}),e[74]=c.onImplement,e[75]=ce,e[76]=ae):ae=e[76];let fe;e[77]!==a||e[78]!==r?(fe={org:r,agentId:a},e[77]=a,e[78]=r,e[79]=fe):fe=e[79];let de,se;e[80]===Symbol.for("react.memo_cache_sentinel")?(de={view:"experiments"},se=l.jsx(Yn,{}),e[80]=de,e[81]=se):(de=e[80],se=e[81]);let H;e[82]!==d?(H=d("experiments.action.viewData"),e[82]=d,e[83]=H):H=e[83];let oe;e[84]!==fe||e[85]!==H?(oe=l.jsx(Es,{asChild:!0,children:l.jsxs(As,{to:Cs.monitoring,params:fe,search:de,children:[se,H]})}),e[84]=fe,e[85]=H,e[86]=oe):oe=e[86];let he;e[87]===Symbol.for("react.memo_cache_sentinel")?(he=l.jsx(o1,{}),e[87]=he):he=e[87];const le=c.onDelete;let ne;e[88]===Symbol.for("react.memo_cache_sentinel")?(ne=l.jsx(qa,{}),e[88]=ne):ne=e[88];let me;e[89]!==d?(me=d("experiments.action.delete"),e[89]=d,e[90]=me):me=e[90];let ge;e[91]!==c.onDelete||e[92]!==me?(ge=l.jsxs(Es,{variant:"destructive",onSelect:le,children:[ne,me]}),e[91]=c.onDelete,e[92]=me,e[93]=ge):ge=e[93];let ve;e[94]!==W||e[95]!==G||e[96]!==ae||e[97]!==oe||e[98]!==ge?(ve=l.jsxs(vn,{align:"end",className:"w-56",children:[W,G,ae,oe,he,ge]}),e[94]=W,e[95]=G,e[96]=ae,e[97]=oe,e[98]=ge,e[99]=ve):ve=e[99];let be;e[100]!==X||e[101]!==ve?(be=l.jsxs(hn,{modal:!1,children:[X,ve]}),e[100]=X,e[101]=ve,e[102]=be):be=e[102];let we;e[103]!==L||e[104]!==B||e[105]!==be?(we=l.jsxs(We.Actions,{secondary:L,children:[B,be]}),e[103]=L,e[104]=B,e[105]=be,e[106]=we):we=e[106];const $e=n.status==="draft";let je;e[107]!==y||e[108]!==$e?(je=l.jsx(em,{arms:y,onChange:j,structureEditable:$e}),e[107]=y,e[108]=$e,e[109]=je):je=e[109];let xe;e[110]!==c.onImplement||e[111]!==n||e[112]!==u||e[113]!==r?(xe=l.jsx(uv,{experiment:n,org:r,implementation:u,onImplement:c.onImplement}),e[110]=c.onImplement,e[111]=n,e[112]=u,e[113]=r,e[114]=xe):xe=e[114];let ke;e[115]!==i||e[116]!==n.key||e[117]!==n.variants||e[118]!==u||e[119]!==d?(ke=i?u.stage!=="writing"&&u.stage!=="deploying"&&l.jsx(tm,{baseUrl:i,treatmentUrl:u.previewUrl,testKey:n.key,arms:n.variants}):l.jsx(Ke,{title:d("experiments.preview.noUrlTitle"),description:d("experiments.preview.noUrlDesc")}),e[115]=i,e[116]=n.key,e[117]=n.variants,e[118]=u,e[119]=d,e[120]=ke):ke=e[120];let _e;e[121]!==je||e[122]!==xe||e[123]!==ke?(_e=l.jsx(We.Content,{children:l.jsxs(We.Container,{className:"flex flex-col gap-6",children:[je,xe,ke]})}),e[121]=je,e[122]=xe,e[123]=ke,e[124]=_e):_e=e[124];let Ae;return e[125]!==V||e[126]!==we||e[127]!==_e?(Ae=l.jsxs(We,{children:[V,we,_e]}),e[125]=V,e[126]=we,e[127]=_e,e[128]=Ae):Ae=e[128],Ae}function xv(t){return t.id.trim()}function hv(t){return t.id.trim()}function gv(t,e){return t+e.weight}function vv(t){const e=O.c(174),{site:s,baseUrl:n,initial:i,onBack:r,onCreated:a}=t,o=ie(),c=po(s),d=Vg(s);let m;e[0]===Symbol.for("react.memo_cache_sentinel")?(m={openCard:!1},e[0]=m):m=e[0];const u=xo(s,m),f=Rd(s),p=zg(s),[x,h]=Z.useState(!1),[g,v]=Z.useState(i?.key??""),[b,y]=Z.useState(i?.name??""),[j,N]=Z.useState(i?.hypothesis??"");let w;e[1]!==i?(w=i?wa(i.variants):Z5,e[1]=i,e[2]=w):w=e[2];const[S,k]=Z.useState(w),[_,$]=Z.useState(""),[T,P]=Z.useState(0),[I,C]=Z.useState(!1),[M,A]=Z.useState(null);let F;e[3]!==S?(F=JSON.stringify(S.map(Sv)),e[3]=S,e[4]=F):F=e[4];const E=F,z=M===E;let R;e[5]!==S?(R=S.some(kv),e[5]=S,e[6]=R):R=e[6];const V=R;let K;e[7]!==S?(K=S.reduce(Nv,0),e[7]=S,e[8]=K):K=e[8];const U=K;let q;e[9]!==g||e[10]!==b||e[11]!==U?(q=!!g.trim()&&!!b.trim()&&U===100,e[9]=g,e[10]=b,e[11]=U,e[12]=q):q=e[12];const L=q;let B;e[13]!==S?(B=Re=>({key:Re,variants:Na(S).map(wv)}),e[13]=S,e[14]=B):B=e[14];const Y=B;let J;e[15]!==S||e[16]!==V||e[17]!==E||e[18]!==d||e[19]!==Y||e[20]!==z||e[21]!==g||e[22]!==p?(J=async()=>{V&&!z&&(await d.mutateAsync(Y(g.trim()))).implemented&&A(E);const Re=await p.mutateAsync({key:g.trim(),variants:S.map(yv)});C(Re.synced),P(jv)},e[15]=S,e[16]=V,e[17]=E,e[18]=d,e[19]=Y,e[20]=z,e[21]=g,e[22]=p,e[23]=J):J=e[23];const X=J;let ee;e[24]!==_||e[25]!==f?(ee=()=>{_.trim()&&f.mutate(_.trim(),{onSuccess:Re=>{v(Re.key),y(Re.name),N(Re.hypothesis),k(wa(Re.variants)),$("")}})},e[24]=_,e[25]=f,e[26]=ee):ee=e[26];const te=ee;let D;e[27]!==S||e[28]!==V||e[29]!==c||e[30]!==u||e[31]!==d||e[32]!==Y||e[33]!==z||e[34]!==g||e[35]!==b||e[36]!==a||e[37]!==p?(D=()=>{c.mutate({key:g.trim(),name:b.trim(),variants:Na(S)},{onSuccess:Re=>{V&&!z&&d.mutate(Y(Re.key)),V&&u.mutate(Re.key),p.mutate({key:Re.key,variants:Re.variants.map(bv)}),a(Re.key)}})},e[27]=S,e[28]=V,e[29]=c,e[30]=u,e[31]=d,e[32]=Y,e[33]=z,e[34]=g,e[35]=b,e[36]=a,e[37]=p,e[38]=D):D=e[38];const W=D,G=p.isPending||d.isPending;let Q;e[39]!==o?(Q=o("experiments.title"),e[39]=o,e[40]=Q):Q=e[40];let re;e[41]!==r||e[42]!==Q?(re={label:Q,onSelect:r},e[41]=r,e[42]=Q,e[43]=re):re=e[43];let ce;e[44]!==o?(ce=o("experiments.new"),e[44]=o,e[45]=ce):ce=e[45];let ae;e[46]!==ce?(ae=[{key:"new",label:ce}],e[46]=ce,e[47]=ae):ae=e[47];let fe;e[48]!==re||e[49]!==ae?(fe=l.jsx(We.Breadcrumbs,{after:"page",parent:re,items:ae}),e[48]=re,e[49]=ae,e[50]=fe):fe=e[50];let de;e[51]!==g||e[52]!==G?(de=G||!g.trim(),e[51]=g,e[52]=G,e[53]=de):de=e[53];let se;e[54]!==G?(se=G&&l.jsx(is,{size:"2xs"}),e[54]=G,e[55]=se):se=e[55];let H;e[56]!==o?(H=o("experiments.preview.updatePreview"),e[56]=o,e[57]=H):H=e[57];let oe;e[58]!==de||e[59]!==se||e[60]!==H||e[61]!==X?(oe=l.jsxs(Se,{variant:"outline",size:"sm",onClick:X,disabled:de,children:[se,H]}),e[58]=de,e[59]=se,e[60]=H,e[61]=X,e[62]=oe):oe=e[62];let he;e[63]===Symbol.for("react.memo_cache_sentinel")?(he=()=>h(!0),e[63]=he):he=e[63];const le=!L;let ne;e[64]!==o?(ne=o("experiments.dialog.create"),e[64]=o,e[65]=ne):ne=e[65];let me;e[66]!==le||e[67]!==ne?(me=l.jsx(Se,{size:"sm",onClick:he,disabled:le,children:ne}),e[66]=le,e[67]=ne,e[68]=me):me=e[68];let ge;e[69]!==oe||e[70]!==me?(ge=l.jsx(We.Actions,{secondary:oe,children:me}),e[69]=oe,e[70]=me,e[71]=ge):ge=e[71];let ve;e[72]!==j||e[73]!==o?(ve=j&&l.jsxs("p",{className:"text-sm",children:[l.jsxs("span",{className:"text-muted-foreground",children:[o("experiments.prompt.hypothesis"),":"," "]}),j]}),e[72]=j,e[73]=o,e[74]=ve):ve=e[74];let be;e[75]!==o?(be=o("experiments.dialog.name"),e[75]=o,e[76]=be):be=e[76];let we;e[77]!==be?(we=l.jsx(Ns,{children:be}),e[77]=be,e[78]=we):we=e[78];let $e;e[79]===Symbol.for("react.memo_cache_sentinel")?($e=Re=>y(Re.target.value),e[79]=$e):$e=e[79];let je;e[80]!==b?(je=l.jsx(ds,{value:b,onChange:$e}),e[80]=b,e[81]=je):je=e[81];let xe;e[82]!==we||e[83]!==je?(xe=l.jsxs("div",{className:"flex flex-col gap-1.5",children:[we,je]}),e[82]=we,e[83]=je,e[84]=xe):xe=e[84];let ke;e[85]!==o?(ke=o("experiments.dialog.key"),e[85]=o,e[86]=ke):ke=e[86];let _e;e[87]!==ke?(_e=l.jsx(Ns,{children:ke}),e[87]=ke,e[88]=_e):_e=e[88];let Ae;e[89]===Symbol.for("react.memo_cache_sentinel")?(Ae=Re=>v(Re.target.value),e[89]=Ae):Ae=e[89];let Pe;e[90]!==g?(Pe=l.jsx(ds,{value:g,onChange:Ae}),e[90]=g,e[91]=Pe):Pe=e[91];let Be;e[92]!==_e||e[93]!==Pe?(Be=l.jsxs("div",{className:"flex flex-col gap-1.5",children:[_e,Pe]}),e[92]=_e,e[93]=Pe,e[94]=Be):Be=e[94];let Xe;e[95]!==xe||e[96]!==Be?(Xe=l.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[xe,Be]}),e[95]=xe,e[96]=Be,e[97]=Xe):Xe=e[97];let st;e[98]===Symbol.for("react.memo_cache_sentinel")?(st=Re=>$(Re.target.value),e[98]=st):st=e[98];let Ze;e[99]!==o?(Ze=o("experiments.prompt.regeneratePlaceholder"),e[99]=o,e[100]=Ze):Ze=e[100];let lt;e[101]!==_||e[102]!==Ze?(lt=l.jsx(Lf,{value:_,onChange:st,placeholder:Ze,rows:1,className:"flex-1 resize-none"}),e[101]=_,e[102]=Ze,e[103]=lt):lt=e[103];let Ie;e[104]!==_||e[105]!==f.isPending?(Ie=f.isPending||!_.trim(),e[104]=_,e[105]=f.isPending,e[106]=Ie):Ie=e[106];let Oe;e[107]!==f.isPending?(Oe=f.isPending?l.jsx(is,{size:"2xs"}):l.jsx(p1,{size:14}),e[107]=f.isPending,e[108]=Oe):Oe=e[108];let Ue;e[109]!==o?(Ue=o("experiments.prompt.regenerate"),e[109]=o,e[110]=Ue):Ue=e[110];let Je;e[111]!==te||e[112]!==Ie||e[113]!==Oe||e[114]!==Ue?(Je=l.jsxs(Se,{variant:"secondary",onClick:te,disabled:Ie,children:[Oe,Ue]}),e[111]=te,e[112]=Ie,e[113]=Oe,e[114]=Ue,e[115]=Je):Je=e[115];let ut;e[116]!==lt||e[117]!==Je?(ut=l.jsxs("div",{className:"flex items-end gap-2",children:[lt,Je]}),e[116]=lt,e[117]=Je,e[118]=ut):ut=e[118];let _t;e[119]!==ve||e[120]!==Xe||e[121]!==ut?(_t=l.jsxs(Js,{className:"gap-4 p-6",children:[ve,Xe,ut]}),e[119]=ve,e[120]=Xe,e[121]=ut,e[122]=_t):_t=e[122];let ft;e[123]!==S?(ft=l.jsx(em,{arms:S,onChange:k,structureEditable:!0}),e[123]=S,e[124]=ft):ft=e[124];let Ge;e[125]!==S||e[126]!==n||e[127]!==g||e[128]!==T||e[129]!==I||e[130]!==o?(Ge=n?I?l.jsx(tm,{baseUrl:n,testKey:g.trim(),arms:S,reloadNonce:T}):l.jsx("p",{className:"text-center text-sm text-muted-foreground",children:o("experiments.preview.notSyncedYet")}):l.jsx(Ke,{title:o("experiments.preview.noUrlTitle"),description:o("experiments.preview.noUrlDesc")}),e[125]=S,e[126]=n,e[127]=g,e[128]=T,e[129]=I,e[130]=o,e[131]=Ge):Ge=e[131];let Ee;e[132]!==_t||e[133]!==ft||e[134]!==Ge?(Ee=l.jsx(We.Content,{children:l.jsxs(We.Container,{className:"flex flex-col gap-6",children:[_t,ft,Ge]})}),e[132]=_t,e[133]=ft,e[134]=Ge,e[135]=Ee):Ee=e[135];let vt;e[136]!==g||e[137]!==o?(vt=o("experiments.confirm.title",{key:g.trim()}),e[136]=g,e[137]=o,e[138]=vt):vt=e[138];let Nt;e[139]!==vt?(Nt=l.jsx($a,{children:vt}),e[139]=vt,e[140]=Nt):Nt=e[140];let Vt;e[141]!==V||e[142]!==o?(Vt=o(V?"experiments.confirm.withImplement":"experiments.confirm.withoutImplement"),e[141]=V,e[142]=o,e[143]=Vt):Vt=e[143];let $t;e[144]!==Vt?($t=l.jsx(Ta,{children:Vt}),e[144]=Vt,e[145]=$t):$t=e[145];let kt;e[146]!==Nt||e[147]!==$t?(kt=l.jsxs(Pa,{children:[Nt,$t]}),e[146]=Nt,e[147]=$t,e[148]=kt):kt=e[148];let Tt;e[149]!==o?(Tt=o("experiments.dialog.cancel"),e[149]=o,e[150]=Tt):Tt=e[150];let Lt;e[151]!==Tt?(Lt=l.jsx(Ca,{children:Tt}),e[151]=Tt,e[152]=Lt):Lt=e[152];let Pt;e[153]!==V||e[154]!==o?(Pt=o(V?"experiments.confirm.proceedWithImplement":"experiments.confirm.proceed"),e[153]=V,e[154]=o,e[155]=Pt):Pt=e[155];let bt;e[156]!==W||e[157]!==c.isPending||e[158]!==Pt?(bt=l.jsx(_a,{onClick:W,disabled:c.isPending,children:Pt}),e[156]=W,e[157]=c.isPending,e[158]=Pt,e[159]=bt):bt=e[159];let qt;e[160]!==Lt||e[161]!==bt?(qt=l.jsxs(Ea,{children:[Lt,bt]}),e[160]=Lt,e[161]=bt,e[162]=qt):qt=e[162];let jt;e[163]!==kt||e[164]!==qt?(jt=l.jsxs(Ma,{children:[kt,qt]}),e[163]=kt,e[164]=qt,e[165]=jt):jt=e[165];let Dt;e[166]!==x||e[167]!==jt?(Dt=l.jsx(Ia,{open:x,onOpenChange:h,children:jt}),e[166]=x,e[167]=jt,e[168]=Dt):Dt=e[168];let ps;return e[169]!==fe||e[170]!==ge||e[171]!==Ee||e[172]!==Dt?(ps=l.jsxs(We,{children:[fe,ge,Ee,Dt]}),e[169]=fe,e[170]=ge,e[171]=Ee,e[172]=Dt,e[173]=ps):ps=e[173],ps}function bv(t){return{id:t.id,weight:t.weight}}function jv(t){return t+1}function yv(t){return{id:t.id.trim(),weight:t.weight}}function wv(t){const{id:e,role:s,description:n}=t;return{id:e,role:s,description:n}}function Nv(t,e){return t+e.weight}function kv(t){return t.description.trim()}function Sv(t){return t.description}function sm(t){const e=O.c(44),{experiment:s,onOpen:n,actions:i,project:r}=t,a=ie(),o=Jd(),c=Zd();let d;if(e[0]!==i||e[1]!==s||e[2]!==o||e[3]!==n||e[4]!==r||e[5]!==a||e[6]!==c){const m=c(s.status);let u,f,p,x,h;if(e[8]!==s.name||e[9]!==s.variants||e[10]!==n){const $=s.variants.filter(Tv);h="group relative flex items-center gap-4 px-5 py-4 transition-colors hover:bg-accent",p="flex min-w-0 flex-1 flex-col gap-0.5",e[16]!==s.name||e[17]!==n?(x=l.jsx("button",{type:"button",onClick:n,className:"truncate text-left text-sm font-medium text-foreground after:absolute after:inset-0 focus-visible:outline-none focus-visible:after:ring-2 focus-visible:after:ring-ring focus-visible:after:ring-inset",children:s.name}),e[16]=s.name,e[17]=n,e[18]=x):x=e[18],u="truncate text-xs text-muted-foreground",f=$.map($v).join(" · "),e[8]=s.name,e[9]=s.variants,e[10]=n,e[11]=u,e[12]=f,e[13]=p,e[14]=x,e[15]=h}else u=e[11],f=e[12],p=e[13],x=e[14],h=e[15];let g;e[19]!==u||e[20]!==f?(g=l.jsx("span",{className:u,children:f}),e[19]=u,e[20]=f,e[21]=g):g=e[21];let v;e[22]!==p||e[23]!==x||e[24]!==g?(v=l.jsxs("div",{className:p,children:[x,g]}),e[22]=p,e[23]=x,e[24]=g,e[25]=v):v=e[25];let b;e[26]!==s.variants?(b=l.jsx(E1,{arms:s.variants,size:22,thickness:5}),e[26]=s.variants,e[27]=b):b=e[27];let y;e[28]!==s.variants?(y=s.variants.map(_v).join(" / "),e[28]=s.variants,e[29]=y):y=e[29];let j;e[30]!==y?(j=l.jsx("span",{className:"text-xs tabular-nums text-muted-foreground",children:y}),e[30]=y,e[31]=j):j=e[31];let N;e[32]!==b||e[33]!==j?(N=l.jsxs("div",{className:"flex w-36 flex-shrink-0 items-center gap-2.5",children:[b,j]}),e[32]=b,e[33]=j,e[34]=N):N=e[34];let w;e[35]!==s||e[36]!==o?(w=o(s),e[35]=s,e[36]=o,e[37]=w):w=e[37];let S;e[38]!==w?(S=l.jsx("span",{className:"hidden w-32 flex-shrink-0 text-xs text-muted-foreground md:block",children:w}),e[38]=w,e[39]=S):S=e[39];let k;e[40]!==s.status?(k=l.jsx("div",{className:"flex w-24 flex-shrink-0",children:l.jsx(Xd,{status:s.status})}),e[40]=s.status,e[41]=k):k=e[41];let _;e[42]!==r?(_=r&&l.jsx("div",{className:"hidden w-44 flex-shrink-0 text-xs text-muted-foreground lg:flex",children:r}),e[42]=r,e[43]=_):_=e[43],d=l.jsxs("div",{className:h,children:[v,N,S,k,_,i&&l.jsx("div",{className:"relative z-10 flex-shrink-0",children:l.jsxs(hn,{modal:!1,children:[l.jsx(gn,{asChild:!0,children:l.jsx(Se,{variant:"ghost",size:"icon-sm","aria-label":a("experiments.action.more"),className:"opacity-0 transition-opacity group-hover:opacity-100 focus-visible:opacity-100 data-[state=open]:opacity-100",children:l.jsx(a1,{size:16})})}),l.jsxs(vn,{align:"end",className:"w-48",children:[m.map($=>l.jsxs(Es,{onSelect:()=>i.onStatusChange($.to),children:[l.jsx($.icon,{}),$.label]},$.to)),m.length>0&&l.jsx(o1,{}),l.jsxs(Es,{variant:"destructive",onSelect:i.onDelete,children:[l.jsx(qa,{}),a("experiments.action.delete")]})]})]})})]}),e[0]=i,e[1]=s,e[2]=o,e[3]=n,e[4]=r,e[5]=a,e[6]=c,e[7]=d}else d=e[7];return d}function _v(t){return t.weight}function $v(t){return t.description||t.id}function Tv(t){return t.role!=="control"}function Pv(t){const e=O.c(121),{virtualMcpId:s}=t,n=ie(),i=Qd(),r=Va(s),{org:a}=He();let o;e[0]!==r?(o=bn(r),e[0]=r,e[1]=o):o=e[1];const c=o,d=r?.metadata;let m;e[2]!==d?(m=Of(d),e[2]=d,e[3]=m):m=e[3];const u=m,[f,p]=Z.useState(!1);let x;e[4]===Symbol.for("react.memo_cache_sentinel")?(x={open:!1,initial:null},e[4]=x):x=e[4];const[h,g]=Z.useState(x),[v,b]=Z.useState(null);let y;e[5]===Symbol.for("react.memo_cache_sentinel")?(y=[],e[5]=y):y=e[5];const[j,N]=Z.useState(y),[w,S]=Z.useState(""),[k,_]=Z.useState(null),{data:$,isLoading:T}=Od(c??""),P=ho(c??""),I=Fd(c??""),C=xo(c??"");if(!c){let ne;e[6]!==n?(ne=n("experiments.title"),e[6]=n,e[7]=ne):ne=e[7];let me;e[8]!==n?(me=n("experiments.noSite"),e[8]=n,e[9]=me):me=e[9];let ge;return e[10]!==ne||e[11]!==me?(ge=l.jsx(We,{children:l.jsx(We.Content,{children:l.jsx(We.Container,{children:l.jsx(Ke,{title:ne,description:me})})})}),e[10]=ne,e[11]=me,e[12]=ge):ge=e[12],ge}let M;e[13]!==P?(M=ne=>({onStatusChange:me=>P.mutate({key:ne.key,status:me}),onImplement:()=>_({kind:"implement",key:ne.key}),onDelete:()=>_({kind:"delete",key:ne.key})}),e[13]=P,e[14]=M):M=e[14];const A=M,F=!!k;let E;e[15]===Symbol.for("react.memo_cache_sentinel")?(E=ne=>!ne&&_(null),e[15]=E):E=e[15];let z;e[16]!==k?.kind||e[17]!==n?(z=k?.kind==="delete"?n("experiments.deleteTitle"):n("experiments.implementTitle"),e[16]=k?.kind,e[17]=n,e[18]=z):z=e[18];let R;e[19]!==z?(R=l.jsx($a,{children:z}),e[19]=z,e[20]=R):R=e[20];let V;e[21]!==k||e[22]!==n?(V=k?.kind==="delete"?n("experiments.deleteConfirm",{key:k.key}):n("experiments.implementConfirm",{key:k?.key??""}),e[21]=k,e[22]=n,e[23]=V):V=e[23];let K;e[24]!==V?(K=l.jsx(Ta,{children:V}),e[24]=V,e[25]=K):K=e[25];let U;e[26]!==R||e[27]!==K?(U=l.jsxs(Pa,{children:[R,K]}),e[26]=R,e[27]=K,e[28]=U):U=e[28];let q;e[29]!==n?(q=n("experiments.dialog.cancel"),e[29]=n,e[30]=q):q=e[30];let L;e[31]!==q?(L=l.jsx(Ca,{children:q}),e[31]=q,e[32]=L):L=e[32];let B;e[33]!==k||e[34]!==I||e[35]!==C||e[36]!==v?(B=()=>{k&&(k.kind==="delete"?(I.mutate(k.key),v===k.key&&b(null)):C.mutate(k.key))},e[33]=k,e[34]=I,e[35]=C,e[36]=v,e[37]=B):B=e[37];let Y;e[38]!==k?.kind||e[39]!==n?(Y=k?.kind==="delete"?n("experiments.action.delete"):n("experiments.implementProceed"),e[38]=k?.kind,e[39]=n,e[40]=Y):Y=e[40];let J;e[41]!==B||e[42]!==Y?(J=l.jsx(_a,{onClick:B,children:Y}),e[41]=B,e[42]=Y,e[43]=J):J=e[43];let X;e[44]!==L||e[45]!==J?(X=l.jsxs(Ea,{children:[L,J]}),e[44]=L,e[45]=J,e[46]=X):X=e[46];let ee;e[47]!==U||e[48]!==X?(ee=l.jsxs(Ma,{children:[U,X]}),e[47]=U,e[48]=X,e[49]=ee):ee=e[49];let te;e[50]!==ee||e[51]!==F?(te=l.jsx(Ia,{open:F,onOpenChange:E,children:ee}),e[50]=ee,e[51]=F,e[52]=te):te=e[52];const D=te;let W;if(e[53]!==A||e[54]!==u||e[55]!==D||e[56]!==$||e[57]!==v||e[58]!==a||e[59]!==c||e[60]!==s){W=Symbol.for("react.early_return_sentinel");e:{const ne=$?.find(me=>me.key===v)??null;if(ne){let me;e[62]===Symbol.for("react.memo_cache_sentinel")?(me=()=>b(null),e[62]=me):me=e[62];const ge=l.jsx(pv,{site:c,experiment:ne,baseUrl:u,org:a.slug,agentId:s,onBack:me,actions:A(ne)},ne.key);let ve;e[63]!==D||e[64]!==ge?(ve=l.jsxs(l.Fragment,{children:[ge,D]}),e[63]=D,e[64]=ge,e[65]=ve):ve=e[65],W=ve;break e}}e[53]=A,e[54]=u,e[55]=D,e[56]=$,e[57]=v,e[58]=a,e[59]=c,e[60]=s,e[61]=W}else W=e[61];if(W!==Symbol.for("react.early_return_sentinel"))return W;if(h.open){let ne,me;e[66]===Symbol.for("react.memo_cache_sentinel")?(ne=()=>g({open:!1,initial:null}),me=ve=>{g({open:!1,initial:null}),b(ve)},e[66]=ne,e[67]=me):(ne=e[66],me=e[67]);let ge;return e[68]!==u||e[69]!==h.initial||e[70]!==c?(ge=l.jsx(vv,{site:c,baseUrl:u,initial:h.initial,onBack:ne,onCreated:me}),e[68]=u,e[69]=h.initial,e[70]=c,e[71]=ge):ge=e[71],ge}let G;e[72]!==$?(G=ne=>$?.filter(me=>me.status===ne).length??0,e[72]=$,e[73]=G):G=e[73];const Q=G;let re,ce,ae,fe,de;if(e[74]!==A||e[75]!==Q||e[76]!==$||e[77]!==T||e[78]!==w||e[79]!==j||e[80]!==i||e[81]!==n){const ne=w.trim().toLowerCase();let me;e[87]!==j?(me=xe=>j.length===0||j.includes(xe.status),e[87]=j,e[88]=me):me=e[88];const ge=($??[]).filter(me).filter(xe=>!ne||xe.name.toLowerCase().includes(ne)).sort(Ev);ae=We;let ve;e[89]!==Q||e[90]!==$?.length||e[91]!==w||e[92]!==j||e[93]!==i||e[94]!==n?(ve=!!$?.length&&l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(Df,{value:w,onChange:S,label:n("experiments.filter.searchLabel"),placeholder:n("experiments.filter.searchPlaceholder"),clearLabel:n("experiments.filter.searchClear")}),l.jsxs(hn,{modal:!1,children:[l.jsx(gn,{asChild:!0,children:l.jsx(yn,{label:n("experiments.filter.label"),tooltipSide:"bottom",variant:"outline","aria-pressed":j.length>0,children:l.jsx(m1,{})})}),l.jsxs(vn,{align:"end",className:"w-52",children:[l.jsx(Rm,{children:n("experiments.filter.status")}),ya.map(xe=>l.jsxs(c1,{checked:j.includes(xe),onSelect:Cv,onCheckedChange:ke=>N(_e=>ke?[..._e,xe]:_e.filter(Ae=>Ae!==xe)),children:[l.jsx("span",{className:ye("size-1.5 rounded-full",Yd[xe])}),i(xe),l.jsx("span",{className:"ml-auto text-xs tabular-nums text-muted-foreground",children:Q(xe)})]},xe))]})]})]}),e[89]=Q,e[90]=$?.length,e[91]=w,e[92]=j,e[93]=i,e[94]=n,e[95]=ve):ve=e[95];let be,we;e[96]===Symbol.for("react.memo_cache_sentinel")?(be=()=>p(!0),we=l.jsx(ks,{size:16}),e[96]=be,e[97]=we):(be=e[96],we=e[97]);let $e;e[98]!==n?($e=n("experiments.new"),e[98]=n,e[99]=$e):$e=e[99];let je;e[100]!==$e?(je=l.jsxs(Se,{size:"sm",onClick:be,children:[we,$e]}),e[100]=$e,e[101]=je):je=e[101],e[102]!==ve||e[103]!==je?(de=l.jsx(We.Actions,{secondary:ve,children:je}),e[102]=ve,e[103]=je,e[104]=de):de=e[104],ce=We.Content,re=We.Container,fe=T?l.jsx("div",{className:"flex justify-center p-12",children:l.jsx(is,{})}):!$||$.length===0?l.jsx(Ke,{title:n("experiments.empty.title"),description:n("experiments.empty.desc"),buttonProps:{children:n("experiments.new"),onClick:()=>p(!0)}}):ge.length===0?l.jsx("p",{className:"py-12 text-center text-sm text-muted-foreground",children:n("experiments.filter.empty")}):l.jsx(Js,{size:"flush",className:"gap-0 divide-y divide-border overflow-hidden",children:ge.map(xe=>l.jsx(sm,{experiment:xe,onOpen:()=>b(xe.key),actions:A(xe)},xe.key))}),e[74]=A,e[75]=Q,e[76]=$,e[77]=T,e[78]=w,e[79]=j,e[80]=i,e[81]=n,e[82]=re,e[83]=ce,e[84]=ae,e[85]=fe,e[86]=de}else re=e[82],ce=e[83],ae=e[84],fe=e[85],de=e[86];let se;e[105]!==re||e[106]!==fe?(se=l.jsx(re,{children:fe}),e[105]=re,e[106]=fe,e[107]=se):se=e[107];let H;e[108]!==ce||e[109]!==se?(H=l.jsx(ce,{children:se}),e[108]=ce,e[109]=se,e[110]=H):H=e[110];let oe;e[111]===Symbol.for("react.memo_cache_sentinel")?(oe=ne=>g({open:!0,initial:ne}),e[111]=oe):oe=e[111];let he;e[112]!==f||e[113]!==c?(he=l.jsx(rv,{site:c,open:f,onOpenChange:p,onCreated:b,onManual:oe}),e[112]=f,e[113]=c,e[114]=he):he=e[114];let le;return e[115]!==ae||e[116]!==D||e[117]!==de||e[118]!==H||e[119]!==he?(le=l.jsxs(ae,{children:[de,H,he,D]}),e[115]=ae,e[116]=D,e[117]=de,e[118]=H,e[119]=he,e[120]=le):le=e[120],le}function Cv(t){return t.preventDefault()}function Ev(t,e){return ya.indexOf(t.status)-ya.indexOf(e.status)}function Mv(t){const e=O.c(7),{virtualMcpId:s}=t;let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n={strict:!1},e[0]=n):n=e[0];const{ui:i}=fr(n),r=Su("experiments_v2_enabled"),a=Ua(s);switch(Pf({flagEnabled:r,v8:a,ui:i})){case"v8":{let o;return e[1]!==s?(o=l.jsx(Cf,{virtualMcpId:s}),e[1]=s,e[2]=o):o=e[2],o}case"v2":{let o;return e[3]!==s?(o=l.jsx(Pv,{virtualMcpId:s}),e[3]=s,e[4]=o):o=e[4],o}case"legacy":{let o;return e[5]!==s?(o=l.jsx(Q5,{virtualMcpId:s}),e[5]=s,e[6]=o):o=e[6],o}}}function lm(){const t=O.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=l.jsx("div",{className:"surface flex flex-col divide-y divide-border",children:[0,1,2].map(Iv)}),t[0]=e):e=t[0],e}function Iv(t){return l.jsxs("div",{className:"flex flex-col gap-2 px-5 py-4",children:[l.jsx("div",{className:"h-4 w-1/3 rounded bg-muted"}),l.jsx("div",{className:"h-3 w-1/2 rounded bg-muted"})]},t)}function nm(t){const e=O.c(8),{project:s}=t;let n;e[0]!==s.icon||e[1]!==s.title?(n=l.jsx(Ba,{icon:s.icon,name:s.title}),e[0]=s.icon,e[1]=s.title,e[2]=n):n=e[2];let i;e[3]!==s.title?(i=l.jsx("span",{className:"truncate",children:s.title}),e[3]=s.title,e[4]=i):i=e[4];let r;return e[5]!==n||e[6]!==i?(r=l.jsxs("span",{className:"flex min-w-0 items-center gap-1.5",children:[n,i]}),e[5]=n,e[6]=i,e[7]=r):r=e[7],r}function Av(t,e){return+(e.experiment.status==="running")-+(t.experiment.status==="running")||Date.parse(e.experiment.updatedAt)-Date.parse(t.experiment.updatedAt)}function im(t){const e=O.c(5),s=gr();let n;if(e[0]!==s||e[1]!==t){let i;e[3]!==s?(i=r=>w1(s.find(a=>a.id===r.id)),e[3]=s,e[4]=i):i=e[4],n=t.map(i),e[0]=s,e[1]=t,e[2]=n}else n=e[2];return n}function Lv(t){const e=O.c(38),{projects:s,listV7:n}=t,i=ie(),{org:r,locator:a}=He(),o=Yt(),c=Cn(),d=im(s),m=n?s.filter(($,T)=>!d[T]):[];let u;if(e[0]!==s||e[1]!==d){let $;e[3]!==d?($=(T,P)=>d[P],e[3]=d,e[4]=$):$=e[4],u=s.filter($),e[0]=s,e[1]=d,e[2]=u}else u=e[2];const f=u;let p;e[5]!==a||e[6]!==o?(p=$=>({...Dd(a,o,$.site),retry:!1}),e[5]=a,e[6]=o,e[7]=p):p=e[7];const x=Wn({queries:m.map(p)});let h;e[8]!==x?(h=x.some(Ov),e[8]=x,e[9]=h):h=e[9];const g=h;let v;e[10]!==x?(v=($,T)=>x[T]?.isError,e[10]=x,e[11]=v):v=e[11];const b=m.filter(v);let y;e[12]!==x?(y=($,T)=>(x[T]?.data??[]).map(P=>({project:$,experiment:P})),e[12]=x,e[13]=y):y=e[13];const j=m.flatMap(y).sort(Av);if(!g&&j.length===0&&b.length===0&&f.length===0){const $=s[0]?.id??"";let T;e[14]!==r.slug||e[15]!==$?(T=Zs(r.slug,$,"experiments"),e[14]=r.slug,e[15]=$,e[16]=T):T=e[16];const P=T;let I;e[17]!==i?(I=i("monitor.locked.firstExperiment.title"),e[17]=i,e[18]=I):I=e[18];let C;e[19]!==i?(C=i("monitor.powers.siteExperiments"),e[19]=i,e[20]=C):C=e[20];let M;e[21]!==i?(M=i("monitor.connect.firstExperiment"),e[21]=i,e[22]=M):M=e[22];let A;e[23]!==P||e[24]!==M||e[25]!==C?(A=[{source:"site",state:"off",meta:C,label:M,link:P}],e[23]=P,e[24]=M,e[25]=C,e[26]=A):A=e[26];let F;e[27]===Symbol.for("react.memo_cache_sentinel")?(F=l.jsx(lm,{}),e[27]=F):F=e[27];let E;return e[28]!==P||e[29]!==A||e[30]!==I?(E=l.jsx(Ds,{kind:"metrics",title:I,steps:A,link:P,children:F}),e[28]=P,e[29]=A,e[30]=I,e[31]=E):E=e[31],E}const N="flex flex-col gap-2",w=(g||j.length>0)&&l.jsxs(Js,{size:"flush",className:"gap-0 divide-y divide-border overflow-hidden",children:[g&&j.length===0&&l.jsxs("div",{className:"flex flex-col gap-3 px-5 py-4",children:[l.jsx(Ce,{className:"h-4 w-1/2"}),l.jsx(Ce,{className:"h-4 w-1/3"})]}),j.map($=>{const{project:T,experiment:P}=$;return l.jsx(sm,{experiment:P,onOpen:()=>c(Zs(r.slug,T.id,"experiments")),project:l.jsx(nm,{project:T})},`${T.id}:${P.id}`)})]}),S=b.length>0&&l.jsx("p",{className:"text-meta px-2 pb-1",children:i("monitor.org.unreadable",{names:b.map(Dv).join(", ")})});let k;e[32]!==f?(k=f.length>0&&l.jsx(Rv,{projects:f}),e[32]=f,e[33]=k):k=e[33];let _;return e[34]!==k||e[35]!==w||e[36]!==S?(_=l.jsxs("div",{className:N,children:[w,S,k]}),e[34]=k,e[35]=w,e[36]=S,e[37]=_):_=e[37],_}function Dv(t){return t.title}function Ov(t){return t.isLoading}function Rv(t){const e=O.c(16),{projects:s}=t,n=ie(),{org:i}=He();let r;e[0]!==n?(r=n("monitor.org.blocks8ExperimentsTitle"),e[0]=n,e[1]=r):r=e[1];let a;e[2]!==r?(a=l.jsx("h2",{id:"monitor-blocks8-experiments-title",className:"text-meta px-2",children:r}),e[2]=r,e[3]=a):a=e[3];let o;if(e[4]!==i||e[5]!==s||e[6]!==n){let m;e[8]!==i||e[9]!==n?(m=u=>l.jsxs("div",{className:"flex items-center justify-between gap-4 px-5 py-3 text-sm",children:[l.jsx(nm,{project:u}),l.jsxs(As,{...Zs(i.slug,u.id,"experimentsApp"),"aria-label":n("monitor.org.openExperimentsNamed",{project:u.title}),className:"inline-flex shrink-0 items-center gap-1 text-xs font-medium text-foreground underline-offset-2 hover:underline",children:[n("monitor.org.openExperiments"),l.jsx(Yn,{size:12})]})]},u.id),e[8]=i,e[9]=n,e[10]=m):m=e[10],o=s.map(m),e[4]=i,e[5]=s,e[6]=n,e[7]=o}else o=e[7];let c;e[11]!==o?(c=l.jsx(Js,{size:"flush",className:"gap-0 divide-y divide-border overflow-hidden",children:o}),e[11]=o,e[12]=c):c=e[12];let d;return e[13]!==a||e[14]!==c?(d=l.jsxs("section",{className:"flex flex-col gap-2 pt-2","aria-labelledby":"monitor-blocks8-experiments-title","data-testid":"monitor-blocks8-experiments",children:[a,c]}),e[13]=a,e[14]=c,e[15]=d):d=e[15],d}function rm(t){const e=O.c(14),{scopeId:s}=t,n=ie(),{org:i}=He();let r;e[0]!==n?(r=n("monitor.locked.experiments.title"),e[0]=n,e[1]=r):r=e[1];let a;e[2]!==n?(a=n("monitor.powers.siteExperiments"),e[2]=n,e[3]=a):a=e[3];let o;e[4]!==a?(o=[{source:"site",state:"off",meta:a}],e[4]=a,e[5]=o):o=e[5];let c;e[6]!==i.slug||e[7]!==s?(c=Ss(i.slug,s),e[6]=i.slug,e[7]=s,e[8]=c):c=e[8];let d;e[9]===Symbol.for("react.memo_cache_sentinel")?(d=l.jsx(lm,{}),e[9]=d):d=e[9];let m;return e[10]!==r||e[11]!==o||e[12]!==c?(m=l.jsx("div",{className:"px-4 pt-6 pb-10 md:px-10",children:l.jsx(Ds,{kind:"metrics",title:r,steps:o,link:c,children:d})}),e[10]=r,e[11]=o,e[12]=c,e[13]=m):m=e[13],m}function Fv(t){const e=O.c(6),{scopeId:s}=t,n=En(),i=Ua(s);if(i){let a;return e[0]!==s?(a=l.jsx("div",{className:"flex h-full min-h-0 flex-col",children:l.jsx(Ef,{virtualMcpId:s})}),e[0]=s,e[1]=a):a=e[1],a}if(!P1(n.experiments,i)){let a;return e[2]!==s?(a=l.jsx(rm,{scopeId:s}),e[2]=s,e[3]=a):a=e[3],a}let r;return e[4]!==s?(r=l.jsx("div",{className:"flex h-full min-h-0 flex-col",children:l.jsx(Mv,{virtualMcpId:s})}),e[4]=s,e[5]=r):r=e[5],r}function zv(t){const e=O.c(3),{scopeId:s}=t;if(s){let i;return e[0]!==s?(i=l.jsx(Fv,{scopeId:s},s),e[0]=s,e[1]=i):i=e[1],i}let n;return e[2]===Symbol.for("react.memo_cache_sentinel")?(n=l.jsx(Vv,{}),e[2]=n):n=e[2],n}function Vv(){const t=O.c(4),e=En(),s=Rs(),n=im(s);if(s.length===0||!P1(e.experiments,n.some(Boolean))){let r;return t[0]===Symbol.for("react.memo_cache_sentinel")?(r=l.jsx(rm,{scopeId:null}),t[0]=r):r=t[0],r}let i;return t[1]!==s||t[2]!==e.experiments?(i=l.jsx("div",{className:"flex h-full min-h-0 flex-col overflow-auto",children:l.jsx("div",{className:"mx-auto flex w-full max-w-[1200px] flex-col gap-4 px-4 pt-6 pb-10 md:px-10",children:l.jsx(Lv,{projects:s,listV7:e.experiments})})}),t[1]=s,t[2]=e.experiments,t[3]=i):i=t[3],i}const qv=["1h","24h","7d"],Sn=["error","warn","info","ok","debug"],am=["log","span"],Hs=Qi().int().nonnegative().catch(0),Fc=Jt({error:Hs,warn:Hs,info:Hs,ok:Hs,debug:Hs}),Kv=Jt({id:Ct(),timestamp:Ct(),kind:_o(am),level:_o(Sn),service:Ct(),message:Ct(),durationMs:Qi().nullable().catch(null),traceId:Ct().nullable().catch(null),spanId:Ct().nullable().catch(null),attributes:Fm(Ct(),zm()).transform(t=>Object.fromEntries(Object.entries(t).flatMap(([e,s])=>s==null?[]:[[e,typeof s=="object"?JSON.stringify(s):String(s)]]))).catch({})}),Bv=Jt({total:Hs,histogram:Ms(Fc.extend({t:Ct()})).catch([]),facets:Jt({levels:Fc,services:Ms(Jt({name:Ct(),count:Hs})).catch([])}).catch({levels:{error:0,warn:0,info:0,ok:0,debug:0},services:[]}),events:Ms(Kv),nextCursor:Ct().nullable().catch(null)}),Hv=5e3,jo={error:{dot:"bg-destructive",text:"text-destructive",fill:"var(--destructive)"},warn:{dot:"bg-warning",text:"text-warning",fill:"var(--warning)"},info:{dot:"bg-chart-1",text:"text-chart-1",fill:"var(--chart-1)"},ok:{dot:"bg-success",text:"text-success",fill:"var(--success)"},debug:{dot:"bg-muted-foreground/50",text:"text-muted-foreground",fill:"var(--muted-foreground)"}},zc="grid grid-cols-[1rem_10.5rem_3.5rem_9rem_minmax(0,1fr)] items-center gap-3 px-4",Zt="all";function Wv(t,e){switch(t){case"1h":return e("monitor.logs.range.1h");case"24h":return e("monitor.logs.range.24h");case"7d":return e("monitor.logs.range.7d");default:return t}}function ui(t,e){switch(t){case"error":return e("monitor.logs.level.error");case"warn":return e("monitor.logs.level.warn");case"info":return e("monitor.logs.level.info");case"ok":return e("monitor.logs.level.ok");case"debug":return e("monitor.logs.level.debug");default:return t}}function om(t,e){switch(t){case"all":return e("monitor.logs.kind.all");case"log":return e("monitor.logs.kind.log");case"span":return e("monitor.logs.kind.span");default:return t}}function Uv(t,e,s,n,i){const r=O.c(19),{org:a}=He();let o,c,d,m;r[0]!==s.kind||r[1]!==s.level||r[2]!==s.service||r[3]!==a.slug||r[4]!==n||r[5]!==e||r[6]!==t?(c=new URLSearchParams({range:e}),s.kind!==Zt&&c.set("kinds",s.kind),s.level!==Zt&&c.set("levels",s.level),s.service!==Zt&&c.set("services",s.service),n&&c.set("q",n),o=`/api/${a.slug}/monitor/${encodeURIComponent(t)}/site/events`,m=u1,d=Qe.monitorSiteEvents(a.slug,t,c.toString()),r[0]=s.kind,r[1]=s.level,r[2]=s.service,r[3]=a.slug,r[4]=n,r[5]=e,r[6]=t,r[7]=o,r[8]=c,r[9]=d,r[10]=m):(o=r[7],c=r[8],d=r[9],m=r[10]);let u;r[11]!==o||r[12]!==c?(u=async h=>{const{pageParam:g}=h,v=new URLSearchParams(c);g&&v.set("cursor",g);const b=await ai(`${o}?${v}`);return b&&typeof b=="object"&&"available"in b&&b.available===!1?null:Bv.parse(b)},r[11]=o,r[12]=c,r[13]=u):u=r[13];const f=i?0:3e4,p=i?Hv:!1;let x;return r[14]!==d||r[15]!==u||r[16]!==f||r[17]!==p?(x={queryKey:d,queryFn:u,initialPageParam:"",getNextPageParam:Yv,retry:!1,staleTime:f,refetchInterval:p,placeholderData:Gv},r[14]=d,r[15]=u,r[16]=f,r[17]=p,r[18]=x):x=r[18],m(x)}function Gv(t){return t}function Yv(t){return t?.nextCursor??void 0}const Qv={total:2200,histogram:Array.from({length:48},(t,e)=>({t:new Date(Date.UTC(2026,0,1,0,e*30)).toISOString(),ok:30+Math.round(12*Math.sin(e/4)),info:e%7===0?2:0,warn:e%5===0?3:0,error:e%9===0?2:0,debug:0})),facets:{levels:{error:47,warn:40,info:13,ok:2100,debug:0},services:[]},events:[],nextCursor:null};function cm(){const t=O.c(24),e=ie();let s;t[0]!==e?(s=e("monitor.logs.events"),t[0]=e,t[1]=s):s=t[1];let n;t[2]!==s?(n=l.jsx(Me,{title:s,value:"2,200"}),t[2]=s,t[3]=n):n=t[3];let i;t[4]!==e?(i=e("monitor.logs.errors"),t[4]=e,t[5]=i):i=t[5];let r;t[6]!==i?(r=l.jsx(Me,{title:i,value:"47"}),t[6]=i,t[7]=r):r=t[7];let a;t[8]!==e?(a=e("monitor.logs.warnings"),t[8]=e,t[9]=a):a=t[9];let o;t[10]!==a?(o=l.jsx(Me,{title:a,value:"40"}),t[10]=a,t[11]=o):o=t[11];let c;t[12]!==n||t[13]!==r||t[14]!==o?(c=l.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[n,r,o]}),t[12]=n,t[13]=r,t[14]=o,t[15]=c):c=t[15];let d;t[16]!==e?(d=e("monitor.logs.overTime"),t[16]=e,t[17]=d):d=t[17];let m;t[18]===Symbol.for("react.memo_cache_sentinel")?(m=l.jsx(dm,{page:Qv,range:"24h"}),t[18]=m):m=t[18];let u;t[19]!==d?(u=l.jsx(Me,{title:d,children:m}),t[19]=d,t[20]=u):u=t[20];let f;return t[21]!==c||t[22]!==u?(f=l.jsxs(l.Fragment,{children:[c,u]}),t[21]=c,t[22]=u,t[23]=f):f=t[23],f}function Xv(t){const e=O.c(14),{scopeId:s,onProject:n}=t,i=En(),r=Rs();let a;if(e[0]!==r||e[1]!==s){let u;e[3]!==s?(u=f=>f.id===s,e[3]=s,e[4]=u):u=e[4],a=r.find(u),e[0]=r,e[1]=s,e[2]=a}else a=e[2];const o=a,c=Z.useRef(null);let d;e[5]!==n||e[6]!==o||e[7]!==r||e[8]!==s?(d=l.jsx("div",{ref:c,className:"flex h-full min-h-0 flex-col overflow-auto",children:l.jsx("div",{className:"mx-auto flex w-full max-w-[1200px] flex-col gap-4 px-4 pt-6 pb-10 md:px-10",children:o?l.jsx(Zv,{site:o.site,scroller:c},o.site):s?l.jsx(Ad,{}):l.jsx(rd,{projects:r,onProject:n,children:l.jsx(cm,{})})})}),e[5]=n,e[6]=o,e[7]=r,e[8]=s,e[9]=d):d=e[9];let m;return e[10]!==s||e[11]!==d||e[12]!==i.monitor?(m=l.jsx(Sr,{scopeId:s,enabled:i.monitor,children:d}),e[10]=s,e[11]=d,e[12]=i.monitor,e[13]=m):m=e[13],m}function Zv(t){const e=O.c(171),{site:s,scroller:n}=t,i=ie(),{org:r}=He(),[a,o]=Z.useState("1h"),[c,d]=Z.useState(!1),[m,u]=Z.useState("");let f;e[0]!==m?(f=m.trim(),e[0]=m,e[1]=f):f=e[1];const p=Z.useDeferredValue(f);let x;e[2]===Symbol.for("react.memo_cache_sentinel")?(x={kind:Zt,level:Zt,service:Zt},e[2]=x):x=e[2];const[h,g]=Z.useState(x),v=Uv(s,a,h,p,c),b=v.data?.pages[0];let y,j,N;if(e[3]!==h||e[4]!==b?.facets.services||e[5]!==c||e[6]!==i){const le=b?.facets.services??[];y=We.Actions;let ne;e[10]!==c?(ne=l.jsx(A1,{checked:c,onCheckedChange:d}),e[10]=c,e[11]=ne):ne=e[11];let me;e[12]!==i?(me=i("orgs.monitoring.live"),e[12]=i,e[13]=me):me=e[13],e[14]!==ne||e[15]!==me?(j=l.jsxs("label",{className:"text-meta flex cursor-pointer items-center gap-2 px-1",children:[ne,me]}),e[14]=ne,e[15]=me,e[16]=j):j=e[16],N=le.length>1&&l.jsx(ns,{label:i("monitor.logs.service"),value:h.service,options:[{value:Zt,label:i("monitor.logs.allServices")},...le.map(t6)],onChange:ge=>g({...h,service:ge})}),e[3]=h,e[4]=b?.facets.services,e[5]=c,e[6]=i,e[7]=y,e[8]=j,e[9]=N}else y=e[7],j=e[8],N=e[9];let w;e[17]!==i?(w=i("monitor.logs.type"),e[17]=i,e[18]=w):w=e[18];const S=h.kind;let k;e[19]!==i?(k=[Zt,...am].map(le=>({value:le,label:om(le,i)})),e[19]=i,e[20]=k):k=e[20];let _;e[21]!==h?(_=le=>g({...h,kind:le}),e[21]=h,e[22]=_):_=e[22];let $;e[23]!==h.kind||e[24]!==w||e[25]!==k||e[26]!==_?($=l.jsx(ns,{label:w,value:S,options:k,onChange:_}),e[23]=h.kind,e[24]=w,e[25]=k,e[26]=_,e[27]=$):$=e[27];let T;e[28]!==i?(T=i("monitor.logs.rangeLabel"),e[28]=i,e[29]=T):T=e[29];let P;e[30]!==i?(P=qv.map(le=>({value:le,label:Wv(le,i)})),e[30]=i,e[31]=P):P=e[31];let I;e[32]!==a||e[33]!==T||e[34]!==P?(I=l.jsx(ns,{label:T,period:!0,value:a,options:P,onChange:o}),e[32]=a,e[33]=T,e[34]=P,e[35]=I):I=e[35];let C;e[36]!==y||e[37]!==I||e[38]!==j||e[39]!==N||e[40]!==$?(C=l.jsxs(y,{children:[j,N,$,I]}),e[36]=y,e[37]=I,e[38]=j,e[39]=N,e[40]=$,e[41]=C):C=e[41];const M=C;if(v.isLoading){let le,ne,me;e[42]===Symbol.for("react.memo_cache_sentinel")?(le=l.jsx("div",{className:"grid grid-cols-3 gap-4",children:[0,1,2].map(e6)}),ne=l.jsx(Ce,{className:"h-64"}),me=l.jsx(Ce,{className:"h-96"}),e[42]=le,e[43]=ne,e[44]=me):(le=e[42],ne=e[43],me=e[44]);let ge;return e[45]!==M?(ge=l.jsxs(l.Fragment,{children:[M,le,ne,me]}),e[45]=M,e[46]=ge):ge=e[46],ge}if(v.error){let le;e[47]===Symbol.for("react.memo_cache_sentinel")?(le=l.jsx(nu,{size:20}),e[47]=le):le=e[47];let ne;e[48]!==i?(ne=i("monitor.logs.loadError"),e[48]=i,e[49]=ne):ne=e[49];let me;e[50]!==v.error.message||e[51]!==ne?(me=l.jsx(Ke,{icon:le,tone:"error",title:ne,description:v.error.message}),e[50]=v.error.message,e[51]=ne,e[52]=me):me=e[52];let ge;return e[53]!==M||e[54]!==me?(ge=l.jsxs(l.Fragment,{children:[M,me]}),e[53]=M,e[54]=me,e[55]=ge):ge=e[55],ge}if(!b){let le;e[56]!==i?(le=i("monitor.logs.unavailable"),e[56]=i,e[57]=le):le=e[57];let ne;e[58]!==r.slug?(ne=Ss(r.slug,null),e[58]=r.slug,e[59]=ne):ne=e[59];let me;e[60]!==i?(me=i("monitor.logs.blocks"),e[60]=i,e[61]=me):me=e[61];let ge;e[62]!==me?(ge=l.jsx(vr,{icon:"/logos/deco%20logo.svg",name:me,size:"xs",fit:"contain"}),e[62]=me,e[63]=ge):ge=e[63];let ve;e[64]!==i?(ve=i("monitor.logs.blocks"),e[64]=i,e[65]=ve):ve=e[65];let be;e[66]!==i?(be=i("monitor.logs.blocksMeta"),e[66]=i,e[67]=be):be=e[67];let we;e[68]!==ge||e[69]!==ve||e[70]!==be?(we=l.jsx("div",{children:l.jsx(Mn,{variant:"divided",lead:ge,title:ve,meta:be})}),e[68]=ge,e[69]=ve,e[70]=be,e[71]=we):we=e[71];let $e;e[72]===Symbol.for("react.memo_cache_sentinel")?($e=l.jsx(cm,{}),e[72]=$e):$e=e[72];let je;return e[73]!==le||e[74]!==ne||e[75]!==we?(je=l.jsx(Ds,{kind:"analytics",title:le,link:ne,guide:we,children:$e}),e[73]=le,e[74]=ne,e[75]=we,e[76]=je):je=e[76],je}let A,F,E,z,R,V,K,U,q,L,B;if(e[77]!==M||e[78]!==v.data?.pages||e[79]!==h.kind||e[80]!==h.level||e[81]!==h.service||e[82]!==b.facets.levels||e[83]!==p.length||e[84]!==i){const le=new Intl.NumberFormat;E=b.facets.levels;let ne;e[96]!==E?(ne=(je,xe)=>je+E[xe],e[96]=E,e[97]=ne):ne=e[97];const me=Sn.reduce(ne,0);let ge;e[98]!==me||e[99]!==i?(ge=je=>me>0?i("monitor.logs.share",{share:new Intl.NumberFormat(void 0,{style:"percent",maximumFractionDigits:1}).format(je/me)}):null,e[98]=me,e[99]=i,e[100]=ge):ge=e[100],R=ge;let ve;e[101]!==v.data?.pages?(ve=v.data?.pages.flatMap(Jv)??[],e[101]=v.data?.pages,e[102]=ve):ve=e[102],z=ve,F=p.length>0||h.level!==Zt||h.kind!==Zt||h.service!==Zt,B=M,U="grid grid-cols-1 gap-4 sm:grid-cols-3";let be;e[103]!==i?(be=i("monitor.logs.events"),e[103]=i,e[104]=be):be=e[104],q=l.jsx(Me,{title:be,value:le.format(me)});let we;e[105]!==i?(we=i("monitor.logs.errors"),e[105]=i,e[106]=we):we=e[106];let $e;e[107]!==E.error||e[108]!==R?($e=E.error>0&&l.jsx("span",{className:"text-meta",children:R(E.error)}),e[107]=E.error,e[108]=R,e[109]=$e):$e=e[109],L=l.jsx(Me,{title:we,value:le.format(E.error),caption:$e}),A=Me,e[110]!==i?(V=i("monitor.logs.warnings"),e[110]=i,e[111]=V):V=e[111],K=le.format(E.warn),e[77]=M,e[78]=v.data?.pages,e[79]=h.kind,e[80]=h.level,e[81]=h.service,e[82]=b.facets.levels,e[83]=p.length,e[84]=i,e[85]=A,e[86]=F,e[87]=E,e[88]=z,e[89]=R,e[90]=V,e[91]=K,e[92]=U,e[93]=q,e[94]=L,e[95]=B}else A=e[85],F=e[86],E=e[87],z=e[88],R=e[89],V=e[90],K=e[91],U=e[92],q=e[93],L=e[94],B=e[95];let Y;e[112]!==E.warn||e[113]!==R?(Y=E.warn>0&&l.jsx("span",{className:"text-meta",children:R(E.warn)}),e[112]=E.warn,e[113]=R,e[114]=Y):Y=e[114];let J;e[115]!==A||e[116]!==V||e[117]!==K||e[118]!==Y?(J=l.jsx(A,{title:V,value:K,caption:Y}),e[115]=A,e[116]=V,e[117]=K,e[118]=Y,e[119]=J):J=e[119];let X;e[120]!==U||e[121]!==q||e[122]!==L||e[123]!==J?(X=l.jsxs("div",{className:U,children:[q,L,J]}),e[120]=U,e[121]=q,e[122]=L,e[123]=J,e[124]=X):X=e[124];let ee;e[125]!==i?(ee=i("monitor.logs.overTime"),e[125]=i,e[126]=ee):ee=e[126];let te;e[127]!==b||e[128]!==a?(te=l.jsx(dm,{page:b,range:a}),e[127]=b,e[128]=a,e[129]=te):te=e[129];let D;e[130]!==ee||e[131]!==te?(D=l.jsx(Mt,{title:ee,children:te}),e[130]=ee,e[131]=te,e[132]=D):D=e[132];let W;e[133]!==i?(W=i("monitor.logs.levelLabel"),e[133]=i,e[134]=W):W=e[134];let G;e[135]!==h||e[136]!==i?(G=[Zt,...Sn].map(le=>l.jsx(ct.Item,{pressed:h.level===le,onClick:()=>g({...h,level:le}),children:le===Zt?i("monitor.logs.level.all"):ui(le,i)},le)),e[135]=h,e[136]=i,e[137]=G):G=e[137];let Q;e[138]!==W||e[139]!==G?(Q=l.jsx(ct,{label:W,children:G}),e[138]=W,e[139]=G,e[140]=Q):Q=e[140];let re;e[141]!==i?(re=i("monitor.logs.search"),e[141]=i,e[142]=re):re=e[142];let ce;e[143]!==m||e[144]!==re?(ce=l.jsx(zf,{value:m,onChange:u,placeholder:re,className:"w-full sm:w-56"}),e[143]=m,e[144]=re,e[145]=ce):ce=e[145];let ae;e[146]!==Q||e[147]!==ce?(ae=l.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[Q,ce]}),e[146]=Q,e[147]=ce,e[148]=ae):ae=e[148];let fe;e[149]!==F||e[150]!==i?(fe=i(F?"monitor.logs.noMatch":"monitor.logs.empty"),e[149]=F,e[150]=i,e[151]=fe):fe=e[151];let de;e[152]!==v?(de=()=>{v.fetchNextPage()},e[152]=v,e[153]=de):de=e[153];let se;e[154]!==v.hasNextPage||e[155]!==v.isFetchingNextPage||e[156]!==de?(se={has:v.hasNextPage,fetching:v.isFetchingNextPage,next:de},e[154]=v.hasNextPage,e[155]=v.isFetchingNextPage,e[156]=de,e[157]=se):se=e[157];let H;e[158]!==z||e[159]!==n||e[160]!==fe||e[161]!==se?(H=l.jsx(n6,{rows:z,empty:fe,more:se,scroller:n}),e[158]=z,e[159]=n,e[160]=fe,e[161]=se,e[162]=H):H=e[162];let oe;e[163]!==ae||e[164]!==H?(oe=l.jsxs("section",{className:"surface flex flex-col gap-3 px-4 pt-4 pb-5",children:[ae,H]}),e[163]=ae,e[164]=H,e[165]=oe):oe=e[165];let he;return e[166]!==B||e[167]!==X||e[168]!==D||e[169]!==oe?(he=l.jsxs(l.Fragment,{children:[B,X,D,oe]}),e[166]=B,e[167]=X,e[168]=D,e[169]=oe,e[170]=he):he=e[170],he}function Jv(t){return t?.events??[]}function e6(t){return l.jsx(Ce,{className:"h-28"},t)}function t6(t){return{value:t.name,label:t.name}}function dm(t){const e=O.c(25),{page:s,range:n}=t,i=ie(),[r]=si(),a=Ra[r.language];let o;e[0]!==a?(o=new Intl.NumberFormat(a,{notation:"compact"}),e[0]=a,e[1]=o):o=e[1];const c=o;let d;e[2]!==n||e[3]!==a?(d=new Intl.DateTimeFormat(a,n==="7d"?{month:"short",day:"numeric"}:{hour:"2-digit",minute:"2-digit"}),e[2]=n,e[3]=a,e[4]=d):d=e[4];const m=d;let u;e[5]!==i?(u=Object.fromEntries(Sn.map(S=>[S,{label:ui(S,i),color:jo[S].fill}])),e[5]=i,e[6]=u):u=e[6];const f=u,p=s.histogram;let x,h;e[7]===Symbol.for("react.memo_cache_sentinel")?(x={top:4,right:-8,bottom:0,left:0},h=l.jsx(Ft,{strokeDasharray:"4 4",stroke:"var(--border)",strokeOpacity:.5,vertical:!1}),e[7]=x,e[8]=h):(x=e[7],h=e[8]);let g;e[9]!==m?(g=l.jsx(zt,{dataKey:"t",axisLine:!1,tickLine:!1,tick:mt,tickMargin:6,minTickGap:48,tickFormatter:S=>m.format(new Date(S))}),e[9]=m,e[10]=g):g=e[10];let v;e[11]!==c?(v=l.jsx(At,{orientation:"right",axisLine:!1,tickLine:!1,tick:mt,tickFormatter:S=>c.format(S),width:52,tickCount:4}),e[11]=c,e[12]=v):v=e[12];let b;e[13]===Symbol.for("react.memo_cache_sentinel")?(b={fill:"var(--muted)"},e[13]=b):b=e[13];let y;e[14]!==m?(y=l.jsx(es,{cursor:b,content:l.jsx(us,{labelFormatter:S=>typeof S=="string"?m.format(new Date(S)):S})}),e[14]=m,e[15]=y):y=e[15];let j;e[16]===Symbol.for("react.memo_cache_sentinel")?(j=[...Sn].reverse().map(s6),e[16]=j):j=e[16];let N;e[17]!==s.histogram||e[18]!==y||e[19]!==g||e[20]!==v?(N=l.jsxs(x1,{data:p,margin:x,children:[h,g,v,y,j]}),e[17]=s.histogram,e[18]=y,e[19]=g,e[20]=v,e[21]=N):N=e[21];let w;return e[22]!==f||e[23]!==N?(w=l.jsx(It,{config:f,className:"h-48 w-full",children:N}),e[22]=f,e[23]=N,e[24]=w):w=e[24],w}function s6(t,e){return l.jsx(Qn,{dataKey:t,stackId:"levels",fill:`var(--color-${t})`,radius:e===Sn.length-1?[3,3,0,0]:0,isAnimationActive:!1},t)}function l6(t){const e=O.c(8),{level:s}=t,n=ie();let i;e[0]!==s||e[1]!==n?(i=ui(s,n),e[0]=s,e[1]=n,e[2]=i):i=e[2];const r=jo[s];let a;e[3]!==r.dot?(a=ye("size-2 shrink-0 rounded-full",r.dot),e[3]=r.dot,e[4]=a):a=e[4];let o;return e[5]!==i||e[6]!==a?(o=l.jsx("span",{role:"img","aria-label":i,className:a}),e[5]=i,e[6]=a,e[7]=o):o=e[7],o}function n6(t){const e=O.c(71),{rows:s,empty:n,more:i,scroller:r}=t,a=ie(),[o]=si(),c=Ra[o.language],d=Hf(s),m=d.selected;let u;e[0]!==i?(u=()=>{i.has&&!i.fetching&&i.next()},e[0]=i,e[1]=u):u=e[1];const f=Wf(u,i.has,i.fetching,r);let p;e[2]!==c?(p=new Intl.DateTimeFormat(c,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit",second:"2-digit"}),e[2]=c,e[3]=p):p=e[3];const x=p;let h,g,v,b,y;if(e[4]!==n||e[5]!==s||e[6]!==m?.id||e[7]!==d||e[8]!==a||e[9]!==c){y=Symbol.for("react.early_return_sentinel");e:{const I=new Intl.DateTimeFormat(c,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit",second:"2-digit",fractionalSecondDigits:3,hourCycle:"h23"});if(s.length===0){let q;e[15]!==n?(q=l.jsx(Ke,{size:"inline",title:n}),e[15]=n,e[16]=q):q=e[16],y=q;break e}b="-mx-4 overflow-x-auto",h="flex min-w-[640px] flex-col";let C,M;e[17]===Symbol.for("react.memo_cache_sentinel")?(C=ye(zc,"text-meta border-b border-border/70 pb-2"),M=l.jsx("span",{}),e[17]=C,e[18]=M):(C=e[17],M=e[18]);let A;e[19]!==a?(A=a("monitor.logs.col.time"),e[19]=a,e[20]=A):A=e[20];let F;e[21]!==A?(F=l.jsx("span",{children:A}),e[21]=A,e[22]=F):F=e[22];let E;e[23]!==a?(E=a("monitor.logs.levelLabel"),e[23]=a,e[24]=E):E=e[24];let z;e[25]!==E?(z=l.jsx("span",{children:E}),e[25]=E,e[26]=z):z=e[26];let R;e[27]!==a?(R=a("monitor.logs.service"),e[27]=a,e[28]=R):R=e[28];let V;e[29]!==R?(V=l.jsx("span",{children:R}),e[29]=R,e[30]=V):V=e[30];let K;e[31]!==a?(K=a("monitor.logs.col.message"),e[31]=a,e[32]=K):K=e[32];let U;e[33]!==K?(U=l.jsx("span",{children:K}),e[33]=K,e[34]=U):U=e[34],e[35]!==F||e[36]!==z||e[37]!==V||e[38]!==U?(g=l.jsxs("div",{className:C,children:[M,F,z,V,U]}),e[35]=F,e[36]=z,e[37]=V,e[38]=U,e[39]=g):g=e[39],v=s.map(q=>l.jsxs("button",{type:"button",onClick:()=>d.select(q.id),className:ye(zc,"focus-ring group w-full cursor-pointer border-b border-border/50 py-1.5 text-left transition-colors hover:bg-accent/40",m?.id===q.id&&"bg-accent"),children:[l.jsx(La,{size:14,className:"text-muted-foreground transition-transform group-hover:translate-x-0.5"}),l.jsx("span",{className:"tnum truncate text-sm text-muted-foreground",children:I.format(new Date(q.timestamp))}),l.jsx("span",{className:ye("text-sm lowercase",jo[q.level].text),children:ui(q.level,a)}),l.jsx("span",{className:"truncate text-sm text-muted-foreground",children:q.service}),l.jsx("span",{className:"truncate font-mono text-xs text-foreground",children:q.message})]},q.id))}e[4]=n,e[5]=s,e[6]=m?.id,e[7]=d,e[8]=a,e[9]=c,e[10]=h,e[11]=g,e[12]=v,e[13]=b,e[14]=y}else h=e[10],g=e[11],v=e[12],b=e[13],y=e[14];if(y!==Symbol.for("react.early_return_sentinel"))return y;let j;e[40]!==h||e[41]!==g||e[42]!==v?(j=l.jsxs("div",{className:h,children:[g,v]}),e[40]=h,e[41]=g,e[42]=v,e[43]=j):j=e[43];let N;e[44]!==b||e[45]!==j?(N=l.jsx("div",{className:b,children:j}),e[44]=b,e[45]=j,e[46]=N):N=e[46];let w;e[47]!==f?(w=l.jsx("div",{ref:f,"aria-hidden":!0}),e[47]=f,e[48]=w):w=e[48];let S;e[49]!==i.fetching?(S=i.fetching&&l.jsx("div",{className:"flex justify-center py-3",children:l.jsx(is,{className:"size-4 text-muted-foreground"})}),e[49]=i.fetching,e[50]=S):S=e[50];let k;e[51]!==d?(k=I=>{I||d.close()},e[51]=d,e[52]=k):k=e[52];let _;e[53]!==s.length||e[54]!==m||e[55]!==d.index||e[56]!==d.next||e[57]!==d.prev||e[58]!==x?(_=m&&l.jsx(i6,{event:m,stamp:x,nav:{prev:d.prev,next:d.next,first:d.index===0,last:d.index===s.length-1}}),e[53]=s.length,e[54]=m,e[55]=d.index,e[56]=d.next,e[57]=d.prev,e[58]=x,e[59]=_):_=e[59];let $;e[60]!==_?($=l.jsx(Kf,{className:"flex flex-col gap-0 p-0 sm:max-w-2xl",children:_}),e[60]=_,e[61]=$):$=e[61];let T;e[62]!==d.isOpen||e[63]!==k||e[64]!==$?(T=l.jsx(Vf,{open:d.isOpen,onOpenChange:k,children:$}),e[62]=d.isOpen,e[63]=k,e[64]=$,e[65]=T):T=e[65];let P;return e[66]!==w||e[67]!==S||e[68]!==T||e[69]!==N?(P=l.jsxs(l.Fragment,{children:[N,w,S,T]}),e[66]=w,e[67]=S,e[68]=T,e[69]=N,e[70]=P):P=e[70],P}function rn(t){const e=O.c(7),{label:s,children:n}=t;let i;e[0]!==s?(i=l.jsx("span",{className:"text-meta",children:s}),e[0]=s,e[1]=i):i=e[1];let r;e[2]!==n?(r=l.jsx("span",{className:"truncate text-sm text-foreground",children:n}),e[2]=n,e[3]=r):r=e[3];let a;return e[4]!==i||e[5]!==r?(a=l.jsxs("div",{className:"flex min-w-0 flex-col gap-1",children:[i,r]}),e[4]=i,e[5]=r,e[6]=a):a=e[6],a}function i6(t){const e=O.c(98),{event:s,stamp:n,nav:i}=t,r=ie();let a;e[0]!==s.attributes?(a=Object.entries(s.attributes),e[0]=s.attributes,e[1]=a):a=e[1];const o=a;let c;e[2]!==s.level?(c=l.jsx(l6,{level:s.level}),e[2]=s.level,e[3]=c):c=e[3];let d;e[4]!==s.level||e[5]!==r?(d=ui(s.level,r),e[4]=s.level,e[5]=r,e[6]=d):d=e[6];let m;e[7]!==c||e[8]!==d?(m=l.jsxs("span",{className:"text-meta flex items-center gap-1.5",children:[c,d]}),e[7]=c,e[8]=d,e[9]=m):m=e[9];let u;e[10]!==s.message?(u=l.jsx(qf,{className:"line-clamp-2 text-sm leading-snug",children:s.message}),e[10]=s.message,e[11]=u):u=e[11];let f;e[12]!==m||e[13]!==u?(f=l.jsxs("div",{className:"flex min-w-0 flex-col gap-1.5",children:[m,u]}),e[12]=m,e[13]=u,e[14]=f):f=e[14];let p;e[15]!==r?(p=r("orgs.audit.previousEntry"),e[15]=r,e[16]=p):p=e[16];let x;e[17]===Symbol.for("react.memo_cache_sentinel")?(x=l.jsx(Ff,{}),e[17]=x):x=e[17];let h;e[18]!==i.first||e[19]!==i.prev||e[20]!==p?(h=l.jsx(yn,{label:p,onClick:i.prev,disabled:i.first,children:x}),e[18]=i.first,e[19]=i.prev,e[20]=p,e[21]=h):h=e[21];let g;e[22]!==r?(g=r("orgs.audit.nextEntry"),e[22]=r,e[23]=g):g=e[23];let v;e[24]===Symbol.for("react.memo_cache_sentinel")?(v=l.jsx(Ka,{}),e[24]=v):v=e[24];let b;e[25]!==i.last||e[26]!==i.next||e[27]!==g?(b=l.jsx(yn,{label:g,onClick:i.next,disabled:i.last,children:v}),e[25]=i.last,e[26]=i.next,e[27]=g,e[28]=b):b=e[28];let y;e[29]!==b||e[30]!==h?(y=l.jsxs("div",{className:"flex shrink-0 items-center gap-0.5",children:[h,b]}),e[29]=b,e[30]=h,e[31]=y):y=e[31];let j;e[32]!==y||e[33]!==f?(j=l.jsx(Bf,{className:"shrink-0 border-b border-border px-6 pt-6 pb-5",children:l.jsxs("div",{className:"flex items-start justify-between gap-3 pr-8",children:[f,y]})}),e[32]=y,e[33]=f,e[34]=j):j=e[34];let N;e[35]!==r?(N=r("monitor.logs.col.time"),e[35]=r,e[36]=N):N=e[36];let w;e[37]!==s.timestamp||e[38]!==n?(w=n.format(new Date(s.timestamp)),e[37]=s.timestamp,e[38]=n,e[39]=w):w=e[39];let S;e[40]!==w?(S=l.jsx("span",{className:"tnum",children:w}),e[40]=w,e[41]=S):S=e[41];let k;e[42]!==N||e[43]!==S?(k=l.jsx(rn,{label:N,children:S}),e[42]=N,e[43]=S,e[44]=k):k=e[44];let _;e[45]!==r?(_=r("monitor.logs.service"),e[45]=r,e[46]=_):_=e[46];let $;e[47]!==s.service||e[48]!==_?($=l.jsx(rn,{label:_,children:s.service}),e[47]=s.service,e[48]=_,e[49]=$):$=e[49];let T;e[50]!==r?(T=r("monitor.logs.type"),e[50]=r,e[51]=T):T=e[51];let P;e[52]!==s.kind||e[53]!==r?(P=om(s.kind,r),e[52]=s.kind,e[53]=r,e[54]=P):P=e[54];let I;e[55]!==T||e[56]!==P?(I=l.jsx(rn,{label:T,children:P}),e[55]=T,e[56]=P,e[57]=I):I=e[57];let C;e[58]!==s.durationMs||e[59]!==r?(C=s.durationMs!==null&&l.jsx(rn,{label:r("monitor.logs.detail.duration"),children:l.jsxs("span",{className:"tnum",children:[Math.round(s.durationMs),"ms"]})}),e[58]=s.durationMs,e[59]=r,e[60]=C):C=e[60];let M;e[61]!==s.traceId||e[62]!==r?(M=s.traceId&&l.jsx(rn,{label:r("monitor.logs.detail.trace"),children:l.jsx("span",{className:"font-mono text-xs",children:s.traceId})}),e[61]=s.traceId,e[62]=r,e[63]=M):M=e[63];let A;e[64]!==s.spanId||e[65]!==r?(A=s.spanId&&l.jsx(rn,{label:r("monitor.logs.detail.span"),children:l.jsx("span",{className:"font-mono text-xs",children:s.spanId})}),e[64]=s.spanId,e[65]=r,e[66]=A):A=e[66];let F;e[67]!==k||e[68]!==$||e[69]!==I||e[70]!==C||e[71]!==M||e[72]!==A?(F=l.jsxs("div",{className:"grid grid-cols-2 gap-x-6 gap-y-4",children:[k,$,I,C,M,A]}),e[67]=k,e[68]=$,e[69]=I,e[70]=C,e[71]=M,e[72]=A,e[73]=F):F=e[73];let E;e[74]!==r?(E=r("monitor.logs.col.message"),e[74]=r,e[75]=E):E=e[75];let z;e[76]!==E?(z=l.jsx("span",{className:"text-meta",children:E}),e[76]=E,e[77]=z):z=e[77];let R;e[78]!==s.message?(R=l.jsx(ir,{text:s.message}),e[78]=s.message,e[79]=R):R=e[79];let V;e[80]!==z||e[81]!==R?(V=l.jsxs("div",{className:"flex items-center justify-between",children:[z,R]}),e[80]=z,e[81]=R,e[82]=V):V=e[82];let K;e[83]!==s.message?(K=l.jsx("pre",{className:"surface-inset whitespace-pre-wrap break-all px-3 py-2.5 font-mono text-xs text-foreground",children:s.message}),e[83]=s.message,e[84]=K):K=e[84];let U;e[85]!==V||e[86]!==K?(U=l.jsxs("div",{className:"flex flex-col gap-2",children:[V,K]}),e[85]=V,e[86]=K,e[87]=U):U=e[87];let q;e[88]!==o||e[89]!==r?(q=o.length>0&&l.jsxs("div",{className:"flex flex-col gap-2",children:[l.jsx("span",{className:"text-meta",children:r("monitor.logs.detail.attributes")}),l.jsx("dl",{className:"surface-inset divide-y divide-border/60",children:o.map(r6)})]}),e[88]=o,e[89]=r,e[90]=q):q=e[90];let L;e[91]!==F||e[92]!==U||e[93]!==q?(L=l.jsxs("div",{className:"flex min-h-0 flex-1 flex-col gap-6 overflow-y-auto px-6 py-5",children:[F,U,q]}),e[91]=F,e[92]=U,e[93]=q,e[94]=L):L=e[94];let B;return e[95]!==j||e[96]!==L?(B=l.jsxs(l.Fragment,{children:[j,L]}),e[95]=j,e[96]=L,e[97]=B):B=e[97],B}function r6(t){const[e,s]=t;return l.jsxs("div",{className:"grid grid-cols-[minmax(0,12rem)_minmax(0,1fr)] gap-3 px-3 py-2",children:[l.jsx("dt",{className:"truncate font-mono text-xs text-muted-foreground",children:e}),l.jsx("dd",{className:"break-all font-mono text-xs text-foreground",children:s})]},e)}function Vc(){const t=O.c(12),e=ie(),{org:s}=He();let n;t[0]===Symbol.for("react.memo_cache_sentinel")?(n=[],t[0]=n):n=t[0];const i=ld(s.slug,n),r=Ha().data??[],a=Cu();let o;if(t[1]!==i||t[2]!==r||t[3]!==e||t[4]!==a){let d;t[6]!==i||t[7]!==e||t[8]!==a?(d=m=>l.jsx(Mn,{variant:"divided",lead:l.jsx(vr,{icon:i("deploys"),name:aa("deploys",e),size:"xs",fit:"contain"}),title:m.path,meta:m.defaultBranch??void 0,trailing:l.jsx(A1,{"aria-label":e("monitor.repos.toggle",{repo:m.path}),checked:m.monitorDeploys,disabled:a.isPending,onCheckedChange:u=>a.mutate({id:m.id,monitorDeploys:u})})},m.id),t[6]=i,t[7]=e,t[8]=a,t[9]=d):d=t[9],o=r.map(d),t[1]=i,t[2]=r,t[3]=e,t[4]=a,t[5]=o}else o=t[5];let c;return t[10]!==o?(c=l.jsx("div",{className:"flex max-h-72 flex-col overflow-y-auto",children:o}),t[10]=o,t[11]=c):c=t[11],c}function Ks(t){const e=O.c(5),{tabs:s,children:n}=t;let i;e[0]!==n?(i=l.jsx("div",{className:"flex min-h-0 flex-1 flex-col",children:n}),e[0]=n,e[1]=i):i=e[1];let r;return e[2]!==i||e[3]!==s?(r=l.jsxs("div",{className:"flex h-full min-h-0 flex-col overflow-auto",children:[s,i]}),e[2]=i,e[3]=s,e[4]=r):r=e[4],r}const Jr="__all";function a6(t){const e=O.c(16),{projects:s,value:n,onChange:i}=t,r=ie();let a;e[0]!==r?(a=r("monitor.projectFilter.label"),e[0]=r,e[1]=a):a=e[1];const o=n??Jr;let c;e[2]!==r?(c=r("monitor.projectFilter.all"),e[2]=r,e[3]=c):c=e[3];let d;e[4]!==c?(d={value:Jr,label:c},e[4]=c,e[5]=d):d=e[5];let m;e[6]!==s||e[7]!==d?(m=[d,...s.map(o6)],e[6]=s,e[7]=d,e[8]=m):m=e[8];let u;e[9]!==i?(u=p=>i(p===Jr?null:p),e[9]=i,e[10]=u):u=e[10];let f;return e[11]!==a||e[12]!==o||e[13]!==m||e[14]!==u?(f=l.jsx(We.Actions,{children:l.jsx(ns,{label:a,value:o,options:m,onChange:u})}),e[11]=a,e[12]=o,e[13]=m,e[14]=u,e[15]=f):f=e[15],f}function o6(t){return{value:t.id,label:t.title}}function c6(t,e,s,n=!1){return t||(!n&&e.length===1?e[0]?.id??null:e.some(i=>i.id===s)?s??null:null)}const an=["w1","m1","y1"],pn=Array.from({length:24},(t,e)=>e),d6=3,ea=3,m6=.9,qc=44,$s="var(--chart-1)",Kc="var(--muted-foreground)",Ri=t=>`${String(Math.floor(t/4)%24).padStart(2,"0")}:${String(t%4*15).padStart(2,"0")}`,Rn=(t,e=t.length)=>t.slice(0,e).reduce((s,n)=>s+(n??0),0),mm=t=>({orders:t.reduce((e,s)=>e+s.orders,0),revenue:t.reduce((e,s)=>e+s.revenue,0),items:t.reduce((e,s)=>e+s.items,0)});function u6(t,e){const s=t.map(n=>n.forecast.soFar[e]);return s.every(n=>n!==null)?mm(s):null}const f6=t=>({today:pn.map(e=>t.every(s=>s.today[e]===null)?null:t.reduce((s,n)=>s+(n.today[e]??0),0)),w1:pn.map(e=>t.reduce((s,n)=>s+(n.w1[e]??0),0))});function p6(t){if(t.length===0)return null;const e=n=>pn.map(i=>t.reduce((r,a)=>r+(n(a)[i]??0),0)),s=n=>t.reduce((i,r)=>i+n(r),0);return{orders:e(n=>n.orders),revenue:e(n=>n.revenue),close:{orders:s(n=>n.close.orders),revenue:s(n=>n.close.revenue)},initial:{orders:s(n=>n.initial.orders),revenue:s(n=>n.initial.revenue)},range:{orders:{low:e(n=>n.range.orders.low),high:e(n=>n.range.orders.high)},revenue:{low:e(n=>n.range.revenue.low),high:e(n=>n.range.revenue.high)}}}}function um(t){const e=O.c(170),{days:s,conversion:n}=t,i=ie(),r=$6;if(s.length===0||s.some(r))return null;const a=s[0];let o;e[0]!==s?(o=Math.min(...s.map(_6)),e[0]=s,e[1]=o):o=e[1];const c=o;let d;e[2]!==c||e[3]!==a.date||e[4]!==a.timezone?(d=c<96&&new Date().toLocaleDateString("en-CA",{timeZone:a.timezone})===a.date,e[2]=c,e[3]=a.date,e[4]=a.timezone,e[5]=d):d=e[5];const m=d;let u,f,p,x,h,g,v,b,y,j,N,w,S,k,_;if(e[6]!==n||e[7]!==s||e[8]!==c||e[9]!==a.date||e[10]!==m||e[11]!==i){const E=mm(s.map(S6));let z;e[27]!==s?(z=Ne=>[Ne,u6(s,Ne)],e[27]=s,e[28]=z):z=e[28];const R=Object.fromEntries(an.map(z)),V=s.map(k6),K=c<95&&V.every(N6)?p6(V):null,U=new Set(s.map(w6)),[q]=U,L=U.size===1&&q?q:null,B=(Ne,et)=>new Intl.NumberFormat(void 0,{style:"currency",currency:L??"USD",minimumFractionDigits:0,maximumFractionDigits:0}).format(Ne),Y=y6,J=j6,X=Ne=>L?Ne.revenue:Ne.orders;h=Ne=>L?B(Ne):J(Ne);const ee=f6(s.map(Ne=>L?Ne.forecast.revenue:Ne.orders));u=K?L?K.revenue:K.orders:null;const te=K?K.range[L?"revenue":"orders"]:null,D=R.w1!==null,W=c/4;p=Math.floor(W);const G=c>=95?"23:59":Ri(c),Q=[...new Set([...pn,24,W])].sort(b6),re=Ne=>Ne===W&&R.w1?X(R.w1):Rn(ee.w1,Ne),ce=Ne=>{if(!te||Ne<W)return null;const et=Math.ceil(Ne)-1;return Ne===W||et<0?[X(E),X(E)]:[X(E)+te.low[et],X(E)+te.high[et]]},ae=Q.map(Ne=>({x:Ne,today:Ne<=W?Ne===W?X(E):Rn(ee.today,Ne):null,w1:D?re(Ne):null,projected:u&&Ne>=W?X(E)+(Ne===W?0:Rn(u,Ne)):null,band:ce(Ne)})),fe=pn.map(Ne=>({x:Ne+.5,today:ee.today[Ne],w1:D?ee.w1[Ne]:null})),de=R.w1?X(R.w1)-Rn(ee.w1,p):null,se=pn.filter(Ne=>Ne>=p-d6&&Ne<=p+(u?ea:0)).map(Ne=>{const et=Ne===p&&m;return{h:Ne,partial:et,value:Ne<=p?ee.today[Ne]??0:null,expected:u?u[Ne]:null,w1:D?et?de:ee.w1[Ne]:null}}),H=new Intl.DateTimeFormat(void 0,{weekday:"short",timeZone:"UTC"}).format(new Date(`${a.date}T12:00:00Z`));let oe;e[29]!==i?(oe=i("monitor.sales.w1"),e[29]=i,e[30]=oe):oe=e[30];let he;e[31]!==i?(he=i("monitor.sales.m1"),e[31]=i,e[32]=he):he=e[32];let le;e[33]!==i?(le=i("monitor.sales.y1"),e[33]=i,e[34]=le):le=e[34];let ne;e[35]!==oe||e[36]!==he||e[37]!==le?(ne={w1:oe,m1:he,y1:le},e[35]=oe,e[36]=he,e[37]=le,e[38]=ne):ne=e[38],x=ne;const me=v6,ge=g6,ve=n?.references;f=[{key:"orders",label:i("monitor.sales.orders"),value:J(E.orders),refs:an.map(Ne=>ot(E.orders,R[Ne]?.orders??null))},L&&{key:"ticket",label:i("monitor.sales.ticket"),value:me(E)===null?"—":B(me(E)),refs:an.map(Ne=>ot(me(E),R[Ne]?me(R[Ne]):null))},{key:"items",label:i("monitor.sales.items"),value:ge(E)===null?J(E.items):`${J(E.items)} · ${i("monitor.sales.perOrder",{n:ge(E).toFixed(2)})}`,refs:an.map(Ne=>ot(E.items,R[Ne]?.items??null))},n?.value!=null&&ve&&{key:"conversion",label:i("monitor.sales.conversion"),value:`${(n.value*100).toFixed(2)}%`,refs:[ot(n.value,ve.w1),null,ot(n.value,ve.y1)]}].filter(h6),g="surface flex flex-col";let be;e[39]!==a.date||e[40]!==m||e[41]!==i?(be=m?i("monitor.sales.title"):i("monitor.sales.titleOn",{date:a.date}),e[39]=a.date,e[40]=m,e[41]=i,e[42]=be):be=e[42];let we;e[43]!==be?(we=l.jsx("h3",{className:"font-medium text-foreground",children:be}),e[43]=be,e[44]=we):we=e[44];const $e=m&&l.jsxs("span",{className:"text-meta tnum inline-flex items-center gap-1.5",children:[l.jsx("span",{className:"size-1.5 rounded-full bg-success"}),i("monitor.sales.live",{time:G})]});let je;e[45]!==we||e[46]!==$e?(je=l.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[we,$e]}),e[45]=we,e[46]=$e,e[47]=je):je=e[47];let xe;e[48]!==i?(xe=i("monitor.sales.source"),e[48]=i,e[49]=xe):xe=e[49];let ke;e[50]!==xe?(ke=l.jsx("span",{className:"text-meta",children:xe}),e[50]=xe,e[51]=ke):ke=e[51],e[52]!==je||e[53]!==ke?(v=l.jsxs("header",{className:"flex flex-wrap items-center justify-between gap-x-4 gap-y-1 border-b border-border/50 px-4 py-3",children:[je,ke]}),e[52]=je,e[53]=ke,e[54]=v):v=e[54];const _e=i("monitor.sales.captured",{from:"00:00",to:G});let Ae;e[55]!==_e?(Ae=l.jsx("span",{className:"text-meta",children:_e}),e[55]=_e,e[56]=Ae):Ae=e[56],b=l.jsxs("div",{className:"grid border-b border-border/50 sm:grid-cols-2",children:[l.jsxs("div",{className:"flex flex-col gap-1 p-4",children:[Ae,l.jsx("span",{className:"tnum text-3xl font-medium text-foreground",children:h(X(E))}),l.jsx("span",{className:"flex flex-wrap gap-x-3 gap-y-0.5",children:an.map(Ne=>l.jsx(St,{change:ot(X(E),R[Ne]?X(R[Ne]):null),better:"up",reference:Ne==="w1"?i("monitor.sales.vsLast",{weekday:H}):x[Ne]},Ne))})]}),K&&l.jsxs("div",{className:"flex flex-col gap-1 border-t border-border/50 p-4 sm:border-t-0 sm:border-l",children:[l.jsx("span",{className:"text-meta",children:i("monitor.sales.projection",{to:"23:59"})}),l.jsx("span",{className:"tnum text-3xl font-medium text-success",children:h(X(K.close))}),l.jsxs("span",{className:"text-meta tnum flex flex-wrap items-center gap-x-1.5 gap-y-0.5",children:[te&&l.jsxs(l.Fragment,{children:[i("monitor.sales.between",{low:h(X(E)+te.low[23]),high:h(X(E)+te.high[23])}),l.jsx("span",{"aria-hidden":!0,children:"·"})]}),i("monitor.sales.opened",{amount:h(X(K.initial))}),l.jsx(St,{change:ot(X(K.close),X(K.initial)),better:"up",reference:""})]})]})]}),k="grid md:grid-cols-[minmax(0,1fr)_minmax(0,320px)]";let Pe;e[57]!==i?(Pe=i("monitor.sales.chart"),e[57]=i,e[58]=Pe):Pe=e[58];let Be;e[59]!==i?(Be=i("monitor.sales.today"),e[59]=i,e[60]=Be):Be=e[60];let Xe;e[61]!==Be?(Xe={today:{label:Be,color:$s}},e[61]=Be,e[62]=Xe):Xe=e[62];let st;e[63]===Symbol.for("react.memo_cache_sentinel")?(st={left:0,right:0,top:8},e[63]=st):st=e[63];let Ze,lt;e[64]===Symbol.for("react.memo_cache_sentinel")?(Ze=l.jsx("defs",{children:l.jsxs("linearGradient",{id:"sales-today",x1:"0",y1:"0",x2:"0",y2:"1",children:[l.jsx("stop",{offset:"0%",stopColor:$s,stopOpacity:.2}),l.jsx("stop",{offset:"100%",stopColor:$s,stopOpacity:0})]})}),lt=l.jsx(Ft,{strokeDasharray:"4 4",stroke:"var(--border)",strokeOpacity:.5,vertical:!1}),e[64]=Ze,e[65]=lt):(Ze=e[64],lt=e[65]);let Ie,Oe;e[66]===Symbol.for("react.memo_cache_sentinel")?(Ie=l.jsx(zt,{dataKey:"x",type:"number",domain:[0,24],hide:!0}),Oe=l.jsx(At,{orientation:"right",axisLine:!1,tickLine:!1,tick:mt,width:qc,tickFormatter:Y}),e[66]=Ie,e[67]=Oe):(Ie=e[66],Oe=e[67]);let Ue;e[68]===Symbol.for("react.memo_cache_sentinel")?(Ue={stroke:"var(--border)",strokeDasharray:"4 4"},e[68]=Ue):Ue=e[68];let Je;e[69]!==m||e[70]!==W?(Je=m&&l.jsx(Ls,{x:W,stroke:"var(--foreground)",strokeOpacity:.25,strokeDasharray:"2 3"}),e[69]=m,e[70]=W,e[71]=Je):Je=e[71];let ut;e[72]!==D?(ut=D&&l.jsx(rs,{type:"monotone",dataKey:"w1",stroke:Kc,strokeOpacity:.6,strokeDasharray:"6 4",strokeWidth:1.25,dot:!1,activeDot:!1,isAnimationActive:!1}),e[72]=D,e[73]=ut):ut=e[73];let _t;e[74]===Symbol.for("react.memo_cache_sentinel")?(_t=l.jsx(Gt,{type:"monotone",dataKey:"today",stroke:$s,strokeWidth:2,fill:"url(#sales-today)",dot:!1,activeDot:{r:3,stroke:"var(--background)",strokeWidth:2},connectNulls:!1,isAnimationActive:!1}),e[74]=_t):_t=e[74];const ft=l.jsx(It,{role:"img","aria-label":Pe,className:"aspect-auto h-[220px] w-full",config:Xe,children:l.jsxs(Gs,{data:ae,margin:st,children:[Ze,lt,Ie,Oe,l.jsx(es,{cursor:Ue,content:Ne=>{const{active:et,payload:ss}=Ne,at=ss?.[0]?.payload;return!et||!at?null:l.jsxs("div",{className:"surface tnum flex flex-col gap-0.5 px-2.5 py-1.5 text-xs shadow-sm",children:[l.jsx("span",{className:"text-meta",children:Ri(Math.round(at.x*4))}),at.today!==null&&l.jsxs("span",{children:[i("monitor.sales.today"),": ",h(at.today)]}),at.projected!==null&&at.today===null&&l.jsxs("span",{children:[i("monitor.sales.projected"),": ",h(at.projected)]}),at.band&&at.today===null&&l.jsx("span",{className:"text-muted-foreground",children:i("monitor.sales.between",{low:h(at.band[0]),high:h(at.band[1])})}),at.w1!==null&&l.jsxs("span",{className:"text-muted-foreground",children:[x.w1,": ",h(at.w1)]})]})}}),Je,ut,te&&l.jsx(Gt,{type:"monotone",dataKey:"band",stroke:"none",fill:$s,fillOpacity:.16,activeDot:!1,isAnimationActive:!1}),u&&l.jsx(rs,{type:"monotone",dataKey:"projected",stroke:$s,strokeDasharray:"2 3",strokeWidth:1.5,dot:!1,activeDot:!1,isAnimationActive:!1,connectNulls:!1}),_t]})});let Ge;e[75]!==i?(Ge=i("monitor.sales.bars"),e[75]=i,e[76]=Ge):Ge=e[76];let Ee;e[77]!==i?(Ee=i("monitor.sales.today"),e[77]=i,e[78]=Ee):Ee=e[78];let vt;e[79]!==Ee?(vt={today:{label:Ee,color:$s}},e[79]=Ee,e[80]=vt):vt=e[80];let Nt;e[81]===Symbol.for("react.memo_cache_sentinel")?(Nt={left:0,right:0,top:4},e[81]=Nt):Nt=e[81];let Vt,$t;e[82]===Symbol.for("react.memo_cache_sentinel")?(Vt=l.jsx(zt,{dataKey:"x",type:"number",domain:[0,24],ticks:[0,6,12,18,24],axisLine:!1,tickLine:!1,tick:mt,tickMargin:6,tickFormatter:x6}),$t=l.jsx(At,{orientation:"right",width:qc,tick:!1,tickLine:!1,axisLine:!1}),e[82]=Vt,e[83]=$t):(Vt=e[82],$t=e[83]);let kt;e[84]!==D?(kt=D&&l.jsx(Qn,{dataKey:"w1",fill:Kc,fillOpacity:.25,barSize:6,radius:[2,2,0,0],isAnimationActive:!1}),e[84]=D,e[85]=kt):kt=e[85];let Tt;e[86]===Symbol.for("react.memo_cache_sentinel")?(Tt=[2,2,0,0],e[86]=Tt):Tt=e[86];let Lt;e[87]!==p||e[88]!==m?(Lt=(Ne,et)=>l.jsx(Za,{fill:et<p&&Ne.w1!==null&&(Ne.today??0)<m6*Ne.w1?"var(--destructive)":$s,fillOpacity:et===p&&m?.5:.85},Ne.x),e[87]=p,e[88]=m,e[89]=Lt):Lt=e[89];const Pt=l.jsx(It,{role:"img","aria-label":Ge,className:"aspect-auto h-[84px] w-full",config:vt,children:l.jsxs(Gs,{data:fe,margin:Nt,barGap:1,children:[Vt,$t,kt,l.jsx(Qn,{dataKey:"today",barSize:6,radius:Tt,isAnimationActive:!1,children:fe.map(Lt)})]})});let bt;e[90]!==ft||e[91]!==Pt?(bt=l.jsxs("div",{className:"flex flex-col",children:[ft,Pt]}),e[90]=ft,e[91]=Pt,e[92]=bt):bt=e[92];let qt;e[93]===Symbol.for("react.memo_cache_sentinel")?(qt=l.jsx("span",{className:"h-0.5 w-4 rounded-full bg-chart-1"}),e[93]=qt):qt=e[93];let jt;e[94]!==i?(jt=i("monitor.sales.today"),e[94]=i,e[95]=jt):jt=e[95];let Dt;e[96]!==jt?(Dt=l.jsx(Fi,{line:qt,children:jt}),e[96]=jt,e[97]=Dt):Dt=e[97];const ps=u&&l.jsx(Fi,{line:l.jsx("span",{className:"w-4 border-t-2 border-dotted border-chart-1"}),children:i("monitor.sales.projected")}),Re=te&&l.jsx(Fi,{line:l.jsx("span",{className:"h-2.5 w-4 rounded-sm bg-chart-1/20"}),children:i("monitor.sales.rangeLegend")});let xs;e[98]!==D||e[99]!==x?(xs=D&&l.jsx(Fi,{line:l.jsx("span",{className:"w-4 border-t-2 border-dashed border-muted-foreground/60"}),children:x.w1}),e[98]=D,e[99]=x,e[100]=xs):xs=e[100];let pt;e[101]!==Dt||e[102]!==ps||e[103]!==Re||e[104]!==xs?(pt=l.jsxs("div",{className:"text-meta flex flex-wrap items-center gap-x-4 gap-y-1",children:[Dt,ps,Re,xs]}),e[101]=Dt,e[102]=ps,e[103]=Re,e[104]=xs,e[105]=pt):pt=e[105],e[106]!==bt||e[107]!==pt?(_=l.jsxs("div",{className:"flex min-w-0 flex-col gap-3 p-4",children:[bt,pt]}),e[106]=bt,e[107]=pt,e[108]=_):_=e[108],S="flex min-w-0 flex-col gap-3 border-t border-border/50 p-4 md:border-t-0 md:border-l",j="tnum w-full table-fixed text-sm [&_td]:align-middle [&_td]:whitespace-nowrap";let Qt,ys;e[109]===Symbol.for("react.memo_cache_sentinel")?(Qt=l.jsx("col",{}),ys=l.jsx("col",{className:"w-[34%]"}),e[109]=Qt,e[110]=ys):(Qt=e[109],ys=e[110]);let Xt;e[111]!==D?(Xt=D&&l.jsx("col",{className:"w-[34%]"}),e[111]=D,e[112]=Xt):Xt=e[112];let as;e[113]!==D?(as=D&&l.jsx("col",{className:"w-14"}),e[113]=D,e[114]=as):as=e[114],e[115]!==Xt||e[116]!==as?(N=l.jsxs("colgroup",{children:[Qt,ys,Xt,as]}),e[115]=Xt,e[116]=as,e[117]=N):N=e[117];let hs;e[118]!==i?(hs=i("monitor.sales.hour"),e[118]=i,e[119]=hs):hs=e[119];let os;e[120]!==hs?(os=l.jsx("th",{className:"py-2 text-left font-normal",children:hs}),e[120]=hs,e[121]=os):os=e[121];let gs;e[122]!==i?(gs=i("monitor.sales.capturedShort"),e[122]=i,e[123]=gs):gs=e[123];let cs;e[124]!==gs?(cs=l.jsx("th",{className:"py-2 text-right font-normal",children:gs}),e[124]=gs,e[125]=cs):cs=e[125];let _s;e[126]!==D||e[127]!==x?(_s=D&&l.jsx("th",{className:"py-2 text-right font-normal",children:x.w1}),e[126]=D,e[127]=x,e[128]=_s):_s=e[128];let vs;e[129]!==D?(vs=D&&l.jsx("th",{}),e[129]=D,e[130]=vs):vs=e[130],e[131]!==os||e[132]!==cs||e[133]!==_s||e[134]!==vs?(w=l.jsx("thead",{children:l.jsxs("tr",{className:"text-meta border-b border-border/50",children:[os,cs,_s,vs]})}),e[131]=os,e[132]=cs,e[133]=_s,e[134]=vs,e[135]=w):w=e[135],y=se.map(Ne=>{const et=Ne.value===null,ss=et?Ne.expected:Ne.value;return l.jsxs("tr",{className:"border-b border-border/50 last:border-b-0",children:[l.jsx("td",{className:ye("py-2",et?"text-muted-foreground":"text-foreground"),children:l.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[Ri(Ne.h*4),Ne.partial&&l.jsx("span",{className:"size-1.5 rounded-full bg-success",title:i("monitor.sales.soFar")})]})}),l.jsx("td",{className:ye("py-2 text-right",et?"text-muted-foreground":"text-foreground"),children:ss===null?"—":h(ss)}),D&&l.jsx("td",{className:"py-2 text-right text-muted-foreground",children:Ne.w1===null?"—":h(Ne.w1)}),D&&l.jsx("td",{className:"py-2 text-right",children:!et&&l.jsx("span",{className:"inline-flex justify-end leading-none",children:l.jsx(St,{change:ot(Ne.value,Ne.w1),better:"up",reference:""})})})]},Ne.h)}),e[6]=n,e[7]=s,e[8]=c,e[9]=a.date,e[10]=m,e[11]=i,e[12]=u,e[13]=f,e[14]=p,e[15]=x,e[16]=h,e[17]=g,e[18]=v,e[19]=b,e[20]=y,e[21]=j,e[22]=N,e[23]=w,e[24]=S,e[25]=k,e[26]=_}else u=e[12],f=e[13],p=e[14],x=e[15],h=e[16],g=e[17],v=e[18],b=e[19],y=e[20],j=e[21],N=e[22],w=e[23],S=e[24],k=e[25],_=e[26];let $;e[136]!==y?($=l.jsx("tbody",{children:y}),e[136]=y,e[137]=$):$=e[137];let T;e[138]!==$||e[139]!==j||e[140]!==N||e[141]!==w?(T=l.jsxs("table",{className:j,children:[N,w,$]}),e[138]=$,e[139]=j,e[140]=N,e[141]=w,e[142]=T):T=e[142];let P;e[143]!==u||e[144]!==m||e[145]!==i?(P=m&&l.jsxs("p",{className:"text-meta flex flex-wrap items-center gap-x-1.5",children:[l.jsx("span",{className:"size-1.5 rounded-full bg-success"}),i("monitor.sales.soFarNote"),u&&l.jsx("span",{"aria-hidden":!0,children:"·"}),u&&i("monitor.sales.expectedNote")]}),e[143]=u,e[144]=m,e[145]=i,e[146]=P):P=e[146];let I;e[147]!==u||e[148]!==p||e[149]!==h||e[150]!==i?(I=u&&l.jsx("p",{className:"text-meta",children:i("monitor.sales.ahead",{amount:h(Rn(u,Math.min(24,p+ea+1))),until:Ri(Math.min(96,(p+ea+1)*4))})}),e[147]=u,e[148]=p,e[149]=h,e[150]=i,e[151]=I):I=e[151];let C;e[152]!==T||e[153]!==P||e[154]!==I||e[155]!==S?(C=l.jsxs("div",{className:S,children:[T,P,I]}),e[152]=T,e[153]=P,e[154]=I,e[155]=S,e[156]=C):C=e[156];let M;e[157]!==C||e[158]!==k||e[159]!==_?(M=l.jsxs("div",{className:k,children:[_,C]}),e[157]=C,e[158]=k,e[159]=_,e[160]=M):M=e[160];let A;e[161]!==f||e[162]!==x?(A=l.jsx("div",{className:"grid grid-cols-2 border-t border-border/50 lg:auto-cols-fr lg:grid-flow-col lg:grid-cols-none",children:f.map((E,z)=>l.jsxs("div",{className:ye("flex flex-col gap-1 p-4",z%2===1&&"border-l border-border/50",z>=2&&"border-t border-border/50 lg:border-t-0",z>=1&&"lg:border-l"),children:[l.jsx("span",{className:"text-meta",children:E.label}),l.jsx("span",{className:"tnum text-xl font-medium text-foreground",children:E.value}),l.jsx("span",{className:"flex flex-wrap gap-x-3 gap-y-0.5 text-xs",children:an.map((R,V)=>l.jsxs("span",{className:"inline-flex items-center gap-1",children:[l.jsx("span",{className:"text-muted-foreground",children:x[R]}),E.refs[V]===null?l.jsx("span",{className:"text-muted-foreground",children:"—"}):l.jsx(St,{change:E.refs[V],better:"up",reference:""})]},R))})]},E.key))}),e[161]=f,e[162]=x,e[163]=A):A=e[163];let F;return e[164]!==g||e[165]!==v||e[166]!==b||e[167]!==M||e[168]!==A?(F=l.jsxs("section",{className:g,children:[v,b,M,A]}),e[164]=g,e[165]=v,e[166]=b,e[167]=M,e[168]=A,e[169]=F):F=e[169],F}function x6(t){return`${String(t).padStart(2,"0")}h`}function h6(t){return!!t}function g6(t){return t.orders>0?t.items/t.orders:null}function v6(t){return t.orders>0?t.revenue/t.orders:null}function b6(t,e){return t-e}function j6(t){return Math.round(t).toLocaleString()}function y6(t){return new Intl.NumberFormat(void 0,{notation:"compact",maximumFractionDigits:1}).format(t)}function w6(t){return t.forecast.currency}function N6(t){return t!==null}function k6(t){return t.forecast.projection}function S6(t){return t.forecast.soFar.today}function _6(t){return t.done}function $6(t){return!t.forecast?.revenue||t.forecast.projection!==null&&!t.forecast.projection.range}function Fi(t){const e=O.c(3),{line:s,children:n}=t;let i;return e[0]!==n||e[1]!==s?(i=l.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[s,n]}),e[0]=n,e[1]=s,e[2]=i):i=e[2],i}const Bn="var(--chart-1)",ka="var(--chart-2)",Sa="var(--muted-foreground)",fm=40,T6=[0,3,6,9,12,15,18,21],pm=t=>`${String(t).padStart(2,"0")}:00`;function P6(t){return(t?.repos??[]).flatMap(e=>e.markers.map(s=>({key:`${e.repositoryId}:${s.bucket}`,hour:s.bucket/4,repo:e.name,commits:s.commits})))}function xm(t){const e=O.c(18),{push:s}=t,n=ie();let i;e[0]!==s.hour?(i=Math.round(s.hour%1*60),e[0]=s.hour,e[1]=i):i=e[1];const r=i;let a;e[2]!==n?(a=n("monitor.chart.deploy"),e[2]=n,e[3]=a):a=e[3];const o=String(Math.floor(s.hour));let c;e[4]!==o?(c=o.padStart(2,"0"),e[4]=o,e[5]=c):c=e[5];const d=String(r);let m;e[6]!==d?(m=d.padStart(2,"0"),e[6]=d,e[7]=m):m=e[7];let u;e[8]!==s.repo||e[9]!==a||e[10]!==c||e[11]!==m?(u=l.jsxs("span",{className:"text-xs text-muted-foreground",children:[a," ·"," ",c,":",m," · ",s.repo]}),e[8]=s.repo,e[9]=a,e[10]=c,e[11]=m,e[12]=u):u=e[12];let f;e[13]!==s.commits?(f=s.commits.map(C6),e[13]=s.commits,e[14]=f):f=e[14];let p;return e[15]!==u||e[16]!==f?(p=l.jsxs("div",{className:"flex max-w-72 flex-col gap-1",children:[u,f]}),e[15]=u,e[16]=f,e[17]=p):p=e[17],p}function C6(t){return l.jsxs("span",{className:"flex flex-col",children:[l.jsx("span",{className:"text-sm font-medium",children:t.message}),l.jsx("span",{className:"text-xs text-muted-foreground",children:t.author})]},t.sha)}function E6(t){const e=O.c(5),{pushes:s}=t;if(s.length===0)return null;let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n={marginRight:fm},e[0]=n):n=e[0];let i;e[1]!==s?(i=s.map(M6),e[1]=s,e[2]=i):i=e[2];let r;return e[3]!==i?(r=l.jsx("div",{className:"relative h-3",style:n,children:i}),e[3]=i,e[4]=r):r=e[4],r}function M6(t){return l.jsxs(il,{children:[l.jsx(ll,{asChild:!0,children:l.jsx("button",{type:"button","aria-label":t.commits[0]?.message??t.repo,className:"focus-ring absolute top-1/2 size-2.5 -translate-x-1/2 -translate-y-1/2 rounded-full border-2 border-background bg-muted-foreground",style:{left:`${t.hour/23*100}%`}})}),l.jsx(nl,{children:l.jsx(xm,{push:t})})]},t.key)}function I6(t){const e=O.c(15),{active:s,payload:n,pushes:i}=t,r=ie(),a=n?.[0]?.payload;if(!s||!a)return null;let o;if(e[0]!==a.d1||e[1]!==a.expected||e[2]!==a.hour||e[3]!==a.today||e[4]!==i||e[5]!==r){const c=[{label:r("monitor.chart.today"),value:a.today,color:Bn},{label:r("monitor.store.expected"),value:a.expected,color:ka},{label:r("monitor.store.yesterday"),value:a.d1,color:Sa}];let d;e[7]!==a.hour?(d=h=>Math.floor(h.hour)===a.hour,e[7]=a.hour,e[8]=d):d=e[8];const m=i.filter(d);let u;e[9]!==a.hour?(u=pm(a.hour),e[9]=a.hour,e[10]=u):u=e[10];let f;e[11]!==u?(f=l.jsx("div",{className:"mb-1 text-xs text-muted-foreground",children:u}),e[11]=u,e[12]=f):f=e[12];const p=c.map(L6);let x;e[13]!==p?(x=l.jsx("div",{className:"flex flex-col gap-1",children:p}),e[13]=p,e[14]=x):x=e[14],o=l.jsxs("div",{className:"rounded-lg border bg-background px-3 py-2 shadow-md",children:[f,x,m.map(A6)]}),e[0]=a.d1,e[1]=a.expected,e[2]=a.hour,e[3]=a.today,e[4]=i,e[5]=r,e[6]=o}else o=e[6];return o}function A6(t){return l.jsx("div",{className:"mt-2 border-t border-border/50 pt-2",children:l.jsx(xm,{push:t})},t.key)}function L6(t){return t.value===null?null:l.jsxs("div",{className:"flex items-center gap-1.5 text-xs",children:[l.jsx("span",{className:"size-2 shrink-0 rounded-full",style:{backgroundColor:t.color}}),l.jsx("span",{className:"text-muted-foreground",children:t.label}),l.jsx("span",{className:"tnum ml-auto pl-3 font-medium",children:Rt(Math.round(t.value))})]},t.label)}function D6(t){const e=O.c(21),{band:s,expected:n}=t,i=ie();let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=l.jsx("span",{className:"h-0.5 w-3 rounded-full bg-chart-1"}),e[0]=r):r=e[0];let a;e[1]!==i?(a=i("monitor.chart.today"),e[1]=i,e[2]=a):a=e[2];let o;e[3]!==a?(o=l.jsxs("span",{className:"flex items-center gap-1.5",children:[r,a]}),e[3]=a,e[4]=o):o=e[4];let c;e[5]!==n||e[6]!==i?(c=n&&l.jsxs("span",{className:"flex items-center gap-1.5",children:[l.jsx("span",{className:"h-0 w-3 border-t border-dashed border-chart-2"}),i("monitor.store.expected")]}),e[5]=n,e[6]=i,e[7]=c):c=e[7];let d;e[8]===Symbol.for("react.memo_cache_sentinel")?(d=l.jsx("span",{className:"h-0.5 w-3 rounded-full bg-muted-foreground/50"}),e[8]=d):d=e[8];let m;e[9]!==i?(m=i("monitor.store.yesterday"),e[9]=i,e[10]=m):m=e[10];let u;e[11]!==m?(u=l.jsxs("span",{className:"flex items-center gap-1.5",children:[d,m]}),e[11]=m,e[12]=u):u=e[12];let f;e[13]!==s||e[14]!==i?(f=s&&l.jsxs("span",{className:"flex items-center gap-1.5",children:[l.jsx("span",{className:"h-2.5 w-3 rounded-sm bg-warning/20"}),i("orderMonitor.thresholdBand")]}),e[13]=s,e[14]=i,e[15]=f):f=e[15];let p;return e[16]!==o||e[17]!==c||e[18]!==u||e[19]!==f?(p=l.jsxs("div",{className:"text-meta flex flex-wrap items-center gap-x-3 gap-y-1",children:[o,c,u,f]}),e[16]=o,e[17]=c,e[18]=u,e[19]=f,e[20]=p):p=e[20],p}function Bc(t){const e=O.c(63),{points:s,pushes:n,label:i}=t,r=ie();let a;e[0]!==s?(a=s.some(F6),e[0]=s,e[1]=a):a=e[1];const o=a;let c;e[2]!==s?(c=s.some(R6),e[2]=s,e[3]=c):c=e[3];const d=c;let m;if(e[4]!==i){let q;e[6]===Symbol.for("react.memo_cache_sentinel")?(q=/\W+/g,e[6]=q):q=e[6],m=i.replace(q,"-"),e[4]=i,e[5]=m}else m=e[5];const u=`store-${m}`;let f;e[7]!==n?(f=l.jsx(E6,{pushes:n}),e[7]=n,e[8]=f):f=e[8];let p;e[9]!==r?(p=r("monitor.chart.today"),e[9]=r,e[10]=p):p=e[10];let x;e[11]!==p?(x={label:p,color:Bn},e[11]=p,e[12]=x):x=e[12];let h;e[13]!==r?(h=r("monitor.store.expected"),e[13]=r,e[14]=h):h=e[14];let g;e[15]!==h?(g={label:h,color:ka},e[15]=h,e[16]=g):g=e[16];let v;e[17]!==r?(v=r("monitor.store.yesterday"),e[17]=r,e[18]=v):v=e[18];let b;e[19]!==v?(b={label:v,color:Sa},e[19]=v,e[20]=b):b=e[20];let y;e[21]!==b||e[22]!==x||e[23]!==g?(y={today:x,expected:g,d1:b},e[21]=b,e[22]=x,e[23]=g,e[24]=y):y=e[24];let j;e[25]===Symbol.for("react.memo_cache_sentinel")?(j={left:0,right:0,top:4},e[25]=j):j=e[25];let N,w;e[26]===Symbol.for("react.memo_cache_sentinel")?(N=l.jsx("stop",{offset:"0%",stopColor:Bn,stopOpacity:.2}),w=l.jsx("stop",{offset:"100%",stopColor:Bn,stopOpacity:0}),e[26]=N,e[27]=w):(N=e[26],w=e[27]);let S;e[28]!==u?(S=l.jsx("defs",{children:l.jsxs("linearGradient",{id:u,x1:"0",y1:"0",x2:"0",y2:"1",children:[N,w]})}),e[28]=u,e[29]=S):S=e[29];let k;e[30]===Symbol.for("react.memo_cache_sentinel")?(k=l.jsx(Ft,{strokeDasharray:"4 4",stroke:"var(--border)",strokeOpacity:.5,vertical:!1}),e[30]=k):k=e[30];let _,$;e[31]===Symbol.for("react.memo_cache_sentinel")?(_=l.jsx(zt,{dataKey:"hour",type:"number",domain:[0,23],ticks:T6,axisLine:!1,tickLine:!1,tick:mt,tickMargin:8,tickFormatter:pm}),$=l.jsx(At,{orientation:"right",axisLine:!1,tickLine:!1,tick:mt,allowDecimals:!1,width:fm,tickCount:4}),e[31]=_,e[32]=$):(_=e[31],$=e[32]);let T;e[33]===Symbol.for("react.memo_cache_sentinel")?(T={stroke:"var(--border)",strokeDasharray:"4 4"},e[33]=T):T=e[33];let P;e[34]!==n?(P=l.jsx(es,{cursor:T,content:q=>{const{active:L,payload:B}=q;return l.jsx(I6,{active:L,payload:B,pushes:n})}}),e[34]=n,e[35]=P):P=e[35];let I;e[36]!==o?(I=o&&l.jsx(Gt,{dataKey:"band",stroke:"none",fill:"var(--warning)",fillOpacity:.1,tooltipType:"none",isAnimationActive:!1}),e[36]=o,e[37]=I):I=e[37];let C;e[38]!==n?(C=n.map(O6),e[38]=n,e[39]=C):C=e[39];let M,A;e[40]===Symbol.for("react.memo_cache_sentinel")?(M=l.jsx(rs,{type:"monotone",dataKey:"d1",stroke:Sa,strokeOpacity:.5,strokeWidth:1.25,dot:!1,activeDot:!1,isAnimationActive:!1}),A=l.jsx(rs,{type:"monotone",dataKey:"expected",stroke:ka,strokeWidth:1.25,strokeDasharray:"4 4",dot:!1,activeDot:!1,isAnimationActive:!1}),e[40]=M,e[41]=A):(M=e[40],A=e[41]);const F=`url(#${u})`;let E;e[42]===Symbol.for("react.memo_cache_sentinel")?(E={r:3,stroke:"var(--background)",strokeWidth:2},e[42]=E):E=e[42];let z;e[43]!==F?(z=l.jsx(Gt,{type:"monotone",dataKey:"today",stroke:Bn,strokeWidth:2,fill:F,dot:!1,activeDot:E,connectNulls:!1,isAnimationActive:!1}),e[43]=F,e[44]=z):z=e[44];let R;e[45]!==s||e[46]!==S||e[47]!==P||e[48]!==I||e[49]!==C||e[50]!==z?(R=l.jsxs(Gs,{data:s,margin:j,children:[S,k,_,$,P,I,C,M,A,z]}),e[45]=s,e[46]=S,e[47]=P,e[48]=I,e[49]=C,e[50]=z,e[51]=R):R=e[51];let V;e[52]!==i||e[53]!==y||e[54]!==R?(V=l.jsx(It,{role:"img","aria-label":i,className:"h-[200px] w-full md:h-[240px]",config:y,children:R}),e[52]=i,e[53]=y,e[54]=R,e[55]=V):V=e[55];let K;e[56]!==o||e[57]!==d?(K=l.jsx(D6,{band:o,expected:d}),e[56]=o,e[57]=d,e[58]=K):K=e[58];let U;return e[59]!==V||e[60]!==K||e[61]!==f?(U=l.jsxs("div",{className:"flex flex-col gap-2",children:[f,V,K]}),e[59]=V,e[60]=K,e[61]=f,e[62]=U):U=e[62],U}function O6(t){return l.jsx(Ls,{x:t.hour,stroke:"var(--foreground)",strokeOpacity:.18,strokeDasharray:"3 3"},t.key)}function R6(t){return t.expected!==null}function F6(t){return t.band!==null}function Hc(t,e){const s=t.orders.today.filter(n=>n!==null).length;return nt(e.slice(0,s))}function z6(t){const e=O.c(116),{day:s,pushes:n}=t,i=ie();let r;e[0]!==n?(r=P6(n),e[0]=n,e[1]=r):r=e[1];const a=r;let o,c,d,m,u,f,p,x,h,g,v,b;if(e[2]!==s||e[3]!==i){const R=nt(s.orders.today),V=nt(s.cancellations.canceled.today);let K;if(e[16]!==s.orders.alertAt||e[17]!==s.orders.d1||e[18]!==s.orders.expected||e[19]!==s.orders.today||e[20]!==s.orders.warnAt){let D;e[22]!==s.orders.alertAt||e[23]!==s.orders.d1||e[24]!==s.orders.expected||e[25]!==s.orders.warnAt?(D=(W,G)=>{const Q=s.orders.warnAt[G],re=s.orders.alertAt[G];return{hour:G,today:W,expected:s.orders.expected[G]??null,d1:s.orders.d1[G]??null,band:Q!=null&&re!==null&&re!==void 0?[re,Q]:null}},e[22]=s.orders.alertAt,e[23]=s.orders.d1,e[24]=s.orders.expected,e[25]=s.orders.warnAt,e[26]=D):D=e[26],K=s.orders.today.map(D),e[16]=s.orders.alertAt,e[17]=s.orders.d1,e[18]=s.orders.expected,e[19]=s.orders.today,e[20]=s.orders.warnAt,e[21]=K}else K=e[21];m=K;let U;if(e[27]!==s.cancellations.canceled.d1||e[28]!==s.cancellations.canceled.today){let D;e[30]!==s.cancellations.canceled.d1?(D=(W,G)=>({hour:G,today:W,expected:null,d1:s.cancellations.canceled.d1[G]??null,band:null}),e[30]=s.cancellations.canceled.d1,e[31]=D):D=e[31],U=s.cancellations.canceled.today.map(D),e[27]=s.cancellations.canceled.d1,e[28]=s.cancellations.canceled.today,e[29]=U}else U=e[29];d=U,v="flex flex-col gap-4",e[32]!==s?(b=l.jsx(um,{days:[s]}),e[32]=s,e[33]=b):b=e[33],x="grid grid-cols-1 gap-4 sm:grid-cols-3";let q;e[34]!==i?(q=i("monitor.store.projected"),e[34]=i,e[35]=q):q=e[35];let L;e[36]!==s.headline.projected?(L=Rt(Math.round(s.headline.projected)),e[36]=s.headline.projected,e[37]=L):L=e[37];let B;e[38]!==s.backfill||e[39]!==s.headline.d1||e[40]!==s.headline.projected||e[41]!==i?(B=s.backfill?l.jsx("span",{className:"text-meta",children:i("monitor.chart.historyLoading",{pct:`${Math.floor((1-s.backfill.pending/s.backfill.total)*100)}%`})}):l.jsx(St,{change:ot(s.headline.projected,s.headline.d1),better:"up",reference:i("monitor.ref.yesterday")}),e[38]=s.backfill,e[39]=s.headline.d1,e[40]=s.headline.projected,e[41]=i,e[42]=B):B=e[42],e[43]!==q||e[44]!==L||e[45]!==B?(h=l.jsx(Me,{title:q,value:L,caption:B}),e[43]=q,e[44]=L,e[45]=B,e[46]=h):h=e[46];let Y;e[47]!==i?(Y=i("monitor.store.soFar"),e[47]=i,e[48]=Y):Y=e[48];const J=Rt(R),X=ot(R,Hc(s,s.orders.d1));let ee;e[49]!==i?(ee=i("monitor.store.sameTime"),e[49]=i,e[50]=ee):ee=e[50];let te;e[51]!==X||e[52]!==ee?(te=l.jsx(St,{change:X,better:"up",reference:ee}),e[51]=X,e[52]=ee,e[53]=te):te=e[53],e[54]!==Y||e[55]!==J||e[56]!==te?(g=l.jsx(Me,{title:Y,value:J,caption:te}),e[54]=Y,e[55]=J,e[56]=te,e[57]=g):g=e[57],c=Me,e[58]!==i?(f=i("monitor.store.canceled"),e[58]=i,e[59]=f):f=e[59],p=Rt(V),o=St,u=ot(V,Hc(s,s.cancellations.canceled.d1)),e[2]=s,e[3]=i,e[4]=o,e[5]=c,e[6]=d,e[7]=m,e[8]=u,e[9]=f,e[10]=p,e[11]=x,e[12]=h,e[13]=g,e[14]=v,e[15]=b}else o=e[4],c=e[5],d=e[6],m=e[7],u=e[8],f=e[9],p=e[10],x=e[11],h=e[12],g=e[13],v=e[14],b=e[15];let y;e[60]!==i?(y=i("monitor.store.sameTime"),e[60]=i,e[61]=y):y=e[61];let j;e[62]!==o||e[63]!==y||e[64]!==u?(j=l.jsx(o,{change:u,better:"down",reference:y}),e[62]=o,e[63]=y,e[64]=u,e[65]=j):j=e[65];let N;e[66]!==c||e[67]!==j||e[68]!==f||e[69]!==p?(N=l.jsx(c,{title:f,value:p,caption:j}),e[66]=c,e[67]=j,e[68]=f,e[69]=p,e[70]=N):N=e[70];let w;e[71]!==N||e[72]!==x||e[73]!==h||e[74]!==g?(w=l.jsxs("div",{className:x,children:[h,g,N]}),e[71]=N,e[72]=x,e[73]=h,e[74]=g,e[75]=w):w=e[75];let S;e[76]!==i?(S=i("monitor.store.ordersPerHour"),e[76]=i,e[77]=S):S=e[77];let k;e[78]!==i?(k=i("monitor.store.ordersPerHour"),e[78]=i,e[79]=k):k=e[79];let _;e[80]!==m||e[81]!==a||e[82]!==k?(_=l.jsx(Bc,{points:m,pushes:a,label:k}),e[80]=m,e[81]=a,e[82]=k,e[83]=_):_=e[83];let $;e[84]!==S||e[85]!==_?($=l.jsx(Me,{title:S,children:_}),e[84]=S,e[85]=_,e[86]=$):$=e[86];let T;e[87]!==s.channels||e[88]!==i?(T=s.channels.length>0&&l.jsx(Me,{title:i("monitor.store.channels"),children:l.jsx("ul",{className:"flex flex-col",children:s.channels.map(V6)})}),e[87]=s.channels,e[88]=i,e[89]=T):T=e[89];let P;e[90]!==i?(P=i("monitor.store.cancelsPerHour"),e[90]=i,e[91]=P):P=e[91];let I;e[92]!==i?(I=i("monitor.store.cancelsPerHour"),e[92]=i,e[93]=I):I=e[93];let C;e[94]!==d||e[95]!==a||e[96]!==I?(C=l.jsx(Bc,{points:d,pushes:a,label:I}),e[94]=d,e[95]=a,e[96]=I,e[97]=C):C=e[97];let M;e[98]!==P||e[99]!==C?(M=l.jsx(Me,{title:P,children:C}),e[98]=P,e[99]=C,e[100]=M):M=e[100];let A;e[101]!==T||e[102]!==M?(A=l.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[T,M]}),e[101]=T,e[102]=M,e[103]=A):A=e[103];let F;e[104]!==s.verdicts||e[105]!==i?(F=hu.map(R=>{const V=s.verdicts[R];return l.jsx(Me,{title:Vi(R,i),aside:l.jsx(Zp,{status:V.status}),caption:l.jsx("span",{className:"text-meta tnum",children:i("monitor.store.verdict",{observed:V.observed,expected:Math.round(V.expected)})})},R)}),e[104]=s.verdicts,e[105]=i,e[106]=F):F=e[106];let E;e[107]!==F?(E=l.jsx("div",{className:"mt-6 grid grid-cols-1 gap-4 sm:grid-cols-3",children:F}),e[107]=F,e[108]=E):E=e[108];let z;return e[109]!==w||e[110]!==$||e[111]!==A||e[112]!==E||e[113]!==v||e[114]!==b?(z=l.jsxs("div",{className:v,children:[b,w,$,A,E]}),e[109]=w,e[110]=$,e[111]=A,e[112]=E,e[113]=v,e[114]=b,e[115]=z):z=e[115],z}function V6(t){return l.jsxs("li",{className:"flex h-12 items-center gap-3 border-b border-border/50 last:border-b-0",children:[l.jsx("span",{className:"min-w-0 flex-1 truncate text-sm text-foreground",children:t.name??t.id}),l.jsx(Nn,{values:t.today,reference:t.d1,className:"h-6 w-24 shrink-0"}),l.jsx("span",{className:"tnum w-12 shrink-0 text-right text-sm text-foreground",children:Rt(t.soFar)}),l.jsx("span",{className:"w-28 shrink-0 text-right",children:l.jsx(St,{change:ot(t.soFar,t.d1SoFar),better:"up",reference:""})})]},t.id)}function q6(t){const e=O.c(12),{orgSlug:s,connectionId:n,at:i,scopeId:r}=t,a=ie(),o=ru(s,n,i),c=au(s,n,i,r??void 0);if(o.isLoading){let m;return e[0]===Symbol.for("react.memo_cache_sentinel")?(m=l.jsxs("div",{className:"flex flex-col gap-4",children:[l.jsxs("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-3",children:[l.jsx(Ce,{className:"h-32"}),l.jsx(Ce,{className:"h-32"}),l.jsx(Ce,{className:"h-32"})]}),l.jsx(Ce,{className:"h-80"})]}),e[0]=m):m=e[0],m}if(!o.data){let m;e[1]!==a?(m=a("orderMonitor.dayErrorTitle"),e[1]=a,e[2]=m):m=e[2];let u;e[3]!==o.error?.message||e[4]!==a?(u=o.error?.message??a("orderMonitor.dayErrorBody"),e[3]=o.error?.message,e[4]=a,e[5]=u):u=e[5];let f;return e[6]!==m||e[7]!==u?(f=l.jsx(Ke,{title:m,description:u}),e[6]=m,e[7]=u,e[8]=f):f=e[8],f}let d;return e[9]!==o.data||e[10]!==c.data?(d=l.jsx(z6,{day:o.data,pushes:c.data}),e[9]=o.data,e[10]=c.data,e[11]=d):d=e[11],d}function K6(t){const e=O.c(20),{store:s,storeId:n,orgSlug:i,scopeId:r,at:a,monitorLink:o,onBackToNow:c}=t,d=ie();let m;e[0]!==o?(m={link:o},e[0]=o,e[1]=m):m=e[1];const u=s?.store.title??n;let f;e[2]!==u?(f=[{key:"monitor-store",label:u}],e[2]=u,e[3]=f):f=e[3];let p;e[4]!==m||e[5]!==f?(p=l.jsx(We.Breadcrumbs,{after:"page",parent:m,items:f}),e[4]=m,e[5]=f,e[6]=p):p=e[6];let x;e[7]!==a||e[8]!==c||e[9]!==d?(x=a&&l.jsx(i1.Toolbar.Right.Portal,{children:l.jsx(Se,{variant:"outline",size:"sm",onClick:c,children:d("orderMonitor.backToNow")})}),e[7]=a,e[8]=c,e[9]=d,e[10]=x):x=e[10];let h;e[11]!==a||e[12]!==i||e[13]!==r||e[14]!==n?(h=l.jsx(q6,{orgSlug:i,connectionId:n,at:a,scopeId:r}),e[11]=a,e[12]=i,e[13]=r,e[14]=n,e[15]=h):h=e[15];let g;return e[16]!==p||e[17]!==x||e[18]!==h?(g=l.jsxs(l.Fragment,{children:[p,x,h]}),e[16]=p,e[17]=x,e[18]=h,e[19]=g):g=e[19],g}const Ps="var(--chart-1)",hm="var(--muted-foreground)",gm=44,Wc=["d1","w1","y1"],B6=12,H6=[3,6,9,12,15,18,21,24],Uc=.1,vm={orders:"lines",errors:"bars",cancellations:"bars",audience:"area",pageviews:"area",conversion:"band",latency:"threshold"},W6=t=>t==="band"||t==="threshold",bm={orders:"up",conversion:"up",audience:"up",pageviews:"up",latency:"down",errors:"down",cancellations:"down"},ur={d1:{dash:"4 3",opacity:.7},w1:{dash:void 0,opacity:.55},y1:{dash:"1 3",opacity:.9}};function jm(t){const e=O.c(4),{color:s,dash:n,opacity:i}=t,r=i===void 0?1:i;let a;return e[0]!==s||e[1]!==n||e[2]!==r?(a=l.jsx("svg",{width:"14",height:"6",viewBox:"0 0 14 6","aria-hidden":!0,className:"size-auto shrink-0",children:l.jsx("line",{x1:"0",x2:"14",y1:"3",y2:"3",stroke:s,strokeOpacity:r,strokeWidth:2,strokeDasharray:n,strokeLinecap:"round"})}),e[0]=s,e[1]=n,e[2]=r,e[3]=a):a=e[3],a}const yo=t=>{const e=O.c(3),{comparison:s}=t,n=ur[s],i=ur[s];let r;return e[0]!==n.dash||e[1]!==i.opacity?(r=l.jsx(jm,{color:hm,dash:n.dash,opacity:i.opacity}),e[0]=n.dash,e[1]=i.opacity,e[2]=r):r=e[2],r},ym=()=>{const t=O.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=l.jsx(jm,{color:Ps,dash:"3 2"}),t[0]=e):e=t[0],e};function wo(t,e){switch(t){case"d1":return e("monitor.compare.d1");case"w1":return e("monitor.compare.w1");case"y1":return e("monitor.compare.y1");default:return t}}const U6={d1:"D-1",w1:"W-1",y1:"Y-1"};function G6(t,e){switch(t){case"orders":return e("monitor.metric.orders");case"errors":return e("monitor.metric.errors");case"latency":return e("monitor.metric.latency");default:return t}}function No(t,e){return t==="conversion"?`${(e*100).toFixed(2)}%`:t==="latency"?Xs(e):ze(e)}function on(t,e){return t==="conversion"?`${e.toFixed(2)}%`:No(t,e)}function Y6(t,e){return t==="conversion"?`${Number(e.toFixed(2))}%`:Rt(e)}function Gc(t,e,s=4){const i=(e-t||Math.abs(e)||1)/s,r=10**Math.floor(Math.log10(i)),a=[1,2,2.5,5,10].map(m=>m*r).find(m=>m>=i)??10*r,o=Math.floor(t/a)*a,c=Math.ceil(e/a)*a,d=[];for(let m=o;m<=c+a/2;m+=a)d.push(Number(m.toFixed(6)));return{domain:[o,c],ticks:d}}const xn=t=>{const e=Math.round(t*60);return`${String(Math.floor(e/60)%24).padStart(2,"0")}:${String(e%60).padStart(2,"0")}`};function Yc(t,e){const s=new Map;for(const n of t){const i=Math.floor(n.bucket/B6);s.set(i,[...s.get(i)??[],n])}return[...s.entries()].sort(([n],[i])=>n-i).map(([n,i])=>{const r=c=>{const d=i.flatMap(u=>{const f=c(u);return f==null?[]:[f]});if(d.length===0)return null;const m=d.reduce((u,f)=>u+f,0);return e?m/d.length:m},a=r(c=>c.band&&Math.min(...c.band)),o=r(c=>c.band&&Math.max(...c.band));return{x:n+.5,hour:n,value:r(c=>c.value),refs:{d1:r(c=>c.d1),w1:r(c=>c.w1),y1:r(c=>c.y1)},band:a!==null&&o!==null?[a,o]:null}})}const js=(t,e)=>Math.max(0,(Date.parse(t.at)-e)/36e5);function Q6(t){const e=O.c(5);if(t.cx===void 0||t.cy===void 0){let r;return e[0]===Symbol.for("react.memo_cache_sentinel")?(r=l.jsx("g",{}),e[0]=r):r=e[0],r}const s=t.cx-10,n=t.cx+10;let i;return e[1]!==t.cy||e[2]!==s||e[3]!==n?(i=l.jsx("line",{x1:s,x2:n,y1:t.cy,y2:t.cy,stroke:"var(--foreground)",strokeOpacity:.55,strokeWidth:2,strokeLinecap:"round"}),e[1]=t.cy,e[2]=s,e[3]=n,e[4]=i):i=e[4],i}const Qc={regression:3,improvement:2,settling:1,neutral:0,unmeasured:0},wm={regression:"var(--destructive)",improvement:"var(--success)",settling:"var(--muted-foreground)",neutral:"var(--muted-foreground)",unmeasured:"var(--muted-foreground)"},X6={regression:"bg-destructive/10 text-destructive",improvement:"bg-success/10 text-success",settling:"bg-muted text-muted-foreground",neutral:"bg-muted text-muted-foreground",unmeasured:"bg-muted text-muted-foreground"};function Z6(t,e,s){const n=s*.025,i=[],r=[...t].sort((a,o)=>js(a,e)-js(o,e));for(const a of r){const o=js(a,e),c=i.at(-1),d=c?.changes.at(-1);c&&d&&o-js(d,e)<=n?c.changes.push(a):i.push({hour:o,changes:[a]})}return i}const J6=t=>t.reduce((e,s)=>Qc[s.verdict]>Qc[e]?s.verdict:e,"neutral");function ko(t){const e=O.c(3),{kind:s,size:n}=t;let i;return e[0]!==s||e[1]!==n?(i=s==="rollout"?l.jsx(Pu,{size:n}):l.jsx(bu,{size:n}),e[0]=s,e[1]=n,e[2]=i):i=e[2],i}function eb(t){const e=O.c(33),{change:s,time:n}=t,i=ie();let r;e[0]!==s.kind?(r=l.jsx(ko,{kind:s.kind,size:12}),e[0]=s.kind,e[1]=r):r=e[1];let a;e[2]!==s.kind||e[3]!==i?(a=s.kind==="rollout"?i("monitor.chart.rollout"):i("monitor.chart.deploy"),e[2]=s.kind,e[3]=i,e[4]=a):a=e[4];let o;e[5]!==a||e[6]!==n?(o=l.jsxs("span",{children:[a," ","· ",n]}),e[5]=a,e[6]=n,e[7]=o):o=e[7];const c=X6[s.verdict];let d;e[8]!==c?(d=ye("ml-auto rounded-full px-1.5 py-px text-[11px] font-medium",c),e[8]=c,e[9]=d):d=e[9];let m;e[10]!==s.verdict||e[11]!==i?(m=so(s.verdict,i),e[10]=s.verdict,e[11]=i,e[12]=m):m=e[12];let u;e[13]!==d||e[14]!==m?(u=l.jsx("span",{className:d,children:m}),e[13]=d,e[14]=m,e[15]=u):u=e[15];let f;e[16]!==r||e[17]!==o||e[18]!==u?(f=l.jsxs("div",{className:"text-meta flex items-center gap-1.5",children:[r,o,u]}),e[16]=r,e[17]=o,e[18]=u,e[19]=f):f=e[19];let p;e[20]!==s.message?(p=l.jsx("p",{className:"text-sm leading-snug font-medium text-foreground",children:s.message}),e[20]=s.message,e[21]=p):p=e[21];let x;e[22]!==s.author||e[23]!==s.projectTitle?(x=l.jsxs("p",{className:"text-meta",children:[s.author," · ",s.projectTitle]}),e[22]=s.author,e[23]=s.projectTitle,e[24]=x):x=e[24];let h;e[25]!==s.impact||e[26]!==i?(h=s.impact.length>0&&l.jsxs("div",{className:"mt-1 flex flex-col gap-1 border-t border-border/50 pt-2",children:[l.jsx("span",{className:"text-meta",children:i("monitor.chart.hourAfter")}),l.jsx("div",{className:"flex flex-wrap gap-x-3 gap-y-1",children:s.impact.map(v=>l.jsx(St,{change:v.change,better:bm[v.metric],reference:G6(v.metric,i)},v.metric))})]}),e[25]=s.impact,e[26]=i,e[27]=h):h=e[27];let g;return e[28]!==x||e[29]!==h||e[30]!==f||e[31]!==p?(g=l.jsxs("div",{className:"flex flex-col gap-1.5",children:[f,p,x,h]}),e[28]=x,e[29]=h,e[30]=f,e[31]=p,e[32]=g):g=e[32],g}function tb(t){const e=O.c(20),{trigger:s,onOpenChange:n,children:i}=t,[r,a]=Z.useState(!1);let o;e[0]!==n?(o=g=>{a(g),n(g)},e[0]=n,e[1]=o):o=e[1];const c=o;let d,m,u,f;e[2]!==c?(d=()=>c(!0),m=()=>c(!1),u=()=>c(!0),f=()=>c(!1),e[2]=c,e[3]=d,e[4]=m,e[5]=u,e[6]=f):(d=e[3],m=e[4],u=e[5],f=e[6]);let p;e[7]!==d||e[8]!==m||e[9]!==u||e[10]!==f||e[11]!==s?(p=l.jsx(ni,{asChild:!0,onMouseEnter:d,onMouseLeave:m,onFocus:u,onBlur:f,children:s}),e[7]=d,e[8]=m,e[9]=u,e[10]=f,e[11]=s,e[12]=p):p=e[12];let x;e[13]!==i?(x=l.jsx(ii,{side:"top",className:"pointer-events-none w-80 p-3",onOpenAutoFocus:sb,children:i}),e[13]=i,e[14]=x):x=e[14];let h;return e[15]!==r||e[16]!==c||e[17]!==p||e[18]!==x?(h=l.jsxs(li,{open:r,onOpenChange:c,children:[p,x]}),e[15]=r,e[16]=c,e[17]=p,e[18]=x,e[19]=h):h=e[19],h}function sb(t){return t.preventDefault()}function lb(t){const e=O.c(16),{changes:s,dayStart:n,end:i,focused:r,onFocus:a}=t,o=ie();let c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c={marginRight:gm},e[0]=c):c=e[0];let d;if(e[1]!==s||e[2]!==n||e[3]!==i||e[4]!==r||e[5]!==a||e[6]!==o){let u;e[8]!==n||e[9]!==i||e[10]!==r||e[11]!==a||e[12]!==o?(u=f=>{const p=f.changes.map(ib),x=f.changes[0],h=J6(f.changes),g=f.changes.some(nb),v=p.some(b=>r.includes(b));return l.jsx(tb,{onOpenChange:b=>a(b?p:[]),trigger:l.jsxs("button",{type:"button","aria-label":f.changes.length>1?o("monitor.chart.changesAt",{count:String(f.changes.length),time:xn(f.hour)}):x.message,className:ye("focus-ring absolute top-0 flex h-5 min-w-5 -translate-x-1/2 items-center justify-center gap-0.5 rounded-full border px-1 text-[10px] leading-none font-medium shadow-xs transition-transform",h==="regression"?"border-destructive/30 bg-destructive/10 text-destructive":h==="improvement"?"border-success/30 bg-success/10 text-success":g?"border-foreground bg-foreground text-background":"border-border bg-background text-muted-foreground",v&&"z-10 scale-110"),style:{left:`${Math.min(f.hour,i)/i*100}%`},children:[l.jsx(ko,{kind:g?"rollout":"deploy",size:11}),f.changes.length>1&&l.jsx("span",{className:"tnum pr-0.5",children:f.changes.length})]}),children:l.jsx("div",{className:"flex flex-col divide-y divide-border/50",children:f.changes.map(b=>l.jsx("div",{className:"py-2 first:pt-0 last:pb-0",children:l.jsx(eb,{change:b,time:xn(js(b,n))})},b.id))})},x.id)},e[8]=n,e[9]=i,e[10]=r,e[11]=a,e[12]=o,e[13]=u):u=e[13],d=Z6(s,n,i).map(u),e[1]=s,e[2]=n,e[3]=i,e[4]=r,e[5]=a,e[6]=o,e[7]=d}else d=e[7];let m;return e[14]!==d?(m=l.jsx("div",{className:"relative h-5",style:c,children:d}),e[14]=d,e[15]=m):m=e[15],m}function nb(t){return t.kind==="rollout"}function ib(t){return t.id}function Fn(t){const e=O.c(8),{mark:s,label:n,value:i}=t;let r;e[0]!==n?(r=l.jsx("span",{className:"text-muted-foreground",children:n}),e[0]=n,e[1]=r):r=e[1];let a;e[2]!==i?(a=l.jsx("span",{className:"tnum ml-auto pl-3 font-medium",children:i}),e[2]=i,e[3]=a):a=e[3];let o;return e[4]!==s||e[5]!==r||e[6]!==a?(o=l.jsxs("div",{className:"flex items-center gap-1.5 text-xs",children:[s,r,a]}),e[4]=s,e[5]=r,e[6]=a,e[7]=o):o=e[7],o}function rb(t){const e=O.c(49),{active:s,payload:n,kpi:i,shown:r,bandLabel:a,changes:o,dayStart:c}=t,d=ie(),m=n?.[0]?.payload;if(!s||!m)return null;let u;if(e[0]!==a||e[1]!==o||e[2]!==c||e[3]!==i.id||e[4]!==i.threshold||e[5]!==m.band||e[6]!==m.hour||e[7]!==m.projected||e[8]!==m.refs||e[9]!==m.value||e[10]!==r||e[11]!==d){let f;e[13]!==c||e[14]!==m.hour?(f=N=>Math.floor(js(N,c))===m.hour,e[13]=c,e[14]=m.hour,e[15]=f):f=e[15];const p=o.filter(f);let x;e[16]!==m.hour||e[17]!==d?(x=d("monitor.chart.range",{from:xn(m.hour),to:xn(m.hour+1)}),e[16]=m.hour,e[17]=d,e[18]=x):x=e[18];let h;e[19]!==x?(h=l.jsx("div",{className:"mb-1 text-xs text-muted-foreground",children:x}),e[19]=x,e[20]=h):h=e[20];let g;e[21]!==i.id||e[22]!==m.projected||e[23]!==m.value||e[24]!==d?(g=m.value!==null?l.jsx(Fn,{mark:l.jsx("span",{className:"size-2 shrink-0 rounded-full",style:{backgroundColor:Ps}}),label:d("monitor.chart.today"),value:on(i.id,m.value)}):m.projected!==null&&l.jsx(Fn,{mark:l.jsx(ym,{}),label:d("monitor.chart.projection"),value:on(i.id,m.projected)}),e[21]=i.id,e[22]=m.projected,e[23]=m.value,e[24]=d,e[25]=g):g=e[25];let v;if(e[26]!==i.id||e[27]!==m.refs||e[28]!==r||e[29]!==d){let N;e[31]!==i.id||e[32]!==m.refs||e[33]!==d?(N=w=>{const S=m.refs[w];return S!==null&&l.jsx(Fn,{mark:l.jsx(yo,{comparison:w}),label:wo(w,d),value:on(i.id,S)},w)},e[31]=i.id,e[32]=m.refs,e[33]=d,e[34]=N):N=e[34],v=r.map(N),e[26]=i.id,e[27]=m.refs,e[28]=r,e[29]=d,e[30]=v}else v=e[30];let b;e[35]!==a||e[36]!==i.id||e[37]!==m.band||e[38]!==d?(b=m.band&&l.jsx(Fn,{mark:l.jsx("span",{className:"size-2 shrink-0 rounded-sm bg-muted-foreground/30"}),label:a,value:d("monitor.chart.range",{from:on(i.id,m.band[0]),to:on(i.id,m.band[1])})}),e[35]=a,e[36]=i.id,e[37]=m.band,e[38]=d,e[39]=b):b=e[39];let y;e[40]!==i.id||e[41]!==i.threshold||e[42]!==d?(y=i.threshold!==void 0&&l.jsx(Fn,{mark:l.jsx("span",{className:"h-0 w-2 shrink-0 border-t border-dashed border-destructive"}),label:d("monitor.chart.target"),value:on(i.id,i.threshold)}),e[40]=i.id,e[41]=i.threshold,e[42]=d,e[43]=y):y=e[43];let j;e[44]!==g||e[45]!==v||e[46]!==b||e[47]!==y?(j=l.jsxs("div",{className:"flex flex-col gap-1",children:[g,v,b,y]}),e[44]=g,e[45]=v,e[46]=b,e[47]=y,e[48]=j):j=e[48],u=l.jsxs("div",{className:"min-w-48 rounded-lg border bg-background px-3 py-2 shadow-md",children:[h,j,p.length>0&&l.jsx("div",{className:"mt-2 flex flex-col gap-1 border-t border-border/50 pt-2",children:p.map(N=>l.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[l.jsx("span",{className:"shrink-0",style:{color:wm[N.verdict]},children:l.jsx(ko,{kind:N.kind,size:12})}),l.jsx("span",{className:"tnum",children:xn(js(N,c))}),l.jsx("span",{className:"max-w-52 truncate text-foreground",children:N.message})]},N.id))})]}),e[0]=a,e[1]=o,e[2]=c,e[3]=i.id,e[4]=i.threshold,e[5]=m.band,e[6]=m.hour,e[7]=m.projected,e[8]=m.refs,e[9]=m.value,e[10]=r,e[11]=d,e[12]=u}else u=e[12];return u}function ab(t){const e=O.c(33),{kpi:s,shape:n,shown:i,projection:r,bandLabel:a,hasBand:o}=t,c=ie();let d;e[0]!==n?(d=n==="bars"?l.jsx("span",{className:"size-2 rounded-sm bg-muted-foreground/70"}):l.jsx("span",{className:"h-0.5 w-3 rounded-full bg-chart-1"}),e[0]=n,e[1]=d):d=e[1];let m;e[2]!==c?(m=c("monitor.chart.todayPerHour"),e[2]=c,e[3]=m):m=e[3];let u;e[4]!==d||e[5]!==m?(u=l.jsxs("span",{className:"flex items-center gap-1.5",children:[d,m]}),e[4]=d,e[5]=m,e[6]=u):u=e[6];let f;e[7]!==r||e[8]!==c?(f=r&&l.jsxs("span",{className:"flex items-center gap-1.5",children:[l.jsx(ym,{}),c("monitor.chart.projection")]}),e[7]=r,e[8]=c,e[9]=f):f=e[9];let p;if(e[10]!==n||e[11]!==i||e[12]!==c){let b;e[14]!==n||e[15]!==c?(b=y=>l.jsxs("span",{className:"flex items-center gap-1.5",children:[n==="bars"?l.jsx("span",{className:"h-0.5 w-3 rounded-full bg-foreground/55"}):l.jsx(yo,{comparison:y}),wo(y,c)]},y),e[14]=n,e[15]=c,e[16]=b):b=e[16],p=i.map(b),e[10]=n,e[11]=i,e[12]=c,e[13]=p}else p=e[13];let x;e[17]!==a||e[18]!==o?(x=o&&l.jsxs("span",{className:"flex items-center gap-1.5",children:[l.jsx("span",{className:"h-2 w-3 rounded-sm bg-muted-foreground/20"}),a]}),e[17]=a,e[18]=o,e[19]=x):x=e[19];let h;e[20]!==n||e[21]!==c?(h=n==="bars"&&l.jsxs("span",{className:"flex items-center gap-1.5",children:[l.jsx("span",{className:"size-2 rounded-sm bg-destructive/70"}),c("monitor.chart.spike")]}),e[20]=n,e[21]=c,e[22]=h):h=e[22];let g;e[23]!==s.threshold||e[24]!==c?(g=s.threshold!==void 0&&l.jsxs("span",{className:"flex items-center gap-1.5",children:[l.jsx("span",{className:"h-0 w-3 border-t border-dashed border-destructive"}),c("monitor.chart.target")]}),e[23]=s.threshold,e[24]=c,e[25]=g):g=e[25];let v;return e[26]!==u||e[27]!==f||e[28]!==p||e[29]!==x||e[30]!==h||e[31]!==g?(v=l.jsxs("div",{className:"text-meta flex flex-wrap items-center gap-x-3 gap-y-1",children:[u,f,p,x,h,g]}),e[26]=u,e[27]=f,e[28]=p,e[29]=x,e[30]=h,e[31]=g,e[32]=v):v=e[32],v}function ob(t){const e=O.c(156),{kpi:s,title:n,points:i,shown:r,changes:a,dayStart:o}=t,c=ie();let d;e[0]===Symbol.for("react.memo_cache_sentinel")?(d=[],e[0]=d):d=e[0];const[m,u]=Z.useState(d),f=vm[s.id];let p,x,h,g,v,b,y,j,N,w,S,k,_,$,T,P,I,C,M,A,F,E,z,R,V,K,U,q;if(e[1]!==a||e[2]!==o||e[3]!==m||e[4]!==s||e[5]!==i||e[6]!==f||e[7]!==r||e[8]!==c||e[9]!==n){j=W6(f);const Q=Yc(i,j);h=Yc(s.projection??[],j);const re=Q.at(-1)?.hour??0,ce=h.length>0?24:Math.min(24,re+2);v=r[0]??"w1";const ae=[...Q.map(xe=>({...xe,projected:h.length>0&&xe.hour===re?xe.value:null})),...h.map(ub)].map(xe=>f==="band"&&xe.band===null&&xe.refs[v]!==null?{...xe,band:[xe.refs[v]*(1-Uc),xe.refs[v]*(1+Uc)]}:xe);y=ae.some(mb);let fe;e[38]!==f||e[39]!==c?(fe=c(f==="band"?"monitor.chart.normal":"orderMonitor.thresholdBand"),e[38]=f,e[39]=c,e[40]=fe):fe=e[40],g=fe;const de=ae.flatMap(xe=>[xe.value,xe.projected,...r.map(ke=>xe.refs[ke]),...xe.band??[]].filter(db)),se=Math.min(...de,s.threshold??Number.POSITIVE_INFINITY),H=Math.max(...de,s.threshold??0),oe=(H-se)*.4,he=j?Gc(Math.max(0,se-oe),H+oe):Gc(0,H),le=xe=>{const ke=xe.refs[v]??0;return(xe.value??0)>Math.max(ke*1.8,ke+3)?"var(--destructive)":"var(--muted-foreground)"};b=`monitor-expanded-${s.id}`,A="flex flex-col gap-1",e[41]!==a||e[42]!==o||e[43]!==ce||e[44]!==m?(F=l.jsx(lb,{changes:a,dayStart:o,end:ce,focused:m,onFocus:u}),e[41]=a,e[42]=o,e[43]=ce,e[44]=m,e[45]=F):F=e[45],x=It,T="img",P=n,I="h-[240px] w-full md:h-[300px]";let ne;e[46]!==c?(ne=c("monitor.chart.today"),e[46]=c,e[47]=ne):ne=e[47],e[48]!==ne?(C={value:{label:ne,color:Ps}},e[48]=ne,e[49]=C):C=e[49],p=Gs,M=ae,e[50]===Symbol.for("react.memo_cache_sentinel")?(E={left:0,right:0,top:4},e[50]=E):E=e[50],z=1;let me,ge;e[51]===Symbol.for("react.memo_cache_sentinel")?(me=l.jsx("stop",{offset:"0%",stopColor:Ps,stopOpacity:.18}),ge=l.jsx("stop",{offset:"100%",stopColor:Ps,stopOpacity:0}),e[51]=me,e[52]=ge):(me=e[51],ge=e[52]),e[53]!==b?(R=l.jsx("defs",{children:l.jsxs("linearGradient",{id:b,x1:"0",y1:"0",x2:"0",y2:"1",children:[me,ge]})}),e[53]=b,e[54]=R):R=e[54],e[55]===Symbol.for("react.memo_cache_sentinel")?(V=l.jsx(Ft,{strokeDasharray:"4 4",stroke:"var(--border)",strokeOpacity:.5,vertical:!1}),e[55]=V):V=e[55];let ve,be;e[56]!==ce?(ve=[0,ce],be=H6.filter(xe=>xe<=ce),e[56]=ce,e[57]=ve,e[58]=be):(ve=e[57],be=e[58]),e[59]!==ve||e[60]!==be?(K=l.jsx(zt,{dataKey:"x",type:"number",domain:ve,ticks:be,axisLine:!1,tickLine:!1,tick:mt,tickMargin:8,tickFormatter:xn}),e[59]=ve,e[60]=be,e[61]=K):K=e[61];let we;e[62]!==s.id?(we=xe=>Y6(s.id,xe),e[62]=s.id,e[63]=we):we=e[63],e[64]!==he.domain||e[65]!==he.ticks||e[66]!==we?(U=l.jsx(At,{orientation:"right",axisLine:!1,tickLine:!1,tick:mt,width:gm,domain:he.domain,ticks:he.ticks,tickFormatter:we}),e[64]=he.domain,e[65]=he.ticks,e[66]=we,e[67]=U):U=e[67];let $e;e[68]!==f?($e=f==="bars"?{fill:"var(--muted)",opacity:.5}:{stroke:"var(--border)",strokeDasharray:"4 4"},e[68]=f,e[69]=$e):$e=e[69];let je;if(e[70]!==g||e[71]!==a||e[72]!==o||e[73]!==s||e[74]!==r?(je=xe=>{const{active:ke,payload:_e}=xe;return l.jsx(rb,{active:ke,payload:_e,kpi:s,shown:r,bandLabel:g,changes:a,dayStart:o})},e[70]=g,e[71]=a,e[72]=o,e[73]=s,e[74]=r,e[75]=je):je=e[75],e[76]!==$e||e[77]!==je?(q=l.jsx(es,{cursor:$e,content:je}),e[76]=$e,e[77]=je,e[78]=q):q=e[78],e[79]!==s.threshold||e[80]!==he.domain?(N=s.threshold!==void 0&&l.jsx(na,{y1:s.threshold,y2:he.domain[1],fill:"var(--destructive)",fillOpacity:.05,ifOverflow:"hidden"}),e[79]=s.threshold,e[80]=he.domain,e[81]=N):N=e[81],e[82]!==s.threshold?(w=s.threshold!==void 0&&l.jsx(Ls,{y:s.threshold,stroke:"var(--destructive)",strokeOpacity:.6,strokeDasharray:"4 4"}),e[82]=s.threshold,e[83]=w):w=e[83],e[84]!==a||e[85]!==o||e[86]!==ce||e[87]!==m){let xe;e[89]!==m?(xe=_e=>m.includes(_e.id),e[89]=m,e[90]=xe):xe=e[90];let ke;e[91]!==o||e[92]!==ce?(ke=_e=>l.jsx(na,{x1:js(_e,o),x2:Math.min(ce,js(_e,o)+1),fill:wm[_e.verdict],fillOpacity:.07,ifOverflow:"hidden"},`after-${_e.id}`),e[91]=o,e[92]=ce,e[93]=ke):ke=e[93],S=a.filter(xe).map(ke),e[84]=a,e[85]=o,e[86]=ce,e[87]=m,e[88]=S}else S=e[88];if(e[94]!==a||e[95]!==o||e[96]!==m){let xe;e[98]!==o||e[99]!==m?(xe=ke=>{const _e=m.includes(ke.id);return l.jsx(Ls,{x:js(ke,o),stroke:_e&&ke.verdict==="regression"?"var(--destructive)":"var(--foreground)",strokeOpacity:_e?.6:m.length>0?.05:ke.kind==="rollout"?.28:.12,strokeWidth:_e?1.25:1},ke.id)},e[98]=o,e[99]=m,e[100]=xe):xe=e[100],k=a.map(xe),e[94]=a,e[95]=o,e[96]=m,e[97]=k}else k=e[97];e[101]!==y?(_=y&&l.jsx(Gt,{type:"monotone",dataKey:"band",stroke:"none",fill:"var(--muted-foreground)",fillOpacity:.12,activeDot:!1,isAnimationActive:!1}),e[101]=y,e[102]=_):_=e[102],$=f==="bars"&&l.jsx(Qn,{dataKey:"value",fillOpacity:.55,radius:[3,3,0,0],barSize:14,isAnimationActive:!1,children:ae.map(xe=>l.jsx(Za,{fill:le(xe)},xe.hour))}),e[1]=a,e[2]=o,e[3]=m,e[4]=s,e[5]=i,e[6]=f,e[7]=r,e[8]=c,e[9]=n,e[10]=p,e[11]=x,e[12]=h,e[13]=g,e[14]=v,e[15]=b,e[16]=y,e[17]=j,e[18]=N,e[19]=w,e[20]=S,e[21]=k,e[22]=_,e[23]=$,e[24]=T,e[25]=P,e[26]=I,e[27]=C,e[28]=M,e[29]=A,e[30]=F,e[31]=E,e[32]=z,e[33]=R,e[34]=V,e[35]=K,e[36]=U,e[37]=q}else p=e[10],x=e[11],h=e[12],g=e[13],v=e[14],b=e[15],y=e[16],j=e[17],N=e[18],w=e[19],S=e[20],k=e[21],_=e[22],$=e[23],T=e[24],P=e[25],I=e[26],C=e[27],M=e[28],A=e[29],F=e[30],E=e[31],z=e[32],R=e[33],V=e[34],K=e[35],U=e[36],q=e[37];let L;e[103]!==v||e[104]!==f?(L=f==="bars"&&l.jsx(D1,{dataKey:`refs.${v}`,isAnimationActive:!1,shape:Q6}),e[103]=v,e[104]=f,e[105]=L):L=e[105];let B;e[106]!==f||e[107]!==r?(B=f!=="bars"&&r.map(cb),e[106]=f,e[107]=r,e[108]=B):B=e[108];let Y;e[109]!==h.length?(Y=h.length>0&&l.jsx(rs,{type:"monotone",dataKey:"projected",stroke:Ps,strokeWidth:2,strokeOpacity:.7,strokeDasharray:"4 4",dot:!1,activeDot:!1,isAnimationActive:!1}),e[109]=h.length,e[110]=Y):Y=e[110];let J;e[111]!==b||e[112]!==f?(J=(f==="area"||f==="lines")&&l.jsx(Gt,{type:"monotone",dataKey:"value",stroke:Ps,strokeWidth:2,fill:`url(#${b})`,dot:!1,activeDot:{r:3,stroke:"var(--background)",strokeWidth:2},isAnimationActive:!1}),e[111]=b,e[112]=f,e[113]=J):J=e[113];let X;e[114]!==j?(X=j&&l.jsx(rs,{type:"monotone",dataKey:"value",stroke:Ps,strokeWidth:2,dot:!1,activeDot:{r:3,stroke:"var(--background)",strokeWidth:2},isAnimationActive:!1}),e[114]=j,e[115]=X):X=e[115];let ee;e[116]!==p||e[117]!==N||e[118]!==w||e[119]!==S||e[120]!==k||e[121]!==_||e[122]!==$||e[123]!==M||e[124]!==L||e[125]!==B||e[126]!==Y||e[127]!==J||e[128]!==X||e[129]!==E||e[130]!==z||e[131]!==R||e[132]!==V||e[133]!==K||e[134]!==U||e[135]!==q?(ee=l.jsxs(p,{data:M,margin:E,barCategoryGap:z,children:[R,V,K,U,q,N,w,S,k,_,$,L,B,Y,J,X]}),e[116]=p,e[117]=N,e[118]=w,e[119]=S,e[120]=k,e[121]=_,e[122]=$,e[123]=M,e[124]=L,e[125]=B,e[126]=Y,e[127]=J,e[128]=X,e[129]=E,e[130]=z,e[131]=R,e[132]=V,e[133]=K,e[134]=U,e[135]=q,e[136]=ee):ee=e[136];let te;e[137]!==x||e[138]!==T||e[139]!==P||e[140]!==I||e[141]!==C||e[142]!==ee?(te=l.jsx(x,{role:T,"aria-label":P,className:I,config:C,children:ee}),e[137]=x,e[138]=T,e[139]=P,e[140]=I,e[141]=C,e[142]=ee,e[143]=te):te=e[143];const D=h.length>0;let W;e[144]!==g||e[145]!==y||e[146]!==s||e[147]!==f||e[148]!==r||e[149]!==D?(W=l.jsx(ab,{kpi:s,shape:f,shown:r,projection:D,bandLabel:g,hasBand:y}),e[144]=g,e[145]=y,e[146]=s,e[147]=f,e[148]=r,e[149]=D,e[150]=W):W=e[150];let G;return e[151]!==A||e[152]!==F||e[153]!==te||e[154]!==W?(G=l.jsxs("div",{className:A,children:[F,te,W]}),e[151]=A,e[152]=F,e[153]=te,e[154]=W,e[155]=G):G=e[155],G}function cb(t){return l.jsx(rs,{type:"monotone",dataKey:`refs.${t}`,stroke:hm,strokeOpacity:ur[t].opacity,strokeDasharray:ur[t].dash,strokeWidth:1.5,dot:!1,activeDot:!1,isAnimationActive:!1},t)}function db(t){return t!==null}function mb(t){return t.band!==null}function ub(t){return{...t,value:null,projected:t.value}}function fb(t){const e=O.c(14),{kpi:s,multiple:n,shown:i,onShown:r}=t,a=ie(),o=s.value;let c;e[0]!==o||e[1]!==s.id||e[2]!==s.references||e[3]!==n||e[4]!==a?(c=Wc.map(p=>{const x=s.references[p];return l.jsxs(Xf,{value:p,"aria-label":wo(p,a),className:"flex-none gap-1.5 px-2.5 text-xs font-normal",children:[n&&l.jsx(yo,{comparison:p}),l.jsx("span",{className:"font-medium",children:U6[p]}),o!==null&&x!==null&&l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"tnum text-muted-foreground",children:No(s.id,x)}),l.jsx(St,{change:ot(o,x),better:bm[s.id],reference:""})]})]},p)}),e[0]=o,e[1]=s.id,e[2]=s.references,e[3]=n,e[4]=a,e[5]=c):c=e[5];const d=c;let m;e[6]!==r?(m=p=>r(Wc.filter(x=>p.includes(x))),e[6]=r,e[7]=m):m=e[7];const u=m;let f;return e[8]!==d||e[9]!==n||e[10]!==u||e[11]!==i||e[12]!==a?(f=n?l.jsx(Mo,{type:"multiple",variant:"outline",size:"sm","aria-label":a("monitor.compare.label"),value:[...i],onValueChange:u,className:"flex-wrap justify-start",children:d}):l.jsx(Mo,{type:"single",variant:"outline",size:"sm","aria-label":a("monitor.compare.label"),value:i[0]??"",onValueChange:p=>p&&u([p]),className:"flex-wrap justify-start",children:d}),e[8]=d,e[9]=n,e[10]=u,e[11]=i,e[12]=a,e[13]=f):f=e[13],f}function pb(t){const e=O.c(35),{kpi:s,title:n,changes:i,dayStart:r,onClose:a}=t,o=ie(),c=vm[s.id];let d;e[0]===Symbol.for("react.memo_cache_sentinel")?(d=["w1"],e[0]=d):d=e[0];const[m,u]=Z.useState(d);let f;e[1]!==s.id||e[2]!==s.projection||e[3]!==s.value||e[4]!==o?(f=s.value===null?void 0:l.jsxs("span",{className:"flex items-baseline gap-2",children:[No(s.id,s.value),s.projection&&l.jsx("span",{className:"text-meta font-sans tracking-normal",children:o("monitor.chart.projectedLabel")})]}),e[1]=s.id,e[2]=s.projection,e[3]=s.value,e[4]=o,e[5]=f):f=e[5];let p;e[6]!==s.historyLoaded||e[7]!==s.soFar||e[8]!==o?(p=s.soFar!==void 0&&l.jsxs("span",{className:"text-meta",children:[o("monitor.chart.soFar",{count:ze(s.soFar)}),s.historyLoaded!==void 0&&` · ${o("monitor.chart.historyLoading",{pct:`${Math.floor(s.historyLoaded*100)}%`})}`]}),e[6]=s.historyLoaded,e[7]=s.soFar,e[8]=o,e[9]=p):p=e[9];let x;e[10]!==o?(x=o("monitor.chart.close"),e[10]=o,e[11]=x):x=e[11];let h;e[12]===Symbol.for("react.memo_cache_sentinel")?(h=l.jsx(I1,{size:16}),e[12]=h):h=e[12];let g;e[13]!==a||e[14]!==x?(g=l.jsx(Se,{variant:"ghost",size:"icon","aria-label":x,onClick:a,children:h}),e[13]=a,e[14]=x,e[15]=g):g=e[15];const v=c!=="bars"&&c!=="band";let b;e[16]!==s||e[17]!==m||e[18]!==v?(b=l.jsx(fb,{kpi:s,multiple:v,shown:m,onShown:u}),e[16]=s,e[17]=m,e[18]=v,e[19]=b):b=e[19];let y;e[20]!==i||e[21]!==r||e[22]!==s||e[23]!==m||e[24]!==n?(y=s.points&&l.jsx(ob,{kpi:s,title:n,points:s.points,shown:m,changes:i,dayStart:Date.parse(r)}),e[20]=i,e[21]=r,e[22]=s,e[23]=m,e[24]=n,e[25]=y):y=e[25];let j;e[26]!==b||e[27]!==y?(j=l.jsxs("div",{className:"flex flex-col gap-4",children:[b,y]}),e[26]=b,e[27]=y,e[28]=j):j=e[28];let N;return e[29]!==j||e[30]!==f||e[31]!==p||e[32]!==g||e[33]!==n?(N=l.jsx(Me,{title:n,value:f,caption:p,aside:g,children:j}),e[29]=j,e[30]=f,e[31]=p,e[32]=g,e[33]=n,e[34]=N):N=e[34],N}const Nm=4,xb=["xl:grid-cols-1","xl:grid-cols-2","xl:grid-cols-3","xl:grid-cols-4"];function hb(t){const e=O.c(2),{text:s}=t;let n;return e[0]!==s?(n=l.jsxs(il,{children:[l.jsx(ll,{asChild:!0,children:l.jsx("button",{type:"button","aria-label":s,className:"focus-ring relative z-10 flex size-4 shrink-0 cursor-help items-center justify-center rounded-full bg-muted text-[0.625rem] font-medium text-muted-foreground",children:"?"})}),l.jsx(nl,{className:"max-w-64",children:s})]}),e[0]=s,e[1]=n):n=e[1],n}function km(t){const e=O.c(15),{numbers:s,expanded:n,onExpand:i}=t,r=n===void 0?null:n,a=ie();if(s.length===0)return null;const o=s.length>1&&"sm:grid-cols-2",c=xb[Math.min(s.length,Nm)-1];let d;e[0]!==o||e[1]!==c?(d=ye("grid grid-cols-1 gap-4",o,c),e[0]=o,e[1]=c,e[2]=d):d=e[2];let m;if(e[3]!==r||e[4]!==s||e[5]!==i||e[6]!==a){let f;e[8]!==r||e[9]!==i||e[10]!==a?(f=p=>l.jsxs(Me,{title:p.label,value:p.value??void 0,caption:p.value===null?l.jsx(Ce,{className:"h-9 w-3/5 rounded-lg"}):p.change,aside:l.jsx(hb,{text:p.help}),className:ye(p.kpi?.points&&i&&"relative surface-interactive",r===p.key&&"bg-accent"),children:[l.jsx("div",{className:"mt-auto h-16",children:p.value===null?l.jsx(Ce,{className:"h-full"}):p.chart}),p.kpi?.points&&i&&l.jsx("button",{type:"button","aria-expanded":r===p.key,"aria-label":a("monitor.chart.expand",{metric:p.label}),onClick:()=>i(r===p.key?null:p.key),className:"focus-ring absolute inset-0 cursor-pointer rounded-[inherit]"})]},p.key),e[8]=r,e[9]=i,e[10]=a,e[11]=f):f=e[11],m=s.map(f),e[3]=r,e[4]=s,e[5]=i,e[6]=a,e[7]=m}else m=e[7];let u;return e[12]!==d||e[13]!==m?(u=l.jsx("div",{className:d,children:m}),e[12]=d,e[13]=m,e[14]=u):u=e[14],u}function Xc(t){const e=O.c(18),{current:s,previous:n,against:i,better:r}=t,a=r===void 0?"up":r,o=100*(s-n)/n;let c,d,m;if(e[0]!==a||e[1]!==o){const p=Math.round(o),x=o/100;let h;e[5]!==a||e[6]!==x?(h=oi(x,a),e[5]=a,e[6]=x,e[7]=h):h=e[7];const g=h;m="text-meta tnum inline-flex items-center gap-1";const v=g==="good"&&"text-success",b=g==="bad"&&"text-destructive";e[8]!==v||e[9]!==b?(c=ye("font-medium",v,b),e[8]=v,e[9]=b,e[10]=c):c=e[10],d=p===0?"0%":`${p>0?"+":"−"}${Math.abs(p)}%`,e[0]=a,e[1]=o,e[2]=c,e[3]=d,e[4]=m}else c=e[2],d=e[3],m=e[4];let u;e[11]!==c||e[12]!==d?(u=l.jsx("span",{className:c,children:d}),e[11]=c,e[12]=d,e[13]=u):u=e[13];let f;return e[14]!==i||e[15]!==m||e[16]!==u?(f=l.jsxs("span",{className:m,children:[u,i]}),e[14]=i,e[15]=m,e[16]=u,e[17]=f):f=e[17],f}function Zc(t,e,s){const n=new Map;for(const r of t??[]){const a=r[e];if(a===null)continue;const o=Math.floor(r.bucket/12);n.set(o,[...n.get(o)??[],a])}const i=Math.max(-1,...n.keys());return Array.from({length:i+1},(r,a)=>{const o=n.get(a);if(!o)return null;const c=o.reduce((d,m)=>d+m,0);return s?c/o.length:c})}function gb(t){const e=(t??[]).filter(n=>n.value!==null&&n.w1!==null);if(e.length===0)return null;const s=n=>e.reduce((i,r)=>i+(r[n]??0),0);return{current:s("value"),previous:s("w1")}}function vb(t,e){const s=O.c(9),{org:n}=He(),i=t?.analyticsSite??"";let r;s[0]!==i?(r={analyticsSite:i},s[0]=i,s[1]=r):r=s[1];const a=jr(n.slug,r,t!==void 0),o=t!==void 0&&a.data?.registered===!0&&e,c=t?.analyticsSite??"";let d;s[2]!==n.slug||s[3]!==o||s[4]!==c?(d={orgSlug:n.slug,site:c,view:"overview",range:"24h",segment:Ox,enabled:o},s[2]=n.slug,s[3]=o,s[4]=c,s[5]=d):d=s[5];const m=yr(d),u=a.isLoading||o&&m.isLoading,f=o?m.data?.data:void 0;let p;return s[6]!==u||s[7]!==f?(p={loading:u,data:f},s[6]=u,s[7]=f,s[8]=p):p=s[8],p}function bb(t){const e=O.c(39),{project:s,today:n,kpis:i,deploys:r,dayStart:a}=t,o=ie(),[c,d]=Z.useState(null),{org:m}=He(),u=vb(s,n);let f;e[0]!==s?(f=s??{site:"",analyticsSite:""},e[0]=s,e[1]=f):f=e[1];const p=f,x=s!==void 0&&n&&!u.data,h=kn(m.slug,p,"summary","24h",x),g=kn(m.slug,p,"timeline","24h",x);let v,b,y,j,N,w,S;if(e[2]!==i||e[3]!==u.data||e[4]!==u.loading||e[5]!==x||e[6]!==h.data||e[7]!==h.isLoading||e[8]!==o||e[9]!==g.data||e[10]!==g.isLoading){const A=fn(u.data,"kpis"),F=fn(u.data,"kpisPrev"),E=Ve(u.data,"series"),z=h.data?.available&&h.data.data.view==="summary"?h.data:null,R=z?.data.view==="summary"?z.data:null,V=z?.window.kind==="calendar",K=g.data?.available&&g.data.data.view==="timeline"?g.data.data.points:[],U=u.loading||x&&(h.isLoading||g.isLoading),q=Nb,L=(Y,J,X)=>{const ee=B(Y==="visitors"?"audience":"pageviews",J,o(Y==="visitors"?"monitor.overview.visitorsHelpToday":"monitor.overview.pageviewsHelpToday"),ze,{whole:!0});if(ee)return ee;if(U)return q(Y,J,X);if(!A&&!R)return Y==="visitors"&&B("audience",J,o("monitor.overview.visitorsHelpToday"),ze,{whole:!0});const te=A?qe(A[Y]):R?.summary[Y]??null,D=A?qe(F?.[Y]):R?.previous?.[Y]??null,W=A?E.map(Q=>gt(Q[Y])):K.map(Q=>Q[Y]),G=D!==null&&D>0&&!V&&(qe(F?.covered)??1)>=.9;return te!==null&&W.length>1&&{key:Y,label:J,help:X,value:ze(te),change:G&&D!==null&&l.jsx(Xc,{current:te,previous:D,against:o("monitor.overview.vsPrior")}),chart:l.jsx(Nn,{values:W,className:"h-16"})}},B=(Y,J,X,ee,te)=>{const{rate:D,better:W,whole:G}=te===void 0?{}:te,Q=D===void 0?!1:D,re=W===void 0?"up":W,ce=G===void 0?Q:G,ae=i.find(se=>se.id===Y),fe=ae?ae.soFar??ae.value:null;if(!ae||fe===null)return!1;const de=ce?ae.references.w1===null?null:{current:fe,previous:ae.references.w1}:gb(ae.points);return{key:Y,label:J,help:X,value:ee(fe),change:de&&de.previous>0&&l.jsx(Xc,{current:de.current,previous:de.previous,against:o("monitor.overview.vsLastWeek"),better:re}),chart:l.jsx(Nn,{values:Zc(ae.points,"value",Q),reference:Zc(ae.points,"w1",Q),className:"h-16"}),kpi:ae}};v=B("orders",o("monitor.overview.orders"),o("monitor.overview.ordersHelpStore"),ze),b=L("visitors",o("monitor.overview.visitors"),o(V?"monitor.overview.visitorsHelpToday":"monitor.overview.visitorsHelp")),y=L("pageviews",o("monitor.overview.pageviews"),o(V?"monitor.overview.pageviewsHelpToday":"monitor.overview.pageviewsHelp")),j=B("cancellations",o("monitor.overview.cancellations"),o("monitor.overview.cancellationsHelp"),ze,{better:"down"}),N=B("conversion",o("monitor.overview.conversion"),o("monitor.overview.conversionHelp"),wb,{rate:!0}),w=B("errors",o("monitor.overview.errors"),o("monitor.overview.errorsHelp"),ze,{better:"down"}),S=B("latency",o("monitor.overview.latency"),o("monitor.overview.latencyHelp"),yb,{rate:!0,better:"down"}),e[2]=i,e[3]=u.data,e[4]=u.loading,e[5]=x,e[6]=h.data,e[7]=h.isLoading,e[8]=o,e[9]=g.data,e[10]=g.isLoading,e[11]=v,e[12]=b,e[13]=y,e[14]=j,e[15]=N,e[16]=w,e[17]=S}else v=e[11],b=e[12],y=e[13],j=e[14],N=e[15],w=e[16],S=e[17];let k;e[18]!==v||e[19]!==b||e[20]!==y||e[21]!==j||e[22]!==N||e[23]!==w||e[24]!==S?(k=[v,b,y,j,N,w,S].filter(jb).slice(0,Nm),e[18]=v,e[19]=b,e[20]=y,e[21]=j,e[22]=N,e[23]=w,e[24]=S,e[25]=k):k=e[25];const _=k;let $;e[26]!==c||e[27]!==_?($=_.find(A=>A.key===c),e[26]=c,e[27]=_,e[28]=$):$=e[28];const T=$,P=T?c:null;let I;e[29]!==_||e[30]!==P?(I=l.jsx(km,{numbers:_,expanded:P,onExpand:d}),e[29]=_,e[30]=P,e[31]=I):I=e[31];let C;e[32]!==a||e[33]!==r||e[34]!==T?(C=T?.kpi&&l.jsx(pb,{kpi:T.kpi,title:T.label,changes:r??[],dayStart:a,onClose:()=>d(null)},T.key),e[32]=a,e[33]=r,e[34]=T,e[35]=C):C=e[35];let M;return e[36]!==I||e[37]!==C?(M=l.jsxs("div",{className:"flex flex-col gap-4",children:[I,C]}),e[36]=I,e[37]=C,e[38]=M):M=e[38],M}function jb(t){return t!==!1}function yb(t){return Xs(t)}function wb(t){return`${(t*100).toFixed(2)}%`}function Nb(t,e,s){return{key:t,label:e,help:s,value:null,chart:null}}const ta="";function kb(t){const e=O.c(30),{orgSlug:s,value:n,onChange:i}=t,r=ie(),{data:a}=ou(s);if(!a?.isAdmin)return null;let o;e[0]!==r?(o=r("monitor.customer.own"),e[0]=r,e[1]=o):o=e[1];let c;e[2]!==o?(c={value:ta,label:o},e[2]=o,e[3]=c):c=e[3];let d;e[4]!==r?(d=r("monitor.customer.all"),e[4]=r,e[5]=d):d=e[5];let m;e[6]!==d?(m={value:"all",label:d},e[6]=d,e[7]=m):m=e[7];let u;if(e[8]!==a.orgs||e[9]!==s||e[10]!==c||e[11]!==m){let y;e[13]!==s?(y=j=>j.slug!==s,e[13]=s,e[14]=y):y=e[14],u=[c,m,...a.orgs.filter(y).map(Sb)],e[8]=a.orgs,e[9]=s,e[10]=c,e[11]=m,e[12]=u}else u=e[12];const f=u,p=n??ta;let x;e[15]!==i?(x=y=>i(y===ta?void 0:y),e[15]=i,e[16]=x):x=e[16];let h;e[17]!==r?(h=r("monitor.customer.placeholder"),e[17]=r,e[18]=h):h=e[18];let g;e[19]!==r?(g=r("monitor.customer.search"),e[19]=r,e[20]=g):g=e[20];let v;e[21]!==r?(v=r("monitor.customer.empty"),e[21]=r,e[22]=v):v=e[22];let b;return e[23]!==f||e[24]!==v||e[25]!==p||e[26]!==x||e[27]!==h||e[28]!==g?(b=l.jsx(j1,{options:f,value:p,onChange:x,width:"w-[220px]",placeholder:h,searchPlaceholder:g,emptyMessage:v}),e[23]=f,e[24]=v,e[25]=p,e[26]=x,e[27]=h,e[28]=g,e[29]=b):b=e[29],b}function Sb(t){return{value:t.slug,label:t.name||t.slug}}function _b(t){const e=O.c(5),{controls:s,customer:n}=t;if(!s&&!n)return null;let i;e[0]!==s?(i=s&&l.jsx(cu,{value:s.date,max:Vn(new Date),onChange:s.onDate}),e[0]=s,e[1]=i):i=e[1];let r;return e[2]!==n||e[3]!==i?(r=l.jsxs(We.Actions,{children:[n,i]}),e[2]=n,e[3]=i,e[4]=r):r=e[4],r}const $b=[{key:"orders",label:"monitor.overview.orders",value:"317"},{key:"visitors",label:"monitor.overview.visitors",value:"21,904"},{key:"pageviews",label:"monitor.overview.pageviews",value:"68,350"},{key:"cancellations",label:"monitor.overview.cancellations",value:"4"}],Tb=[3,2,2,4,7,9,8,10,12,11,13,12,9,10];function Pb(t){const e=O.c(6),{board:s}=t;let n;e[0]!==s.stores?(n=s.stores.flatMap(Eb),e[0]=s.stores,e[1]=n):n=e[1];const i=n;let r;return e[2]!==s.kpis||e[3]!==s.stores.length||e[4]!==i?(r=i.length>0&&i.length===s.stores.length?l.jsx(um,{days:i,conversion:s.kpis.find(Cb)}):null,e[2]=s.kpis,e[3]=s.stores.length,e[4]=i,e[5]=r):r=e[5],r}function Cb(t){return t.id==="conversion"}function Eb(t){return t.day?[t.day]:[]}function Mb(t){const e=O.c(18),{board:s,orgSlug:n,scopeId:i,today:r,selection:a,onSelect:o,ask:c,numbers:d,more:m}=t;let u;e[0]!==s.signals?(u=q2(s.signals),e[0]=s.signals,e[1]=u):u=e[1];const f=u;let p;e[2]!==s.stores||e[3]!==o||e[4]!==n||e[5]!==i||e[6]!==a||e[7]!==f||e[8]!==r?(p=f.length>0?l.jsx(Mg,{signals:f,orgSlug:n,scopeId:i,onOpenStore:g=>o({...a,store:g})}):r&&s.stores.length>0&&l.jsx(Ig,{}),e[2]=s.stores,e[3]=o,e[4]=n,e[5]=i,e[6]=a,e[7]=f,e[8]=r,e[9]=p):p=e[9];let x;e[10]!==s?(x=l.jsx(Pb,{board:s}),e[10]=s,e[11]=x):x=e[11];let h;return e[12]!==c||e[13]!==m||e[14]!==d||e[15]!==p||e[16]!==x?(h=l.jsxs("div",{className:"flex flex-col gap-8",children:[c,p,x,d,m]}),e[12]=c,e[13]=m,e[14]=d,e[15]=p,e[16]=x,e[17]=h):h=e[17],h}function Ib(t){const e=O.c(77),{board:s,loading:n,error:i,orgSlug:r,scopeId:a,orgWide:o,selection:c,onSelect:d}=t,m=o===void 0?!1:o,u=ie(),f=Rs();let p,x,h,g,v;if(e[0]!==i||e[1]!==n||e[2]!==d||e[3]!==s||e[4]!==r||e[5]!==m||e[6]!==f||e[7]!==a||e[8]!==c||e[9]!==u){h=Symbol.for("react.early_return_sentinel");e:{const _=c6(a,f,c.project,m);let $;e[15]!==d||e[16]!==c.view?($=L=>d({view:c.view,project:L??void 0}),e[15]=d,e[16]=c.view,e[17]=$):$=e[17];const T=$,P=B2(s,_),I=(L,B)=>{const Y=P.stores.find(J=>J.store.connectionId===L);return B&&Y?zn(B,"23:59:59",ra(Y.store)):void 0},C=L=>P.sources.find(B=>B.id===L)?.state??"off";v=c.view??"metrics";let M;e[18]!==c.date?(M=c.date??Vn(new Date),e[18]=c.date,e[19]=M):M=e[19];const A=M;let F;e[20]===Symbol.for("react.memo_cache_sentinel")?(F=Vn(new Date),e[20]=F):F=e[20];const E=A===F,z=f.find(L=>L.id===_);let R;e[21]!==d||e[22]!==c.project?(R=L=>d({view:L==="metrics"?void 0:L,project:c.project}),e[21]=d,e[22]=c.project,e[23]=R):R=e[23];let V;e[24]!==R||e[25]!==v?(V=l.jsx(xg,{view:v,onView:R}),e[24]=R,e[25]=v,e[26]=V):V=e[26];const K=!a&&f.length>1&&l.jsx(a6,{projects:f,value:_,onChange:T});let U;if(e[27]!==V||e[28]!==K?(U=l.jsxs(l.Fragment,{children:[V,K]}),e[27]=V,e[28]=K,e[29]=U):U=e[29],g=U,v==="deploys"){const L=C("deploys"),B=n?l.jsx(Ce,{className:"h-64"}):P.deploys?l.jsx($c,{deploys:P.deploys,history:P.deployHistory,orgSlug:r,scopeId:_}):l.jsx(Ds,{kind:"metrics",title:u("monitor.locked.deploys.title"),...L==="partial"?{guide:l.jsx(Vc,{})}:{steps:[{source:"deploys",state:L}]},link:Ss(r,_),children:l.jsx($c,{deploys:[],history:null,orgSlug:r,scopeId:_})});let Y;e[30]!==B?(Y=l.jsx("div",{className:"mx-auto flex w-full max-w-[1200px] flex-col gap-4 px-4 pt-6 pb-10 md:px-10",children:B}),e[30]=B,e[31]=Y):Y=e[31],h=l.jsxs(Ks,{tabs:g,children:[!n&&P.deploys&&l.jsx(We.Actions,{children:l.jsxs(li,{children:[l.jsx(ni,{asChild:!0,children:l.jsxs(Se,{variant:"outline",size:"sm",className:"gap-1",children:[l.jsx(Vm,{size:14}),u("monitor.repos.button")]})}),l.jsx(ii,{align:"end",className:"w-80 p-3",children:l.jsx(Vc,{})})]})}),Y]});break e}if(v==="alerts"){let L;e[32]!==d||e[33]!==c.project?(L=B=>d({project:c.project,store:B}),e[32]=d,e[33]=c.project,e[34]=L):L=e[34],h=l.jsx(Ks,{tabs:g,children:l.jsx(cp,{orgSlug:r,stores:new Set(P.stores.map(Db)),scoped:_!==null,onOpenStore:L})});break e}if(v==="experiments"){h=l.jsx(Ks,{tabs:g,children:l.jsx(zv,{scopeId:_})});break e}if(v==="logs"){h=l.jsx(Ks,{tabs:g,children:l.jsx(Xv,{scopeId:_,onProject:T})});break e}if(v==="audience"){let L;e[35]!==d||e[36]!==c.view?(L=B=>d({view:c.view,project:B.project}),e[35]=d,e[36]=c.view,e[37]=L):L=e[37],h=l.jsx(Ks,{tabs:g,children:l.jsx(bg,{scopeId:_,onOpen:L})});break e}if(v==="heatmap"){h=l.jsx(Ks,{tabs:g,children:l.jsx(vg,{scopeId:_,onProject:T})});break e}if(v==="performance"){h=l.jsx(Ks,{tabs:g,children:l.jsx(gg,{scopeId:_,onProject:T})});break e}x=P.stores.length===0&&!P.deploys?.length&&!P.experiments?.length&&P.kpis.every(Lb);const q=P.sources.every(Ab);if(c.store){let L;e[38]!==c.store?(L=Y=>Y.store.connectionId===c.store,e[38]=c.store,e[39]=L):L=e[39];let B;e[40]!==d||e[41]!==c.store?(B=()=>d({store:c.store}),e[40]=d,e[41]=c.store,e[42]=B):B=e[42],p=l.jsx(K6,{store:P.stores.find(L),storeId:c.store,orgSlug:r,scopeId:_,at:c.at??I(c.store,c.date),monitorLink:_?{to:Cs.monitoring,params:{org:r,agentId:_}}:{to:Oa.monitoring,params:{org:r}},onBackToNow:B})}else if(n){let L;e[43]===Symbol.for("react.memo_cache_sentinel")?(L=l.jsxs("div",{className:"flex flex-col gap-6",children:[l.jsx(Ce,{className:"h-14 rounded-full"}),l.jsx(Ce,{className:"h-32"})]}),e[43]=L):L=e[43],p=L}else if(i){let L;e[44]===Symbol.for("react.memo_cache_sentinel")?(L=l.jsx(pr,{size:20}),e[44]=L):L=e[44];let B;e[45]!==u?(B=u("monitor.loadError"),e[45]=u,e[46]=B):B=e[46];let Y;e[47]!==i.message||e[48]!==B?(Y=l.jsx(Ke,{icon:L,title:B,description:i.message}),e[47]=i.message,e[48]=B,e[49]=Y):Y=e[49],p=Y}else if(q){let L;e[50]!==u?(L=u("monitor.locked.metrics.title"),e[50]=u,e[51]=L):L=e[51];const B=["orders","analytics","site","deploys"].map(ee=>({source:ee,state:C(ee)})),Y=Ss(r,_);let J;e[52]!==u?(J=$b.map(ee=>({key:ee.key,label:u(ee.label),help:u(ee.label),value:ee.value,chart:l.jsx(Nn,{values:Tb,className:"h-14"})})),e[52]=u,e[53]=J):J=e[53];let X;e[54]!==J?(X=l.jsx(km,{numbers:J}),e[54]=J,e[55]=X):X=e[55],p=l.jsx(Ds,{kind:"metrics",title:L,steps:B,link:Y,children:X})}else{let L;e[56]!==z?.title||e[57]!==c.customer?(L=c.customer?null:l.jsx(mp,{project:z?.title??null}),e[56]=z?.title,e[57]=c.customer,e[58]=L):L=e[58],p=l.jsx(Mb,{board:P,selection:c,orgSlug:r,scopeId:_,today:E,onSelect:d,ask:L,numbers:l.jsx(bb,{project:z,today:E,kpis:P.kpis,deploys:P.deploys,dayStart:P.dayStart}),more:!c.customer&&l.jsx(Ex,{steps:["orders","analytics","site","deploys"].map(B=>({source:B,state:C(B),meta:B==="orders"?u("monitor.connect.ordersAlerts"):void 0})),link:Ss(r,_)})})}}e[0]=i,e[1]=n,e[2]=d,e[3]=s,e[4]=r,e[5]=m,e[6]=f,e[7]=a,e[8]=c,e[9]=u,e[10]=p,e[11]=x,e[12]=h,e[13]=g,e[14]=v}else p=e[10],x=e[11],h=e[12],g=e[13],v=e[14];if(h!==Symbol.for("react.early_return_sentinel"))return h;const b=v==="metrics"&&!n&&!i&&(!!c.store||!x);let y;e[59]!==b||e[60]!==d||e[61]!==c?(y=b?{date:c.date??Vn(new Date),onDate:_=>d({...c,date:_===Vn(new Date)?void 0:_,at:void 0})}:null,e[59]=b,e[60]=d,e[61]=c,e[62]=y):y=e[62];const j=y;let N;e[63]!==d||e[64]!==r||e[65]!==c.customer||e[66]!==v?(N=v==="metrics"&&l.jsx(kb,{orgSlug:r,value:c.customer,onChange:_=>d({view:"metrics",customer:_})}),e[63]=d,e[64]=r,e[65]=c.customer,e[66]=v,e[67]=N):N=e[67];let w;e[68]!==j||e[69]!==N?(w=l.jsx(_b,{controls:j,customer:N}),e[68]=j,e[69]=N,e[70]=w):w=e[70];let S;e[71]!==p?(S=l.jsx("div",{className:"mx-auto flex w-full max-w-[1200px] flex-col gap-4 px-4 pt-6 pb-10 md:px-10",children:p}),e[71]=p,e[72]=S):S=e[72];let k;return e[73]!==w||e[74]!==S||e[75]!==g?(k=l.jsxs("div",{className:"flex h-full min-h-0 flex-col overflow-auto",children:[g,w,S]}),e[73]=w,e[74]=S,e[75]=g,e[76]=k):k=e[76],k}function Ab(t){return t.state==="off"}function Lb(t){return t.value===null}function Db(t){return t.store.connectionId}const zi=(t,e)=>(t.app_name??"").includes(e)||(t.app_id??"").includes(e);function Ob(t,e,s){const n=r1(),i=Zf("monitoring"),r=n.orderMonitorEnabled===!0&&i,a=du(t,r),o=i?a.data??[]:[],c=mu()!==void 0,d=Ja(t).alerts,m=c?[]:d,u=!r||a.isSuccess,f=e?o.filter(D=>D.agentIds.includes(e)):o,p=uu(t,f.map(D=>({connectionId:D.connectionId,at:s?zn(s,"23:59:59",ra(D)):void 0}))),x=new Map(f.flatMap((D,W)=>{const G=p[W]?.data;return G?[[D.connectionId,G]]:[]})),h=[...x.values()],g=gr(),v=c?[]:g,b=f[0]?ra(f[0]):Intl.DateTimeFormat().resolvedOptions().timeZone,y=e?bn(v.find(D=>D.id===e)):null,j=fu(t,{tz:b,at:s?zn(s,"23:59:59",b):void 0,site:y??null},i&&(!e||!!y)).data??null,N=v1(),w=c?[]:N,S=Ha().data??[],k=c?[]:S.filter(D=>D.monitorDeploys),_=Eu(k.map(D=>D.id)).data??[],$=h.length===f.length&&f.length>0,T=p.find(D=>D.error)?.error??null,P=new Map(o.map(D=>[D.connectionId,D])),I=(s?[]:m).flatMap(D=>{const W=P.get(D.subjectId);return e&&W&&!W.agentIds.includes(e)?[]:[{kind:"alert",id:D.id,severity:"alert",since:D.createdAt,projectId:W?e??W.agentIds[0]??null:null,storeId:W?.connectionId??null,title:D.title,link:D.link}]}),C=e?v.filter(D=>D.id===e):v,M=C.filter(D=>!n1(D.id)&&D.metadata?.type!=="commerce-discovery"&&bn(D)),A=w.filter(D=>zi(D,"google-analytics")),F=w.filter(D=>zi(D,"search-console")),E=w.filter(D=>zi(D,"vtex")||zi(D,"shopify")),z=f.flatMap(D=>D.rules.map(W=>W.evaluatedAt)).sort().at(-1),R=[f.length>0?{id:"orders",state:"live",detail:{provider:"VTEX",count:f.length},lastEventAt:z??null,lakeRows:null,icon:E[0]?.icon??null}:{id:"orders",state:V2(0,E.length,u),detail:E.length>0?{provider:"VTEX",count:E.length}:null,lastEventAt:null,lakeRows:null,icon:E[0]?.icon??null},{id:"site",state:M.length>0?"live":"off",detail:M.length>0?{provider:"deco",count:M.length}:null,lastEventAt:null,lakeRows:null},{id:"deploys",state:k.length>0?"live":S.length>0?"partial":"off",detail:k.length>0?{provider:"GitHub",count:k.length}:null,lastEventAt:null,lakeRows:null},{id:"analytics",icon:A[0]?.icon??null,state:A.length>0?"live":"off",detail:A.length>0?{provider:"Google",count:A.length}:null,lastEventAt:null,lakeRows:null},{id:"search",icon:F[0]?.icon??null,state:F.length>0?"live":"off",detail:F.length>0?{provider:"Google",count:F.length}:null,lastEventAt:null,lakeRows:null}],V=h.length===0?0:Math.min(...h.map(D=>Math.floor(D.done/4))),K=[];if(f.length>0){const D=(H,oe)=>h.length===0?null:nt(h.map(he=>he.orders[H][oe]??null)),W=Array.from({length:24},(H,oe)=>oe),G=(H,oe)=>{const he=h.map(le=>{const{warn:ne,alert:me}=H(le);return[me[oe]??null,ne[oe]??null]});return h.length>0&&he.every(([le,ne])=>le!==null&&ne!==null)?[nt(he.map(([le])=>le)),nt(he.map(([,le])=>le))]:null},Q=H=>G(oe=>({warn:oe.orders.warnAt,alert:oe.orders.alertAt}),H),re=W.filter(H=>H<V).map(H=>({bucket:H*12+6,value:D("today",H),d1:D("d1",H),w1:D("w1",H),y1:D("y1",H),band:Q(H)})),ce=W.filter(H=>H>=V).map(H=>({bucket:H*12+6,value:h.length===0?null:nt(h.map(oe=>oe.orders.expected[H]??null)),d1:D("d1",H),w1:D("w1",H),y1:D("y1",H),band:Q(H)})),ae=h.flatMap(H=>H.backfill?[H.backfill]:[]);K.push({id:"orders",source:"orders",value:$?nt(h.map(H=>H.headline.projected)):null,soFar:$?nt(h.map(H=>nt(H.orders.today))):void 0,historyLoaded:ae.length>0?1-nt(ae.map(H=>H.pending))/nt(ae.map(H=>H.total)):void 0,references:{d1:$?nt(h.map(H=>H.headline.d1)):null,w1:$?nt(h.map(H=>H.headline.w1)):null,y1:$?nt(h.map(H=>H.headline.y1)):null},points:$?re:null,projection:$?ce:void 0});const fe=(H,oe)=>h.length===0?null:nt(h.map(he=>he.cancellations.canceled[H][oe]??null)),de=W.filter(H=>H<=V),se=H=>$?nt(de.map(oe=>fe(H,oe))):null;K.push({id:"cancellations",source:"orders",value:$?nt(de.map(H=>fe("today",H))):null,references:{d1:se("d1"),w1:se("w1"),y1:se("y1")},points:$?de.map(H=>({bucket:H*12+6,value:fe("today",H),d1:fe("d1",H),w1:fe("w1",H),y1:fe("y1",H),band:G(oe=>({warn:oe.cancellations.canceledWarnAt,alert:oe.cancellations.canceledAlertAt}),H)})):null})}const U=(j?.visitors.today??[]).flatMap((D,W)=>D===null?[]:[W]),q=j?Object.values(j.headline.conversions).some(D=>D>0)?{hour:(D,W)=>j.conversions[D][W]??null,day:D=>j.headline.conversions[D]}:$?{hour:(D,W)=>nt(h.map(G=>G.orders[D][W]??null)),day:D=>nt(U.map(W=>nt(h.map(G=>G.orders[D][W]??null))))}:null:null;if(j){const{visitors:D,headline:W}=j;K.push({id:"audience",source:"site",value:W.visitors.today,references:{d1:W.visitors.d1,w1:W.visitors.w1,y1:W.visitors.y1},points:U.map(Q=>({bucket:Q*12+6,value:D.today[Q]??null,d1:D.d1[Q]??null,w1:D.w1[Q]??null,y1:D.y1[Q]??null}))});const{pageviews:G}=j;K.push({id:"pageviews",source:"site",value:W.pageviews.today,references:{d1:W.pageviews.d1,w1:W.pageviews.w1,y1:W.pageviews.y1},points:U.map(Q=>({bucket:Q*12+6,value:G.today[Q]??null,d1:G.d1[Q]??null,w1:G.w1[Q]??null,y1:G.y1[Q]??null}))})}if(j&&q){const{visitors:D,headline:W}=j,G=(re,ce)=>re===null||!ce?null:re/ce,Q=(re,ce)=>{const ae=G(q.hour(re,ce),D[re][ce]??null);return ae===null?null:ae*100};K.push({id:"conversion",source:"site",value:G(q.day("today"),W.visitors.today),references:{d1:G(q.day("d1"),W.visitors.d1),w1:G(q.day("w1"),W.visitors.w1),y1:G(q.day("y1"),W.visitors.y1)},points:U.map(re=>({bucket:re*12+6,value:Q("today",re),d1:Q("d1",re),w1:Q("w1",re),y1:Q("y1",re)}))})}else A.length===0&&K.push({id:"conversion",source:"analytics",value:null,references:{d1:null,w1:null,y1:null},points:null});const L=new Map;for(const D of h)for(const W of D.channels){const G=W.name??W.id,Q=L.get(G);L.set(G,Q?{...Q,today:Q.today.map((re,ce)=>re===null&&W.today[ce]===null?null:(re??0)+(W.today[ce]??0)),d1:Q.d1.map((re,ce)=>re+(W.d1[ce]??0)),soFar:Q.soFar+W.soFar,d1SoFar:Q.d1SoFar+W.d1SoFar}:{...W,id:G})}const B=C.flatMap(D=>{const W=f.filter(Q=>Q.agentIds.includes(D.id));if(W.length===0)return[];const G=W.flatMap(Q=>{const re=x.get(Q.connectionId);return re?[re]:[]});return[{id:D.id,title:D.title,status:R1(W.map(K2)),orders:G.length?nt(G.map(Q=>Q.headline.projected)):null,ordersPrevious:G.length?nt(G.map(Q=>Q.headline.d1)):null,ordersSeries:null,conversion:null,errorRate:null,lastDeploy:null,signals:I.filter(Q=>Q.kind==="alert"&&W.some(re=>re.connectionId===Q.storeId)).length}]}),Y=D=>{const W=x.get(D);return W?[{start:Date.parse(zn(W.date,"00:00:00",W.timezone)),done:W.done,today:W.orders.today,w1:W.orders.w1}]:[]},J=new Map(k.map(D=>[D.id,D])),X=k.length===0?null:_.flatMap(D=>{const W=J.get(D.repositoryId),G=D.commits.at(-1);if(!W||!G)return[];const Q={repositoryId:W.id,url:W.webUrl},re=C.filter(ae=>{const fe=ae.metadata?.repository;return!!fe&&W1(fe,Q)});if(e&&re.length===0)return[];const ce=f.filter(ae=>re.some(fe=>ae.agentIds.includes(fe.id)));return[{id:`${D.repositoryId}:${G.sha}`,kind:"deploy",projectId:e??re[0]?.id??null,projectTitle:re[0]?.title??W.path,at:D.at,message:G.message,author:G.author,task:null,around:null,...H2(Date.parse(D.at),ce.flatMap(ae=>Y(ae.connectionId)))}]}),ee=h[0]?zn(h[0].date,"00:00:00",h[0].timezone):new Date(new Date().setHours(0,0,0,0)).toISOString(),te=Date.parse(ee);return{board:{checkedAt:z??null,dayStart:ee,kpis:K,channels:$?[...L.values()].map(D=>({...D,today:D.today.map((W,G)=>G<V?W:null)})):null,stores:f.map(D=>({store:D,day:x.get(D.connectionId)})),deploys:X?.filter(D=>{const W=Date.parse(D.at);return W>=te&&W<te+864e5})??null,deployHistory:X,signals:I,projects:B,experiments:null,sources:R},loading:a.isLoading||p.some(D=>D.isLoading),error:(i?a.error:null)??T}}function Rb(){const t=O.c(11);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e={strict:!1},t[0]=e):e=t[0];const s=fr(e),n="view"in s&&typeof s.view=="string"?s.view:void 0,i="section"in s&&typeof s.section=="string"?s.section:void 0;let r;t[1]!==n||t[2]!==i?(r=n==="audience"&&i?zb(i):n?Fb(n):void 0,t[1]=n,t[2]=i,t[3]=r):r=t[3];const a=r,o="date"in s&&typeof s.date=="string"?s.date:void 0,c="store"in s&&typeof s.store=="string"?s.store:void 0,d="at"in s&&typeof s.at=="string"?s.at:void 0,m="project"in s&&typeof s.project=="string"?s.project:void 0,u="customer"in s&&typeof s.customer=="string"?s.customer:void 0;let f;return t[4]!==o||t[5]!==c||t[6]!==d||t[7]!==m||t[8]!==u||t[9]!==a?(f={view:a,date:o,store:c,at:d,project:m,customer:u},t[4]=o,t[5]=c,t[6]=d,t[7]=m,t[8]=u,t[9]=a,t[10]=f):f=t[10],f}function Fb(t){return t==="analytics"?"performance":t==="errors"?"logs":t==="realtime"||t==="pages"||t==="events"?"audience":Id.find(e=>e===t)}function zb(t){return t==="heatmap"?"heatmap":t==="errors"?"logs":t==="vitals"?"performance":"audience"}function Vb(){const t=O.c(3);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e={strict:!1},t[0]=e):e=t[0];const s=fr(e);let n;return t[1]!==s?(n=Object.fromEntries(Vx.flatMap(i=>s[i]===void 0?[]:[[i,s[i]]])),t[1]=s,t[2]=n):n=t[2],n}function qb(t){const e=O.c(9),{orgSlug:s,scopeId:n,orgWide:i,selection:r,onSelect:a}=t,o=Rs().some(f=>f.id===r.project)?r.project:void 0,{board:c,loading:d,error:m}=Ob(s,r.customer?null:n??o??null,r.date);let u;return e[0]!==c||e[1]!==m||e[2]!==d||e[3]!==a||e[4]!==s||e[5]!==i||e[6]!==n||e[7]!==r?(u=l.jsx(Ib,{board:c,loading:d,error:m,orgSlug:s,scopeId:n,orgWide:i,selection:r,onSelect:a}),e[0]=c,e[1]=m,e[2]=d,e[3]=a,e[4]=s,e[5]=i,e[6]=n,e[7]=r,e[8]=u):u=e[8],u}function Kb(){const t=O.c(22),{org:e}=He(),s=Jf();let n;t[0]!==s?(n=s&&qm({id:s})?s:null,t[0]=s,t[1]=n):n=t[1];const i=n,r=Cn(),a=Rb(),o=Vb();let c;t[2]!==r||t[3]!==e.slug||t[4]!==s||t[5]!==o||t[6]!==a.customer||t[7]!==a.project||t[8]!==a.view?(c=h=>{const g=h.view==="audience"&&a.view==="audience"&&h.project===a.project?{...h,...o}:h,v="customer"in h?g:{...g,customer:a.customer};r(s?{to:Cs.monitoring,params:{org:e.slug,agentId:s},search:v}:{to:Oa.monitoring,params:{org:e.slug},search:v})},t[2]=r,t[3]=e.slug,t[4]=s,t[5]=o,t[6]=a.customer,t[7]=a.project,t[8]=a.view,t[9]=c):c=t[9];const d=c,m=(a.view??"metrics")==="metrics"?a.customer:void 0,u=s!==null&&i===null;let f;t[10]!==m||t[11]!==a?(f={...a,customer:m},t[10]=m,t[11]=a,t[12]=f):f=t[12];let p;t[13]!==d||t[14]!==e.slug||t[15]!==i||t[16]!==u||t[17]!==f?(p=l.jsx(qb,{orgSlug:e.slug,scopeId:i,orgWide:u,selection:f,onSelect:d}),t[13]=d,t[14]=e.slug,t[15]=i,t[16]=u,t[17]=f,t[18]=p):p=t[18];let x;return t[19]!==m||t[20]!==p?(x=l.jsx(pu.Provider,{value:m,children:p}),t[19]=m,t[20]=p,t[21]=x):x=t[21],x}function U7(){const t=O.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=l.jsx(Km.Content,{children:l.jsx(Kb,{})}),t[0]=e):e=t[0],e}export{U7 as default};