@swirls/cli 0.0.20 → 0.0.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- var Vt=Object.defineProperty;var f=(e,t)=>()=>(e&&(t=e(e=0)),t);var b=(e,t)=>{for(var r in t)Vt(e,r,{get:t[r],enumerable:!0})};import Ho from"path";import{fileURLToPath as Yo}from"url";var i=f(()=>{"use strict"});import Wt from"http";import{withResult as je}from"@byteslice/result";import*as F from"zod";function Qt(e){if(!e.url)throw new Error("No URL found in callback response.");let t=new URL(e.url,G);return F.parse(Gt,Object.fromEntries(t.searchParams.entries()))}function Fe(e){e.writeHead(400,{"Content-Type":"text/html"}),e.end(Zt)}function Xt(e){e.writeHead(200,{"Content-Type":"text/html"}),e.end(Kt)}function Le(e){return new Promise((t,r)=>{let o=Wt.createServer(async(a,s)=>{let c=await je(()=>Qt(a),n=>n);if(c.failure){Fe(s),r(c.failure);return}let d=await je(()=>e(c.data),n=>n);if(d.failure){Fe(s),r(d.failure);return}Xt(s),o.close(()=>{t()})});o.listen(ve)})}var ve,G,Gt,Kt,Zt,Ie=f(()=>{"use strict";i();ve=8765,G=`http://localhost:${ve}`,Gt=F.object({code:F.string(),state:F.string()}),Kt=`
2
+ var Zo=Object.create;var ht=Object.defineProperty;var Jo=Object.getOwnPropertyDescriptor;var en=Object.getOwnPropertyNames;var tn=Object.getPrototypeOf,rn=Object.prototype.hasOwnProperty;var S=(e,r)=>()=>(e&&(r=e(e=0)),r);var we=(e,r)=>()=>(r||e((r={exports:{}}).exports,r),r.exports),B=(e,r)=>{for(var n in r)ht(e,n,{get:r[n],enumerable:!0})},on=(e,r,n,s)=>{if(r&&typeof r=="object"||typeof r=="function")for(let i of en(r))!rn.call(e,i)&&i!==n&&ht(e,i,{get:()=>r[i],enumerable:!(s=Jo(r,i))||s.enumerable});return e};var b=(e,r,n)=>(n=e!=null?Zo(tn(e)):{},on(r||!e||!e.__esModule?ht(n,"default",{value:e,enumerable:!0}):n,e));import fi from"path";import{fileURLToPath as mi}from"url";var l=S(()=>{"use strict"});import nn from"http";import{withResult as pr}from"@byteslice/result";import*as ae from"zod";function un(e){if(!e.url)throw new Error("No URL found in callback response.");let r=new URL(e.url,wt);return ae.parse(sn,Object.fromEntries(r.searchParams.entries()))}function mr(e){e.writeHead(400,{"Content-Type":"text/html"}),e.end(cn)}function ln(e){e.writeHead(200,{"Content-Type":"text/html"}),e.end(an)}function gr(e){return new Promise((r,n)=>{let s=nn.createServer(async(i,c)=>{let p=await pr(()=>un(i),m=>m);if(p.failure){mr(c),n(p.failure);return}let E=await pr(()=>e(p.data),m=>m);if(E.failure){mr(c),n(E.failure);return}ln(c),s.close(()=>{r()})});s.listen(dr)})}var dr,wt,sn,an,cn,hr=S(()=>{"use strict";l();dr=8765,wt=`http://localhost:${dr}`,sn=ae.object({code:ae.string(),state:ae.string()}),an=`
3
3
  <!DOCTYPE html>
4
4
  <html lang="en">
5
5
  <head>
@@ -18,7 +18,7 @@ var Vt=Object.defineProperty;var f=(e,t)=>()=>(e&&(t=e(e=0)),t);var b=(e,t)=>{fo
18
18
  </div>
19
19
  </body>
20
20
  </html>
21
- `,Zt=`
21
+ `,cn=`
22
22
  <!DOCTYPE html>
23
23
  <html lang="en">
24
24
  <head>
@@ -38,5 +38,68 @@ var Vt=Object.defineProperty;var f=(e,t)=>()=>(e&&(t=e(e=0)),t);var b=(e,t)=>{fo
38
38
  </div>
39
39
  </body>
40
40
  </html>
41
- `});import qt from"@clerk/clerk-js/headless/index.js";async function Te(e){let t=new er(e);return await t.load({standardBrowser:!1}),t}async function Re(e,t){let r=await e.client?.signIn.create({ticket:t,strategy:"ticket"});if(!r||!r.createdSessionId)throw new Error("Failed to sign in.");return{createdSessionId:r.createdSessionId}}var er,Ue=f(()=>{"use strict";i();er=qt.Clerk});async function K(e,t){await e.fsPromise.stat(t).then(()=>!0).catch(()=>!1)||await e.fsPromise.mkdir(t,{recursive:!0})}function U(e){if(!e.path)throw new Error("No `path` found in context.");if(!e.os)throw new Error("No `os` found in context.");let t=e.os.homedir();return e.path.join(t,".swirls")}var Z=f(()=>{"use strict";i()});import*as j from"zod";function Q(e){return`${U(e)}/credentials`}async function Ee(e){let t=Q(e);await e.fsPromise.stat(t).then(()=>!0).catch(()=>!1)&&await e.fsPromise.unlink(t)}async function O(e){let t=Q(e),r=await e.fsPromise.readFile(t,"utf8");return j.parse(tr,JSON.parse(r))}async function X(e,t,r,o){let a=Q(e);await K(e,U(e)),await e.fsPromise.writeFile(a,JSON.stringify({idToken:t,jwt:r,sessionId:o}))}var tr,q=f(()=>{"use strict";i();Z();tr=j.object({idToken:j.string(),jwt:j.string(),sessionId:j.string()})});import rr from"open";function De(e=32){let t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",r=new Uint8Array(e);crypto.getRandomValues(r);let o="";for(let a of r)o+=t[a%t.length];return o}function Ae(e){let t=new URLSearchParams({client_id:e.clientId,redirect_uri:e.redirectUri,response_type:"code",scope:"openid profile email",state:e.state});rr(`${e.authorizeUri}?${t}`)}var $e=f(()=>{"use strict";i()});import*as v from"zod";var or,ir,N,ee=f(()=>{"use strict";i();or=v.object({API_URL:v.string(),OAUTH_AUTHORIZE_URL:v.string()}),ir={API_URL:"https://swirls.ai/api",OAUTH_AUTHORIZE_URL:"https://clerk.swirls.ai/oauth/authorize"},N=v.parse(or,ir)});import{withResult as ar}from"@byteslice/result";import{createORPCClient as sr,onError as nr}from"@orpc/client";import{RPCLink as cr}from"@orpc/client/fetch";async function u(e){let t=new cr({url:`${N.API_URL}/rpc`,headers:async()=>{let o=await ar(()=>O(e),c=>new Error("Failed to read credentials file",{cause:c.message}));if(o.failure)return{};let{idToken:a,jwt:s}=o.data;return{Authorization:`Bearer ${s||a}`}},interceptors:[nr(o=>{o instanceof Error&&o.name==="AbortError"||console.error(o)})]});return sr(t)}var P=f(()=>{"use strict";i();q();ee()});import{Box as lr,Text as ze}from"ink";import{jsx as _e,jsxs as mr}from"react/jsx-runtime";function p(e){return mr(lr,{flexDirection:"column",children:[_e(ze,{color:"red",children:e.message}),_e(ze,{children:"If this issue persists, send us an email at help@byteslice.co, and we can help you out."})]})}var y=f(()=>{"use strict";i()});import{Text as pr}from"ink";import{jsx as fr}from"react/jsx-runtime";function g(e){return fr(pr,{color:"green",children:e.message})}var k=f(()=>{"use strict";i()});import{Text as dr}from"ink";import{jsx as ur}from"react/jsx-runtime";function Be(e){return ur(dr,{color:"yellow",children:e.message})}var Oe=f(()=>{"use strict";i()});function gr(e){return`${U(e)}/project`}async function Ne(e){let t=gr(e);await e.fsPromise.stat(t).then(()=>!0).catch(()=>!1)&&await e.fsPromise.unlink(t)}var Me=f(()=>{"use strict";i();Z()});var te={};b(te,{login:()=>hr,logout:()=>xr});import{withResult as C}from"@byteslice/result";import{render as L}from"ink";import{jsx as I}from"react/jsx-runtime";async function wr(e,t,r){let o=await C(async()=>await(await u(e)).cli.exchangeToken({code:r.code}),h=>new Error("Failed to exchange callback code for token",{cause:h.message}));if(o.failure)throw o.failure;await X(e,o.data.idToken,"","");let a=await C(async()=>await(await u(e)).cli.createSignInTicket(),h=>new Error("Failed to exchange ID token code for a sign-in ticket",{cause:h.message}));if(a.failure)throw a.failure;let s=await Te(t.clerkPublishableKey),c=await C(()=>Re(s,a.data.token),h=>new Error("Failed to create a new sign-in for this device",{cause:h.message}));if(c.failure)throw c.failure;let d=await C(async()=>await(await u(e)).cli.createJwt({sessionId:c.data.createdSessionId}),h=>new Error("Failed to create a session JWT",{cause:h.message}));if(d.failure)throw d.failure;let n=await C(()=>X(e,o.data.idToken,d.data,c.data.createdSessionId),h=>new Error("Failed to save your credentials to disk",{cause:h.message}));if(n.failure)throw n.failure}async function hr(){let e=await u(this),t=De(),r=await C(()=>e.cli.getConfig(),a=>new Error("Failed to retrieve authentication configuration",{cause:a.message}));r.failure&&(L(I(p,{message:r.failure.message})),process.exit(1)),Ae({authorizeUri:N.OAUTH_AUTHORIZE_URL,clientId:r.data.clientId,redirectUri:G,state:t});let o=await C(()=>Le(async a=>{if(a.state!==t)throw new Error("Invalid state.");await wr(this,r.data,a)}),a=>a);o.failure&&(L(I(p,{message:o.failure.message})),process.exit(1)),L(I(g,{message:"Success! You are now logged in."}))}async function xr(){let e=await C(()=>O(this),s=>s);e.failure&&(L(I(p,{message:"There was an issue reading your credentials. You are probably already logged out."})),process.exit(1));let t=await u(this),r=await C(()=>t.cli.getConfig(),s=>new Error("Failed to retrieve authentication configuration",{cause:s.message}));r.failure&&(L(I(p,{message:r.failure.message})),process.exit(1)),(await C(async()=>t.cli.revokeSession({sessionId:e.data.sessionId}),s=>s)).failure&&L(I(Be,{message:"There was an issue revoking your session. You are probably already logged out. Purging credentials file..."}));let a=await C(async()=>{await Ee(this),await Ne(this)},s=>s);if(a.failure)throw a.failure;L(I(g,{message:"Success! You are now logged out."}))}var re=f(()=>{"use strict";i();Ie();Ue();q();$e();P();y();k();Oe();ee();Me()});import{Box as Pr,Text as Ye}from"ink";import kr from"ink-spinner";import{jsx as Ve,jsxs as We}from"react/jsx-runtime";function Ge(e){return We(Pr,{children:[Ve(Ye,{color:"cyan",children:Ve(kr,{type:"dots"})}),We(Ye,{children:[" ",e.message]})]})}var Ke=f(()=>{"use strict";i()});import{existsSync as Sr}from"fs";import{resolve as jr}from"path";import{configFileName as Ze,configSchema as Fr}from"@swirls/sdk/config";import{createJiti as vr}from"jiti";async function Qe(){let e=jr(process.cwd(),Ze);if(!Sr(e))throw new Error(`Config file not found in project root: ${Ze}`);let r=await vr(import.meta.url).import(e,{default:!0});return Fr.parse(r)}var Xe=f(()=>{"use strict";i()});async function qe(e,t){let r=await u(e),{results:o}=await r.forms.listForms({projectId:t});function a(c){return c.schema!=null}return o.filter(a).map(c=>({id:c.id,name:c.name,schema:c.schema}))}var et=f(()=>{"use strict";i();P()});import tt from"fs/promises";import Lr from"path";async function M(e,t){let r=Lr.dirname(e);await tt.mkdir(r,{recursive:!0}),await tt.writeFile(e,t,"utf-8")}var oe=f(()=>{"use strict";i()});var rt={};b(rt,{generateCode:()=>Tr});import ie from"process";import{withResult as ae}from"@byteslice/result";import{generateFormsCode as Ir}from"@swirls/sdk/form/generate";import{render as E}from"ink";import{jsx as D}from"react/jsx-runtime";async function Tr(){let e=await ae(()=>Qe(),s=>new Error("Failed to load configuration",{cause:s}));e.failure&&(E(D(p,{message:e.failure.message})),ie.exit(1));let{projectId:t,genPath:r}=e.data;E(D(Ge,{message:"Generating form code..."}));let o=await ae(async()=>{let s=['// This file was generated by "@swirls/cli dev generate"',"// Do not edit this file manually",""],c=await qe(this,t);return Ir(c,s)},s=>new Error(`Failed to generate form code: ${s.message}`,{cause:s}));o.failure&&(E(D(p,{message:o.failure.message})),ie.exit(1));let a=await ae(()=>M(r,o.data),s=>new Error("Failed to write code file",{cause:s}));a.failure&&(E(D(p,{message:a.failure.message})),ie.exit(1)),E(D(g,{message:`Success! Generated code at ${r}`}))}var ot=f(()=>{"use strict";i();y();Ke();k();Xe();et();oe()});import{Box as it,render as Rr,Text as at}from"ink";import Ur from"ink-text-input";import{useState as st}from"react";import{z as Er}from"zod";import{jsx as H,jsxs as nt}from"react/jsx-runtime";function Dr(e){let[t,r]=st(""),[o,a]=st(null);return nt(it,{flexDirection:"column",children:[nt(it,{children:[H(at,{children:"Enter project ID (UUID): "}),H(Ur,{value:t,onChange:d=>{a(null),r(d)},onSubmit:d=>{if(a(null),d.trim()===""){setImmediate(()=>e.onInput());return}let n=Er.uuid().safeParse(d);if(!n.success){a("Invalid UUID. Please try again."),r("");return}setImmediate(()=>e.onInput(n.data))}})]}),o&&H(at,{color:"red",children:o})]})}async function ct(){return new Promise(e=>{let t=Rr(H(Dr,{onInput:r=>{t.unmount(),e(r)}}))})}var lt=f(()=>{"use strict";i()});var mt={};b(mt,{initializeConfig:()=>Or});import{existsSync as Ar}from"fs";import{resolve as $r}from"path";import se from"process";import{withResult as zr}from"@byteslice/result";import{configFileName as _r,generateConfig as Br}from"@swirls/sdk/config";import{render as ne}from"ink";import{jsx as ce}from"react/jsx-runtime";async function Or(){let e=$r(se.cwd(),_r);Ar(e)&&(ne(ce(p,{message:`Configuration already exists at ${e}.`})),se.exit(1));let t=await ct(),r=await zr(async()=>{let o=Br(t);await M(e,o)},o=>new Error("Failed to create configuration",{cause:o}));r.failure&&(ne(ce(p,{message:r.failure.message})),se.exit(1)),ne(ce(g,{message:`Success! Created configuration at ${e}`}))}var pt=f(()=>{"use strict";i();y();k();lt();oe()});import{render as Jr}from"ink";import Yr from"open";import{jsx as Wr}from"react/jsx-runtime";async function J(e){let t=`${Vr}/${e.id}`;await Yr(t),Jr(Wr(g,{message:`Opened project "${e.name}" in browser.`}))}var Vr,le=f(()=>{"use strict";i();k();Vr="https://swirls.ai/projects"});import{Box as me,render as Gr,Text as Kr}from"ink";import Zr from"ink-text-input";import{useState as Qr}from"react";import{jsx as fe,jsxs as pe}from"react/jsx-runtime";function Xr(e){let[t,r]=Qr(""),o=a=>{let s=a.trim().toLowerCase(),c=s===""||s==="y"||s==="yes";setImmediate(()=>e.onAnswer(c))};return fe(me,{flexDirection:"column",children:pe(me,{children:[pe(Kr,{children:[e.message," "]}),fe(Zr,{value:t,onChange:r,onSubmit:o})]})})}async function ut(e){let{above:t}=e??{};return new Promise(r=>{let o=Gr(pe(me,{flexDirection:"column",children:[t,fe(Xr,{message:"Open project in browser? (Y/n)",onAnswer:a=>{o.unmount(),r(a)}})]}))})}var gt=f(()=>{"use strict";i()});var ht={};b(ht,{createProject:()=>to});import{withResult as qr}from"@byteslice/result";import{render as eo}from"ink";import{jsx as wt}from"react/jsx-runtime";async function to(e,t){let r=await u(this),o=await qr(()=>r.projects.createProject({name:t}),s=>new Error(`Failed to create project: ${s.message}`,{cause:s}));o.failure&&(eo(wt(p,{message:o.failure.message})),process.exit(1)),await ut({above:wt(g,{message:`Success! Created "${t}" project: ${o.data.id}`})})&&await J(o.data)}var xt=f(()=>{"use strict";i();P();y();k();le();gt()});var bt={};b(bt,{openProject:()=>oo});import{withResult as ro}from"@byteslice/result";import{render as yt}from"ink";import{jsx as Ct}from"react/jsx-runtime";async function oo(e,t){let r=await u(this),o=await ro(()=>r.projects.getProject({projectId:t}),a=>new Error(`Failed to get project: ${a.message}`,{cause:a}));o.failure&&(yt(Ct(p,{message:o.failure.message})),process.exit(1)),o.data||(yt(Ct(p,{message:"Project not found."})),process.exit(1)),await J(o.data)}var Pt=f(()=>{"use strict";i();P();y();le()});import{Box as T,Text as Y}from"ink";import{Fragment as no}from"react";import{Fragment as po,jsx as x,jsxs as ue}from"react/jsx-runtime";function co(e){return typeof e=="boolean"?e?ue(po,{children:[x(Y,{color:"green",children:"\u2714"})," yes"]}):"no":String(e)}function lo(e,t){return t.map(r=>{let o=r.key in e?co(e[r.key]):null;return{column:r,value:o}})}function mo(e,t,r=1){return t.map(o=>{let a=String(o).length,s=e.map(d=>o in d&&(typeof d[o]=="string"||typeof d[o]=="number")?String(d[o]).length:0),c=Math.max(...s,a)+r*2;return{name:String(o),key:o,width:c}})}function de(e){return x(Y,{children:Array(e.width).fill("\u2500").join("")})}function jt(e){let t=mo(e.data,e.keys),r=t.reduce((o,a)=>o+a.width,0);return ue(T,{flexDirection:"column",width:r,children:[x(de,{width:r}),x(T,{flexDirection:"row",children:t.map(o=>x(T,{width:o.width,children:x(Y,{bold:!0,color:"blue",children:o.name})},o.name))}),x(de,{width:r}),x(T,{flexDirection:"column",children:e.data.map((o,a)=>{let s=lo(o,t);return ue(no,{children:[x(T,{flexDirection:"row",children:s.map(c=>x(T,{width:c.column.width,children:x(Y,{children:c.value})},c.column.name))}),x(de,{width:r})]},`row-${a}`)})})]})}var Ft=f(()=>{"use strict";i()});import{existsSync as fo}from"fs";import{resolve as uo}from"path";import{configFileName as vt,configSchema as go}from"@swirls/sdk/config";import{createJiti as wo}from"jiti";async function S(e){if(e)return e;let t=uo(process.cwd(),vt);if(!fo(t))throw new Error(`No project specified and no ${vt} found. Use --project flag or run from a project directory.`);let o=await wo(import.meta.url).import(t,{default:!0});return go.parse(o).projectId}var R=f(()=>{"use strict";i()});var It={};b(It,{list:()=>ho});import{withResult as Lt}from"@byteslice/result";import{render as ge}from"ink";import{jsx as we}from"react/jsx-runtime";async function ho(e,t){let r=await Lt(()=>S(e.project),n=>new Error(n.message));r.failure&&(ge(we(p,{message:r.failure.message})),process.exit(1));let o=await u(this),a=await Lt(()=>o.buckets.listFiles({projectId:r.data,path:t}),n=>new Error(`Failed to list files: ${n.message}`,{cause:n}));a.failure&&(ge(we(p,{message:a.failure.message})),process.exit(1));let{files:s,folders:c}=a.data;if(c.length===0&&s.length===0){console.log("No files or folders found.");return}let d=[...c.map(n=>({type:"folder",name:n.name,size:"-"})),...s.map(n=>({type:"file",name:n.name,size:n.size?xo(n.size):"-"}))];ge(we(jt,{keys:["type","name","size"],data:d}))}function xo(e){if(e===0)return"0 B";let t=1024,r=["B","KB","MB","GB","TB"],o=Math.floor(Math.log(e)/Math.log(t));return`${parseFloat((e/t**o).toFixed(2))} ${r[o]}`}var Tt=f(()=>{"use strict";i();P();y();Ft();R()});var Rt={};b(Rt,{upload:()=>bo});import{readFile as yo}from"fs/promises";import{basename as Co}from"path";import{withResult as V}from"@byteslice/result";import{render as A}from"ink";import{jsx as $}from"react/jsx-runtime";async function bo(e,t,r){let o=await V(()=>S(e.project),w=>new Error(w.message));o.failure&&(A($(p,{message:o.failure.message})),process.exit(1));let a=await V(()=>yo(t),w=>new Error(`Failed to read file: ${w.message}`,{cause:w}));a.failure&&(A($(p,{message:a.failure.message})),process.exit(1));let s=Co(t),c=r?`${r}/${s}`:s,d=await u(this),n=await V(()=>d.buckets.createSignedUploadUrl({projectId:o.data,path:c}),w=>new Error(`Failed to get upload URL: ${w.message}`,{cause:w}));n.failure&&(A($(p,{message:n.failure.message})),process.exit(1));let h=await V(async()=>{let w=await fetch(n.data.signedUrl,{method:"PUT",headers:{"Content-Type":"application/octet-stream","x-upsert":"true"},body:a.data});if(!w.ok)throw new Error(`Upload failed: ${w.statusText}`);return w},w=>new Error(`Failed to upload file: ${w.message}`,{cause:w}));h.failure&&(A($(p,{message:h.failure.message})),process.exit(1)),A($(g,{message:`Uploaded ${s} to ${c}`}))}var Ut=f(()=>{"use strict";i();P();y();k();R()});var Et={};b(Et,{download:()=>ko});import{writeFile as Po}from"fs/promises";import{withResult as W}from"@byteslice/result";import{render as z}from"ink";import{jsx as _}from"react/jsx-runtime";async function ko(e,t,r){let o=await W(()=>S(e.project),n=>new Error(n.message));o.failure&&(z(_(p,{message:o.failure.message})),process.exit(1));let a=await u(this),s=await W(()=>a.buckets.createSignedUrl({projectId:o.data,path:t}),n=>new Error(`Failed to get download URL: ${n.message}`,{cause:n}));s.failure&&(z(_(p,{message:s.failure.message})),process.exit(1));let c=await W(async()=>{let n=await fetch(s.data.signedUrl);if(!n.ok)throw new Error(`Download failed: ${n.statusText}`);return n.arrayBuffer()},n=>new Error(`Failed to download file: ${n.message}`,{cause:n}));c.failure&&(z(_(p,{message:c.failure.message})),process.exit(1));let d=await W(()=>Po(r,Buffer.from(c.data)),n=>new Error(`Failed to write file: ${n.message}`,{cause:n}));d.failure&&(z(_(p,{message:d.failure.message})),process.exit(1)),z(_(g,{message:`Downloaded ${t} to ${r}`}))}var Dt=f(()=>{"use strict";i();P();y();k();R()});var $t={};b($t,{deleteFile:()=>So});import{withResult as At}from"@byteslice/result";import{render as he}from"ink";import{jsx as xe}from"react/jsx-runtime";async function So(e,t){let r=await At(()=>S(e.project),s=>new Error(s.message));r.failure&&(he(xe(p,{message:r.failure.message})),process.exit(1));let o=await u(this),a=await At(()=>o.buckets.deleteFile({projectId:r.data,path:t}),s=>new Error(`Failed to delete file: ${s.message}`,{cause:s}));a.failure&&(he(xe(p,{message:a.failure.message})),process.exit(1)),he(xe(g,{message:`Deleted ${t}`}))}var zt=f(()=>{"use strict";i();P();y();k();R()});var Bt={};b(Bt,{url:()=>jo});import{withResult as _t}from"@byteslice/result";import{render as ye}from"ink";import{jsx as Ce}from"react/jsx-runtime";async function jo(e,t){let r=await _t(()=>S(e.project),s=>new Error(s.message));r.failure&&(ye(Ce(p,{message:r.failure.message})),process.exit(1));let o=await u(this),a=await _t(()=>o.buckets.createSignedUrl({projectId:r.data,path:t,expiresIn:e.expires}),s=>new Error(`Failed to create signed URL: ${s.message}`,{cause:s}));a.failure&&(ye(Ce(p,{message:a.failure.message})),process.exit(1)),console.log(a.data.signedUrl),ye(Ce(g,{message:`URL expires at ${a.data.expiresAt}`}))}var Ot=f(()=>{"use strict";i();P();y();k();R()});i();import{proposeCompletions as Yt}from"@stricli/core";i();import{buildInstallCommand as Uo,buildUninstallCommand as Eo}from"@stricli/auto-complete";import{buildApplication as Do,buildRouteMap as Ao}from"@stricli/core";i();import{buildCommand as He,buildRouteMap as yr}from"@stricli/core";var Cr=He({loader:async()=>{let{login:e}=await Promise.resolve().then(()=>(re(),te));return e},parameters:{positional:{kind:"tuple",parameters:[]}},docs:{brief:"Log in with an existing account"}}),br=He({loader:async()=>{let{logout:e}=await Promise.resolve().then(()=>(re(),te));return e},parameters:{positional:{kind:"tuple",parameters:[]}},docs:{brief:"Log out of an existing account"}}),Je=yr({routes:{login:Cr,logout:br},docs:{brief:"Auth commands"}});i();import{buildCommand as ft,buildRouteMap as Nr}from"@stricli/core";var Mr=ft({loader:async()=>{let{generateCode:e}=await Promise.resolve().then(()=>(ot(),rt));return e},parameters:{positional:{kind:"tuple",parameters:[]}},docs:{brief:"Generate application code and types"}}),Hr=ft({loader:async()=>{let{initializeConfig:e}=await Promise.resolve().then(()=>(pt(),mt));return e},parameters:{positional:{kind:"tuple",parameters:[]}},docs:{brief:"Initialize Swirls configuration file"}}),dt=Nr({routes:{gen:Mr,init:Hr},docs:{brief:"Developer commands"}});i();import{buildCommand as kt,buildRouteMap as io}from"@stricli/core";var ao=kt({loader:async()=>{let{createProject:e}=await Promise.resolve().then(()=>(xt(),ht));return e},parameters:{positional:{kind:"tuple",parameters:[{brief:"Project name",parse:String,placeholder:"name"}]}},docs:{brief:"Create a new project"}}),so=kt({loader:async()=>{let{openProject:e}=await Promise.resolve().then(()=>(Pt(),bt));return e},parameters:{positional:{kind:"tuple",parameters:[{brief:"Project ID",parse:String,placeholder:"project-id"}]}},docs:{brief:"Open project in browser"}}),St=io({routes:{create:ao,open:so},docs:{brief:"Project commands"}});i();import{buildCommand as B,buildRouteMap as Fo}from"@stricli/core";var vo=B({loader:async()=>{let{list:e}=await Promise.resolve().then(()=>(Tt(),It));return e},parameters:{positional:{kind:"tuple",parameters:[{brief:"Path to list (optional)",parse:String,placeholder:"path",optional:!0}]},flags:{project:{kind:"parsed",brief:"Project ID (uses config if not specified)",parse:String,optional:!0}}},docs:{brief:"List files in storage"}}),Lo=B({loader:async()=>{let{upload:e}=await Promise.resolve().then(()=>(Ut(),Rt));return e},parameters:{positional:{kind:"tuple",parameters:[{brief:"Local file path to upload",parse:String,placeholder:"file"},{brief:"Destination path in storage (optional)",parse:String,placeholder:"dest",optional:!0}]},flags:{project:{kind:"parsed",brief:"Project ID (uses config if not specified)",parse:String,optional:!0}}},docs:{brief:"Upload a file to storage"}}),Io=B({loader:async()=>{let{download:e}=await Promise.resolve().then(()=>(Dt(),Et));return e},parameters:{positional:{kind:"tuple",parameters:[{brief:"Path to file in storage",parse:String,placeholder:"path"},{brief:"Local destination path",parse:String,placeholder:"dest"}]},flags:{project:{kind:"parsed",brief:"Project ID (uses config if not specified)",parse:String,optional:!0}}},docs:{brief:"Download a file from storage"}}),To=B({loader:async()=>{let{deleteFile:e}=await Promise.resolve().then(()=>(zt(),$t));return e},parameters:{positional:{kind:"tuple",parameters:[{brief:"Path to file in storage",parse:String,placeholder:"path"}]},flags:{project:{kind:"parsed",brief:"Project ID (uses config if not specified)",parse:String,optional:!0}}},docs:{brief:"Delete a file from storage"}}),Ro=B({loader:async()=>{let{url:e}=await Promise.resolve().then(()=>(Ot(),Bt));return e},parameters:{positional:{kind:"tuple",parameters:[{brief:"Path to file in storage",parse:String,placeholder:"path"}]},flags:{project:{kind:"parsed",brief:"Project ID (uses config if not specified)",parse:String,optional:!0},expires:{kind:"parsed",brief:"Expiration time in seconds (default: 86400 = 24 hours)",parse:Number,optional:!0}}},docs:{brief:"Get a signed URL for a file"}}),Nt=Fo({routes:{list:vo,upload:Lo,download:Io,delete:To,url:Ro},docs:{brief:"Storage commands"}});var Mt="@swirls/cli",Ht="0.0.20",Jt="Swirls command line application";var $o=Ao({routes:{auth:Je,dev:dt,project:St,storage:Nt,install:Uo("cli",{bash:"__cli_bash_complete"}),uninstall:Eo("cli",{bash:!0})},docs:{brief:Jt,hideRoute:{install:!0,uninstall:!0}}}),Pe=Do($o,{name:Mt,versionInfo:{currentVersion:Ht}});i();import zo from"fs";import _o from"fs/promises";import Bo from"os";import Oo from"path";function ke(e){return{fs:zo,fsPromise:_o,os:Bo,path:Oo,process:e}}var Se=process.argv.slice(3);process.env.COMP_LINE?.endsWith(" ")&&Se.push("");await Yt(Pe,Se,ke(process));try{for(let{completion:e}of await Yt(Pe,Se,ke(process)))process.stdout.write(`${e}
41
+ `});import fn from"@clerk/clerk-js/headless/index.js";async function wr(e){let r=new pn(e);return await r.load({standardBrowser:!1}),r}async function yr(e,r){let n=await e.client?.signIn.create({ticket:r,strategy:"ticket"});if(!n||!n.createdSessionId)throw new Error("Failed to sign in.");return{createdSessionId:n.createdSessionId}}var pn,vr=S(()=>{"use strict";l();pn=fn.Clerk});async function yt(e,r){await e.fsPromise.stat(r).then(()=>!0).catch(()=>!1)||await e.fsPromise.mkdir(r,{recursive:!0})}function Ie(e){if(!e.path)throw new Error("No `path` found in context.");if(!e.os)throw new Error("No `os` found in context.");let r=e.os.homedir();return e.path.join(r,".swirls")}var vt=S(()=>{"use strict";l()});import*as J from"zod";function _t(e){return`${Ie(e)}/credentials`}async function _r(e){let r=_t(e);await e.fsPromise.stat(r).then(()=>!0).catch(()=>!1)&&await e.fsPromise.unlink(r)}async function Ke(e){let r=_t(e),n=await e.fsPromise.readFile(r,"utf8");return J.parse(mn,JSON.parse(n))}async function Et(e,r,n,s){let i=_t(e);await yt(e,Ie(e)),await e.fsPromise.writeFile(i,JSON.stringify({idToken:r,jwt:n,sessionId:s}))}var mn,bt=S(()=>{"use strict";l();vt();mn=J.object({idToken:J.string(),jwt:J.string(),sessionId:J.string()})});import dn from"open";function Er(e=32){let r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",n=new Uint8Array(e);crypto.getRandomValues(n);let s="";for(let i of n)s+=r[i%r.length];return s}function br(e){let r=new URLSearchParams({client_id:e.clientId,redirect_uri:e.redirectUri,response_type:"code",scope:"openid profile email",state:e.state});dn(`${e.authorizeUri}?${r}`)}var Cr=S(()=>{"use strict";l()});import*as ce from"zod";var gn,hn,Qe,Ct=S(()=>{"use strict";l();gn=ce.object({API_URL:ce.string(),OAUTH_AUTHORIZE_URL:ce.string()}),hn={API_URL:"https://swirls.ai/api",OAUTH_AUTHORIZE_URL:"https://clerk.swirls.ai/oauth/authorize"},Qe=ce.parse(gn,hn)});import{withResult as wn}from"@byteslice/result";import{createORPCClient as yn,onError as vn}from"@orpc/client";import{RPCLink as _n}from"@orpc/client/fetch";async function U(e){let r=new _n({url:`${Qe.API_URL}/rpc`,headers:async()=>{let s=await wn(()=>Ke(e),p=>new Error("Failed to read credentials file",{cause:p.message}));if(s.failure)return{};let{idToken:i,jwt:c}=s.data;return{Authorization:`Bearer ${c||i}`}},interceptors:[vn(s=>{s instanceof Error&&s.name==="AbortError"||console.error(s)})]});return yn(r)}var W=S(()=>{"use strict";l();bt();Ct()});var xr=we(Xe=>{"use strict";l();var En=Symbol.for("react.transitional.element"),bn=Symbol.for("react.fragment");function Tr(e,r,n){var s=null;if(n!==void 0&&(s=""+n),r.key!==void 0&&(s=""+r.key),"key"in r){n={};for(var i in r)i!=="key"&&(n[i]=r[i])}else n=r;return r=n.ref,{$$typeof:En,type:e,key:s,ref:r!==void 0?r:null,props:n}}Xe.Fragment=bn;Xe.jsx=Tr;Xe.jsxs=Tr});var $r=we(h=>{"use strict";l();var Rt=Symbol.for("react.transitional.element"),Cn=Symbol.for("react.portal"),Tn=Symbol.for("react.fragment"),xn=Symbol.for("react.strict_mode"),Rn=Symbol.for("react.profiler"),kn=Symbol.for("react.consumer"),Sn=Symbol.for("react.context"),Pn=Symbol.for("react.forward_ref"),jn=Symbol.for("react.suspense"),An=Symbol.for("react.memo"),jr=Symbol.for("react.lazy"),On=Symbol.for("react.activity"),Rr=Symbol.iterator;function Ln(e){return e===null||typeof e!="object"?null:(e=Rr&&e[Rr]||e["@@iterator"],typeof e=="function"?e:null)}var Ar={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Or=Object.assign,Lr={};function ve(e,r,n){this.props=e,this.context=r,this.refs=Lr,this.updater=n||Ar}ve.prototype.isReactComponent={};ve.prototype.setState=function(e,r){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,r,"setState")};ve.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function Ir(){}Ir.prototype=ve.prototype;function kt(e,r,n){this.props=e,this.context=r,this.refs=Lr,this.updater=n||Ar}var St=kt.prototype=new Ir;St.constructor=kt;Or(St,ve.prototype);St.isPureReactComponent=!0;var kr=Array.isArray;function xt(){}var A={H:null,A:null,T:null,S:null},Nr=Object.prototype.hasOwnProperty;function Pt(e,r,n){var s=n.ref;return{$$typeof:Rt,type:e,key:r,ref:s!==void 0?s:null,props:n}}function In(e,r){return Pt(e.type,r,e.props)}function jt(e){return typeof e=="object"&&e!==null&&e.$$typeof===Rt}function Nn(e){var r={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(n){return r[n]})}var Sr=/\/+/g;function Tt(e,r){return typeof e=="object"&&e!==null&&e.key!=null?Nn(""+e.key):r.toString(36)}function $n(e){switch(e.status){case"fulfilled":return e.value;case"rejected":throw e.reason;default:switch(typeof e.status=="string"?e.then(xt,xt):(e.status="pending",e.then(function(r){e.status==="pending"&&(e.status="fulfilled",e.value=r)},function(r){e.status==="pending"&&(e.status="rejected",e.reason=r)})),e.status){case"fulfilled":return e.value;case"rejected":throw e.reason}}throw e}function ye(e,r,n,s,i){var c=typeof e;(c==="undefined"||c==="boolean")&&(e=null);var p=!1;if(e===null)p=!0;else switch(c){case"bigint":case"string":case"number":p=!0;break;case"object":switch(e.$$typeof){case Rt:case Cn:p=!0;break;case jr:return p=e._init,ye(p(e._payload),r,n,s,i)}}if(p)return i=i(e),p=s===""?"."+Tt(e,0):s,kr(i)?(n="",p!=null&&(n=p.replace(Sr,"$&/")+"/"),ye(i,r,n,"",function(O){return O})):i!=null&&(jt(i)&&(i=In(i,n+(i.key==null||e&&e.key===i.key?"":(""+i.key).replace(Sr,"$&/")+"/")+p)),r.push(i)),1;p=0;var E=s===""?".":s+":";if(kr(e))for(var m=0;m<e.length;m++)s=e[m],c=E+Tt(s,m),p+=ye(s,r,n,c,i);else if(m=Ln(e),typeof m=="function")for(e=m.call(e),m=0;!(s=e.next()).done;)s=s.value,c=E+Tt(s,m++),p+=ye(s,r,n,c,i);else if(c==="object"){if(typeof e.then=="function")return ye($n(e),r,n,s,i);throw r=String(e),Error("Objects are not valid as a React child (found: "+(r==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":r)+"). If you meant to render a collection of children, use an array instead.")}return p}function Ze(e,r,n){if(e==null)return e;var s=[],i=0;return ye(e,s,"","",function(c){return r.call(n,c,i++)}),s}function Un(e){if(e._status===-1){var r=e._result;r=r(),r.then(function(n){(e._status===0||e._status===-1)&&(e._status=1,e._result=n)},function(n){(e._status===0||e._status===-1)&&(e._status=2,e._result=n)}),e._status===-1&&(e._status=0,e._result=r)}if(e._status===1)return e._result.default;throw e._result}var Pr=typeof reportError=="function"?reportError:function(e){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var r=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof e=="object"&&e!==null&&typeof e.message=="string"?String(e.message):String(e),error:e});if(!window.dispatchEvent(r))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",e);return}console.error(e)},Fn={map:Ze,forEach:function(e,r,n){Ze(e,function(){r.apply(this,arguments)},n)},count:function(e){var r=0;return Ze(e,function(){r++}),r},toArray:function(e){return Ze(e,function(r){return r})||[]},only:function(e){if(!jt(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};h.Activity=On;h.Children=Fn;h.Component=ve;h.Fragment=Tn;h.Profiler=Rn;h.PureComponent=kt;h.StrictMode=xn;h.Suspense=jn;h.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=A;h.__COMPILER_RUNTIME={__proto__:null,c:function(e){return A.H.useMemoCache(e)}};h.cache=function(e){return function(){return e.apply(null,arguments)}};h.cacheSignal=function(){return null};h.cloneElement=function(e,r,n){if(e==null)throw Error("The argument must be a React element, but you passed "+e+".");var s=Or({},e.props),i=e.key;if(r!=null)for(c in r.key!==void 0&&(i=""+r.key),r)!Nr.call(r,c)||c==="key"||c==="__self"||c==="__source"||c==="ref"&&r.ref===void 0||(s[c]=r[c]);var c=arguments.length-2;if(c===1)s.children=n;else if(1<c){for(var p=Array(c),E=0;E<c;E++)p[E]=arguments[E+2];s.children=p}return Pt(e.type,i,s)};h.createContext=function(e){return e={$$typeof:Sn,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null},e.Provider=e,e.Consumer={$$typeof:kn,_context:e},e};h.createElement=function(e,r,n){var s,i={},c=null;if(r!=null)for(s in r.key!==void 0&&(c=""+r.key),r)Nr.call(r,s)&&s!=="key"&&s!=="__self"&&s!=="__source"&&(i[s]=r[s]);var p=arguments.length-2;if(p===1)i.children=n;else if(1<p){for(var E=Array(p),m=0;m<p;m++)E[m]=arguments[m+2];i.children=E}if(e&&e.defaultProps)for(s in p=e.defaultProps,p)i[s]===void 0&&(i[s]=p[s]);return Pt(e,c,i)};h.createRef=function(){return{current:null}};h.forwardRef=function(e){return{$$typeof:Pn,render:e}};h.isValidElement=jt;h.lazy=function(e){return{$$typeof:jr,_payload:{_status:-1,_result:e},_init:Un}};h.memo=function(e,r){return{$$typeof:An,type:e,compare:r===void 0?null:r}};h.startTransition=function(e){var r=A.T,n={};A.T=n;try{var s=e(),i=A.S;i!==null&&i(n,s),typeof s=="object"&&s!==null&&typeof s.then=="function"&&s.then(xt,Pr)}catch(c){Pr(c)}finally{r!==null&&n.types!==null&&(r.types=n.types),A.T=r}};h.unstable_useCacheRefresh=function(){return A.H.useCacheRefresh()};h.use=function(e){return A.H.use(e)};h.useActionState=function(e,r,n){return A.H.useActionState(e,r,n)};h.useCallback=function(e,r){return A.H.useCallback(e,r)};h.useContext=function(e){return A.H.useContext(e)};h.useDebugValue=function(){};h.useDeferredValue=function(e,r){return A.H.useDeferredValue(e,r)};h.useEffect=function(e,r){return A.H.useEffect(e,r)};h.useEffectEvent=function(e){return A.H.useEffectEvent(e)};h.useId=function(){return A.H.useId()};h.useImperativeHandle=function(e,r,n){return A.H.useImperativeHandle(e,r,n)};h.useInsertionEffect=function(e,r){return A.H.useInsertionEffect(e,r)};h.useLayoutEffect=function(e,r){return A.H.useLayoutEffect(e,r)};h.useMemo=function(e,r){return A.H.useMemo(e,r)};h.useOptimistic=function(e,r){return A.H.useOptimistic(e,r)};h.useReducer=function(e,r,n){return A.H.useReducer(e,r,n)};h.useRef=function(e){return A.H.useRef(e)};h.useState=function(e){return A.H.useState(e)};h.useSyncExternalStore=function(e,r,n){return A.H.useSyncExternalStore(e,r,n)};h.useTransition=function(){return A.H.useTransition()};h.version="19.2.1"});var Ur=we((g,Je)=>{"use strict";l();process.env.NODE_ENV!=="production"&&(function(){function e(t,o){Object.defineProperty(s.prototype,t,{get:function(){console.warn("%s(...) is deprecated in plain JavaScript React classes. %s",o[0],o[1])}})}function r(t){return t===null||typeof t!="object"?null:(t=Be&&t[Be]||t["@@iterator"],typeof t=="function"?t:null)}function n(t,o){t=(t=t.constructor)&&(t.displayName||t.name)||"ReactClass";var u=t+"."+o;Jt[u]||(console.error("Can't call %s on a component that is not yet mounted. This is a no-op, but it might indicate a bug in your application. Instead, assign to `this.state` directly or define a `state = {};` class property with the desired state in the %s component.",o,t),Jt[u]=!0)}function s(t,o,u){this.props=t,this.context=o,this.refs=dt,this.updater=u||er}function i(){}function c(t,o,u){this.props=t,this.context=o,this.refs=dt,this.updater=u||er}function p(){}function E(t){return""+t}function m(t){try{E(t);var o=!1}catch{o=!0}if(o){o=console;var u=o.error,f=typeof Symbol=="function"&&Symbol.toStringTag&&t[Symbol.toStringTag]||t.constructor.name||"Object";return u.call(o,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",f),E(t)}}function O(t){if(t==null)return null;if(typeof t=="function")return t.$$typeof===Go?null:t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case de:return"Fragment";case a:return"Profiler";case Ae:return"StrictMode";case ie:return"Suspense";case Oe:return"SuspenseList";case ge:return"Activity"}if(typeof t=="object")switch(typeof t.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),t.$$typeof){case je:return"Portal";case j:return t.displayName||"Context";case w:return(t._context.displayName||"Context")+".Consumer";case $:var o=t.render;return t=t.displayName,t||(t=o.displayName||o.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case N:return o=t.displayName||null,o!==null?o:O(t.type)||"Memo";case M:o=t._payload,t=t._init;try{return O(t(o))}catch{}}return null}function L(t){if(t===de)return"<>";if(typeof t=="object"&&t!==null&&t.$$typeof===M)return"<...>";try{var o=O(t);return o?"<"+o+">":"<...>"}catch{return"<...>"}}function Re(){var t=C.A;return t===null?null:t.getOwner()}function ke(){return Error("react-stack-top-frame")}function oe(t){if(We.call(t,"key")){var o=Object.getOwnPropertyDescriptor(t,"key").get;if(o&&o.isReactWarning)return!1}return t.key!==void 0}function Ye(t,o){function u(){nr||(nr=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",o))}u.isReactWarning=!0,Object.defineProperty(t,"key",{get:u,configurable:!0})}function lt(){var t=O(this.type);return ir[t]||(ir[t]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),t=this.props.ref,t!==void 0?t:null}function ne(t,o,u,f,d,T){var _=u.ref;return t={$$typeof:me,type:t,key:o,props:u,_owner:f},(_!==void 0?_:null)!==null?Object.defineProperty(t,"ref",{enumerable:!1,get:lt}):Object.defineProperty(t,"ref",{enumerable:!1,value:null}),t._store={},Object.defineProperty(t._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(t,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(t,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:d}),Object.defineProperty(t,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:T}),Object.freeze&&(Object.freeze(t.props),Object.freeze(t)),t}function ft(t,o){return o=ne(t.type,o,t.props,t._owner,t._debugStack,t._debugTask),t._store&&(o._store.validated=t._store.validated),o}function ze(t){V(t)?t._store&&(t._store.validated=1):typeof t=="object"&&t!==null&&t.$$typeof===M&&(t._payload.status==="fulfilled"?V(t._payload.value)&&t._payload.value._store&&(t._payload.value._store.validated=1):t._store&&(t._store.validated=1))}function V(t){return typeof t=="object"&&t!==null&&t.$$typeof===me}function pt(t){var o={"=":"=0",":":"=2"};return"$"+t.replace(/[=:]/g,function(u){return o[u]})}function Se(t,o){return typeof t=="object"&&t!==null&&t.key!=null?(m(t.key),pt(""+t.key)):o.toString(36)}function mt(t){switch(t.status){case"fulfilled":return t.value;case"rejected":throw t.reason;default:switch(typeof t.status=="string"?t.then(p,p):(t.status="pending",t.then(function(o){t.status==="pending"&&(t.status="fulfilled",t.value=o)},function(o){t.status==="pending"&&(t.status="rejected",t.reason=o)})),t.status){case"fulfilled":return t.value;case"rejected":throw t.reason}}throw t}function K(t,o,u,f,d){var T=typeof t;(T==="undefined"||T==="boolean")&&(t=null);var _=!1;if(t===null)_=!0;else switch(T){case"bigint":case"string":case"number":_=!0;break;case"object":switch(t.$$typeof){case me:case je:_=!0;break;case M:return _=t._init,K(_(t._payload),o,u,f,d)}}if(_){_=t,d=d(_);var P=f===""?"."+Se(_,0):f;return rr(d)?(u="",P!=null&&(u=P.replace(cr,"$&/")+"/"),K(d,o,u,"",function(Z){return Z})):d!=null&&(V(d)&&(d.key!=null&&(_&&_.key===d.key||m(d.key)),u=ft(d,u+(d.key==null||_&&_.key===d.key?"":(""+d.key).replace(cr,"$&/")+"/")+P),f!==""&&_!=null&&V(_)&&_.key==null&&_._store&&!_._store.validated&&(u._store.validated=2),d=u),o.push(d)),1}if(_=0,P=f===""?".":f+":",rr(t))for(var x=0;x<t.length;x++)f=t[x],T=P+Se(f,x),_+=K(f,o,u,T,d);else if(x=r(t),typeof x=="function")for(x===t.entries&&(ar||console.warn("Using Maps as children is not supported. Use an array of keyed ReactElements instead."),ar=!0),t=x.call(t),x=0;!(f=t.next()).done;)f=f.value,T=P+Se(f,x++),_+=K(f,o,u,T,d);else if(T==="object"){if(typeof t.then=="function")return K(mt(t),o,u,f,d);throw o=String(t),Error("Objects are not valid as a React child (found: "+(o==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":o)+"). If you meant to render a collection of children, use an array instead.")}return _}function le(t,o,u){if(t==null)return t;var f=[],d=0;return K(t,f,"","",function(T){return o.call(u,T,d++)}),f}function Pe(t){if(t._status===-1){var o=t._ioInfo;o!=null&&(o.start=o.end=performance.now()),o=t._result;var u=o();if(u.then(function(d){if(t._status===0||t._status===-1){t._status=1,t._result=d;var T=t._ioInfo;T!=null&&(T.end=performance.now()),u.status===void 0&&(u.status="fulfilled",u.value=d)}},function(d){if(t._status===0||t._status===-1){t._status=2,t._result=d;var T=t._ioInfo;T!=null&&(T.end=performance.now()),u.status===void 0&&(u.status="rejected",u.reason=d)}}),o=t._ioInfo,o!=null){o.value=u;var f=u.displayName;typeof f=="string"&&(o.name=f)}t._status===-1&&(t._status=0,t._result=u)}if(t._status===1)return o=t._result,o===void 0&&console.error(`lazy: Expected the result of a dynamic import() call. Instead received: %s
42
+
43
+ Your code should look like:
44
+ const MyComponent = lazy(() => import('./MyComponent'))
45
+
46
+ Did you accidentally put curly braces around the import?`,o),"default"in o||console.error(`lazy: Expected the result of a dynamic import() call. Instead received: %s
47
+
48
+ Your code should look like:
49
+ const MyComponent = lazy(() => import('./MyComponent'))`,o),o.default;throw t._result}function I(){var t=C.H;return t===null&&console.error(`Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:
50
+ 1. You might have mismatching versions of React and the renderer (such as React DOM)
51
+ 2. You might be breaking the Rules of Hooks
52
+ 3. You might have more than one copy of React in the same app
53
+ See https://react.dev/link/invalid-hook-call for tips about how to debug and fix this problem.`),t}function He(){C.asyncTransitions--}function Q(t){if(qe===null)try{var o=("require"+Math.random()).slice(0,7);qe=(Je&&Je[o]).call(Je,"timers").setImmediate}catch{qe=function(f){lr===!1&&(lr=!0,typeof MessageChannel>"u"&&console.error("This browser does not have a MessageChannel implementation, so enqueuing tasks via await act(async () => ...) will fail. Please file an issue at https://github.com/facebook/react/issues if you encounter this warning."));var d=new MessageChannel;d.port1.onmessage=f,d.port2.postMessage(void 0)}}return qe(t)}function X(t){return 1<t.length&&typeof AggregateError=="function"?new AggregateError(t):t[0]}function fe(t,o){o!==Ge-1&&console.error("You seem to have overlapping act() calls, this is not supported. Be sure to await previous act() calls before making a new one. "),Ge=o}function se(t,o,u){var f=C.actQueue;if(f!==null)if(f.length!==0)try{pe(f),Q(function(){return se(t,o,u)});return}catch(d){C.thrownErrors.push(d)}else C.actQueue=null;0<C.thrownErrors.length?(f=X(C.thrownErrors),C.thrownErrors.length=0,u(f)):o(t)}function pe(t){if(!gt){gt=!0;var o=0;try{for(;o<t.length;o++){var u=t[o];do{C.didUsePromise=!1;var f=u(!1);if(f!==null){if(C.didUsePromise){t[o]=u,t.splice(0,o);return}u=f}else break}while(!0)}t.length=0}catch(d){t.splice(0,o+1),C.thrownErrors.push(d)}finally{gt=!1}}}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var me=Symbol.for("react.transitional.element"),je=Symbol.for("react.portal"),de=Symbol.for("react.fragment"),Ae=Symbol.for("react.strict_mode"),a=Symbol.for("react.profiler"),w=Symbol.for("react.consumer"),j=Symbol.for("react.context"),$=Symbol.for("react.forward_ref"),ie=Symbol.for("react.suspense"),Oe=Symbol.for("react.suspense_list"),N=Symbol.for("react.memo"),M=Symbol.for("react.lazy"),ge=Symbol.for("react.activity"),Be=Symbol.iterator,Jt={},er={isMounted:function(){return!1},enqueueForceUpdate:function(t){n(t,"forceUpdate")},enqueueReplaceState:function(t){n(t,"replaceState")},enqueueSetState:function(t){n(t,"setState")}},tr=Object.assign,dt={};Object.freeze(dt),s.prototype.isReactComponent={},s.prototype.setState=function(t,o){if(typeof t!="object"&&typeof t!="function"&&t!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,t,o,"setState")},s.prototype.forceUpdate=function(t){this.updater.enqueueForceUpdate(this,t,"forceUpdate")};var Y={isMounted:["isMounted","Instead, make sure to clean up subscriptions and pending requests in componentWillUnmount to prevent memory leaks."],replaceState:["replaceState","Refactor your code to use setState instead (see https://github.com/facebook/react/issues/3236)."]};for(Le in Y)Y.hasOwnProperty(Le)&&e(Le,Y[Le]);i.prototype=s.prototype,Y=c.prototype=new i,Y.constructor=c,tr(Y,s.prototype),Y.isPureReactComponent=!0;var rr=Array.isArray,Go=Symbol.for("react.client.reference"),C={H:null,A:null,T:null,S:null,actQueue:null,asyncTransitions:0,isBatchingLegacy:!1,didScheduleLegacyUpdate:!1,didUsePromise:!1,thrownErrors:[],getCurrentStack:null,recentlyCreatedOwnerStacks:0},We=Object.prototype.hasOwnProperty,or=console.createTask?console.createTask:function(){return null};Y={react_stack_bottom_frame:function(t){return t()}};var nr,sr,ir={},Vo=Y.react_stack_bottom_frame.bind(Y,ke)(),Ko=or(L(ke)),ar=!1,cr=/\/+/g,ur=typeof reportError=="function"?reportError:function(t){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var o=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof t=="object"&&t!==null&&typeof t.message=="string"?String(t.message):String(t),error:t});if(!window.dispatchEvent(o))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",t);return}console.error(t)},lr=!1,qe=null,Ge=0,Ve=!1,gt=!1,fr=typeof queueMicrotask=="function"?function(t){queueMicrotask(function(){return queueMicrotask(t)})}:Q;Y=Object.freeze({__proto__:null,c:function(t){return I().useMemoCache(t)}});var Le={map:le,forEach:function(t,o,u){le(t,function(){o.apply(this,arguments)},u)},count:function(t){var o=0;return le(t,function(){o++}),o},toArray:function(t){return le(t,function(o){return o})||[]},only:function(t){if(!V(t))throw Error("React.Children.only expected to receive a single React element child.");return t}};g.Activity=ge,g.Children=Le,g.Component=s,g.Fragment=de,g.Profiler=a,g.PureComponent=c,g.StrictMode=Ae,g.Suspense=ie,g.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=C,g.__COMPILER_RUNTIME=Y,g.act=function(t){var o=C.actQueue,u=Ge;Ge++;var f=C.actQueue=o!==null?o:[],d=!1;try{var T=t()}catch(x){C.thrownErrors.push(x)}if(0<C.thrownErrors.length)throw fe(o,u),t=X(C.thrownErrors),C.thrownErrors.length=0,t;if(T!==null&&typeof T=="object"&&typeof T.then=="function"){var _=T;return fr(function(){d||Ve||(Ve=!0,console.error("You called act(async () => ...) without await. This could lead to unexpected testing behaviour, interleaving multiple act calls and mixing their scopes. You should - await act(async () => ...);"))}),{then:function(x,Z){d=!0,_.then(function(he){if(fe(o,u),u===0){try{pe(f),Q(function(){return se(he,x,Z)})}catch(Xo){C.thrownErrors.push(Xo)}if(0<C.thrownErrors.length){var Qo=X(C.thrownErrors);C.thrownErrors.length=0,Z(Qo)}}else x(he)},function(he){fe(o,u),0<C.thrownErrors.length&&(he=X(C.thrownErrors),C.thrownErrors.length=0),Z(he)})}}}var P=T;if(fe(o,u),u===0&&(pe(f),f.length!==0&&fr(function(){d||Ve||(Ve=!0,console.error("A component suspended inside an `act` scope, but the `act` call was not awaited. When testing React components that depend on asynchronous data, you must await the result:\n\nawait act(() => ...)"))}),C.actQueue=null),0<C.thrownErrors.length)throw t=X(C.thrownErrors),C.thrownErrors.length=0,t;return{then:function(x,Z){d=!0,u===0?(C.actQueue=f,Q(function(){return se(P,x,Z)})):x(P)}}},g.cache=function(t){return function(){return t.apply(null,arguments)}},g.cacheSignal=function(){return null},g.captureOwnerStack=function(){var t=C.getCurrentStack;return t===null?null:t()},g.cloneElement=function(t,o,u){if(t==null)throw Error("The argument must be a React element, but you passed "+t+".");var f=tr({},t.props),d=t.key,T=t._owner;if(o!=null){var _;e:{if(We.call(o,"ref")&&(_=Object.getOwnPropertyDescriptor(o,"ref").get)&&_.isReactWarning){_=!1;break e}_=o.ref!==void 0}_&&(T=Re()),oe(o)&&(m(o.key),d=""+o.key);for(P in o)!We.call(o,P)||P==="key"||P==="__self"||P==="__source"||P==="ref"&&o.ref===void 0||(f[P]=o[P])}var P=arguments.length-2;if(P===1)f.children=u;else if(1<P){_=Array(P);for(var x=0;x<P;x++)_[x]=arguments[x+2];f.children=_}for(f=ne(t.type,d,f,T,t._debugStack,t._debugTask),d=2;d<arguments.length;d++)ze(arguments[d]);return f},g.createContext=function(t){return t={$$typeof:j,_currentValue:t,_currentValue2:t,_threadCount:0,Provider:null,Consumer:null},t.Provider=t,t.Consumer={$$typeof:w,_context:t},t._currentRenderer=null,t._currentRenderer2=null,t},g.createElement=function(t,o,u){for(var f=2;f<arguments.length;f++)ze(arguments[f]);f={};var d=null;if(o!=null)for(x in sr||!("__self"in o)||"key"in o||(sr=!0,console.warn("Your app (or one of its dependencies) is using an outdated JSX transform. Update to the modern JSX transform for faster performance: https://react.dev/link/new-jsx-transform")),oe(o)&&(m(o.key),d=""+o.key),o)We.call(o,x)&&x!=="key"&&x!=="__self"&&x!=="__source"&&(f[x]=o[x]);var T=arguments.length-2;if(T===1)f.children=u;else if(1<T){for(var _=Array(T),P=0;P<T;P++)_[P]=arguments[P+2];Object.freeze&&Object.freeze(_),f.children=_}if(t&&t.defaultProps)for(x in T=t.defaultProps,T)f[x]===void 0&&(f[x]=T[x]);d&&Ye(f,typeof t=="function"?t.displayName||t.name||"Unknown":t);var x=1e4>C.recentlyCreatedOwnerStacks++;return ne(t,d,f,Re(),x?Error("react-stack-top-frame"):Vo,x?or(L(t)):Ko)},g.createRef=function(){var t={current:null};return Object.seal(t),t},g.forwardRef=function(t){t!=null&&t.$$typeof===N?console.error("forwardRef requires a render function but received a `memo` component. Instead of forwardRef(memo(...)), use memo(forwardRef(...))."):typeof t!="function"?console.error("forwardRef requires a render function but was given %s.",t===null?"null":typeof t):t.length!==0&&t.length!==2&&console.error("forwardRef render functions accept exactly two parameters: props and ref. %s",t.length===1?"Did you forget to use the ref parameter?":"Any additional parameter will be undefined."),t!=null&&t.defaultProps!=null&&console.error("forwardRef render functions do not support defaultProps. Did you accidentally pass a React component?");var o={$$typeof:$,render:t},u;return Object.defineProperty(o,"displayName",{enumerable:!1,configurable:!0,get:function(){return u},set:function(f){u=f,t.name||t.displayName||(Object.defineProperty(t,"name",{value:f}),t.displayName=f)}}),o},g.isValidElement=V,g.lazy=function(t){t={_status:-1,_result:t};var o={$$typeof:M,_payload:t,_init:Pe},u={name:"lazy",start:-1,end:-1,value:null,owner:null,debugStack:Error("react-stack-top-frame"),debugTask:console.createTask?console.createTask("lazy()"):null};return t._ioInfo=u,o._debugInfo=[{awaited:u}],o},g.memo=function(t,o){t==null&&console.error("memo: The first argument must be a component. Instead received: %s",t===null?"null":typeof t),o={$$typeof:N,type:t,compare:o===void 0?null:o};var u;return Object.defineProperty(o,"displayName",{enumerable:!1,configurable:!0,get:function(){return u},set:function(f){u=f,t.name||t.displayName||(Object.defineProperty(t,"name",{value:f}),t.displayName=f)}}),o},g.startTransition=function(t){var o=C.T,u={};u._updatedFibers=new Set,C.T=u;try{var f=t(),d=C.S;d!==null&&d(u,f),typeof f=="object"&&f!==null&&typeof f.then=="function"&&(C.asyncTransitions++,f.then(He,He),f.then(p,ur))}catch(T){ur(T)}finally{o===null&&u._updatedFibers&&(t=u._updatedFibers.size,u._updatedFibers.clear(),10<t&&console.warn("Detected a large number of updates inside startTransition. If this is due to a subscription please re-write it to use React provided hooks. Otherwise concurrent mode guarantees are off the table.")),o!==null&&u.types!==null&&(o.types!==null&&o.types!==u.types&&console.error("We expected inner Transitions to have transferred the outer types set and that you cannot add to the outer Transition while inside the inner.This is a bug in React."),o.types=u.types),C.T=o}},g.unstable_useCacheRefresh=function(){return I().useCacheRefresh()},g.use=function(t){return I().use(t)},g.useActionState=function(t,o,u){return I().useActionState(t,o,u)},g.useCallback=function(t,o){return I().useCallback(t,o)},g.useContext=function(t){var o=I();return t.$$typeof===w&&console.error("Calling useContext(Context.Consumer) is not supported and will cause bugs. Did you mean to call useContext(Context) instead?"),o.useContext(t)},g.useDebugValue=function(t,o){return I().useDebugValue(t,o)},g.useDeferredValue=function(t,o){return I().useDeferredValue(t,o)},g.useEffect=function(t,o){return t==null&&console.warn("React Hook useEffect requires an effect callback. Did you forget to pass a callback to the hook?"),I().useEffect(t,o)},g.useEffectEvent=function(t){return I().useEffectEvent(t)},g.useId=function(){return I().useId()},g.useImperativeHandle=function(t,o,u){return I().useImperativeHandle(t,o,u)},g.useInsertionEffect=function(t,o){return t==null&&console.warn("React Hook useInsertionEffect requires an effect callback. Did you forget to pass a callback to the hook?"),I().useInsertionEffect(t,o)},g.useLayoutEffect=function(t,o){return t==null&&console.warn("React Hook useLayoutEffect requires an effect callback. Did you forget to pass a callback to the hook?"),I().useLayoutEffect(t,o)},g.useMemo=function(t,o){return I().useMemo(t,o)},g.useOptimistic=function(t,o){return I().useOptimistic(t,o)},g.useReducer=function(t,o,u){return I().useReducer(t,o,u)},g.useRef=function(t){return I().useRef(t)},g.useState=function(t){return I().useState(t)},g.useSyncExternalStore=function(t,o,u){return I().useSyncExternalStore(t,o,u)},g.useTransition=function(){return I().useTransition()},g.version="19.2.1",typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()});var Ne=we((Bi,At)=>{"use strict";l();process.env.NODE_ENV==="production"?At.exports=$r():At.exports=Ur()});var Fr=we(et=>{"use strict";l();process.env.NODE_ENV!=="production"&&(function(){function e(a){if(a==null)return null;if(typeof a=="function")return a.$$typeof===He?null:a.displayName||a.name||null;if(typeof a=="string")return a;switch(a){case ne:return"Fragment";case ze:return"Profiler";case ft:return"StrictMode";case mt:return"Suspense";case K:return"SuspenseList";case I:return"Activity"}if(typeof a=="object")switch(typeof a.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),a.$$typeof){case lt:return"Portal";case pt:return a.displayName||"Context";case V:return(a._context.displayName||"Context")+".Consumer";case Se:var w=a.render;return a=a.displayName,a||(a=w.displayName||w.name||"",a=a!==""?"ForwardRef("+a+")":"ForwardRef"),a;case le:return w=a.displayName||null,w!==null?w:e(a.type)||"Memo";case Pe:w=a._payload,a=a._init;try{return e(a(w))}catch{}}return null}function r(a){return""+a}function n(a){try{r(a);var w=!1}catch{w=!0}if(w){w=console;var j=w.error,$=typeof Symbol=="function"&&Symbol.toStringTag&&a[Symbol.toStringTag]||a.constructor.name||"Object";return j.call(w,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",$),r(a)}}function s(a){if(a===ne)return"<>";if(typeof a=="object"&&a!==null&&a.$$typeof===Pe)return"<...>";try{var w=e(a);return w?"<"+w+">":"<...>"}catch{return"<...>"}}function i(){var a=Q.A;return a===null?null:a.getOwner()}function c(){return Error("react-stack-top-frame")}function p(a){if(X.call(a,"key")){var w=Object.getOwnPropertyDescriptor(a,"key").get;if(w&&w.isReactWarning)return!1}return a.key!==void 0}function E(a,w){function j(){pe||(pe=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",w))}j.isReactWarning=!0,Object.defineProperty(a,"key",{get:j,configurable:!0})}function m(){var a=e(this.type);return me[a]||(me[a]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),a=this.props.ref,a!==void 0?a:null}function O(a,w,j,$,ie,Oe){var N=j.ref;return a={$$typeof:Ye,type:a,key:w,props:j,_owner:$},(N!==void 0?N:null)!==null?Object.defineProperty(a,"ref",{enumerable:!1,get:m}):Object.defineProperty(a,"ref",{enumerable:!1,value:null}),a._store={},Object.defineProperty(a._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(a,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(a,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:ie}),Object.defineProperty(a,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:Oe}),Object.freeze&&(Object.freeze(a.props),Object.freeze(a)),a}function L(a,w,j,$,ie,Oe){var N=w.children;if(N!==void 0)if($)if(fe(N)){for($=0;$<N.length;$++)Re(N[$]);Object.freeze&&Object.freeze(N)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else Re(N);if(X.call(w,"key")){N=e(a);var M=Object.keys(w).filter(function(Be){return Be!=="key"});$=0<M.length?"{key: someKey, "+M.join(": ..., ")+": ...}":"{key: someKey}",Ae[N+$]||(M=0<M.length?"{"+M.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
54
+ let props = %s;
55
+ <%s {...props} />
56
+ React keys must be passed directly to JSX without using spread:
57
+ let props = %s;
58
+ <%s key={someKey} {...props} />`,$,N,M,N),Ae[N+$]=!0)}if(N=null,j!==void 0&&(n(j),N=""+j),p(w)&&(n(w.key),N=""+w.key),"key"in w){j={};for(var ge in w)ge!=="key"&&(j[ge]=w[ge])}else j=w;return N&&E(j,typeof a=="function"?a.displayName||a.name||"Unknown":a),O(a,N,j,i(),ie,Oe)}function Re(a){ke(a)?a._store&&(a._store.validated=1):typeof a=="object"&&a!==null&&a.$$typeof===Pe&&(a._payload.status==="fulfilled"?ke(a._payload.value)&&a._payload.value._store&&(a._payload.value._store.validated=1):a._store&&(a._store.validated=1))}function ke(a){return typeof a=="object"&&a!==null&&a.$$typeof===Ye}var oe=Ne(),Ye=Symbol.for("react.transitional.element"),lt=Symbol.for("react.portal"),ne=Symbol.for("react.fragment"),ft=Symbol.for("react.strict_mode"),ze=Symbol.for("react.profiler"),V=Symbol.for("react.consumer"),pt=Symbol.for("react.context"),Se=Symbol.for("react.forward_ref"),mt=Symbol.for("react.suspense"),K=Symbol.for("react.suspense_list"),le=Symbol.for("react.memo"),Pe=Symbol.for("react.lazy"),I=Symbol.for("react.activity"),He=Symbol.for("react.client.reference"),Q=oe.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,X=Object.prototype.hasOwnProperty,fe=Array.isArray,se=console.createTask?console.createTask:function(){return null};oe={react_stack_bottom_frame:function(a){return a()}};var pe,me={},je=oe.react_stack_bottom_frame.bind(oe,c)(),de=se(s(c)),Ae={};et.Fragment=ne,et.jsx=function(a,w,j){var $=1e4>Q.recentlyCreatedOwnerStacks++;return L(a,w,j,!1,$?Error("react-stack-top-frame"):je,$?se(s(a)):de)},et.jsxs=function(a,w,j){var $=1e4>Q.recentlyCreatedOwnerStacks++;return L(a,w,j,!0,$?Error("react-stack-top-frame"):je,$?se(s(a)):de)}})()});var R=we((Vi,Ot)=>{"use strict";l();process.env.NODE_ENV==="production"?Ot.exports=xr():Ot.exports=Fr()});import{Box as Dn,Text as Dr}from"ink";function k(e){return(0,$e.jsxs)(Dn,{flexDirection:"column",children:[(0,$e.jsx)(Dr,{color:"red",children:e.message}),(0,$e.jsx)(Dr,{children:"If this issue persists, send us an email at help@byteslice.co, and we can help you out."})]})}var $e,z=S(()=>{"use strict";l();$e=b(R(),1)});import{Text as Mn}from"ink";function F(e){return(0,Mr.jsx)(Mn,{color:"green",children:e.message})}var Mr,q=S(()=>{"use strict";l();Mr=b(R(),1)});import{Text as Yn}from"ink";function Yr(e){return(0,zr.jsx)(Yn,{color:"yellow",children:e.message})}var zr,Hr=S(()=>{"use strict";l();zr=b(R(),1)});function zn(e){return`${Ie(e)}/project`}async function Br(e){let r=zn(e);await e.fsPromise.stat(r).then(()=>!0).catch(()=>!1)&&await e.fsPromise.unlink(r)}var Wr=S(()=>{"use strict";l();vt()});var Lt={};B(Lt,{login:()=>Bn,logout:()=>Wn});import{withResult as H}from"@byteslice/result";import{render as ue}from"ink";async function Hn(e,r,n){let s=await H(async()=>await(await U(e)).cli.exchangeToken({code:n.code}),O=>new Error("Failed to exchange callback code for token",{cause:O.message}));if(s.failure)throw s.failure;await Et(e,s.data.idToken,"","");let i=await H(async()=>await(await U(e)).cli.createSignInTicket(),O=>new Error("Failed to exchange ID token code for a sign-in ticket",{cause:O.message}));if(i.failure)throw i.failure;let c=await wr(r.clerkPublishableKey),p=await H(()=>yr(c,i.data.token),O=>new Error("Failed to create a new sign-in for this device",{cause:O.message}));if(p.failure)throw p.failure;let E=await H(async()=>await(await U(e)).cli.createJwt({sessionId:p.data.createdSessionId}),O=>new Error("Failed to create a session JWT",{cause:O.message}));if(E.failure)throw E.failure;let m=await H(()=>Et(e,s.data.idToken,E.data,p.data.createdSessionId),O=>new Error("Failed to save your credentials to disk",{cause:O.message}));if(m.failure)throw m.failure}async function Bn(){let e=await U(this),r=Er(),n=await H(()=>e.cli.getConfig(),i=>new Error("Failed to retrieve authentication configuration",{cause:i.message}));n.failure&&(ue((0,ee.jsx)(k,{message:n.failure.message})),process.exit(1)),br({authorizeUri:Qe.OAUTH_AUTHORIZE_URL,clientId:n.data.clientId,redirectUri:wt,state:r});let s=await H(()=>gr(async i=>{if(i.state!==r)throw new Error("Invalid state.");await Hn(this,n.data,i)}),i=>i);s.failure&&(ue((0,ee.jsx)(k,{message:s.failure.message})),process.exit(1)),ue((0,ee.jsx)(F,{message:"Success! You are now logged in."}))}async function Wn(){let e=await H(()=>Ke(this),c=>c);e.failure&&(ue((0,ee.jsx)(k,{message:"There was an issue reading your credentials. You are probably already logged out."})),process.exit(1));let r=await U(this),n=await H(()=>r.cli.getConfig(),c=>new Error("Failed to retrieve authentication configuration",{cause:c.message}));n.failure&&(ue((0,ee.jsx)(k,{message:n.failure.message})),process.exit(1)),(await H(async()=>r.cli.revokeSession({sessionId:e.data.sessionId}),c=>c)).failure&&ue((0,ee.jsx)(Yr,{message:"There was an issue revoking your session. You are probably already logged out. Purging credentials file..."}));let i=await H(async()=>{await _r(this),await Br(this)},c=>c);if(i.failure)throw i.failure;ue((0,ee.jsx)(F,{message:"Success! You are now logged out."}))}var ee,It=S(()=>{"use strict";l();hr();vr();bt();Cr();W();z();q();Hr();Ct();Wr();ee=b(R(),1)});import{Box as Kn,Text as Vr}from"ink";import Qn from"ink-spinner";function Kr(e){return(0,_e.jsxs)(Kn,{children:[(0,_e.jsx)(Vr,{color:"cyan",children:(0,_e.jsx)(Qn,{type:"dots"})}),(0,_e.jsxs)(Vr,{children:[" ",e.message]})]})}var _e,Qr=S(()=>{"use strict";l();_e=b(R(),1)});import{existsSync as Xn}from"fs";import{resolve as Zn}from"path";import{configFileName as Xr,configSchema as Jn}from"@swirls/sdk/config";import{createJiti as es}from"jiti";async function Zr(){let e=Zn(process.cwd(),Xr);if(!Xn(e))throw new Error(`Config file not found in project root: ${Xr}`);let n=await es(import.meta.url).import(e,{default:!0});return Jn.parse(n)}var Jr=S(()=>{"use strict";l()});async function eo(e,r){let n=await U(e),{results:s}=await n.forms.listForms({projectId:r});function i(p){return p.schema!=null}return s.filter(i).map(p=>({id:p.id,name:p.name,schema:p.schema}))}var to=S(()=>{"use strict";l();W()});import ro from"fs/promises";import ts from"path";async function tt(e,r){let n=ts.dirname(e);await ro.mkdir(n,{recursive:!0}),await ro.writeFile(e,r,"utf-8")}var Nt=S(()=>{"use strict";l()});var oo={};B(oo,{generateCode:()=>os});import $t from"process";import{withResult as Ut}from"@byteslice/result";import{generateFormsCode as rs}from"@swirls/sdk/form/generate";import{render as Ue}from"ink";async function os(){let e=await Ut(()=>Zr(),c=>new Error("Failed to load configuration",{cause:c}));e.failure&&(Ue((0,Ee.jsx)(k,{message:e.failure.message})),$t.exit(1));let{projectId:r,genPath:n}=e.data;Ue((0,Ee.jsx)(Kr,{message:"Generating form code..."}));let s=await Ut(async()=>{let c=['// This file was generated by "@swirls/cli dev generate"',"// Do not edit this file manually",""],p=await eo(this,r);return rs(p,c)},c=>new Error(`Failed to generate form code: ${c.message}`,{cause:c}));s.failure&&(Ue((0,Ee.jsx)(k,{message:s.failure.message})),$t.exit(1));let i=await Ut(()=>tt(n,s.data),c=>new Error("Failed to write code file",{cause:c}));i.failure&&(Ue((0,Ee.jsx)(k,{message:i.failure.message})),$t.exit(1)),Ue((0,Ee.jsx)(F,{message:`Success! Generated code at ${n}`}))}var Ee,no=S(()=>{"use strict";l();z();Qr();q();Jr();to();Nt();Ee=b(R(),1)});import{Box as so,render as ns,Text as io}from"ink";import ss from"ink-text-input";import{z as is}from"zod";function as(e){let[r,n]=(0,Ft.useState)(""),[s,i]=(0,Ft.useState)(null);return(0,te.jsxs)(so,{flexDirection:"column",children:[(0,te.jsxs)(so,{children:[(0,te.jsx)(io,{children:"Enter project ID (UUID): "}),(0,te.jsx)(ss,{value:r,onChange:E=>{i(null),n(E)},onSubmit:E=>{if(i(null),E.trim()===""){setImmediate(()=>e.onInput());return}let m=is.uuid().safeParse(E);if(!m.success){i("Invalid UUID. Please try again."),n("");return}setImmediate(()=>e.onInput(m.data))}})]}),s&&(0,te.jsx)(io,{color:"red",children:s})]})}async function ao(){return new Promise(e=>{let r=ns((0,te.jsx)(as,{onInput:n=>{r.unmount(),e(n)}}))})}var Ft,te,co=S(()=>{"use strict";l();Ft=b(Ne(),1),te=b(R(),1)});var uo={};B(uo,{initializeConfig:()=>ms});import{existsSync as cs}from"fs";import{resolve as us}from"path";import Dt from"process";import{withResult as ls}from"@byteslice/result";import{configFileName as fs,generateConfig as ps}from"@swirls/sdk/config";import{render as Mt}from"ink";async function ms(){let e=us(Dt.cwd(),fs);cs(e)&&(Mt((0,rt.jsx)(k,{message:`Configuration already exists at ${e}.`})),Dt.exit(1));let r=await ao(),n=await ls(async()=>{let s=ps(r);await tt(e,s)},s=>new Error("Failed to create configuration",{cause:s}));n.failure&&(Mt((0,rt.jsx)(k,{message:n.failure.message})),Dt.exit(1)),Mt((0,rt.jsx)(F,{message:`Success! Created configuration at ${e}`}))}var rt,lo=S(()=>{"use strict";l();z();q();co();Nt();rt=b(R(),1)});import{render as ws}from"ink";import ys from"open";async function ot(e){let r=`${vs}/${e.id}`;await ys(r),ws((0,mo.jsx)(F,{message:`Opened project "${e.name}" in browser.`}))}var mo,vs,Yt=S(()=>{"use strict";l();q();mo=b(R(),1),vs="https://swirls.ai/projects"});import{Box as zt,render as _s,Text as Es}from"ink";import bs from"ink-text-input";function Cs(e){let[r,n]=(0,go.useState)(""),s=i=>{let c=i.trim().toLowerCase(),p=c===""||c==="y"||c==="yes";setImmediate(()=>e.onAnswer(p))};return(0,re.jsx)(zt,{flexDirection:"column",children:(0,re.jsxs)(zt,{children:[(0,re.jsxs)(Es,{children:[e.message," "]}),(0,re.jsx)(bs,{value:r,onChange:n,onSubmit:s})]})})}async function ho(e){let{above:r}=e??{};return new Promise(n=>{let s=_s((0,re.jsxs)(zt,{flexDirection:"column",children:[r,(0,re.jsx)(Cs,{message:"Open project in browser? (Y/n)",onAnswer:i=>{s.unmount(),n(i)}})]}))})}var go,re,wo=S(()=>{"use strict";l();go=b(Ne(),1),re=b(R(),1)});var yo={};B(yo,{createProject:()=>Rs});import{withResult as Ts}from"@byteslice/result";import{render as xs}from"ink";async function Rs(e,r){let n=await U(this),s=await Ts(()=>n.projects.createProject({name:r}),c=>new Error(`Failed to create project: ${c.message}`,{cause:c}));s.failure&&(xs((0,Ht.jsx)(k,{message:s.failure.message})),process.exit(1)),await ho({above:(0,Ht.jsx)(F,{message:`Success! Created "${r}" project: ${s.data.id}`})})&&await ot(s.data)}var Ht,vo=S(()=>{"use strict";l();W();z();q();Yt();wo();Ht=b(R(),1)});var Eo={};B(Eo,{openProject:()=>Ss});import{withResult as ks}from"@byteslice/result";import{render as _o}from"ink";async function Ss(e,r){let n=await U(this),s=await ks(()=>n.projects.getProject({projectId:r}),i=>new Error(`Failed to get project: ${i.message}`,{cause:i}));s.failure&&(_o((0,Bt.jsx)(k,{message:s.failure.message})),process.exit(1)),s.data||(_o((0,Bt.jsx)(k,{message:"Project not found."})),process.exit(1)),await ot(s.data)}var Bt,bo=S(()=>{"use strict";l();W();z();Yt();Bt=b(R(),1)});import{Box as be,Text as nt}from"ink";function Os(e){return typeof e=="boolean"?e?(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(nt,{color:"green",children:"\u2714"})," yes"]}):"no":String(e)}function Ls(e,r){return r.map(n=>{let s=n.key in e?Os(e[n.key]):null;return{column:n,value:s}})}function Is(e,r,n=1){return r.map(s=>{let i=String(s).length,c=e.map(E=>s in E&&(typeof E[s]=="string"||typeof E[s]=="number")?String(E[s]).length:0),p=Math.max(...c,i)+n*2;return{name:String(s),key:s,width:p}})}function Wt(e){return(0,D.jsx)(nt,{children:Array(e.width).fill("\u2500").join("")})}function Ro(e){let r=Is(e.data,e.keys),n=r.reduce((s,i)=>s+i.width,0);return(0,D.jsxs)(be,{flexDirection:"column",width:n,children:[(0,D.jsx)(Wt,{width:n}),(0,D.jsx)(be,{flexDirection:"row",children:r.map(s=>(0,D.jsx)(be,{width:s.width,children:(0,D.jsx)(nt,{bold:!0,color:"blue",children:s.name})},s.name))}),(0,D.jsx)(Wt,{width:n}),(0,D.jsx)(be,{flexDirection:"column",children:e.data.map((s,i)=>{let c=Ls(s,r);return(0,D.jsxs)(xo.Fragment,{children:[(0,D.jsx)(be,{flexDirection:"row",children:c.map(p=>(0,D.jsx)(be,{width:p.column.width,children:(0,D.jsx)(nt,{children:p.value})},p.column.name))}),(0,D.jsx)(Wt,{width:n})]},`row-${i}`)})})]})}var xo,D,ko=S(()=>{"use strict";l();xo=b(Ne(),1),D=b(R(),1)});import{existsSync as Ns}from"fs";import{resolve as $s}from"path";import{configFileName as So,configSchema as Us}from"@swirls/sdk/config";import{createJiti as Fs}from"jiti";async function G(e){if(e)return e;let r=$s(process.cwd(),So);if(!Ns(r))throw new Error(`No project specified and no ${So} found. Use --project flag or run from a project directory.`);let s=await Fs(import.meta.url).import(r,{default:!0});return Us.parse(s).projectId}var Ce=S(()=>{"use strict";l()});var jo={};B(jo,{list:()=>Ds});import{withResult as Po}from"@byteslice/result";import{render as qt}from"ink";async function Ds(e,r){let n=await Po(()=>G(e.project),m=>new Error(m.message));n.failure&&(qt((0,st.jsx)(k,{message:n.failure.message})),process.exit(1));let s=await U(this),i=await Po(()=>s.buckets.listFiles({projectId:n.data,path:r}),m=>new Error(`Failed to list files: ${m.message}`,{cause:m}));i.failure&&(qt((0,st.jsx)(k,{message:i.failure.message})),process.exit(1));let{files:c,folders:p}=i.data;if(p.length===0&&c.length===0){console.log("No files or folders found.");return}let E=[...p.map(m=>({type:"folder",name:m.name,size:"-"})),...c.map(m=>({type:"file",name:m.name,size:m.size?Ms(m.size):"-"}))];qt((0,st.jsx)(Ro,{keys:["type","name","size"],data:E}))}function Ms(e){if(e===0)return"0 B";let r=1024,n=["B","KB","MB","GB","TB"],s=Math.floor(Math.log(e)/Math.log(r));return`${parseFloat((e/r**s).toFixed(2))} ${n[s]}`}var st,Ao=S(()=>{"use strict";l();W();z();ko();Ce();st=b(R(),1)});var Oo={};B(Oo,{upload:()=>Hs});import{readFile as Ys}from"fs/promises";import{basename as zs}from"path";import{withResult as it}from"@byteslice/result";import{render as Fe}from"ink";async function Hs(e,r,n){let s=await it(()=>G(e.project),L=>new Error(L.message));s.failure&&(Fe((0,Te.jsx)(k,{message:s.failure.message})),process.exit(1));let i=await it(()=>Ys(r),L=>new Error(`Failed to read file: ${L.message}`,{cause:L}));i.failure&&(Fe((0,Te.jsx)(k,{message:i.failure.message})),process.exit(1));let c=zs(r),p=n?`${n}/${c}`:c,E=await U(this),m=await it(()=>E.buckets.createSignedUploadUrl({projectId:s.data,path:p}),L=>new Error(`Failed to get upload URL: ${L.message}`,{cause:L}));m.failure&&(Fe((0,Te.jsx)(k,{message:m.failure.message})),process.exit(1));let O=await it(async()=>{let L=await fetch(m.data.signedUrl,{method:"PUT",headers:{"Content-Type":"application/octet-stream","x-upsert":"true"},body:i.data});if(!L.ok)throw new Error(`Upload failed: ${L.statusText}`);return L},L=>new Error(`Failed to upload file: ${L.message}`,{cause:L}));O.failure&&(Fe((0,Te.jsx)(k,{message:O.failure.message})),process.exit(1)),Fe((0,Te.jsx)(F,{message:`Uploaded ${c} to ${p}`}))}var Te,Lo=S(()=>{"use strict";l();W();z();q();Ce();Te=b(R(),1)});var Io={};B(Io,{download:()=>Ws});import{writeFile as Bs}from"fs/promises";import{withResult as at}from"@byteslice/result";import{render as De}from"ink";async function Ws(e,r,n){let s=await at(()=>G(e.project),m=>new Error(m.message));s.failure&&(De((0,xe.jsx)(k,{message:s.failure.message})),process.exit(1));let i=await U(this),c=await at(()=>i.buckets.createSignedUrl({projectId:s.data,path:r}),m=>new Error(`Failed to get download URL: ${m.message}`,{cause:m}));c.failure&&(De((0,xe.jsx)(k,{message:c.failure.message})),process.exit(1));let p=await at(async()=>{let m=await fetch(c.data.signedUrl);if(!m.ok)throw new Error(`Download failed: ${m.statusText}`);return m.arrayBuffer()},m=>new Error(`Failed to download file: ${m.message}`,{cause:m}));p.failure&&(De((0,xe.jsx)(k,{message:p.failure.message})),process.exit(1));let E=await at(()=>Bs(n,Buffer.from(p.data)),m=>new Error(`Failed to write file: ${m.message}`,{cause:m}));E.failure&&(De((0,xe.jsx)(k,{message:E.failure.message})),process.exit(1)),De((0,xe.jsx)(F,{message:`Downloaded ${r} to ${n}`}))}var xe,No=S(()=>{"use strict";l();W();z();q();Ce();xe=b(R(),1)});var Uo={};B(Uo,{deleteFile:()=>qs});import{withResult as $o}from"@byteslice/result";import{render as Gt}from"ink";async function qs(e,r){let n=await $o(()=>G(e.project),c=>new Error(c.message));n.failure&&(Gt((0,ct.jsx)(k,{message:n.failure.message})),process.exit(1));let s=await U(this),i=await $o(()=>s.buckets.deleteFile({projectId:n.data,path:r}),c=>new Error(`Failed to delete file: ${c.message}`,{cause:c}));i.failure&&(Gt((0,ct.jsx)(k,{message:i.failure.message})),process.exit(1)),Gt((0,ct.jsx)(F,{message:`Deleted ${r}`}))}var ct,Fo=S(()=>{"use strict";l();W();z();q();Ce();ct=b(R(),1)});var Mo={};B(Mo,{url:()=>Gs});import{withResult as Do}from"@byteslice/result";import{render as Vt}from"ink";async function Gs(e,r){let n=await Do(()=>G(e.project),c=>new Error(c.message));n.failure&&(Vt((0,ut.jsx)(k,{message:n.failure.message})),process.exit(1));let s=await U(this),i=await Do(()=>s.buckets.createSignedUrl({projectId:n.data,path:r,expiresIn:e.expires}),c=>new Error(`Failed to create signed URL: ${c.message}`,{cause:c}));i.failure&&(Vt((0,ut.jsx)(k,{message:i.failure.message})),process.exit(1)),console.log(i.data.signedUrl),Vt((0,ut.jsx)(F,{message:`URL expires at ${i.data.expiresAt}`}))}var ut,Yo=S(()=>{"use strict";l();W();z();q();Ce();ut=b(R(),1)});l();import{proposeCompletions as qo}from"@stricli/core";l();import{buildInstallCommand as ei,buildUninstallCommand as ti}from"@stricli/auto-complete";import{buildApplication as ri,buildRouteMap as oi}from"@stricli/core";l();import{buildCommand as qr,buildRouteMap as qn}from"@stricli/core";var Gn=qr({loader:async()=>{let{login:e}=await Promise.resolve().then(()=>(It(),Lt));return e},parameters:{positional:{kind:"tuple",parameters:[]}},docs:{brief:"Log in with an existing account"}}),Vn=qr({loader:async()=>{let{logout:e}=await Promise.resolve().then(()=>(It(),Lt));return e},parameters:{positional:{kind:"tuple",parameters:[]}},docs:{brief:"Log out of an existing account"}}),Gr=qn({routes:{login:Gn,logout:Vn},docs:{brief:"Auth commands"}});l();import{buildCommand as fo,buildRouteMap as ds}from"@stricli/core";var gs=fo({loader:async()=>{let{generateCode:e}=await Promise.resolve().then(()=>(no(),oo));return e},parameters:{positional:{kind:"tuple",parameters:[]}},docs:{brief:"Generate application code and types"}}),hs=fo({loader:async()=>{let{initializeConfig:e}=await Promise.resolve().then(()=>(lo(),uo));return e},parameters:{positional:{kind:"tuple",parameters:[]}},docs:{brief:"Initialize Swirls configuration file"}}),po=ds({routes:{gen:gs,init:hs},docs:{brief:"Developer commands"}});l();import{buildCommand as Co,buildRouteMap as Ps}from"@stricli/core";var js=Co({loader:async()=>{let{createProject:e}=await Promise.resolve().then(()=>(vo(),yo));return e},parameters:{positional:{kind:"tuple",parameters:[{brief:"Project name",parse:String,placeholder:"name"}]}},docs:{brief:"Create a new project"}}),As=Co({loader:async()=>{let{openProject:e}=await Promise.resolve().then(()=>(bo(),Eo));return e},parameters:{positional:{kind:"tuple",parameters:[{brief:"Project ID",parse:String,placeholder:"project-id"}]}},docs:{brief:"Open project in browser"}}),To=Ps({routes:{create:js,open:As},docs:{brief:"Project commands"}});l();import{buildCommand as Me,buildRouteMap as Vs}from"@stricli/core";var Ks=Me({loader:async()=>{let{list:e}=await Promise.resolve().then(()=>(Ao(),jo));return e},parameters:{positional:{kind:"tuple",parameters:[{brief:"Path to list (optional)",parse:String,placeholder:"path",optional:!0}]},flags:{project:{kind:"parsed",brief:"Project ID (uses config if not specified)",parse:String,optional:!0}}},docs:{brief:"List files in storage"}}),Qs=Me({loader:async()=>{let{upload:e}=await Promise.resolve().then(()=>(Lo(),Oo));return e},parameters:{positional:{kind:"tuple",parameters:[{brief:"Local file path to upload",parse:String,placeholder:"file"},{brief:"Destination path in storage (optional)",parse:String,placeholder:"dest",optional:!0}]},flags:{project:{kind:"parsed",brief:"Project ID (uses config if not specified)",parse:String,optional:!0}}},docs:{brief:"Upload a file to storage"}}),Xs=Me({loader:async()=>{let{download:e}=await Promise.resolve().then(()=>(No(),Io));return e},parameters:{positional:{kind:"tuple",parameters:[{brief:"Path to file in storage",parse:String,placeholder:"path"},{brief:"Local destination path",parse:String,placeholder:"dest"}]},flags:{project:{kind:"parsed",brief:"Project ID (uses config if not specified)",parse:String,optional:!0}}},docs:{brief:"Download a file from storage"}}),Zs=Me({loader:async()=>{let{deleteFile:e}=await Promise.resolve().then(()=>(Fo(),Uo));return e},parameters:{positional:{kind:"tuple",parameters:[{brief:"Path to file in storage",parse:String,placeholder:"path"}]},flags:{project:{kind:"parsed",brief:"Project ID (uses config if not specified)",parse:String,optional:!0}}},docs:{brief:"Delete a file from storage"}}),Js=Me({loader:async()=>{let{url:e}=await Promise.resolve().then(()=>(Yo(),Mo));return e},parameters:{positional:{kind:"tuple",parameters:[{brief:"Path to file in storage",parse:String,placeholder:"path"}]},flags:{project:{kind:"parsed",brief:"Project ID (uses config if not specified)",parse:String,optional:!0},expires:{kind:"parsed",brief:"Expiration time in seconds (default: 86400 = 24 hours)",parse:Number,optional:!0}}},docs:{brief:"Get a signed URL for a file"}}),zo=Vs({routes:{list:Ks,upload:Qs,download:Xs,delete:Zs,url:Js},docs:{brief:"Storage commands"}});var Ho="@swirls/cli",Bo="0.0.21",Wo="Swirls command line application";var ni=oi({routes:{auth:Gr,dev:po,project:To,storage:zo,install:ei("cli",{bash:"__cli_bash_complete"}),uninstall:ti("cli",{bash:!0})},docs:{brief:Wo,hideRoute:{install:!0,uninstall:!0}}}),Qt=ri(ni,{name:Ho,versionInfo:{currentVersion:Bo}});l();import si from"fs";import ii from"fs/promises";import ai from"os";import ci from"path";function Xt(e){return{fs:si,fsPromise:ii,os:ai,path:ci,process:e}}var Zt=process.argv.slice(3);process.env.COMP_LINE?.endsWith(" ")&&Zt.push("");await qo(Qt,Zt,Xt(process));try{for(let{completion:e}of await qo(Qt,Zt,Xt(process)))process.stdout.write(`${e}
42
59
  `)}catch{}
60
+ /*! Bundled license information:
61
+
62
+ react/cjs/react-jsx-runtime.production.js:
63
+ (**
64
+ * @license React
65
+ * react-jsx-runtime.production.js
66
+ *
67
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
68
+ *
69
+ * This source code is licensed under the MIT license found in the
70
+ * LICENSE file in the root directory of this source tree.
71
+ *)
72
+
73
+ react/cjs/react.production.js:
74
+ (**
75
+ * @license React
76
+ * react.production.js
77
+ *
78
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
79
+ *
80
+ * This source code is licensed under the MIT license found in the
81
+ * LICENSE file in the root directory of this source tree.
82
+ *)
83
+
84
+ react/cjs/react.development.js:
85
+ (**
86
+ * @license React
87
+ * react.development.js
88
+ *
89
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
90
+ *
91
+ * This source code is licensed under the MIT license found in the
92
+ * LICENSE file in the root directory of this source tree.
93
+ *)
94
+
95
+ react/cjs/react-jsx-runtime.development.js:
96
+ (**
97
+ * @license React
98
+ * react-jsx-runtime.development.js
99
+ *
100
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
101
+ *
102
+ * This source code is licensed under the MIT license found in the
103
+ * LICENSE file in the root directory of this source tree.
104
+ *)
105
+ */
package/dist/cli.js CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- var Jt=Object.defineProperty;var f=(e,t)=>()=>(e&&(t=e(e=0)),t);var b=(e,t)=>{for(var r in t)Jt(e,r,{get:t[r],enumerable:!0})};import Mo from"path";import{fileURLToPath as Jo}from"url";var i=f(()=>{"use strict"});import Yt from"http";import{withResult as Pe}from"@byteslice/result";import*as F from"zod";function Kt(e){if(!e.url)throw new Error("No URL found in callback response.");let t=new URL(e.url,G);return F.parse(Vt,Object.fromEntries(t.searchParams.entries()))}function ke(e){e.writeHead(400,{"Content-Type":"text/html"}),e.end(Gt)}function Zt(e){e.writeHead(200,{"Content-Type":"text/html"}),e.end(Wt)}function je(e){return new Promise((t,r)=>{let o=Yt.createServer(async(a,s)=>{let c=await Pe(()=>Kt(a),n=>n);if(c.failure){ke(s),r(c.failure);return}let d=await Pe(()=>e(c.data),n=>n);if(d.failure){ke(s),r(d.failure);return}Zt(s),o.close(()=>{t()})});o.listen(Se)})}var Se,G,Vt,Wt,Gt,Fe=f(()=>{"use strict";i();Se=8765,G=`http://localhost:${Se}`,Vt=F.object({code:F.string(),state:F.string()}),Wt=`
2
+ var Qo=Object.create;var ht=Object.defineProperty;var Xo=Object.getOwnPropertyDescriptor;var Zo=Object.getOwnPropertyNames;var Jo=Object.getPrototypeOf,en=Object.prototype.hasOwnProperty;var S=(e,r)=>()=>(e&&(r=e(e=0)),r);var we=(e,r)=>()=>(r||e((r={exports:{}}).exports,r),r.exports),B=(e,r)=>{for(var n in r)ht(e,n,{get:r[n],enumerable:!0})},tn=(e,r,n,s)=>{if(r&&typeof r=="object"||typeof r=="function")for(let i of Zo(r))!en.call(e,i)&&i!==n&&ht(e,i,{get:()=>r[i],enumerable:!(s=Xo(r,i))||s.enumerable});return e};var b=(e,r,n)=>(n=e!=null?Qo(Jo(e)):{},tn(r||!e||!e.__esModule?ht(n,"default",{value:e,enumerable:!0}):n,e));import li from"path";import{fileURLToPath as pi}from"url";var l=S(()=>{"use strict"});import rn from"http";import{withResult as ur}from"@byteslice/result";import*as ae from"zod";function an(e){if(!e.url)throw new Error("No URL found in callback response.");let r=new URL(e.url,wt);return ae.parse(on,Object.fromEntries(r.searchParams.entries()))}function lr(e){e.writeHead(400,{"Content-Type":"text/html"}),e.end(sn)}function cn(e){e.writeHead(200,{"Content-Type":"text/html"}),e.end(nn)}function pr(e){return new Promise((r,n)=>{let s=rn.createServer(async(i,c)=>{let p=await ur(()=>an(i),m=>m);if(p.failure){lr(c),n(p.failure);return}let E=await ur(()=>e(p.data),m=>m);if(E.failure){lr(c),n(E.failure);return}cn(c),s.close(()=>{r()})});s.listen(fr)})}var fr,wt,on,nn,sn,mr=S(()=>{"use strict";l();fr=8765,wt=`http://localhost:${fr}`,on=ae.object({code:ae.string(),state:ae.string()}),nn=`
3
3
  <!DOCTYPE html>
4
4
  <html lang="en">
5
5
  <head>
@@ -18,7 +18,7 @@ var Jt=Object.defineProperty;var f=(e,t)=>()=>(e&&(t=e(e=0)),t);var b=(e,t)=>{fo
18
18
  </div>
19
19
  </body>
20
20
  </html>
21
- `,Gt=`
21
+ `,sn=`
22
22
  <!DOCTYPE html>
23
23
  <html lang="en">
24
24
  <head>
@@ -38,4 +38,67 @@ var Jt=Object.defineProperty;var f=(e,t)=>()=>(e&&(t=e(e=0)),t);var b=(e,t)=>{fo
38
38
  </div>
39
39
  </body>
40
40
  </html>
41
- `});import Qt from"@clerk/clerk-js/headless/index.js";async function ve(e){let t=new Xt(e);return await t.load({standardBrowser:!1}),t}async function Le(e,t){let r=await e.client?.signIn.create({ticket:t,strategy:"ticket"});if(!r||!r.createdSessionId)throw new Error("Failed to sign in.");return{createdSessionId:r.createdSessionId}}var Xt,Ie=f(()=>{"use strict";i();Xt=Qt.Clerk});async function K(e,t){await e.fsPromise.stat(t).then(()=>!0).catch(()=>!1)||await e.fsPromise.mkdir(t,{recursive:!0})}function U(e){if(!e.path)throw new Error("No `path` found in context.");if(!e.os)throw new Error("No `os` found in context.");let t=e.os.homedir();return e.path.join(t,".swirls")}var Z=f(()=>{"use strict";i()});import*as j from"zod";function Q(e){return`${U(e)}/credentials`}async function Te(e){let t=Q(e);await e.fsPromise.stat(t).then(()=>!0).catch(()=>!1)&&await e.fsPromise.unlink(t)}async function O(e){let t=Q(e),r=await e.fsPromise.readFile(t,"utf8");return j.parse(qt,JSON.parse(r))}async function X(e,t,r,o){let a=Q(e);await K(e,U(e)),await e.fsPromise.writeFile(a,JSON.stringify({idToken:t,jwt:r,sessionId:o}))}var qt,q=f(()=>{"use strict";i();Z();qt=j.object({idToken:j.string(),jwt:j.string(),sessionId:j.string()})});import er from"open";function Re(e=32){let t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",r=new Uint8Array(e);crypto.getRandomValues(r);let o="";for(let a of r)o+=t[a%t.length];return o}function Ue(e){let t=new URLSearchParams({client_id:e.clientId,redirect_uri:e.redirectUri,response_type:"code",scope:"openid profile email",state:e.state});er(`${e.authorizeUri}?${t}`)}var Ee=f(()=>{"use strict";i()});import*as v from"zod";var tr,rr,N,ee=f(()=>{"use strict";i();tr=v.object({API_URL:v.string(),OAUTH_AUTHORIZE_URL:v.string()}),rr={API_URL:"https://swirls.ai/api",OAUTH_AUTHORIZE_URL:"https://clerk.swirls.ai/oauth/authorize"},N=v.parse(tr,rr)});import{withResult as or}from"@byteslice/result";import{createORPCClient as ir,onError as ar}from"@orpc/client";import{RPCLink as sr}from"@orpc/client/fetch";async function u(e){let t=new sr({url:`${N.API_URL}/rpc`,headers:async()=>{let o=await or(()=>O(e),c=>new Error("Failed to read credentials file",{cause:c.message}));if(o.failure)return{};let{idToken:a,jwt:s}=o.data;return{Authorization:`Bearer ${s||a}`}},interceptors:[ar(o=>{o instanceof Error&&o.name==="AbortError"||console.error(o)})]});return ir(t)}var P=f(()=>{"use strict";i();q();ee()});import{Box as nr,Text as De}from"ink";import{jsx as Ae,jsxs as cr}from"react/jsx-runtime";function p(e){return cr(nr,{flexDirection:"column",children:[Ae(De,{color:"red",children:e.message}),Ae(De,{children:"If this issue persists, send us an email at help@byteslice.co, and we can help you out."})]})}var y=f(()=>{"use strict";i()});import{Text as lr}from"ink";import{jsx as mr}from"react/jsx-runtime";function g(e){return mr(lr,{color:"green",children:e.message})}var k=f(()=>{"use strict";i()});import{Text as pr}from"ink";import{jsx as fr}from"react/jsx-runtime";function $e(e){return fr(pr,{color:"yellow",children:e.message})}var ze=f(()=>{"use strict";i()});function dr(e){return`${U(e)}/project`}async function _e(e){let t=dr(e);await e.fsPromise.stat(t).then(()=>!0).catch(()=>!1)&&await e.fsPromise.unlink(t)}var Be=f(()=>{"use strict";i();Z()});var te={};b(te,{login:()=>gr,logout:()=>wr});import{withResult as C}from"@byteslice/result";import{render as L}from"ink";import{jsx as I}from"react/jsx-runtime";async function ur(e,t,r){let o=await C(async()=>await(await u(e)).cli.exchangeToken({code:r.code}),h=>new Error("Failed to exchange callback code for token",{cause:h.message}));if(o.failure)throw o.failure;await X(e,o.data.idToken,"","");let a=await C(async()=>await(await u(e)).cli.createSignInTicket(),h=>new Error("Failed to exchange ID token code for a sign-in ticket",{cause:h.message}));if(a.failure)throw a.failure;let s=await ve(t.clerkPublishableKey),c=await C(()=>Le(s,a.data.token),h=>new Error("Failed to create a new sign-in for this device",{cause:h.message}));if(c.failure)throw c.failure;let d=await C(async()=>await(await u(e)).cli.createJwt({sessionId:c.data.createdSessionId}),h=>new Error("Failed to create a session JWT",{cause:h.message}));if(d.failure)throw d.failure;let n=await C(()=>X(e,o.data.idToken,d.data,c.data.createdSessionId),h=>new Error("Failed to save your credentials to disk",{cause:h.message}));if(n.failure)throw n.failure}async function gr(){let e=await u(this),t=Re(),r=await C(()=>e.cli.getConfig(),a=>new Error("Failed to retrieve authentication configuration",{cause:a.message}));r.failure&&(L(I(p,{message:r.failure.message})),process.exit(1)),Ue({authorizeUri:N.OAUTH_AUTHORIZE_URL,clientId:r.data.clientId,redirectUri:G,state:t});let o=await C(()=>je(async a=>{if(a.state!==t)throw new Error("Invalid state.");await ur(this,r.data,a)}),a=>a);o.failure&&(L(I(p,{message:o.failure.message})),process.exit(1)),L(I(g,{message:"Success! You are now logged in."}))}async function wr(){let e=await C(()=>O(this),s=>s);e.failure&&(L(I(p,{message:"There was an issue reading your credentials. You are probably already logged out."})),process.exit(1));let t=await u(this),r=await C(()=>t.cli.getConfig(),s=>new Error("Failed to retrieve authentication configuration",{cause:s.message}));r.failure&&(L(I(p,{message:r.failure.message})),process.exit(1)),(await C(async()=>t.cli.revokeSession({sessionId:e.data.sessionId}),s=>s)).failure&&L(I($e,{message:"There was an issue revoking your session. You are probably already logged out. Purging credentials file..."}));let a=await C(async()=>{await Te(this),await _e(this)},s=>s);if(a.failure)throw a.failure;L(I(g,{message:"Success! You are now logged out."}))}var re=f(()=>{"use strict";i();Fe();Ie();q();Ee();P();y();k();ze();ee();Be()});import{Box as Cr,Text as Me}from"ink";import br from"ink-spinner";import{jsx as He,jsxs as Je}from"react/jsx-runtime";function Ye(e){return Je(Cr,{children:[He(Me,{color:"cyan",children:He(br,{type:"dots"})}),Je(Me,{children:[" ",e.message]})]})}var Ve=f(()=>{"use strict";i()});import{existsSync as Pr}from"fs";import{resolve as kr}from"path";import{configFileName as We,configSchema as Sr}from"@swirls/sdk/config";import{createJiti as jr}from"jiti";async function Ge(){let e=kr(process.cwd(),We);if(!Pr(e))throw new Error(`Config file not found in project root: ${We}`);let r=await jr(import.meta.url).import(e,{default:!0});return Sr.parse(r)}var Ke=f(()=>{"use strict";i()});async function Ze(e,t){let r=await u(e),{results:o}=await r.forms.listForms({projectId:t});function a(c){return c.schema!=null}return o.filter(a).map(c=>({id:c.id,name:c.name,schema:c.schema}))}var Qe=f(()=>{"use strict";i();P()});import Xe from"fs/promises";import Fr from"path";async function M(e,t){let r=Fr.dirname(e);await Xe.mkdir(r,{recursive:!0}),await Xe.writeFile(e,t,"utf-8")}var oe=f(()=>{"use strict";i()});var qe={};b(qe,{generateCode:()=>Lr});import ie from"process";import{withResult as ae}from"@byteslice/result";import{generateFormsCode as vr}from"@swirls/sdk/form/generate";import{render as E}from"ink";import{jsx as D}from"react/jsx-runtime";async function Lr(){let e=await ae(()=>Ge(),s=>new Error("Failed to load configuration",{cause:s}));e.failure&&(E(D(p,{message:e.failure.message})),ie.exit(1));let{projectId:t,genPath:r}=e.data;E(D(Ye,{message:"Generating form code..."}));let o=await ae(async()=>{let s=['// This file was generated by "@swirls/cli dev generate"',"// Do not edit this file manually",""],c=await Ze(this,t);return vr(c,s)},s=>new Error(`Failed to generate form code: ${s.message}`,{cause:s}));o.failure&&(E(D(p,{message:o.failure.message})),ie.exit(1));let a=await ae(()=>M(r,o.data),s=>new Error("Failed to write code file",{cause:s}));a.failure&&(E(D(p,{message:a.failure.message})),ie.exit(1)),E(D(g,{message:`Success! Generated code at ${r}`}))}var et=f(()=>{"use strict";i();y();Ve();k();Ke();Qe();oe()});import{Box as tt,render as Ir,Text as rt}from"ink";import Tr from"ink-text-input";import{useState as ot}from"react";import{z as Rr}from"zod";import{jsx as H,jsxs as it}from"react/jsx-runtime";function Ur(e){let[t,r]=ot(""),[o,a]=ot(null);return it(tt,{flexDirection:"column",children:[it(tt,{children:[H(rt,{children:"Enter project ID (UUID): "}),H(Tr,{value:t,onChange:d=>{a(null),r(d)},onSubmit:d=>{if(a(null),d.trim()===""){setImmediate(()=>e.onInput());return}let n=Rr.uuid().safeParse(d);if(!n.success){a("Invalid UUID. Please try again."),r("");return}setImmediate(()=>e.onInput(n.data))}})]}),o&&H(rt,{color:"red",children:o})]})}async function at(){return new Promise(e=>{let t=Ir(H(Ur,{onInput:r=>{t.unmount(),e(r)}}))})}var st=f(()=>{"use strict";i()});var nt={};b(nt,{initializeConfig:()=>_r});import{existsSync as Er}from"fs";import{resolve as Dr}from"path";import se from"process";import{withResult as Ar}from"@byteslice/result";import{configFileName as $r,generateConfig as zr}from"@swirls/sdk/config";import{render as ne}from"ink";import{jsx as ce}from"react/jsx-runtime";async function _r(){let e=Dr(se.cwd(),$r);Er(e)&&(ne(ce(p,{message:`Configuration already exists at ${e}.`})),se.exit(1));let t=await at(),r=await Ar(async()=>{let o=zr(t);await M(e,o)},o=>new Error("Failed to create configuration",{cause:o}));r.failure&&(ne(ce(p,{message:r.failure.message})),se.exit(1)),ne(ce(g,{message:`Success! Created configuration at ${e}`}))}var ct=f(()=>{"use strict";i();y();k();st();oe()});import{render as Mr}from"ink";import Hr from"open";import{jsx as Yr}from"react/jsx-runtime";async function J(e){let t=`${Jr}/${e.id}`;await Hr(t),Mr(Yr(g,{message:`Opened project "${e.name}" in browser.`}))}var Jr,le=f(()=>{"use strict";i();k();Jr="https://swirls.ai/projects"});import{Box as me,render as Vr,Text as Wr}from"ink";import Gr from"ink-text-input";import{useState as Kr}from"react";import{jsx as fe,jsxs as pe}from"react/jsx-runtime";function Zr(e){let[t,r]=Kr(""),o=a=>{let s=a.trim().toLowerCase(),c=s===""||s==="y"||s==="yes";setImmediate(()=>e.onAnswer(c))};return fe(me,{flexDirection:"column",children:pe(me,{children:[pe(Wr,{children:[e.message," "]}),fe(Gr,{value:t,onChange:r,onSubmit:o})]})})}async function pt(e){let{above:t}=e??{};return new Promise(r=>{let o=Vr(pe(me,{flexDirection:"column",children:[t,fe(Zr,{message:"Open project in browser? (Y/n)",onAnswer:a=>{o.unmount(),r(a)}})]}))})}var ft=f(()=>{"use strict";i()});var ut={};b(ut,{createProject:()=>qr});import{withResult as Qr}from"@byteslice/result";import{render as Xr}from"ink";import{jsx as dt}from"react/jsx-runtime";async function qr(e,t){let r=await u(this),o=await Qr(()=>r.projects.createProject({name:t}),s=>new Error(`Failed to create project: ${s.message}`,{cause:s}));o.failure&&(Xr(dt(p,{message:o.failure.message})),process.exit(1)),await pt({above:dt(g,{message:`Success! Created "${t}" project: ${o.data.id}`})})&&await J(o.data)}var gt=f(()=>{"use strict";i();P();y();k();le();ft()});var xt={};b(xt,{openProject:()=>to});import{withResult as eo}from"@byteslice/result";import{render as wt}from"ink";import{jsx as ht}from"react/jsx-runtime";async function to(e,t){let r=await u(this),o=await eo(()=>r.projects.getProject({projectId:t}),a=>new Error(`Failed to get project: ${a.message}`,{cause:a}));o.failure&&(wt(ht(p,{message:o.failure.message})),process.exit(1)),o.data||(wt(ht(p,{message:"Project not found."})),process.exit(1)),await J(o.data)}var yt=f(()=>{"use strict";i();P();y();le()});import{Box as T,Text as Y}from"ink";import{Fragment as ao}from"react";import{Fragment as lo,jsx as x,jsxs as ue}from"react/jsx-runtime";function so(e){return typeof e=="boolean"?e?ue(lo,{children:[x(Y,{color:"green",children:"\u2714"})," yes"]}):"no":String(e)}function no(e,t){return t.map(r=>{let o=r.key in e?so(e[r.key]):null;return{column:r,value:o}})}function co(e,t,r=1){return t.map(o=>{let a=String(o).length,s=e.map(d=>o in d&&(typeof d[o]=="string"||typeof d[o]=="number")?String(d[o]).length:0),c=Math.max(...s,a)+r*2;return{name:String(o),key:o,width:c}})}function de(e){return x(Y,{children:Array(e.width).fill("\u2500").join("")})}function Pt(e){let t=co(e.data,e.keys),r=t.reduce((o,a)=>o+a.width,0);return ue(T,{flexDirection:"column",width:r,children:[x(de,{width:r}),x(T,{flexDirection:"row",children:t.map(o=>x(T,{width:o.width,children:x(Y,{bold:!0,color:"blue",children:o.name})},o.name))}),x(de,{width:r}),x(T,{flexDirection:"column",children:e.data.map((o,a)=>{let s=no(o,t);return ue(ao,{children:[x(T,{flexDirection:"row",children:s.map(c=>x(T,{width:c.column.width,children:x(Y,{children:c.value})},c.column.name))}),x(de,{width:r})]},`row-${a}`)})})]})}var kt=f(()=>{"use strict";i()});import{existsSync as mo}from"fs";import{resolve as po}from"path";import{configFileName as St,configSchema as fo}from"@swirls/sdk/config";import{createJiti as uo}from"jiti";async function S(e){if(e)return e;let t=po(process.cwd(),St);if(!mo(t))throw new Error(`No project specified and no ${St} found. Use --project flag or run from a project directory.`);let o=await uo(import.meta.url).import(t,{default:!0});return fo.parse(o).projectId}var R=f(()=>{"use strict";i()});var Ft={};b(Ft,{list:()=>go});import{withResult as jt}from"@byteslice/result";import{render as ge}from"ink";import{jsx as we}from"react/jsx-runtime";async function go(e,t){let r=await jt(()=>S(e.project),n=>new Error(n.message));r.failure&&(ge(we(p,{message:r.failure.message})),process.exit(1));let o=await u(this),a=await jt(()=>o.buckets.listFiles({projectId:r.data,path:t}),n=>new Error(`Failed to list files: ${n.message}`,{cause:n}));a.failure&&(ge(we(p,{message:a.failure.message})),process.exit(1));let{files:s,folders:c}=a.data;if(c.length===0&&s.length===0){console.log("No files or folders found.");return}let d=[...c.map(n=>({type:"folder",name:n.name,size:"-"})),...s.map(n=>({type:"file",name:n.name,size:n.size?wo(n.size):"-"}))];ge(we(Pt,{keys:["type","name","size"],data:d}))}function wo(e){if(e===0)return"0 B";let t=1024,r=["B","KB","MB","GB","TB"],o=Math.floor(Math.log(e)/Math.log(t));return`${parseFloat((e/t**o).toFixed(2))} ${r[o]}`}var vt=f(()=>{"use strict";i();P();y();kt();R()});var Lt={};b(Lt,{upload:()=>yo});import{readFile as ho}from"fs/promises";import{basename as xo}from"path";import{withResult as V}from"@byteslice/result";import{render as A}from"ink";import{jsx as $}from"react/jsx-runtime";async function yo(e,t,r){let o=await V(()=>S(e.project),w=>new Error(w.message));o.failure&&(A($(p,{message:o.failure.message})),process.exit(1));let a=await V(()=>ho(t),w=>new Error(`Failed to read file: ${w.message}`,{cause:w}));a.failure&&(A($(p,{message:a.failure.message})),process.exit(1));let s=xo(t),c=r?`${r}/${s}`:s,d=await u(this),n=await V(()=>d.buckets.createSignedUploadUrl({projectId:o.data,path:c}),w=>new Error(`Failed to get upload URL: ${w.message}`,{cause:w}));n.failure&&(A($(p,{message:n.failure.message})),process.exit(1));let h=await V(async()=>{let w=await fetch(n.data.signedUrl,{method:"PUT",headers:{"Content-Type":"application/octet-stream","x-upsert":"true"},body:a.data});if(!w.ok)throw new Error(`Upload failed: ${w.statusText}`);return w},w=>new Error(`Failed to upload file: ${w.message}`,{cause:w}));h.failure&&(A($(p,{message:h.failure.message})),process.exit(1)),A($(g,{message:`Uploaded ${s} to ${c}`}))}var It=f(()=>{"use strict";i();P();y();k();R()});var Tt={};b(Tt,{download:()=>bo});import{writeFile as Co}from"fs/promises";import{withResult as W}from"@byteslice/result";import{render as z}from"ink";import{jsx as _}from"react/jsx-runtime";async function bo(e,t,r){let o=await W(()=>S(e.project),n=>new Error(n.message));o.failure&&(z(_(p,{message:o.failure.message})),process.exit(1));let a=await u(this),s=await W(()=>a.buckets.createSignedUrl({projectId:o.data,path:t}),n=>new Error(`Failed to get download URL: ${n.message}`,{cause:n}));s.failure&&(z(_(p,{message:s.failure.message})),process.exit(1));let c=await W(async()=>{let n=await fetch(s.data.signedUrl);if(!n.ok)throw new Error(`Download failed: ${n.statusText}`);return n.arrayBuffer()},n=>new Error(`Failed to download file: ${n.message}`,{cause:n}));c.failure&&(z(_(p,{message:c.failure.message})),process.exit(1));let d=await W(()=>Co(r,Buffer.from(c.data)),n=>new Error(`Failed to write file: ${n.message}`,{cause:n}));d.failure&&(z(_(p,{message:d.failure.message})),process.exit(1)),z(_(g,{message:`Downloaded ${t} to ${r}`}))}var Rt=f(()=>{"use strict";i();P();y();k();R()});var Et={};b(Et,{deleteFile:()=>Po});import{withResult as Ut}from"@byteslice/result";import{render as he}from"ink";import{jsx as xe}from"react/jsx-runtime";async function Po(e,t){let r=await Ut(()=>S(e.project),s=>new Error(s.message));r.failure&&(he(xe(p,{message:r.failure.message})),process.exit(1));let o=await u(this),a=await Ut(()=>o.buckets.deleteFile({projectId:r.data,path:t}),s=>new Error(`Failed to delete file: ${s.message}`,{cause:s}));a.failure&&(he(xe(p,{message:a.failure.message})),process.exit(1)),he(xe(g,{message:`Deleted ${t}`}))}var Dt=f(()=>{"use strict";i();P();y();k();R()});var $t={};b($t,{url:()=>ko});import{withResult as At}from"@byteslice/result";import{render as ye}from"ink";import{jsx as Ce}from"react/jsx-runtime";async function ko(e,t){let r=await At(()=>S(e.project),s=>new Error(s.message));r.failure&&(ye(Ce(p,{message:r.failure.message})),process.exit(1));let o=await u(this),a=await At(()=>o.buckets.createSignedUrl({projectId:r.data,path:t,expiresIn:e.expires}),s=>new Error(`Failed to create signed URL: ${s.message}`,{cause:s}));a.failure&&(ye(Ce(p,{message:a.failure.message})),process.exit(1)),console.log(a.data.signedUrl),ye(Ce(g,{message:`URL expires at ${a.data.expiresAt}`}))}var zt=f(()=>{"use strict";i();P();y();k();R()});i();import{run as Bo}from"@stricli/core";i();import{buildInstallCommand as To,buildUninstallCommand as Ro}from"@stricli/auto-complete";import{buildApplication as Uo,buildRouteMap as Eo}from"@stricli/core";i();import{buildCommand as Oe,buildRouteMap as hr}from"@stricli/core";var xr=Oe({loader:async()=>{let{login:e}=await Promise.resolve().then(()=>(re(),te));return e},parameters:{positional:{kind:"tuple",parameters:[]}},docs:{brief:"Log in with an existing account"}}),yr=Oe({loader:async()=>{let{logout:e}=await Promise.resolve().then(()=>(re(),te));return e},parameters:{positional:{kind:"tuple",parameters:[]}},docs:{brief:"Log out of an existing account"}}),Ne=hr({routes:{login:xr,logout:yr},docs:{brief:"Auth commands"}});i();import{buildCommand as lt,buildRouteMap as Br}from"@stricli/core";var Or=lt({loader:async()=>{let{generateCode:e}=await Promise.resolve().then(()=>(et(),qe));return e},parameters:{positional:{kind:"tuple",parameters:[]}},docs:{brief:"Generate application code and types"}}),Nr=lt({loader:async()=>{let{initializeConfig:e}=await Promise.resolve().then(()=>(ct(),nt));return e},parameters:{positional:{kind:"tuple",parameters:[]}},docs:{brief:"Initialize Swirls configuration file"}}),mt=Br({routes:{gen:Or,init:Nr},docs:{brief:"Developer commands"}});i();import{buildCommand as Ct,buildRouteMap as ro}from"@stricli/core";var oo=Ct({loader:async()=>{let{createProject:e}=await Promise.resolve().then(()=>(gt(),ut));return e},parameters:{positional:{kind:"tuple",parameters:[{brief:"Project name",parse:String,placeholder:"name"}]}},docs:{brief:"Create a new project"}}),io=Ct({loader:async()=>{let{openProject:e}=await Promise.resolve().then(()=>(yt(),xt));return e},parameters:{positional:{kind:"tuple",parameters:[{brief:"Project ID",parse:String,placeholder:"project-id"}]}},docs:{brief:"Open project in browser"}}),bt=ro({routes:{create:oo,open:io},docs:{brief:"Project commands"}});i();import{buildCommand as B,buildRouteMap as So}from"@stricli/core";var jo=B({loader:async()=>{let{list:e}=await Promise.resolve().then(()=>(vt(),Ft));return e},parameters:{positional:{kind:"tuple",parameters:[{brief:"Path to list (optional)",parse:String,placeholder:"path",optional:!0}]},flags:{project:{kind:"parsed",brief:"Project ID (uses config if not specified)",parse:String,optional:!0}}},docs:{brief:"List files in storage"}}),Fo=B({loader:async()=>{let{upload:e}=await Promise.resolve().then(()=>(It(),Lt));return e},parameters:{positional:{kind:"tuple",parameters:[{brief:"Local file path to upload",parse:String,placeholder:"file"},{brief:"Destination path in storage (optional)",parse:String,placeholder:"dest",optional:!0}]},flags:{project:{kind:"parsed",brief:"Project ID (uses config if not specified)",parse:String,optional:!0}}},docs:{brief:"Upload a file to storage"}}),vo=B({loader:async()=>{let{download:e}=await Promise.resolve().then(()=>(Rt(),Tt));return e},parameters:{positional:{kind:"tuple",parameters:[{brief:"Path to file in storage",parse:String,placeholder:"path"},{brief:"Local destination path",parse:String,placeholder:"dest"}]},flags:{project:{kind:"parsed",brief:"Project ID (uses config if not specified)",parse:String,optional:!0}}},docs:{brief:"Download a file from storage"}}),Lo=B({loader:async()=>{let{deleteFile:e}=await Promise.resolve().then(()=>(Dt(),Et));return e},parameters:{positional:{kind:"tuple",parameters:[{brief:"Path to file in storage",parse:String,placeholder:"path"}]},flags:{project:{kind:"parsed",brief:"Project ID (uses config if not specified)",parse:String,optional:!0}}},docs:{brief:"Delete a file from storage"}}),Io=B({loader:async()=>{let{url:e}=await Promise.resolve().then(()=>(zt(),$t));return e},parameters:{positional:{kind:"tuple",parameters:[{brief:"Path to file in storage",parse:String,placeholder:"path"}]},flags:{project:{kind:"parsed",brief:"Project ID (uses config if not specified)",parse:String,optional:!0},expires:{kind:"parsed",brief:"Expiration time in seconds (default: 86400 = 24 hours)",parse:Number,optional:!0}}},docs:{brief:"Get a signed URL for a file"}}),_t=So({routes:{list:jo,upload:Fo,download:vo,delete:Lo,url:Io},docs:{brief:"Storage commands"}});var Bt="@swirls/cli",Ot="0.0.20",Nt="Swirls command line application";var Do=Eo({routes:{auth:Ne,dev:mt,project:bt,storage:_t,install:To("cli",{bash:"__cli_bash_complete"}),uninstall:Ro("cli",{bash:!0})},docs:{brief:Nt,hideRoute:{install:!0,uninstall:!0}}}),Mt=Uo(Do,{name:Bt,versionInfo:{currentVersion:Ot}});i();import Ao from"fs";import $o from"fs/promises";import zo from"os";import _o from"path";function Ht(e){return{fs:Ao,fsPromise:$o,os:zo,path:_o,process:e}}await Bo(Mt,process.argv.slice(2),Ht(process));
41
+ `});import un from"@clerk/clerk-js/headless/index.js";async function dr(e){let r=new ln(e);return await r.load({standardBrowser:!1}),r}async function gr(e,r){let n=await e.client?.signIn.create({ticket:r,strategy:"ticket"});if(!n||!n.createdSessionId)throw new Error("Failed to sign in.");return{createdSessionId:n.createdSessionId}}var ln,hr=S(()=>{"use strict";l();ln=un.Clerk});async function yt(e,r){await e.fsPromise.stat(r).then(()=>!0).catch(()=>!1)||await e.fsPromise.mkdir(r,{recursive:!0})}function Ie(e){if(!e.path)throw new Error("No `path` found in context.");if(!e.os)throw new Error("No `os` found in context.");let r=e.os.homedir();return e.path.join(r,".swirls")}var vt=S(()=>{"use strict";l()});import*as J from"zod";function _t(e){return`${Ie(e)}/credentials`}async function wr(e){let r=_t(e);await e.fsPromise.stat(r).then(()=>!0).catch(()=>!1)&&await e.fsPromise.unlink(r)}async function Ke(e){let r=_t(e),n=await e.fsPromise.readFile(r,"utf8");return J.parse(fn,JSON.parse(n))}async function Et(e,r,n,s){let i=_t(e);await yt(e,Ie(e)),await e.fsPromise.writeFile(i,JSON.stringify({idToken:r,jwt:n,sessionId:s}))}var fn,bt=S(()=>{"use strict";l();vt();fn=J.object({idToken:J.string(),jwt:J.string(),sessionId:J.string()})});import pn from"open";function yr(e=32){let r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",n=new Uint8Array(e);crypto.getRandomValues(n);let s="";for(let i of n)s+=r[i%r.length];return s}function vr(e){let r=new URLSearchParams({client_id:e.clientId,redirect_uri:e.redirectUri,response_type:"code",scope:"openid profile email",state:e.state});pn(`${e.authorizeUri}?${r}`)}var _r=S(()=>{"use strict";l()});import*as ce from"zod";var mn,dn,Qe,Ct=S(()=>{"use strict";l();mn=ce.object({API_URL:ce.string(),OAUTH_AUTHORIZE_URL:ce.string()}),dn={API_URL:"https://swirls.ai/api",OAUTH_AUTHORIZE_URL:"https://clerk.swirls.ai/oauth/authorize"},Qe=ce.parse(mn,dn)});import{withResult as gn}from"@byteslice/result";import{createORPCClient as hn,onError as wn}from"@orpc/client";import{RPCLink as yn}from"@orpc/client/fetch";async function $(e){let r=new yn({url:`${Qe.API_URL}/rpc`,headers:async()=>{let s=await gn(()=>Ke(e),p=>new Error("Failed to read credentials file",{cause:p.message}));if(s.failure)return{};let{idToken:i,jwt:c}=s.data;return{Authorization:`Bearer ${c||i}`}},interceptors:[wn(s=>{s instanceof Error&&s.name==="AbortError"||console.error(s)})]});return hn(r)}var W=S(()=>{"use strict";l();bt();Ct()});var br=we(Xe=>{"use strict";l();var vn=Symbol.for("react.transitional.element"),_n=Symbol.for("react.fragment");function Er(e,r,n){var s=null;if(n!==void 0&&(s=""+n),r.key!==void 0&&(s=""+r.key),"key"in r){n={};for(var i in r)i!=="key"&&(n[i]=r[i])}else n=r;return r=n.ref,{$$typeof:vn,type:e,key:s,ref:r!==void 0?r:null,props:n}}Xe.Fragment=_n;Xe.jsx=Er;Xe.jsxs=Er});var Lr=we(h=>{"use strict";l();var Rt=Symbol.for("react.transitional.element"),En=Symbol.for("react.portal"),bn=Symbol.for("react.fragment"),Cn=Symbol.for("react.strict_mode"),Tn=Symbol.for("react.profiler"),xn=Symbol.for("react.consumer"),Rn=Symbol.for("react.context"),kn=Symbol.for("react.forward_ref"),Sn=Symbol.for("react.suspense"),Pn=Symbol.for("react.memo"),kr=Symbol.for("react.lazy"),jn=Symbol.for("react.activity"),Cr=Symbol.iterator;function An(e){return e===null||typeof e!="object"?null:(e=Cr&&e[Cr]||e["@@iterator"],typeof e=="function"?e:null)}var Sr={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Pr=Object.assign,jr={};function ve(e,r,n){this.props=e,this.context=r,this.refs=jr,this.updater=n||Sr}ve.prototype.isReactComponent={};ve.prototype.setState=function(e,r){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,r,"setState")};ve.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function Ar(){}Ar.prototype=ve.prototype;function kt(e,r,n){this.props=e,this.context=r,this.refs=jr,this.updater=n||Sr}var St=kt.prototype=new Ar;St.constructor=kt;Pr(St,ve.prototype);St.isPureReactComponent=!0;var Tr=Array.isArray;function xt(){}var A={H:null,A:null,T:null,S:null},Or=Object.prototype.hasOwnProperty;function Pt(e,r,n){var s=n.ref;return{$$typeof:Rt,type:e,key:r,ref:s!==void 0?s:null,props:n}}function On(e,r){return Pt(e.type,r,e.props)}function jt(e){return typeof e=="object"&&e!==null&&e.$$typeof===Rt}function Ln(e){var r={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(n){return r[n]})}var xr=/\/+/g;function Tt(e,r){return typeof e=="object"&&e!==null&&e.key!=null?Ln(""+e.key):r.toString(36)}function In(e){switch(e.status){case"fulfilled":return e.value;case"rejected":throw e.reason;default:switch(typeof e.status=="string"?e.then(xt,xt):(e.status="pending",e.then(function(r){e.status==="pending"&&(e.status="fulfilled",e.value=r)},function(r){e.status==="pending"&&(e.status="rejected",e.reason=r)})),e.status){case"fulfilled":return e.value;case"rejected":throw e.reason}}throw e}function ye(e,r,n,s,i){var c=typeof e;(c==="undefined"||c==="boolean")&&(e=null);var p=!1;if(e===null)p=!0;else switch(c){case"bigint":case"string":case"number":p=!0;break;case"object":switch(e.$$typeof){case Rt:case En:p=!0;break;case kr:return p=e._init,ye(p(e._payload),r,n,s,i)}}if(p)return i=i(e),p=s===""?"."+Tt(e,0):s,Tr(i)?(n="",p!=null&&(n=p.replace(xr,"$&/")+"/"),ye(i,r,n,"",function(O){return O})):i!=null&&(jt(i)&&(i=On(i,n+(i.key==null||e&&e.key===i.key?"":(""+i.key).replace(xr,"$&/")+"/")+p)),r.push(i)),1;p=0;var E=s===""?".":s+":";if(Tr(e))for(var m=0;m<e.length;m++)s=e[m],c=E+Tt(s,m),p+=ye(s,r,n,c,i);else if(m=An(e),typeof m=="function")for(e=m.call(e),m=0;!(s=e.next()).done;)s=s.value,c=E+Tt(s,m++),p+=ye(s,r,n,c,i);else if(c==="object"){if(typeof e.then=="function")return ye(In(e),r,n,s,i);throw r=String(e),Error("Objects are not valid as a React child (found: "+(r==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":r)+"). If you meant to render a collection of children, use an array instead.")}return p}function Ze(e,r,n){if(e==null)return e;var s=[],i=0;return ye(e,s,"","",function(c){return r.call(n,c,i++)}),s}function Nn(e){if(e._status===-1){var r=e._result;r=r(),r.then(function(n){(e._status===0||e._status===-1)&&(e._status=1,e._result=n)},function(n){(e._status===0||e._status===-1)&&(e._status=2,e._result=n)}),e._status===-1&&(e._status=0,e._result=r)}if(e._status===1)return e._result.default;throw e._result}var Rr=typeof reportError=="function"?reportError:function(e){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var r=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof e=="object"&&e!==null&&typeof e.message=="string"?String(e.message):String(e),error:e});if(!window.dispatchEvent(r))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",e);return}console.error(e)},Un={map:Ze,forEach:function(e,r,n){Ze(e,function(){r.apply(this,arguments)},n)},count:function(e){var r=0;return Ze(e,function(){r++}),r},toArray:function(e){return Ze(e,function(r){return r})||[]},only:function(e){if(!jt(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};h.Activity=jn;h.Children=Un;h.Component=ve;h.Fragment=bn;h.Profiler=Tn;h.PureComponent=kt;h.StrictMode=Cn;h.Suspense=Sn;h.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=A;h.__COMPILER_RUNTIME={__proto__:null,c:function(e){return A.H.useMemoCache(e)}};h.cache=function(e){return function(){return e.apply(null,arguments)}};h.cacheSignal=function(){return null};h.cloneElement=function(e,r,n){if(e==null)throw Error("The argument must be a React element, but you passed "+e+".");var s=Pr({},e.props),i=e.key;if(r!=null)for(c in r.key!==void 0&&(i=""+r.key),r)!Or.call(r,c)||c==="key"||c==="__self"||c==="__source"||c==="ref"&&r.ref===void 0||(s[c]=r[c]);var c=arguments.length-2;if(c===1)s.children=n;else if(1<c){for(var p=Array(c),E=0;E<c;E++)p[E]=arguments[E+2];s.children=p}return Pt(e.type,i,s)};h.createContext=function(e){return e={$$typeof:Rn,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null},e.Provider=e,e.Consumer={$$typeof:xn,_context:e},e};h.createElement=function(e,r,n){var s,i={},c=null;if(r!=null)for(s in r.key!==void 0&&(c=""+r.key),r)Or.call(r,s)&&s!=="key"&&s!=="__self"&&s!=="__source"&&(i[s]=r[s]);var p=arguments.length-2;if(p===1)i.children=n;else if(1<p){for(var E=Array(p),m=0;m<p;m++)E[m]=arguments[m+2];i.children=E}if(e&&e.defaultProps)for(s in p=e.defaultProps,p)i[s]===void 0&&(i[s]=p[s]);return Pt(e,c,i)};h.createRef=function(){return{current:null}};h.forwardRef=function(e){return{$$typeof:kn,render:e}};h.isValidElement=jt;h.lazy=function(e){return{$$typeof:kr,_payload:{_status:-1,_result:e},_init:Nn}};h.memo=function(e,r){return{$$typeof:Pn,type:e,compare:r===void 0?null:r}};h.startTransition=function(e){var r=A.T,n={};A.T=n;try{var s=e(),i=A.S;i!==null&&i(n,s),typeof s=="object"&&s!==null&&typeof s.then=="function"&&s.then(xt,Rr)}catch(c){Rr(c)}finally{r!==null&&n.types!==null&&(r.types=n.types),A.T=r}};h.unstable_useCacheRefresh=function(){return A.H.useCacheRefresh()};h.use=function(e){return A.H.use(e)};h.useActionState=function(e,r,n){return A.H.useActionState(e,r,n)};h.useCallback=function(e,r){return A.H.useCallback(e,r)};h.useContext=function(e){return A.H.useContext(e)};h.useDebugValue=function(){};h.useDeferredValue=function(e,r){return A.H.useDeferredValue(e,r)};h.useEffect=function(e,r){return A.H.useEffect(e,r)};h.useEffectEvent=function(e){return A.H.useEffectEvent(e)};h.useId=function(){return A.H.useId()};h.useImperativeHandle=function(e,r,n){return A.H.useImperativeHandle(e,r,n)};h.useInsertionEffect=function(e,r){return A.H.useInsertionEffect(e,r)};h.useLayoutEffect=function(e,r){return A.H.useLayoutEffect(e,r)};h.useMemo=function(e,r){return A.H.useMemo(e,r)};h.useOptimistic=function(e,r){return A.H.useOptimistic(e,r)};h.useReducer=function(e,r,n){return A.H.useReducer(e,r,n)};h.useRef=function(e){return A.H.useRef(e)};h.useState=function(e){return A.H.useState(e)};h.useSyncExternalStore=function(e,r,n){return A.H.useSyncExternalStore(e,r,n)};h.useTransition=function(){return A.H.useTransition()};h.version="19.2.1"});var Ir=we((g,Je)=>{"use strict";l();process.env.NODE_ENV!=="production"&&(function(){function e(t,o){Object.defineProperty(s.prototype,t,{get:function(){console.warn("%s(...) is deprecated in plain JavaScript React classes. %s",o[0],o[1])}})}function r(t){return t===null||typeof t!="object"?null:(t=Be&&t[Be]||t["@@iterator"],typeof t=="function"?t:null)}function n(t,o){t=(t=t.constructor)&&(t.displayName||t.name)||"ReactClass";var u=t+"."+o;Qt[u]||(console.error("Can't call %s on a component that is not yet mounted. This is a no-op, but it might indicate a bug in your application. Instead, assign to `this.state` directly or define a `state = {};` class property with the desired state in the %s component.",o,t),Qt[u]=!0)}function s(t,o,u){this.props=t,this.context=o,this.refs=dt,this.updater=u||Xt}function i(){}function c(t,o,u){this.props=t,this.context=o,this.refs=dt,this.updater=u||Xt}function p(){}function E(t){return""+t}function m(t){try{E(t);var o=!1}catch{o=!0}if(o){o=console;var u=o.error,f=typeof Symbol=="function"&&Symbol.toStringTag&&t[Symbol.toStringTag]||t.constructor.name||"Object";return u.call(o,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",f),E(t)}}function O(t){if(t==null)return null;if(typeof t=="function")return t.$$typeof===Wo?null:t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case de:return"Fragment";case a:return"Profiler";case Ae:return"StrictMode";case ie:return"Suspense";case Oe:return"SuspenseList";case ge:return"Activity"}if(typeof t=="object")switch(typeof t.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),t.$$typeof){case je:return"Portal";case j:return t.displayName||"Context";case w:return(t._context.displayName||"Context")+".Consumer";case U:var o=t.render;return t=t.displayName,t||(t=o.displayName||o.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case N:return o=t.displayName||null,o!==null?o:O(t.type)||"Memo";case M:o=t._payload,t=t._init;try{return O(t(o))}catch{}}return null}function L(t){if(t===de)return"<>";if(typeof t=="object"&&t!==null&&t.$$typeof===M)return"<...>";try{var o=O(t);return o?"<"+o+">":"<...>"}catch{return"<...>"}}function Re(){var t=C.A;return t===null?null:t.getOwner()}function ke(){return Error("react-stack-top-frame")}function oe(t){if(We.call(t,"key")){var o=Object.getOwnPropertyDescriptor(t,"key").get;if(o&&o.isReactWarning)return!1}return t.key!==void 0}function Ye(t,o){function u(){tr||(tr=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",o))}u.isReactWarning=!0,Object.defineProperty(t,"key",{get:u,configurable:!0})}function lt(){var t=O(this.type);return or[t]||(or[t]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),t=this.props.ref,t!==void 0?t:null}function ne(t,o,u,f,d,T){var _=u.ref;return t={$$typeof:me,type:t,key:o,props:u,_owner:f},(_!==void 0?_:null)!==null?Object.defineProperty(t,"ref",{enumerable:!1,get:lt}):Object.defineProperty(t,"ref",{enumerable:!1,value:null}),t._store={},Object.defineProperty(t._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(t,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(t,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:d}),Object.defineProperty(t,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:T}),Object.freeze&&(Object.freeze(t.props),Object.freeze(t)),t}function ft(t,o){return o=ne(t.type,o,t.props,t._owner,t._debugStack,t._debugTask),t._store&&(o._store.validated=t._store.validated),o}function ze(t){V(t)?t._store&&(t._store.validated=1):typeof t=="object"&&t!==null&&t.$$typeof===M&&(t._payload.status==="fulfilled"?V(t._payload.value)&&t._payload.value._store&&(t._payload.value._store.validated=1):t._store&&(t._store.validated=1))}function V(t){return typeof t=="object"&&t!==null&&t.$$typeof===me}function pt(t){var o={"=":"=0",":":"=2"};return"$"+t.replace(/[=:]/g,function(u){return o[u]})}function Se(t,o){return typeof t=="object"&&t!==null&&t.key!=null?(m(t.key),pt(""+t.key)):o.toString(36)}function mt(t){switch(t.status){case"fulfilled":return t.value;case"rejected":throw t.reason;default:switch(typeof t.status=="string"?t.then(p,p):(t.status="pending",t.then(function(o){t.status==="pending"&&(t.status="fulfilled",t.value=o)},function(o){t.status==="pending"&&(t.status="rejected",t.reason=o)})),t.status){case"fulfilled":return t.value;case"rejected":throw t.reason}}throw t}function K(t,o,u,f,d){var T=typeof t;(T==="undefined"||T==="boolean")&&(t=null);var _=!1;if(t===null)_=!0;else switch(T){case"bigint":case"string":case"number":_=!0;break;case"object":switch(t.$$typeof){case me:case je:_=!0;break;case M:return _=t._init,K(_(t._payload),o,u,f,d)}}if(_){_=t,d=d(_);var P=f===""?"."+Se(_,0):f;return Jt(d)?(u="",P!=null&&(u=P.replace(sr,"$&/")+"/"),K(d,o,u,"",function(Z){return Z})):d!=null&&(V(d)&&(d.key!=null&&(_&&_.key===d.key||m(d.key)),u=ft(d,u+(d.key==null||_&&_.key===d.key?"":(""+d.key).replace(sr,"$&/")+"/")+P),f!==""&&_!=null&&V(_)&&_.key==null&&_._store&&!_._store.validated&&(u._store.validated=2),d=u),o.push(d)),1}if(_=0,P=f===""?".":f+":",Jt(t))for(var x=0;x<t.length;x++)f=t[x],T=P+Se(f,x),_+=K(f,o,u,T,d);else if(x=r(t),typeof x=="function")for(x===t.entries&&(nr||console.warn("Using Maps as children is not supported. Use an array of keyed ReactElements instead."),nr=!0),t=x.call(t),x=0;!(f=t.next()).done;)f=f.value,T=P+Se(f,x++),_+=K(f,o,u,T,d);else if(T==="object"){if(typeof t.then=="function")return K(mt(t),o,u,f,d);throw o=String(t),Error("Objects are not valid as a React child (found: "+(o==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":o)+"). If you meant to render a collection of children, use an array instead.")}return _}function le(t,o,u){if(t==null)return t;var f=[],d=0;return K(t,f,"","",function(T){return o.call(u,T,d++)}),f}function Pe(t){if(t._status===-1){var o=t._ioInfo;o!=null&&(o.start=o.end=performance.now()),o=t._result;var u=o();if(u.then(function(d){if(t._status===0||t._status===-1){t._status=1,t._result=d;var T=t._ioInfo;T!=null&&(T.end=performance.now()),u.status===void 0&&(u.status="fulfilled",u.value=d)}},function(d){if(t._status===0||t._status===-1){t._status=2,t._result=d;var T=t._ioInfo;T!=null&&(T.end=performance.now()),u.status===void 0&&(u.status="rejected",u.reason=d)}}),o=t._ioInfo,o!=null){o.value=u;var f=u.displayName;typeof f=="string"&&(o.name=f)}t._status===-1&&(t._status=0,t._result=u)}if(t._status===1)return o=t._result,o===void 0&&console.error(`lazy: Expected the result of a dynamic import() call. Instead received: %s
42
+
43
+ Your code should look like:
44
+ const MyComponent = lazy(() => import('./MyComponent'))
45
+
46
+ Did you accidentally put curly braces around the import?`,o),"default"in o||console.error(`lazy: Expected the result of a dynamic import() call. Instead received: %s
47
+
48
+ Your code should look like:
49
+ const MyComponent = lazy(() => import('./MyComponent'))`,o),o.default;throw t._result}function I(){var t=C.H;return t===null&&console.error(`Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:
50
+ 1. You might have mismatching versions of React and the renderer (such as React DOM)
51
+ 2. You might be breaking the Rules of Hooks
52
+ 3. You might have more than one copy of React in the same app
53
+ See https://react.dev/link/invalid-hook-call for tips about how to debug and fix this problem.`),t}function He(){C.asyncTransitions--}function Q(t){if(qe===null)try{var o=("require"+Math.random()).slice(0,7);qe=(Je&&Je[o]).call(Je,"timers").setImmediate}catch{qe=function(f){ar===!1&&(ar=!0,typeof MessageChannel>"u"&&console.error("This browser does not have a MessageChannel implementation, so enqueuing tasks via await act(async () => ...) will fail. Please file an issue at https://github.com/facebook/react/issues if you encounter this warning."));var d=new MessageChannel;d.port1.onmessage=f,d.port2.postMessage(void 0)}}return qe(t)}function X(t){return 1<t.length&&typeof AggregateError=="function"?new AggregateError(t):t[0]}function fe(t,o){o!==Ge-1&&console.error("You seem to have overlapping act() calls, this is not supported. Be sure to await previous act() calls before making a new one. "),Ge=o}function se(t,o,u){var f=C.actQueue;if(f!==null)if(f.length!==0)try{pe(f),Q(function(){return se(t,o,u)});return}catch(d){C.thrownErrors.push(d)}else C.actQueue=null;0<C.thrownErrors.length?(f=X(C.thrownErrors),C.thrownErrors.length=0,u(f)):o(t)}function pe(t){if(!gt){gt=!0;var o=0;try{for(;o<t.length;o++){var u=t[o];do{C.didUsePromise=!1;var f=u(!1);if(f!==null){if(C.didUsePromise){t[o]=u,t.splice(0,o);return}u=f}else break}while(!0)}t.length=0}catch(d){t.splice(0,o+1),C.thrownErrors.push(d)}finally{gt=!1}}}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var me=Symbol.for("react.transitional.element"),je=Symbol.for("react.portal"),de=Symbol.for("react.fragment"),Ae=Symbol.for("react.strict_mode"),a=Symbol.for("react.profiler"),w=Symbol.for("react.consumer"),j=Symbol.for("react.context"),U=Symbol.for("react.forward_ref"),ie=Symbol.for("react.suspense"),Oe=Symbol.for("react.suspense_list"),N=Symbol.for("react.memo"),M=Symbol.for("react.lazy"),ge=Symbol.for("react.activity"),Be=Symbol.iterator,Qt={},Xt={isMounted:function(){return!1},enqueueForceUpdate:function(t){n(t,"forceUpdate")},enqueueReplaceState:function(t){n(t,"replaceState")},enqueueSetState:function(t){n(t,"setState")}},Zt=Object.assign,dt={};Object.freeze(dt),s.prototype.isReactComponent={},s.prototype.setState=function(t,o){if(typeof t!="object"&&typeof t!="function"&&t!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,t,o,"setState")},s.prototype.forceUpdate=function(t){this.updater.enqueueForceUpdate(this,t,"forceUpdate")};var Y={isMounted:["isMounted","Instead, make sure to clean up subscriptions and pending requests in componentWillUnmount to prevent memory leaks."],replaceState:["replaceState","Refactor your code to use setState instead (see https://github.com/facebook/react/issues/3236)."]};for(Le in Y)Y.hasOwnProperty(Le)&&e(Le,Y[Le]);i.prototype=s.prototype,Y=c.prototype=new i,Y.constructor=c,Zt(Y,s.prototype),Y.isPureReactComponent=!0;var Jt=Array.isArray,Wo=Symbol.for("react.client.reference"),C={H:null,A:null,T:null,S:null,actQueue:null,asyncTransitions:0,isBatchingLegacy:!1,didScheduleLegacyUpdate:!1,didUsePromise:!1,thrownErrors:[],getCurrentStack:null,recentlyCreatedOwnerStacks:0},We=Object.prototype.hasOwnProperty,er=console.createTask?console.createTask:function(){return null};Y={react_stack_bottom_frame:function(t){return t()}};var tr,rr,or={},qo=Y.react_stack_bottom_frame.bind(Y,ke)(),Go=er(L(ke)),nr=!1,sr=/\/+/g,ir=typeof reportError=="function"?reportError:function(t){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var o=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof t=="object"&&t!==null&&typeof t.message=="string"?String(t.message):String(t),error:t});if(!window.dispatchEvent(o))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",t);return}console.error(t)},ar=!1,qe=null,Ge=0,Ve=!1,gt=!1,cr=typeof queueMicrotask=="function"?function(t){queueMicrotask(function(){return queueMicrotask(t)})}:Q;Y=Object.freeze({__proto__:null,c:function(t){return I().useMemoCache(t)}});var Le={map:le,forEach:function(t,o,u){le(t,function(){o.apply(this,arguments)},u)},count:function(t){var o=0;return le(t,function(){o++}),o},toArray:function(t){return le(t,function(o){return o})||[]},only:function(t){if(!V(t))throw Error("React.Children.only expected to receive a single React element child.");return t}};g.Activity=ge,g.Children=Le,g.Component=s,g.Fragment=de,g.Profiler=a,g.PureComponent=c,g.StrictMode=Ae,g.Suspense=ie,g.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=C,g.__COMPILER_RUNTIME=Y,g.act=function(t){var o=C.actQueue,u=Ge;Ge++;var f=C.actQueue=o!==null?o:[],d=!1;try{var T=t()}catch(x){C.thrownErrors.push(x)}if(0<C.thrownErrors.length)throw fe(o,u),t=X(C.thrownErrors),C.thrownErrors.length=0,t;if(T!==null&&typeof T=="object"&&typeof T.then=="function"){var _=T;return cr(function(){d||Ve||(Ve=!0,console.error("You called act(async () => ...) without await. This could lead to unexpected testing behaviour, interleaving multiple act calls and mixing their scopes. You should - await act(async () => ...);"))}),{then:function(x,Z){d=!0,_.then(function(he){if(fe(o,u),u===0){try{pe(f),Q(function(){return se(he,x,Z)})}catch(Ko){C.thrownErrors.push(Ko)}if(0<C.thrownErrors.length){var Vo=X(C.thrownErrors);C.thrownErrors.length=0,Z(Vo)}}else x(he)},function(he){fe(o,u),0<C.thrownErrors.length&&(he=X(C.thrownErrors),C.thrownErrors.length=0),Z(he)})}}}var P=T;if(fe(o,u),u===0&&(pe(f),f.length!==0&&cr(function(){d||Ve||(Ve=!0,console.error("A component suspended inside an `act` scope, but the `act` call was not awaited. When testing React components that depend on asynchronous data, you must await the result:\n\nawait act(() => ...)"))}),C.actQueue=null),0<C.thrownErrors.length)throw t=X(C.thrownErrors),C.thrownErrors.length=0,t;return{then:function(x,Z){d=!0,u===0?(C.actQueue=f,Q(function(){return se(P,x,Z)})):x(P)}}},g.cache=function(t){return function(){return t.apply(null,arguments)}},g.cacheSignal=function(){return null},g.captureOwnerStack=function(){var t=C.getCurrentStack;return t===null?null:t()},g.cloneElement=function(t,o,u){if(t==null)throw Error("The argument must be a React element, but you passed "+t+".");var f=Zt({},t.props),d=t.key,T=t._owner;if(o!=null){var _;e:{if(We.call(o,"ref")&&(_=Object.getOwnPropertyDescriptor(o,"ref").get)&&_.isReactWarning){_=!1;break e}_=o.ref!==void 0}_&&(T=Re()),oe(o)&&(m(o.key),d=""+o.key);for(P in o)!We.call(o,P)||P==="key"||P==="__self"||P==="__source"||P==="ref"&&o.ref===void 0||(f[P]=o[P])}var P=arguments.length-2;if(P===1)f.children=u;else if(1<P){_=Array(P);for(var x=0;x<P;x++)_[x]=arguments[x+2];f.children=_}for(f=ne(t.type,d,f,T,t._debugStack,t._debugTask),d=2;d<arguments.length;d++)ze(arguments[d]);return f},g.createContext=function(t){return t={$$typeof:j,_currentValue:t,_currentValue2:t,_threadCount:0,Provider:null,Consumer:null},t.Provider=t,t.Consumer={$$typeof:w,_context:t},t._currentRenderer=null,t._currentRenderer2=null,t},g.createElement=function(t,o,u){for(var f=2;f<arguments.length;f++)ze(arguments[f]);f={};var d=null;if(o!=null)for(x in rr||!("__self"in o)||"key"in o||(rr=!0,console.warn("Your app (or one of its dependencies) is using an outdated JSX transform. Update to the modern JSX transform for faster performance: https://react.dev/link/new-jsx-transform")),oe(o)&&(m(o.key),d=""+o.key),o)We.call(o,x)&&x!=="key"&&x!=="__self"&&x!=="__source"&&(f[x]=o[x]);var T=arguments.length-2;if(T===1)f.children=u;else if(1<T){for(var _=Array(T),P=0;P<T;P++)_[P]=arguments[P+2];Object.freeze&&Object.freeze(_),f.children=_}if(t&&t.defaultProps)for(x in T=t.defaultProps,T)f[x]===void 0&&(f[x]=T[x]);d&&Ye(f,typeof t=="function"?t.displayName||t.name||"Unknown":t);var x=1e4>C.recentlyCreatedOwnerStacks++;return ne(t,d,f,Re(),x?Error("react-stack-top-frame"):qo,x?er(L(t)):Go)},g.createRef=function(){var t={current:null};return Object.seal(t),t},g.forwardRef=function(t){t!=null&&t.$$typeof===N?console.error("forwardRef requires a render function but received a `memo` component. Instead of forwardRef(memo(...)), use memo(forwardRef(...))."):typeof t!="function"?console.error("forwardRef requires a render function but was given %s.",t===null?"null":typeof t):t.length!==0&&t.length!==2&&console.error("forwardRef render functions accept exactly two parameters: props and ref. %s",t.length===1?"Did you forget to use the ref parameter?":"Any additional parameter will be undefined."),t!=null&&t.defaultProps!=null&&console.error("forwardRef render functions do not support defaultProps. Did you accidentally pass a React component?");var o={$$typeof:U,render:t},u;return Object.defineProperty(o,"displayName",{enumerable:!1,configurable:!0,get:function(){return u},set:function(f){u=f,t.name||t.displayName||(Object.defineProperty(t,"name",{value:f}),t.displayName=f)}}),o},g.isValidElement=V,g.lazy=function(t){t={_status:-1,_result:t};var o={$$typeof:M,_payload:t,_init:Pe},u={name:"lazy",start:-1,end:-1,value:null,owner:null,debugStack:Error("react-stack-top-frame"),debugTask:console.createTask?console.createTask("lazy()"):null};return t._ioInfo=u,o._debugInfo=[{awaited:u}],o},g.memo=function(t,o){t==null&&console.error("memo: The first argument must be a component. Instead received: %s",t===null?"null":typeof t),o={$$typeof:N,type:t,compare:o===void 0?null:o};var u;return Object.defineProperty(o,"displayName",{enumerable:!1,configurable:!0,get:function(){return u},set:function(f){u=f,t.name||t.displayName||(Object.defineProperty(t,"name",{value:f}),t.displayName=f)}}),o},g.startTransition=function(t){var o=C.T,u={};u._updatedFibers=new Set,C.T=u;try{var f=t(),d=C.S;d!==null&&d(u,f),typeof f=="object"&&f!==null&&typeof f.then=="function"&&(C.asyncTransitions++,f.then(He,He),f.then(p,ir))}catch(T){ir(T)}finally{o===null&&u._updatedFibers&&(t=u._updatedFibers.size,u._updatedFibers.clear(),10<t&&console.warn("Detected a large number of updates inside startTransition. If this is due to a subscription please re-write it to use React provided hooks. Otherwise concurrent mode guarantees are off the table.")),o!==null&&u.types!==null&&(o.types!==null&&o.types!==u.types&&console.error("We expected inner Transitions to have transferred the outer types set and that you cannot add to the outer Transition while inside the inner.This is a bug in React."),o.types=u.types),C.T=o}},g.unstable_useCacheRefresh=function(){return I().useCacheRefresh()},g.use=function(t){return I().use(t)},g.useActionState=function(t,o,u){return I().useActionState(t,o,u)},g.useCallback=function(t,o){return I().useCallback(t,o)},g.useContext=function(t){var o=I();return t.$$typeof===w&&console.error("Calling useContext(Context.Consumer) is not supported and will cause bugs. Did you mean to call useContext(Context) instead?"),o.useContext(t)},g.useDebugValue=function(t,o){return I().useDebugValue(t,o)},g.useDeferredValue=function(t,o){return I().useDeferredValue(t,o)},g.useEffect=function(t,o){return t==null&&console.warn("React Hook useEffect requires an effect callback. Did you forget to pass a callback to the hook?"),I().useEffect(t,o)},g.useEffectEvent=function(t){return I().useEffectEvent(t)},g.useId=function(){return I().useId()},g.useImperativeHandle=function(t,o,u){return I().useImperativeHandle(t,o,u)},g.useInsertionEffect=function(t,o){return t==null&&console.warn("React Hook useInsertionEffect requires an effect callback. Did you forget to pass a callback to the hook?"),I().useInsertionEffect(t,o)},g.useLayoutEffect=function(t,o){return t==null&&console.warn("React Hook useLayoutEffect requires an effect callback. Did you forget to pass a callback to the hook?"),I().useLayoutEffect(t,o)},g.useMemo=function(t,o){return I().useMemo(t,o)},g.useOptimistic=function(t,o){return I().useOptimistic(t,o)},g.useReducer=function(t,o,u){return I().useReducer(t,o,u)},g.useRef=function(t){return I().useRef(t)},g.useState=function(t){return I().useState(t)},g.useSyncExternalStore=function(t,o,u){return I().useSyncExternalStore(t,o,u)},g.useTransition=function(){return I().useTransition()},g.version="19.2.1",typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()});var Ne=we((Hi,At)=>{"use strict";l();process.env.NODE_ENV==="production"?At.exports=Lr():At.exports=Ir()});var Nr=we(et=>{"use strict";l();process.env.NODE_ENV!=="production"&&(function(){function e(a){if(a==null)return null;if(typeof a=="function")return a.$$typeof===He?null:a.displayName||a.name||null;if(typeof a=="string")return a;switch(a){case ne:return"Fragment";case ze:return"Profiler";case ft:return"StrictMode";case mt:return"Suspense";case K:return"SuspenseList";case I:return"Activity"}if(typeof a=="object")switch(typeof a.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),a.$$typeof){case lt:return"Portal";case pt:return a.displayName||"Context";case V:return(a._context.displayName||"Context")+".Consumer";case Se:var w=a.render;return a=a.displayName,a||(a=w.displayName||w.name||"",a=a!==""?"ForwardRef("+a+")":"ForwardRef"),a;case le:return w=a.displayName||null,w!==null?w:e(a.type)||"Memo";case Pe:w=a._payload,a=a._init;try{return e(a(w))}catch{}}return null}function r(a){return""+a}function n(a){try{r(a);var w=!1}catch{w=!0}if(w){w=console;var j=w.error,U=typeof Symbol=="function"&&Symbol.toStringTag&&a[Symbol.toStringTag]||a.constructor.name||"Object";return j.call(w,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",U),r(a)}}function s(a){if(a===ne)return"<>";if(typeof a=="object"&&a!==null&&a.$$typeof===Pe)return"<...>";try{var w=e(a);return w?"<"+w+">":"<...>"}catch{return"<...>"}}function i(){var a=Q.A;return a===null?null:a.getOwner()}function c(){return Error("react-stack-top-frame")}function p(a){if(X.call(a,"key")){var w=Object.getOwnPropertyDescriptor(a,"key").get;if(w&&w.isReactWarning)return!1}return a.key!==void 0}function E(a,w){function j(){pe||(pe=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",w))}j.isReactWarning=!0,Object.defineProperty(a,"key",{get:j,configurable:!0})}function m(){var a=e(this.type);return me[a]||(me[a]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),a=this.props.ref,a!==void 0?a:null}function O(a,w,j,U,ie,Oe){var N=j.ref;return a={$$typeof:Ye,type:a,key:w,props:j,_owner:U},(N!==void 0?N:null)!==null?Object.defineProperty(a,"ref",{enumerable:!1,get:m}):Object.defineProperty(a,"ref",{enumerable:!1,value:null}),a._store={},Object.defineProperty(a._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(a,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(a,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:ie}),Object.defineProperty(a,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:Oe}),Object.freeze&&(Object.freeze(a.props),Object.freeze(a)),a}function L(a,w,j,U,ie,Oe){var N=w.children;if(N!==void 0)if(U)if(fe(N)){for(U=0;U<N.length;U++)Re(N[U]);Object.freeze&&Object.freeze(N)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else Re(N);if(X.call(w,"key")){N=e(a);var M=Object.keys(w).filter(function(Be){return Be!=="key"});U=0<M.length?"{key: someKey, "+M.join(": ..., ")+": ...}":"{key: someKey}",Ae[N+U]||(M=0<M.length?"{"+M.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
54
+ let props = %s;
55
+ <%s {...props} />
56
+ React keys must be passed directly to JSX without using spread:
57
+ let props = %s;
58
+ <%s key={someKey} {...props} />`,U,N,M,N),Ae[N+U]=!0)}if(N=null,j!==void 0&&(n(j),N=""+j),p(w)&&(n(w.key),N=""+w.key),"key"in w){j={};for(var ge in w)ge!=="key"&&(j[ge]=w[ge])}else j=w;return N&&E(j,typeof a=="function"?a.displayName||a.name||"Unknown":a),O(a,N,j,i(),ie,Oe)}function Re(a){ke(a)?a._store&&(a._store.validated=1):typeof a=="object"&&a!==null&&a.$$typeof===Pe&&(a._payload.status==="fulfilled"?ke(a._payload.value)&&a._payload.value._store&&(a._payload.value._store.validated=1):a._store&&(a._store.validated=1))}function ke(a){return typeof a=="object"&&a!==null&&a.$$typeof===Ye}var oe=Ne(),Ye=Symbol.for("react.transitional.element"),lt=Symbol.for("react.portal"),ne=Symbol.for("react.fragment"),ft=Symbol.for("react.strict_mode"),ze=Symbol.for("react.profiler"),V=Symbol.for("react.consumer"),pt=Symbol.for("react.context"),Se=Symbol.for("react.forward_ref"),mt=Symbol.for("react.suspense"),K=Symbol.for("react.suspense_list"),le=Symbol.for("react.memo"),Pe=Symbol.for("react.lazy"),I=Symbol.for("react.activity"),He=Symbol.for("react.client.reference"),Q=oe.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,X=Object.prototype.hasOwnProperty,fe=Array.isArray,se=console.createTask?console.createTask:function(){return null};oe={react_stack_bottom_frame:function(a){return a()}};var pe,me={},je=oe.react_stack_bottom_frame.bind(oe,c)(),de=se(s(c)),Ae={};et.Fragment=ne,et.jsx=function(a,w,j){var U=1e4>Q.recentlyCreatedOwnerStacks++;return L(a,w,j,!1,U?Error("react-stack-top-frame"):je,U?se(s(a)):de)},et.jsxs=function(a,w,j){var U=1e4>Q.recentlyCreatedOwnerStacks++;return L(a,w,j,!0,U?Error("react-stack-top-frame"):je,U?se(s(a)):de)}})()});var R=we((Gi,Ot)=>{"use strict";l();process.env.NODE_ENV==="production"?Ot.exports=br():Ot.exports=Nr()});import{Box as $n,Text as Ur}from"ink";function k(e){return(0,Ue.jsxs)($n,{flexDirection:"column",children:[(0,Ue.jsx)(Ur,{color:"red",children:e.message}),(0,Ue.jsx)(Ur,{children:"If this issue persists, send us an email at help@byteslice.co, and we can help you out."})]})}var Ue,z=S(()=>{"use strict";l();Ue=b(R(),1)});import{Text as Fn}from"ink";function F(e){return(0,$r.jsx)(Fn,{color:"green",children:e.message})}var $r,q=S(()=>{"use strict";l();$r=b(R(),1)});import{Text as Dn}from"ink";function Fr(e){return(0,Dr.jsx)(Dn,{color:"yellow",children:e.message})}var Dr,Mr=S(()=>{"use strict";l();Dr=b(R(),1)});function Mn(e){return`${Ie(e)}/project`}async function Yr(e){let r=Mn(e);await e.fsPromise.stat(r).then(()=>!0).catch(()=>!1)&&await e.fsPromise.unlink(r)}var zr=S(()=>{"use strict";l();vt()});var Lt={};B(Lt,{login:()=>zn,logout:()=>Hn});import{withResult as H}from"@byteslice/result";import{render as ue}from"ink";async function Yn(e,r,n){let s=await H(async()=>await(await $(e)).cli.exchangeToken({code:n.code}),O=>new Error("Failed to exchange callback code for token",{cause:O.message}));if(s.failure)throw s.failure;await Et(e,s.data.idToken,"","");let i=await H(async()=>await(await $(e)).cli.createSignInTicket(),O=>new Error("Failed to exchange ID token code for a sign-in ticket",{cause:O.message}));if(i.failure)throw i.failure;let c=await dr(r.clerkPublishableKey),p=await H(()=>gr(c,i.data.token),O=>new Error("Failed to create a new sign-in for this device",{cause:O.message}));if(p.failure)throw p.failure;let E=await H(async()=>await(await $(e)).cli.createJwt({sessionId:p.data.createdSessionId}),O=>new Error("Failed to create a session JWT",{cause:O.message}));if(E.failure)throw E.failure;let m=await H(()=>Et(e,s.data.idToken,E.data,p.data.createdSessionId),O=>new Error("Failed to save your credentials to disk",{cause:O.message}));if(m.failure)throw m.failure}async function zn(){let e=await $(this),r=yr(),n=await H(()=>e.cli.getConfig(),i=>new Error("Failed to retrieve authentication configuration",{cause:i.message}));n.failure&&(ue((0,ee.jsx)(k,{message:n.failure.message})),process.exit(1)),vr({authorizeUri:Qe.OAUTH_AUTHORIZE_URL,clientId:n.data.clientId,redirectUri:wt,state:r});let s=await H(()=>pr(async i=>{if(i.state!==r)throw new Error("Invalid state.");await Yn(this,n.data,i)}),i=>i);s.failure&&(ue((0,ee.jsx)(k,{message:s.failure.message})),process.exit(1)),ue((0,ee.jsx)(F,{message:"Success! You are now logged in."}))}async function Hn(){let e=await H(()=>Ke(this),c=>c);e.failure&&(ue((0,ee.jsx)(k,{message:"There was an issue reading your credentials. You are probably already logged out."})),process.exit(1));let r=await $(this),n=await H(()=>r.cli.getConfig(),c=>new Error("Failed to retrieve authentication configuration",{cause:c.message}));n.failure&&(ue((0,ee.jsx)(k,{message:n.failure.message})),process.exit(1)),(await H(async()=>r.cli.revokeSession({sessionId:e.data.sessionId}),c=>c)).failure&&ue((0,ee.jsx)(Fr,{message:"There was an issue revoking your session. You are probably already logged out. Purging credentials file..."}));let i=await H(async()=>{await wr(this),await Yr(this)},c=>c);if(i.failure)throw i.failure;ue((0,ee.jsx)(F,{message:"Success! You are now logged out."}))}var ee,It=S(()=>{"use strict";l();mr();hr();bt();_r();W();z();q();Mr();Ct();zr();ee=b(R(),1)});import{Box as Gn,Text as Wr}from"ink";import Vn from"ink-spinner";function qr(e){return(0,_e.jsxs)(Gn,{children:[(0,_e.jsx)(Wr,{color:"cyan",children:(0,_e.jsx)(Vn,{type:"dots"})}),(0,_e.jsxs)(Wr,{children:[" ",e.message]})]})}var _e,Gr=S(()=>{"use strict";l();_e=b(R(),1)});import{existsSync as Kn}from"fs";import{resolve as Qn}from"path";import{configFileName as Vr,configSchema as Xn}from"@swirls/sdk/config";import{createJiti as Zn}from"jiti";async function Kr(){let e=Qn(process.cwd(),Vr);if(!Kn(e))throw new Error(`Config file not found in project root: ${Vr}`);let n=await Zn(import.meta.url).import(e,{default:!0});return Xn.parse(n)}var Qr=S(()=>{"use strict";l()});async function Xr(e,r){let n=await $(e),{results:s}=await n.forms.listForms({projectId:r});function i(p){return p.schema!=null}return s.filter(i).map(p=>({id:p.id,name:p.name,schema:p.schema}))}var Zr=S(()=>{"use strict";l();W()});import Jr from"fs/promises";import Jn from"path";async function tt(e,r){let n=Jn.dirname(e);await Jr.mkdir(n,{recursive:!0}),await Jr.writeFile(e,r,"utf-8")}var Nt=S(()=>{"use strict";l()});var eo={};B(eo,{generateCode:()=>ts});import Ut from"process";import{withResult as $t}from"@byteslice/result";import{generateFormsCode as es}from"@swirls/sdk/form/generate";import{render as $e}from"ink";async function ts(){let e=await $t(()=>Kr(),c=>new Error("Failed to load configuration",{cause:c}));e.failure&&($e((0,Ee.jsx)(k,{message:e.failure.message})),Ut.exit(1));let{projectId:r,genPath:n}=e.data;$e((0,Ee.jsx)(qr,{message:"Generating form code..."}));let s=await $t(async()=>{let c=['// This file was generated by "@swirls/cli dev generate"',"// Do not edit this file manually",""],p=await Xr(this,r);return es(p,c)},c=>new Error(`Failed to generate form code: ${c.message}`,{cause:c}));s.failure&&($e((0,Ee.jsx)(k,{message:s.failure.message})),Ut.exit(1));let i=await $t(()=>tt(n,s.data),c=>new Error("Failed to write code file",{cause:c}));i.failure&&($e((0,Ee.jsx)(k,{message:i.failure.message})),Ut.exit(1)),$e((0,Ee.jsx)(F,{message:`Success! Generated code at ${n}`}))}var Ee,to=S(()=>{"use strict";l();z();Gr();q();Qr();Zr();Nt();Ee=b(R(),1)});import{Box as ro,render as rs,Text as oo}from"ink";import os from"ink-text-input";import{z as ns}from"zod";function ss(e){let[r,n]=(0,Ft.useState)(""),[s,i]=(0,Ft.useState)(null);return(0,te.jsxs)(ro,{flexDirection:"column",children:[(0,te.jsxs)(ro,{children:[(0,te.jsx)(oo,{children:"Enter project ID (UUID): "}),(0,te.jsx)(os,{value:r,onChange:E=>{i(null),n(E)},onSubmit:E=>{if(i(null),E.trim()===""){setImmediate(()=>e.onInput());return}let m=ns.uuid().safeParse(E);if(!m.success){i("Invalid UUID. Please try again."),n("");return}setImmediate(()=>e.onInput(m.data))}})]}),s&&(0,te.jsx)(oo,{color:"red",children:s})]})}async function no(){return new Promise(e=>{let r=rs((0,te.jsx)(ss,{onInput:n=>{r.unmount(),e(n)}}))})}var Ft,te,so=S(()=>{"use strict";l();Ft=b(Ne(),1),te=b(R(),1)});var io={};B(io,{initializeConfig:()=>fs});import{existsSync as is}from"fs";import{resolve as as}from"path";import Dt from"process";import{withResult as cs}from"@byteslice/result";import{configFileName as us,generateConfig as ls}from"@swirls/sdk/config";import{render as Mt}from"ink";async function fs(){let e=as(Dt.cwd(),us);is(e)&&(Mt((0,rt.jsx)(k,{message:`Configuration already exists at ${e}.`})),Dt.exit(1));let r=await no(),n=await cs(async()=>{let s=ls(r);await tt(e,s)},s=>new Error("Failed to create configuration",{cause:s}));n.failure&&(Mt((0,rt.jsx)(k,{message:n.failure.message})),Dt.exit(1)),Mt((0,rt.jsx)(F,{message:`Success! Created configuration at ${e}`}))}var rt,ao=S(()=>{"use strict";l();z();q();so();Nt();rt=b(R(),1)});import{render as gs}from"ink";import hs from"open";async function ot(e){let r=`${ws}/${e.id}`;await hs(r),gs((0,lo.jsx)(F,{message:`Opened project "${e.name}" in browser.`}))}var lo,ws,Yt=S(()=>{"use strict";l();q();lo=b(R(),1),ws="https://swirls.ai/projects"});import{Box as zt,render as ys,Text as vs}from"ink";import _s from"ink-text-input";function Es(e){let[r,n]=(0,fo.useState)(""),s=i=>{let c=i.trim().toLowerCase(),p=c===""||c==="y"||c==="yes";setImmediate(()=>e.onAnswer(p))};return(0,re.jsx)(zt,{flexDirection:"column",children:(0,re.jsxs)(zt,{children:[(0,re.jsxs)(vs,{children:[e.message," "]}),(0,re.jsx)(_s,{value:r,onChange:n,onSubmit:s})]})})}async function po(e){let{above:r}=e??{};return new Promise(n=>{let s=ys((0,re.jsxs)(zt,{flexDirection:"column",children:[r,(0,re.jsx)(Es,{message:"Open project in browser? (Y/n)",onAnswer:i=>{s.unmount(),n(i)}})]}))})}var fo,re,mo=S(()=>{"use strict";l();fo=b(Ne(),1),re=b(R(),1)});var go={};B(go,{createProject:()=>Ts});import{withResult as bs}from"@byteslice/result";import{render as Cs}from"ink";async function Ts(e,r){let n=await $(this),s=await bs(()=>n.projects.createProject({name:r}),c=>new Error(`Failed to create project: ${c.message}`,{cause:c}));s.failure&&(Cs((0,Ht.jsx)(k,{message:s.failure.message})),process.exit(1)),await po({above:(0,Ht.jsx)(F,{message:`Success! Created "${r}" project: ${s.data.id}`})})&&await ot(s.data)}var Ht,ho=S(()=>{"use strict";l();W();z();q();Yt();mo();Ht=b(R(),1)});var yo={};B(yo,{openProject:()=>Rs});import{withResult as xs}from"@byteslice/result";import{render as wo}from"ink";async function Rs(e,r){let n=await $(this),s=await xs(()=>n.projects.getProject({projectId:r}),i=>new Error(`Failed to get project: ${i.message}`,{cause:i}));s.failure&&(wo((0,Bt.jsx)(k,{message:s.failure.message})),process.exit(1)),s.data||(wo((0,Bt.jsx)(k,{message:"Project not found."})),process.exit(1)),await ot(s.data)}var Bt,vo=S(()=>{"use strict";l();W();z();Yt();Bt=b(R(),1)});import{Box as be,Text as nt}from"ink";function js(e){return typeof e=="boolean"?e?(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(nt,{color:"green",children:"\u2714"})," yes"]}):"no":String(e)}function As(e,r){return r.map(n=>{let s=n.key in e?js(e[n.key]):null;return{column:n,value:s}})}function Os(e,r,n=1){return r.map(s=>{let i=String(s).length,c=e.map(E=>s in E&&(typeof E[s]=="string"||typeof E[s]=="number")?String(E[s]).length:0),p=Math.max(...c,i)+n*2;return{name:String(s),key:s,width:p}})}function Wt(e){return(0,D.jsx)(nt,{children:Array(e.width).fill("\u2500").join("")})}function Co(e){let r=Os(e.data,e.keys),n=r.reduce((s,i)=>s+i.width,0);return(0,D.jsxs)(be,{flexDirection:"column",width:n,children:[(0,D.jsx)(Wt,{width:n}),(0,D.jsx)(be,{flexDirection:"row",children:r.map(s=>(0,D.jsx)(be,{width:s.width,children:(0,D.jsx)(nt,{bold:!0,color:"blue",children:s.name})},s.name))}),(0,D.jsx)(Wt,{width:n}),(0,D.jsx)(be,{flexDirection:"column",children:e.data.map((s,i)=>{let c=As(s,r);return(0,D.jsxs)(bo.Fragment,{children:[(0,D.jsx)(be,{flexDirection:"row",children:c.map(p=>(0,D.jsx)(be,{width:p.column.width,children:(0,D.jsx)(nt,{children:p.value})},p.column.name))}),(0,D.jsx)(Wt,{width:n})]},`row-${i}`)})})]})}var bo,D,To=S(()=>{"use strict";l();bo=b(Ne(),1),D=b(R(),1)});import{existsSync as Ls}from"fs";import{resolve as Is}from"path";import{configFileName as xo,configSchema as Ns}from"@swirls/sdk/config";import{createJiti as Us}from"jiti";async function G(e){if(e)return e;let r=Is(process.cwd(),xo);if(!Ls(r))throw new Error(`No project specified and no ${xo} found. Use --project flag or run from a project directory.`);let s=await Us(import.meta.url).import(r,{default:!0});return Ns.parse(s).projectId}var Ce=S(()=>{"use strict";l()});var ko={};B(ko,{list:()=>$s});import{withResult as Ro}from"@byteslice/result";import{render as qt}from"ink";async function $s(e,r){let n=await Ro(()=>G(e.project),m=>new Error(m.message));n.failure&&(qt((0,st.jsx)(k,{message:n.failure.message})),process.exit(1));let s=await $(this),i=await Ro(()=>s.buckets.listFiles({projectId:n.data,path:r}),m=>new Error(`Failed to list files: ${m.message}`,{cause:m}));i.failure&&(qt((0,st.jsx)(k,{message:i.failure.message})),process.exit(1));let{files:c,folders:p}=i.data;if(p.length===0&&c.length===0){console.log("No files or folders found.");return}let E=[...p.map(m=>({type:"folder",name:m.name,size:"-"})),...c.map(m=>({type:"file",name:m.name,size:m.size?Fs(m.size):"-"}))];qt((0,st.jsx)(Co,{keys:["type","name","size"],data:E}))}function Fs(e){if(e===0)return"0 B";let r=1024,n=["B","KB","MB","GB","TB"],s=Math.floor(Math.log(e)/Math.log(r));return`${parseFloat((e/r**s).toFixed(2))} ${n[s]}`}var st,So=S(()=>{"use strict";l();W();z();To();Ce();st=b(R(),1)});var Po={};B(Po,{upload:()=>Ys});import{readFile as Ds}from"fs/promises";import{basename as Ms}from"path";import{withResult as it}from"@byteslice/result";import{render as Fe}from"ink";async function Ys(e,r,n){let s=await it(()=>G(e.project),L=>new Error(L.message));s.failure&&(Fe((0,Te.jsx)(k,{message:s.failure.message})),process.exit(1));let i=await it(()=>Ds(r),L=>new Error(`Failed to read file: ${L.message}`,{cause:L}));i.failure&&(Fe((0,Te.jsx)(k,{message:i.failure.message})),process.exit(1));let c=Ms(r),p=n?`${n}/${c}`:c,E=await $(this),m=await it(()=>E.buckets.createSignedUploadUrl({projectId:s.data,path:p}),L=>new Error(`Failed to get upload URL: ${L.message}`,{cause:L}));m.failure&&(Fe((0,Te.jsx)(k,{message:m.failure.message})),process.exit(1));let O=await it(async()=>{let L=await fetch(m.data.signedUrl,{method:"PUT",headers:{"Content-Type":"application/octet-stream","x-upsert":"true"},body:i.data});if(!L.ok)throw new Error(`Upload failed: ${L.statusText}`);return L},L=>new Error(`Failed to upload file: ${L.message}`,{cause:L}));O.failure&&(Fe((0,Te.jsx)(k,{message:O.failure.message})),process.exit(1)),Fe((0,Te.jsx)(F,{message:`Uploaded ${c} to ${p}`}))}var Te,jo=S(()=>{"use strict";l();W();z();q();Ce();Te=b(R(),1)});var Ao={};B(Ao,{download:()=>Hs});import{writeFile as zs}from"fs/promises";import{withResult as at}from"@byteslice/result";import{render as De}from"ink";async function Hs(e,r,n){let s=await at(()=>G(e.project),m=>new Error(m.message));s.failure&&(De((0,xe.jsx)(k,{message:s.failure.message})),process.exit(1));let i=await $(this),c=await at(()=>i.buckets.createSignedUrl({projectId:s.data,path:r}),m=>new Error(`Failed to get download URL: ${m.message}`,{cause:m}));c.failure&&(De((0,xe.jsx)(k,{message:c.failure.message})),process.exit(1));let p=await at(async()=>{let m=await fetch(c.data.signedUrl);if(!m.ok)throw new Error(`Download failed: ${m.statusText}`);return m.arrayBuffer()},m=>new Error(`Failed to download file: ${m.message}`,{cause:m}));p.failure&&(De((0,xe.jsx)(k,{message:p.failure.message})),process.exit(1));let E=await at(()=>zs(n,Buffer.from(p.data)),m=>new Error(`Failed to write file: ${m.message}`,{cause:m}));E.failure&&(De((0,xe.jsx)(k,{message:E.failure.message})),process.exit(1)),De((0,xe.jsx)(F,{message:`Downloaded ${r} to ${n}`}))}var xe,Oo=S(()=>{"use strict";l();W();z();q();Ce();xe=b(R(),1)});var Io={};B(Io,{deleteFile:()=>Bs});import{withResult as Lo}from"@byteslice/result";import{render as Gt}from"ink";async function Bs(e,r){let n=await Lo(()=>G(e.project),c=>new Error(c.message));n.failure&&(Gt((0,ct.jsx)(k,{message:n.failure.message})),process.exit(1));let s=await $(this),i=await Lo(()=>s.buckets.deleteFile({projectId:n.data,path:r}),c=>new Error(`Failed to delete file: ${c.message}`,{cause:c}));i.failure&&(Gt((0,ct.jsx)(k,{message:i.failure.message})),process.exit(1)),Gt((0,ct.jsx)(F,{message:`Deleted ${r}`}))}var ct,No=S(()=>{"use strict";l();W();z();q();Ce();ct=b(R(),1)});var $o={};B($o,{url:()=>Ws});import{withResult as Uo}from"@byteslice/result";import{render as Vt}from"ink";async function Ws(e,r){let n=await Uo(()=>G(e.project),c=>new Error(c.message));n.failure&&(Vt((0,ut.jsx)(k,{message:n.failure.message})),process.exit(1));let s=await $(this),i=await Uo(()=>s.buckets.createSignedUrl({projectId:n.data,path:r,expiresIn:e.expires}),c=>new Error(`Failed to create signed URL: ${c.message}`,{cause:c}));i.failure&&(Vt((0,ut.jsx)(k,{message:i.failure.message})),process.exit(1)),console.log(i.data.signedUrl),Vt((0,ut.jsx)(F,{message:`URL expires at ${i.data.expiresAt}`}))}var ut,Fo=S(()=>{"use strict";l();W();z();q();Ce();ut=b(R(),1)});l();import{run as ai}from"@stricli/core";l();import{buildInstallCommand as Zs,buildUninstallCommand as Js}from"@stricli/auto-complete";import{buildApplication as ei,buildRouteMap as ti}from"@stricli/core";l();import{buildCommand as Hr,buildRouteMap as Bn}from"@stricli/core";var Wn=Hr({loader:async()=>{let{login:e}=await Promise.resolve().then(()=>(It(),Lt));return e},parameters:{positional:{kind:"tuple",parameters:[]}},docs:{brief:"Log in with an existing account"}}),qn=Hr({loader:async()=>{let{logout:e}=await Promise.resolve().then(()=>(It(),Lt));return e},parameters:{positional:{kind:"tuple",parameters:[]}},docs:{brief:"Log out of an existing account"}}),Br=Bn({routes:{login:Wn,logout:qn},docs:{brief:"Auth commands"}});l();import{buildCommand as co,buildRouteMap as ps}from"@stricli/core";var ms=co({loader:async()=>{let{generateCode:e}=await Promise.resolve().then(()=>(to(),eo));return e},parameters:{positional:{kind:"tuple",parameters:[]}},docs:{brief:"Generate application code and types"}}),ds=co({loader:async()=>{let{initializeConfig:e}=await Promise.resolve().then(()=>(ao(),io));return e},parameters:{positional:{kind:"tuple",parameters:[]}},docs:{brief:"Initialize Swirls configuration file"}}),uo=ps({routes:{gen:ms,init:ds},docs:{brief:"Developer commands"}});l();import{buildCommand as _o,buildRouteMap as ks}from"@stricli/core";var Ss=_o({loader:async()=>{let{createProject:e}=await Promise.resolve().then(()=>(ho(),go));return e},parameters:{positional:{kind:"tuple",parameters:[{brief:"Project name",parse:String,placeholder:"name"}]}},docs:{brief:"Create a new project"}}),Ps=_o({loader:async()=>{let{openProject:e}=await Promise.resolve().then(()=>(vo(),yo));return e},parameters:{positional:{kind:"tuple",parameters:[{brief:"Project ID",parse:String,placeholder:"project-id"}]}},docs:{brief:"Open project in browser"}}),Eo=ks({routes:{create:Ss,open:Ps},docs:{brief:"Project commands"}});l();import{buildCommand as Me,buildRouteMap as qs}from"@stricli/core";var Gs=Me({loader:async()=>{let{list:e}=await Promise.resolve().then(()=>(So(),ko));return e},parameters:{positional:{kind:"tuple",parameters:[{brief:"Path to list (optional)",parse:String,placeholder:"path",optional:!0}]},flags:{project:{kind:"parsed",brief:"Project ID (uses config if not specified)",parse:String,optional:!0}}},docs:{brief:"List files in storage"}}),Vs=Me({loader:async()=>{let{upload:e}=await Promise.resolve().then(()=>(jo(),Po));return e},parameters:{positional:{kind:"tuple",parameters:[{brief:"Local file path to upload",parse:String,placeholder:"file"},{brief:"Destination path in storage (optional)",parse:String,placeholder:"dest",optional:!0}]},flags:{project:{kind:"parsed",brief:"Project ID (uses config if not specified)",parse:String,optional:!0}}},docs:{brief:"Upload a file to storage"}}),Ks=Me({loader:async()=>{let{download:e}=await Promise.resolve().then(()=>(Oo(),Ao));return e},parameters:{positional:{kind:"tuple",parameters:[{brief:"Path to file in storage",parse:String,placeholder:"path"},{brief:"Local destination path",parse:String,placeholder:"dest"}]},flags:{project:{kind:"parsed",brief:"Project ID (uses config if not specified)",parse:String,optional:!0}}},docs:{brief:"Download a file from storage"}}),Qs=Me({loader:async()=>{let{deleteFile:e}=await Promise.resolve().then(()=>(No(),Io));return e},parameters:{positional:{kind:"tuple",parameters:[{brief:"Path to file in storage",parse:String,placeholder:"path"}]},flags:{project:{kind:"parsed",brief:"Project ID (uses config if not specified)",parse:String,optional:!0}}},docs:{brief:"Delete a file from storage"}}),Xs=Me({loader:async()=>{let{url:e}=await Promise.resolve().then(()=>(Fo(),$o));return e},parameters:{positional:{kind:"tuple",parameters:[{brief:"Path to file in storage",parse:String,placeholder:"path"}]},flags:{project:{kind:"parsed",brief:"Project ID (uses config if not specified)",parse:String,optional:!0},expires:{kind:"parsed",brief:"Expiration time in seconds (default: 86400 = 24 hours)",parse:Number,optional:!0}}},docs:{brief:"Get a signed URL for a file"}}),Do=qs({routes:{list:Gs,upload:Vs,download:Ks,delete:Qs,url:Xs},docs:{brief:"Storage commands"}});var Mo="@swirls/cli",Yo="0.0.21",zo="Swirls command line application";var ri=ti({routes:{auth:Br,dev:uo,project:Eo,storage:Do,install:Zs("cli",{bash:"__cli_bash_complete"}),uninstall:Js("cli",{bash:!0})},docs:{brief:zo,hideRoute:{install:!0,uninstall:!0}}}),Ho=ei(ri,{name:Mo,versionInfo:{currentVersion:Yo}});l();import oi from"fs";import ni from"fs/promises";import si from"os";import ii from"path";function Bo(e){return{fs:oi,fsPromise:ni,os:si,path:ii,process:e}}await ai(Ho,process.argv.slice(2),Bo(process));
59
+ /*! Bundled license information:
60
+
61
+ react/cjs/react-jsx-runtime.production.js:
62
+ (**
63
+ * @license React
64
+ * react-jsx-runtime.production.js
65
+ *
66
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
67
+ *
68
+ * This source code is licensed under the MIT license found in the
69
+ * LICENSE file in the root directory of this source tree.
70
+ *)
71
+
72
+ react/cjs/react.production.js:
73
+ (**
74
+ * @license React
75
+ * react.production.js
76
+ *
77
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
78
+ *
79
+ * This source code is licensed under the MIT license found in the
80
+ * LICENSE file in the root directory of this source tree.
81
+ *)
82
+
83
+ react/cjs/react.development.js:
84
+ (**
85
+ * @license React
86
+ * react.development.js
87
+ *
88
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
89
+ *
90
+ * This source code is licensed under the MIT license found in the
91
+ * LICENSE file in the root directory of this source tree.
92
+ *)
93
+
94
+ react/cjs/react-jsx-runtime.development.js:
95
+ (**
96
+ * @license React
97
+ * react-jsx-runtime.development.js
98
+ *
99
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
100
+ *
101
+ * This source code is licensed under the MIT license found in the
102
+ * LICENSE file in the root directory of this source tree.
103
+ *)
104
+ */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@swirls/cli",
3
- "version": "0.0.20",
3
+ "version": "0.0.21",
4
4
  "description": "Swirls command line application",
5
5
  "author": {
6
6
  "name": "Swirls",
@@ -49,9 +49,6 @@
49
49
  "tsup": "8.5.1",
50
50
  "typescript": "5.9.3"
51
51
  },
52
- "peerDependencies": {
53
- "react": ">=18.0.0"
54
- },
55
52
  "engines": {
56
53
  "node": ">=22"
57
54
  },