import{aa as l,ab as r}from"./_applist-tangy-colts-beg-36.js";import{_ as t}from"./main-tangy-colts-beg.js";import{s as p}from"./machine.-tangy-colts-beg-869.js";import{f as c}from"./machineh-tangy-colts-beg-716.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 m=l(({helpers:a})=>({states:{components:[{addConnectionHelpingText:t('You can find credentials from <a target="_blank" class="text-blue-600 underline" rel="noopener noreferrer nofollow" href="https://my.demio.com/manage/settings/api-details">Here</a>'),componentName:a.componentName.connection,connectionsTypes:[{encryptKeys:["value"],label:t("API Key"),type:"api_key",verifyConnection:{headers:{Accept:"application/json","api-key":"","api-secret":""},method:"GET",responseKeyMatch:["pong"],url:"https://my.demio.com/api/v1/ping"}}],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:"event-id",label:t("Event"),onChange:"SELECT_EVENT",onRefetch:"REFETCH_EVENT",optionFilterProp:"label",options:[],placeholder:t("Select an event"),render:"IF_CONNECTION_SELECTED",showSearch:!0,value:void 0},{componentName:a.componentName.select,fieldType:"config",id:"active-status",label:t("Active Status"),onChange:"SELECT_ACTIVE_STATUS",optionFilterProp:"label",options:[{label:t("Yes"),value:"true"},{label:t("No"),value:"false"}],placeholder:t("Return only active dates in series"),render:"IF_CONNECTION_SELECTED",showSearch:!0,value:void 0}]},actions:{IF_CONNECTION_SELECTED:({$:e})=>{var o;return r((o=e.getComponent("connection-id"))==null?void 0:o.value)},ON_MACHINE_LOAD:async({$:e})=>{p(e,[{db:"connectionId",id:"connection-id"},{db:"activeStatus",id:"active-status"},{db:"eventId",id:"event-id"}]),await c(e)},REFETCH_EVENT:async({$:e})=>{await c(e)},SELECT_EVENT:async({$:e,e:o})=>{e.setThisComponent(n=>{n.value=o}),e.setComponent("project-title",n=>{n.value=void 0}),e.setDb(n=>{n.eventId=o,n.projectTitle=void 0})},SELECT_ACTIVE_STATUS:async({$:e,e:o})=>{e.setThisComponent(n=>{n.value=o}),e.setDb(n=>{n.activeStatus=o})},CONNECTION_ADD_CHANGE:({$:e,e:o})=>{e.setThisComponent(n=>{e.util.isConnectionComponent(n)&&n.connectionsTypes.forEach(i=>{var s;i.type==="api_key"&&((s=i.verifyConnection)!=null&&s.headers)&&(i.verifyConnection.headers["api-key"]=o.key,i.verifyConnection.headers["api-secret"]=o.value)})})},SET_CONNECTION:async({$:e,e:o})=>{e.setThisComponent(n=>{n.value=o}),e.setDb(n=>{n.connectionId=o}),await c(e)}}}));export{m as default};
