import{b as d,i as a}from"./useflows-BpG3C9m1.js";import{e as o}from"./main-few-lands-burn.js";import{s as r,h as n}from"./machine.-BRuqPpdF.js";import{h as c,c as s}from"./commons.-bP-saOXM.js";import{f as l,a as m}from"./machineh-5vGV0ecU.js";import"./mutative-C6xjlr6O.js";import"./lodash-YpNkAOPN.js";const T=d(({helpers:t})=>({states:{components:[s(t),{allowClear:!0,componentName:t.componentName.select,fieldType:"config",helperText:o("Select the spreadsheet."),id:"spreadsheet-id",label:o("Spreadsheet"),onChange:"HANDLE_SPREADSHEET",onRefetch:"REFETCH_SPREADSHEETS",optionFilterProp:"label",options:[],render:"IF_CONNECTION_SELECTED",required:!0,showSearch:!0,value:void 0},{allowClear:!0,componentName:t.componentName.select,fieldType:"config",helperText:o("Select the sheet."),id:"sheet-title",label:o("Sheet"),onChange:"HANDLE_SHEET",onRefetch:"REFETCH_SHEETS",optionFilterProp:"label",options:[],render:"IF_SPREADSHEET_SELECTED",required:!0,showSearch:!0,value:void 0},{componentName:t.componentName.mixInput,helperText:o("The name of the new column."),id:"column-name",label:o("Column Name"),onChange:"HANDLE_COLUMN_NAME",path:"columnName",render:"IF_SHEET_SELECTED",required:!0,value:[]},{componentName:t.componentName.mixInput,helperText:o("The column index starts from 1. If empty, added at end."),id:"column-index",label:o("Column Index"),onChange:"HANDLE_COLUMN_INDEX",path:"columnIndex",render:"IF_SHEET_SELECTED",required:!1,value:[]}]},actions:{CONNECTION_ADD_CHANGE:c,HANDLE_COLUMN_INDEX:n("columnIndex"),HANDLE_COLUMN_NAME:n("columnName"),HANDLE_SHEET:n("sheetTitle"),IF_CONNECTION_SELECTED:({$:e})=>a(e.getComponent("connection-id")?.value),IF_SHEET_SELECTED:({$:e})=>a(e.getComponent("sheet-title")?.value),IF_SPREADSHEET_SELECTED:({$:e})=>a(e.getComponent("spreadsheet-id")?.value),REFETCH_SHEETS:({$:e})=>m(e),REFETCH_SPREADSHEETS:({$:e})=>l(e),SET_CONNECTION:({$:e,e:E})=>{n("connectionId")({$:e,e:E}),l(e)},HANDLE_SPREADSHEET:({$:e,e:E})=>{n("spreadsheetId")({$:e,e:E}),e.setComponent("sheet-title",i=>{i.value=void 0}),m(e)},ON_MACHINE_LOAD:({$:e})=>{r(e,[{db:"connectionId",id:"connection-id"},{db:"spreadsheetId",id:"spreadsheet-id"},{db:"sheetTitle",id:"sheet-title"},{db:"columnName",id:"column-name"},{db:"columnIndex",id:"column-index"}]),Promise.all([l(e),m(e)])}}}));export{T as default};
