PageSourceSearch

https://crazyleads.com.br/_next/static/chunks/9259.090e150376c7edd7.js

js crazyleads.com.br collected 2026-09-24 14:36:04 UTC 126,698 bytes, 1 lines download raw bytes

1!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},t=(new e.Error).stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="6479e715-f084-4563-9973-e7f044dc9d39",e._sentryDebugIdIdentifier="sentry-dbid-6479e715-f084-4563-9973-e7f044dc9d39")}catch(e){}}();"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9259],{76858:function(e,t,n){n.d(t,{Z:function(){return a}});let a=(0,n(79205).Z)("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]])},95468:function(e,t,n){n.d(t,{Z:function(){return a}});let a=(0,n(79205).Z)("Ban",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m4.9 4.9 14.2 14.2",key:"1m5liu"}]])},96215:function(e,t,n){n.d(t,{Z:function(){return a}});let a=(0,n(79205).Z)("ChartColumn",[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M18 17V9",key:"2bz60n"}],["path",{d:"M13 17V5",key:"1frdt8"}],["path",{d:"M8 17v-3",key:"17ska0"}]])},92451:function(e,t,n){n.d(t,{Z:function(){return a}});let a=(0,n(79205).Z)("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]])},92735:function(e,t,n){n.d(t,{Z:function(){return a}});let a=(0,n(79205).Z)("Download",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]])},46211:function(e,t,n){n.d(t,{Z:function(){return a}});let a=(0,n(79205).Z)("Flag",[["path",{d:"M4 15s1-1 4-1 5 2 8 2 4-1 4-1V3s-1 1-4 1-5-2-8-2-4 1-4 1z",key:"i9b6wo"}],["line",{x1:"4",x2:"4",y1:"22",y2:"15",key:"1cm3nv"}]])},13781:function(e,t,n){n.d(t,{Z:function(){return a}});let a=(0,n(79205).Z)("GitBranch",[["line",{x1:"6",x2:"6",y1:"3",y2:"15",key:"17qcm7"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M18 9a9 9 0 0 1-9 9",key:"n2h4wq"}]])},61788:function(e,t,n){n.d(t,{Z:function(){return a}});let a=(0,n(79205).Z)("GitMerge",[["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}],["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M6 21V9a9 9 0 0 0 9 9",key:"7kw0sc"}]])},28124:function(e,t,n){n.d(t,{Z:function(){return a}});let a=(0,n(79205).Z)("Layers",[["path",{d:"m12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83Z",key:"8b97xw"}],["path",{d:"m22 17.65-9.17 4.16a2 2 0 0 1-1.66 0L2 17.65",key:"dd6zsq"}],["path",{d:"m22 12.65-9.17 4.16a2 2 0 0 1-1.66 0L2 12.65",key:"ep9fru"}]])},45554:function(e,t,n){n.d(t,{Z:function(){return a}});let a=(0,n(79205).Z)("ListChecks",[["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["path",{d:"m3 7 2 2 4-4",key:"1obspn"}],["path",{d:"M13 6h8",key:"15sg57"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 18h8",key:"oe0vm4"}]])},45675:function(e,t,n){n.d(t,{Z:function(){return a}});let a=(0,n(79205).Z)("Pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]])},82431:function(e,t,n){n.d(t,{Z:function(){return a}});let a=(0,n(79205).Z)("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]])},73247:function(e,t,n){n.d(t,{Z:function(){return a}});let a=(0,n(79205).Z)("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]])},44743:function(e,t,n){n.d(t,{Z:function(){return a}});let a=(0,n(79205).Z)("Send",[["path",{d:"m22 2-7 20-4-9-9-4Z",key:"1q3vgg"}],["path",{d:"M22 2 11 13",key:"nzbqef"}]])},92369:function(e,t,n){n.d(t,{Z:function(){return a}});let a=(0,n(79205).Z)("User",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]])},85629:function(e,t,n){n.d(t,{X:function(){return c}});var a=n(57437),s=n(39612),i=n(79455),r=n(95733),o=n(19889),d=n(51817),l=n(2265);function c(e){let{open:t,name:n,pending:c,onOpenChange:u,onConfirm:m}=e,{t:p}=(0,o.$G)(),[x,f]=(0,l.useState)("");(0,l.useEffect)(()=>{t||f("")},[t]);let h=x.trim()===n.trim()&&""!==n.trim();return(0,a.jsx)(s.aR,{open:t,onOpenChange:e=>!c&&u(e),children:(0,a.jsxs)(s._T,{children:[(0,a.jsxs)(s.fY,{children:[(0,a.jsx)(s.f$,{children:p("audiencias.list.deleteTitle")}),(0,a.jsx)(s.yT,{children:p("audiencias.list.deleteDescription")})]}),(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsx)("label",{className:"text-xs text-muted-foreground",htmlFor:"audience-delete-confirm",children:p("audiencias.list.deleteConfirmLabel",{name:n})}),(0,a.jsx)(r.I,{id:"audience-delete-confirm",value:x,onChange:e=>f(e.target.value),placeholder:n,autoComplete:"off",disabled:c})]}
1),(0,a.jsxs)(s.xo,{children:[(0,a.jsx)(s.le,{disabled:c,children:p("common.cancel")}),(0,a.jsx)(i.z,{variant:"destructive",disabled:!h||c,onClick:m,children:c?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(d.Z,{className:"mr-2 h-4 w-4 animate-spin"}),p("audiencias.list.deleting")]}):p("audiencias.list.delete")})]})]})})}},42978:function(e,t,n){n.d(t,{LQ:function(){return R},S:function(){return k},Ys:function(){return j},lY:function(){return C}});var a=n(57437),s=n(53751),i=n(79455),r=n(48954),o=n(25477),d=n(63935),l=n(65252),c=n(19889),u=n(19700),m=n(23882),p=n(71632),x=n(95805),f=n(99397),h=n(96362),v=n(44743),g=n(27648),b=n(2265);function j(){return{lista:[]}}function y(e){return u.OB.find(t=>t.backendType===e)}let N={healthy:"audiencias.destinos.health.healthy",paused:"audiencias.destinos.health.paused",disabled:"audiencias.destinos.health.disabled",credentials_invalid:"audiencias.destinos.health.credentials_invalid",unhealthy:"audiencias.destinos.health.unhealthy"};function w(e){let{d:t}=e,{t:n}=(0,c.$G)(),s=t.enabled&&"healthy"===t.health_status,i=N[t.health_status];return(0,a.jsx)("span",{className:(0,m.cn)("rounded px-1.5 py-0.5 text-[10px]",s?"bg-emerald-50 text-emerald-700":"bg-amber-50 text-amber-700"),children:i?n(i):t.health_status})}function _(e){var t;let{d:n}=e,s=y(n.type),i=null==s?void 0:s.icon;return(0,a.jsxs)("div",{className:"flex min-w-0 items-center gap-2",children:[i&&(0,a.jsx)(i,{className:(0,m.cn)("h-4 w-4 shrink-0",null==s?void 0:s.accent)}),(0,a.jsx)("span",{className:"truncate text-sm font-medium",children:n.name}),(0,a.jsx)("span",{className:"shrink-0 font-mono text-[10px] text-muted-foreground",children:null!==(t=null==s?void 0:s.label)&&void 0!==t?t:n.type}),(0,a.jsx)(w,{d:n})]})}function k(e){let t=(0,p.a)({queryKey:["actions","destinations",e],queryFn:()=>l.d.listDestinations(e),enabled:!!e,staleTime:3e4}),n=(0,b.useMemo)(()=>{var e,n;return null!==(n=null===(e=t.data)||void 0===e?void 0:e.data)&&void 0!==n?n:[]},[t.data]),a=(0,b.useMemo)(()=>n.filter(e=>{var t;return(null===(t=y(e.type))||void 0===t?void 0:t.kind)==="list"}),[n]);return{...t,deLista:a}}function C(e){let{destinos:t,value:n,onChange:s,indisponiveis:i=[]}=e,{t:l}=(0,c.$G)(),u=e=>n.find(t=>t.destination_id===e),p=(e,t)=>s(t?[...n.filter(t=>t.destination_id!==e),{destination_id:e,sync_mode:"mirror"}]:n.filter(t=>t.destination_id!==e));return(0,a.jsx)("div",{className:"space-y-2",children:t.map(e=>{let t=u(e.id),c=i.includes(e.id);return(0,a.jsxs)("div",{className:(0,m.cn)("flex flex-wrap items-center gap-3 rounded-md border p-3",t?"border-primary/40 bg-primary/5":"border-border",c&&"opacity-60"),children:[(0,a.jsx)(r.X,{id:"lista-".concat(e.id),checked:!!t,disabled:c,onCheckedChange:t=>p(e.id,!0===t)}),(0,a.jsx)(o._,{htmlFor:"lista-".concat(e.id),className:"min-w-0 flex-1 cursor-pointer",children:(0,a.jsx)(_,{d:e})}),c&&(0,a.jsx)("span",{className:"rounded bg-muted px-1.5 py-0.5 text-[10px] text-muted-foreground",children:l("audiencias.review.alreadyLinked")}),t&&(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"text-xs text-muted-foreground",children:l("audiencias.destinos.syncMode")}),(0,a.jsxs)(d.Ph,{value:t.sync_mode,onValueChange:t=>s(n.map(n=>n.destination_id===e.id?{...n,sync_mode:t}:n)),children:[(0,a.jsx)(d.i4,{className:"h-8 w-[220px] text-xs",children:(0,a.jsx)(d.ki,{})}),(0,a.jsxs)(d.Bw,{children:[(0,a.jsx)(d.Ql,{value:"mirror",children:l("audiencias.destinos.mirror")}),(0,a.jsx)(d.Ql,{value:"add_only",children:l("audiencias.destinos.addOnly")})]})]})]})]},e.id)})})}function R(e){let{projectId:t,projectSlug:n,value:r,onChange:o,retornoCriarDestino:d,jaLigadas:l=[]}=e,{t:u}=(0,c.$G)(),{deLista:m,isLoading:p,isError:b}=k(t),j="/projects/".concat(n,"/destinations/new?type=meta_audience")+(d?"&retorno=".concat(encodeURIComponent(d)):"");return b?(0,a.jsx)(s.bZ,{variant:"destructive",children:(0,a.jsx)(s.X,{children:u("audiencias.destinos.error")})}):(0,a.jsxs)("div",{className:"space-y-8",children:[(0,a.jsxs)("section",{className:"space-y-3",children:[(0,a.jsxs)("div",{className:"flex items-start justify-between gap-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsxs)("h3",{className:"flex items-center gap-2 text-sm font-semibold",children:[(0,a.jsx)(x.Z,{className:"h-4 w-4 text-muted-foreground"}),u("audiencias.destinos.listTitle")]}),(0,a.jsx)("p",{className:"mt-1 text-xs text-muted-foreground",children:u("audiencias.destinos.listDescription")})]}),(0,a.jsx)(i.z,{asChild:!0,type:"button",variant:"outline",size:"sm",className:"h-8 shrink-0 text-xs",children:(0,a.jsxs)(g.default,{href:j,children:[(0,a.jsx)(f.Z,{className:"mr-1 h-3 w-3"}),u("audiencias.destinos.createDestination"),(0,a.jsx)(h.Z,{className:"ml-1 h-3 w-3 opacity-60"})]})})]}),p&&(0,a.jsx)("p",{className:"text-xs text-muted-foreground",children:u("audiencias.destinos.loading")}),!p&&0===m.length&&(0,a.jsx)("p",{className:"rounded border border-dashed border-border p-4 text-center text-xs text-muted-foreground",children:u("audiencias.destinos.listEmpty")}),(0,a.jsx)(C,{destinos:m,value:r.lista,onChange:e=>o({...r,lista:e}),indisponiveis:l})]}),(0,a.jsxs)("section",{className:"rounded-md border border-border bg-muted/30 px-4 py-3",children:[(0,a.jsxs)("h3",{className:"flex items-center gap-2 text-sm font-semibold",children:[(0,a.jsx)(v.Z,{className:"h-4 w-4 text-muted-foreground"}),u("audiencias.destinos.eventsAreEnviosTitle")]}),(0,a.jsx)("p",{className:"mt-1 text-xs text-muted-foreground",children:u("audiencias.destinos.eventsAreEnviosDescription")})]})]})}},13859:function(e,t,n){n.d(t,{R:function(){return c}});var a=n(57437),s=n(59095),i=n(19889),r=n(51817),o=n(54442),d=n(93717);let l={ok:"success",info:"info",warn:"warning",error:"error",neutral:"neutral"};function c(e){let{estado:t,computacao:n,className:c}=e,{t:u}=(0,i.$G)(),m=(0,o.F)(t),p="calculando"===t||"erro_de_calculo"===t?(0,d.B6)(n):null,x=(0,d.P)(p),f="calculando"===t&&(0,d.D7)(n);return(0,a.jsxs)(s.O,{tone:l[m.tom],className:c,children:[f&&(0,a.jsx)(r.Z,{className:"mr-1 inline h-3 w-3 animate-spin","aria-hidden":!0}),x?u(x.key,x.params):"audiencias.estado.desconhecido"===m.labelKey?String(t):u(m.labelKey)]})}},54442:function(e,t,n){n.d(t,{F:function(){return r},j:function(){return i}});let a={calculando:{labelKey:"audiencias.estado.calculando",tom:"info"},erro_de_calculo:{labelKey:"audiencias.estado.erro_de_calculo",tom:"error"},sincronizada:{labelKey:"audiencias.estado.sincronizada",tom:"ok"},sincronizando:{labelKey:"audiencias.estado.sincronizando",tom:"info"},pausada:{labelKey:"audiencias.estado.pausada",tom:"neutral"},bloqueada:{labelKey:"audiencias.estado.bloqueada",tom:"warn"},falha:{labelKey:"audiencias.estado.falha",tom:"error"},sem_destino:{labelKey:"audiencias.estado.sem_destino",tom:"neutral"}},s={labelKey:"audiencias.estado.desconhecido",tom:"neutral"},i=Object.keys(a);function r(e){var t;return null!==(t=a[e])&&void 0!==t?t:s}},36594:function(e,t,n){function a(e,t,n){if(null==e&&null==t)return"—";let a=e=>null==e?"?":new Intl.NumberFormat(n).format(e);return null!=e&&null!=t&&e===t?a(e):"".concat(a(e),"–").concat(a(t))}function s(e){if(!e)return"neutral";let t=e.toLowerCase();return t.includes("error")||t.includes("fail")?"error":t.includes("normal")||t.includes("ready")||t.includes("ok")||t.includes("done")?"success":t.includes("progress")||t.includes("running")||t.includes("pending")?"info":"neutral"}function i(e){switch(e){case"completed":case"done":return"success";case"partial":return"warning";case"failed":case"blocked":case"canceled":case"cancelled":return"error";
1case"running":case"queued":return"info";default:return"neutral"}}function r(e){if(!e)return null;let t=e.replace(/^act_/,"").trim();return/^\d+$/.test(t)?"https://business.facebook.com/adsmanager/audiences?act=".concat(t):null}n.d(t,{Cw:function(){return i},Mi:function(){return r},eH:function(){return a},er:function(){return s}})},6311:function(e,t,n){n.d(t,{Y8:function(){return i},p6:function(){return s}});var a=n(38766);function s(e,t){return"full"===e?t("audiencias.detail.runs.kindFull"):"delta"===e?t("audiencias.detail.runs.kindDelta"):null!=e?e:"—"}function i(e,t){var n;let{t:s,locale:i,agora:r}=t;if(!e)return s("audiencias.detail.runs.none");let o=(0,a.y)(null!==(n=e.finished_at)&&void 0!==n?n:e.started_at,s,r),d=e=>new Intl.NumberFormat(i).format(e);if("running"===e.status||"queued"===e.status)return s("audiencias.detail.runs.running",{quando:o});if("failed"===e.status)return s("audiencias.detail.runs.failed",{quando:o,erro:e.error?": ".concat(e.error):""});if("blocked"===e.status)return s("audiencias.detail.runs.blocked",{quando:o,erro:e.error?": ".concat(e.error):""});let l=function(e,t){let{t:n,locale:a}=t,s=e=>new Intl.NumberFormat(a).format(e),i=[];return e.invalid>0&&i.push(n("audiencias.detail.runs.invalid",{count:s(e.invalid)})),e.sem_identificador>0&&i.push(n("audiencias.detail.runs.noIdentifier",{count:s(e.sem_identificador)})),i}(e,t),c=l.length?" (".concat(l.join(" \xb7 "),")"):"";return(e.sent_add>0&&e.sent_remove>0?s("audiencias.detail.runs.sentAndRemoved",{quando:o,enviados:d(e.sent_add),removidos:d(e.sent_remove)}):e.sent_add>0?s("audiencias.detail.runs.sent",{quando:o,enviados:d(e.sent_add)}):e.sent_remove>0?s("audiencias.detail.runs.removed",{quando:o,removidos:d(e.sent_remove)}):s("audiencias.detail.runs.nothing",{quando:o}))+c}},38766:function(e,t,n){n.d(t,{y:function(){return a}});function a(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Date.now();if(!e)return t("audiencias.list.never");let a=new Date(e).getTime();if(Number.isNaN(a))return t("audiencias.list.never");let s=Math.floor((n-a)/6e4);if(s<1)return t("audiencias.list.relativeNow");if(s<60)return t("audiencias.list.relativeMinutes",{count:s});let i=Math.floor(s/60);return i<24?t("audiencias.list.relativeHours",{count:i}):t("audiencias.list.relativeDays",{count:Math.floor(i/24)})}},43880:function(e,t,n){n.r(t),n.d(t,{AudienceDetailTemplate:function(){return eJ}});var a=n(57437),s=n(79455),i=n(57175),r=n(17733),o=n(19889),d=n(65600),l=n(48535),c=n(51817),u=n(32489),m=n(45675),p=n(82431),x=n(18930),f=n(76865),h=n(13781),v=n(99376),g=n(2265),b=n(13113),j=n(13443),y=n(23882),N=n(93717),w=n(38766);function _(e){var t,n;let{progresso:s,className:i}=e,{t:r}=(0,o.$G)();if(!s)return null;let d="erro"===s.fase;return(0,a.jsxs)("div",{className:(0,y.cn)("shrink-0 border-b border-border bg-muted/30 px-4 py-1.5",i),role:"status",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 text-[11px]",children:[d?(0,a.jsx)(f.Z,{className:"h-3.5 w-3.5 shrink-0 text-destructive"}):(0,a.jsx)(c.Z,{className:"h-3.5 w-3.5 shrink-0 animate-spin text-muted-foreground"}),(0,a.jsx)("span",{className:(0,y.cn)("min-w-0 truncate",d?"text-destructive":"text-muted-foreground"),children:"catchup"===s.fase?r("audiencias.calculo.headerCatchup"):"erro"===s.fase?null!==(n=s.erro)&&void 0!==n?n:r("audiencias.calculo.errorUnknown"):null!=s.feito&&null!=s.total?r("conversoes"===s.unidade?"audiencias.calculo.headerBackfillConversions":"audiencias.calculo.headerBackfillDays",{done:s.feito,total:s.total}):r("audiencias.calculo.headerBackfill")}),null!=s.percentual&&!d&&(0,a.jsxs)("span",{className:"ml-auto shrink-0 tabular-nums text-muted-foreground",children:[s.percentual,"%"]})]}),!d&&(0,a.jsx)(j.E,{value:null!==(t=s.percentual)&&void 0!==t?t:"catchup"===s.fase?95:0,className:(0,y.cn)("mt-1 h-1",null==s.percentual&&"animate-pulse")})]})}function k(e){var t,n;let{progresso:i,eventos:r,onRetry:d,retrying:l}=e,{t:u}=(0,o.$G)();if(!i)return null;let m=r.length?r.join(", "):u("audiencias.calculo.eventsFallback");if("erro"===i.fase)return(0,a.jsx)(b.$W,{titulo:u("audiencias.calculo.errorTitle"),children:(0,a.jsxs)("div",{className:"space-y-3 text-xs",children:[(0,a.jsx)("p",{className:"rounded-md border border-destructive/30 bg-destructive/5 px-3 py-2 font-mono text-[11px] text-destructive break-words",children:null!==(t=i.erro)&&void 0!==t?t:u("audiencias.calculo.errorUnknown")}),(0,a.jsx)("p",{className:"text-muted-foreground",children:u("audiencias.calculo.errorHint")}),(0,a.jsxs)(s.z,{variant:"outline",size:"sm",className:"h-8 gap-1.5 text-xs",onClick:d,disabled:l,children:[l?(0,a.jsx)(c.Z,{className:"h-3 w-3 animate-spin"}):(0,a.jsx)(p.Z,{className:"h-3 w-3"}),u("audiencias.calculo.retry")]})]})});let x="catchup"===i.fase?u("audiencias.calculo.cardCatchup"):null!=i.feito&&null!=i.total?u("conversoes"===i.unidade?"audiencias.calculo.cardBackfillConversions":"audiencias.calculo.cardBackfillDays",{done:i.feito,total:i.total,events:m}):u("audiencias.calculo.cardBackfill",{events:m});return(0,a.jsx)(b.$W,{titulo:u("audiencias.calculo.cardTitle"),children:(0,a.jsxs)("div",{className:"space-y-2 text-xs",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)(c.Z,{className:"h-3.5 w-3.5 shrink-0 animate-spin text-muted-foreground"}),(0,a.jsx)("span",{className:"text-foreground",children:x}),null!=i.percentual&&(0,a.jsxs)("span",{className:"ml-auto tabular-nums text-muted-foreground",children:[i.percentual,"%"]})]}),(0,a.jsx)(j.E,{value:null!==(n=i.percentual)&&void 0!==n?n:"catchup"===i.fase?95:0,className:"h-1.5"}),i.startedAt&&(0,a.jsx)("p",{className:"text-muted-foreground",children:u("audiencias.calculo.cardSince",{when:(0,w.y)(i.startedAt,u)})}),(0,a.jsx)("p",{className:"text-muted-foreground",children:u("audiencias.calculo.cardHint")})]})})}function C(e){let{progresso:t}=e,{t:n}=(0,o.$G)();return t?"erro"===t.fase?(0,a.jsx)("span",{className:"text-destructive",children:n("audiencias.calculo.membersError")}):"catchup"===t.fase?(0,a.jsx)(a.Fragment,{children:n("audiencias.calculo.membersCatchup")}):(0,a.jsxs)("span",{className:"inline-flex items-center gap-2",children:[(0,a.jsx)(c.Z,{className:"h-3.5 w-3.5 animate-spin"}),null!=t.feito&&null!=t.total&&"dias"===t.unidade?n("audiencias.calculo.membersBackfill",{done:t.feito,total:t.total}):n("audiencias.calculo.membersBackfillNoTotal")]}):null}var R=n(85629),I=n(7912),S=n(59095),U=n(99397),z=n(76858),T=n(96362),D=n(27648);function E(e,t,n,a){let s=new Map,i=new Map(a.map(e=>[e.id,e]));for(let e of a)if(e.signalSourceIds.includes(t))for(let t of e.outputs)for(let n of t.subscriptionIds)s.set(n,{grupo:e,destEvent:t.destEvent,subscriptionEnabled:t.subscriptionEnabled});return n.map(t=>{var n,a,r,o,d,l;
1let c=t.group_id?i.get(t.group_id):void 0,u=c?{grupo:c,destEvent:null!==(r=null===(n=c.outputs.find(e=>e.subscriptionIds.includes(t.id)))||void 0===n?void 0:n.destEvent)&&void 0!==r?r:"",subscriptionEnabled:t.enabled}:s.get(t.id),m=u?u.grupo.id:null!==(o=t.group_id)&&void 0!==o?o:null;return{subscriptionId:t.id,envioId:m,envioName:u?u.grupo.name:null!==(d=t.feature_name)&&void 0!==d?d:null,destinationId:t.destination_id,destinationName:t.destination.name,destinationType:t.destination.type,signalType:(null===(a=t.events)||void 0===a?void 0:a.length)?t.events.join(", "):t.signal_type,destEvent:(null==u?void 0:u.destEvent)||null,enabled:t.enabled,href:m?"/projects/".concat(e,"/pipelines/").concat(encodeURIComponent(m)):(l=t.destination_id,"/projects/".concat(e,"/destinations/").concat(encodeURIComponent(l),"?secao=deliveries"))}})}function Z(e){let{projectId:t,projectSlug:n,audienceId:i,eventSubscriptions:r}=e,{t:d}=(0,o.$G)(),{groups:c}=(0,l.wA)(t),u=(0,g.useMemo)(()=>E(n,i,r,c),[n,i,r,c]),m="/projects/".concat(n,"/pipelines/new?origin=AUDIENCE&source=").concat(encodeURIComponent(i));return(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsxs)("div",{className:"flex items-start justify-between gap-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("h3",{className:"text-sm font-semibold text-foreground",children:d("audiencias.detail.envios.title")}),(0,a.jsx)("p",{className:"mt-0.5 text-xs text-muted-foreground",children:d("audiencias.detail.envios.hint")})]}),(0,a.jsx)(s.z,{asChild:!0,size:"sm",className:"h-8 shrink-0 gap-1 text-xs",children:(0,a.jsxs)(D.default,{href:m,children:[(0,a.jsx)(U.Z,{className:"h-3 w-3"})," ",d("audiencias.detail.envios.create")]})})]}),0===u.length?(0,a.jsx)(b.I0,{titulo:d("audiencias.detail.envios.title"),descricao:d("audiencias.detail.envios.empty"),acoes:(0,a.jsx)(s.z,{asChild:!0,size:"sm",variant:"outline",className:"h-7 gap-1 text-xs",children:(0,a.jsxs)(D.default,{href:m,children:[(0,a.jsx)(U.Z,{className:"h-3 w-3"})," ",d("audiencias.detail.envios.create")]})})}):(0,a.jsx)("div",{className:"divide-y divide-border rounded-lg border border-border",children:u.map(e=>{var t,n;return(0,a.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-3 px-4 py-3",children:[(0,a.jsxs)("div",{className:"flex min-w-0 items-center gap-2.5",children:[(0,a.jsx)("div",{className:"rounded-md bg-muted p-1.5",children:(0,a.jsx)(I.s,{id:e.destinationType,className:"h-4 w-4"})}),(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsx)("div",{className:"truncate text-sm font-medium text-foreground",children:null!==(t=e.envioName)&&void 0!==t?t:e.destinationName}),(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-1.5 text-xs text-muted-foreground",children:[e.envioName&&(0,a.jsx)("span",{className:"truncate",children:e.destinationName}),e.envioName&&(0,a.jsx)("span",{children:"\xb7"}),(0,a.jsx)("span",{children:"audience.entered"===(n=e.signalType)?d("audiencias.detail.destinations.entered"):"audience.exited"===n?d("audiencias.detail.destinations.exited"):n}),e.destEvent&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(z.Z,{className:"h-3 w-3"}),(0,a.jsx)("span",{className:"font-mono",children:e.destEvent})]})]}),!e.envioId&&(0,a.jsx)("div",{className:"text-[11px] text-muted-foreground",children:d("audiencias.detail.envios.legacyHint")})]}),(0,a.jsx)(S.O,{tone:e.enabled?"success":"neutral",children:e.enabled?d("audiencias.detail.destinations.enabled"):d("audiencias.detail.destinations.disabled")})]}),(0,a.jsx)(s.z,{asChild:!0,variant:"outline",size:"sm",className:"h-8 gap-1 text-xs",children:(0,a.jsxs)(D.default,{href:e.href,children:[(0,a.jsx)(T.Z,{className:"h-3 w-3"}),e.envioId?d("audiencias.detail.envios.openEnvio"):d("audiencias.detail.envios.openDestination")]})})]},e.subscriptionId)})})]})}var P=n(13859),M=n(14447);function A(e,t){console.log("[Segments API] ".concat(e),t)}let L=()=>(0,M.SV)()+"/api";async function O(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{method:n="GET",body:a,headers:s}=t,i=e.startsWith("http")?e:"".concat(L()).concat(e),r=await fetch(i,{method:n,headers:{"Content-Type":"application/json",...s},body:void 0!==a?JSON.stringify(a):void 0,credentials:"include"});if(!r.ok){let e=await r.json().catch(()=>({}));throw Error(e.message||e.detail||"Segments API: ".concat(r.status," ").concat(r.statusText))}if(204===r.status||202===r.status)return;let o=await r.text();if(o&&""!==o.trim())return JSON.parse(o)}let q={listSegments(e,t){let n=new URLSearchParams;(null==t?void 0:t.status)&&n.set("status",t.status),(null==t?void 0:t.page)!=null&&n.set("page",String(t.page)),(null==t?void 0:t.page_size)!=null&&n.set("page_size",String(t.page_size));let a=n.toString();return O("/projects/".concat(encodeURIComponent(e),"/segments/").concat(a?"?".concat(a):""))},async createSegment(e,t){A("POST createSegment — payload",{projectId:e,payload:t});let n=await O("/projects/".concat(encodeURIComponent(e),"/segments/"),{method:"POST",body:t});return A("POST createSegment — response",n),n},async getSegment(e,t){let n=await O("/projects/".concat(encodeURIComponent(e),"/segments/").concat(encodeURIComponent(t),"/"));if(!n.draft_revision&&Array.isArray(n.revisions)){let e=n.revisions.filter(e=>"draft"===e.state),t=null==e?void 0:e.sort((e,t)=>
1t.version-e.version)[0];t&&(n.draft_revision=t)}if(!n.published_revision&&Array.isArray(n.revisions)){let e=n.revisions.find(e=>e.id===n.published_revision_id||"published"===e.state);e&&(n.published_revision=e)}return n},updateSegment:(e,t,n)=>O("/projects/".concat(encodeURIComponent(e),"/segments/").concat(encodeURIComponent(t),"/"),{method:"PATCH",body:n}),deleteSegment:(e,t)=>O("/projects/".concat(encodeURIComponent(e),"/segments/").concat(encodeURIComponent(t),"/"),{method:"DELETE"}),async createRevision(e,t,n){let a=null!=n?n:{};A("POST createRevision — payload",{projectId:e,segmentId:t,payload:a});let s=await O("/projects/".concat(encodeURIComponent(e),"/segments/").concat(encodeURIComponent(t),"/revisions/"),{method:"POST",body:a});return A("POST createRevision — response",s),s},async updateRevision(e,t,n,a){A("PATCH updateRevision — payload",{projectId:e,segmentId:t,revisionId:n,payload:a});let s=await O("/projects/".concat(encodeURIComponent(e),"/segments/").concat(encodeURIComponent(t),"/revisions/").concat(encodeURIComponent(n),"/"),{method:"PATCH",body:a});return A("PATCH updateRevision — response",s),s},async publishRevision(e,t,n,a){let s=null!=a?a:{};A("POST publishRevision — payload",{projectId:e,segmentId:t,revisionId:n,payload:s});let i=await O("/projects/".concat(encodeURIComponent(e),"/segments/").concat(encodeURIComponent(t),"/revisions/").concat(encodeURIComponent(n),"/publish/"),{method:"POST",body:s});return A("POST publishRevision — response",i),i},async getSegmentMembers(e,t,n){let a=new URLSearchParams;(null==n?void 0:n.active)!=null&&a.set("active",n.active),(null==n?void 0:n.lead_id)!=null&&a.set("lead_id",n.lead_id),(null==n?void 0:n.page)!=null&&a.set("page",String(n.page)),(null==n?void 0:n.page_size)!=null&&a.set("page_size",String(n.page_size)),(null==n?void 0:n.updated_after)!=null&&a.set("updated_after",n.updated_after);let s=a.toString(),i=await O("/projects/".concat(encodeURIComponent(e),"/segments/").concat(encodeURIComponent(t),"/members/").concat(s?"?".concat(s):""));return Array.isArray(i)?{data:i}:i},getSegmentMembersStats:(e,t)=>O("/projects/".concat(encodeURIComponent(e),"/segments/").concat(encodeURIComponent(t),"/members/stats/")),getSegmentBuilds(e,t,n){let a=new URLSearchParams;(null==n?void 0:n.page)!=null&&a.set("page",String(n.page)),(null==n?void 0:n.page_size)!=null&&a.set("page_size",String(n.page_size)),(null==n?void 0:n.status)!=null&&a.set("status",n.status);let s=a.toString();return O("/projects/".concat(encodeURIComponent(e),"/segments/").concat(encodeURIComponent(t),"/build-runs/").concat(s?"?".concat(s):""))},getBuildRunDetail:(e,t,n)=>O("/projects/".concat(encodeURIComponent(e),"/segments/").concat(encodeURIComponent(t),"/build-runs/").concat(encodeURIComponent(n),"/")),async getBuildRunPartitions(e,t,n){let a=await O("/projects/".concat(encodeURIComponent(e),"/segments/").concat(encodeURIComponent(t),"/build-runs/").concat(encodeURIComponent(n),"/partitions/"));return Array.isArray(a)?{data:a}:a},retryBuildRunPartition:(e,t,n,a)=>O("/projects/".concat(encodeURIComponent(e),"/segments/").concat(encodeURIComponent(t),"/build-runs/").concat(encodeURIComponent(n),"/partitions/").concat(encodeURIComponent(a),"/retry/"),{method:"POST"}),retryBuildRun:(e,t,n)=>O("/projects/".concat(encodeURIComponent(e),"/segments/").concat(encodeURIComponent(t),"/build-runs/").concat(encodeURIComponent(n),"/retry/"),{method:"POST"}),cancelBuildRun:(e,t,n)=>O("/projects/".concat(encodeURIComponent(e),"/segments/").concat(encodeURIComponent(t),"/build-runs/").concat(encodeURIComponent(n),"/cancel/"),{method:"POST"}),getBuildRunMembers(e,t,n,a){let s=new URLSearchParams;(null==a?void 0:a.page)!=null&&s.set("page",String(a.page)),(null==a?void 0:a.page_size)!=null&&s.set("page_size",String(a.page_size));let i=s.toString();return O("/projects/".concat(encodeURIComponent(e),"/segments/").concat(encodeURIComponent(t),"/build-runs/").concat(encodeURIComponent(n),"/members/").concat(i?"?".concat(i):""))},async getSegmentOutbox(e,t,n){let a=new URLSearchParams;(null==n?void 0:n.build_run_id)!=null&&a.set("build_run_id",n.build_run_id),(null==n?void 0:n.event_type)!=null&&a.set("event_type",n.event_type),(null==n?void 0:n.include_payload)!=null&&a.set("include_payload",String(n.include_payload)),(null==n?void 0:n.lead_id)!=null&&a.set("lead_id",n.lead_id),(null==n?void 0:n.occurred_from)!=null&&a.set("occurred_from",n.occurred_from),(null==n?void 0:n.occurred_to)!=null&&a.set("occurred_to",n.occurred_to),(null==n?void 0:n.page)!=null&&a.set("page",String(n.page)),(null==n?void 0:n.page_size)!=null&&a.set("page_size",String(n.page_size)),(null==n?void 0:n.status)!=null&&a.set("status",n.status);let s=a.toString(),i=await O("/projects/".concat(encodeURIComponent(e),"/segments/").concat(encodeURIComponent(t),"/outbox/").concat(s?"?".concat(s):""));return Array.isArray(i)?{data:i}:i}
1,retryOutboxEvent:(e,t,n)=>O("/projects/".concat(encodeURIComponent(e),"/segments/").concat(encodeURIComponent(t),"/outbox/").concat(encodeURIComponent(n),"/retry/"),{method:"POST"}),markOutboxSent:(e,t,n)=>O("/projects/".concat(encodeURIComponent(e),"/segments/").concat(encodeURIComponent(t),"/outbox/").concat(encodeURIComponent(n),"/mark-sent/"),{method:"POST"}),getDestinationsConfig:(e,t)=>O("/projects/".concat(encodeURIComponent(e),"/segments/").concat(encodeURIComponent(t),"/destinations/")),getDestinationConfig:(e,t,n)=>O("/projects/".concat(encodeURIComponent(e),"/segments/").concat(encodeURIComponent(t),"/destinations/").concat(encodeURIComponent(n),"/")),updateDestinationConfig:(e,t,n,a)=>O("/projects/".concat(encodeURIComponent(e),"/segments/").concat(encodeURIComponent(t),"/destinations/").concat(encodeURIComponent(n),"/"),{method:"PATCH",body:a}),membersCsvUrl:(e,t)=>"".concat(L(),"/projects/").concat(encodeURIComponent(e),"/segments/").concat(encodeURIComponent(t),"/members/export/"),membersMetaCsvUrl(e,t){return"".concat(this.membersCsvUrl(e,t),"?formato=meta")},async exportMembersCsv(e,t){var n,a;let s="".concat(L(),"/projects/").concat(encodeURIComponent(e),"/segments/").concat(encodeURIComponent(t),"/members/export/"),i=await fetch(s,{method:"GET",credentials:"include"});if(!i.ok)throw Error("Erro ao exportar leads do segmento");let r=await i.blob(),o=(null!==(n=i.headers.get("Content-Disposition"))&&void 0!==n?n:"").match(/filename="?([^"]+)"?/);return{blob:r,filename:null!==(a=null==o?void 0:o[1])&&void 0!==a?a:"segment_".concat(t,"_leads.csv")}},getRecheckAudit(e,t,n){let a=new URLSearchParams;(null==n?void 0:n.lead_id)&&a.set("lead_id",n.lead_id),(null==n?void 0:n.membership_changed)!=null&&a.set("membership_changed",n.membership_changed),(null==n?void 0:n.page)!=null&&a.set("page",String(n.page)),(null==n?void 0:n.page_size)!=null&&a.set("page_size",String(n.page_size));let s=a.toString();return O("/projects/".concat(encodeURIComponent(e),"/segments/").concat(encodeURIComponent(t),"/recheck-audit/").concat(s?"?".concat(s):""))},getCronAudit(e,t,n){let a=new URLSearchParams;(null==n?void 0:n.cron_type)&&a.set("cron_type",n.cron_type),(null==n?void 0:n.decision)&&a.set("decision",n.decision),(null==n?void 0:n.page)!=null&&a.set("page",String(n.page)),(null==n?void 0:n.page_size)!=null&&a.set("page_size",String(n.page_size));let s=a.toString();return O("/projects/".concat(encodeURIComponent(e),"/segments/").concat(encodeURIComponent(t),"/cron-audit/").concat(s?"?".concat(s):""))}};var B=n(71632);n(14438);let K=(e,t)=>["segments",e,t,"builds"],$=(e,t)=>["segments",e,t,"outbox"],F=(e,t)=>["segments",e,t,"members"];async function G(e,t){try{return await q.getSegmentBuilds(e,t)}catch(e){return{data:[]}}}async function H(e,t,n){try{return await q.getSegmentOutbox(e,t,n)}catch(e){return{data:[]}}}async function V(e,t,n){try{return await q.getSegmentMembers(e,t,n)}catch(e){return{data:[]}}}var W=n(56514),Y=n(36594);let J={published:"success",draft:"warning",deprecated:"neutral"};function X(e){var t,n,s,r,d;let{projectId:l,detail:c}=e,{t:u}=(0,o.$G)(),m=(0,o.bU)(),p=(0,W.NU)(),x=(d=c.segment.id,(0,B.a)({queryKey:K(l,null!=d?d:""),queryFn:()=>l&&d?G(l,d):Promise.resolve({data:[]}),enabled:!!l&&!!d})),f=e=>e?(0,W.wi)(e,p,m):"—";return(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsx)(b.$W,{titulo:u("audiencias.detail.history.revisions"),semPreenchimento:!0,children:0===c.revisions.length?(0,a.jsx)("p",{className:"px-4 py-4 text-sm text-muted-foreground",children:u("audiencias.detail.rules.noRevisions")}):(0,a.jsx)("ul",{className:"divide-y divide-border",children:c.revisions.map(e=>{var t,n;return(0,a.jsxs)("li",{className:"flex items-center justify-between gap-3 px-4 py-2 text-xs",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"font-mono text-foreground",children:u("audiencias.detail.rules.revision",{version:e.version})}),(0,a.jsx)(S.O,{tone:null!==(t=J[e.state])&&void 0!==t?t:"neutral",children:"published"===e.state?u("audiencias.detail.rules.published"):"draft"===e.state?u("audiencias.detail.rules.draft"):"deprecated"===e.state?u("audiencias.detail.rules.deprecated"):e.state})]}),(0,a.jsx)("span",{className:"text-muted-foreground",children:f(null!==(n=e.published_at)&&void 0!==n?n:e.created_at)})]},e.id)})})}),(0,a.jsx)(b.$W,{titulo:u("audiencias.detail.history.builds"),semPreenchimento:!0,children:x.isLoading?(0,a.jsx)("div",{className:"p-4",children:(0,a.jsx)(i.O,{className:"h-16 w-full"})}):0===(null!==(s=null===(t=x.data)||void 0===t?void 0:t.data)&&void 0!==s?s:[]).length?(0,a.jsx)("p",{className:"px-4 py-4 text-sm text-muted-foreground",children:u("audiencias.detail.history.buildsEmpty")}):(0,a.jsxs)("table",{className:"w-full text-xs",children:[(0,a.jsx)("thead",{children:(0,a.jsxs)("tr",{className:"border-b border-border text-left text-[11px] uppercase tracking-wider text-muted-foreground",children:[(0,a.jsx)("th",{className:"px-4 py-2 font-medium",children:u("audiencias.detail.history.colMode")}),(0,a.jsx)("th",{className:"px-2 py-2 font-medium",children:u("audiencias.detail.history.colStatus")}),(0,a.jsx)("th",{className:"px-2 py-2 font-medium",children:u("audiencias.detail.history.colRequested")}),(0,a.jsx)("th",{className:"px-4 py-2 font-medium",children:u("audiencias.detail.history.colFinished")})]})}),(0,a.jsx)("tbody",{children:(null!==(r=null===(n=x.data)||void 0===n?void 0:n.data)&&void 0!==r?r:[]).map(e=>{var t,n;return(0,a.jsxs)("tr",{className:"border-b border-border last:border-0",children:[(0,a.jsx)("td",{className:"px-4 py-2 font-mono text-foreground",children:null!==(t=e.mode)&&void 0!==t?t:"—"}),(0,a.jsx)("td",{className:"px-2 py-2",children:(0,a.jsx)(S.O,{tone:(0,Y.Cw)(e.status),className:"text-[10px]",children:e.status})}),(0,a.jsx)("td",{className:"px-2 py-2 text-muted-foreground",children:f(null!==(n=e.requested_at)&&void 0!==n?n:e.started_at)}),(0,a.jsx)("td",{className:"px-4 py-2 text-muted-foreground",children:f(e.finished_at)})]},e.id)})})]})})]})}var Q=n(39612),ee=n(28490),et=n(19700),en=n(29525),ea=n(64591),es=n(64372),ei=n(13389),er=n(6311),eo=n(42978);function ed(e){let{projectId:t,projectSlug:n,audienceId:i,listDestinations:r}=e,{t:d}=(0,o.$G)(),l=(0,o.bU)(),u=(0,ei.uC)(t,i),m=(0,ei.ay)(t,i),f=(0,ei.cd)(t,i),h=(0,ei.dC)(t,i),[v,j]=(0,g.useState)(null),[y,N]=(0,g.useState)(!1);return(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsxs)("div",{className:"flex items-start justify-between gap-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("h3",{className:"text-sm font-semibold text-foreground",children:d("audiencias.detail.lists.title")}),(0,a.jsx)("p",{className:"mt-0.5 text-xs text-muted-foreground",children:d("audiencias.detail.lists.hint")})]}),(0,a.jsxs)(s.z,{size:"sm",variant:"outline",className:"h-8 shrink-0 gap-1 text-xs",onClick:()=>N(!0),children:[(0,a.jsx)(U.Z,{className:"h-3 w-3"})," ",d("audiencias.detail.lists.link")]})]}),0===r.length?(0,a.jsx)(b.I0,{titulo:d("audiencias.detail.lists.title"),descricao:d("audiencias.detail.lists.empty"),acoes:(0,a.jsxs)(s.z,{size:"sm",variant:"outline",className:"h-7 gap-1 text-xs",onClick:()=>N(!0),children:[(0,a.jsx)(U.Z,{className:"h-3 w-3"})," ",d("audiencias.detail.lists.link")]})}):r.map(e=>{var t,i,r,o,h;let v=(0,et.WV)(e.destination.type),g=u.isPending&&u.variables===e.destination_id||m.isPending&&m.variables===e.destination_id||f.isPending&&(null===(t=f.variables)||void 0===t?void 0:t.destinationId)===e.destination_id,y=(0,Y.Mi)(e.destination.ad_account_id),N=(0,Y.eH)(e.remote_count_lower,e.remote_count_upper,l),w=null!==(i=e.last_run)&&void 0!==i?i:null;return(0,a.jsx)(b.$W,{titulo:(0,a.jsxs)("span",{className:"flex min-w-0 items-center gap-2",children:[(0,a.jsx)(I.s,{id:e.destination.type,className:"h-4 w-4"}),(0,a.jsx)(D.default,{href:"/projects/".concat(n,"/destinations/").concat(e.destination_id),className:"truncate hover:underline",children:e.destination.name}),(0,a.jsx)("span",{className:"font-mono text-[10px] font-normal text-muted-foreground",children:null!==(r=null==v?void 0:v.label)&&void 0!==r?r:e.destination.type}),(0,a.jsx)(S.O,{tone:e.enabled?"success":"neutral",className:"text-[10px]",children:e.enabled?d("audiencias.detail.destinations.enabled"):d("audiencias.detail.destinations.disabled")})]}),acoes:(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-1",children:[(0,a.jsxs)(s.z,{variant:"outline",size:"sm",className:"h-7 gap-1 text-[11px]",disabled:g,onClick:()=>u.mutate(e.destination_id),children:[g?(0,a.jsx)(c.Z,{className:"h-3 w-3 animate-spin"}):(0,a.jsx)(p.Z,{className:"h-3 w-3"}),d("audiencias.detail.destinations.syncNow")]}),(0,a.jsxs)(s.z,{variant:"outline",size:"sm",className:"h-7 gap-1 text-[11px]",disabled:g,onClick:()=>m.mutate(e.destination_id),children:[(0,a.jsx)(en.Z,{className:"h-3 w-3"})," ",d("audiencias.detail.destinations.repair")]}),(0,a.jsx)(s.z,{variant:"outline",size:"sm",className:"h-7 gap-1 text-[11px]",disabled:g,onClick:()=>f.mutate({destinationId:e.destination_id,enabled:!e.enabled}),children:e.enabled?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(ea.Z,{className:"h-3 w-3"})," ",d("audiencias.detail.destinations.pause")]}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(es.Z,{className:"h-3 w-3"})," ",d("audiencias.detail.destinations.resume")]})}),(0,a.jsxs)(s.z,{variant:"outline",size:"sm",className:"h-7 gap-1 text-[11px] text-muted-foreground hover:border-destructive/50 hover:text-destructive",disabled:g,onClick:()=>j(e),children:[(0,a.jsx)(x.Z,{className:"h-3 w-3"})," ",d("audiencias.detail.destinations.remove")]})]}),children:(0,a.jsxs)("dl",{className:"grid grid-cols-1 gap-x-6 gap-y-2 text-xs md:grid-cols-2",children:[(0,a.jsxs)(ec,{rotulo:d("audiencias.detail.lists.remoteAudience"),children:[(0,a.jsxs)("span",{className:"inline-flex flex-wrap items-center gap-1.5",children:[(0,a.jsx)("span",{children:null!==(h=null!==(o=e.remote_audience_name)&&void 0!==o?o:e.remote_audience_id)&&void 0!==h?h:"—"}),y&&(0,a.jsxs)("a",{href:y,target:"_blank",rel:"noreferrer",className:"inline-flex items-center gap-0.5 text-muted-foreground hover:text-foreground hover:underline",children:[d("audiencias.detail.lists.openInAdsManager")," ",(0,a.jsx)(T.Z,{className:"h-3 w-3"})]})]}),(0,a.jsx)("div",{className:"text-muted-foreground",children:"—"===N?d("audiencias.detail.lists.recognizedUnknown"):d("audiencias.detail.lists.recognized",{range:N})})]}),(0,a.jsx)(ec,{rotulo:d("audiencias.detail.lists.mode"),children:"mirror"===e.sync_mode?d("audiencias.detail.lists.mirror"):d("audiencias.detail.lists.addOnly")}),(0,a.jsx)(ec,{rotulo:d("audiencias.detail.lists.lastSync"),className:"md:col-span-2",children:(0,a.jsxs)("span",{className:"inline-flex flex-wrap items-center gap-1.5",children:[w&&(0,a.jsx)(S.O,{tone:(0,Y.Cw)(w.status),className:"text-[10px]",children:(0,er.p6)(w.kind,d)}),(0,a.jsx)("span",{children:(0,er.Y8)(w,{t:d,locale:l})})]})}),(e.blocked_reason||e.last_error||!e.enabled)&&(0,a.jsxs)(ec,{rotulo:d("audiencias.detail.lists.state"),className:"md:col-span-2",children:[!e.enabled&&(0,a.jsx)("div",{className:"text-muted-foreground",children:d("audiencias.detail.lists.paused")}),e.blocked_reason&&(0,a.jsx)("div",{className:"text-amber-700 dark:text-amber-400",children:d("audiencias.detail.lists.blocked",{reason:e.blocked_reason})}),e.last_error&&(0,a.jsx)("div",{className:"break-words text-destructive",children:d("audiencias.detail.lists.error",{error:e.last_error})})]})]})},e.destination_id)}
1),(0,a.jsx)(el,{open:y,onOpenChange:N,projectId:t,audienceId:i,jaLigadas:r.map(e=>e.destination_id)}),(0,a.jsx)(Q.aR,{open:!!v,onOpenChange:e=>!e&&!h.isPending&&j(null),children:(0,a.jsxs)(Q._T,{children:[(0,a.jsxs)(Q.fY,{children:[(0,a.jsx)(Q.f$,{children:d("audiencias.detail.destinations.removeTitle")}),(0,a.jsxs)(Q.yT,{children:[null==v?void 0:v.destination.name," — ",d("audiencias.detail.destinations.removeDescription")]})]}),(0,a.jsxs)(Q.xo,{children:[(0,a.jsx)(Q.le,{disabled:h.isPending,children:d("common.cancel")}),(0,a.jsxs)(Q.OL,{disabled:h.isPending,onClick:e=>{e.preventDefault(),v&&h.mutate(v.destination_id,{onSuccess:()=>j(null)})},children:[h.isPending?(0,a.jsx)(c.Z,{className:"mr-2 h-4 w-4 animate-spin"}):null,d("audiencias.detail.destinations.remove")]})]})]})})]})}function el(e){let{open:t,onOpenChange:n,projectId:i,audienceId:r,jaLigadas:d}=e,{t:l}=(0,o.$G)(),{deLista:u,isLoading:m}=(0,eo.S)(i),p=(0,ei.Jx)(i,r),[x,f]=(0,g.useState)([]),h=u.filter(e=>!d.includes(e.id)),v=async()=>{for(let e of x)await p.mutateAsync({destination_id:e.destination_id,sync_mode:e.sync_mode});f([]),n(!1)};return(0,a.jsx)(ee.Vq,{open:t,onOpenChange:e=>{p.isPending||(n(e),e||f([]))},children:(0,a.jsxs)(ee.cZ,{className:"max-w-lg",children:[(0,a.jsxs)(ee.fK,{children:[(0,a.jsx)(ee.$N,{children:l("audiencias.detail.lists.linkTitle")}),(0,a.jsx)(ee.Be,{children:l("audiencias.detail.lists.linkDescription")})]}),m?(0,a.jsx)("p",{className:"text-xs text-muted-foreground",children:l("audiencias.destinos.loading")}):0===h.length?(0,a.jsx)("p",{className:"rounded border border-dashed border-border p-4 text-center text-xs text-muted-foreground",children:l("audiencias.detail.lists.linkNoOptions")}):(0,a.jsx)(eo.lY,{destinos:h,value:x,onChange:f}),(0,a.jsxs)(ee.cN,{children:[(0,a.jsx)(s.z,{variant:"outline",size:"sm",disabled:p.isPending,onClick:()=>n(!1),children:l("common.cancel")}),(0,a.jsxs)(s.z,{size:"sm",disabled:0===x.length||p.isPending,onClick:v,children:[p.isPending&&(0,a.jsx)(c.Z,{className:"mr-1.5 h-3 w-3 animate-spin"}),l("audiencias.detail.lists.linkConfirm")]})]})]})})}function ec(e){let{rotulo:t,children:n,className:s}=e;return(0,a.jsxs)("div",{className:s,children:[(0,a.jsx)("dt",{className:"text-[11px] uppercase tracking-wider text-muted-foreground",children:t}),(0,a.jsx)("dd",{className:"mt-0.5 text-foreground",children:n})]})}var eu=n(55774),em=n(84390),ep=n(40875),ex=n(10407);function ef(e){var t,n,s;let{projectId:r,audienceId:d,audienceName:l,progresso:c=null}=e,{t:u}=(0,o.$G)(),m=(0,o.bU)(),p=(0,W.NU)(),[x,f]=(0,g.useState)(1),[h,v]=(0,g.useState)(null),{data:b,isLoading:j,isError:N}=(s={page:x,page_size:25},(0,B.a)({queryKey:[...F(r,null!=d?d:""),s],queryFn:()=>r&&d?V(r,d,s):Promise.resolve({data:[]}),enabled:!!r&&!!d})),w=q.membersCsvUrl(r,d),_=q.membersMetaCsvUrl(r,d),k=null!==(t=null==b?void 0:b.data)&&void 0!==t?t:[],R=Math.max(1,Math.ceil((null!==(n=null==b?void 0:b.total)&&void 0!==n?n:k.length)/25)),I=[{label:"",className:"w-8"},{label:u("audiencias.detail.members.colLead")},{label:u("audiencias.detail.members.colStatus"),className:"w-28"},{label:u("audiencias.detail.members.colFirstSeen"),className:"w-44"},{label:u("audiencias.detail.members.colLastSeen"),className:"w-44"}];return j?(0,a.jsx)(i.O,{className:"h-48 w-full rounded-lg"}):(0,a.jsxs)("div",{className:"space-y-3",children:[(0,a.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[(0,a.jsxs)("p",{className:"text-xs text-muted-foreground",children:[u("audiencias.detail.members.exportHint")," ",(0,a.jsx)("span",{className:"text-muted-foreground/80",children:u("audiencias.detail.members.exportMetaHint")})]}),(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,a.jsx)(eu.Y,{url:_,label:u("audiencias.detail.members.exportMeta"),size:"xs",className:"h-7 text-[11px]",disabled:0===k.length}),(0,a.jsx)(eu.Y,{url:w,label:u("audiencias.detail.members.exportCsv"),exportLabel:u("audiencias.detail.members.exportTaskLabel",{name:l}),size:"xs",className:"h-7 text-[11px]",disabled:0===k.length})]})]}),(0,a.jsxs)(em.eP,{columns:I,children:[0===k.length&&(0,a.jsx)("tr",{children:(0,a.jsx)("td",{colSpan:I.length,className:(0,y.cn)("h-24 text-center text-sm",N?"text-destructive":"text-muted-foreground"),children:N?u("audiencias.detail.members.error"):c?(0,a.jsx)(C,{progresso:c}):u("audiencias.detail.members.empty")})}),k.map(e=>{let t=h===e.lead_id;return(0,a.jsxs)(g.Fragment,{children:[(0,a.jsxs)("tr",{className:(0,y.cn)("h-10 cursor-pointer border-b border-border hover:bg-muted/40",t&&"bg-muted/30"),onClick:()=>v(t?null:e.lead_id),children:[(0,a.jsx)("td",{className:"pl-4 text-muted-foreground",children:t?(0,a.jsx)(ep.Z,{className:"h-3.5 w-3.5"}):(0,a.jsx)(ex.Z,{className:"h-3.5 w-3.5"})}),(0,a.jsxs)("td",{className:"py-2 pr-4 text-sm",children:[(0,a.jsx)("div",{className:"truncate text-foreground",children:e.lead_name||e.lead_email||e.lead_phone||e.lead_id}),e.lead_email&&e.lead_name&&(0,a.jsx)("div",{className:"truncate text-xs text-muted-foreground",children:e.lead_email})]}),(0,a.jsx)("td",{className:"py-2",children:(0,a.jsx)(S.O,{tone:e.is_member?"success":"neutral",children:e.is_member?u("audiencias.detail.members.active"):u("audiencias.detail.members.inactive")})}),(0,a.jsx)("td",{className:"py-2 text-xs text-muted-foreground",children:(0,W.wi)(e.first_seen_at,p,m)}),(0,a.jsx)("td",{className:"py-2 text-xs text-muted-foreground",children:(0,W.wi)(e.last_seen_at,p,m)})]}),t&&(0,a.jsx)("tr",{className:"border-b border-border bg-muted/20",children:(0,a.jsx)("td",{colSpan:I.length,className:"px-6 py-3",children:(0,a.jsx)(eh,{projectId:r,audienceId:d,leadId:e.lead_id})})})]},e.lead_id)})]}),R>1&&(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsx)("span",{className:"text-xs text-muted-foreground",children:u("audiencias.detail.members.pageOf",{page:x,total:R})}),(0,a.jsx)(em.dl,{page:x,onPageChange:f,hasPrev:x>1,hasNext:x<R})]})]})}function eh(e){var t,n;let{projectId:s,audienceId:i,leadId:r}=e,{t:d}=(0,o.$G)(),l=(0,o.bU)(),c=(0,W.NU)(),{data:u,isLoading:m}=(n={lead_id:r,include_payload:!0,page_size:20},(0,B.a)({queryKey:[...$(s,null!=i?i:""),n],queryFn:()=>s&&i?H(s,i,n):Promise.resolve({data:[]}),enabled:!!s&&!!i})),p=null!==(t=null==u?void 0:u.data)&&void 0!==t?t:[];return(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsx)("div",{className:"text-[11px] font-medium uppercase tracking-wider text-muted-foreground",children:d("audiencias.detail.members.whyTitle")}),m?(0,a.jsx)("div",{className:"text-xs text-muted-foreground",children:d("audiencias.detail.members.whyLoading")}):0===p.length?(0,a.jsx)("div",{className:"text-xs text-muted-foreground",children:d("audiencias.detail.members.whyEmpty")}):(0,a.jsx)("ul",{className:"space-y-1",children:p.map(e=>{let t=e.event_type.endsWith("entered"),n=function(e){if(!e.payload)return null;try{let t=JSON.parse(e.payload);return"string"==typeof t.reason?t.reason:null}catch(e){return null}}(e);return(0,a.jsxs)("li",{className:"flex flex-wrap items-center gap-2 text-xs",children:[(0,a.jsx)(S.O,{tone:t?"success":"neutral",children:e.event_type}),(0,a.jsx)("span",{className:"text-muted-foreground",children:(0,W.wi)(e.occurred_at,c,l)}),n&&(0,a.jsxs)("span",{className:"font-mono text-foreground",children:[d("audiencias.detail.members.whyReason"),": ",n]}),(0,a.jsxs)("span",{className:"text-muted-foreground",children:["\xb7 ",e.status]})]},e.id)})})]})}var ev=n(52542),eg=n(68440);n(36190);var eb=n(45554),ej=n(92369),ey=n(28124),eN=n(95468),ew=n(46211),e_=n(61788),ek=n(14163),eC=n(6023),eR=n(67900),eI=n(26793),eS=n(78859),eU=n(82801),ez=n(31683);let eT="hsl(var(--muted-foreground) / 0.45)",eD=(e,t)=>e*(t?400:280),eE={minutos:"audiencias.jornada.minutos",horas:"audiencias.jornada.horas"},eZ={card:function(e){let{data:t}=e,n="barreira"===t.tom;return(0,a.jsxs)("div",{style:{width:230},className:(0,y.cn)("cursor-pointer rounded-lg border bg-card text-card-foreground shadow-sm transition-colors",t.dimmed?"border-dashed opacity-60":n?"border-destructive/40 hover:border-destructive/70":"hover:border-primary/40"),children:[t.hasIn&&(0,a.jsx)(ev.HH,{type:"target",position:eg.Ly.Left,className:"!h-2 !w-2 !border-border !bg-muted-foreground
1/40"}),(0,a.jsxs)("div",{className:(0,y.cn)("flex w-full items-center gap-2 border-b px-3 py-2 text-left",n&&"bg-destructive/5"),children:[(0,a.jsx)("span",{className:"flex h-5 w-5 shrink-0 items-center justify-center",children:t.icon}),(0,a.jsx)("span",{className:"min-w-0 flex-1 truncate text-xs font-semibold text-foreground",children:t.title}),t.badge&&(0,a.jsx)("span",{className:(0,y.cn)("shrink-0 rounded-full px-1.5 py-0.5 text-[10px] font-medium",n?"bg-destructive/10 text-destructive":"bg-muted text-muted-foreground"),children:t.badge}),(0,a.jsx)(ep.Z,{className:(0,y.cn)("h-3.5 w-3.5 shrink-0 text-muted-foreground transition-transform",t.expanded&&"rotate-180")})]}),t.expanded?(0,a.jsxs)("div",{className:"px-3 py-2",children:[t.sections.map((e,t)=>(0,a.jsxs)("div",{className:(0,y.cn)(t>0&&"mt-2 border-t pt-2"),children:[e.heading&&(0,a.jsx)("div",{className:"mb-1 font-mono text-[9px] uppercase tracking-wide text-muted-foreground/70",children:e.heading}),(0,a.jsxs)("div",{className:"flex flex-col gap-1",children:[0===e.rows.length&&(0,a.jsx)("span",{className:"text-[11px] text-muted-foreground/60",children:"-"}),e.rows.map((e,t)=>(0,a.jsxs)("div",{className:"flex items-start justify-between gap-2",children:[(0,a.jsx)("span",{className:"shrink-0 text-[10px] text-muted-foreground",children:e.k}),(0,a.jsx)("span",{className:"min-w-0 break-words text-right font-mono text-[10px] text-foreground",children:e.v})]},t))]})]},t)),t.onEdit&&(0,a.jsxs)("button",{type:"button",onClick:e=>{var n;e.stopPropagation(),null===(n=t.onEdit)||void 0===n||n.call(t)},className:"nodrag mt-2 flex w-full items-center justify-center gap-1 rounded border py-1 text-[10px] font-medium text-muted-foreground hover:bg-muted hover:text-foreground",children:[(0,a.jsx)(m.Z,{className:"h-3 w-3"})," ",t.editLabel]})]}):(0,a.jsx)("div",{className:"px-3 py-2",children:(0,a.jsx)("span",{className:"block truncate font-mono text-[11px] text-muted-foreground",children:t.subtitle||"-"})}),t.hasOut&&(0,a.jsx)(ev.HH,{type:"source",position:eg.Ly.Right,className:"!h-2 !w-2 !border-border !bg-muted-foreground/40"})]})}};function eP(e,t){return t(eE[e.unidade])}function eM(e,t){return t("audiencias.jornada.esperaResumo",{valor:e.valor,unidade:eP(e,t)})}let eA=e=>"cond-".concat(e);function eL(e){let{rule:t,members:n,sources:s,saidas:i,eventosDoCatalogo:r,nomeDaConversao:d,onEdit:l}=e,{t:c}=(0,o.$G)(),[u,m]=(0,g.useState)(new Set),p=(0,g.useCallback)(e=>{m(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),x=c("audiencias.list.edit"),h=(0,g.useMemo)(()=>new Intl.NumberFormat,[]),v=(0,g.useCallback)(e=>h.format(e),[h]),b=(0,g.useCallback)(e=>{var t;return null===(t=s.find(t=>t.id===e))||void 0===t?void 0:t.origin},[s]),j=(0,g.useCallback)(e=>{var t,n;return null!==(n=null===(t=s.find(t=>t.id===e))||void 0===t?void 0:t.name)&&void 0!==n?n:e},[s]),{content:N,edges:w,jornada:_}=(0,g.useMemo)(()=>(function(e){let{rule:t,members:n,saidas:s,expanded:i,editLabel:r,t:o,formatarNumero:d,origemDaFonte:l,eventosDoCatalogo:c,nomeDaFonte:u,nomeDaConversao:m,onEdit:p}=e,x=(0,eS.E0)(t),f=[],h=[],v=t&&("and"===t.type||"or"===t.type)?t:null,g=v?v.children:t?[t]:[],b=(null==v?void 0:v.type)==="or"?"or":"and",j=(e,t)=>{let n="not"===e.type,s=n?e.child:e,i=n?o("audiencias.detail.flow.not"):void 0;if("event"===s.type){var r,d;let e=(0,eU.bU)(s,l,c),m=(0,eR.Gy)(e,s.event_type),p=(0,eR.GW)(e,s.event_type,o),x=(null!==(r=s.source_ids)&&void 0!==r?r:[]).map(u),f=(0,eI.f)(s),h=[{k:o("audiencias.detail.flow.event"),v:m?"".concat(p," (").concat(null!==(d=(0,eR.EK)(e))&&void 0!==d?d:"",")"):p},{k:o("audiencias.detail.flow.sources"),v:x.length?x.join(", "):o("audiencias.detail.flow.allSources")},{k:o("audiencias.detail.flow.window"),v:o("audiencias.detail.flow.windowDays",{days:s.window_days})}];null!=s.min_count&&h.push({k:o("audiencias.detail.flow.count"),v:o("audiencias.detail.flow.atLeast",{n:s.min_count})}),null!=s.max_count&&h.push({k:o("audiencias.detail.flow.count"),v:o("audiencias.detail.flow.atMost",{n:s.max_count})}),h.push({k:o("audiencias.detail.flow.conditions"),v:f>0?o("audiencias.detail.flow.conditionsCount",{count:f}):o("audiencias.detail.flow.noConditions")});let v=[n?o("audiencias.detail.flow.not"):null,p,f>0?o("audiencias.detail.flow.conditionsCount",{count:f}
1):null].filter(Boolean).join(" \xb7 ");return{title:"".concat(o("audiencias.detail.flow.condition")," ").concat(t+1),subtitle:v,badge:i,icon:(0,a.jsx)(ez.p,{origin:e,className:"h-4 w-4"}),sections:[{rows:h}]}}if("in_feature"===s.type){let e=(null==m?void 0:m(s.feature_id))||s.feature_id,n=[{k:o("audiencias.detail.flow.conversion"),v:e}];return s.window_days&&n.push({k:o("audiencias.detail.flow.window"),v:o("audiencias.detail.flow.windowDays",{days:s.window_days})}),{title:"".concat(o("audiencias.detail.flow.condition")," ").concat(t+1),subtitle:[i,e].filter(Boolean).join(" \xb7 "),badge:i,icon:(0,a.jsx)(eb.Z,{className:"h-4 w-4 text-primary"}),sections:[{rows:n}]}}if("in_profile"===s.type){let e=(0,eC.Uf)(s.profile_rule),n=[{k:o("audiencias.detail.flow.conditions"),v:e>0?o("audiencias.detail.flow.conditionsCount",{count:e}):o("audiencias.detail.flow.noConditions")}];return{title:"".concat(o("audiencias.detail.flow.condition")," ").concat(t+1),subtitle:[i,o("audiencias.detail.flow.profile")].filter(Boolean).join(" \xb7 "),badge:i,icon:(0,a.jsx)(ej.Z,{className:"h-4 w-4 text-primary"}),sections:[{rows:n}]}}if("and"===s.type||"or"===s.type){let e=s.children.map((e,t)=>({k:"".concat(t+1),v:e.type}));return{title:o("audiencias.detail.flow.group"),subtitle:"".concat("or"===s.type?o("audiencias.detail.flow.or"):o("audiencias.detail.flow.and")," \xb7 ").concat(s.children.length),badge:i,icon:(0,a.jsx)(ey.Z,{className:"h-4 w-4 text-muted-foreground"}),sections:[{rows:e}]}}let p="sequential"===s.type?o("audiencias.detail.flow.sequence"):s.type;return{title:"".concat(o("audiencias.detail.flow.condition")," ").concat(t+1),subtitle:o("audiencias.detail.flow.legacyNode",{type:p}),badge:i,icon:(0,a.jsx)(ey.Z,{className:"h-4 w-4 text-muted-foreground"}),sections:[{rows:[{k:o("audiencias.detail.flow.condition"),v:s.type}]}]}},y=(e,t,n)=>{f.push({id:e,col:t,data:{...n,expanded:i.has(e),onEdit:p,editLabel:r}})},N=(e,t,n,a)=>{var s,i;let r=null!==(s=null==a?void 0:a.carencia)&&void 0!==s?s:null;h.push({id:e,source:t,target:n,animated:null===(i=null==a?void 0:a.animated)||void 0===i||i,style:{stroke:(null==a?void 0:a.barreira)?"hsl(var(--destructive) / 0.55)":eT},...r?{label:o("audiencias.jornada.esperaNaAresta",{valor:r.valor,unidade:eP(r,o)}),labelShowBg:!0,labelStyle:{fill:"hsl(var(--foreground))",fontSize:10,fontWeight:500},labelBgStyle:{fill:"hsl(var(--background))",stroke:eT},labelBgPadding:[6,3],labelBgBorderRadius:4}:{}})},w=[],_=0;if(x.sequencial){let e=new Set(x.passos.map(e=>e.depoisDe).filter(e=>null!=e)),t=t=>null!=t.depoisDe||e.has(t.indiceNaRaiz),n=new Map(x.passos.map((e,t)=>[e.indiceNaRaiz,t+1])),s=e=>{var s;let i=j(g[e.indiceNaRaiz],e.indiceNaRaiz),r=n.get(e.indiceNaRaiz),d=t(e)&&null==e.depoisDe,l=null!=e.depoisDe?o("audiencias.jornada.depoisDoPasso",{n:null!==(s=n.get(e.depoisDe))&&void 0!==s?s:e.depoisDe+1}):d?o("audiencias.jornada.gatilho"):o("audiencias.jornada.aQualquerMomento"),c=[{k:o("audiencias.jornada.momento"),v:l}];e.carencia&&c.push({k:o("audiencias.jornada.espera"),v:eM(e.carencia,o)}),e.negado&&c.push({k:o("audiencias.jornada.naoFez"),v:o("audiencias.jornada.barrado")});let u=e.negado?o("audiencias.jornada.barrado"):d?o("audiencias.jornada.gatilho"):t(e)?void 0:o("audiencias.jornada.aQualquerMomento");return{...i,title:o("audiencias.jornada.passo",{n:r}),badge:u,tom:e.negado?"barreira":"normal",icon:e.negado?(0,a.jsx)(eN.Z,{className:"h-4 w-4 text-destructive"}):d?(0,a.jsx)(ew.Z,{className:"h-4 w-4 text-primary"}):i.icon,subtitle:[l,i.subtitle,e.carencia?eM(e.carencia,o):null].filter(Boolean).join(" \xb7 "),sections:[{heading:o("audiencias.jornada.badge"),rows:c},...i.sections]}};for(let n of x.passos){let a=eA(n.indiceNaRaiz),i=t(n);if(y(a,i?n.nivel:0,s(n)),i&&(_=Math.max(_,n.nivel)),null!=n.depoisDe){let e=x.passos.find(e=>e.indiceNaRaiz===n.depoisDe);N("e-passo-".concat(e.indiceNaRaiz,"-").concat(n.indiceNaRaiz),eA(e.indiceNaRaiz),a,{carencia:e.carencia,barreira:n.negado})}e.has(n.indiceNaRaiz)||w.push({id:a,carencia:n.carencia,barreira:n.negado})}x.soltas.forEach(e=>{let t=eA(e.indiceNaRaiz);y(t,0,j(e.no,e.indiceNaRaiz)),w.push({id:t,carencia:null,barreira:!1})})}else g.forEach((e,t)=>{let n=eA(t);y(n,0,j(e,t)),w.push({id:n,carencia:null,barreira:!1})});let k=g.length>1,C=_+1;if(k){let e="or"===b?o("audiencias.detail.flow.or"):o("audiencias.detail.flow.and");
1for(let t of(y("op",C,{title:e,subtitle:"".concat(g.length," \xd7"),icon:(0,a.jsx)(e_.Z,{className:"h-4 w-4 text-muted-foreground"}),sections:[{rows:g.map((t,n)=>({k:"".concat(o("audiencias.detail.flow.condition")," ").concat(n+1),v:e}))}]}),w))N("e-".concat(t.id,"-op"),t.id,"op",{carencia:t.carencia,barreira:t.barreira})}let R=(k?C:_)+1;if(y("aud",R,{title:o("audiencias.detail.flow.audience"),subtitle:o("audiencias.detail.flow.membersBadge",{count:d(n)}),icon:(0,a.jsx)(ek.ee,{className:"h-4 w-4",showTooltip:!1}),sections:[{rows:[{k:o("audiencias.detail.summary.membersToday"),v:d(n)}]}]}),k)N("e-op-aud","op","aud");else for(let e of w)N("e-".concat(e.id,"-aud"),e.id,"aud",{carencia:e.carencia,barreira:e.barreira});s.forEach(e=>{var t;let n="out-".concat(e.kind,"-").concat(e.id);y(n,R+1,{title:e.name,subtitle:e.subtitle,badge:"list"===e.kind?o("audiencias.detail.flow.list"):o("audiencias.detail.flow.envio"),icon:(0,a.jsx)(I.s,{id:e.destinationType,className:"h-4 w-4"}),dimmed:!e.enabled,sections:[{rows:null!==(t=e.rows)&&void 0!==t?t:[]}]}),N("e-aud-".concat(n),"aud",n,{animated:e.enabled})});let S=new Set(h.map(e=>e.target)),U=new Set(h.map(e=>e.source));for(let e of f)e.data.hasIn=S.has(e.id),e.data.hasOut=U.has(e.id);return{content:f,edges:h,jornada:x}})({rule:t,members:n,saidas:i,expanded:u,editLabel:x,t:c,formatarNumero:v,origemDaFonte:b,eventosDoCatalogo:r,nomeDaFonte:j,nomeDaConversao:d,onEdit:l}),[t,n,i,u,x,c,v,b,r,j,d,l]),[k,C]=(0,g.useState)({}),R=(0,g.useCallback)(e=>{C(t=>{let n=!1,a={...t};for(let t of e)if("dimensions"===t.type&&t.dimensions){let e=Math.round(t.dimensions.height);e>0&&a[t.id]!==e&&(a[t.id]=e,n=!0)}return n?a:t})},[]),S=(0,g.useMemo)(()=>(function(e,t){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],a=e=>{var n;return null!==(n=t[e])&&void 0!==n?n:72},s=t=>{let n=0,s={};for(let i of e)i.col===t&&(s[i.id]=n,n+=a(i.id)+26);return{y:s,total:Math.max(0,n-26)}},i=[...new Set(e.map(e=>e.col))],r=new Map(i.map(e=>[e,s(e)])),o=Math.max(0,...i.map(e=>r.get(e).total));return e.map(e=>{let t=r.get(e.col),a=t.y[e.id]+Math.max(0,(o-t.total)/2);return{id:e.id,type:"card",position:{x:eD(e.col,n),y:a},data:e.data}})})(N,k,_.sequencial),[N,k,_.sequencial]);return(0,a.jsxs)("div",{className:"relative h-full w-full bg-background",children:[(0,a.jsxs)("div",{className:"pointer-events-none absolute left-3 top-3 z-10 flex max-w-[min(24rem,70%)] flex-col items-start gap-1",children:[(0,a.jsx)("span",{className:(0,y.cn)("rounded-full border px-2 py-0.5 text-[10px] font-semibold",_.sequencial?"border-primary/30 bg-primary/10 text-primary":"border-border bg-muted text-muted-foreground"),children:_.sequencial?c("audiencias.jornada.badge"):c("audiencias.jornada.semOrdemBadge")}),_.sequencial&&(0,a.jsx)("span",{className:"rounded-md border bg-background/90 px-2 py-1 text-[10px] leading-snug text-muted-foreground shadow-sm",children:c("audiencias.jornada.comoLer")}),_.ancorasQuebradas.length>0&&(0,a.jsxs)("span",{className:"flex items-start gap-1 rounded-md border border-destructive/40 bg-destructive/5 px-2 py-1 text-[10px] leading-snug text-destructive shadow-sm",children:[(0,a.jsx)(f.Z,{className:"mt-px h-3 w-3 shrink-0"}),c("audiencias.jornada.ancoraQuebrada")]})]}),(0,a.jsx)(ev.x$,{nodes:S,edges:w,nodeTypes:eZ,onNodesChange:R,onNodeClick:(e,t)=>p(t.id),fitView:!0,fitViewOptions:{padding:.2},nodesDraggable:!1,nodesConnectable:!1,elementsSelectable:!1,panOnScroll:!0,zoomOnDoubleClick:!1,minZoom:.3,maxZoom:1.5,proOptions:{hideAttribution:!0},style:{background:"transparent"},children:(0,a.jsx)(ev.Aq,{variant:ev.T7.Dots,gap:18,size:1,color:"hsl(var(--muted-foreground) / 0.25)",style:{background:"transparent"}})})]})}let eO=[7,14,30,90];function eq(e){let t=String(e).split("-");return 3!==t.length?String(e):"".concat(t[2],"/").concat(t[1])}function eB(e){let{titulo:t,valor:n,rotulo:s}=e;return(0,a.jsx)(b.$W,{children:(0,a.jsx)(b.oN,{titulo:t,valorDestaque:n,rotulo:s})})}function eK(e){var t,n,i;let{serie:r,serieCarregando:d,serieIndisponivel:l,status:u,membros:m,realtime:p,periodo:x,onPeriodo:f,enviosLigados:h,computacao:v}=e,{t:j}
1=(0,o.$G)(),y=(0,o.bU)(),N=(0,g.useCallback)(e=>(0,b.mE)(e,0,y),[y]),w=e=>null==e?"—":N(e),_=function(e){if(!e||!Array.isArray(e.points))return{membrosHoje:null,entraram7d:null,sairam7d:null,enviadosAsListas7d:null,removidosDasListas7d:null};let t=e.points.slice(-7),n=e=>t.reduce((t,n)=>t+(e(n)||0),0);return{membrosHoje:e.members_now,entraram7d:n(e=>e.entraram),sairam7d:n(e=>e.sairam),enviadosAsListas7d:n(e=>{var t,n;return null!==(n=null===(t=e.listas)||void 0===t?void 0:t.enviados)&&void 0!==n?n:0}),removidosDasListas7d:n(e=>{var t,n;return null!==(n=null===(t=e.listas)||void 0===t?void 0:t.removidos)&&void 0!==n?n:0})}}(r),k=null!==(t=null==u?void 0:u.list_destinations)&&void 0!==t?t:[],C=k.length>0,R=k.find(e=>null!=e.remote_count_lower||null!=e.remote_count_upper),I=(null!==(n=null==r?void 0:r.points)&&void 0!==n?n:[]).map(e=>{var t,n,a,s;return{dia:e.dia,membros:e.membros,entraram:e.entraram,sairam:e.sairam,enviados:null!==(a=null===(t=e.listas)||void 0===t?void 0:t.enviados)&&void 0!==a?a:0,removidos:null!==(s=null===(n=e.listas)||void 0===n?void 0:n.removidos)&&void 0!==s?s:0}}),S=(0,a.jsx)("div",{className:"flex items-center justify-center",style:{height:b.KT.normal},children:(0,a.jsx)(c.Z,{className:"h-4 w-4 animate-spin text-muted-foreground"})});return(0,a.jsxs)("div",{className:"space-y-4",children:[v,(0,a.jsxs)("div",{className:"grid grid-cols-2 gap-2 md:grid-cols-3 lg:grid-cols-6",children:[(0,a.jsx)(eB,{titulo:j("audiencias.detail.summary.membersToday"),valor:N(null!==(i=_.membrosHoje)&&void 0!==i?i:m)}),(0,a.jsx)(eB,{titulo:j("audiencias.detail.summary.entered7d"),valor:w(_.entraram7d)}),(0,a.jsx)(eB,{titulo:j("audiencias.detail.summary.exited7d"),valor:w(_.sairam7d)}),(0,a.jsx)(eB,{titulo:j("audiencias.detail.summary.sentToLists7d"),valor:w(_.enviadosAsListas7d),rotulo:_.removidosDasListas7d?j("audiencias.detail.summary.removedFromLists7dHint",{count:N(_.removidosDasListas7d)}):void 0}),(0,a.jsx)(eB,{titulo:j("audiencias.detail.summary.listsLinked"),valor:N(k.length)}),(0,a.jsx)(eB,{titulo:j("audiencias.detail.summary.enviosLinked"),valor:N(h)})]}),l&&(0,a.jsx)("p",{className:"text-xs text-muted-foreground",children:j("audiencias.detail.summary.serieUnavailable")}),(0,a.jsx)(b.$W,{titulo:j("audiencias.detail.summary.membersChart"),acoes:(0,a.jsx)("div",{className:"flex items-center gap-1",children:eO.map(e=>(0,a.jsxs)(s.z,{variant:x===e?"default":"outline",size:"sm",className:"h-6 px-2 text-[10px]",onClick:()=>f(e),children:[e,"d"]},e))}),children:d?S:(0,a.jsx)(b.BH,{permitirDecimais:!1,dados:I,chaveX:"dia",series:[{chave:"membros",rotulo:j("audiencias.detail.summary.membersSeries"),cor:b.EA.marca}],semCabecalho:!0,formatarValor:N,formatarRotuloX:eq,mostrarGrade:!0,mostrarEixoY:!0,mensagemSemDados:j("audiencias.detail.summary.chartEmpty")})}),(0,a.jsx)(b.$W,{titulo:j("audiencias.detail.summary.movementChart"),children:d?S:(0,a.jsx)(b.Ur,{permitirDecimais:!1,dados:I,chaveX:"dia",series:[{chave:"entraram",rotulo:j("audiencias.detail.summary.enteredSeries"),cor:b.EA.marca},{chave:"sairam",rotulo:j("audiencias.detail.summary.exitedSeries"),cor:b.EA.destrutiva}],semCabecalho:!0,formatarValor:N,formatarRotuloX:eq,mostrarGrade:!0,mostrarEixoY:!0,mostrarLegenda:!0,mensagemSemDados:j("audiencias.detail.summary.chartEmpty")})}),C&&(0,a.jsx)(b.$W,{titulo:j("audiencias.detail.summary.listsChart"),children:d?S:(0,a.jsx)(b.Ur,{permitirDecimais:!1,dados:I,chaveX:"dia",series:[{chave:"enviados",rotulo:j("audiencias.detail.summary.sentSeries"),cor:b.EA.marca},{chave:"removidos",rotulo:j("audiencias.detail.summary.removedSeries"),cor:b.EA.destrutiva}],semCabecalho:!0,formatarValor:N,formatarRotuloX:eq,mostrarGrade:!0,mostrarEixoY:!0,mostrarLegenda:!0,mensagemSemDados:j("audiencias.detail.summary.chartEmpty")})}),(0,a.jsx)(b.$W,{titulo:j("audiencias.detail.summary.howTitle"),children:(0,a.jsxs)("div",{className:"space-y-3 text-xs leading-relaxed text-foreground",children:[(0,a.jsx)("p",{className:"text-muted-foreground",children:j(p?"audiencias.detail.summary.realtimeNote":"audiencias.detail.summary.hourlyNote")}),(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{children:j("audiencias.detail.summary.howLists")}),(0,a.jsx)("p",{className:"text-muted-foreground",children:C?R?j("audiencias.detail.summary.howListsRecognized",{range:(0,Y.eH)(R.remote_count_lower,R.remote_count_upper,y)}):null:j("audiencias.detail.summary.howListsNone")})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{children:j("audiencias.detail.summary.howEnvios")}),(0,a.jsx)("p",{className:"text-muted-foreground",children:h>0?j("audiencias.detail.summary.howEnviosCount",{count:h}):j("audiencias.detail.summary.howEnviosNone")})]})]})})]})}function e$(e){if(null==e)return null;if("string"==typeof e)try{return JSON.parse(e)}catch(e){return null}return"object"==typeof e?e:null}function eF(e){for(var t=arguments.length,n=Array(t>1?t-1:0),a=1;a<t;a++)n[a-1]=arguments[a];if(!e)return null;for(let t of n){let n=e[t];if("number"==typeof n)return n}return null}function eG(e){var t;let{listDestinations:n,lastCatchup:s,work:i}=e,{t:r}=(0,o.$G)(),d=(0,o.bU)(),l=(0,W.NU)(),c=e=>null==e?"—":new Intl.NumberFormat(d).format(e),u=e=>{var t,a;return null!==(a=null===(t=n.find(t=>t.destination_id===e))||void 0===t?void 0:t.destination.name)&&void 0!==a?a:null};return(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsxs)(b.$W,{titulo:r("audiencias.detail.syncs.lastRunTitle"),semPreenchimento:!0,children:[(0,a.jsx)("p",{className:"px-4 pt-3 text-xs text-muted-foreground",children:r("audiencias.detail.runs.tableHint")}),0===n.length?(0,a.jsx)("p",{className:"px-4 py-4 text-sm text-muted-foreground",children:r("audiencias.detail.destinations.listEmpty")}):(0,a.jsx)("div",{className:"overflow-x-auto",children:(0,a.jsxs)("table",{className:"mt-2 w-full text-xs",children:[(0,a.jsx)("thead",{children:(0,a.jsxs)("tr",{className:"border-b border-border text-left text-[11px] uppercase tracking-wider text-muted-foreground",children:[(0,a.jsx)("th",{className:"px-4 py-2 font-medium",children:r("audiencias.detail.runs.colWhen")}),(0,a.jsx)("th",{className:"px-2 py-2 font-medium",children:r("audiencias.detail.runs.colList")}),(0,a.jsx)("th",{className:"px-2 py-2 font-medium",children:r("audiencias.detail.runs.colKind")}),(0,a.jsx)("th",{className:"px-2 py-2 text-right font-medium",children:r("audiencias.detail.runs.colSent")}
1),(0,a.jsx)("th",{className:"px-2 py-2 text-right font-medium",children:r("audiencias.detail.runs.colRemoved")}),(0,a.jsx)("th",{className:"px-2 py-2 text-right font-medium",children:r("audiencias.detail.runs.colInvalid")}),(0,a.jsx)("th",{className:"px-2 py-2 text-right font-medium",children:r("audiencias.detail.runs.colNoId")}),(0,a.jsx)("th",{className:"px-4 py-2 font-medium",children:r("audiencias.detail.runs.colResult")})]})}),(0,a.jsx)("tbody",{children:n.map(e=>{var t,n;let s=null!==(t=e.last_run)&&void 0!==t?t:null;return(0,a.jsxs)("tr",{className:"border-b border-border last:border-0",children:[(0,a.jsx)("td",{className:"px-4 py-2 text-muted-foreground",children:s?(0,w.y)(null!==(n=s.finished_at)&&void 0!==n?n:s.started_at,r):"—"}),(0,a.jsx)("td",{className:"px-2 py-2",children:(0,a.jsxs)("span",{className:"inline-flex items-center gap-1.5 text-foreground",children:[(0,a.jsx)(I.s,{id:e.destination.type,className:"h-3.5 w-3.5"})," ",e.destination.name]})}),(0,a.jsx)("td",{className:"px-2 py-2 text-muted-foreground",children:s?(0,er.p6)(s.kind,r):"—"}),(0,a.jsx)("td",{className:"px-2 py-2 text-right tabular-nums",children:c(null==s?void 0:s.sent_add)}),(0,a.jsx)("td",{className:"px-2 py-2 text-right tabular-nums",children:c(null==s?void 0:s.sent_remove)}),(0,a.jsx)("td",{className:"px-2 py-2 text-right tabular-nums",children:c(null==s?void 0:s.invalid)}),(0,a.jsx)("td",{className:"px-2 py-2 text-right tabular-nums",children:c(null==s?void 0:s.sem_identificador)}),(0,a.jsxs)("td",{className:"px-4 py-2",children:[(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-1.5",children:[s&&(0,a.jsx)(S.O,{tone:(0,Y.Cw)(s.status),className:"text-[10px]",children:s.status}),(0,a.jsx)("span",{className:"text-muted-foreground",children:(0,er.Y8)(s,{t:r,locale:d})})]}),s&&(0,a.jsxs)("details",{className:"mt-1",children:[(0,a.jsx)("summary",{className:"cursor-pointer text-[11px] text-muted-foreground hover:text-foreground",children:r("audiencias.detail.runs.details")}),(0,a.jsx)("pre",{className:"mt-1 max-h-40 overflow-auto rounded-md bg-muted/40 p-2 font-mono text-[10px] text-foreground",children:JSON.stringify(s,null,2)})]})]})]},e.destination_id)})})]})})]}),(0,a.jsx)(b.$W,{titulo:r("audiencias.detail.runs.catchupTitle"),children:s?(0,a.jsxs)("div",{className:"space-y-2 text-sm",children:[(0,a.jsxs)("p",{className:"flex flex-wrap items-center gap-2 text-foreground",children:[(0,a.jsx)(S.O,{tone:(0,Y.Cw)(s.status),className:"text-[10px]",children:s.status}),(0,a.jsx)("span",{children:function(e,t,n,a){var s,i;let r=(0,w.y)(null!==(i=null!==(s=e.finished_at)&&void 0!==s?s:e.started_at)&&void 0!==i?i:e.requested_at,t,void 0),o=e$(e.stats_json),d=eF(o,"entered_count","entered"),l=eF(o,"exited_count","exited"),c=eF(o,"total_members","total"),u=e=>new Intl.NumberFormat(n).format(e);return null==d&&null==l&&null==c?t("audiencias.detail.runs.catchupNoStats",{quando:r,status:e.status}):t("audiencias.detail.runs.catchupPhrase",{quando:r,entered:u(null!=d?d:0),exited:u(null!=l?l:0),total:null==c?"—":u(c)})}(s,r,d)})]}),s.error&&(0,a.jsx)("p",{className:"break-words text-xs text-destructive",children:s.error}),(0,a.jsxs)("details",{children:[(0,a.jsx)("summary",{className:"cursor-pointer text-[11px] text-muted-foreground hover:text-foreground",children:r("audiencias.detail.runs.details")}),(0,a.jsx)("pre",{className:"mt-1 max-h-48 overflow-auto rounded-md bg-muted/40 p-3 font-mono text-[11px] text-foreground",children:JSON.stringify({...s,stats_json:null!==(t=e$(s.stats_json))&&void 0!==t?t:s.stats_json},null,2)})]})]}):(0,a.jsx)("p",{className:"text-sm text-muted-foreground",children:r("audiencias.detail.syncs.catchupNone")})}),(0,a.jsx)(b.$W,{titulo:r("audiencias.detail.runs.queueTitle"),children:0===i.length?(0,a.jsx)("p",{className:"text-sm text-muted-foreground",children:r("audiencias.detail.syncs.queueEmpty")}):(0,a.jsx)("ul",{className:"space-y-1.5 text-sm",children:i.map((e,t)=>{var n,s;let i=u(e.destination_id);return(0,a.jsxs)("li",{className:"flex flex-wrap items-center gap-2",children:[(0,a.jsx)("span",{className:"text-foreground",children:r("audiencias.detail.runs.queueItem",{kind:("diff"===(s=e.kind)?r("audiencias.detail.runs.queueKindDiff"):"list_sync"===s?r("audiencias.detail.runs.queueKindListSync"):"event_fanout"===s?r("audiencias.detail.runs.queueKindFanout"):s)+(i?" (".concat(i,")"):""),quando:e.due_at?(0,W.wi)(e.due_at,l,d):"—",attempts:e.attempts})}),e.last_error&&(0,a.jsx)("span",{className:"truncate text-xs text-destructive",title:e.last_error,children:e.last_error})]},"".concat(e.kind,"-").concat(null!==(n=e.destination_id)&&void 0!==n?n:"","-").concat(t))})})})]})}var eH=n(12711),eV=n(7824);let eW=[{grupo:"manage",id:"summary",labelKey:"audiencias.detail.menu.summary"},{grupo:"manage",id:"rules",labelKey:"audiencias.detail.menu.rules"},{grupo:"manage",id:"lists",labelKey:"audiencias.detail.menu.lists"},{grupo:"manage",id:"envios",labelKey:"audiencias.detail.menu.envios"},{grupo:"manage",id:"members",labelKey:"audiencias.detail.menu.members"},{grupo:"audit",id:"syncs",labelKey:"audiencias.detail.menu.syncs"},{grupo:"audit",id:"history",labelKey:"audiencias.detail.menu.history"}],eY=new Set(eW.map(e=>e.id));function eJ(e){var t,n,b,j,y,w,C,I,S,U,z;let{projectId:T,projectSlug:D,audienceId:M}=e,{t:A}
1=(0,o.$G)(),L=(0,o.bU)(),O=(0,v.useRouter)(),q=(0,v.useSearchParams)(),B=null==q?void 0:q.get("secao"),[K,$]=(0,g.useState)(B&&eY.has(B)?B:"summary"),[F,G]=(0,g.useState)(30),[H,V]=(0,g.useState)(!1),W=(0,ei.AL)(T,M),Y=(0,g.useRef)(Date.now()),J=(0,ei.Qc)(T,M,{refetchInterval:e=>{var t;return(0,N.D7)(null===(t=e.state.data)||void 0===t?void 0:t.computacao)&&Date.now()-Y.current<3e5?5e3:3e4}}),Q=(0,ei.mG)(T,M,F),ee=(0,ei.fo)(T,M),{data:et}=(0,ei.zc)(T),en=null==et?void 0:et.events,ea=(0,g.useMemo)(()=>(0,eH.pi)(null==et?void 0:et.profile_fields,"en-US"===L?"en":"pt-BR"),[null==et?void 0:et.profile_fields,L]),{sources:es}=(0,d.p)({pageSize:200}),{groups:er}=(0,l.wA)(T),eo=(0,ei.P)(T,M),el=(0,ei.$V)(T),ec=(0,g.useCallback)(()=>O.push("/projects/".concat(D,"/audiences")),[O,D]),eu=(0,g.useCallback)(()=>O.push("/projects/".concat(D,"/audiences/new?segment=").concat(M)),[O,D,M]),em=W.data,ep=J.data,ex=null!==(n=null==ep?void 0:ep.estado)&&void 0!==n?n:null==em?void 0:em.status.estado,eh=null!==(y=null!==(j=null!==(b=null==ep?void 0:ep.computacao)&&void 0!==b?b:null==em?void 0:em.status.computacao)&&void 0!==j?j:null==em?void 0:em.computacao)&&void 0!==y?y:null,ev=function(e,t){if("calculando"!==e&&"erro_de_calculo"!==e)return null;let n=(0,N.B6)(t);return n&&("calculando"!==e||"erro"!==n.fase)?"erro_de_calculo"===e&&"erro"!==n.fase?{...n,fase:"erro"}:n:null}(ex,eh),eg=(0,g.useMemo)(()=>{var e,t,n;let a=new Map((null!==(t=null===(e=ee.data)||void 0===e?void 0:e.results)&&void 0!==t?t:[]).map(e=>{var t;return[e.destination_id,null!==(t=e.last_run)&&void 0!==t?t:null]}));return(null!==(n=null==ep?void 0:ep.list_destinations)&&void 0!==n?n:[]).map(e=>{var t,n;return{...e,last_run:null!==(n=null!==(t=e.last_run)&&void 0!==t?t:a.get(e.destination_id))&&void 0!==n?n:null}})},[ep,ee.data]),eb=(0,g.useMemo)(()=>{var e;return null!==(e=null==ep?void 0:ep.event_subscriptions)&&void 0!==e?e:[]},[ep]),ej=null!==(C=null!==(w=null==ep?void 0:ep.members)&&void 0!==w?w:null==em?void 0:em.members)&&void 0!==C?C:0,ey=(0,g.useCallback)(e=>{var t;return null===(t=es.find(t=>t.id===e))||void 0===t?void 0:t.origin},[es]),eN=(0,g.useMemo)(()=>(0,eU.s1)(null==em?void 0:em.rule_autoral),[em]),ew=eN[0]?(0,eU.bU)(eN[0].node,ey,en):null,e_=(0,g.useMemo)(()=>{let e=new Set,t=[];for(let n of eN){let a=(0,eU.bU)(n.node,ey,en),s=(0,eR.Gy)(a,n.node.event_type)?(0,eR.GW)(a,n.node.event_type,A):n.node.event_type;e.has(s)||(e.add(s),t.push(s))}return t},[eN,ey,en,A]),ek=(0,g.useMemo)(()=>E(D,M,eb,er),[D,M,eb,er]),eC=(0,g.useMemo)(()=>[...eg.map(e=>{var t,n;return{id:e.destination_id,kind:"list",name:e.destination.name,destinationType:e.destination.type,subtitle:"mirror"===e.sync_mode?A("audiencias.detail.lists.mirror"):A("audiencias.detail.lists.addOnly"),enabled:e.enabled,rows:[{k:A("audiencias.detail.lists.mode"),v:e.sync_mode},{k:A("audiencias.detail.lists.remoteAudience"),v:null!==(n=null!==(t=e.remote_audience_name)&&void 0!==t?t:e.remote_audience_id)&&void 0!==n?n:"—"}]}}),...ek.map(e=>{var t,n;return{id:e.subscriptionId,kind:"envio",name:null!==(t=e.envioName)&&void 0!==t?t:e.destinationName,destinationType:e.destinationType,subtitle:null!==(n=e.destEvent)&&void 0!==n?n:e.signalType,enabled:e.enabled,rows:[{k:A("audiencias.detail.flow.event"),v:e.signalType},...e.destEvent?[{k:A("audiencias.detail.flow.envio"),v:e.destEvent}]:[]]}})],[eg,ek,A]),eI=(0,g.useCallback)(e=>{let t=null==et?void 0:et.conversions.find(t=>t.id===e);return(null==t?void 0:t.name)||(null==t?void 0:t.slug)||null},[et]),eT=(0,g.useCallback)(e=>{var t;return null===(t=es.find(t=>t.id===e))||void 0===t?void 0:t.name},[es]),eD=(0,g.useMemo)(()=>[{key:"manage",title:A("audiencias.detail.menu.groupManage"),items:eW.filter(e=>"manage"===e.grupo).map(e=>({id:e.id,label:A(e.labelKey)}))},{key:"audit",title:A("audiencias.detail.menu.groupAudit"),items:eW.filter(e=>"audit"===e.grupo).map(e=>({id:e.id,label:A(e.labelKey)}))}],[A]);return W.isLoading?(0,a.jsx)("div",{className:"flex h-[100dvh] items-center justify-center",children:(0,a.jsx)(c.Z,{className:"h-5 w-5 animate-spin text-muted-foreground"})}):W.isError||!em?(0,a.jsxs)("div",{className:"flex h-[100dvh] flex-col items-center justify-center gap-3",children:[(0,a.jsx)("p",{className:"text-sm text-muted-foreground",children:W.isError?A("audiencias.detail.error"):A("audiencias.detail.notFound")}),(0,a.jsx)(s.z,{variant:"outline",size:"sm",onClick:ec,children:A("audiencias.detail.back")})]}):(0,a.jsxs)("div",{className:"flex h-[100dvh] flex-col overflow-hidden bg-background",children:[(0,a.jsxs)("div",{className:"flex shrink-0 items-center justify-between border-b border-border px-4 pb-2 pt-3",children:[(0,a.jsxs)("div",{className:"flex min-w-0 items-center gap-2",children:[(0,a.jsx)(s.z,{variant:"ghost",size:"icon",className:"h-8 w-8 text-muted-foreground hover:bg-muted","aria-label":A("audiencias.detail.back"),onClick:ec,children:(0,a.jsx)(u.Z,{className:"h-4 w-4"})}),(0,a.jsx)("span",{className:"flex h-6 w-6 shrink-0 items-center justify-center rounded-md bg-muted",children:(0,a.jsx)(ez.p,{origin:ew,className:"h-3.5 w-3.5"})}),(0,a.jsx)("h2",{className:"min-w-0 truncate text-sm font-medium text-foreground",children:em.segment.name}),e_.slice(0,2).map(e=>(0,a.jsx)("span",{className:"shrink-0 rounded bg-muted px-1.5 py-0.5 font-mono text-[11px] text-muted-foreground",children:e},e)),e_.length>2&&(0,a.jsxs)("span",{className:"shrink-0 rounded bg-muted px-1.5 py-0.5 font-mono text-[11px] text-muted-foreground",title:e_.join(", "),children:["+",e_.length-2]}),ex&&(0,a.jsx)(P.R,{estado:ex,computacao:eh}),em.realtime&&(0,a.jsx)("span",{className:"shrink-0 rounded bg-muted px-1.5 py-0.5 text-[11px] text-muted-foreground",children:A("audiencias.detail.realtimeLegacy")})]}),(0,a.jsxs)("div",{className:"flex shrink-0 items-center gap-1.5",children:[(0,a.jsxs)(s.z,{variant:"outline",size:"sm",className:"h-8 gap-1.5 text-xs",onClick:eu,children:[(0,a.jsx)(m.Z,{className:"h-3.5 w-3.5"})," ",A("audiencias.list.edit")]}),(0,a.jsxs)(s.z,{variant:"outline",size:"sm",className:"h-8 gap-1.5 text-xs",onClick:()=>eo.mutate(),disabled:eo.isPending,children:[eo.isPending?(0,a.jsx)(c.Z,{className:"h-3 w-3 animate-spin"}):(0,a.jsx)(p.Z,{className:"h-3 w-3"}),A("audiencias.list.syncNow")]}),(0,a.jsxs)(s.z,{variant:"outline",size:"sm",className:"h-8 gap-1.5 text-xs text-muted-foreground hover:border-destructive/50 hover:text-destructive",onClick:()=>V(!0),children:[(0,a.jsx)(x.Z,{className:"h-3.5 w-3.5"})," ",A("audiencias.list.delete")]})]})]}),(0,a.jsx)(_,{progresso:ev}),(0,a.jsxs)("div",{className:"flex min-h-0 flex-1 overflow-hidden",children:[(0,a.jsx)(r.Q,{titulo:A("audiencias.detail.menu.title"),ativo:K,onSelecionar:e=>$(e),grupos:eD}),(0,a.jsxs)("div",{className:"min-w-0 flex-1 ".concat("rules"===K?"overflow-hidden":"overflow-auto p-4"),children:["summary"===K&&(0,a.jsx)(eK,{computacao:(0,a.jsx)(k,{progresso:ev,eventos:e_,onRetry:()=>eo.mutate(),retrying:eo.isPending}),serie:Q.data,serieCarregando:Q.isLoading,serieIndisponivel:Q.isError,status:ep,membros:ej,realtime:em.realtime,periodo:F,onPeriodo:G,enviosLigados:eb.length}),"rules"===K&&(0,a.jsxs)("div",{className:"flex h-full min-w-0 flex-col",children:[(0,a.jsxs)("div",{className:"shrink-0 border-b border-border px-4 py-3",children:[(0,a.jsx)("p",{className:"text-sm text-foreground",children:(0,eV.Gl)(em.rule_autoral,A,{nomeDaConversao:eI,nomeDaFonte:eT,origemDaFonte:ey,eventosDoCatalogo:en,camposDePerfil:ea})}),function(e,t){if(!(0,eS.E0)(null!=e?e:null).sequencial)return!1;let n=function(e){let t="string"==typeof e?(()=>{try{return JSON.parse(e)}catch(e){return null}})():e;if(!t||"object"!=typeof t)return null;let n=t.meta;if(!n||"object"!=typeof n)return null;let a=n.motor;return"string"==typeof a&&a?a:null}(t);return null!=n&&"linha_do_tempo"!==n}(em.rule_autoral,null===(t=em.published_revision)||void 0===t?void 0:t.definition_json)&&(0,a.jsxs)("p",{className:"mt-1 flex items-start gap-1.5 rounded border border-destructive/40 bg-destructive/5 p-2 text-[11px] text-destructive",children:[(0,a.jsx)(f.Z,{className:"mt-0.5 h-3.5 w-3.5 shrink-0"}),A("audiencias.jornada.ordemNaoExecutada")]}),(0,eS.E0)(em.rule_autoral).sequencial&&(0,a.jsxs)("p",{className:"mt-1 flex items-center gap-1.5 text-[11px] text-muted-foreground",children:[(0,a.jsx)(h.Z,{className:"h-3 w-3 shrink-0 text-primary"}),A("audiencias.jornada.ordemImporta")]}),(0,a.jsxs)("details",{className:"mt-1",children:[(0,a.jsx)("summary",{className:"cursor-pointer text-[11px] text-muted-foreground hover:text-foreground",children:A("audiencias.detail.flow.rawToggle")}),(0,a.jsx)("pre",{className:"mt-1 max-h-64 overflow-auto rounded-md bg-muted/40 p-3 font-mono text-[11px] text-foreground",children:JSON.stringify(em.rule_autoral,null,2)})]})]}),(0,a.jsx)("div",{className:"min-h-0 flex-1",children:(0,a.jsx)(eL,{rule:em.rule_autoral,members:ej,sources:es,saidas:eC,eventosDoCatalogo:en,nomeDaConversao:eI,onEdit:eu})})]}),"lists"===K&&(J.isLoading?(0,a.jsx)(i.O,{className:"h-32 w-full rounded-lg"}):(0,a.jsx)(ed,{projectId:T,projectSlug:D,audienceId:M,listDestinations:eg})),"envios"===K&&(J.isLoading?(0,a.jsx)(i.O,{className:"h-32 w-full rounded-lg"}):(0,a.jsx)(Z,{projectId:T,projectSlug:D,audienceId:M,eventSubscriptions:eb})),"members"===K&&(0,a.jsx)(ef,{projectId:T,audienceId:M,audienceName:em.segment.name,progresso:ev}),"syncs"===K&&(J.isLoading?(0,a.jsx)(i.O,{className:"h-32 w-full rounded-lg"}):(0,a.jsx)(eG,{listDestinations:eg,lastCatchup:null!==(S=null!==(I=null==ep?void 0:ep.last_catchup)&&void 0!==I?I:em.status.last_catchup)&&void 0!==S?S:em.last_build_run,work:null!==(z=null!==(U=null==ep?void 0:ep.work)&&void 0!==U?U:em.status.work)&&void 0!==z?z:em.work}
1)),"history"===K&&(0,a.jsx)(X,{projectId:T,detail:em})]})]}),(0,a.jsx)(R.X,{open:H,name:em.segment.name,pending:el.isPending,onOpenChange:V,onConfirm:()=>el.mutate(M,{onSuccess:ec})})]})}},55774:function(e,t,n){n.d(t,{Y:function(){return l}});var a=n(57437),s=n(79455),i=n(51768),r=n(92735),o=n(51817),d=n(2265);function l(e){let{url:t,onExport:n,label:l="Exportar CSV",exportLabel:c,disabled:u=!1,size:m="sm",className:p}=e,{addTask:x,updateTask:f,tasks:h}=(0,i.k)(),v=(0,d.useCallback)(async()=>{if(!n)return;let e="export-".concat(Date.now());x(e,null!=c?c:l),f(e,{status:"exporting",progress:5});let t=setInterval(()=>{i.k.getState().tasks.forEach(t=>{t.id===e&&"exporting"===t.status&&t.progress<90&&f(e,{progress:t.progress+12*Math.random()})})},400);try{let{blob:a,filename:s}=await n();clearInterval(t),f(e,{status:"done",progress:100});let i=URL.createObjectURL(a),r=document.createElement("a");r.href=i,r.download=s,r.rel="noopener",document.body.appendChild(r),r.click(),r.remove(),window.setTimeout(()=>URL.revokeObjectURL(i),6e4)}catch(n){clearInterval(t),console.error("[EXPORT_CSV]",n),f(e,{status:"error",progress:0,error:n instanceof Error?n.message:"Erro ao exportar"})}},[n,x,f,c,l]),g=h.some(e=>"exporting"===e.status);return t?(0,a.jsx)(s.z,{asChild:!0,variant:"outline",size:m,disabled:u,className:"gap-1.5 ".concat(null!=p?p:""),children:(0,a.jsxs)("a",{href:t,download:!0,children:[(0,a.jsx)(r.Z,{className:"xs"===m?"h-3 w-3":"h-4 w-4"}),l]})}):(0,a.jsxs)(s.z,{variant:"outline",size:m,onClick:v,disabled:u||g,className:"gap-1.5 ".concat(null!=p?p:""),children:[g?(0,a.jsx)(o.Z,{className:"xs"===m?"h-3 w-3 animate-spin":"h-4 w-4 animate-spin"}):(0,a.jsx)(r.Z,{className:"xs"===m?"h-3 w-3":"h-4 w-4"}),l]})}},84390:function(e,t,n){n.d(t,{A_:function(){return p},IM:function(){return w},MI:function(){return N},O3:function(){return v},Pd:function(){return g},T9:function(){return f},dl:function(){return y},eP:function(){return x},l5:function(){return b},m3:function(){return j},yi:function(){return h}});var a=n(57437),s=n(57175),i=n(19889),r=n(79455),o=n(95733),d=n(18902),l=n(23882),c=n(73247),u=n(92451),m=n(10407);function p(e){let{title:t,description:n,actions:s}=e;return(0,a.jsxs)("div",{className:"flex items-start justify-between gap-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("h1",{className:"text-xl font-medium text-foreground",children:t}),n&&(0,a.jsx)("p",{className:"text-sm text-muted-foreground mt-1",children:n})]}),s&&(0,a.jsx)("div",{className:"flex items-center gap-2 shrink-0",children:s})]})}function x(e){let{columns:t,children:n,className:s,embedded:i}=e;return(0,a.jsx)("div",{className:(0,l.cn)(!i&&"rounded-lg border border-border overflow-hidden",s),children:(0,a.jsxs)(d.iA,{children:[(0,a.jsx)(d.xD,{children:(0,a.jsx)(d.SC,{className:"hover:bg-transparent",children:t.map((e,t)=>(0,a.jsx)(d.ss,{className:(0,l.cn)("h-10 text-[11px] font-medium uppercase tracking-wider text-muted-foreground",0===t&&"pl-6",e.className),children:e.label},t))})}),(0,a.jsx)(d.RM,{children:n})]})})}function f(e){let{children:t,onClick:n,className:s}=e;return(0,a.jsx)(d.SC,{className:(0,l.cn)(n&&"cursor-pointer",s),onClick:n,children:t})}function h(e){let{children:t,first:n,className:s,onClick:i}=e;return(0,a.jsx)(d.pj,{className:(0,l.cn)("py-4",n?"pl-6 font-medium text-foreground":"text-muted-foreground",s),onClick:i,children:t})}function v(e){let{children:t,className:n}=e;return(0,a.jsx)("div",{className:(0,l.cn)("overflow-hidden rounded-lg border border-border bg-card shadow-sm",n),children:t})}function g(e){let{children:t}=e;return(0,a.jsx)("div",{className:"flex items-center gap-2 px-3 py-2.5 border-b border-border",children:t})}function b(e){let{value:t,onChange:n,placeholder:s}=e,{t:r}=(0,i.$G)();return(0,a.jsxs)("div",{className:"relative w-full max-w-xs",children:[(0,a.jsx)(c.Z,{className:"absolute left-2.5 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-muted-foreground"}),(0,a.jsx)(o.I,{type:"text",placeholder:null!=s?s:r("list.searchByNamePlaceholder"),value:t,onChange:e=>n(e.target.value),className:"pl-8 h-8 text-[13px]"})]})}function j(e){let{children:t}=e;return(0,a.jsx)("div",{className:"flex items-center justify-between px-3 py-2.5 border-t border-border",children:t})}function y(e){let{page:t,onPageChange:n,hasPrev:s,hasNext:o}=e,{t:d}=(0,i.$G)();return(0,a.jsxs)("div",{className:"flex items-center gap-1",children:[(0,a.jsx)(r.z,{variant:"outline",size:"sm",className:"h-8 w-8 p-0","aria-label":d("list.previousPage"),disabled:!1===s||t<=1,onClick:()=>n(t-1),children:(0,a.jsx)(u.Z,{className:"h-4 w-4"})}),(0,a.jsx)(r.z,{variant:"outline",size:"sm",className:"h-8 w-8 p-0","aria-label":d("list.nextPage"),disabled:!1===o,onClick:()=>n(t+1),children:(0,a.jsx)(m.Z,{className:"h-4 w-4"})})]})}function N(e){let{icon:t,title:n,description:s,action:i}=e;return(0,a.jsxs)("div",{className:"text-center py-12",children:[(0,a.jsx)(t,{className:"h-10 w-10 text-muted-foreground
1/50 mx-auto mb-4"}),(0,a.jsx)("h3",{className:"text-base font-medium text-foreground mb-1.5",children:n}),s&&(0,a.jsx)("p",{className:"text-sm text-muted-foreground mb-4",children:s}),i]})}function w(e){let{columns:t,rows:n=4,embedded:i}=e;return(0,a.jsx)(x,{columns:t,embedded:i,children:Array.from({length:n}).map((e,n)=>(0,a.jsx)(d.SC,{children:t.map((e,t)=>(0,a.jsx)(d.pj,{className:(0,l.cn)("py-4",0===t&&"pl-6"),children:(0,a.jsx)(s.O,{className:(0,l.cn)("h-4 py-0 my-0.5",0===t?"w-36":"w-3/4"),delayIndex:n})},t))},n))})}},7912:function(e,t,n){n.d(t,{s:function(){return m}});var a=n(57437),s=n(31679),i=n(44743),r=n(23882),o=n(19700),d=n(94806);function l(e){let{svgKey:t,className:n}=e,s=d.Y[t];return s?(0,a.jsx)("svg",{viewBox:s.viewBox,className:n,style:{width:"auto"},"aria-hidden":!0,...s.mono?{fill:"currentColor"}:{},dangerouslySetInnerHTML:{__html:s.inner}}):null}let c={microsoft_ads:function(e){let{className:t}=e;return(0,a.jsxs)("svg",{viewBox:"0 0 24 24",className:t,style:{width:"auto"},"aria-hidden":!0,xmlns:"http://www.w3.org/2000/svg",children:[(0,a.jsx)("rect",{x:"1",y:"1",width:"10",height:"10",fill:"#F25022"}),(0,a.jsx)("rect",{x:"13",y:"1",width:"10",height:"10",fill:"#7FBA00"}),(0,a.jsx)("rect",{x:"1",y:"13",width:"10",height:"10",fill:"#00A4EF"}),(0,a.jsx)("rect",{x:"13",y:"13",width:"10",height:"10",fill:"#FFB900"})]})},slack:e=>(0,a.jsx)(l,{svgKey:"slack",...e}),linkedin:e=>(0,a.jsx)(l,{svgKey:"linkedin",...e}),amplitude:e=>(0,a.jsx)(l,{svgKey:"amplitude",...e}),segment:e=>(0,a.jsx)(l,{svgKey:"segment",...e}),mparticle:e=>(0,a.jsx)(l,{svgKey:"mparticle",...e}),customerio:e=>(0,a.jsx)(l,{svgKey:"customerio",...e}),rudderstack:e=>(0,a.jsx)(l,{svgKey:"rudderstack",...e}),criteo:e=>(0,a.jsx)(l,{svgKey:"criteo",...e}),firehose:e=>(0,a.jsx)(l,{svgKey:"aws",...e}),twilio:e=>(0,a.jsx)(l,{svgKey:"twilio",...e}),sendgrid:e=>(0,a.jsx)(l,{svgKey:"sendgrid",...e}),zenvia:e=>(0,a.jsx)(l,{svgKey:"zenvia",...e})},u={facebook_capi:s.ISX,meta_audience:s.ISX,tiktok:s.RNP,ga4:s.NTK,snapchat:s.kjT,pinterest:s.i5h,reddit:s.kDT,twitter:s.uQ_,posthog:s.rvq,mixpanel:s.LiW,hubspot:s.mnu,resend:s.y80,brevo:s.Dg_};function m(e){var t;let{id:n,className:s}=e,d=(0,o.WV)(n),l=c[n];if(l)return(0,a.jsx)(a.Fragment,{children:l({className:s})});let m=u[n];if(null==m?void 0:m.path)return(0,a.jsx)("svg",{role:"img","aria-hidden":!0,viewBox:"0 0 24 24",fill:"currentColor",className:(0,r.cn)(s,null==d?void 0:d.accent),children:(0,a.jsx)("path",{d:m.path})});let p=null!==(t=null==d?void 0:d.icon)&&void 0!==t?t:i.Z;return(0,a.jsx)(p,{className:(0,r.cn)(s,null==d?void 0:d.accent)})}},17733:function(e,t,n){n.d(t,{Q:function(){return i}});var a=n(57437),s=n(23882);function i(e){let{titulo:t,grupos:n,ativo:i,onSelecionar:r,className:o}=e;return(0,a.jsxs)("div",{className:(0,s.cn)("flex h-full w-64 shrink-0 flex-col overflow-hidden border-r border-border bg-sidebar",o),children:[(0,a.jsx)("div",{className:"flex min-h-12 shrink-0 items-center border-b border-border px-6",children:(0,a.jsx)("h4",{className:"truncate text-lg text-foreground",children:t})}),(0,a.jsx)("nav",{role:"menu","aria-label":t,"aria-orientation":"vertical",className:"grow overflow-y-auto",children:(0,a.jsx)("ul",{className:"flex flex-col",children:n.map((e,t)=>(0,a.jsxs)("li",{role:"none",children:[(0,a.jsxs)("div",{className:"my-4 mx-3",children:[e.title&&(0,a.jsx)("div",{className:"mb-2 px-3",children:(0,a.jsx)("span",{className:"font-mono text-sm uppercase text-muted-foreground",children:e.title})}),(0,a.jsx)("ul",{role:"none",children:e.items.map(e=>{let t=e.id===i;return(0,a.jsx)("li",{role:"none",children:(0,a.jsx)("button",{role:"menuitem","aria-current":t?"page":void 0,onClick:()=>r(e.id),className:(0,s.cn)("group my-px flex w-full cursor-pointer items-center rounded-md px-3 py-[3px] text-left transition-colors","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background","active:bg-sidebar-accent/50",t?"bg-sidebar-accent":"hover:bg-sidebar-accent/50"),children:(0,a.jsx)("span",{className:(0,s.cn)("w-full truncate text-sm transition",t?"font-semibold text-foreground":"font-normal text-muted-foreground group-hover:text-foreground"),children:e.label})})},e.id)})})]}),t!==n.length-1&&(0,a.jsx)("div",{className:"h-px w-full bg-border"})]},e.key))})})]})}},32585:function(e,t,n){n.d(t,{$:function(){return i}});var a=n(57437),s=n(23882);let i=e=>{let{className:t}=e;return(0,a.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:(0,s.cn)("animate-spin",t),children:(0,a.jsx)("path",{d:"M21 12a9 9 0 1 1-6.219-8.56"})})}},59095:function(e,t,n){n.d(t,{O:function(){return r}});var a=n(57437),s=n(23882);let i={success:"border border-primary/40 bg-primary/10 text-[hsl(153_60%_35%)] dark:text-primary",warning:"border border-amber-500/40 bg-amber-500/10 text-amber-700 dark:text-amber-400",error:"border border-destructive/40 bg-destructive/10 text-destructive",neutral:"bg-muted text-muted-foreground",info:"border border-border bg-background text-muted-foreground"};function r(e){let{tone:t="neutral",children:n,className:r}=e;return(0,a.jsx)("span",{className:(0,s.cn)("inline-flex items-center text-xs font-medium px-2 py-0.5 rounded whitespace-nowrap",i[t],r),children:n})}},39612:function(e,t,n){n.d(t,{OL:function(){return v},_T:function(){return m},aR:function(){return d},f$:function(){return f},fY:function(){return p},le:function(){return g},vW:function(){return l},xo:function(){return x},yT:function(){return h}});
1var a=n(57437),s=n(90277),i=n(2265),r=n(23882),o=n(79455);let d=s.fC,l=s.xz,c=s.h_,u=i.forwardRef((e,t)=>{let{className:n,...i}=e;return(0,a.jsx)(s.aV,{className:(0,r.cn)("fixed inset-0 z-[100] bg-black/80  data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",n),...i,ref:t})});u.displayName=s.aV.displayName;let m=i.forwardRef((e,t)=>{let{className:n,...i}=e;return(0,a.jsxs)(c,{children:[(0,a.jsx)(u,{}),(0,a.jsx)(s.VY,{ref:t,className:(0,r.cn)("fixed left-[50%] top-[50%] z-[100] grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",n),...i})]})});m.displayName=s.VY.displayName;let p=e=>{let{className:t,...n}=e;return(0,a.jsx)("div",{className:(0,r.cn)("flex flex-col space-y-2 text-center sm:text-left",t),...n})};p.displayName="AlertDialogHeader";let x=e=>{let{className:t,...n}=e;return(0,a.jsx)("div",{className:(0,r.cn)("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...n})};x.displayName="AlertDialogFooter";let f=i.forwardRef((e,t)=>{let{className:n,...i}=e;return(0,a.jsx)(s.Dx,{ref:t,className:(0,r.cn)("text-lg font-semibold",n),...i})});f.displayName=s.Dx.displayName;let h=i.forwardRef((e,t)=>{let{className:n,...i}=e;return(0,a.jsx)(s.dk,{ref:t,className:(0,r.cn)("text-sm text-muted-foreground",n),...i})});h.displayName=s.dk.displayName;let v=i.forwardRef((e,t)=>{let{className:n,variant:i,size:d,...l}=e;return(0,a.jsx)(s.aU,{ref:t,className:(0,r.cn)((0,o.d)({variant:i,size:d}),n),...l})});v.displayName=s.aU.displayName;let g=i.forwardRef((e,t)=>{let{className:n,...i}=e;return(0,a.jsx)(s.$j,{ref:t,className:(0,r.cn)((0,o.d)({variant:"outline"}),"mt-2 sm:mt-0",n),...i})});g.displayName=s.$j.displayName},79455:function(e,t,n){n.d(t,{d:function(){return l},z:function(){return c}});var a=n(57437),s=n(37053),i=n(90535),r=n(2265),o=n(23882),d=n(32585);let l=(0,i.j)("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-[13px] font-medium ring-offset-background transition-colors duration-200 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"border border-primary bg-[#72E3A8] text-foreground hover:bg-[#63d99b] dark:bg-[#006239] dark:text-[#EDEFEE] dark:border-[#3ECF8E]/30 dark:hover:bg-[#0a7448]",destructive:"border border-destructive/40 bg-destructive/15 text-foreground hover:border-destructive hover:bg-destructive/25 dark:bg-destructive/25 dark:hover:bg-destructive/40",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-[34px] px-3 py-2",sm:"h-[26px] rounded-md px-2.5 text-xs [&_svg]:size-3.5",xs:"h-6 rounded-md px-2 text-xs [&_svg]:size-3.5",lg:"h-[38px] rounded-md px-4",icon:"h-[34px] w-[34px]"}},defaultVariants:{variant:"default",size:"default"}}),c=r.forwardRef((e,t)=>{let{className:n,variant:i,size:r,asChild:c=!1,loading:u=!1,...m}=e,p=c?s.g7:"button";return u?(0,a.jsx)(p,{className:(0,o.cn)(l({variant:i,size:r,className:n})),disabled:!0,ref:t,...m,children:(0,a.jsx)("div",{className:"flex h-full items-center justify-center",children:(0,a.jsx)(d.$,{className:"h-5 w-5"})})}):(0,a.jsx)(p,{className:(0,o.cn)(l({variant:i,size:r,className:n})),ref:t,...m})});c.displayName="Button"},48954:function(e,t,n){n.d(t,{X:function(){return l}});var a=n(57437),s=n(9270),i=n(21047),r=n(30401),o=n(2265),d=n(23882);let l=o.forwardRef((e,t)=>
1{let{className:n,...o}=e;return(0,a.jsx)(s.fC,{ref:t,className:(0,d.cn)("peer flex h-4 w-4 shrink-0 items-center justify-center rounded-sm border border-border bg-background ring-offset-background","transition-colors duration-150 ease-in-out","hover:border-muted-foreground","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2","disabled:cursor-not-allowed disabled:opacity-50","data-[state=checked]:border-foreground data-[state=checked]:bg-foreground data-[state=checked]:text-background","data-[state=indeterminate]:border-foreground data-[state=indeterminate]:bg-foreground data-[state=indeterminate]:text-background",n),...o,children:(0,a.jsx)(s.z$,{className:"flex items-center justify-center text-current",children:"indeterminate"===o.checked?(0,a.jsx)(i.Z,{className:"h-3 w-3",strokeWidth:4}):(0,a.jsx)(r.Z,{className:"h-3 w-3",strokeWidth:4})})})});l.displayName=s.fC.displayName},28490:function(e,t,n){n.d(t,{$N:function(){return h},Be:function(){return v},GG:function(){return u},Vq:function(){return d},cN:function(){return f},cZ:function(){return p},fK:function(){return x},hg:function(){return l}});var a=n(57437),s=n(49027),i=n(32489),r=n(2265),o=n(23882);let d=s.fC,l=s.xz,c=s.h_,u=s.x8,m=r.forwardRef((e,t)=>{let{className:n,...i}=e;return(0,a.jsx)(s.aV,{ref:t,className:(0,o.cn)("fixed inset-0 z-[100] bg-black/40 backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",n),...i})});m.displayName=s.aV.displayName;let p=r.forwardRef((e,t)=>{let{className:n,children:r,loading:d=!1,...l}=e;return(0,a.jsxs)(c,{children:[(0,a.jsx)(m,{}),(0,a.jsxs)(s.VY,{ref:t,className:(0,o.cn)("fixed left-[50%] top-[50%] z-[100] grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-5 shadow-md duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",d&&"pointer-events-none opacity-75",n),...l,children:[r,(0,a.jsxs)(s.x8,{className:"absolute right-4 top-4 roun
1ded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[(0,a.jsx)(i.Z,{className:"h-4 w-4"}),(0,a.jsx)("span",{className:"sr-only",children:"Close"})]})]})]})});p.displayName=s.VY.displayName;let x=e=>{let{className:t,...n}=e;return(0,a.jsx)("div",{className:(0,o.cn)("flex flex-col space-y-1.5 text-center sm:text-left",t),...n})};x.displayName="DialogHeader";let f=e=>{let{className:t,...n}=e;return(0,a.jsx)("div",{className:(0,o.cn)("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...n})};f.displayName="DialogFooter";let h=r.forwardRef((e,t)=>{let{className:n,...i}=e;return(0,a.jsx)(s.Dx,{ref:t,className:(0,o.cn)("text-base font-medium leading-none tracking-tight",n),...i})});h.displayName=s.Dx.displayName;let v=r.forwardRef((e,t)=>{let{className:n,...i}=e;return(0,a.jsx)(s.dk,{ref:t,className:(0,o.cn)("text-sm text-muted-foreground",n),...i})});v.displayName=s.dk.displayName},25477:function(e,t,n){n.d(t,{_:function(){return l}});var a=n(57437),s=n(2265),i=n(6394),r=n(90535),o=n(23882);let d=(0,r.j)("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),l=s.forwardRef((e,t)=>{let{className:n,...s}=e;return(0,a.jsx)(i.f,{ref:t,className:(0,o.cn)(d(),n),...s})});l.displayName=i.f.displayName},13443:function(e,t,n){n.d(t,{E:function(){return o}});var a=n(57437),s=n(2265),i=n(60610),r=n(23882);let o=s.forwardRef((e,t)=>{let{className:n,value:s,...o}=e;return(0,a.jsx)(i.fC,{ref:t,className:(0,r.cn)("relative h-4 w-full overflow-hidden rounded-full bg-secondary",n),...o,children:(0,a.jsx)(i.z$,{className:"h-full w-full flex-1 bg-primary transition-all",style:{transform:"translateX(-".concat(100-(s||0),"%)")}})})});o.displayName=i.fC.displayName},63935:function(e,t,n){n.d(t,{Bw:function(){return h},DI:function(){return u},Ph:function(){return c},Ql:function(){return g},i4:function(){return p},ki:function(){return m},n5:function(){return v}});var a=n(57437),s=n(56873),i=n(40875),r=n(22135),o=n(30401),d=n(2265),l=n(23882);let c=s.fC,u=s.ZA,m=s.B4,p=d.forwardRef((e,t)=>{let{className:n,children:r,...o}=e;return(0,a.jsxs)(s.xz,{ref:t,className:(0,l.cn)("flex h-[34px] w-full items-center justify-between gap-2 rounded-md border border-input bg-background px-3 py-2 text-[13px] transition-colors duration-200 placeholder:text-muted-foreground focus:outline-none disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",n),...o,children:[r,(0,a.jsx)(s.JO,{asChild:!0,children:(0,a.jsx)(i.Z,{className:"h-4 w-4 shrink-0 text-muted-foreground",strokeWidth:1.5})})]})});p.displayName=s.xz.displayName;let x=d.forwardRef((e,t)=>{let{className:n,...i}=e;return(0,a.jsx)(s.u_,{ref:t,className:(0,l.cn)("flex cursor-default items-center justify-center py-1",n),...i,children:(0,a.jsx)(r.Z,{className:"h-4 w-4"})})});x.displayName=s.u_.displayName;let f=d.forwardRef((e,t)=>{let{className:n,...r}=e;return(0,a.jsx)(s.$G,{ref:t,className:(0,l.cn)("flex cursor-default items-center justify-center py-1",n),...r,children:(0,a.jsx)(i.Z,{className:"h-4 w-4"})})});f.displayName=s.$G.displayName;let h=d.forwardRef((e,t)=>{let{className:n,children:i,position:r="popper",...o}=e;return(0,a.jsx)(s.h_,{children:(0,a.jsxs)(s.VY,{ref:t,className:(0,l.cn)("relative z-[110] max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2","popper"===r&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",n),position:r,...o,children:[(0,a.jsx)(x,{}),(0,a.jsx)(s.l_,{className:(0,l.cn)("p-1","popper"===r&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:i}),(0,a.jsx)(f,{})]})})});h.displayName=s.VY.displayName;let v=d.forwardRef((e,t)=>
1{let{className:n,...i}=e;return(0,a.jsx)(s.__,{ref:t,className:(0,l.cn)("py-1.5 pl-8 pr-2 text-xs font-medium",n),...i})});v.displayName=s.__.displayName;let g=d.forwardRef((e,t)=>{let{className:n,children:i,...r}=e;return(0,a.jsxs)(s.ck,{ref:t,className:(0,l.cn)("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-[13px] outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",n),...r,children:[(0,a.jsx)("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:(0,a.jsx)(s.wU,{children:(0,a.jsx)(o.Z,{className:"h-4 w-4"})})}),(0,a.jsx)(s.eT,{children:i})]})});g.displayName=s.ck.displayName,d.forwardRef((e,t)=>{let{className:n,...i}=e;return(0,a.jsx)(s.Z0,{ref:t,className:(0,l.cn)("-mx-1 my-1 h-px bg-border",n),...i})}).displayName=s.Z0.displayName},18902:function(e,t,n){n.d(t,{RM:function(){return d},SC:function(){return l},iA:function(){return r},pj:function(){return u},ss:function(){return c},xD:function(){return o}});var a=n(57437),s=n(2265),i=n(23882);let r=s.forwardRef((e,t)=>{let{className:n,nativeClassName:s,...r}=e;return(0,a.jsx)("div",{className:(0,i.cn)("relative w-full overflow-auto",s),children:(0,a.jsx)("table",{ref:t,className:(0,i.cn)("w-full caption-bottom text-sm",n),...r})})});r.displayName="Table";let o=s.forwardRef((e,t)=>{let{className:n,...s}=e;return(0,a.jsx)("thead",{ref:t,className:(0,i.cn)("[&_tr]:border-b",n),...s})});o.displayName="TableHeader";let d=s.forwardRef((e,t)=>{let{className:n,...s}=e;return(0,a.jsx)("tbody",{ref:t,className:(0,i.cn)("[&_tr:last-child]:border-0",n),...s})});d.displayName="TableBody",s.forwardRef((e,t)=>{let{className:n,...s}=e;return(0,a.jsx)("tfoot",{ref:t,className:(0,i.cn)("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",n),...s})}).displayName="TableFooter";let l=s.forwardRef((e,t)=>{let{className:n,...s}=e;return(0,a.jsx)("tr",{ref:t,className:(0,i.cn)("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",n),...s})});l.displayName="TableRow";let c=s.forwardRef((e,t)=>{let{className:n,...s}=e;return(0,a.jsx)("th",{ref:t,className:(0,i.cn)("h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0",n),...s})});c.displayName="TableHead";let u=s.forwardRef((e,t)=>{let{className:n,...s}=e;return(0,a.jsx)("td",{ref:t,className:(0,i.cn)("p-4 align-middle [&:has([role=checkbox])]:pr-0",n),...s})});u.displayName="TableCell",s.forwardRef((e,t)=>{let{className:n,...s}=e;return(0,a.jsx)("caption",{ref:t,className:(0,i.cn)("mt-4 text-sm text-muted-foreground",n),...s})}).displayName="TableCaption"},43119:function(e,t,n){n.d(t,{TooltipProvider:function(){return o},_v:function(){return c},aJ:function(){return l},u:function(){return d}});
1var a=n(57437),s=n(61312),i=n(2265),r=n(23882);let o=s.zt,d=s.fC,l=s.xz,c=i.forwardRef((e,t)=>{let{className:n,sideOffset:i=4,...o}=e;return(0,a.jsx)(s.VY,{ref:t,sideOffset:i,className:(0,r.cn)("z-[110] overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-xs text-popover-foreground shadow-md animate-in fade-in-50 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[side=bottom]:slide-in-from-top-1 data-[side=left]:slide-in-from-right-1 data-[side=right]:slide-in-from-left-1 data-[side=top]:slide-in-from-bottom-1",n),...o})});c.displayName=s.VY.displayName},65252:function(e,t,n){n.d(t,{d:function(){return r}});var a=n(14447);let s=()=>(0,a.SV)()+"/api";async function i(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{method:n="GET",body:a}=t,i=e.startsWith("http")?e:"".concat(s()).concat(e),r=await fetch(i,{method:n,headers:{"Content-Type":"application/json"},body:void 0!==a?JSON.stringify(a):void 0,credentials:"include"});if(!r.ok){let e=await r.json().catch(()=>({}));throw Error(e.message||e.detail||"Actions API: ".concat(r.status," ").concat(r.statusText))}if(204===r.status||202===r.status)return;let o=await r.text();if(o&&""!==o.trim())return JSON.parse(o)}let r={listDestinations:e=>i("/projects/".concat(encodeURIComponent(e),"/actions/destinations/")),createDestination:(e,t)=>i("/projects/".concat(encodeURIComponent(e),"/actions/destinations/"),{method:"POST",body:t}),getDestination:(e,t)=>i("/projects/".concat(encodeURIComponent(e),"/actions/destinations/").concat(encodeURIComponent(t),"/")),updateDestination:(e,t,n)=>i("/projects/".concat(encodeURIComponent(e),"/actions/destinations/").concat(encodeURIComponent(t),"/"),{method:"PATCH",body:n}),deleteDestination:(e,t)=>i("/projects/".concat(encodeURIComponent(e),"/actions/destinations/").concat(encodeURIComponent(t),"/"),{method:"DELETE"}),listSubscriptions:(e,t)=>i("/projects/".concat(encodeURIComponent(e),"/actions/destinations/").concat(encodeURIComponent(t),"/subscriptions/")),createSubscription:(e,t,n)=>i("/projects/".concat(encodeURIComponent(e),"/actions/destinations/").concat(encodeURIComponent(t),"/subscriptions/"),{method:"POST",body:n}),deleteSubscription:(e,t,n)=>i("/projects/".concat(encodeURIComponent(e),"/actions/destinations/").concat(encodeURIComponent(t),"/subscriptions/").concat(encodeURIComponent(n),"/"),{method:"DELETE"}),getDestinationAudiences:(e,t)=>i("/projects/".concat(encodeURIComponent(e),"/actions/destinations/").concat(encodeURIComponent(t),"/audiences/")),getDestinationAudienceRuns(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},a=n.limit?"?limit=".concat(n.limit):"";return i("/projects/".concat(encodeURIComponent(e),"/actions/destinations/").concat(encodeURIComponent(t),"/audiences/runs/").concat(a))},listDeliveries(e,t){var n;let a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},s=new URLSearchParams;a.limit&&s.set("limit",String(a.limit)),(null===(n=a.subscription_ids)||void 0===n?void 0:n.length)&&s.set("subscription_ids",a.subscription_ids.join(","));let r=s.toString();return i("/projects/".concat(encodeURIComponent(e),"/actions/destinations/").concat(encodeURIComponent(t),"/deliveries/").concat(r?"?".concat(r):""))},getDeliverySummary(e,t){var n,a;let s=new URLSearchParams;return(null===(n=t.subscription_ids)||void 0===n?void 0:n.length)&&s.set("subscription_ids",t.subscription_ids.join(",")),(null===(a=t.destination_ids)||void 0===a?void 0:a.length)&&s.set("destination_ids",t.destination_ids.join(",")),t.period&&s.set("period",t.period),t.tz&&s.set("tz",t.tz),i("/projects/".concat(encodeURIComponent(e),"/actions/deliveries/summary/?").concat(s.toString()))},retryDeliveries:(e,t,n)=>i("/projects/".concat(encodeURIComponent(e),"/actions/destinations/").concat(encodeURIComponent(t),"/deliveries/retry/"),{method:"POST",body:n?{outbox_keys:n}:{}}),listHeldDeliveries(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:50;return i("/projects/".concat(encodeURIComponent(e),"/actions/destinations/").concat(encodeURIComponent(t),"/deliveries/held/?limit=").concat(n))},cancelHeldDeliveries:(e,t,n)=>i("/projects/".concat(encodeURIComponent(e),"/actions/destinations/").concat(encodeURIComponent(t),"/deliveries/cancel/"),{method:"POST",body:"all"in n?{all:!0}:{outbox_keys:n.outboxKeys}}),testDestination:(e,t)=>i("/projects/".concat(encodeURIComponent(e),"/actions/destinations/").concat(encodeURIComponent(t),"/test/"),{method:"POST",body:{}}),reactivateDestination:(e,t)=>i("/projects/".concat(encodeURIComponent(e),"/actions/destinations/").concat(encodeURIComponent(t),"/reactivate/"),{method:"POST",body:{}}),listAudit(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},a=new URLSearchParams;n.limit&&a.set("limit",String(n.limit)),n.offset&&a.set("offset",String(n.offset));let s=a.toString();return i("/projects/".concat(encodeURIComponent(e),"/actions/destinations/").concat(encodeURIComponent(t),"/audit/").concat(s?"?".concat(s):""))},updateSubscription:(e,t,n,a)=>i("/projects/".concat(encodeURIComponent(e),"/actions/destinations/").concat(encodeURIComponent(t),"/subscriptions/").concat(encodeURIComponent(n),"/"),{method:"PATCH",body:a}),listDiscovery(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},a=new URLSearchParams;n.days&&a.set("days",String(n.days));let s=a.toString();return i("/projects/".concat(encodeURIComponent(e),"/actions/destinations/").concat(encodeURIComponent(t),"/discovery/").concat(s?"?".concat(s):""))},listDeliveryStats(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},a=new URLSearchParams;n.hours&&a.set("hours",String(n.hours));let s=a.toString();return i("/projects/".concat(encodeURIComponent(e),"/actions/destinations/").concat(encodeURIComponent(t),"/deliveries/stats/").concat(s?"?".concat(s):""))},getEventSamples(e,t){var n;let a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},s=new URLSearchParams;return s.set("events",t.join(",")),a.limit&&s.set("limit",String(a.limit)),(null===(n=a.forms)||void 0===n?void 0:n.length)&&s.set("forms",a.forms.join(",")),i("/projects/".concat(encodeURIComponent(e),"/actions/event-samples/?").concat(s.toString()))},getPayloadProfile(e,t){var n;let a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},s=new URLSearchParams;return s.set("events",t.join(",")),a.days&&s.set("days",String(a.days)),(null===(n=a.forms)||void 0===n?void 0:n.length)&&s.set("forms",a.forms.join(",")),i("/projects/".concat(encodeURIComponent(e),"/actions/payload-profile/?").concat(s.toString()))},getHealth(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},a=new URLSearchParams;n.window&&a.set("window",n.window);let s=a.toString();return i("/projects/".concat(encodeURIComponent(e),"/actions/destinations/").concat(encodeURIComponent(t),"/health/").concat(s?"?".concat(s):""))},listPayloadSamples(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},a=new URLSearchParams;n.hours&&a.set("hours",String(n.hours));let s=a.toString();return i("/projects/".concat(encodeURIComponent(e),"/actions/destinations/").concat(encodeURIComponent(t),"/deliveries/payloads/").concat(s?"?".concat(s):""))},matchQuality(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},a=new URLSearchParams;n.hours&&a.set("hours",String(n.hours));let s=a.toString();return i("/projects/".concat(encodeURIComponent(e),"/actions/destinations/").concat(encodeURIComponent(t),"/match-quality/").concat(s?"?".concat(s):""))},getSemanticCatalog:e=>i("/projects/".concat(encodeURIComponent(e),"/pixel/semantic-catalog/")),getEventC
1ooccurrence:e=>i("/projects/".concat(encodeURIComponent(e),"/pixel/event-cooccurrence/")),approveEvent:(e,t,n)=>i("/projects/".concat(encodeURIComponent(e),"/actions/destinations/").concat(encodeURIComponent(t),"/approve/"),{method:"POST",body:n})}},19889:function(e,t,n){n.d(t,{$G:function(){return a.useTranslation},bU:function(){return a.useLocale},iA:function(){return a.localeTags},k1:function(){return a.locales},zM:function(){return a.localeLabelKeys}}),n(67774),n(96191);var a=n(59983)},65970:function(e,t,n){function a(e){return"".concat("cl.pipeline.mock.").concat(e)}function s(e){return"".concat("cl.destinations.mock.").concat(e)}function i(e){if(!o())return[];try{let t=window.localStorage.getItem(s(e));if(!t)return[];let n=JSON.parse(t);return Array.isArray(n)?n:[]}catch(e){return[]}}function r(e,t){o()&&window.localStorage.setItem(s(e),JSON.stringify(t))}function o(){return!!window.localStorage}function d(e){if(!o())return[];try{let t=window.localStorage.getItem(a(e));if(!t)return[];let n=JSON.parse(t);return Array.isArray(n)?n:[]}catch(e){return[]}}function l(e,t){o()&&window.localStorage.setItem(a(e),JSON.stringify(t))}function c(){return"undefined"!=typeof crypto&&"randomUUID"in crypto?"mock_".concat(crypto.randomUUID()):"mock_".concat(Date.now(),"_").concat(Math.floor(1e6*Math.random()))}function u(){return new Date().toISOString()}n.d(t,{P:function(){return m}});let m={list:e=>d(e),get:(e,t)=>d(e).find(e=>e.id===t),create(e,t){let n=d(e),a={id:c(),project_id:e,name:t.name,type:t.type,config:t.config,secret_keys:t.secretKeys,enabled:!0,created_at:u(),updated_at:u(),subscription:t.subscription,is_mock:!0};return l(e,[a,...n]),a},update(e,t,n){let a=d(e),s=a.findIndex(e=>e.id===t);if(-1===s)return;let i={...a[s],...n,updated_at:u()};return a[s]=i,l(e,a),i},remove(e,t){l(e,d(e).filter(e=>e.id!==t))},listDestinations:e=>i(e),getDestination:(e,t)=>i(e).find(e=>e.id===t),createDestination(e,t){let n=i(e),a={id:c(),project_id:e,name:t.name,type:t.type,config:t.config,secret_keys:t.secretKeys,enabled:!0,created_at:u(),updated_at:u(),is_mock:!0};return r(e,[a,...n]),a},updateDestination(e,t,n){let a=i(e),s=a.findIndex(e=>e.id===t);if(-1===s)return;let o={...a[s],...n,updated_at:u()};return a[s]=o,r(e,a),o},removeDestination(e,t){r(e,i(e).filter(e=>e.id!==t))},test:()=>({success:!1,http_status:0,latency_ms:0,response_body:"mock: destino ainda sem backend de envio"})}},48535:function(e,t,n){n.d(t,{OH:function(){return u},wA:function(){return m}});var a=n(2265),s=n(71632),i=n(8164),r=n(65252),o=n(87238),d=n(65970),l=n(51366);function c(e){var t;let n=(null!=e?e:{}).event_map;return n&&null!==(t=Object.values(n)[0])&&void 0!==t?t:""}function u(e){var t,n;return"".concat(e.persistedId,"|").concat(null!==(n=null===(t=e.groupMeta)||void 0===t?void 0:t.output_id)&&void 0!==n?n:"")}function m(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,{data:n,isLoading:m}=(0,s.a)({queryKey:["actions","destinations",e],queryFn:()=>r.d.listDestinations(e),enabled:!!e,staleTime:3e4}),p=(0,a.useMemo)(()=>{var e;return null!==(e=null==n?void 0:n.data)&&void 0!==e?e:[]},[n]),x=(0,i.h)({queries:p.map(t=>({queryKey:["actions","subscriptions",e,t.id],queryFn:()=>r.d.listSubscriptions(e,t.id),enabled:!!e&&!!t.id,staleTime:15e3}))}),f=x.some(e=>e.isLoading),h=(0,a.useMemo)(()=>{let e=new Set;for(let a of x){var t,n;for(let s of null!==(n=null===(t=a.data)||void 0===t?void 0:t.data)&&void 0!==n?n:[])"conversion.matched"===s.signal_type&&s.signal_source_id&&e.add(s.signal_source_id)}return Array.from(e).sort()},[x]),v=(0,i.h)({queries:h.map(t=>({queryKey:["features","nome-da-conversao",e,t],queryFn:()=>o.z.getFeature(e,t),enabled:!!e,staleTime:6e4,retry:!1}))}),g=(0,a.useMemo)(()=>{let e=new Map;return v.forEach((t,n)=>{var a;let s=null===(a=t.data)||void 0===a?void 0:a.name,i=h[n];s&&i&&e.set(i,s)}),e},[v,h]);return{groups:(0,a.useMemo)(()=>(function(e,t,n,a){var s,i,r,o,d,m,p,x,f,h,v,g,b,j,y;let N=[];for(let a of(e.forEach((e,n)=>{var a,s,i,r,o,d,u,m;let p=(null!==(a=t[n])&&void 0!==a?a:[]).filter(e=>"journey.step"!==e.signal_type),x=p.filter(e=>{var t;return(0,l.WI)(null!==(t=e.mapping_config)&&void 0!==t?t:null)}),f=x.length>0?x:p.slice(0,1),h=new Set(p.map(e=>{var t,n;return null===(t=(0,l.WI)(null!==(n=e.mapping_config)&&void 0!==n?n:null))||void 0===t?void 0:t.id}).filter(e=>!!e)).size<=1;for(let t of f){let n=null!==(r=null==t?void 0:t.mapping_config)&&void 0!==r?r:null;N.push({persistedId:e.id,isMock:!1,name:e.name,destinationType:null!==(o=null===(s=(null!=n?n:{}).pipeline)||void 0===s?void 0:s.destination_type)&&void 0!==o?o:e.type,destEvent:c(n),destinationEnabled:e.enabled,subscriptionEnabled:(null==t?void 0:t.enabled)!==!1,createdAt:e.created_at,mappingConfig:n,config:null!==(d=e.config)&&void 0!==d?d:{},signalType:null!==(u=null==t?void 0:t.signal_type)&&void 0!==u?u:"",signalSourceId:null!==(m=null==t?void 0:t.signal_source_id)&&void 0!==m?m:null,groupMeta:(0,l.WI)(n),subscriptionIds:t?[t.id]:[],ownedDestination:(null===(i=(null!=n?n:{}).pipeline)||void 0===i?void 0:i.owned_destination)!==!1,destinationExclusive:h})}}),n)){let e=a.subscription.mapping_config;N.push({persistedId:a.id,isMock:!0,name:a.name,destinationType:a.type,destEvent:c(e),destinationEnabled:a.enabled,subscriptionEnabled:a.enabled,createdAt:a.created_at,mappingConfig:e,config:a.config,signalType:a.subscription.signal_type,signalSourceId:null!==(s=a.subscription.signal_source_id)&&void 0!==s?s:null,groupMeta:(0,l.WI)(e),subscriptionIds:[],ownedDestination:!0,destinationExclusive:!0})}let w=new Map,_=new Map;for(let e of N){let t=null!==(p=null!==(m=null!==(d="conversion.matched"===e.signalType?e.signalSourceId:null)&&void 0!==d?d:null===(i=e.groupMeta)||void 0===i?void 0:i.conversion_id)&&void 0!==m?m:null===(r=e.groupMeta)||void 0===r?void 0:r.id)&&void 0!==p?p:"single:".concat(e.persistedId),n=null!==(x=null===(o=e.groupMeta)||void 0===o?void 0:o.source_ids)&&void 0!==x?x:e.signalSourceId?[e.signalSourceId]:[],a=w.get(t);if(a){for(let t of(a.outputs.push(e),n))a.signalSourceIds.includes(t)||a.signalSourceIds.push(t);e.createdAt<a.createdAt&&(a.createdAt=e.createdAt),(null===(f=e.groupMeta)||void 0===f?void 0:f.name)&&e.createdAt<(null!==(h=_.get(t))&&void 0!==h?h:"")&&(a.name=e.groupMeta.name,_.set(t,e.createdAt))}else{let a=(0,l.z_)(e.groupMeta,e.destEvent);w.set(t,{id:t,name:null!==(g=null===(v=e.groupMeta)||void 0===v?void 0:v.name)&&void 0!==g?g:e.name,originEvent:null!==(b=a[0])&&void 0!==b?b:"",originEvents:a,signalSourceIds:[...n],createdAt:e.createdAt,outputs:[e]}),_.set(t,e.createdAt)}}if(a)for(let e of w.values()){let t=a.get(e.id);t&&(e.name=t)}for(let e of w.values()){let t=new Map;e.outputs=e.outputs.filter(e=>{let n=t.get(u(e));if(n){for(let t of e.subscriptionIds)n.subscriptionIds.includes(t)||n.subscriptionIds.push(t);return n.subscriptionEnabled=n.subscriptionEnabled&&e.subscriptionEnabled,!1}return t.set(u(e),e),!0})}let k=new Map;for(let e of w.values())for(let t of e.outputs)k.set(t.persistedId,(null!==(j=k.get(t.persistedId))&&void 0!==j?j:0)+1);for(let e of w.values())for(let t of e.outputs)(null!==(y=k.get(t.persistedId))&&void 0!==y?y:0)>1&&(t.destinationExclusive=!1);return Array.from(w.values()).sort((e,t)=>
1e.createdAt<t.createdAt?1:-1)})(p,p.map((e,t)=>{var n,a,s;return null!==(s=null===(a=x[t])||void 0===a?void 0:null===(n=a.data)||void 0===n?void 0:n.data)&&void 0!==s?s:[]}),d.P.list(e),g),[p,x,e,t,g]),isLoading:m||f}}},56514:function(e,t,n){n.d(t,{CV:function(){return r},NU:function(){return s},Zg:function(){return o},_8:function(){return l},wi:function(){return d}});var a=n(99199);function s(){let e=(0,a.i)(e=>e.project);return(null==e?void 0:e.timezone)||"America/Sao_Paulo"}let i=/^\d{4}-\d{2}-\d{2}[T ]\d{2}:\d{2}(:\d{2}(\.\d+)?)?$/;function r(e,t){var n;let a,{timeZone:s,locale:r="pt-BR",...o}=t,d=null==e?null:Number.isNaN((a=e instanceof Date?e:new Date("string"==typeof e?(n=e.trim(),i.test(n)?"".concat(n.replace(" ","T"),"Z"):n):e)).getTime())?null:a;if(!d)return"";try{return new Intl.DateTimeFormat(r,{timeZone:s,...o}).format(d)}catch(e){return new Intl.DateTimeFormat(r,o).format(d)}}function o(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"pt-BR";return r(e,{timeZone:t,locale:n,hour:"2-digit",minute:"2-digit"})}function d(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"pt-BR";return r(e,{timeZone:t,locale:n,day:"2-digit",month:"short",year:"numeric",hour:"2-digit",minute:"2-digit"})}function l(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"pt-BR",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new Date;try{var a,s;let i=new Intl.DateTimeFormat(t,{timeZone:e,timeZoneName:"short"}).formatToParts(n);return null!==(s=null===(a=i.find(e=>"timeZoneName"===e.type))||void 0===a?void 0:a.value)&&void 0!==s?s:""}catch(e){return""}}},14447:function(e,t,n){n.d(t,{Lp:function(){return o},SV:function(){return i},a6:function(){return r}});var a=n(74537),s=n(19090);function i(){return""}n(25566);let r=(0,a.ec)({}),o=r.createClient({links:[(0,s.N8)({url:"/api"})]})},51768:function(e,t,n){n.d(t,{k:function(){return a}});let a=(0,n(97094).Ue)(e=>({tasks:[],minimized:!1,addTask:(t,n)=>e(e=>({tasks:[...e.tasks,{id:t,label:n,status:"pending",progress:0,createdAt:Date.now()}],minimized:!1})),updateTask:(t,n)=>e(e=>({tasks:e.tasks.map(e=>e.id===t?{...e,...n}:e)})),removeTask:t=>e(e=>({tasks:e.tasks.filter(e=>e.id!==t)})),clearDone:()=>e(e=>({tasks:e.tasks.filter(e=>"done"!==e.status&&"error"!==e.status)})),setMinimized:t=>e({minimized:t})}))},60610:function(e,t,n){n.d(t,{fC:function(){return j},z$:function(){return y}});var a=n(2265),s=n(73966),i=n(66840),r=n(57437),o="Progress",[d,l]=(0,s.b)(o),[c,u]=d(o),m=a.forwardRef((e,t)=>{var n,a,s,o;let{__scopeProgress:d,value:l=null,max:u,getValueLabel:m=f,...p}=e;(u||0===u)&&!g(u)&&console.error((n="".concat(u),a="Progress","Invalid prop `max` of value `".concat(n,"` supplied to `").concat(a,"`. Only numbers greater than 0 are valid max values. Defaulting to `").concat(100,"`.")));let x=g(u)?u:100;null===l||b(l,x)||console.error((s="".concat(l),o="Progress","Invalid prop `value` of value `".concat(s,"` supplied to `").concat(o,"`. The `value` prop must be:\n  - a positive number\n  - less than the value passed to `max` (or ").concat(100," if no `max` prop is set)\n  - `null` or `undefined` if the progress is indeterminate.\n\nDefaulting to `null`.")));let j=b(l,x)?l:null,y=v(j)?m(j,x):void 0;return(0,r.jsx)(c,{scope:d,value:j,max:x,children:(0,r.jsx)(i.WV.div,{"aria-valuemax":x,"aria-valuemin":0,"aria-valuenow":v(j)?j:void 0,"aria-valuetext":y,role:"progressbar","data-state":h(j,x),"data-value":null!=j?j:void 0,"data-max":x,...p,ref:t})})});m.displayName=o;var p="ProgressIndicator",x=a.forwardRef((e,t)=>{var n;let{__scopeProgress:a,...s}=e,o=u(p,a);return(0,r.jsx)(i.WV.div,{"data-state":h(o.value,o.max),"data-value":null!==(n=o.value)&&void 0!==n?n:void 0,"data-max":o.max,...s,ref:t})});function f(e,t){return"".concat(Math.round(e/t*100),"%")}function h(e,t){return null==e?"indeterminate":e===t?"complete":"loading"}function v(e){return"number"==typeof e}function g(e){return v(e)&&!isNaN(e)&&e>0}function b(e,t){return v(e)&&!isNaN(e)&&e<=t&&e>=0}x.displayName=p;var j=m,y=x}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.