import{aa as h,ab as s}from"./_applist-tangy-colts-beg-36.js";import{_ as n}from"./main-tangy-colts-beg.js";import{s as c}from"./machine.-tangy-colts-beg-869.js";import{h as l,f as E,b as i,c as d,a as S}from"./machineh-tangy-colts-beg-115.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 _=h(({helpers:a})=>({states:{components:[d(a),{componentName:a.componentName.select,fieldType:"config",id:"spreadsheet-id",label:n("Spreadsheet"),onChange:"SELECT_SPREADSHEET",onRefetch:"REFETCH_SPREADSHEETS",optionFilterProp:"label",options:[],placeholder:n("Select a spreadsheet"),render:"IF_CONNECTION_SELECTED",showSearch:!0,value:void 0},{componentName:a.componentName.select,fieldType:"config",id:"sheet-title",label:n("Sheet"),onChange:"SELECT_SHEET",onRefetch:"REFETCH_SHEETS",optionFilterProp:"label",options:[],placeholder:n("Select a sheet"),render:"IF_SPREADSHEET_SELECTED",showSearch:!0,value:void 0}]},actions:{ON_MACHINE_LOAD:async({$:e})=>{c(e,[{db:"connectionId",id:"connection-id"},{db:"spreadsheetId",id:"spreadsheet-id"},{db:"sheetTitle",id:"sheet-title"}]),await Promise.all([E(e),i(e)])},IF_CONNECTION_SELECTED:({$:e})=>{var t;return s((t=e.getComponent("connection-id"))==null?void 0:t.value)},IF_SHEET_SELECTED:({$:e})=>{var t;return s((t=e.getComponent("sheet-title"))==null?void 0:t.value)},IF_SPREADSHEET_SELECTED:({$:e})=>{var t;return s((t=e.getComponent("spreadsheet-id"))==null?void 0:t.value)},REFETCH_SHEETS:({$:e})=>i(e),REFETCH_SPREADSHEETS:({$:e})=>E(e),CONNECTION_ADD_CHANGE:l,SELECT_SHEET:async({$:e,e:t})=>{e.setThisComponent(o=>{o.value=t}),e.setDb(o=>{o.sheetTitle=t})},SELECT_SPREADSHEET:async({$:e,e:t})=>{e.setThisComponent(o=>{o.value=t}),e.setComponent("sheet-title",o=>{o.value=void 0}),e.setDb(o=>{o.spreadsheetId=t,o.sheetTitle=void 0}),await i(e)},SET_CONNECTION:async({$:e,e:t})=>{e.setThisComponent(o=>{o.value=t}),e.setDb(o=>{o.connectionId=t}),await E(e),S(e,a)}}}));export{_ as default};
