import{aa as c,ab as i}from"./_applist-tangy-colts-beg-36.js";import{_ as o}from"./main-tangy-colts-beg.js";import{h as a,s as E}from"./machine.-tangy-colts-beg-869.js";import{h as s,c as h}from"./commons.-tangy-colts-beg-359.js";import{f as l,b as d,h as m}from"./machineh-tangy-colts-beg-169.js";import"./lodash-tangy-colts-beg-516.js";globalThis.jotaiAtomCache=globalThis.jotaiAtomCache||{cache:new Map,get(n,e){return this.cache.has(n)?this.cache.get(n):(this.cache.set(n,e),e)}};const p=c(({helpers:n})=>({states:{components:[h(n),{componentName:n.componentName.select,fieldType:"config",helperText:o("Choose the search method."),id:"search-method",label:o("Search Method"),onChange:"SET_SEARCH_METHOD",options:[{label:o("Search File/Folder Name"),value:"name"},{label:o("Advanced Search"),value:"query"}],render:"IF_CONNECTION_SELECTED",required:!0,value:"name"},{componentName:n.componentName.mixInput,fieldType:"config",helperText:o("The name of the file or folder to search for. Returns also files and folders whose names partially match this search term."),id:"search-query",label:o("Search Query"),onChange:"SET_SEARCH_QUERY",render:"IF_SEARCH_METHOD_NAME",value:void 0},{componentName:n.componentName.mixInput,fieldType:"config",helperText:o("Use the Google query strings syntax to search for a specific set of files or folders."),id:"query-string",label:o("Query String"),onChange:"SET_QUERY_STRING",render:"IF_SEARCH_METHOD_QUERY",value:void 0},{componentName:n.componentName.switch,fieldType:"config",helperText:o("Whether to return all results or only up to a given limit."),id:"return-all",label:o("Return All"),onChange:"SET_RETURN_ALL",render:"IF_CONNECTION_SELECTED",size:"small",value:!1},{componentName:n.componentName.mixInput,fieldType:"config",helperText:o("Max number of results to return."),id:"limit",label:o("Limit"),onChange:"SET_LIMIT",render:"IF_RETURN_ALL_FALSE",value:void 0},{allowClear:!0,componentName:n.componentName.select,fieldType:"config",helperText:o("Select the drive you want to search in."),id:"drive-id",label:o("Filter by Drive"),onChange:"SELECT_DRIVE",onRefetch:"REFETCH_DRIVES",options:[],render:"IF_CONNECTION_SELECTED",showSearch:!0,value:void 0},{allowClear:!0,componentName:n.componentName.select,fieldType:"config",helperText:o("Select the folder you want to search in. By default, the root folder of the drive is used."),id:"folder-id",label:o("Filter by Folder"),onChange:"SELECT_FOLDER",onRefetch:"REFETCH_FOLDERS",options:[],render:"IF_CONNECTION_SELECTED",showSearch:!0,value:void 0},{componentName:n.componentName.switch,fieldType:"config",helperText:o("Whether to include trashed files and folders in the search results."),id:"include-trashed",label:o("Include Trashed"),onChange:"SET_INCLUDE_TRASHED",render:"IF_CONNECTION_SELECTED",value:!1}]},actions:{SET_CONNECTION:async({$:e,e:t})=>{a("connectionId")({$:e,e:t}),await Promise.all([d(e),l(e)]),m(e,n)},CONNECTION_ADD_CHANGE:s,IF_CONNECTION_SELECTED:({$:e})=>{var t;return i((t=e.getComponent("connection-id"))==null?void 0:t.value)},IF_RETURN_ALL_FALSE:({$:e})=>{var t,r;return((t=e.getComponent("return-all"))==null?void 0:t.value)===!1&&i((r=e.getComponent("connection-id"))==null?void 0:r.value)},IF_SEARCH_METHOD_NAME:({$:e})=>{var t,r;return((t=e.getComponent("search-method"))==null?void 0:t.value)==="name"&&i((r=e.getComponent("connection-id"))==null?void 0:r.value)},IF_SEARCH_METHOD_QUERY:({$:e})=>{var t,r;return((t=e.getComponent("search-method"))==null?void 0:t.value)==="query"&&i((r=e.getComponent("connection-id"))==null?void 0:r.value)},REFETCH_DRIVES:({$:e})=>d(e),REFETCH_FOLDERS:({$:e})=>l(e),SELECT_DRIVE:a("filterDriveId"),SELECT_FOLDER:a("filterFolderId"),SET_INCLUDE_TRASHED:a("includeTrashed"),SET_LIMIT:a("limit"),SET_QUERY_STRING:a("queryString"),SET_RETURN_ALL:a("returnAll"),SET_SEARCH_METHOD:a("searchMethod"),SET_SEARCH_QUERY:a("searchQuery"),ON_MACHINE_LOAD:async({$:e})=>{E(e,[{db:"connectionId",id:"connection-id"},{db:"searchMethod",id:"search-method"},{db:"searchQuery",id:"search-query"},{db:"queryString",id:"query-string"},{db:"returnAll",id:"return-all"},{db:"limit",id:"limit"},{db:"filterDriveId",id:"drive-id"},{db:"filterFolderId",id:"folder-id"},{db:"includeTrashed",id:"include-trashed"}]),await Promise.all([d(e),l(e)])}}}));export{p as default};
