import{aa as c,ab as r}from"./_applist-tangy-colts-beg-36.js";import{_ as a}from"./main-tangy-colts-beg.js";import{h as n,s}from"./machine.-tangy-colts-beg-869.js";import{f as E,a as l,b as d,h,c as m}from"./microsof-tangy-colts-beg-277.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 O=c(({helpers:t})=>({states:{components:[m(t),{allowClear:!0,componentName:t.componentName.select,fieldType:"config",helperText:a("Select the folder where the workbook is located. Leave empty for root folder."),id:"folder-id",label:a("Folder"),onChange:"HANDLE_FOLDER",onRefetch:"REFETCH_FOLDERS",options:[{label:a("Root"),value:"root"}],render:"IF_CONNECTION_SELECTED",showSearch:!0,value:"root"},{allowClear:!0,componentName:t.componentName.select,fieldType:"config",helperText:a("Select the workbook."),id:"workbook-id",label:a("Workbook"),onChange:"HANDLE_WORKBOOK",onRefetch:"REFETCH_WORKBOOKS",options:[],render:"IF_CONNECTION_SELECTED",required:!0,value:void 0},{allowClear:!0,componentName:t.componentName.select,fieldType:"config",helperText:a("Select the worksheet."),id:"worksheet-id",label:a("Worksheet"),onChange:"HANDLE_WORKSHEET",onRefetch:"REFETCH_WORKSHEETS",options:[],render:"IF_WORKBOOK_SELECTED",required:!0,value:void 0},{componentName:t.componentName.select,fieldType:"config",helperText:a("Select how to determine the table range."),id:"select-range",label:a("Select Range"),onChange:"HANDLE_SELECT_RANGE",options:[{label:a("Automatically"),value:"auto"},{label:a("Manually"),value:"manual"}],render:"IF_WORKSHEET_SELECTED",required:!0,value:"auto"},{componentName:t.componentName.mixInput,helperText:a("The range of cells that will be converted to a table (e.g., A1:B2)."),id:"address",label:a("Range"),onChange:"HANDLE_RANGE",path:"address",render:"IF_MANUAL_RANGE",required:!0,value:[]},{componentName:t.componentName.switch,helperText:a("Whether the range has column labels."),id:"has-headers",label:a("Has Headers"),onChange:"HANDLE_HAS_HEADERS",path:"hasHeaders",render:"IF_WORKSHEET_SELECTED",size:"small",value:!0}]},actions:{CONNECTION_ADD_CHANGE:h,HANDLE_HAS_HEADERS:n("hasHeaders"),HANDLE_RANGE:n("range"),HANDLE_SELECT_RANGE:n("selectRange"),HANDLE_WORKSHEET:n("worksheetId"),IF_CONNECTION_SELECTED:({$:e})=>{var o;return r((o=e.getComponent("connection-id"))==null?void 0:o.value)},IF_WORKBOOK_SELECTED:({$:e})=>{var o;return r((o=e.getComponent("workbook-id"))==null?void 0:o.value)},IF_WORKSHEET_SELECTED:({$:e})=>{var o;return r((o=e.getComponent("worksheet-id"))==null?void 0:o.value)},REFETCH_FOLDERS:({$:e})=>d(e),REFETCH_WORKBOOKS:({$:e})=>l(e),REFETCH_WORKSHEETS:({$:e})=>E(e),IF_MANUAL_RANGE:({$:e})=>{var o,i;return r((o=e.getComponent("worksheet-id"))==null?void 0:o.value)&&((i=e.getComponent("select-range"))==null?void 0:i.value)==="manual"},SET_CONNECTION:({$:e,e:o})=>{n("connectionId")({$:e,e:o}),Promise.all([d(e),l(e)])},HANDLE_FOLDER:({$:e,e:o})=>{n("folderId")({$:e,e:o}),l(e)},HANDLE_WORKBOOK:({$:e,e:o})=>{n("workbookId")({$:e,e:o}),E(e)},ON_MACHINE_LOAD:async({$:e})=>{s(e,[{db:"connectionId",id:"connection-id"},{db:"folderId",id:"folder-id"},{db:"workbookId",id:"workbook-id"},{db:"worksheetId",id:"worksheet-id"},{db:"selectRange",id:"select-range"},{db:"range",id:"range"},{db:"hasHeaders",id:"has-headers"}]),await Promise.all([d(e),l(e),E(e)])}}}));export{O as default};
