import{C as e,D as t,Dt as n,F as r,H as i,I as a,M as o,N as s,Ot as c,Q as l,S as u,St as d,Z as f,_ as p,a as m,c as h,ct as g,et as _,g as v,j as y,k as b,kt as x,nt as S,o as C,ot as w,p as T,s as E,tt as D,ut as O,v as k,xt as A}from"./ZLGReh43.js";import{a as j,p as M}from"./BDBSsbMb.js";import{K as N,M as P,U as F,ct as I,dt as L,it as R,lt as z,nt as B,ot as V,pt as H,s as U,st as W,ut as G}from"./BApLQfqY.js";import"./xihTtKlq.js";import"./orCHVlgT.js";var K=F({component:`progress`,parts:[`root`]}),q=class e{static create(t){return new e(t)}opts;attachment;constructor(e){this.opts=e,this.attachment=N(this.opts.ref)}#e=O(()=>({role:`progressbar`,value:this.opts.value.current,"aria-valuemin":this.opts.min.current,"aria-valuemax":this.opts.max.current,"aria-valuenow":this.opts.value.current===null?void 0:this.opts.value.current,"data-value":this.opts.value.current===null?void 0:this.opts.value.current,"data-state":J(this.opts.value.current,this.opts.max.current),"data-max":this.opts.max.current,"data-min":this.opts.min.current,"data-indeterminate":this.opts.value.current===null?``:void 0,[K.root]:``,...this.attachment}));get props(){return i(this.#e)}set props(e){w(this.#e,e)}};function J(e,t){return e===null?`indeterminate`:e===t?`loaded`:`loading`}var Y=new Set([`$$slots`,`$$events`,`$$legacy`,`child`,`children`,`value`,`max`,`min`,`id`,`ref`]),X=s(`<div><!></div>`);function Z(n,a){let s=r();d(a,!0);let l=m(a,`value`,3,0),u=m(a,`max`,3,100),f=m(a,`min`,3,0),p=m(a,`id`,19,()=>P(s)),h=m(a,`ref`,15,null),g=C(a,Y),v=q.create({value:R(()=>l()),max:R(()=>u()),min:R(()=>f()),id:R(()=>p()),ref:R(()=>h(),e=>h(e))}),b=O(()=>B(g,v.props));var S=o(),w=D(S),E=t=>{var n=o();e(D(n),()=>a.child,()=>({props:i(b)})),y(t,n)},k=t=>{var n=X();T(n,()=>({...i(b)})),e(_(n),()=>a.children??x),c(n),y(t,n)};t(w,e=>{a.child?e(E):e(k,-1)}),y(n,S),A()}var Q=s(`<!> <!> <!>`,1),$=s(`<!> <!>`,1);function ee(e,t){d(t,!1),h(),V(e,{class:`flex flex-col items-center p-6 animate-spin scale-150`,children:(e,t)=>{var r=$(),i=D(r);I(i,{class:`flex flex-col items-center text-center`,children:(e,t)=>{var r=Q(),i=D(r);U(i,{});var o=S(i,2);W(o,{children:(e,t)=>{n(),y(e,a(`Project loading...`))},$$slots:{default:!0}}),z(S(o,2),{children:(e,t)=>{n(),y(e,a(`Retrieving save`))},$$slots:{default:!0}}),y(e,r)},$$slots:{default:!0}}),G(S(i,2),{class:`mt-4`,children:(e,t)=>{L(e,{variant:`outline`,size:`sm`,onclick:()=>{j(M(`/`))},children:(e,t)=>{n(),y(e,a(`Cancel`))},$$slots:{default:!0}})},$$slots:{default:!0}}),y(e,r)},$$slots:{default:!0}}),A()}var te=s(`<div class="w-screen h-screen flex items-center justify-center"><!></div>`);function ne(e){var t=te();ee(_(t),{}),c(t),y(e,t)}var re=new Set([`$$slots`,`$$events`,`$$legacy`,`ref`,`class`,`max`,`value`]),ie=s(`<div data-slot="progress-indicator" class="bg-primary size-full flex-1 transition-all"></div>`);function ae(e,t){d(t,!0);let n=m(t,`ref`,15,null),r=m(t,`max`,3,100),a=C(t,re);var s=o(),c=D(s);{let e=O(()=>H(`bg-muted h-1 rounded-full relative flex w-full items-center overflow-x-hidden`,t.class));u(c,()=>Z,(o,s)=>{s(o,E({"data-slot":`progress`,get class(){return i(e)},get value(){return t.value},get max(){return r()}},()=>a,{get ref(){return n()},set ref(e){n(e)},children:(e,n)=>{var i=ie();f(()=>v(i,`transform: translateX(-${100-100*(t.value??0)/(r()??1)}%)`)),y(e,i)},$$slots:{default:!0}}))})}y(e,s),A()}var oe=s(`<div aria-hidden="true"><div class="bg-black outline outline-neutral-900 rounded-xl p-6 w-full max-w-sm shadow-2xl flex flex-col"><span id="project-title" class="text-2xl font-bold mb-8 text-center"> </span> <!></div></div>`);function se(e,t){d(t,!0);let n=g(0),r=g(0);l(()=>{w(r,0),w(n,t.promises.length,!0),t.promises.forEach(e=>{e.finally(()=>{w(r,i(r)+1),i(r)===i(n)&&i(n)>0&&t.callback?.()})})});var a=oe(),o=_(a),s=_(o),u=_(s,!0);c(s);var m=S(s,2);{let e=O(()=>i(r)/i(n)*100);ae(m,{get value(){return i(e)}})}c(o),c(a),f(()=>{p(a,1,k(t.show?`fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50 p-4`:`hidden`)),b(u,t.title)}),y(e,a),A()}export{ne as n,se as t};