"use strict";(self.webpackChunkdami=self.webpackChunkdami||[]).push([[1950],{41950:(a,t,e)=>{e.r(t),e.d(t,{default:()=>d});var i=e(93150),s=e.n(i),n=e(31263),o=e(31791);const d=async function({data:a,id:t,label:e}){const i=void 0===a.saveToComputer||a.saveToComputer;try{let d=null;const l={quality:a.quality,format:a.ext||"png"},c=async t=>{a.saveToColumn&&this.addDataToColumn(a.dataColumn,t),i&&await async function({filename:a,uri:t,ext:e}){const i=await s().permissions.contains({permissions:["downloads"]}),o=`${a||"Screenshot"}.${e||"png"}`;if(i)return void await s().downloads.download({url:t,filename:o});const d=new Image;d.onload=()=>{const a=document.createElement("canvas");a.width=d.width,a.height=d.height,a.getContext("2d").drawImage(d,0,0),(0,n.AG)(o,a.toDataURL())},d.src=t}({filename:a.fileName,uri:t,ext:a.ext}),a.assignVariable&&this.setVariable(a.variableName,t)};if(a.captureActiveTab){if(!this.activeTab.id)throw new Error("no-tab");let t=null;const i=!0,n=async()=>{let a=null;return a=i?await s().tabs.captureVisibleTab(t.windowId,l):await s().tabs.captureTab(this.activeTab.id,l),a};i&&([t]=await s().tabs.query({active:!0,url:"*://*/*"}),this.windowId&&await s().windows.update(this.windowId,{focused:!0})),await s().tabs.update(this.activeTab.id,{active:!0}),await(0,o.Hh)({tabId:this.activeTab.id,listenError:!0}),d=await(a.fullPage||["element","fullpage"].includes(a.type)?this._sendMessageToTab({label:e,options:l,data:{type:a.type,selector:a.selector},tabId:this.activeTab.id}):n()),t&&(await s().windows.update(t.windowId,{focused:!0}),await s().tabs.update(t.id,{active:!0})),await c(d)}else d=await s().tabs.captureVisibleTab(l),await c(d);return{data:d,nextBlockId:this.getBlockConnections(t)}}catch(t){throw"element"===a.type&&(t.data={selector:a.selector}),t}}}}]);