import{aa as r,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 E}from"./machine.-tangy-colts-beg-869.js";import{h as d,c as C}from"./commons.-tangy-colts-beg-359.js";import{f as i,b as c,h as T}from"./machineh-tangy-colts-beg-169.js";import"./lodash-tangy-colts-beg-516.js";globalThis.jotaiAtomCache=globalThis.jotaiAtomCache||{cache:new Map,get(o,e){return this.cache.has(o)?this.cache.get(o):(this.cache.set(o,e),e)}};const O=r(({helpers:o})=>({states:{components:[C(o),{componentName:o.componentName.mixInput,fieldType:"config",helperText:t("The text to create the file with."),id:"content",label:t("File Content"),onChange:"SET_CONTENT",render:"IF_CONNECTION_SELECTED",required:!0,value:void 0},{componentName:o.componentName.mixInput,fieldType:"config",helperText:t("The name of the file you want to create."),id:"file-name",label:t("File Name"),onChange:"SET_FILE_NAME",render:"IF_CONNECTION_SELECTED",required:!1,value:void 0},{allowClear:!0,componentName:o.componentName.select,fieldType:"config",helperText:t("Select the drive where to create the new file."),id:"drive-id",label:t("Parent Drive"),onChange:"SELECT_DRIVE",onRefetch:"REFETCH_DRIVES",options:[],render:"IF_CONNECTION_SELECTED",showSearch:!0,value:void 0},{allowClear:!0,componentName:o.componentName.select,fieldType:"config",helperText:t("Select the folder where to create the new file."),id:"folder-id",label:t("Parent Folder"),onChange:"SELECT_FOLDER",onRefetch:"REFETCH_FOLDERS",options:[],render:"IF_CONNECTION_SELECTED",showSearch:!0,value:void 0},{componentName:o.componentName.switch,fieldType:"config",helperText:t("Whether to create a Google Document (instead of the .txt default format)."),id:"convert-to-google-doc",label:t("Convert to Google Document"),onChange:"SET_CONVERT_TO_GOOGLE_DOC",render:"IF_CONNECTION_SELECTED",value:!1}]},actions:{SET_CONNECTION:async({$:e,e:a})=>{n("connectionId")({$:e,e:a}),await Promise.all([i(e),c(e)]),T(e,o)},CONNECTION_ADD_CHANGE:d,IF_CONNECTION_SELECTED:({$:e})=>{var a;return l((a=e.getComponent("connection-id"))==null?void 0:a.value)},REFETCH_DRIVES:({$:e})=>c(e),REFETCH_FOLDERS:({$:e})=>i(e),SELECT_DRIVE:n("driveId"),SELECT_FOLDER:n("folderId"),SET_CONTENT:n("content"),SET_CONVERT_TO_GOOGLE_DOC:n("convertToGoogleDoc"),SET_FILE_NAME:n("fileName"),ON_MACHINE_LOAD:async({$:e})=>{E(e,[{db:"connectionId",id:"connection-id"},{db:"content",id:"content"},{db:"fileName",id:"file-name"},{db:"driveId",id:"drive-id"},{db:"folderId",id:"folder-id"},{db:"convertToGoogleDoc",id:"convert-to-google-doc"}]),await Promise.all([i(e),c(e)])}}}));export{O as default};
