import{aa as s,ab as c}from"./_applist-tangy-colts-beg-36.js";import{_ as i}from"./main-tangy-colts-beg.js";import{s as C}from"./machine.-tangy-colts-beg-869.js";import{a as n}from"./machineh-tangy-colts-beg-95.js";import{h,c as r}from"./notionco-tangy-colts-beg-866.js";import"./lodash-tangy-colts-beg-516.js";globalThis.jotaiAtomCache=globalThis.jotaiAtomCache||{cache:new Map,get(o,a){return this.cache.has(o)?this.cache.get(o):(this.cache.set(o,a),a)}};const N=s(({helpers:o})=>({states:{components:[r(o),{componentName:o.componentName.select,fieldType:"config",id:"database-id",label:i("Database"),onChange:"SELECT_DATABASE",onRefetch:"REFETCH_DATABASE",optionFilterProp:"label",options:[],placeholder:i("Select a Database"),render:"IF_CONNECTION_SELECTED",showSearch:!0,value:void 0}]},actions:{IF_CONNECTION_SELECTED:({$:a})=>{var e;return c((e=a.getComponent("connection-id"))==null?void 0:e.value)},REFETCH_DATABASE:async({$:a})=>{await n(a)},SELECT_DATABASE:async({$:a,e})=>{a.setThisComponent(t=>{t.value=e}),a.setDb(t=>{t.databaseId=e})},ON_MACHINE_LOAD:async({$:a})=>{C(a,[{db:"connectionId",id:"connection-id"},{db:"databaseId",id:"database-id"}]),await n(a)},SET_CONNECTION:async({$:a,e})=>{a.setThisComponent(t=>{t.value=e}),a.setDb(t=>{t.connectionId=e}),await n(a)},CONNECTION_ADD_CHANGE:h}}));export{N as default};
