import{A as e,k as t}from"./vendor-tanstack-CnTDU3TP.js";import{t as n}from"./createLucideIcon-D6HmSa4x.js";import{nn as r}from"./index-BVrdu45I.js";var i=n(`file`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}]]),a=n(`folder`,[[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}]]);function o(...e){let t=e.flat(1);return t.map((e,n)=>typeof e==`string`?s(e,n!==0,n!==t.length-1):e).join(`/`)}function s(e,t=!0,n=!0){let r=t&&e[0]===`/`,i=n&&e[e.length-1]===`/`;return r&&i?e.slice(1,-1):r?e.slice(1):i?e.slice(0,-1):e}var c=[{id:`vanilla-js`,name:`Web + REST ORM`,description:`Define your entities in schema.graphql, add your HTML/CSS/JS in web, and you're cooking!`,tags:[`Harper`,`ORM`,`REST`,`GraphQL`],npm:`@harperfast/template-vanilla-studio`,githubUrl:`https://github.com/HarperFast/create-harper/tree/main/template-vanilla`},{id:`vanilla-ts`,name:`TypeScript`,description:`The same Web + REST ORM from the first template, but with TypeScript sprinkled in.`,tags:[`Harper`,`TypeScript`,`GraphQL`],npm:`@harperfast/template-vanilla-ts-studio`,githubUrl:`https://github.com/HarperFast/create-harper/tree/main/template-vanilla-ts`}];async function l({instanceClient:e,project:t,template:n,entityType:r}){let{data:i}=await e.post(`/`,{operation:`add_component`,project:t,template:n,replicated:r===`cluster`},{timeout:3e5});return i}function u(){return t({mutationFn:l})}function d(e,t,n){for(let r of e)if(r[t]===n)return r}async function f({file:e,project:t,entityType:n,instanceClient:r}){let{data:i}=await r.post(`/`,{operation:`drop_component`,file:e||void 0,project:t,replicated:n===`cluster`});return i}function p(e){let t=(e||``)?.split(`.`);return t.length>1?t.slice(-1)[0]:``}var m={apng:{kind:`image`,mime:`image/apng`},avif:{kind:`image`,mime:`image/avif`},bmp:{kind:`image`,mime:`image/bmp`},gif:{kind:`image`,mime:`image/gif`},ico:{kind:`image`,mime:`image/x-icon`},jfif:{kind:`image`,mime:`image/jpeg`},jpeg:{kind:`image`,mime:`image/jpeg`},jpg:{kind:`image`,mime:`image/jpeg`},png:{kind:`image`,mime:`image/png`},svg:{kind:`image`,mime:`image/svg+xml`},webp:{kind:`image`,mime:`image/webp`},m4v:{kind:`video`,mime:`video/mp4`},mov:{kind:`video`,mime:`video/quicktime`},mp4:{kind:`video`,mime:`video/mp4`},ogv:{kind:`video`,mime:`video/ogg`},webm:{kind:`video`,mime:`video/webm`}};function h(e){return m[p(e).toLowerCase()]}function g(e){return h(e)!==void 0}async function _({instanceClient:e,file:t,project:n,encoding:r}){let{data:i}=await e.post(`/`,{operation:`get_component_file`,project:n,file:t,encoding:r??(g(t)?`base64`:`utf8`)});return{project:n,file:t,...i}}function v(t){return e({queryKey:y(t),queryFn:()=>_(t),enabled:!!t.file&&!!t.project,retry:!1})}function y(e){return[e.entityId,`get_component_file`,e.project,e.file,e.encoding]}function b(e){return!!e?.entries}var x=`__root__`,S=`importedApplications`,C=`newApplication`;function w(e){let t={},n=[],i=[],a=[];for(let r of e)b(r)?r.package?i.push(r.path):n.push(r.path):a.push(r.path),T(t,r);return t[x]={index:x,isFolder:!0,children:[C,S,...n,...a].filter(r),data:void 0,canMove:!1,canRename:!1},t[S]={index:S,isFolder:!0,children:i,data:{name:`Imported Applications`,path:S,package:S,project:``,entries:[]},canMove:!1,canRename:!1},t[C]={index:C,isFolder:!1,data:{name:`New Application`,path:C,project:``},canMove:!1,canRename:!1},{items:t,rootId:x}}function T(e,t){let n=t.path;if(b(t)){let r=t,i=[],a=[];for(let e of r.entries)b(e)?i.push(e.path):a.push(e.path);e[n]={index:n,isFolder:!0,children:[...i,...a],data:t,canMove:!1,canRename:!1};for(let t of r.entries)T(e,t)}else e[n]={index:n,isFolder:!1,data:t,canMove:!t.package,canRename:!t.package}}function E(e,t,n,r=[]){let i=[];for(let a of e){let e=n(a,r);i.push(e);let o=a,s=o[t];s&&(e[t]=E(s,t,n,[...r,o]))}return i}function D(e){let t=new Set;return{rootEntries:E(e||[],`entries`,(e,n)=>{let r=b(e)&&e.entries.find(e=>e.name.toLowerCase()===`readme.md`),i=[...n.map(e=>e.name),e.name].join(`/`);return t.add(i),{name:e.name,path:i,project:(n[0]||e)?.name,package:(n[0]||e)?.package,overviewEntry:r&&!b(r)&&{name:r.name,path:[...n.map(e=>e.name),e.name,r.name].join(`/`),project:(n[0]||e)?.name,package:(n[0]||e)?.package}||void 0}}),pathsRegistry:t}}async function O({file:e,payload:t,project:n,entityType:r,instanceClient:i,encoding:a}){let{data:o}=await i.post(`/`,{operation:`set_component_file`,file:e,payload:t,project:n,encoding:a,replicated:r===`cluster`},{timeout:3e5});return o}function k(){return t({mutationFn:O})}export{c as _,S as a,i as b,_ as c,h as d,p as f,u as g,l as h,w as i,y as l,d as m,k as n,C as o,f as p,D as r,b as s,O as t,v as u,o as v,a as y};
//# sourceMappingURL=setComponentFile-CdvgHnSh.js.map