import{aa as m,ab as c}from"./_applist-tangy-colts-beg-36.js";import{_ as n}from"./main-tangy-colts-beg.js";import{h as t,s}from"./machine.-tangy-colts-beg-869.js";import{h as f,c as h}from"./commons.-tangy-colts-beg-359.js";import{f as l,a as d,b as r,h as C}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 I=m(({helpers:o})=>({states:{components:[h(o),{allowClear:!0,componentName:o.componentName.select,fieldType:"config",helperText:n("Select the file to copy."),id:"file-id",label:n("File"),onChange:"SELECT_FILE",onRefetch:"REFETCH_FILES",options:[],render:"IF_CONNECTION_SELECTED",required:!0,showSearch:!0,value:void 0},{componentName:o.componentName.mixInput,fieldType:"config",helperText:n('The name of the new file. If not set, "Copy of {original file name}" will be used.'),id:"file-name",label:n("File Name"),onChange:"SET_FILE_NAME",render:"IF_CONNECTION_SELECTED",value:void 0},{componentName:o.componentName.switch,fieldType:"config",helperText:n("Whether to copy the file in the same folder as the original file."),id:"same-folder",label:n("Copy In The Same Folder"),onChange:"SET_SAME_FOLDER",render:"IF_CONNECTION_SELECTED",value:!1},{allowClear:!0,componentName:o.componentName.select,fieldType:"config",helperText:n("Select the drive where to save the copied file."),id:"drive-id",label:n("Parent Drive"),onChange:"SELECT_DRIVE",onRefetch:"REFETCH_DRIVES",options:[],render:"IF_SAME_FOLDER_FALSE",showSearch:!0,value:void 0},{allowClear:!0,componentName:o.componentName.select,fieldType:"config",helperText:n("Select the folder where to save the copied file."),id:"folder-id",label:n("Parent Folder"),onChange:"SELECT_FOLDER",onRefetch:"REFETCH_FOLDERS",options:[],render:"IF_SAME_FOLDER_FALSE",showSearch:!0,value:void 0}]},actions:{SET_CONNECTION:async({$:e,e:i})=>{t("connectionId")({$:e,e:i}),await Promise.all([d(e),l(e),r(e)]),C(e,o)},CONNECTION_ADD_CHANGE:f,IF_CONNECTION_SELECTED:({$:e})=>{var i;return c((i=e.getComponent("connection-id"))==null?void 0:i.value)},IF_SAME_FOLDER_FALSE:({$:e})=>{var a,E;return!((a=e.getComponent("same-folder"))==null?void 0:a.value)&&c((E=e.getComponent("connection-id"))==null?void 0:E.value)},REFETCH_DRIVES:({$:e})=>r(e),REFETCH_FILES:({$:e})=>d(e),REFETCH_FOLDERS:({$:e})=>l(e),SELECT_DRIVE:t("driveId"),SELECT_FILE:t("fileId"),SELECT_FOLDER:t("folderId"),SET_FILE_NAME:t("fileName"),SET_SAME_FOLDER:({$:e,e:i})=>{t("sameFolder")({$:e,e:i}),i.value===!0&&(e.setComponent("drive-id",a=>{a.value=void 0}),e.setComponent("folder-id",a=>{a.value=void 0}))},ON_MACHINE_LOAD:async({$:e})=>{s(e,[{db:"connectionId",id:"connection-id"},{db:"fileId",id:"file-id"},{db:"fileName",id:"file-name"},{db:"sameFolder",id:"same-folder"},{db:"driveId",id:"drive-id"},{db:"folderId",id:"folder-id"}]),await Promise.all([d(e),l(e),r(e)])}}}));export{I as default};
