import{aa as r,ab as n}from"./_applist-tangy-colts-beg-36.js";import{_ as o}from"./main-tangy-colts-beg.js";import{h as l,s}from"./machine.-tangy-colts-beg-869.js";import{f as i,a as c,b as d,h as E,c as C,d as m}from"./machineh-tangy-colts-beg-230.js";import"./lodash-tangy-colts-beg-516.js";globalThis.jotaiAtomCache=globalThis.jotaiAtomCache||{cache:new Map,get(t,e){return this.cache.has(t)?this.cache.get(t):(this.cache.set(t,e),e)}};const S=r(({helpers:t})=>({states:{components:[C(t),{allowClear:!0,componentName:t.componentName.select,fieldType:"config",helperText:o("Select your Airtable Base from the list."),id:"base-id",label:o("Select Base"),onChange:"SELECT_BASE",onRefetch:"REFETCH_BASES",optionFilterProp:"label",options:[],placeholder:o("Select Base"),render:"IF_CONNECTION_SELECTED",required:!0,showSearch:!0,value:void 0},{allowClear:!0,componentName:t.componentName.select,fieldType:"config",helperText:o("Select the table where you want to create a record."),id:"table-id",label:o("Select Table"),onChange:"SELECT_TABLE",onRefetch:"REFETCH_TABLES",optionFilterProp:"label",options:[],path:"table-id",render:"IF_BASE_ID_SELECTED",required:!0,showSearch:!0,value:void 0},{addItemButtonLabel:"Add Field",componentName:t.componentName.repeaterField,fieldsMetaData:[{allowClear:!0,componentName:t.componentName.select,label:o("Field Name"),name:"airtableFieldKey",options:[],placeholder:o("Select Field"),showSearch:!0,value:void 0,wrapperClassName:"w-100"},{componentName:t.componentName.mixInput,label:o("Field Value"),name:"value",value:[],wrapperClassName:"w-100"}],helperText:o("Map the fields to create a record. Select field names and provide their values."),id:"record-fields",label:o("Record Fields"),labelActionIconName:"refresh-cw",labelActionOnClick:"REFETCH_FIELDS",labelActionText:o("Refetch Fields"),onChange:"SET_RECORD_FIELDS",path:"record-fields",render:"IF_TABLE_SELECTED",value:[]}]},actions:{CONNECTION_ADD_CHANGE:E,SELECT_BASE:({$:e,e:a})=>{l("baseId")({$:e,e:a}),i(e)},SELECT_TABLE:({$:e,e:a})=>{l("tableId")({$:e,e:a}),c(e)},IF_BASE_ID_SELECTED:({$:e})=>{var a;return n((a=e.getComponent("base-id"))==null?void 0:a.value)},IF_CONNECTION_SELECTED:({$:e})=>{var a;return n((a=e.getComponent("connection-id"))==null?void 0:a.value)},IF_TABLE_SELECTED:({$:e})=>{var a;return n((a=e.getComponent("table-id"))==null?void 0:a.value)},ON_MACHINE_LOAD:async({$:e})=>{s(e,[{db:"connectionId",id:"connection-id"},{db:"baseId",id:"base-id"},{db:"tableId",id:"table-id"},{db:"recordFields",id:"record-fields"},{db:"fieldTypes",id:"fieldTypes"}]),await Promise.all([d(e),i(e),c(e)])},REFETCH_BASES:({$:e})=>d(e),REFETCH_FIELDS:({$:e})=>c(e),REFETCH_TABLES:({$:e})=>i(e),SET_CONNECTION:async({$:e,e:a})=>{l("connectionId")({$:e,e:a}),await d(e),m(e,t)},SET_RECORD_FIELDS:l("recordFields")}}));export{S as default};
