(function(){"use strict";const f=(...e)=>console.log("[ZV:FuncoesNovas]",...e),G="ZV:zvMentionOverride",A="ZV:zvRecurrencePending",V="ZV:zvZapSaverExtra",j="ZV:zvBulkGroups",te={exportMode:"agenda",selectedLabelIds:[],selectedGroupIds:[]};window.__ZV_bulkGroupIds=window.__ZV_bulkGroupIds||[];function z(e){return new Promise(t=>{chrome.storage.local.get(e,r=>t(r[e]))})}function v(e){return new Promise(t=>{chrome.storage.local.set(e,t)})}async function N(){const e=await z(G);return e&&typeof e=="object"?e:{enabled:!1,bulk:!1}}async function ne(e){const r={...await N(),...e};await v({[G]:r}),window.__ZV_mentionSync={send:!!r.enabled,bulk:!!r.bulk}}window.__ZV_mentionSync={send:!1,bulk:!1},N().then(e=>{window.__ZV_mentionSync={send:!!e.enabled,bulk:!!e.bulk}});async function p(){const e=await z(V);return{...te,...e||{}}}async function g(e){const t=await p();await v({[V]:{...t,...e}})}async function W(){const e=await z(j);return Array.isArray(e)?e:[]}async function re(e){window.__ZV_bulkGroupIds=e,await v({[j]:e})}W().then(e=>{window.__ZV_bulkGroupIds=e});const ae=6e4,oe=400;function F(e,t){try{const r=document.documentElement.getAttribute(e);return r?JSON.parse(r):t}catch{return t}}function b(){return document.documentElement.getAttribute("data-zv-wpp-ready")==="1"}function R(){return F("data-zv-groups",[])}function U(){return F("data-zv-labels",[])}function E(){document.dispatchEvent(new CustomEvent("zv:req-refresh-groups"))}function x(e=ae){return b()?Promise.resolve(!0):(E(),new Promise(t=>{const r=Date.now();let n=0;const a=i=>{clearInterval(c),document.removeEventListener("zv:groups-updated",o),t(i)},o=()=>{b()&&a(!0)};document.addEventListener("zv:groups-updated",o);const c=setInterval(()=>{if(b()){a(!0);return}const i=Date.now()-r;i-n>=4e3&&(n=i,E()),i>=e&&a(!1)},oe)}))}async function $(){return await x(45e3),R()}async function ce(){return await x(45e3),U()}function ie(){if(!b()){const t=document.documentElement.getAttribute("data-zv-wpp-bridge-status");try{const r=t?JSON.parse(t):null;if(r?.phase==="waiting")return"Aguardando WhatsApp carregar\u2026";if(r?.phase==="timeout")return"WhatsApp demorou para carregar. Recarregue a p\xE1gina (F5)."}catch{}return"Aguardando lista de grupos\u2026"}return R().length===0?"Nenhum grupo encontrado nesta conta.":""}async function se(e){const t="exp-"+Date.now(),r="data-zv-export-result-"+t;document.documentElement.removeAttribute(r),document.dispatchEvent(new CustomEvent("zv:req-export",{detail:{...e,requestId:t}}));const n=Date.now();return new Promise(a=>{const o=setInterval(()=>{const c=document.documentElement.getAttribute(r);if(c){clearInterval(o);try{a(JSON.parse(c))}catch{a({ok:!1,contacts:[],error:"parse"})}return}Date.now()-n>=2e4&&(clearInterval(o),a({ok:!1,contacts:[],error:"timeout"}))},200)})}function H(e){document.querySelectorAll("#"+e).forEach((t,r)=>{r>0&&t.remove()})}function S(){const e=document.querySelector('[data-state="active"][value]')?.getAttribute("value")||"";return e.includes("ZapSaver")||e.includes("zapsaver")?!0:!!document.querySelector('button[data-state="active"]')?.textContent?.includes("ZapSaver")}const J="zv-funcoes-novas-style";function w(){if(document.getElementById(J))return;const e=document.createElement("style");e.id=J,e.textContent=`
      .zv-fn-li {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        gap: 1.25rem;
        padding: 0.5rem 0.5rem;
      }
      @media (min-width: 768px) { .zv-fn-li { padding: 1rem 0.5rem; } }
      .zv-fn-li-label {
        display: flex;
        width: 10rem;
        gap: 0.75rem;
        font-size: 0.875rem;
        font-weight: 700;
        color: inherit;
        flex-shrink: 0;
      }
      .zv-fn-li-body {
        flex: 1;
        min-width: 0;
        font-size: 0.875rem;
        font-weight: 300;
      }
      .zv-fn-panel {
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
        margin: 0.5rem 0;
      }
      .zv-fn-panel strong { font-size: 0.875rem; }
      .zv-fn-field {
        width: 100%;
        border: none;
        background: var(--zv-main-bg, hsl(var(--main-background, 240 6% 10%)));
        background-color: color-mix(in srgb, currentColor 4%, transparent);
        padding: 0.5rem 0.75rem;
        border-radius: 0.375rem;
        font-size: 0.875rem;
        color: inherit;
        outline: none;
      }
      .zv-fn-field:focus-visible {
        box-shadow: 0 0 0 1px hsl(var(--ring, 240 5% 65%));
      }
      .zv-fn-select {
        appearance: none;
        cursor: pointer;
      }
      .zv-fn-check-row {
        display: flex;
        align-items: center;
        gap: 0.5rem;
        cursor: pointer;
        font-size: 0.875rem;
        font-weight: 500;
      }
      .zv-fn-check-row input { width: 1rem; height: 1rem; cursor: pointer; accent-color: hsl(220 90% 56%); }
      .zv-fn-hint { font-size: 0.75rem; opacity: 0.65; margin-top: 0.25rem; }
      .zv-fn-number {
        display: inline-flex;
        align-items: stretch;
        border: 1px solid hsl(var(--input, 240 4% 46%));
        border-radius: 0.375rem;
        overflow: hidden;
        background: hsl(var(--background, 240 6% 10%));
        box-shadow: 0 1px 2px rgba(0,0,0,.15);
      }
      .zv-fn-number input {
        width: 3rem;
        border: none;
        background: transparent;
        text-align: center;
        font-size: 1rem;
        padding: 0.75rem 0.25rem;
        color: inherit;
        -moz-appearance: textfield;
      }
      .zv-fn-number input::-webkit-outer-spin-button,
      .zv-fn-number input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
      .zv-fn-number-btns {
        display: flex;
        flex-direction: column;
        border-left: 1px solid hsl(var(--input, 240 4% 46%));
        width: 1.5rem;
      }
      .zv-fn-number-btns button {
        flex: 1;
        border: none;
        background: transparent;
        color: inherit;
        cursor: pointer;
        font-size: 0.65rem;
        padding: 0;
        line-height: 1;
      }
      .zv-fn-number-btns button:hover { background: color-mix(in srgb, currentColor 8%, transparent); }
      .zv-fn-times-grid { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.5rem; }
      .zv-fn-times-grid input[type="time"] { width: auto; min-width: 7rem; }
      .zv-fn-multibox {
        max-height: 10rem;
        overflow-y: auto;
        border-radius: 0.375rem;
        padding: 0.5rem;
        background: color-mix(in srgb, currentColor 4%, transparent);
        display: flex;
        flex-direction: column;
        gap: 0.35rem;
      }
      .zv-fn-multibox label {
        display: flex;
        align-items: center;
        gap: 0.5rem;
        font-size: 0.8125rem;
        cursor: pointer;
        font-weight: 400;
      }
      .zv-fn-radio-group {
        display: flex;
        flex-direction: column;
        gap: 0.35rem;
        padding: 0.375rem;
        border-radius: 0.375rem;
        background: color-mix(in srgb, currentColor 4%, transparent);
      }
      .zv-fn-radio-group label {
        display: flex;
        align-items: center;
        gap: 0.5rem;
        font-size: 0.875rem;
        cursor: pointer;
      }
    `,document.head.appendChild(e)}function K(e,t){const r=document.createElement("li");r.className="zv-fn-li";const n=document.createElement("div");n.className="zv-fn-li-label",n.textContent=e;const a=document.createElement("div");return a.className="zv-fn-li-body",a.appendChild(t),r.append(n,a),r}function le({value:e=1,min:t=1,max:r=24,hint:n="",onChange:a}){const o=document.createElement("div");o.style.display="flex",o.style.alignItems="center",o.style.gap="0.75rem";const c=document.createElement("div");c.className="zv-fn-number";const i=document.createElement("input");i.type="number",i.min=String(t),i.max=String(r),i.value=String(e);const d=document.createElement("div");d.className="zv-fn-number-btns";const s=document.createElement("button");s.type="button",s.textContent="\u25B2";const m=document.createElement("button");m.type="button",m.textContent="\u25BC";const u=()=>{let l=parseInt(i.value,10);Number.isNaN(l)&&(l=t),l=Math.max(t,Math.min(r,l)),i.value=String(l),a?.(l)};if(s.addEventListener("click",()=>{i.value=String(Math.min(r,parseInt(i.value,10)+1||t)),u()}),m.addEventListener("click",()=>{i.value=String(Math.max(t,(parseInt(i.value,10)||t)-1)),u()}),i.addEventListener("change",u),i.addEventListener("input",u),d.append(s,m),c.append(i,d),o.appendChild(c),n){const l=document.createElement("span");l.className="zv-fn-hint",l.textContent=n,o.appendChild(l)}return{el:o,input:i,setValue:l=>{i.value=String(l),u()}}}function _(){const e=document.querySelector('[role="dialog"] input[type="datetime-local"], ul.divide-y input[type="datetime-local"]');if(!e?.value)return"09:00";const t=e.value.split("T")[1];return t?t.slice(0,5):"09:00"}function de(){const e=new Date;return e.setMinutes(e.getMinutes()-e.getTimezoneOffset()),e.toISOString().slice(0,16)}const ue="zv-ghost-mention-all";function me(){return(document.documentElement.getAttribute("data-zv-active-chat")||"").includes("@g.us")}function Y(e,{bulk:t=!1}={}){const r=ue+(t?"-bulk":"");if(!e||e.querySelector("#"+r)||!t&&!me())return;const n=document.createElement("label");n.className="zv-fn-check-row",n.innerHTML=`<input type="checkbox" id="${r}" /><span>Marcar todos ocultamente</span>`,e.appendChild(n);const a=n.querySelector("input");a.addEventListener("change",()=>ne(t?{bulk:a.checked}:{enabled:a.checked})),N().then(o=>{a.checked=t?!!o.bulk:!!o.enabled})}function pe(){return Array.from(document.querySelectorAll('[role="dialog"]')).find(e=>{const t=e.textContent||"";return t.includes("Confirma\xE7\xE3o de agendamento")||t.includes("Data de agendamento")})}function fe(e){e.querySelector("#zv-recurrence-enabled")?.closest("li")?.remove(),e.querySelector("#zv-recurrence-detail-li")?.remove()}function we(){const e=pe();if(!e)return;const t=e.querySelector("ul.divide-y");if(!t||(w(),t.querySelector("#zv-recurrence-enabled")))return;fe(t);const n=Array.from(t.children).find(o=>(o.textContent||"").includes("T\xE9rmino")),a=ve();n?t.insertBefore(a,n):t.appendChild(a),t.querySelectorAll('input[type="datetime-local"]').forEach(o=>{o.dataset.zvRecDtHook||(o.dataset.zvRecDtHook="1",o.addEventListener("change",()=>{if(document.getElementById("zv-recurrence-enabled")?.checked){const c=document.querySelector('#zv-recurrence-times-grid input[type="time"]');c&&!c.dataset.userEdited&&(c.value=_()),k()}}))})}function ve(){const e=document.createDocumentFragment(),t=document.createElement("label");t.className="zv-fn-check-row",t.innerHTML='<input type="checkbox" id="zv-recurrence-enabled" /><span>Repetir agendamento</span>';const r=document.createElement("div");r.id="zv-recurrence-fields",r.style.display="none";const n=document.createElement("select");n.id="zv-recurrence-frequency",n.className="zv-fn-field zv-fn-select",n.innerHTML=`
      <option value="daily" selected>Di\xE1rio</option>
      <option value="weekly">Semanal</option>
      <option value="biweekly">Quinzenal</option>
      <option value="monthly">Mensal</option>
    `;const a=document.createElement("div");a.id="zv-recurrence-daily-wrap";const o=le({value:1,min:1,max:24,hint:"vezes ao dia",onChange:d});a.appendChild(o.el);const c=document.createElement("div");c.id="zv-recurrence-times-grid",c.className="zv-fn-times-grid";const i=document.createElement("input");i.type="datetime-local",i.id="zv-recurrence-end-date",i.className="zv-fn-field",i.min=de(),r.append(Object.assign(document.createElement("p"),{className:"zv-fn-hint",textContent:"Frequ\xEAncia"}),n,a,c,Object.assign(document.createElement("p"),{className:"zv-fn-hint",style:"margin-top:0.75rem",textContent:"Data fim (opcional)"}),i);function d(){if(c.innerHTML="",n.value!=="daily")return;const u=parseInt(o.input.value,10)||1,l=_();for(let Z=0;Z<u;Z++){const h=document.createElement("input");h.type="time",h.className="zv-fn-field",h.value=Z===0?l:"",h.addEventListener("change",k),c.appendChild(h)}k()}function s(){const u=document.getElementById("zv-recurrence-enabled")?.checked;r.style.display=u?"block":"none",a.style.display=n.value==="daily"?"block":"none",u?d():D(null)}n.addEventListener("change",s),i.addEventListener("change",k),t.querySelector("input").addEventListener("change",()=>{const u=document.getElementById("zv-recurrence-detail-li");u&&(u.style.display=t.querySelector("input").checked?"":"none"),s()}),e.appendChild(K("Repetir",t));const m=K("Recorr\xEAncia",r);return m.id="zv-recurrence-detail-li",m.style.display="none",e.appendChild(m),e}function k(){if(!document.getElementById("zv-recurrence-enabled")?.checked){D(null);return}const t=document.getElementById("zv-recurrence-frequency")?.value||"daily",r=parseInt(document.querySelector(".zv-fn-number input")?.value||"1",10)||1,n=Array.from(document.querySelectorAll('#zv-recurrence-times-grid input[type="time"]')).map(c=>c.value).filter(Boolean),a=document.getElementById("zv-recurrence-end-date")?.value,o=a?a.split("T")[0]:null;D({enabled:!0,frequency:t,timesPerDay:t==="daily"?r:1,timesOfDay:n.length?n:[_()],endDate:o,seriesId:window.__ZV_recurrenceSeriesId||(window.__ZV_recurrenceSeriesId="zv-series-"+Date.now())})}async function D(e){await v({[A]:e})}const C="zv-bulk-groups-panel";let M=!1;function ge(){H(C)}function y(e,t,r,{emptyText:n,onRefresh:a}={}){const o=document.createElement("div");if(o.className="zv-fn-multibox",!e.length){const c=document.createElement("p");if(c.className="zv-fn-hint",c.textContent=n||ie()||"Nenhum grupo encontrado. Clique em Atualizar lista.",o.appendChild(c),a){const i=document.createElement("button");i.type="button",i.className="zv-fn-field",i.style.marginTop="0.5rem",i.style.cursor="pointer",i.textContent="Atualizar lista",i.addEventListener("click",a),o.appendChild(i)}return o}return e.forEach(c=>{const i=document.createElement("label"),d=document.createElement("input");d.type="checkbox",d.value=c.id,d.checked=t.includes(c.id),d.addEventListener("change",()=>{const s=Array.from(o.querySelectorAll("input:checked")).map(m=>m.value);r(s)}),i.append(d,document.createTextNode(c.name)),o.appendChild(i)}),o}function be(e,t,r){e.innerHTML="",e.className="zv-fn-panel";const n=document.createElement("strong"),a=document.createElement("span");a.className="text-primary",a.textContent=String(r.length),n.append("Grupos para o disparo (",a,"):");const o=y(t,r,async c=>{a.textContent=String(c.length),await re(c)},{onRefresh:async()=>{E(),await x(15e3),e.dataset.zvStale="1",L(!0)}});e.append(n,o),delete e.dataset.zvStale,delete e.dataset.zvLoading}async function L(e=!1){ge();const t=document.getElementById(C);if(t&&!e&&!t.dataset.zvStale&&t.dataset.zvLoading!=="1"||M)return;const r=Array.from(document.querySelectorAll("strong")).find(a=>(a.textContent||"").includes("N\xFAmeros para o disparo"));if(!r)return;w(),M=!0;let n=t;n?(n.dataset.zvLoading="1",n.textContent="Carregando grupos..."):(n=document.createElement("div"),n.id=C,n.dataset.zvLoading="1",n.className="zv-fn-panel",n.textContent="Carregando grupos...",r.parentElement.insertBefore(n,r));try{const[a,o]=await Promise.all([$(),W()]);be(n,a,o)}catch(a){f("injectBulkGroups",a),n.textContent="Erro ao carregar grupos. Clique em Atualizar lista.",n.dataset.zvStale="1"}finally{M=!1}}const I="zv-zapsaver-export-modes";let B=!1;async function q(e,t){E(),await x(15e3);const r=U(),n=R(),a=e.querySelector("#zv-export-labels-wrap"),o=e.querySelector("#zv-export-groups-wrap");a&&(a.querySelectorAll(".zv-fn-multibox, p.zv-fn-hint").forEach(c=>c.remove()),a.prepend(Object.assign(document.createElement("p"),{className:"zv-fn-hint",textContent:"Selecione as etiquetas"}),y(r,t.selectedLabelIds,c=>g({selectedLabelIds:c}),{emptyText:"Nenhuma etiqueta encontrada.",onRefresh:()=>p().then(c=>q(e,c))}))),o&&(o.querySelectorAll(".zv-fn-multibox, p.zv-fn-hint").forEach(c=>c.remove()),o.prepend(Object.assign(document.createElement("p"),{className:"zv-fn-hint",textContent:"Selecione os grupos"}),y(n,t.selectedGroupIds,c=>g({selectedGroupIds:c}),{onRefresh:()=>p().then(c=>q(e,c))})))}function ye(e,t,r,n){e.innerHTML="",e.className="zv-fn-panel";const a=document.createElement("label");a.className="zv-fn-hint",a.textContent="Modo de exporta\xE7\xE3o";const o=document.createElement("div");o.className="zv-fn-radio-group",[{v:"agenda",t:"Agenda (contatos n\xE3o salvos)"},{v:"labels",t:"Por etiqueta"},{v:"groups",t:"Por grupo"}].forEach(({v:s,t:m})=>{const u=document.createElement("label"),l=document.createElement("input");l.type="radio",l.name="zv-export-mode",l.value=s,l.checked=t.exportMode===s,u.append(l,document.createTextNode(m)),o.appendChild(u)});const c=document.createElement("div");c.id="zv-export-labels-wrap",c.style.display=t.exportMode==="labels"?"block":"none",c.append(Object.assign(document.createElement("p"),{className:"zv-fn-hint",textContent:"Selecione as etiquetas"}),y(r,t.selectedLabelIds,s=>g({selectedLabelIds:s}),{emptyText:"Nenhuma etiqueta encontrada.",onRefresh:()=>p().then(s=>q(e,s))}));const i=document.createElement("div");i.id="zv-export-groups-wrap",i.style.display=t.exportMode==="groups"?"block":"none",i.append(Object.assign(document.createElement("p"),{className:"zv-fn-hint",textContent:"Selecione os grupos"}),y(n,t.selectedGroupIds,s=>g({selectedGroupIds:s}),{onRefresh:()=>p().then(s=>q(e,s))}));function d(){const s=o.querySelector("input:checked")?.value||"agenda";c.style.display=s==="labels"?"block":"none",i.style.display=s==="groups"?"block":"none";const m=Array.from(c.querySelectorAll("input:checked")).map(l=>l.value),u=Array.from(i.querySelectorAll("input:checked")).map(l=>l.value);g({exportMode:s,selectedLabelIds:m,selectedGroupIds:u})}o.querySelectorAll("input").forEach(s=>s.addEventListener("change",d)),e.append(a,o,c,i),delete e.dataset.zvLoading,delete e.dataset.zvStale}async function O(e=!1){if(!S())return;H(I);const t=document.getElementById(I);if(t&&!e&&!t.dataset.zvStale&&t.dataset.zvLoading!=="1"||B)return;const r=document.querySelector('[name="zapsaver-prefix"]')?.closest(".flex.flex-col")||Array.from(document.querySelectorAll("button")).find(a=>(a.textContent||"").includes("Exportar contatos"))?.parentElement;if(!r)return;w(),B=!0;let n=t;if(n)n.dataset.zvLoading="1",n.textContent="Carregando...";else{n=document.createElement("div"),n.id=I,n.dataset.zvLoading="1",n.className="zv-fn-panel",n.textContent="Carregando...";const a=r.querySelector("button");a?.textContent?.includes("Exportar")?a.insertAdjacentElement("afterend",n):r.insertBefore(n,r.firstChild?.nextSibling||r.firstChild)}if(!r.querySelector("button")?.dataset.zvPatched){const a=r.querySelector("button");a&&(a.dataset.zvPatched="1",a.addEventListener("click",async function(o){const c=await p();c.exportMode!=="agenda"&&(o.stopImmediatePropagation(),o.preventDefault(),await he(c))},!0))}try{const a=await p(),[o,c]=await Promise.all([ce(),$()]);ye(n,a,o,c)}catch(a){f("injectZapSaverModes",a),n.textContent="Erro ao carregar. Clique em Atualizar lista nos grupos.",n.dataset.zvStale="1"}finally{B=!1}}async function he(e){const t=document.querySelector('[name="zapsaver-prefix"]')?.value||"",r=document.querySelector("#zapsaver-vcard-type-file-inp")?.checked?"vcard":"csv",n=await se({mode:e.exportMode,labelIds:e.selectedLabelIds,groupIds:e.selectedGroupIds,prefix:t});if(!n.ok){alert(n.error||"WhatsApp ainda n\xE3o est\xE1 pronto. Aguarde e tente novamente.");return}const a=n.contacts||[];if(!a.length){alert("Nenhum contato encontrado. Verifique etiquetas/grupos selecionados.");return}const o=new Date().toLocaleDateString("pt-BR").replace(/\//g,"-");if(r==="vcard"){const c=a.map(s=>`BEGIN:VCARD
VERSION:3.0
N:${s.name}
FN:${s.name}
TEL;TYPE=VOICE,CELL:${s.number}
END:VCARD
`).join(""),i=new Blob([c],{type:"text/vcard"}),d=document.createElement("a");d.href=URL.createObjectURL(i),d.download=`${a.length}_contatos_(${o}).vcf`,d.click()}else{const c=`\uFEFFFirst Name,Mobile Phone
`+a.map(s=>`${String(s.name).replace(/,/g,"")},${s.number}`).join(`
`),i=new Blob([c],{type:"text/csv"}),d=document.createElement("a");d.href=URL.createObjectURL(i),d.download=`${a.length}_contatos_(${o}).csv`,d.click()}f("exported",a.length,e.exportMode)}function ze(){w(),document.querySelectorAll('[role="dialog"]').forEach(t=>{const r=t.textContent||"";if(!r.includes("Destinat\xE1rio")&&!r.includes("agendamento"))return;const n=t.querySelector("ul.divide-y");n&&Y(n)});const e=Array.from(document.querySelectorAll("strong")).find(t=>(t.textContent||"").includes("Disparar"));e?.closest('[class*="flex"]')&&Y(e.closest("div")||e.parentElement,{bulk:!0})}chrome.storage.onChanged.addListener(async(e,t)=>{if(t!=="local"||!e["ZV:scheduleStore"])return;const r=await z(A);if(r?.enabled)try{const n=e["ZV:scheduleStore"].newValue,a=n?.state?.scheduleList||n?.scheduleList||[],o=a[a.length-1];if(!o||o.recurrenceRule?.enabled)return;o.recurrenceRule=r,await v({"ZV:scheduleStore":n?.state?{...n,state:{...n.state,scheduleList:a}}:{state:{scheduleList:a},version:0},[A]:null})}catch(n){f("recurrence attach",n)}});let Q="",T=null,X=!1;function Ee(){return document.getElementById("zv-sidebar")||document.querySelector('[id*="ZV"]')||document.getElementById("app")||document.body}function P(){if(b()&&!X){X=!0;const r=document.getElementById(C);r&&(r.dataset.zvStale||!r.querySelector(".zv-fn-multibox label"))&&L(!0),S()&&O(!0)}ze(),L();const t=document.querySelector('[data-state="active"][value]')?.getAttribute("value")||Array.from(document.querySelectorAll('button[data-state="active"]')).map(r=>r.textContent).join("");t!==Q&&(Q=t,document.querySelectorAll("#"+I).forEach(r=>r.remove())),S()&&O()}function xe(){T||(T=setTimeout(()=>{T=null,P()},300))}const Se=new MutationObserver(()=>xe());function ee(){P(),Se.observe(Ee(),{childList:!0,subtree:!0}),setInterval(P,4e3),document.documentElement.addEventListener("zv:groups-updated",()=>{S()&&O(!0),L(!0)}),f("ativo v5 \u2014 bridge DOM + wait ready fix")}document.readyState==="loading"?document.addEventListener("DOMContentLoaded",ee):ee()})();
