import{aa as s,ab as l}from"./_applist-tangy-colts-beg-36.js";import{_ as t}from"./main-tangy-colts-beg.js";import{h as n,s as m}from"./machine.-tangy-colts-beg-869.js";import{f as i,a as r,b as d,s as E,h,c as C}from"./microsof-tangy-colts-beg-277.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:[C(a),{allowClear:!0,componentName:a.componentName.select,fieldType:"config",helperText:t("Select the folder where the workbook is located. Leave empty for root folder."),id:"folder-id",label:t("Folder"),onChange:"HANDLE_FOLDER",onRefetch:"REFETCH_FOLDERS",options:[{label:t("Root"),value:"root"}],render:"IF_CONNECTION_SELECTED",showSearch:!0,value:"root"},{allowClear:!0,componentName:a.componentName.select,fieldType:"config",helperText:t("Select the workbook."),id:"workbook-id",label:t("Workbook"),onChange:"HANDLE_WORKBOOK",onRefetch:"REFETCH_WORKBOOKS",options:[],render:"IF_CONNECTION_SELECTED",required:!0,value:void 0},{allowClear:!0,componentName:a.componentName.select,fieldType:"config",helperText:t("Select the worksheet."),id:"worksheet-id",label:t("Worksheet"),onChange:"HANDLE_WORKSHEET",onRefetch:"REFETCH_WORKSHEETS",options:[],render:"IF_WORKBOOK_SELECTED",required:!0,value:void 0},{addItemButtonLabel:"Add Column",componentName:a.componentName.repeaterField,fieldsMetaData:[{componentName:a.componentName.select,label:t("Column"),name:"column",options:[],required:!0,style:{width:100},value:""},{componentName:a.componentName.mixInput,label:t("Value"),name:"value",required:!0,value:void 0,wrapperClassName:"w-100"}],helperText:t("Map columns to their values. Each row will have the column-value pairs you define here."),id:"rows-data",label:t("Field Mapping"),labelActionIconName:"refresh-cw",labelActionOnClick:"REFETCH_COLUMNS",labelActionText:t("Refetch Columns"),onChange:"HANDLE_ROWS_DATA",path:"rowsData",render:"IF_WORKSHEET_SELECTED",value:[],wrapperClassName:"mt-3"}]},actions:{CONNECTION_ADD_CHANGE:h,HANDLE_ROWS_DATA:n("rowsData"),IF_CONNECTION_SELECTED:({$:e})=>{var o;return l((o=e.getComponent("connection-id"))==null?void 0:o.value)},IF_WORKBOOK_SELECTED:({$:e})=>{var o;return l((o=e.getComponent("workbook-id"))==null?void 0:o.value)},IF_WORKSHEET_SELECTED:({$:e})=>{var o;return l((o=e.getComponent("worksheet-id"))==null?void 0:o.value)},REFETCH_COLUMNS:({$:e})=>E(e),REFETCH_FOLDERS:({$:e})=>d(e),REFETCH_WORKBOOKS:({$:e})=>r(e),REFETCH_WORKSHEETS:({$:e})=>i(e),SET_CONNECTION:({$:e,e:o})=>{n("connectionId")({$:e,e:o}),Promise.all([d(e),r(e)])},HANDLE_FOLDER:({$:e,e:o})=>{n("folderId")({$:e,e:o}),r(e)},HANDLE_WORKBOOK:({$:e,e:o})=>{n("workbookId")({$:e,e:o}),e.setComponent("worksheet-id",c=>{c.value=void 0}),i(e)},HANDLE_WORKSHEET:({$:e,e:o})=>{n("worksheetId")({$:e,e:o}),E(e)},ON_MACHINE_LOAD:async({$:e})=>{m(e,[{db:"connectionId",id:"connection-id"},{db:"folderId",id:"folder-id"},{db:"workbookId",id:"workbook-id"},{db:"worksheetId",id:"worksheet-id"},{db:"rowsData",id:"rows-data"}]),await Promise.all([d(e),r(e),i(e),E(e)])}}}));export{T as default};
