"use strict";(self.webpackChunkdami=self.webpackChunkdami||[]).push([[6487],{36487:(e,t,a)=>{a.r(t),a.d(t,{default:()=>d});var n=a(93150),i=a.n(n),o=a(31263);function r(e,t){return(a,n)=>new Promise((i=>{let o=!1;const r=s=>{o||t&&!t(s,{data:a,activeTab:n})||(e.removeListener(r),i(s))};setTimeout((()=>{o=!0,e.removeListener(r),i("")}),a.timeout||1e4),e.addListener(r)}))}const s=({url:e},{data:t})=>{if(!(0,o.cb)(t.tabUrl)){if(!new RegExp(t.tabUrl,"gi").test(e))return!1}return!0},c={"tab:loaded":function({tabLoadedUrl:e,activeTabLoaded:t,timeout:a},{id:n}){return new Promise(((r,s)=>{let c=!1;const d=()=>{c||(n?i().tabs.get(n).then((e=>{"complete"!==e.status?setTimeout(d,1e3):r()})).catch(s):s(new Error("no-tab")))},u=(0,o.cb)(e)?"<all_urls>":e.replace(/\s/g,"").split(","),l=()=>{i().tabs.query({url:u,status:"loading"}).then((e=>{c||(0!==e.length?setTimeout(l,1e3):r())})).catch(s)};t?d():l(),setTimeout((()=>{c=!0,s(new Error("timeout"))}),a||1e4)}))},"tab:close":r(i().tabs.onRemoved),"tab:create":r(i().webNavigation.onCreatedNavigationTarget,s),"window:create":r(i().webNavigation.onCreatedNavigationTarget,s),"window:close":r(i().windows.onRemoved)};async function d({data:e,id:t}){const a=c[e.eventName];if(!a)throw new Error(`Can't find ${e.eventName} event`);const n=await a(e,this.activeTab);return"tab:create"===e.eventName&&e.setAsActiveTab&&(this.activeTab.id=n.tabId,this.activeTab.url=n.url),{data:n||"",nextBlockId:this.getBlockConnections(t)}}}}]);