import{E as b,O as l}from"./v_7_4_2_27_fac7f92f-33f6-4d26-8a6f-b87b9638d3cc11.js";import{c as f}from"./v_7_4_2_27_fac7f92f-33f6-4d26-8a6f-b87b9638d3cc8.js";async function m(e,r,u){return new Promise((s,i)=>{const o=indexedDB.open(e,1);o.onerror=function(t){console.error("Erro ao abrir o banco de dados."),i("Erro ao abrir o banco de dados.")},o.onupgradeneeded=function(t){t.target.result.createObjectStore(r,{keyPath:"id",autoIncrement:!0})},o.onsuccess=function(t){const a=t.target.result,n=a.transaction([r],"readwrite").objectStore(r);n.clear();const c=n.add(u);c.onsuccess=function(){s(!0),a.close()},c.onerror=function(){console.error("Worker Erro ao salvar os dados da camapanha."),s(!1)}}})}const O=(e,r=!1)=>{m("useOrderLabels","orderLabels",e),b({stopPropag:r,action:"setOrderLabels",waitForResponse:!1,data:e}),d.setState({orderLabels:e})},L=l({setOrderLabels:e=>{O(e.data,!0)},getOrderLabels:()=>d.getState().orderLabels});chrome.runtime.onMessage.addListener(L);const d=f()(()=>({orderLabels:[]}));export{O as s,d as u};
