import{aa as s,ab as l}from"./_applist-tangy-colts-beg-36.js";import{_ as t}from"./main-tangy-colts-beg.js";import{s as r}from"./machine.-tangy-colts-beg-869.js";import"./lodash-tangy-colts-beg-516.js";globalThis.jotaiAtomCache=globalThis.jotaiAtomCache||{cache:new Map,get(a,e){return this.cache.has(a)?this.cache.get(a):(this.cache.set(a,e),e)}};const T=s(({helpers:a})=>({states:{components:[{addConnectionHelpingText:t('You can find your API key in <a target="_blank" class="text-blue-600 underline" rel="noopener noreferrer nofollow" href="https://app.woodpecker.co/settings/api">Woodpecker Settings</a>'),componentName:a.componentName.connection,connectionsTypes:[{encryptKeys:["value"],label:t("Api Key"),showKey:!1,type:"api_key",verifyConnection:{headers:{Authorization:"","Content-Type":"application/json"},method:"GET",responseKeyMatch:["0.id"],url:"https://api.woodpecker.co/rest/v1/campaign_list"}}],fieldType:"config",id:"connection-id",label:t("Select Connection"),onConnectionAddChange:"CONNECTION_ADD_CHANGE",onConnectionChange:"SET_CONNECTION",render:!0,value:void 0},{componentName:a.componentName.select,fieldType:"config",id:"search-status",label:t("Select Prospect"),onChange:"SET_PROSPECT_STATUS",options:[{label:t("ACTIVE"),value:"ACTIVE"},{label:t("BLACKLIST"),value:"BLACKLIST"},{label:t("REPLIED"),value:"REPLIED"},{label:t("INVALID"),value:"INVALID"},{label:t("BOUNCED"),value:"BOUNCED"}],placeholder:t("Select a Prospect"),render:"IF_CONNECTION_SELECTED",required:!0,value:"ACTIVE"}]},actions:{SET_CONNECTION:async({$:e,e:o})=>{e.setThisComponent(n=>{n.value=o}),e.setDb(n=>{n.connectionId=o})},IF_CONNECTION_SELECTED:({$:e})=>{var o;return l((o=e.getComponent("connection-id"))==null?void 0:o.value)},SET_PROSPECT_STATUS:async({$:e,e:o})=>{e.setThisComponent(n=>{n.value=o}),e.setDb(n=>{n.prospectId=o})},CONNECTION_ADD_CHANGE:({$:e,e:o})=>{e.setThisComponent(n=>{e.util.isConnectionComponent(n)&&n.connectionsTypes.forEach(i=>{var c;i.type==="api_key"&&((c=i.verifyConnection)!=null&&c.headers)&&o.value&&(i.verifyConnection.headers.Authorization="Basic "+btoa(`${o.value}`))})})},ON_MACHINE_LOAD:async({$:e})=>{r(e,[{db:"connectionId",id:"connection-id"},{db:"searchStatus",id:"search-status"}])}}}));export{T as default};
