@fungi.computer/prints 0.9.3 → 0.9.4
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.
- package/dist/assets/{data-list-C-84r4-E.js → data-list-fpaa4N9N.js} +1 -1
- package/dist/assets/{index-DVcnPTd7.js → index-DVqrh5Bt.js} +4 -4
- package/dist/assets/index-DWh6A3MQ.css +2 -0
- package/dist/assets/{log-event-Bq77BTZs.js → log-event-cXG7sOut.js} +1 -1
- package/dist/assets/{media-CV91GU1z.js → media-B_-NjrDp.js} +1 -1
- package/dist/assets/{print-download-button-kcfgBeuV.js → print-download-button-ftFxCzK4.js} +1 -1
- package/dist/assets/{print-info-drawer-DQEdoQYi.js → print-info-drawer-C9NGQ3N-.js} +2 -2
- package/dist/index.html +5 -5
- package/package.json +7 -7
- package/dist/assets/index-yeP2n2EN.css +0 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{At as t,Bt as n,Ct as r,Dt as i,Et as a,Gr as o,It as s,Jt as c,Kt as l,Ln as u,Lt as d,Mt as f,Nt as p,Pt as m,Qt as h,Rn as ee,Rt as g,St as _,Tr as v,Tt as y,Ut as b,Vt as te,Wt as x,Yt as S,Zt as C,_n as ne,_t as re,ar as ie,at as ae,bn as oe,bt as se,c as ce,cn as w,ct as le,dt as T,f as ue,ft as de,g as fe,gn as E,gt as pe,ht as me,in as D,jr as he,jt as ge,kt as O,lt as _e,m as ve,mt as ye,n as be,nn as k,o as xe,ot as Se,p as Ce,pt as we,sn as Te,st as Ee,t as De,tn as Oe,u as A,ut as ke,vn as Ae,vt as je,wt as Me,xn as Ne,xt as Pe,yn as Fe,yt as Ie,zn as Le,zt as Re}from"./media-CV91GU1z.js";import{a as ze,i as Be,n as Ve,o as He,r as Ue}from"./modules-C4mfDnjH.js";function We(e){return{onFetch:(t,n)=>{let r=t.options,i=t.fetchOptions?.meta?.fetchMore?.direction,a=t.state.data?.pages||[],o=t.state.data?.pageParams||[],s={pages:[],pageParams:[]},c=0,l=async()=>{let n=!1,l=e=>{me(e,()=>t.signal,()=>n=!0)},u=je(t.options,t.fetchOptions),d=async(e,r,i)=>{if(n)return Promise.reject(t.signal.reason);if(r==null&&e.pages.length)return Promise.resolve(e);let a=(()=>{let e={client:t.client,queryKey:t.queryKey,pageParam:r,direction:i?`backward`:`forward`,meta:t.options.meta};return l(e),e})(),o=await u(a),{maxPages:s}=t.options,c=i?re:pe;return{pages:c(e.pages,o,s),pageParams:c(e.pageParams,r,s)}};if(i&&a.length){let e=i===`backward`,t=e?Ge:j,n={pages:a,pageParams:o};s=await d(n,t(r,n),e)}else{let t=e??a.length;do{let e=c===0?o[0]??r.initialPageParam:j(r,s);if(c>0&&e==null)break;s=await d(s,e),c++}while(c<t)}return s};t.fetchFn=t.options.persister?()=>t.options.persister?.(l,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):l}}}function j(e,{pages:t,pageParams:n}){let r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function Ge(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}function Ke(e,t){return t?j(e,t)!=null:!1}function qe(e,t){return!t||!e.getPreviousPageParam?!1:Ge(e,t)!=null}var Je=class extends Se{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e){super(),this.#s=!1,this.#o=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#i=e.client,this.#r=this.#i.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#t=Ze(this.options),this.state=e.state??this.#t,this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return this.#e}get promise(){return this.#a?.promise}setOptions(e){if(this.options={...this.#o,...e},e?._type&&(this.#e=e._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){let e=Ze(this.options);e.data!==void 0&&(this.setState(Xe(e.data,e.dataUpdatedAt)),this.#t=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus===`idle`&&this.#r.remove(this)}setData(e,t){let n=i(this.state.data,e,this.options);return this.#c({data:n,type:`success`,dataUpdatedAt:t?.updatedAt,manual:t?.manual}),n}setState(e){this.#c({type:`setState`,state:e})}cancel(e){let t=this.#a?.promise;return this.#a?.cancel(e),t?t.then(y).catch(y):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return this.#t}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(e=>O(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===f||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0&&this.observers.some(e=>O(e.options.staleTime,this)===`static`)}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e===`static`?!1:this.state.isInvalidated?!0:!p(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(e=>e.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#a?.continue()}onOnline(){this.observers.find(e=>e.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#a?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#r.notify({type:`observerAdded`,query:this,observer:e}))}removeObserver(e){let t=this.observers.indexOf(e);t!==-1&&(this.observers.splice(t,1),this.observers.length||(this.#a&&(this.#s||this.state.fetchStatus===`paused`&&this.state.status===`pending`?this.#a.cancel({revert:!0}):this.#a.cancelRetry()),this.scheduleGc()),this.#r.notify({type:`observerRemoved`,query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||this.#c({type:`invalidate`})}async fetch(e,t){if(this.state.fetchStatus!==`idle`&&this.#a?.status()!==`rejected`){if(this.state.data!==void 0&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#a)return this.#a.continueRetry(),this.#a.promise}if(e&&this.setOptions(e),!this.options.queryFn){let e=this.observers.find(e=>e.options.queryFn);e&&this.setOptions(e.options)}let n=new AbortController,r=e=>{Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(this.#s=!0,n.signal)})},i=()=>{let e=je(this.options,t),n=(()=>{let e={client:this.#i,queryKey:this.queryKey,meta:this.meta};return r(e),e})();return this.#s=!1,this.options.persister?this.options.persister(e,n,this):e(n)},a=(()=>{let e={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#i,state:this.state,fetchFn:i};return r(e),e})();(this.#e===`infinite`?We(this.options.pages):this.options.behavior)?.onFetch(a,this),this.#n=this.state,(this.state.fetchStatus===`idle`||this.state.fetchMeta!==a.fetchOptions?.meta)&&this.#c({type:`fetch`,meta:a.fetchOptions?.meta});let o=this.#a=_e({initialPromise:t?.initialPromise,fn:a.fetchFn,onCancel:e=>{e instanceof Ee&&e.revert&&this.setState({...this.#n,fetchStatus:`idle`}),n.abort()},onFail:(e,t)=>{this.#c({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#c({type:`pause`})},onContinue:()=>{this.#c({type:`continue`})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0});try{let e=await o.start();if(e===void 0)throw Error(`${this.queryHash} data is undefined`);return this.setData(e),this.#r.config.onSuccess?.(e,this),this.#r.config.onSettled?.(e,this.state.error,this),e}catch(e){if(e instanceof Ee){if(e.silent)return this.#a.promise;if(e.revert){if(this.state.data===void 0)throw e;return this.state.data}}throw this.#c({type:`error`,error:e}),this.#r.config.onError?.(e,this),this.#r.config.onSettled?.(this.state.data,e,this),e}finally{this.#a===o&&(this.#a=void 0),this.scheduleGc()}}#c(e){let t=t=>{switch(e.type){case`failed`:return{...t,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case`pause`:return{...t,fetchStatus:`paused`};case`continue`:return{...t,fetchStatus:`fetching`};case`fetch`:return{...t,...Ye(t.data,this.options),fetchMeta:e.meta??null};case`success`:let n={...t,...Xe(e.data,e.dataUpdatedAt),dataUpdateCount:t.dataUpdateCount+1,...!e.manual&&{fetchStatus:`idle`,fetchFailureCount:0,fetchFailureReason:null}};return this.#n=e.manual?n:void 0,n;case`error`:let r=e.error;return{...t,error:r,errorUpdateCount:t.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:t.fetchFailureCount+1,fetchFailureReason:r,fetchStatus:`idle`,status:`error`,isInvalidated:!0};case`invalidate`:return{...t,isInvalidated:!0};case`setState`:return{...t,...e.state}}};this.state=t(this.state),T.batch(()=>{this.observers.slice().forEach(e=>{e.onQueryUpdate()}),this.#r.notify({query:this,type:`updated`,action:e})})}};function Ye(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:le(t.networkMode)?`fetching`:`paused`,...e===void 0&&{error:null,status:`pending`}}}function Xe(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:`success`}}function Ze(e){let t=typeof e.initialData==`function`?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt==`function`?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?`success`:`pending`,fetchStatus:`idle`}}var Qe=class extends we{#e;#t=void 0;#n=void 0;#r=void 0;#i;#a;#o;#s;#c;#l;#u;#d;#f;#p=new Set;constructor(e,t){super(),this.options=t,this.#e=e,this.#o=null,this.bindMethods(),this.setOptions(t)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),et(this.#t,this.options)?this.#m():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return tt(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return tt(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#b(),this.#x(),this.#t.removeObserver(this)}setOptions(e){let n=this.options,r=this.#t;if(this.options=this.#e.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!=`boolean`&&typeof this.options.enabled!=`function`&&typeof O(this.options.enabled,this.#t)!=`boolean`)throw Error(`Expected enabled to be a boolean or a callback that returns a boolean`);this.#S(),this.#t.setOptions(this.options),n._defaulted&&!t(this.options,n)&&this.#e.getQueryCache().notify({type:`observerOptionsUpdated`,query:this.#t,observer:this});let i=this.hasListeners();i&&nt(this.#t,r,this.options,n)&&this.#m(),this.updateResult(),i&&(this.#t!==r||O(this.options.enabled,this.#t)!==O(n.enabled,this.#t)||O(this.options.staleTime,this.#t)!==O(n.staleTime,this.#t))&&this.#g();let a=this.#_();i&&(this.#t!==r||O(this.options.enabled,this.#t)!==O(n.enabled,this.#t)||a!==this.#f)&&this.#v(a)}getOptimisticResult(e){let n=this.#e.getQueryCache().build(this.#e,e),r=this.createResult(n,e);return t(this.getCurrentResult(),r)||(this.#r=r,this.#a=this.options,this.#i=this.#t.state),r}getCurrentResult(){return this.#r}trackResult(e,t){return new Proxy(e,{get:(e,n)=>(this.trackProp(n),t?.(n),Reflect.get(e,n))})}trackProp(e){this.#p.add(e)}getCurrentQuery(){return this.#t}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){let t=this.#e.defaultQueryOptions(e),n=this.#e.getQueryCache().build(this.#e,t),r=()=>{},i,a=new Promise(e=>{i=e,r=this.#e.getQueryCache().subscribe(i=>{i.type===`updated`&&i.query.queryHash===n.queryHash&&n.state.data!==void 0&&(r(),e(this.createResult(n,t)))})});return Promise.race([n.fetch().then(()=>{let e=this.createResult(n,t);return i?.(e),e}).finally(()=>{r()}),a])}fetch(e){return this.#m({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#r))}#m(e){this.#S();let t=this.#t.fetch(this.options,e);return e?.throwOnError||(t=t.catch(y)),t}#h(e){return!ye()&&O(this.options.enabled,this.#t)!==!1&&_(e)}#g(){this.#b();let e=O(this.options.staleTime,this.#t);if(this.#r.isStale||!this.#h(e))return;let t=p(this.#r.dataUpdatedAt,e)+1;this.#u=m.setTimeout(()=>{this.#r.isStale||this.updateResult()},t)}#_(){return(typeof this.options.refetchInterval==`function`?this.options.refetchInterval(this.#t):this.options.refetchInterval)??!1}#v(e){this.#x(),this.#f=e,!(this.#f===0||!this.#h(this.#f))&&(this.#d=m.setInterval(()=>{(this.options.refetchIntervalInBackground||de.isFocused())&&this.#m()},this.#f))}#y(){this.#g(),this.#v(this.#_())}#b(){this.#u!==void 0&&(m.clearTimeout(this.#u),this.#u=void 0)}#x(){this.#d!==void 0&&(m.clearInterval(this.#d),this.#d=void 0)}createResult(e,t){let n=this.#t,r=this.options,a=this.#r,o=this.#i,s=this.#a,c=e===n?this.#n:e.state,{state:l}=e,u={...l},d=!1,f;if(t._optimisticResults){let i=this.hasListeners(),a=!i&&et(e,t),o=i&&nt(e,n,t,r);(a||o)&&(u={...u,...Ye(l.data,e.options)}),t._optimisticResults===`isRestoring`&&(u.fetchStatus=`idle`)}let{error:p,errorUpdatedAt:m,status:h}=u;f=u.data;let ee=!1;if(t.placeholderData!==void 0&&f===void 0&&h===`pending`){let e;a?.isPlaceholderData&&t.placeholderData===s?.placeholderData?(e=a.data,ee=!0):e=typeof t.placeholderData==`function`?t.placeholderData(this.#l?.state.data,this.#l):t.placeholderData,e!==void 0&&(h=`success`,f=i(a?.data,e,t),d=!0)}if(t.select&&f!==void 0&&!ee){if(a&&f===o?.data&&t.select===this.#s)f=this.#c;else try{this.#s=t.select,f=t.select(f),f=i(a?.data,f,t),this.#c=f,this.#o=null}catch(e){this.#o=e}}else f===void 0&&(this.#o=null);this.#o&&(p=this.#o,f=this.#c,m=Date.now(),h=`error`,d=!1);let g=u.fetchStatus===`fetching`,_=h===`pending`,v=h===`error`,y=_&&g,b=f!==void 0;return{status:h,fetchStatus:u.fetchStatus,isPending:_,isSuccess:h===`success`,isError:v,isInitialLoading:y,isLoading:y,data:f,dataUpdatedAt:u.dataUpdatedAt,error:p,errorUpdatedAt:m,failureCount:u.fetchFailureCount,failureReason:u.fetchFailureReason,errorUpdateCount:u.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:u.dataUpdateCount>c.dataUpdateCount||u.errorUpdateCount>c.errorUpdateCount,isFetching:g,isRefetching:g&&!_,isLoadingError:v&&!b,isPaused:u.fetchStatus===`paused`,isPlaceholderData:d,isRefetchError:v&&b,isStale:rt(e,t),refetch:this.refetch,isEnabled:O(t.enabled,e)!==!1}}updateResult(){let e=this.#r,n=this.createResult(this.#t,this.options);if(this.#i=this.#t.state,this.#a=this.options,this.#i.data!==void 0&&(this.#l=this.#t),t(n,e))return;this.#r=n;let r=(()=>{if(!e)return!0;let{notifyOnChangeProps:t}=this.options,n=typeof t==`function`?t():t;if(n===`all`||!n&&!this.#p.size)return!0;let r=new Set(n??this.#p);return this.options.throwOnError&&r.add(`error`),Object.keys(this.#r).some(t=>{let n=t;return this.#r[n]!==e[n]&&r.has(n)})})();T.batch(()=>{r&&this.listeners.forEach(e=>{e(this.#r)}),this.#e.getQueryCache().notify({query:this.#t,type:`observerResultsUpdated`})})}#S(){let e=this.#e.getQueryCache().build(this.#e,this.options);if(e===this.#t)return;let t=this.#t;this.#t=e,this.#n=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#y()}};function $e(e,t){return O(t.enabled,e)!==!1&&e.state.data===void 0&&(e.state.status!==`error`||O(t.retryOnMount,e)!==!1)}function et(e,t){return $e(e,t)||e.state.data!==void 0&&tt(e,t,t.refetchOnMount)}function tt(e,t,n){if(O(t.enabled,e)!==!1&&O(t.staleTime,e)!==`static`){let r=typeof n==`function`?n(e):n;return r===`always`||r!==!1&&rt(e,t)}return!1}function nt(e,t,n,r){return(e!==t||O(r.enabled,e)===!1)&&(!n.suspense||e.state.status!==`error`)&&rt(e,n)}function rt(e,t){return O(t.enabled,e)!==!1&&e.isStaleByTime(O(t.staleTime,e))}var it=class extends we{#e;#t;#n;constructor(e={}){super(),this.config=e,this.#e=new Set,this.#t=new Map,this.#n=0}build(e,t,n){let r=new ae({client:e,mutationCache:this,mutationId:++this.#n,options:e.defaultMutationOptions(t),state:n});return this.add(r),r}add(e){this.#e.add(e);let t=M(e);if(typeof t==`string`){let n=this.#t.get(t);n?n.push(e):this.#t.set(t,[e])}this.notify({type:`added`,mutation:e})}remove(e){if(this.#e.delete(e)){let t=M(e);if(typeof t==`string`){let n=this.#t.get(t);if(n){if(n.length>1){let t=n.indexOf(e);t!==-1&&n.splice(t,1)}else n[0]===e&&this.#t.delete(t)}}}this.notify({type:`removed`,mutation:e})}canRun(e){let t=M(e);if(typeof t==`string`){let n=this.#t.get(t)?.find(e=>e.state.status===`pending`);return!n||n===e}return!0}runNext(e){let t=M(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){T.batch(()=>{this.#e.forEach(e=>{this.notify({type:`removed`,mutation:e})}),this.#e.clear(),this.#t.clear()})}getAll(){return Array.from(this.#e)}find(e){let t={exact:!0,...e};return this.getAll().find(e=>r(t,e))}findAll(e={}){return this.getAll().filter(t=>r(e,t))}notify(e){T.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return T.batch(()=>Promise.all(e.map(e=>e.continue().catch(y))))}};function M(e){return e.options.scope?.id}var at=class extends we{#e;constructor(e={}){super(),this.config=e,this.#e=new Map}build(e,t,n){let r=t.queryKey,i=t.queryHash??Pe(r,t),a=this.get(i);return a||(a=new Je({client:e,queryKey:r,queryHash:i,options:e.defaultQueryOptions(t),state:n,defaultOptions:e.getQueryDefaults(r)}),this.add(a)),a}add(e){this.#e.has(e.queryHash)||(this.#e.set(e.queryHash,e),this.notify({type:`added`,query:e}))}remove(e){let t=this.#e.get(e.queryHash);t&&(e.destroy(),t===e&&this.#e.delete(e.queryHash),this.notify({type:`removed`,query:e}))}clear(){T.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#e.get(e)}getAll(){return[...this.#e.values()]}find(e){let t={exact:!0,...e};return this.getAll().find(e=>Me(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>Me(e,t)):t}notify(e){T.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){T.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){T.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},ot=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new at,this.#t=e.mutationCache||new it,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=de.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=ke.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#a--,this.#a===0&&(this.#o?.(),this.#o=void 0,this.#s?.(),this.#s=void 0)}isFetching(e){return this.#e.findAll({...e,fetchStatus:`fetching`}).length}isMutating(e){return this.#t.findAll({...e,status:`pending`}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),n=this.#e.build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(O(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return this.#e.findAll(e).map(({queryKey:e,state:t})=>[e,t.data])}setQueryData(e,t,n){let r=this.defaultQueryOptions({queryKey:e}),i=this.#e.get(r.queryHash)?.state.data,a=Ie(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return T.batch(()=>this.#e.findAll(e).map(({queryKey:e})=>[e,this.setQueryData(e,t,n)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state}removeQueries(e){let t=this.#e;T.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return T.batch(()=>{let r=n.findAll(e),i=new Set(r);return r.forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,predicate:e=>i.has(e)},t)})}cancelQueries(e,t={}){let n={revert:!0,...t},r=T.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(y).catch(y)}invalidateQueries(e,t={}){return T.batch(()=>(this.#e.findAll(e).forEach(e=>{e.invalidate()}),e?.refetchType===`none`?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??`active`},t)))}refetchQueries(e,t={}){let n={...t,cancelRefetch:t.cancelRefetch??!0},r=T.batch(()=>this.#e.findAll(e).filter(e=>!e.isDisabled()&&!e.isStatic()).map(e=>{let t=e.fetch(void 0,n);return n.throwOnError||(t=t.catch(y)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(y)}async query(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t),r=n.isStaleByTime(O(t.staleTime,n))?await n.fetch(t):n.state.data,i=t.select;return i?i(r):r}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime(O(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(y).catch(y)}infiniteQuery(e){return e._type=`infinite`,this.query(e)}fetchInfiniteQuery(e){return e._type=`infinite`,this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(y).catch(y)}ensureInfiniteQueryData(e){return e._type=`infinite`,this.ensureQueryData(e)}resumePausedMutations(){return ke.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#n}setDefaultOptions(e){this.#n=e}setQueryDefaults(e,t){this.#r.set(se(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{a(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(se(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{a(e,t.mutationKey)&&Object.assign(n,t.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;let t={...this.#n.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||=Pe(t.queryKey,t),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!==`always`),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode=`offlineFirst`),t.queryFn===f&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#n.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}},N=e(o(),1),st=N.createContext(!1),ct=()=>N.useContext(st);st.Provider;var P=d();function lt(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var ut=N.createContext(lt()),dt=()=>N.useContext(ut),ft=(e,t,n)=>{let r=n?.state.error&&typeof e.throwOnError==`function`?ge(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||r)&&(t.isReset()||(e.retryOnMount=!1))},pt=e=>{N.useEffect(()=>{e.clearReset()},[e])},mt=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||ge(n,[e.error,r])),ht=e=>{if(e.suspense){let t=1e3,n=e=>e===`static`?e:Math.max(e??t,t),r=e.staleTime;e.staleTime=typeof r==`function`?(...e)=>n(r(...e)):n(r),typeof e.gcTime==`number`&&(e.gcTime=Math.max(e.gcTime,t))}},gt=(e,t)=>e?.suspense&&t.isPending,_t=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function vt(e,t,n){let r=ct(),i=dt(),a=s(n),o=a.defaultQueryOptions(e),c=a.getQueryCache().get(o.queryHash),l=e.subscribed!==!1;o._optimisticResults=r?`isRestoring`:l?`optimistic`:void 0,ht(o),ft(o,i,c),pt(i);let[u]=N.useState(()=>new t(a,o)),d=u.getOptimisticResult(o),f=!r&&l;if(N.useSyncExternalStore(N.useCallback(e=>{let t=f?u.subscribe(T.batchCalls(e)):y;return u.updateResult(),t},[u,f]),()=>u.getCurrentResult(),()=>u.getCurrentResult()),N.useEffect(()=>{u.setOptions(o)},[o,u]),gt(o,d))throw _t(o,u,i);if(mt({result:d,errorResetBoundary:i,throwOnError:o.throwOnError,query:c,suspense:o.suspense}))throw d.error;return o.notifyOnChangeProps?d:u.trackResult(d)}function yt(e,t){return vt(e,Qe,t)}function bt(e){return e}function xt(e){return e}var St=`gilled.velvety.spored.saprotrophic.mycorrhizal.luminescent.honeycomb.truffley.wispy.earthy.mossy.woody.waxy.gelatinous.coral.inkcapped.feathery.stiped.ringed.annulate.scaly.shaggy.fuzzy.spiky.conical.umbral.parasol.leathery.damp.dewy.bristly.powdery.yeasty.musty.ancient.patient.steady.faithful.hardy.rootbound.forested.shaded.sunlit.sporeladen.golden.honeyed.amber.ivory.crimson.violet.indigo.silver.mossgreen.midnight.creamy.buttery.porcelain.glossy.matte.ribbed.fluted.wavy.lobed.branched.curled.folded.hooded.crowned.blushing.weeping.laughing.dancing.singing.whistling.glowing.ghostly.fairy.elfin.rustic.homey.barnraised.pasture.orchard.mill.woven.gardened.herded.trailed.ridged.meadow.fielded.vined.rooted.tendered.seasoned.ripe.wild.tame.broody.stubborn.gentle.drowsy.watchful.wandering.migratory.burrowed.nested.perched.loamy.mulched.composted.fermented.brewed.cured.smoked.pickled.preserved.aged.vintage.heirloom.grandmothers.forgotten.remembered.beloved.cherished.worn.weathered.windblown.rainsoaked.frosted.snowed.bloomed.flowered.seeded.sprouted.grafted.pruned.harvested.threshed.milled.baked.proofed.risen.folded.twisted.braided.stitched.patched.mended.polished.burnished.glazed.gilded.verdigris.patinaed.microdosed.tripping.wavy.prismatic.shimmering.rippling.echoing.oracular.mystic.kaleidoscopic.auroral.nebular.azure.psychedelic.transcendent.visionary.wandering.dreaming.phantom.spectral.iridescent.liminal.tidal.celestial.cosmic.astral.ethereal.incandescent`.split(`.`),Ct=`shiitake.morel.chanterelle.bolete.puffball.oyster.enoki.maitake.lionsmane.truffle.porcini.agaric.amanita.bracket.conk.stipe.cap.gill.spore.hypha.mycelium.sporocarp.earthstar.stinkhorn.jelly.milkcap.blewit.cep.hedgehog.woodear.waxcap.inkcap.birdnest.cup.saddle.fieldcap.rust.smut.ergot.lichen.yeast.mold.toadstool.fruitingbody.basidiocarp.ascocarp.perithecium.apothecium.cystidium.basidium.clamp.septa.rhizomorph.sclerotium.gemma.annulus.volva.pileus.lamella.trama.gleba.peridium.sporangium.zygospora.conidia.teleomorph.anamorph.saprobe.endophyte.epiphyte.decomposer.recycler.alchemist.mycorrhiza.hyphae.web.net.lattice.thread.strand.root.tendril.runner.vine.ivy.moss.fern.liverwort.mule.cairn.almanac.parrot.birddog.watchdog.pigeon.ranch.barn.coop.pasture.meadow.field.orchard.gate.fence.silo.well.windmill.homestead.trail.ridge.creek.hill.grove.vineyard.apiary.garden.plot.furrow.shed.stable.trough.hayloft.rootcellar.smokehouse.springhouse.millstone.weathervane.lantern.tinderbox.candlemold.honeycomb.beeswax.propolis.nectar.pollen.comb.burrow.den.nest.perch.warren.colony.swarm.flock.herd.pod.grist.flour.starter.mother.scoby.kombucha.miso.tempeh.cheese.rennet.whey.curd.cream.butter.braid.loaf.crust.crumb.fiddlehead.sorrel.ramp.morelberry.huckleberry.thimbleberry.salmonberry.serviceberry.chokecherry.microdose.trip.shroom.liberty.teacher.treasure.wanderer.seeker.dreamer.shaman.visionary.tripper.oracle.seer.augur.prism.fractal.kaleidoscope.spectrum.nebula.aurora.comet.meteor.eclipse.zenith.horizon.mirage.echo.ripple.shimmer.glimmer.phantom.twilight.starlight.moonbeam`.split(`.`);function wt(e){let t=Math.floor(4294967296/e.length)*e.length,n;do{let e=crypto.getRandomValues(new Uint32Array(1))[0];if(e===void 0)throw Error(`CSPRNG returned no candidate value`);n=e}while(n>=t);let r=e[n%e.length];if(r===void 0)throw Error(`Candidate vocabulary is empty`);return r}function Tt(e){if(e?.count===1/0)throw RangeError(`words count must be finite`);let t=Math.max(1,Math.floor(e?.count??2)),n=e?.separator??`-`,r=[wt(St)];for(let e=1;e<t;e++)r.push(wt(Ct));return r.join(n)}function Et(e){return e instanceof g?e:new g(`App operation failed`,{cause:e,code:`HOST_FAILURE`,retryable:!1})}var Dt=new WeakMap,F={of(e,...t){return[e?.identity.surfaceId??null,e?.context.get().computerId??null,...t]}};function Ot(e){let t={};return e&&Dt.set(t,e),t}function kt(){let e=new ot({defaultOptions:{queries:{retry:!1,staleTime:3e4,refetchOnWindowFocus:!1},mutations:{retry:!1}}}),t=new Map;return e.getQueryCache().subscribe(n=>{let r=n.query;if(n.type===`removed`){t.get(r.queryHash)?.release(),t.delete(r.queryHash);return}let i=r.meta&&Dt.get(r.meta),a=t.get(r.queryHash);if(a?.app===i||(a?.release(),t.delete(r.queryHash),!i))return;let o=()=>{queueMicrotask(()=>{e.getQueryCache().get(r.queryHash)===r&&t.get(r.queryHash)?.app===i&&e.resetQueries({predicate:e=>e===r})})},s=i.capabilities.subscribe(o);t.set(r.queryHash,{app:i,release:s}),a&&o()}),e}function I(e,t,n,r){let i=e?.context.get().computerId;return bt({queryKey:n,meta:Ot(e),enabled:e!==null,retry:!1,queryFn:async({signal:n})=>{try{if(!e)throw new g(`No App connection`,{code:`DISCONNECTED`,retryable:!0});if(e.context.get().computerId!==i)throw new g(`The selected Computer changed`,{code:`SELECTION_CHANGED`,retryable:!1});return await r(e.capabilities.require(t),n)}catch(e){throw Et(e)}}})}function At(e){return xt({mutationKey:e.queryKey,scope:{id:se(e.queryKey)},mutationFn:async(t,n)=>{try{return await e.mutationFn(t,n)}catch(e){throw Et(e)}},onMutate:async(t,{client:n})=>{if(n.isMutating({mutationKey:e.queryKey,exact:!0})>1)return;await n.cancelQueries({queryKey:e.queryKey,exact:!0});let r=n.getQueryData(e.queryKey);if(r!==void 0)return n.setQueryData(e.queryKey,e.apply(r,t)),{previous:r,optimistic:n.getQueryData(e.queryKey)}},onError:(t,n,r,{client:i})=>{r&&i.getQueryData(e.queryKey)===r.optimistic&&i.setQueryData(e.queryKey,r.previous)},onSettled:(t,n,r,i,{client:a})=>a.invalidateQueries({queryKey:e.queryKey,exact:!0})})}var L=fe(`app.backend`,1,v(()=>Ce({request:ve(ue(he().transform(e=>ie(e))))}))),jt=fe(`app.methods`,1,v(()=>Ce({call:ve(ue(he().transform(e=>ie(e))))}))),Mt=Object.freeze({alphaIntercept:-9,alphaSlope:19,blurStdDeviation:1.5});function Nt(e){var t,n,r=``;if(typeof e==`string`||typeof e==`number`)r+=e;else if(typeof e==`object`){if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(n=Nt(e[t]))&&(r&&(r+=` `),r+=n)}else for(n in e)e[n]&&(r&&(r+=` `),r+=n)}return r}function Pt(){for(var e,t,n=0,r=``,i=arguments.length;n<i;n++)(e=arguments[n])&&(t=Nt(e))&&(r&&(r+=` `),r+=t);return r}var Ft=e=>typeof e==`boolean`?`${e}`:e===0?`0`:e,It=Pt,Lt=(e,t)=>n=>{if(t?.variants==null)return It(e,n?.class,n?.className);let{variants:r,defaultVariants:i}=t,a=Object.keys(r).map(e=>{let t=n?.[e],a=i?.[e];if(t===null)return null;let o=Ft(t)||Ft(a);return r[e][o]}),o=n&&Object.entries(n).reduce((e,t)=>{let[n,r]=t;return r===void 0||(e[n]=r),e},{});return It(e,a,t?.compoundVariants?.reduce((e,t)=>{let{class:n,className:r,...a}=t;return Object.entries(a).every(e=>{let[t,n]=e;return Array.isArray(n)?n.includes({...i,...o}[t]):{...i,...o}[t]===n})?[...e,n,r]:e},[]),n?.class,n?.className)},Rt=(0,N.forwardRef)(function({className:e,size:t=`md`,depth:n=`shallow`,placement:r=`standalone`,...i},a){return(0,P.jsx)(`div`,{...i,ref:a,"data-surface-size":t,"data-surface-depth":n,"data-surface-placement":r,className:A(`caps-surface`,e)})}),zt=(0,N.forwardRef)(function({className:e,...t},n){return(0,P.jsx)(`div`,{...t,ref:n,className:A(`caps-screen`,e)})}),Bt=(0,N.forwardRef)(function({children:e,className:t,depth:n=`deep`,fit:r=`content`,density:i=`normal`,...a},o){let s=r===`fill`;return(0,P.jsx)(Rt,{...a,className:A(t,s&&`flex min-h-0 flex-1`),depth:n,ref:o,children:(0,P.jsx)(`div`,{className:A(`caps-display-gasket`,s&&`flex min-h-0 min-w-0 flex-1`),"data-display-density":i,children:(0,P.jsx)(zt,{className:A(s&&`flex min-h-0 min-w-0 flex-1 overflow-hidden`),children:e})})})}),Vt=(0,N.forwardRef)(function({className:e,icon:t,status:n,title:r,...i},a){return(0,P.jsxs)(`header`,{...i,className:A(`caps-screen-header`,e),ref:a,children:[t?(0,P.jsx)(`span`,{className:`caps-screen-header-icon`,"aria-hidden":`true`,children:t}):null,(0,P.jsx)(`span`,{className:`caps-screen-header-title`,children:r}),n?(0,P.jsx)(`span`,{className:`caps-screen-header-status`,children:n}):null]})});(0,N.forwardRef)(function({appearance:e,className:t,...n},r){return(0,P.jsx)(`div`,{...n,className:A(`caps-screen-cells`,t),"data-appearance":e===`compact`?e:void 0,ref:r})}),(0,N.forwardRef)(function({children:e,className:t,legend:n,readout:r,icon:i,appearance:a,wide:o=!1,...s},c){return(0,P.jsxs)(`div`,{...s,className:A(`caps-screen-cell`,t),"data-wide":o||void 0,"data-appearance":a===`compact`?a:void 0,ref:c,children:[i?(0,P.jsx)(`span`,{className:`caps-screen-cell-icon`,children:i}):null,n?(0,P.jsx)(`span`,{className:`caps-screen-cell-legend`,children:n}):null,r?(0,P.jsx)(`span`,{className:`caps-screen-cell-readout`,children:r}):null,a===`compact`?(0,P.jsx)(`div`,{className:`caps-screen-cell-controls`,children:e}):e]})});function Ht(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}function Ut(...e){return t=>{let n=!1,r=e.map(e=>{let r=Ht(e,t);return!n&&typeof r==`function`&&(n=!0),r});if(n)return()=>{for(let t=0;t<r.length;t++){let n=r[t];typeof n==`function`?n():Ht(e[t],null)}}}}function Wt(...e){return N.useCallback(Ut(...e),e)}function Gt(e){let t=N.forwardRef((t,n)=>{let{children:r,...i}=t,a=null,o=!1,s=[];$t(r)&&typeof R==`function`&&(r=R(r._payload)),N.Children.forEach(r,e=>{if(Zt(e)){o=!0;let t=e,n=`child`in t.props?t.props.child:t.props.children;$t(n)&&typeof R==`function`&&(n=R(n._payload)),a=Jt(t,n),s.push(a?.props?.children)}else s.push(e)}),a?a=N.cloneElement(a,void 0,s):!o&&N.Children.count(r)===1&&N.isValidElement(r)&&(a=r);let c=a?Xt(a):void 0,l=Wt(n,c);if(!a){if(r||r===0)throw Error(o?nn(e):tn(e));return r}let u=Yt(i,a.props??{});return a.type!==N.Fragment&&(u.ref=n?l:c),N.cloneElement(a,u)});return t.displayName=`${e}.Slot`,t}var Kt=Gt(`Slot`),qt=Symbol.for(`radix.slottable`),Jt=(e,t)=>{if(`child`in e.props){let t=e.props.child;return N.isValidElement(t)?N.cloneElement(t,void 0,e.props.children(t.props.children)):null}return N.isValidElement(t)?t:null};function Yt(e,t){let n={...t};for(let r in t){let i=e[r],a=t[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(n[r]=i):r===`style`?n[r]={...i,...a}:r===`className`&&(n[r]=[i,a].filter(Boolean).join(` `))}return{...e,...n}}function Xt(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function Zt(e){return N.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===qt}var Qt=Symbol.for(`react.lazy`);function $t(e){return typeof e==`object`&&!!e&&`$$typeof`in e&&e.$$typeof===Qt&&`_payload`in e&&en(e._payload)}function en(e){return typeof e==`object`&&!!e&&`then`in e}var tn=e=>`${e} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,nn=e=>`${e} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,R=N.use,z=Object.freeze({reduced:!1,squish:90,fast:120,normal:180,slow:280,springDuration:320,bounce:.3,stretch:.28,distance:4,stagger:24,blur:0,shake:3,steps:0,fuse:1,pressDepth:.5,pressScale:1,ease:`cubic-bezier(0.2, 0, 0, 1)`,easeExit:`cubic-bezier(0.4, 0, 1, 1)`}),B=`(prefers-reduced-motion: reduce)`;function V(e){let t=e.ownerDocument.defaultView;if(!t)return z;let n=t.getComputedStyle(e),r=(e,t)=>{let r=n.getPropertyValue(e).trim(),i=Number.parseFloat(r);return Number.isFinite(i)?Math.max(0,i):t},i=(e,t)=>{let i=n.getPropertyValue(e).trim();return r(e,t)*(i.endsWith(`s`)&&!i.endsWith(`ms`)?1e3:1)},a=t.matchMedia?.(B).matches??!1,o=(e,t)=>a?120:i(`--stipe-motion-${e}`,t),s=(e,t)=>a?0:r(`--stipe-motion-${e}`,t);return{reduced:a,squish:o(`squish`,z.squish),fast:o(`fast`,z.fast),normal:o(`normal`,z.normal),slow:o(`slow`,z.slow),springDuration:o(`spring-duration`,z.springDuration),bounce:Math.min(1,s(`bounce`,z.bounce)),stretch:s(`stretch`,z.stretch),distance:s(`distance`,z.distance),stagger:a?0:i(`--stipe-motion-stagger`,z.stagger),blur:s(`blur`,z.blur),shake:s(`shake`,z.shake),steps:Math.floor(s(`steps`,z.steps)),fuse:r(`--stipe-motion-fuse`,z.fuse),pressDepth:a?0:r(`--stipe-press-depth`,z.pressDepth),pressScale:a?1:r(`--stipe-press-scale`,z.pressScale),ease:n.getPropertyValue(`--stipe-motion-ease`).trim()||z.ease,easeExit:n.getPropertyValue(`--stipe-motion-ease-exit`).trim()||z.easeExit}}function rn(e){let[t,n]=(0,N.useState)(()=>({...z,reduced:!0}));return(0,N.useLayoutEffect)(()=>{let t=e.current,r=t?.ownerDocument.defaultView;if(!t||!r)return;let i=()=>{let e=V(t);n(t=>JSON.stringify(t)===JSON.stringify(e)?t:e)};i();let a=new r.MutationObserver(i);for(let e=t;e;e=e.parentElement)a.observe(e,{attributes:!0,attributeFilter:[`data-theme`,`class`,`style`]});let o=r.matchMedia?.(B);return o?.addEventListener(`change`,i),()=>{a.disconnect(),o?.removeEventListener(`change`,i)}},[e]),t}function an(e,t){return e.reduced?0:Math.round(t*e.normal/z.normal)}function on(e,t){if(e.reduced)return 0;let n=t*e.bounce/z.bounce;return Math.min(.9,Math.max(0,n))}function sn(e,t){return e.reduced?0:Math.round(t*e.springDuration/z.springDuration)}function H(e,t){return e.steps>0?`steps(${String(e.steps)}, end)`:t}function U(e){return`animate`in e}var cn=globalThis;function ln(){return cn.matchMedia?.(B).matches??!1}function un(e){let t=cn.matchMedia?.(B);return t?.addEventListener(`change`,e),()=>{t?.removeEventListener(`change`,e)}}function dn(){return!0}function fn(){return(0,N.useSyncExternalStore)(un,ln,dn)}var pn=(0,N.forwardRef)(function({asChild:e=!1,className:t,...n},r){let i=A(`absolute h-px w-px overflow-hidden whitespace-nowrap border-0 p-0 [clip:rect(0,0,0,0)]`,t);return e?(0,P.jsx)(Kt,{...n,className:i,ref:r}):(0,P.jsx)(`span`,{...n,className:i,ref:r})}),mn=(e=10,t)=>{let n=t?Be:He;return t=>n(ze(t,0,1)*e)*(1/e)},hn=(0,N.forwardRef)(function({id:e,transform:t},n){return(0,P.jsxs)(`radialGradient`,{ref:n,id:e,gradientUnits:`userSpaceOnUse`,cx:`-1.2`,cy:`-1.6`,r:`5.6`,gradientTransform:t,children:[(0,P.jsx)(`stop`,{offset:`0`,stopColor:`color-mix(in oklab, var(--color-white) calc(var(--depth) * 50%), currentColor)`}),(0,P.jsx)(`stop`,{offset:`1`,stopColor:`currentColor`})]})});function gn({id:e}){return(0,P.jsx)(`filter`,{id:e,x:`-50%`,y:`-50%`,width:`200%`,height:`200%`,children:(0,P.jsx)(`feDropShadow`,{dx:`0`,dy:`1.5`,stdDeviation:`1`,floodColor:`currentColor`,style:{floodOpacity:`calc(var(--depth) * 0.6)`}})})}function _n({id:e}){return(0,P.jsxs)(`filter`,{id:e,x:`-10%`,y:`-10%`,width:`120%`,height:`120%`,colorInterpolationFilters:`sRGB`,children:[(0,P.jsx)(`feGaussianBlur`,{in:`SourceAlpha`,stdDeviation:`0.3`,result:`soft-edge`}),(0,P.jsx)(`feOffset`,{in:`soft-edge`,dx:`0.25`,dy:`0.45`,result:`lower-edge`}),(0,P.jsx)(`feComposite`,{in:`SourceAlpha`,in2:`lower-edge`,operator:`out`,result:`inner-shadow`}),(0,P.jsx)(`feFlood`,{floodColor:`var(--color-black)`,floodOpacity:`calc(var(--depth) * 0.28)`}),(0,P.jsx)(`feComposite`,{in2:`inner-shadow`,operator:`in`,result:`shade`}),(0,P.jsx)(`feOffset`,{in:`soft-edge`,dx:`-0.2`,dy:`-0.35`,result:`upper-edge`}),(0,P.jsx)(`feComposite`,{in:`SourceAlpha`,in2:`upper-edge`,operator:`out`,result:`inner-highlight`}),(0,P.jsx)(`feFlood`,{floodColor:`var(--color-white)`,floodOpacity:`calc(var(--depth) * 0.7)`}),(0,P.jsx)(`feComposite`,{in2:`inner-highlight`,operator:`in`,result:`highlight`}),(0,P.jsxs)(`feMerge`,{children:[(0,P.jsx)(`feMergeNode`,{in:`SourceGraphic`}),(0,P.jsx)(`feMergeNode`,{in:`shade`}),(0,P.jsx)(`feMergeNode`,{in:`highlight`})]})]})}var vn=Object.freeze({alphaIntercept:-8,alphaSlope:18,blurStdDeviation:2});function yn({id:e,values:t=Mt}){return(0,P.jsxs)(`filter`,{id:e,x:`-50%`,y:`-50%`,width:`200%`,height:`200%`,children:[(0,P.jsx)(`feGaussianBlur`,{in:`SourceGraphic`,stdDeviation:t.blurStdDeviation,result:`blur`}),(0,P.jsx)(`feColorMatrix`,{in:`blur`,values:`1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 ${String(t.alphaSlope)} ${String(t.alphaIntercept)}`,result:`gooey`}),(0,P.jsx)(`feComposite`,{in:`SourceGraphic`,in2:`gooey`,operator:`atop`})]})}function bn(e,t){let n=e.ownerDocument,r=!0,i=()=>{t(r&&!n.hidden)},a=globalThis,o=`IntersectionObserver`in globalThis&&a.IntersectionObserver?new a.IntersectionObserver(t=>{let n=t.find(t=>t.target===e);n&&(r=n.isIntersecting,i())}):void 0;return o?.observe(e),n.addEventListener(`visibilitychange`,i),i(),()=>{o?.disconnect(),n.removeEventListener(`visibilitychange`,i)}}function xn(e){let t=Math.max(0,Math.min(1,e));return t*t*(3-2*t)}function Sn(e,t){let n=Math.max(0,Math.min(1,(t-(e-1)*.085)/.68));return Math.sin(n*Math.PI)**2}function Cn(e,t,n){let r=n*Math.PI*2,i=t*2.1,a=Math.sin(r*2+i)*.15,o={rx:4*(1+a),ry:4/(1+a)};if(e===`line`){let e=7.5+4*Math.cos(r+(t===2?-.45:0));return{cx:(t-1)*e,cy:Math.sin(r+i)*.7,...o}}if(e===`square`){let e=4.7+2.7*Math.cos(r);return{cx:(t%2?1:-1)*e,cy:(t<2?-1:1)*e,...o}}if(e===`donut`){let e=xn(n/.66)*Math.PI*2,o=Math.min(e,t*Math.PI/8)-Math.PI/2,s=xn((n-.79)/.21),c=8+Math.sin(r*2+i)*.35*Math.sin(n*Math.PI);return{cx:Math.cos(o)*c*(1-s),cy:Math.sin(o)*c*(1-s)-8*s,rx:3.6*(1+a*Math.sin(n*Math.PI)),ry:3.6/(1+a*Math.sin(n*Math.PI))}}if(e===`bloom`){if(t===0){let e=[1,2,3,4].reduce((e,t)=>e+Sn(t,n),0),t=Math.sqrt(49-e*4);return{cx:Math.sin(r)*.4,cy:Math.sin(r*2)*.4,rx:t*(1+a),ry:t/(1+a)}}let e=Sn(t,n),i=(t-1)*Math.PI/2-Math.PI/4+Math.sin(r)*.22;return{cx:Math.cos(i)*14*e,cy:Math.sin(i)*14*e,rx:3.2*(1+a),ry:3.2/(1+a)}}return{cx:Math.sin(r+i)*6+Math.sin(r*3+i)*2.5,cy:Math.cos(r*2+i)*6,...o}}var wn={line:1700,square:1900,donut:3e3,wander:4600,bloom:2800};function Tn({variant:e}){let t=`caps-loader-${(0,N.useId)().replaceAll(`:`,``)}`,n=(0,N.useRef)(null),r=(0,N.useRef)(null),i=rn(r),{reduced:a}=i,o=e===`donut`?16:e===`bloom`?5:e===`square`?4:3;return(0,N.useLayoutEffect)(()=>{if(a||!n.current||!r.current)return;let t=[...n.current.querySelectorAll(`ellipse`)].map((t,n)=>Ue(t,{keyframes:Array.from({length:48},(t,r)=>({...Cn(e,n,(r+1)/48),duration:an(i,wn[e])/48})),ease:`linear`,loop:!0})),o=bn(r.current,e=>{for(let n of t)e?n.resume():n.pause()});return()=>{o();for(let e of t)e.revert()}},[e,a,i]),(0,P.jsxs)(`svg`,{ref:r,"aria-hidden":`true`,focusable:`false`,viewBox:e===`line`?`-20 -10 40 20`:`-20 -20 40 40`,children:[(0,P.jsxs)(`defs`,{children:[(0,P.jsx)(yn,{id:t,values:vn}),(0,P.jsx)(hn,{id:`${t}-surface`,transform:e===`line`?`matrix(3.4 0 0 1.4 0 0)`:`matrix(3 0 0 3 0 0)`}),(0,P.jsx)(gn,{id:`${t}-shadow`}),(0,P.jsx)(`mask`,{id:`${t}-mask`,maskUnits:`userSpaceOnUse`,x:`-20`,y:`-20`,width:`40`,height:`40`,style:{maskType:`alpha`},children:(0,P.jsx)(`g`,{ref:n,fill:`currentColor`,filter:`url(#${t})`,children:Array.from({length:o},(t,n)=>(0,P.jsx)(`ellipse`,{...Cn(e,n,0)},n))})})]}),(0,P.jsx)(`g`,{filter:`url(#${t}-shadow)`,children:(0,P.jsx)(`rect`,{x:`-20`,y:`-20`,width:`40`,height:`40`,fill:`url(#${t}-surface)`,mask:`url(#${t}-mask)`})})]})}var En={sm:`caps-loader-sm`,md:`caps-loader-md`,lg:`caps-loader-lg`,fill:`caps-loader-fill`},Dn={neutral:`text-base-content`,accent:`text-accent`,primary:`text-primary`,success:`text-success`},W=(0,N.forwardRef)(function({"aria-label":e,"aria-labelledby":t,className:n,decorative:r=!1,label:i=`Loading`,size:a=`md`,variant:o=`line`,tone:s=`neutral`,...c},l){let u=`${(0,N.useId)()}-label`,d=!r&&e===void 0&&t===void 0;return(0,P.jsxs)(`span`,{...c,"aria-label":r?void 0:e,"aria-hidden":r||void 0,"aria-labelledby":r?void 0:t??(e===void 0?u:void 0),className:A(`caps-loader`,En[a],Dn[s],n),"data-variant":o,role:r?void 0:`status`,ref:l,children:[(0,P.jsx)(Tn,{variant:o}),d?(0,P.jsx)(pn,{id:u,children:i}):null]})}),On=`disabled:bg-base-200 disabled:text-base-content disabled:outline-1 disabled:outline-solid disabled:outline-base-content/25 aria-disabled:bg-base-200 aria-disabled:text-base-content aria-disabled:outline-1 aria-disabled:outline-solid aria-disabled:outline-base-content/25`,kn=Lt(`btn caps-button disabled:pointer-events-none`,{variants:{variant:{primary:`btn-primary caps-button-filled`,secondary:`btn-secondary caps-button-filled`,accent:`btn-accent caps-button-filled`,destructive:`btn-error caps-button-filled`,outline:`btn-outline ${On}`,ghost:`btn-ghost`,"ghost-destructive":`btn-ghost caps-button-ghost-destructive`,link:`btn-link ${On}`},size:{xs:`btn-xs`,sm:`btn-sm`,default:`btn-md`,lg:`btn-lg`,icon:`btn-square btn-md`,menubar:`caps-button-menubar`}},defaultVariants:{variant:`primary`,size:`default`}}),An=(0,N.forwardRef)(function({asChild:e=!1,children:t,className:n,disabled:r,loading:i=!1,result:a,resultLabel:o,onResultEnd:s,size:c=`default`,variant:l=`primary`,...u},d){let f=A(kn({size:c,variant:l}),n),p=(0,N.useRef)(a).current,m=(0,N.useRef)(null);return(0,N.useImperativeHandle)(d,()=>m.current),jn(m,i,a),e?(0,P.jsx)(Kt,{...u,"aria-busy":i?!0:u[`aria-busy`],"aria-disabled":r===!0||i?!0:void 0,className:f,ref:m,children:t}):(0,P.jsx)(`button`,{...u,"aria-busy":i?!0:u[`aria-busy`],className:f,disabled:r===!0||i,ref:m,type:u.type??`button`,children:a===void 0&&o===void 0?(0,P.jsxs)(P.Fragment,{children:[i?(0,P.jsx)(W,{className:`size-3`,decorative:!0,size:`sm`}):null,t]}):(0,P.jsx)(In,{label:o,loading:i,onResultEnd:s,result:a,settled:p,children:t})})});function jn(e,t,n){let r=(0,N.useRef)(null),i=(0,N.useRef)(null),a=(0,N.useRef)(null);(0,N.useLayoutEffect)(()=>{let o=e.current;if(!o)return;let s=JSON.stringify([t,n??null,o.textContent]),c=s!==i.current;i.current=s;let l=a.current;if(!c&&l)return;let u=l?o.offsetWidth:r.current;l&&(a.current=null,l.cancel(),o.style.removeProperty(`overflow`),o.style.removeProperty(`white-space`));let d=o.offsetWidth;if(r.current=d>0?d:null,!c||u===null||d===0||Math.abs(u-d)<1||!U(o))return;let f=V(o);if(f.reduced)return;let p=o.animate([{width:`${String(u)}px`},{width:`${String(d)}px`}],{duration:f.normal,easing:H(f,f.ease)});a.current=p,o.style.overflow=`clip`,o.style.whiteSpace=`nowrap`;let m=()=>{a.current===p&&(a.current=null,o.style.removeProperty(`overflow`),o.style.removeProperty(`white-space`))};p.onfinish=m,p.oncancel=m})}var Mn=1100;function Nn(e,t){let n=t.bounce/.3,r=1+.05*Math.min(1.4,.4+n),i=1-.02*Math.min(1.4,n);return e.animate([{transform:`scale(1)`},{transform:`scale(${String(r)})`,offset:.35},{transform:`scale(${String(i)})`,offset:.7},{transform:`scale(1)`}],{duration:t.springDuration,easing:H(t,`ease-out`)})}function Pn(e,t){let n=t.shake;return e.animate([{transform:`none`},{transform:`translateX(${String(-n)}px)`},{transform:`translateX(${String(n)}px)`},{transform:`translateX(${String(-n*.6)}px)`},{transform:`translateX(${String(n*.3)}px)`},{transform:`none`}],{duration:t.slow*1.3,easing:H(t,`linear`)})}function Fn(e,t,n){let r=n.distance+2,i=`blur(${String(n.blur)}px)`;return[e.animate([{opacity:1,transform:`none`,filter:`blur(0px)`},{opacity:0,transform:`translateY(${String(-r)}px)`,filter:i}],{duration:n.fast,easing:H(n,n.ease)}),t.animate([{opacity:0,transform:`translateY(${String(r)}px)`,filter:i},{opacity:1,transform:`none`,filter:`blur(0px)`}],{duration:n.normal,easing:H(n,n.ease),fill:`backwards`})]}function In({children:e,label:t,loading:n,onResultEnd:r,result:i,settled:a}){let o=(0,N.useRef)(null),s=fn(),[c,l]=(0,N.useState)(!1),[u,d]=(0,N.useState)(!1);c&&!u&&d(!0);let f=(0,N.useRef)(a),p=(0,N.useRef)(r);(0,N.useEffect)(()=>{p.current=r},[r]),(0,N.useLayoutEffect)(()=>{let e=f.current;if(f.current=i,i===e)return;if(i===`done`){l(!0);let e=setTimeout(()=>{p.current?p.current():l(!1)},Mn);return()=>{clearTimeout(e)}}l(!1);let t=o.current;if(i!==`failed`||!t||!U(t))return;let n=V(t);if(n.shake<=0)return;let r=Pn(t,n);return()=>{r.cancel()}},[i,s]);let m=(0,N.useRef)(c);return(0,N.useLayoutEffect)(()=>{let e=o.current;if(!e||m.current===c)return;m.current=c;let t=e.querySelector(`[data-face="label"]`),n=e.querySelector(`[data-face="result"]`);if(!t||!n||!U(e)){c||d(!1);return}let r=V(e),i=c?Fn(t,n,r):Fn(n,t,r);if(c||i[0]?.addEventListener(`finish`,()=>{d(!1)}),c&&!r.reduced){i.push(Nn(e.closest(`button`)??e,r));let t=n.querySelector(`path`);t&&i.push(t.animate([{strokeDashoffset:1},{strokeDashoffset:0}],{duration:r.normal*1.4,delay:r.fast/2,easing:H(r,r.ease),fill:`backwards`}))}return()=>{for(let e of i)e.cancel()}},[c,s]),(0,P.jsxs)(`span`,{ref:o,className:`caps-button-faces`,"data-showing":c?`result`:`label`,children:[(0,P.jsxs)(`span`,{className:`caps-button-face`,"data-face":`label`,"aria-hidden":c?!0:void 0,children:[n||c?(0,P.jsx)(W,{className:`size-3`,decorative:!0,size:`sm`}):null,e]}),u?(0,P.jsxs)(`span`,{className:`caps-button-face`,"data-face":`result`,"aria-hidden":!c||void 0,children:[(0,P.jsx)(`svg`,{className:`caps-button-check`,viewBox:`0 0 24 24`,"aria-hidden":`true`,focusable:`false`,children:(0,P.jsx)(`path`,{d:`M4.5 12.5 9.5 17.5 19.5 6.5`,pathLength:1})}),t===void 0?e:t]}):null]})}var Ln={xs:`size-3`,sm:`size-[var(--stipe-icon-size-sm)]`,md:`size-[var(--stipe-icon-size-md)]`,lg:`size-[var(--stipe-icon-size-lg)]`},Rn=(0,N.forwardRef)(function({active:e=!1,icon:t,iconSize:n=`xs`,className:r,reveal:i=!1,size:a=`xs`,tone:o=`default`,variant:s=`ghost`,...c},l){let u=a===`responsive`;return(0,P.jsx)(An,{...c,resultLabel:c.result===void 0?void 0:null,ref:l,size:u?`sm`:a,variant:s,className:A(`caps-icon-button btn-circle`,u&&`caps-icon-button-responsive md:btn-xs`,e&&`text-accent`,i&&`scale-0 transition-transform group-hover:scale-100 focus-visible:scale-100`,o===`destructive`&&`hover:text-error`,r),children:(0,P.jsx)(`span`,{"aria-hidden":`true`,className:A(`inline-flex shrink-0 [&>svg]:size-full [&>svg]:[stroke-width:var(--stipe-icon-stroke)]`,Ln[n]),children:t})})}),zn=Object.freeze({ease:`linear`,duration:0});function Bn(e,t){let n=sn(e,t.duration);return n<=0?zn:e.steps>0?{ease:mn(e.steps),duration:n}:{ease:Ve({bounce:on(e,t.bounce),duration:n}),duration:n}}function Vn(e,t){let n=an(e,t.duration);return{ease:e.steps>0?mn(e.steps):t.ease,duration:n}}var Hn=ce(`Check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),Un=ce(`RotateCcw`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}]]),Wn=ce(`X`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]);h({operation:x(`read-library`),computerId:l});var G=C.pipe(D(E(4096)),D(Fe(e=>e.startsWith(`/`)&&e!==`/`&&!e.includes(`\0`)&&!e.endsWith(`/`)&&!e.split(`/`).some(e=>e===`.`||e===`..`))));h({path:c(G)});var Gn=`modulepreload`,Kn=function(e,t){return new URL(e,t).href},qn={},Jn=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function s(e){return import.meta.resolve?import.meta.resolve(e):new URL(e,import.meta.url).href}r=o(t.map(t=>{if(t=Kn(t,n),t=s(t),t in qn)return;qn[t]=!0;let r=t.endsWith(`.css`);for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}let i=document.createElement(`link`);if(i.rel=r?`stylesheet`:Gn,r||(i.as=`script`),i.crossOrigin=``,i.href=t,a&&i.setAttribute(`nonce`,a),document.head.appendChild(i),r)return new Promise((e,n)=>{i.addEventListener(`load`,e),i.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})};function Yn(e,t){return e.computerId===void 0||e.computerId===t}var Xn=`@cf/black-forest-labs/flux-2-klein-4b`,Zn=`Image creation is unavailable for this Computer right now.`,K={landscape:{height:768,width:1024},portrait:{height:1024,width:768},square:{height:1024,width:1024}},Qn=[`landscape`,`portrait`,`square`];function $n(e){return e instanceof De&&e.stage===`provider`&&e.provider!==void 0&&`reason`in e.provider&&e.provider.reason===`credits_exhausted`}function er(e){return $n(e)?{title:`AI Gateway credits unavailable`,message:`Cloudflare AI Gateway couldn't fund this request. Check the account's credits and billing in the Cloudflare dashboard under AI Gateway, or choose a Workers AI model such as Flux.${e.code===`MEDIA_PROVIDER_FAILURE_UNCHARGED`?` You weren't charged.`:``}`,retryable:!1}:Re(e,{INSUFFICIENT_CREDIT:{title:`Couldn’t create image`,message:`Media generation needs Team credits. Add credits in Billing, then retry.`}})}function tr(){return{destination:void 0,height:768,model:Xn,prompt:``,references:[],steps:void 0,width:1024}}function nr(e,t,n=`png`){if(e.trim().length===0)throw Error(`Media generation token must not be empty.`);let r=e.trim();if(!/^[a-zA-Z0-9]+(?:-[a-zA-Z0-9]+)*$/.test(r))throw Error(`Media generation basename contains invalid characters.`);return`${t.replace(/\/$/,``)}/generated-${r}.${n}`}function rr(e,t,n){let r=e.destination?.trim();if(r)return r;let i=n?.outputFormats.includes(`png`)?`png`:n?.outputFormats[0]??`png`,a=n?.kind===`video`?`mp4`:i===`jpeg`?`jpg`:i;return nr(Tt({count:4}),t,a)}function ir(e){return e?.kind===`video`?`Generate video`:`Generate image`}function ar(e,t,n=!1){if(e===void 0)return`Creating media…`;if(e.kind!==`video`)return`Creating image…`;if(t===void 0)return`Creating video… Videos take about 2 minutes`;let r=Math.max(0,Math.floor(t/1e3));return`Creating video… ${String(Math.floor(r/60))}:${String(r%60).padStart(2,`0`)} elapsed${n?` since reopening`:``} · Videos take about 2 minutes`}var or=(e,t)=>t===0?e:or(t,e%t),sr=(e,t,n)=>{if(n!==void 0)return`${String(e)} × ${String(t)} · ${String(n[0])}:${String(n[1])}`;let r=or(e,t);return`${String(e)} × ${String(t)} · ${String(e/r)}:${String(t/r)}`},cr=[[16,9],[21,9]],q=16;function lr(e){let t=e.input.maxDimension;if(e.kind!==`image`||e.input.dimensions!==`own`||!e.input.maxDimensionDocumented||t===null)return[];let n=Math.floor(t/q)*q;return cr.map(([e,t])=>{let r=Math.round(n*t/e/q)*q;return{value:`${String(n)}x${String(r)}`,label:sr(n,r,[e,t]),width:n,height:r}})}function ur(e,t,n){if(e?.input.dimensions===`none`)return null;let r=e?.video?.formats.find(e=>e.width===t&&e.height===n);if(r!==void 0)return`${r.resolution} ${r.aspectRatio}`;let i=or(t,n),a=t/i,o=n/i;return a<=21&&o<=21?`${String(a)}:${String(o)}`:`${String(t)} × ${String(n)}`}function dr(e){return e?.video!==void 0&&e.video!==null?e.video.formats.map(e=>({value:`${String(e.width)}x${String(e.height)}`,label:`${e.resolution} · ${e.aspectRatio} · ${String(e.width)} × ${String(e.height)}`,width:e.width,height:e.height})):e!==void 0&&e.sizes!==null?e.sizes.flatMap(e=>{let t=/^(\d+)x(\d+)$/u.exec(e);if(t===null)return[];let n=Number(t[1]),r=Number(t[2]);return[{value:e,label:sr(n,r),width:n,height:r}]}):[...Qn.map(e=>({value:e,label:sr(K[e].width,K[e].height),...K[e]})),...e===void 0?[]:lr(e)]}function fr(e,t,n){return n?.kind===`video`&&t.kind===`video`||t.input.dimensions!==`none`&&Le(Te(Sr(()=>t))({model:t.id,width:e.width,height:e.height}))?{width:e.width,height:e.height}:{width:t.input.defaultWidth,height:t.input.defaultHeight}}function pr(e){return e.label.split(` — `)[0]??e.label}function mr(e,t){return e.find(e=>e.id===t)}function hr(e,t){return{...e,height:t.input.defaultHeight,model:t.id,steps:t.input.steps===`fixed`?void 0:t.input.defaultSteps??void 0,durationSeconds:t.video?.defaultSeconds,generateAudio:t.video?.defaultGenerateAudio??void 0,width:t.input.defaultWidth}}var gr={"first-frame":`First frame`,"last-frame":`Last frame`,reference:`Reference`};function _r(e,t,n){let r=t[n]?.role,i=r===void 0?0:e.indexOf(r)+1;return[...e.slice(i),...e.slice(0,i)].find(e=>e!==r&&(e===`reference`||!t.some((t,r)=>r!==n&&t.role===e)))}function vr(e){return e?.video?.referenceRoles??[]}function yr(e,t){let n=vr(t);if(t?.video==null)return e.map(({path:e,computerId:t})=>t===void 0?{path:e}:{path:e,computerId:t});let r=e.map(e=>e.role!==void 0&&n.includes(e.role)?e.role:void 0),i=e=>r.includes(e),a=n.includes(`last-frame`),o=i(`reference`)||!i(`first-frame`)&&!i(`last-frame`)&&e.length>(a?2:1);return e.map((e,t)=>{let s=r[t];return s===void 0&&(s=o&&n.includes(`reference`)?`reference`:!i(`first-frame`)&&n.includes(`first-frame`)?`first-frame`:a&&!i(`last-frame`)?`last-frame`:n.includes(`reference`)?`reference`:`first-frame`,r[t]=s),{...e,role:s}})}function br(e,t,n){let r=t.video;if(r===null||e.length===0)return;let i=t=>e.filter(e=>e.role===t).length,a=i(`first-frame`),o=i(`last-frame`),s=i(`reference`);if(a>1||o>1)return r.referenceRoles.includes(`last-frame`)?`${t.label} takes one first frame and one last frame.`:`${t.label} takes one first frame.`;if(o>0&&a===0)return`A last frame needs a first frame as well.`;if(s>0&&a+o>0)return`Frames and references cannot be mixed. Use a first and last frame, or references.`;if(s>r.maxReferenceImages)return r.maxReferenceImages===0?`${t.label} takes no reference images.`:`${t.label} takes up to ${String(r.maxReferenceImages)} reference images.`;if(s>0&&n!==void 0&&!r.referenceResolutions.some(e=>e===n))return`${t.label} takes reference images only at ${r.referenceResolutions.join(`, `)}.`}function xr(e,t){let n=t.video?.formats.find(t=>t.width===e.width&&t.height===e.height);if(t.kind===`video`&&n===void 0)throw Error(`Choose a supported video resolution and aspect ratio.`);let r={height:e.height,model:e.model,prompt:e.prompt.trim(),width:e.width};return n!==void 0&&(r.resolution=n.resolution,r.aspectRatio=n.aspectRatio),e.steps!==void 0&&(r.steps=e.steps),e.durationSeconds!==void 0&&(r.durationSeconds=e.durationSeconds),e.references.length>0&&(r.references=yr(e.references,t)),t.video?.supportsAudio===!0&&e.generateAudio!==void 0&&(r.generateAudio=e.generateAudio),{destination:{path:e.destination?.trim()??``},settings:r}}function Sr(e){return h({model:C,width:S,height:S,durationSeconds:Ne(Oe(S)),steps:Ne(Oe(S))}).check(Fe(t=>{let n=e(t.model);if(!Number.isSafeInteger(t.width)||t.width<1)return{path:[`width`],issue:`Width must be a positive integer.`};if(!Number.isSafeInteger(t.height)||t.height<1)return{path:[`height`],issue:`Height must be a positive integer.`};if(n!==void 0){if(n.input.dimensions===`own`){let e=n.input.maxDimension??4096;if(t.width<256||t.height<256)return{path:[t.width<256?`width`:`height`],issue:`${n.label} requires dimensions of at least 256 × 256.`};if(t.width>e||t.height>e)return{path:[t.width>e?`width`:`height`],issue:`${n.label} accepts dimensions up to ${String(e)}.`}}if(n.sizes!==null&&!n.sizes.includes(`${String(t.width)}x${String(t.height)}`))return{path:[`width`],issue:`${n.label} accepts only these sizes: ${n.sizes.join(`, `)}.`};if(n.video!==null&&t.durationSeconds!==void 0&&(!Number.isSafeInteger(t.durationSeconds)||t.durationSeconds<n.video.minSeconds||t.durationSeconds>n.video.maxSeconds))return{path:[`durationSeconds`],issue:`${n.label} makes clips from ${String(n.video.minSeconds)} to ${String(n.video.maxSeconds)} seconds.`};if(n.input.steps===`fixed`&&t.steps!==void 0)return{path:[`steps`],issue:`${n.label} uses fixed steps.`};if(t.steps!==void 0&&(!Number.isSafeInteger(t.steps)||t.steps<1||n.input.maxSteps!==null&&t.steps>n.input.maxSteps))return{path:[`steps`],issue:`${n.label} accepts at most ${String(n.input.maxSteps??`the provider limit`)} steps.`}}}))}function Cr(e,t){let n=e.trim().length;return n>t.maxPromptLength?{length:n,excess:n-t.maxPromptLength}:null}function wr(e,t){if(e.destination?.trim().length===0)return`A destination file path is required.`;if(e.prompt.trim().length===0)return t?.kind===`video`?`Describe the video to generate.`:`Describe the image to generate.`;if(t===void 0)return`Choose a model from the granted registry.`;let n=Cr(e.prompt,t);if(n!==null)return`${t.label} accepts prompts up to ${String(t.maxPromptLength)} characters; this one is ${String(n.length)}. Shorten it by ${String(n.excess)}.`;let r=Te(Sr(()=>t))(e);if(ee(r))return u()(r.failure.issue).issues.map(e=>e.message).join(` `);if(e.references.length>t.input.maxReferences)return`${t.label} accepts at most ${String(t.input.maxReferences)} reference images.`;if(e.references.length>0&&t.input.referenceField===null)return`${t.label} does not accept reference images.`;if(t.video!==null){let n=t.video.formats.find(t=>t.width===e.width&&t.height===e.height);return br(yr(e.references,t),t,n?.resolution)}}var J=l,Tr=l.pipe(D(E(1024))),Er=n(Tr).pipe(D(E(200)));k([h({operation:x(`read-notices`),computerId:J}),h({operation:x(`dismiss-notices`),computerId:J,keys:Er})]);var Dr=h({keys:Er});async function Or(e,t){return w(Dr)(await e.require(L).request(JSON.stringify(t)))}k([h({operation:x(`read-folder`),computerId:J}),h({operation:x(`select-folder`),computerId:J,path:G})]);var kr=h({path:G,configured:te});async function Ar(e,t){return w(kr)(await e.require(L).request(JSON.stringify(t)))}var jr=2048,Mr=8e3,Nr=[{name:`Anime cel`,text:`Anime cel illustration with clean ink outlines, flat cel shading, and a limited palette of saturated colors. Soft painted backgrounds, expressive eyes, and crisp highlights, in the look of a hand-drawn animation frame.`},{name:`Cinematic film still`,text:`Cinematic film still shot on anamorphic lenses with shallow depth of field. Moody, motivated lighting, subtle film grain, and a considered color grade, composed like a frame from a feature film.`},{name:`Watercolor`,text:`Soft watercolor painting on textured paper, with translucent washes, visible pigment bleeds, and gentle color gradients. Loose brushwork, white paper left showing at the edges, and a calm, airy mood.`},{name:`Pixel art`,text:`Pixel art with a limited color palette, crisp square pixels, and no anti-aliasing. Clear readable silhouettes, dithered shading, and the charm of a classic 16-bit game sprite or scene.`},{name:`Product photo`,text:`Professional product photograph on a seamless studio background. Soft diffused lighting with gentle shadows, sharp focus across the subject, accurate colors, and clean, minimal composition suited to a catalog.`},{name:`Comic ink`,text:`Comic book panel with bold black ink linework, hatching and crosshatched shadows, and flat vivid colors. Dynamic angles, strong contrast, and a printed halftone texture.`}].map((e,t)=>({...e,id:-(t+1),builtIn:!0})),Y=C.pipe(D(ne(1)),D(E(64))),Pr=C.pipe(D(ne(1)),D(E(Mr))),X=l,Fr=h({id:b,name:Y,text:Pr,builtIn:te});k([h({operation:x(`list-styles`),computerId:X}),h({operation:x(`save-style`),computerId:X,id:oe(b),name:Y,text:Pr}),h({operation:x(`delete-style`),computerId:X,id:b}),h({operation:x(`read-print-style`),computerId:X,path:l})]);var Ir=h({styles:n(Fr).pipe(D(E(50+Nr.length)))}),Lr=h({style:c(Y)});function Rr(e,t){let n=t.trim();return e===void 0?n:`${e.trim()}\n\n${n}`}function zr(e){return e?.maxPromptLength??jr}function Br(e,t,n,r=[]){if(e.length<=t)return;let i=`${String(e.length)} characters; this model accepts at most ${String(t)}.`,a=r.map(e=>`@${e}`).join(`, `);return n!==void 0&&a!==``?`The "${n}" style and your prompt with ${a} expanded total ${i}`:n===void 0?a===``?`The prompt is ${i}`:`Your prompt with ${a} expanded is ${i}`:`The "${n}" style and your prompt total ${i}`}var Z=e=>e.require(L),Q=e=>JSON.stringify(e),Vr=w(Ir);async function Hr(e,t){return Vr(await Z(e).request(Q({operation:`list-styles`,computerId:t})))}async function Ur(e,t,n){return Vr(await Z(e).request(Q({operation:`save-style`,computerId:t,id:n.id,name:n.name,text:n.text})))}async function Wr(e,t,n){return Vr(await Z(e).request(Q({operation:`delete-style`,computerId:t,id:n})))}async function Gr(e,t,n){return w(Lr)(await Z(e).request(Q({operation:`read-print-style`,computerId:t,path:n})))}var Kr=8,qr=C.pipe(D(ne(1)),D(E(32)),D(Ae(/^[\p{L}\p{N}_-]+$/u))),Jr=C.pipe(D(E(500))),Yr=l.pipe(D(E(4096))),Xr=n(h({path:Yr})).pipe(D(E(8))),Zr=l,Qr=h({id:b,name:qr,description:Jr,references:Xr});k([h({operation:x(`list-characters`),computerId:Zr}),h({operation:x(`save-character`),computerId:Zr,id:oe(b),name:qr,description:Jr,references:Xr}),h({operation:x(`delete-character`),computerId:Zr,id:b})]);var $r=h({characters:n(Qr).pipe(D(E(50)))}),ei=(e,t)=>e.toLowerCase()===t.toLowerCase(),ti=/(?<![\p{L}\p{N}_@-])@([\p{L}\p{N}_-]+)/gu;function ni(e){let t=[];for(let n of e.matchAll(ti)){let e=n.at(1);e!==void 0&&!t.some(t=>ei(t,e))&&t.push(e)}return t}function ri(e,t){let n=[];return{prompt:e.replace(ti,(e,r)=>{let i=t.find(e=>ei(e.name,r));if(i===void 0)return e;let a=!n.includes(i);return a&&n.push(i),a&&i.description.trim()!==``?`${i.name} (${i.description.trim()})`:i.name}),characters:n}}function ii(e,t,n){let r=e.trim();return Rr(t,ri(r,n).prompt).length-r.length}function ai(e,t){let n=ni(e),r=t.filter(e=>!n.some(t=>ei(t,e)));return r.length===0?e:`${r.map(e=>`@${e}`).join(` `)} ${e}`}function oi(e,t,n){let r=(e,t)=>e.path===t&&(e.computerId===void 0||e.computerId===n),i=[...e];for(let e of t)for(let t of e.references)i.some(e=>r(e,t.path))||i.push({path:t.path});return i}function si(e){let t=ri(ai(e.prompt,e.names??[]),e.saved),n=oi(e.references,t.characters,e.computerId),r=n.length-e.references.length;if(e.model!==void 0&&r>0&&n.length>e.model.maxReferences){let n=t.characters.map(e=>e.name).join(`, `);return{kind:`refused`,message:e.model.maxReferences===0?`${e.model.label} does not take reference images, so it cannot use ${n}.`:`${n} add ${String(r)} reference ${r===1?`image`:`images`} to your ${String(e.references.length)}; ${e.model.label} accepts at most ${String(e.model.maxReferences)}.`}}return{kind:`ready`,prompt:t.prompt,references:n,characters:t.characters}}function ci(e,t){let n=/(?<![\p{L}\p{N}_@-])@([\p{L}\p{N}_-]*)$/u.exec(e.slice(0,t));return n===null?null:{start:n.index,query:n.at(1)??``}}function li(e,t){let n=t.toLowerCase(),r=e=>e.name.toLowerCase();return[...e.filter(e=>r(e).startsWith(n)),...e.filter(e=>!r(e).startsWith(n)&&r(e).includes(n))].slice(0,Kr)}var ui=e=>e.require(L),di=e=>JSON.stringify(e),fi=w($r);async function pi(e,t){return fi(await ui(e).request(di({operation:`list-characters`,computerId:t})))}async function mi(e,t,n){return fi(await ui(e).request(di({operation:`save-character`,computerId:t,id:n.id,name:n.name,description:n.description,references:n.references})))}async function hi(e,t,n){return fi(await ui(e).request(di({operation:`delete-character`,computerId:t,id:n})))}var $={models:e=>F.of(e,`prints`,`models`),folder:e=>F.of(e,`prints`,`folder`),dismissals:e=>F.of(e,`prints`,`dismissals`),styles:e=>F.of(e,`prints`,`styles`),printStyle:(e,t)=>F.of(e,`prints`,`print-style`,t),characters:e=>F.of(e,`prints`,`characters`)};function gi(e){return{...I(e,be,$.models(e),async(t,n)=>{if(!e)throw Error(`Prints is disconnected`);let r=await xe(e.capabilities);return n.throwIfAborted(),r}),enabled:!!(e?.context.get().computerId&&e.capabilities.has(be)),structuralSharing:!1}}function _i(e){let t=e?.context.get().computerId;return{...I(e,L,$.folder(e),async(n,r)=>{if(!e||!t)throw Error(`No Computer selected`);let i=await Ar(e.capabilities,{operation:`read-folder`,computerId:t});if(r.throwIfAborted(),e.context.get().computerId!==t)throw new g(`Computer selection changed`,{code:`SELECTION_CHANGED`,retryable:!1});return i}),enabled:!!(t&&e.capabilities.has(L))}}function vi(e){let t=e?.context.get().computerId;return{...I(e,L,$.dismissals(e),async(n,r)=>{if(!e||!t)throw Error(`No Computer selected`);let i=await Or(e.capabilities,{operation:`read-notices`,computerId:t});return r.throwIfAborted(),i}),enabled:!!(t&&e.capabilities.has(L))}}function yi(e){let t=e?.context.get().computerId;return{...I(e,L,$.styles(e),async(n,r)=>{if(!e||!t)throw Error(`No Computer selected`);let i=await Hr(e.capabilities,t);return r.throwIfAborted(),i}),enabled:!!(t&&e.capabilities.has(L))}}function bi(e,t){let n=e?.context.get().computerId;return{...I(e,L,$.printStyle(e,t??``),async(r,i)=>{if(!e||!n||t===null)throw Error(`No print selected`);let a=await Gr(e.capabilities,n,t);return i.throwIfAborted(),a}),enabled:!!(n&&t!==null&&e.capabilities.has(L))}}function xi(e){let t=e?.context.get().computerId;return{...I(e,L,$.characters(e),async(n,r)=>{if(!e||!t)throw Error(`No Computer selected`);let i=await pi(e.capabilities,t);return r.throwIfAborted(),i}),enabled:!!(t&&e.capabilities.has(L))}}function Si({checked:e}){let t=`caps-switch-${(0,N.useId)().replaceAll(`:`,``)}`,n=(0,N.useRef)(null),r=(0,N.useRef)(null),i=(0,N.useRef)(e).current,a=(0,N.useRef)(e),o=fn();return(0,N.useLayoutEffect)(()=>{if(!n.current||!r.current)return;let t=o||a.current===e;a.current=e;let i=e?16:8,s=V(n.current),c=Bn(s,{bounce:.25,duration:440}),l=Vn(s,{ease:`inOutSine`,duration:100}),u=Ue(n.current,t?{x:2,y:2,width:i,height:8,duration:0}:{x:[{to:e?2.5:1.5,...l},{to:2,...c}],y:[{to:1.5,...l},{to:2,...c}],height:[{to:9,...l},{to:8,...c}],width:[{to:e?7:16.5,...l},{to:i,...c}]}),d=Ue(r.current,{gradientTransform:e?`matrix(2 0 0 1 10 6)`:`matrix(1 0 0 1 6 6)`,...t?{duration:0}:{delay:l.duration,...c}});return()=>{u.cancel(),d.cancel()}},[e,o]),(0,P.jsxs)(`svg`,{className:`caps-switch-visual`,width:`40`,height:`24`,viewBox:`0 0 20 12`,"aria-hidden":`true`,focusable:`false`,children:[(0,P.jsxs)(`defs`,{children:[(0,P.jsx)(hn,{ref:r,id:`${t}-surface`,transform:i?`matrix(2 0 0 1 10 6)`:`matrix(1 0 0 1 6 6)`}),(0,P.jsx)(gn,{id:`${t}-shadow`}),(0,P.jsx)(_n,{id:`${t}-inset`}),(0,P.jsx)(`clipPath`,{id:`${t}-track`,children:(0,P.jsx)(`rect`,{x:`1`,y:`1`,width:`18`,height:`10`,rx:`5`})})]}),(0,P.jsx)(`rect`,{className:`caps-switch-track`,filter:`url(#${t}-inset)`,x:`0.5`,y:`0.5`,width:`19`,height:`11`,rx:`5.5`}),(0,P.jsx)(`g`,{clipPath:`url(#${t}-track)`,children:(0,P.jsx)(`rect`,{ref:n,x:`2`,y:`2`,width:i?16:8,height:`8`,rx:`4`,fill:`url(#${t}-surface)`,filter:`url(#${t}-shadow)`})})]})}var Ci=(0,N.forwardRef)(function({className:e,checked:t,defaultChecked:n=!1,onChange:r,onCheckedChange:i,...a},o){let s=(0,N.useRef)(null),[c,l]=(0,N.useState)(n),u=t??c;return(0,N.useImperativeHandle)(o,()=>{if(!s.current)throw Error(`Switch input is not mounted`);return s.current},[]),(0,N.useEffect)(()=>{let e=s.current?.form;if(!e||t!==void 0)return;let r=e=>{queueMicrotask(()=>{!e.defaultPrevented&&s.current&&l(n)})};return e.addEventListener(`reset`,r),()=>{e.removeEventListener(`reset`,r)}},[t,n,a.form]),(0,P.jsxs)(`span`,{className:`caps-switch`,"data-checked":u,children:[(0,P.jsx)(`input`,{...a,checked:u,className:A(`caps-switch-input`,e),onChange:e=>{t===void 0&&l(e.target.checked),r?.(e),i?.(e.target.checked)},ref:s,role:`switch`,type:`checkbox`}),(0,P.jsx)(Si,{checked:u})]})}),wi=(0,N.forwardRef)(function({className:e,density:t=`regular`,...n},r){return(0,P.jsx)(`ul`,{...n,className:A(`list`,t===`compact`&&`list-sm`,e),ref:r})}),Ti=(0,N.forwardRef)(function({className:e,...t},n){return(0,P.jsx)(`li`,{...t,className:A(`list-row`,e),ref:n})});(0,N.forwardRef)(function({className:e,icon:t,label:n,children:r,...i},a){return(0,P.jsxs)(`li`,{...i,className:A(`list-row caps-fact`,e),ref:a,children:[(0,P.jsxs)(`span`,{className:`caps-fact-label`,children:[t?(0,P.jsx)(`span`,{className:`caps-fact-icon`,"aria-hidden":`true`,children:t}):null,n]}),(0,P.jsx)(`span`,{className:`caps-fact-value`,children:r})]})});var Ei=(0,N.forwardRef)(function({aside:e,children:t,className:n,level:r=2,...i},a){return(0,P.jsxs)(r===3?`h3`:`h2`,{...i,className:A(`caps-data-list-heading`,n),ref:a,children:[(0,P.jsx)(`span`,{children:t}),e===void 0?null:(0,P.jsx)(`span`,{className:`caps-data-list-heading-aside`,children:e})]})});export{Wn as $,gr as A,At,Yn as B,dt as Bt,zr as C,Vt as Ct,Ar as D,jt as Dt,Or as E,L as Et,hr as F,_t as Ft,vr as G,pr as H,Qe as Ht,ir as I,gt as It,dr as J,yr as K,rr as L,ft as Lt,K as M,yt as Mt,tr as N,vt as Nt,Xn as O,I as Ot,er as P,ht as Pt,G as Q,xr as R,mt as Rt,Br as S,zt as St,Y as T,Lt as Tt,_r as U,Ke as Ut,mr as V,ct as Vt,br as W,qe as Wt,wr as X,fr as Y,Jn as Z,si as _,an as _t,_i as a,Rn as at,Rr as b,fn as bt,bi as c,bn as ct,yi as d,gn as dt,Un as et,ii as f,hn as ft,ci as g,H as gt,ri as h,U as ht,Ci as i,Bn as it,Qn as j,F as jt,Zn as k,kt,$ as l,yn as lt,hi as m,pn as mt,Ei as n,zn as nt,gi as o,An as ot,qr as p,vn as pt,ur as q,Ti as r,Vn as rt,vi as s,W as st,wi as t,Hn as tt,xi as u,_n as ut,mi as v,V as vt,Ur as w,Rt as wt,Wr as x,Bt as xt,li as y,rn as yt,ar as z,pt as zt};
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{At as t,Bt as n,Ct as r,Dt as i,Et as a,Gr as o,It as s,Jt as c,Kt as l,Ln as u,Lt as d,Mt as f,Nt as p,Pt as m,Qt as h,Rn as ee,Rt as g,St as _,Tr as v,Tt as y,Ut as b,Vt as te,Wt as x,Yt as S,Zt as C,_n as ne,_t as re,ar as ie,at as ae,bn as oe,bt as se,c as ce,cn as w,ct as le,dt as T,f as ue,ft as de,g as fe,gn as E,gt as pe,ht as me,in as D,jr as he,jt as ge,kt as O,lt as _e,m as ve,mt as ye,n as be,nn as k,o as xe,ot as Se,p as Ce,pt as we,sn as Te,st as Ee,t as De,tn as Oe,u as A,ut as ke,vn as Ae,vt as je,wt as Me,xn as Ne,xt as Pe,yn as Fe,yt as Ie,zn as Le,zt as Re}from"./media-B_-NjrDp.js";import{a as ze,i as Be,n as Ve,o as He,r as Ue}from"./modules-C4mfDnjH.js";function We(e){return{onFetch:(t,n)=>{let r=t.options,i=t.fetchOptions?.meta?.fetchMore?.direction,a=t.state.data?.pages||[],o=t.state.data?.pageParams||[],s={pages:[],pageParams:[]},c=0,l=async()=>{let n=!1,l=e=>{me(e,()=>t.signal,()=>n=!0)},u=je(t.options,t.fetchOptions),d=async(e,r,i)=>{if(n)return Promise.reject(t.signal.reason);if(r==null&&e.pages.length)return Promise.resolve(e);let a=(()=>{let e={client:t.client,queryKey:t.queryKey,pageParam:r,direction:i?`backward`:`forward`,meta:t.options.meta};return l(e),e})(),o=await u(a),{maxPages:s}=t.options,c=i?re:pe;return{pages:c(e.pages,o,s),pageParams:c(e.pageParams,r,s)}};if(i&&a.length){let e=i===`backward`,t=e?Ge:j,n={pages:a,pageParams:o};s=await d(n,t(r,n),e)}else{let t=e??a.length;do{let e=c===0?o[0]??r.initialPageParam:j(r,s);if(c>0&&e==null)break;s=await d(s,e),c++}while(c<t)}return s};t.fetchFn=t.options.persister?()=>t.options.persister?.(l,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):l}}}function j(e,{pages:t,pageParams:n}){let r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function Ge(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}function Ke(e,t){return t?j(e,t)!=null:!1}function qe(e,t){return!t||!e.getPreviousPageParam?!1:Ge(e,t)!=null}var Je=class extends Se{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e){super(),this.#s=!1,this.#o=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#i=e.client,this.#r=this.#i.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#t=Ze(this.options),this.state=e.state??this.#t,this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return this.#e}get promise(){return this.#a?.promise}setOptions(e){if(this.options={...this.#o,...e},e?._type&&(this.#e=e._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){let e=Ze(this.options);e.data!==void 0&&(this.setState(Xe(e.data,e.dataUpdatedAt)),this.#t=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus===`idle`&&this.#r.remove(this)}setData(e,t){let n=i(this.state.data,e,this.options);return this.#c({data:n,type:`success`,dataUpdatedAt:t?.updatedAt,manual:t?.manual}),n}setState(e){this.#c({type:`setState`,state:e})}cancel(e){let t=this.#a?.promise;return this.#a?.cancel(e),t?t.then(y).catch(y):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return this.#t}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(e=>O(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===f||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0&&this.observers.some(e=>O(e.options.staleTime,this)===`static`)}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e===`static`?!1:this.state.isInvalidated?!0:!p(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(e=>e.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#a?.continue()}onOnline(){this.observers.find(e=>e.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#a?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#r.notify({type:`observerAdded`,query:this,observer:e}))}removeObserver(e){let t=this.observers.indexOf(e);t!==-1&&(this.observers.splice(t,1),this.observers.length||(this.#a&&(this.#s||this.state.fetchStatus===`paused`&&this.state.status===`pending`?this.#a.cancel({revert:!0}):this.#a.cancelRetry()),this.scheduleGc()),this.#r.notify({type:`observerRemoved`,query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||this.#c({type:`invalidate`})}async fetch(e,t){if(this.state.fetchStatus!==`idle`&&this.#a?.status()!==`rejected`){if(this.state.data!==void 0&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#a)return this.#a.continueRetry(),this.#a.promise}if(e&&this.setOptions(e),!this.options.queryFn){let e=this.observers.find(e=>e.options.queryFn);e&&this.setOptions(e.options)}let n=new AbortController,r=e=>{Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(this.#s=!0,n.signal)})},i=()=>{let e=je(this.options,t),n=(()=>{let e={client:this.#i,queryKey:this.queryKey,meta:this.meta};return r(e),e})();return this.#s=!1,this.options.persister?this.options.persister(e,n,this):e(n)},a=(()=>{let e={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#i,state:this.state,fetchFn:i};return r(e),e})();(this.#e===`infinite`?We(this.options.pages):this.options.behavior)?.onFetch(a,this),this.#n=this.state,(this.state.fetchStatus===`idle`||this.state.fetchMeta!==a.fetchOptions?.meta)&&this.#c({type:`fetch`,meta:a.fetchOptions?.meta});let o=this.#a=_e({initialPromise:t?.initialPromise,fn:a.fetchFn,onCancel:e=>{e instanceof Ee&&e.revert&&this.setState({...this.#n,fetchStatus:`idle`}),n.abort()},onFail:(e,t)=>{this.#c({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#c({type:`pause`})},onContinue:()=>{this.#c({type:`continue`})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0});try{let e=await o.start();if(e===void 0)throw Error(`${this.queryHash} data is undefined`);return this.setData(e),this.#r.config.onSuccess?.(e,this),this.#r.config.onSettled?.(e,this.state.error,this),e}catch(e){if(e instanceof Ee){if(e.silent)return this.#a.promise;if(e.revert){if(this.state.data===void 0)throw e;return this.state.data}}throw this.#c({type:`error`,error:e}),this.#r.config.onError?.(e,this),this.#r.config.onSettled?.(this.state.data,e,this),e}finally{this.#a===o&&(this.#a=void 0),this.scheduleGc()}}#c(e){let t=t=>{switch(e.type){case`failed`:return{...t,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case`pause`:return{...t,fetchStatus:`paused`};case`continue`:return{...t,fetchStatus:`fetching`};case`fetch`:return{...t,...Ye(t.data,this.options),fetchMeta:e.meta??null};case`success`:let n={...t,...Xe(e.data,e.dataUpdatedAt),dataUpdateCount:t.dataUpdateCount+1,...!e.manual&&{fetchStatus:`idle`,fetchFailureCount:0,fetchFailureReason:null}};return this.#n=e.manual?n:void 0,n;case`error`:let r=e.error;return{...t,error:r,errorUpdateCount:t.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:t.fetchFailureCount+1,fetchFailureReason:r,fetchStatus:`idle`,status:`error`,isInvalidated:!0};case`invalidate`:return{...t,isInvalidated:!0};case`setState`:return{...t,...e.state}}};this.state=t(this.state),T.batch(()=>{this.observers.slice().forEach(e=>{e.onQueryUpdate()}),this.#r.notify({query:this,type:`updated`,action:e})})}};function Ye(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:le(t.networkMode)?`fetching`:`paused`,...e===void 0&&{error:null,status:`pending`}}}function Xe(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:`success`}}function Ze(e){let t=typeof e.initialData==`function`?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt==`function`?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?`success`:`pending`,fetchStatus:`idle`}}var Qe=class extends we{#e;#t=void 0;#n=void 0;#r=void 0;#i;#a;#o;#s;#c;#l;#u;#d;#f;#p=new Set;constructor(e,t){super(),this.options=t,this.#e=e,this.#o=null,this.bindMethods(),this.setOptions(t)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),et(this.#t,this.options)?this.#m():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return tt(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return tt(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#b(),this.#x(),this.#t.removeObserver(this)}setOptions(e){let n=this.options,r=this.#t;if(this.options=this.#e.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!=`boolean`&&typeof this.options.enabled!=`function`&&typeof O(this.options.enabled,this.#t)!=`boolean`)throw Error(`Expected enabled to be a boolean or a callback that returns a boolean`);this.#S(),this.#t.setOptions(this.options),n._defaulted&&!t(this.options,n)&&this.#e.getQueryCache().notify({type:`observerOptionsUpdated`,query:this.#t,observer:this});let i=this.hasListeners();i&&nt(this.#t,r,this.options,n)&&this.#m(),this.updateResult(),i&&(this.#t!==r||O(this.options.enabled,this.#t)!==O(n.enabled,this.#t)||O(this.options.staleTime,this.#t)!==O(n.staleTime,this.#t))&&this.#g();let a=this.#_();i&&(this.#t!==r||O(this.options.enabled,this.#t)!==O(n.enabled,this.#t)||a!==this.#f)&&this.#v(a)}getOptimisticResult(e){let n=this.#e.getQueryCache().build(this.#e,e),r=this.createResult(n,e);return t(this.getCurrentResult(),r)||(this.#r=r,this.#a=this.options,this.#i=this.#t.state),r}getCurrentResult(){return this.#r}trackResult(e,t){return new Proxy(e,{get:(e,n)=>(this.trackProp(n),t?.(n),Reflect.get(e,n))})}trackProp(e){this.#p.add(e)}getCurrentQuery(){return this.#t}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){let t=this.#e.defaultQueryOptions(e),n=this.#e.getQueryCache().build(this.#e,t),r=()=>{},i,a=new Promise(e=>{i=e,r=this.#e.getQueryCache().subscribe(i=>{i.type===`updated`&&i.query.queryHash===n.queryHash&&n.state.data!==void 0&&(r(),e(this.createResult(n,t)))})});return Promise.race([n.fetch().then(()=>{let e=this.createResult(n,t);return i?.(e),e}).finally(()=>{r()}),a])}fetch(e){return this.#m({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#r))}#m(e){this.#S();let t=this.#t.fetch(this.options,e);return e?.throwOnError||(t=t.catch(y)),t}#h(e){return!ye()&&O(this.options.enabled,this.#t)!==!1&&_(e)}#g(){this.#b();let e=O(this.options.staleTime,this.#t);if(this.#r.isStale||!this.#h(e))return;let t=p(this.#r.dataUpdatedAt,e)+1;this.#u=m.setTimeout(()=>{this.#r.isStale||this.updateResult()},t)}#_(){return(typeof this.options.refetchInterval==`function`?this.options.refetchInterval(this.#t):this.options.refetchInterval)??!1}#v(e){this.#x(),this.#f=e,!(this.#f===0||!this.#h(this.#f))&&(this.#d=m.setInterval(()=>{(this.options.refetchIntervalInBackground||de.isFocused())&&this.#m()},this.#f))}#y(){this.#g(),this.#v(this.#_())}#b(){this.#u!==void 0&&(m.clearTimeout(this.#u),this.#u=void 0)}#x(){this.#d!==void 0&&(m.clearInterval(this.#d),this.#d=void 0)}createResult(e,t){let n=this.#t,r=this.options,a=this.#r,o=this.#i,s=this.#a,c=e===n?this.#n:e.state,{state:l}=e,u={...l},d=!1,f;if(t._optimisticResults){let i=this.hasListeners(),a=!i&&et(e,t),o=i&&nt(e,n,t,r);(a||o)&&(u={...u,...Ye(l.data,e.options)}),t._optimisticResults===`isRestoring`&&(u.fetchStatus=`idle`)}let{error:p,errorUpdatedAt:m,status:h}=u;f=u.data;let ee=!1;if(t.placeholderData!==void 0&&f===void 0&&h===`pending`){let e;a?.isPlaceholderData&&t.placeholderData===s?.placeholderData?(e=a.data,ee=!0):e=typeof t.placeholderData==`function`?t.placeholderData(this.#l?.state.data,this.#l):t.placeholderData,e!==void 0&&(h=`success`,f=i(a?.data,e,t),d=!0)}if(t.select&&f!==void 0&&!ee){if(a&&f===o?.data&&t.select===this.#s)f=this.#c;else try{this.#s=t.select,f=t.select(f),f=i(a?.data,f,t),this.#c=f,this.#o=null}catch(e){this.#o=e}}else f===void 0&&(this.#o=null);this.#o&&(p=this.#o,f=this.#c,m=Date.now(),h=`error`,d=!1);let g=u.fetchStatus===`fetching`,_=h===`pending`,v=h===`error`,y=_&&g,b=f!==void 0;return{status:h,fetchStatus:u.fetchStatus,isPending:_,isSuccess:h===`success`,isError:v,isInitialLoading:y,isLoading:y,data:f,dataUpdatedAt:u.dataUpdatedAt,error:p,errorUpdatedAt:m,failureCount:u.fetchFailureCount,failureReason:u.fetchFailureReason,errorUpdateCount:u.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:u.dataUpdateCount>c.dataUpdateCount||u.errorUpdateCount>c.errorUpdateCount,isFetching:g,isRefetching:g&&!_,isLoadingError:v&&!b,isPaused:u.fetchStatus===`paused`,isPlaceholderData:d,isRefetchError:v&&b,isStale:rt(e,t),refetch:this.refetch,isEnabled:O(t.enabled,e)!==!1}}updateResult(){let e=this.#r,n=this.createResult(this.#t,this.options);if(this.#i=this.#t.state,this.#a=this.options,this.#i.data!==void 0&&(this.#l=this.#t),t(n,e))return;this.#r=n;let r=(()=>{if(!e)return!0;let{notifyOnChangeProps:t}=this.options,n=typeof t==`function`?t():t;if(n===`all`||!n&&!this.#p.size)return!0;let r=new Set(n??this.#p);return this.options.throwOnError&&r.add(`error`),Object.keys(this.#r).some(t=>{let n=t;return this.#r[n]!==e[n]&&r.has(n)})})();T.batch(()=>{r&&this.listeners.forEach(e=>{e(this.#r)}),this.#e.getQueryCache().notify({query:this.#t,type:`observerResultsUpdated`})})}#S(){let e=this.#e.getQueryCache().build(this.#e,this.options);if(e===this.#t)return;let t=this.#t;this.#t=e,this.#n=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#y()}};function $e(e,t){return O(t.enabled,e)!==!1&&e.state.data===void 0&&(e.state.status!==`error`||O(t.retryOnMount,e)!==!1)}function et(e,t){return $e(e,t)||e.state.data!==void 0&&tt(e,t,t.refetchOnMount)}function tt(e,t,n){if(O(t.enabled,e)!==!1&&O(t.staleTime,e)!==`static`){let r=typeof n==`function`?n(e):n;return r===`always`||r!==!1&&rt(e,t)}return!1}function nt(e,t,n,r){return(e!==t||O(r.enabled,e)===!1)&&(!n.suspense||e.state.status!==`error`)&&rt(e,n)}function rt(e,t){return O(t.enabled,e)!==!1&&e.isStaleByTime(O(t.staleTime,e))}var it=class extends we{#e;#t;#n;constructor(e={}){super(),this.config=e,this.#e=new Set,this.#t=new Map,this.#n=0}build(e,t,n){let r=new ae({client:e,mutationCache:this,mutationId:++this.#n,options:e.defaultMutationOptions(t),state:n});return this.add(r),r}add(e){this.#e.add(e);let t=M(e);if(typeof t==`string`){let n=this.#t.get(t);n?n.push(e):this.#t.set(t,[e])}this.notify({type:`added`,mutation:e})}remove(e){if(this.#e.delete(e)){let t=M(e);if(typeof t==`string`){let n=this.#t.get(t);if(n){if(n.length>1){let t=n.indexOf(e);t!==-1&&n.splice(t,1)}else n[0]===e&&this.#t.delete(t)}}}this.notify({type:`removed`,mutation:e})}canRun(e){let t=M(e);if(typeof t==`string`){let n=this.#t.get(t)?.find(e=>e.state.status===`pending`);return!n||n===e}return!0}runNext(e){let t=M(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){T.batch(()=>{this.#e.forEach(e=>{this.notify({type:`removed`,mutation:e})}),this.#e.clear(),this.#t.clear()})}getAll(){return Array.from(this.#e)}find(e){let t={exact:!0,...e};return this.getAll().find(e=>r(t,e))}findAll(e={}){return this.getAll().filter(t=>r(e,t))}notify(e){T.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return T.batch(()=>Promise.all(e.map(e=>e.continue().catch(y))))}};function M(e){return e.options.scope?.id}var at=class extends we{#e;constructor(e={}){super(),this.config=e,this.#e=new Map}build(e,t,n){let r=t.queryKey,i=t.queryHash??Pe(r,t),a=this.get(i);return a||(a=new Je({client:e,queryKey:r,queryHash:i,options:e.defaultQueryOptions(t),state:n,defaultOptions:e.getQueryDefaults(r)}),this.add(a)),a}add(e){this.#e.has(e.queryHash)||(this.#e.set(e.queryHash,e),this.notify({type:`added`,query:e}))}remove(e){let t=this.#e.get(e.queryHash);t&&(e.destroy(),t===e&&this.#e.delete(e.queryHash),this.notify({type:`removed`,query:e}))}clear(){T.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#e.get(e)}getAll(){return[...this.#e.values()]}find(e){let t={exact:!0,...e};return this.getAll().find(e=>Me(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>Me(e,t)):t}notify(e){T.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){T.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){T.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},ot=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new at,this.#t=e.mutationCache||new it,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=de.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=ke.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#a--,this.#a===0&&(this.#o?.(),this.#o=void 0,this.#s?.(),this.#s=void 0)}isFetching(e){return this.#e.findAll({...e,fetchStatus:`fetching`}).length}isMutating(e){return this.#t.findAll({...e,status:`pending`}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),n=this.#e.build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(O(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return this.#e.findAll(e).map(({queryKey:e,state:t})=>[e,t.data])}setQueryData(e,t,n){let r=this.defaultQueryOptions({queryKey:e}),i=this.#e.get(r.queryHash)?.state.data,a=Ie(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return T.batch(()=>this.#e.findAll(e).map(({queryKey:e})=>[e,this.setQueryData(e,t,n)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state}removeQueries(e){let t=this.#e;T.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return T.batch(()=>{let r=n.findAll(e),i=new Set(r);return r.forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,predicate:e=>i.has(e)},t)})}cancelQueries(e,t={}){let n={revert:!0,...t},r=T.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(y).catch(y)}invalidateQueries(e,t={}){return T.batch(()=>(this.#e.findAll(e).forEach(e=>{e.invalidate()}),e?.refetchType===`none`?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??`active`},t)))}refetchQueries(e,t={}){let n={...t,cancelRefetch:t.cancelRefetch??!0},r=T.batch(()=>this.#e.findAll(e).filter(e=>!e.isDisabled()&&!e.isStatic()).map(e=>{let t=e.fetch(void 0,n);return n.throwOnError||(t=t.catch(y)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(y)}async query(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t),r=n.isStaleByTime(O(t.staleTime,n))?await n.fetch(t):n.state.data,i=t.select;return i?i(r):r}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime(O(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(y).catch(y)}infiniteQuery(e){return e._type=`infinite`,this.query(e)}fetchInfiniteQuery(e){return e._type=`infinite`,this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(y).catch(y)}ensureInfiniteQueryData(e){return e._type=`infinite`,this.ensureQueryData(e)}resumePausedMutations(){return ke.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#n}setDefaultOptions(e){this.#n=e}setQueryDefaults(e,t){this.#r.set(se(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{a(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(se(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{a(e,t.mutationKey)&&Object.assign(n,t.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;let t={...this.#n.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||=Pe(t.queryKey,t),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!==`always`),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode=`offlineFirst`),t.queryFn===f&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#n.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}},N=e(o(),1),st=N.createContext(!1),ct=()=>N.useContext(st);st.Provider;var P=d();function lt(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var ut=N.createContext(lt()),dt=()=>N.useContext(ut),ft=(e,t,n)=>{let r=n?.state.error&&typeof e.throwOnError==`function`?ge(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||r)&&(t.isReset()||(e.retryOnMount=!1))},pt=e=>{N.useEffect(()=>{e.clearReset()},[e])},mt=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||ge(n,[e.error,r])),ht=e=>{if(e.suspense){let t=1e3,n=e=>e===`static`?e:Math.max(e??t,t),r=e.staleTime;e.staleTime=typeof r==`function`?(...e)=>n(r(...e)):n(r),typeof e.gcTime==`number`&&(e.gcTime=Math.max(e.gcTime,t))}},gt=(e,t)=>e?.suspense&&t.isPending,_t=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function vt(e,t,n){let r=ct(),i=dt(),a=s(n),o=a.defaultQueryOptions(e),c=a.getQueryCache().get(o.queryHash),l=e.subscribed!==!1;o._optimisticResults=r?`isRestoring`:l?`optimistic`:void 0,ht(o),ft(o,i,c),pt(i);let[u]=N.useState(()=>new t(a,o)),d=u.getOptimisticResult(o),f=!r&&l;if(N.useSyncExternalStore(N.useCallback(e=>{let t=f?u.subscribe(T.batchCalls(e)):y;return u.updateResult(),t},[u,f]),()=>u.getCurrentResult(),()=>u.getCurrentResult()),N.useEffect(()=>{u.setOptions(o)},[o,u]),gt(o,d))throw _t(o,u,i);if(mt({result:d,errorResetBoundary:i,throwOnError:o.throwOnError,query:c,suspense:o.suspense}))throw d.error;return o.notifyOnChangeProps?d:u.trackResult(d)}function yt(e,t){return vt(e,Qe,t)}function bt(e){return e}function xt(e){return e}var St=`gilled.velvety.spored.saprotrophic.mycorrhizal.luminescent.honeycomb.truffley.wispy.earthy.mossy.woody.waxy.gelatinous.coral.inkcapped.feathery.stiped.ringed.annulate.scaly.shaggy.fuzzy.spiky.conical.umbral.parasol.leathery.damp.dewy.bristly.powdery.yeasty.musty.ancient.patient.steady.faithful.hardy.rootbound.forested.shaded.sunlit.sporeladen.golden.honeyed.amber.ivory.crimson.violet.indigo.silver.mossgreen.midnight.creamy.buttery.porcelain.glossy.matte.ribbed.fluted.wavy.lobed.branched.curled.folded.hooded.crowned.blushing.weeping.laughing.dancing.singing.whistling.glowing.ghostly.fairy.elfin.rustic.homey.barnraised.pasture.orchard.mill.woven.gardened.herded.trailed.ridged.meadow.fielded.vined.rooted.tendered.seasoned.ripe.wild.tame.broody.stubborn.gentle.drowsy.watchful.wandering.migratory.burrowed.nested.perched.loamy.mulched.composted.fermented.brewed.cured.smoked.pickled.preserved.aged.vintage.heirloom.grandmothers.forgotten.remembered.beloved.cherished.worn.weathered.windblown.rainsoaked.frosted.snowed.bloomed.flowered.seeded.sprouted.grafted.pruned.harvested.threshed.milled.baked.proofed.risen.folded.twisted.braided.stitched.patched.mended.polished.burnished.glazed.gilded.verdigris.patinaed.microdosed.tripping.wavy.prismatic.shimmering.rippling.echoing.oracular.mystic.kaleidoscopic.auroral.nebular.azure.psychedelic.transcendent.visionary.wandering.dreaming.phantom.spectral.iridescent.liminal.tidal.celestial.cosmic.astral.ethereal.incandescent`.split(`.`),Ct=`shiitake.morel.chanterelle.bolete.puffball.oyster.enoki.maitake.lionsmane.truffle.porcini.agaric.amanita.bracket.conk.stipe.cap.gill.spore.hypha.mycelium.sporocarp.earthstar.stinkhorn.jelly.milkcap.blewit.cep.hedgehog.woodear.waxcap.inkcap.birdnest.cup.saddle.fieldcap.rust.smut.ergot.lichen.yeast.mold.toadstool.fruitingbody.basidiocarp.ascocarp.perithecium.apothecium.cystidium.basidium.clamp.septa.rhizomorph.sclerotium.gemma.annulus.volva.pileus.lamella.trama.gleba.peridium.sporangium.zygospora.conidia.teleomorph.anamorph.saprobe.endophyte.epiphyte.decomposer.recycler.alchemist.mycorrhiza.hyphae.web.net.lattice.thread.strand.root.tendril.runner.vine.ivy.moss.fern.liverwort.mule.cairn.almanac.parrot.birddog.watchdog.pigeon.ranch.barn.coop.pasture.meadow.field.orchard.gate.fence.silo.well.windmill.homestead.trail.ridge.creek.hill.grove.vineyard.apiary.garden.plot.furrow.shed.stable.trough.hayloft.rootcellar.smokehouse.springhouse.millstone.weathervane.lantern.tinderbox.candlemold.honeycomb.beeswax.propolis.nectar.pollen.comb.burrow.den.nest.perch.warren.colony.swarm.flock.herd.pod.grist.flour.starter.mother.scoby.kombucha.miso.tempeh.cheese.rennet.whey.curd.cream.butter.braid.loaf.crust.crumb.fiddlehead.sorrel.ramp.morelberry.huckleberry.thimbleberry.salmonberry.serviceberry.chokecherry.microdose.trip.shroom.liberty.teacher.treasure.wanderer.seeker.dreamer.shaman.visionary.tripper.oracle.seer.augur.prism.fractal.kaleidoscope.spectrum.nebula.aurora.comet.meteor.eclipse.zenith.horizon.mirage.echo.ripple.shimmer.glimmer.phantom.twilight.starlight.moonbeam`.split(`.`);function wt(e){let t=Math.floor(4294967296/e.length)*e.length,n;do{let e=crypto.getRandomValues(new Uint32Array(1))[0];if(e===void 0)throw Error(`CSPRNG returned no candidate value`);n=e}while(n>=t);let r=e[n%e.length];if(r===void 0)throw Error(`Candidate vocabulary is empty`);return r}function Tt(e){if(e?.count===1/0)throw RangeError(`words count must be finite`);let t=Math.max(1,Math.floor(e?.count??2)),n=e?.separator??`-`,r=[wt(St)];for(let e=1;e<t;e++)r.push(wt(Ct));return r.join(n)}function Et(e){return e instanceof g?e:new g(`App operation failed`,{cause:e,code:`HOST_FAILURE`,retryable:!1})}var Dt=new WeakMap,F={of(e,...t){return[e?.identity.surfaceId??null,e?.context.get().computerId??null,...t]}};function Ot(e){let t={};return e&&Dt.set(t,e),t}function kt(){let e=new ot({defaultOptions:{queries:{retry:!1,staleTime:3e4,refetchOnWindowFocus:!1},mutations:{retry:!1}}}),t=new Map;return e.getQueryCache().subscribe(n=>{let r=n.query;if(n.type===`removed`){t.get(r.queryHash)?.release(),t.delete(r.queryHash);return}let i=r.meta&&Dt.get(r.meta),a=t.get(r.queryHash);if(a?.app===i||(a?.release(),t.delete(r.queryHash),!i))return;let o=()=>{queueMicrotask(()=>{e.getQueryCache().get(r.queryHash)===r&&t.get(r.queryHash)?.app===i&&e.resetQueries({predicate:e=>e===r})})},s=i.capabilities.subscribe(o);t.set(r.queryHash,{app:i,release:s}),a&&o()}),e}function I(e,t,n,r){let i=e?.context.get().computerId;return bt({queryKey:n,meta:Ot(e),enabled:e!==null,retry:!1,queryFn:async({signal:n})=>{try{if(!e)throw new g(`No App connection`,{code:`DISCONNECTED`,retryable:!0});if(e.context.get().computerId!==i)throw new g(`The selected Computer changed`,{code:`SELECTION_CHANGED`,retryable:!1});return await r(e.capabilities.require(t),n)}catch(e){throw Et(e)}}})}function At(e){return xt({mutationKey:e.queryKey,scope:{id:se(e.queryKey)},mutationFn:async(t,n)=>{try{return await e.mutationFn(t,n)}catch(e){throw Et(e)}},onMutate:async(t,{client:n})=>{if(n.isMutating({mutationKey:e.queryKey,exact:!0})>1)return;await n.cancelQueries({queryKey:e.queryKey,exact:!0});let r=n.getQueryData(e.queryKey);if(r!==void 0)return n.setQueryData(e.queryKey,e.apply(r,t)),{previous:r,optimistic:n.getQueryData(e.queryKey)}},onError:(t,n,r,{client:i})=>{r&&i.getQueryData(e.queryKey)===r.optimistic&&i.setQueryData(e.queryKey,r.previous)},onSettled:(t,n,r,i,{client:a})=>a.invalidateQueries({queryKey:e.queryKey,exact:!0})})}var L=fe(`app.backend`,1,v(()=>Ce({request:ve(ue(he().transform(e=>ie(e))))}))),jt=fe(`app.methods`,1,v(()=>Ce({call:ve(ue(he().transform(e=>ie(e))))}))),Mt=Object.freeze({alphaIntercept:-9,alphaSlope:19,blurStdDeviation:1.5});function Nt(e){var t,n,r=``;if(typeof e==`string`||typeof e==`number`)r+=e;else if(typeof e==`object`){if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(n=Nt(e[t]))&&(r&&(r+=` `),r+=n)}else for(n in e)e[n]&&(r&&(r+=` `),r+=n)}return r}function Pt(){for(var e,t,n=0,r=``,i=arguments.length;n<i;n++)(e=arguments[n])&&(t=Nt(e))&&(r&&(r+=` `),r+=t);return r}var Ft=e=>typeof e==`boolean`?`${e}`:e===0?`0`:e,It=Pt,Lt=(e,t)=>n=>{if(t?.variants==null)return It(e,n?.class,n?.className);let{variants:r,defaultVariants:i}=t,a=Object.keys(r).map(e=>{let t=n?.[e],a=i?.[e];if(t===null)return null;let o=Ft(t)||Ft(a);return r[e][o]}),o=n&&Object.entries(n).reduce((e,t)=>{let[n,r]=t;return r===void 0||(e[n]=r),e},{});return It(e,a,t?.compoundVariants?.reduce((e,t)=>{let{class:n,className:r,...a}=t;return Object.entries(a).every(e=>{let[t,n]=e;return Array.isArray(n)?n.includes({...i,...o}[t]):{...i,...o}[t]===n})?[...e,n,r]:e},[]),n?.class,n?.className)},Rt=(0,N.forwardRef)(function({className:e,size:t=`md`,depth:n=`shallow`,placement:r=`standalone`,...i},a){return(0,P.jsx)(`div`,{...i,ref:a,"data-surface-size":t,"data-surface-depth":n,"data-surface-placement":r,className:A(`caps-surface`,e)})}),zt=(0,N.forwardRef)(function({className:e,...t},n){return(0,P.jsx)(`div`,{...t,ref:n,className:A(`caps-screen`,e)})}),Bt=(0,N.forwardRef)(function({children:e,className:t,depth:n=`deep`,fit:r=`content`,density:i=`normal`,...a},o){let s=r===`fill`;return(0,P.jsx)(Rt,{...a,className:A(t,s&&`flex min-h-0 flex-1`),depth:n,ref:o,children:(0,P.jsx)(`div`,{className:A(`caps-display-gasket`,s&&`flex min-h-0 min-w-0 flex-1`),"data-display-density":i,children:(0,P.jsx)(zt,{className:A(s&&`flex min-h-0 min-w-0 flex-1 overflow-hidden`),children:e})})})}),Vt=(0,N.forwardRef)(function({className:e,icon:t,status:n,title:r,...i},a){return(0,P.jsxs)(`header`,{...i,className:A(`caps-screen-header`,e),ref:a,children:[t?(0,P.jsx)(`span`,{className:`caps-screen-header-icon`,"aria-hidden":`true`,children:t}):null,(0,P.jsx)(`span`,{className:`caps-screen-header-title`,children:r}),n?(0,P.jsx)(`span`,{className:`caps-screen-header-status`,children:n}):null]})});(0,N.forwardRef)(function({appearance:e,className:t,...n},r){return(0,P.jsx)(`div`,{...n,className:A(`caps-screen-cells`,t),"data-appearance":e===`compact`?e:void 0,ref:r})}),(0,N.forwardRef)(function({children:e,className:t,legend:n,readout:r,icon:i,appearance:a,wide:o=!1,...s},c){return(0,P.jsxs)(`div`,{...s,className:A(`caps-screen-cell`,t),"data-wide":o||void 0,"data-appearance":a===`compact`?a:void 0,ref:c,children:[i?(0,P.jsx)(`span`,{className:`caps-screen-cell-icon`,children:i}):null,n?(0,P.jsx)(`span`,{className:`caps-screen-cell-legend`,children:n}):null,r?(0,P.jsx)(`span`,{className:`caps-screen-cell-readout`,children:r}):null,a===`compact`?(0,P.jsx)(`div`,{className:`caps-screen-cell-controls`,children:e}):e]})});function Ht(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}function Ut(...e){return t=>{let n=!1,r=e.map(e=>{let r=Ht(e,t);return!n&&typeof r==`function`&&(n=!0),r});if(n)return()=>{for(let t=0;t<r.length;t++){let n=r[t];typeof n==`function`?n():Ht(e[t],null)}}}}function Wt(...e){return N.useCallback(Ut(...e),e)}function Gt(e){let t=N.forwardRef((t,n)=>{let{children:r,...i}=t,a=null,o=!1,s=[];$t(r)&&typeof R==`function`&&(r=R(r._payload)),N.Children.forEach(r,e=>{if(Zt(e)){o=!0;let t=e,n=`child`in t.props?t.props.child:t.props.children;$t(n)&&typeof R==`function`&&(n=R(n._payload)),a=Jt(t,n),s.push(a?.props?.children)}else s.push(e)}),a?a=N.cloneElement(a,void 0,s):!o&&N.Children.count(r)===1&&N.isValidElement(r)&&(a=r);let c=a?Xt(a):void 0,l=Wt(n,c);if(!a){if(r||r===0)throw Error(o?nn(e):tn(e));return r}let u=Yt(i,a.props??{});return a.type!==N.Fragment&&(u.ref=n?l:c),N.cloneElement(a,u)});return t.displayName=`${e}.Slot`,t}var Kt=Gt(`Slot`),qt=Symbol.for(`radix.slottable`),Jt=(e,t)=>{if(`child`in e.props){let t=e.props.child;return N.isValidElement(t)?N.cloneElement(t,void 0,e.props.children(t.props.children)):null}return N.isValidElement(t)?t:null};function Yt(e,t){let n={...t};for(let r in t){let i=e[r],a=t[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(n[r]=i):r===`style`?n[r]={...i,...a}:r===`className`&&(n[r]=[i,a].filter(Boolean).join(` `))}return{...e,...n}}function Xt(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function Zt(e){return N.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===qt}var Qt=Symbol.for(`react.lazy`);function $t(e){return typeof e==`object`&&!!e&&`$$typeof`in e&&e.$$typeof===Qt&&`_payload`in e&&en(e._payload)}function en(e){return typeof e==`object`&&!!e&&`then`in e}var tn=e=>`${e} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,nn=e=>`${e} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,R=N.use,z=Object.freeze({reduced:!1,squish:90,fast:120,normal:180,slow:280,springDuration:320,bounce:.3,stretch:.28,distance:4,stagger:24,blur:0,shake:3,steps:0,fuse:1,pressDepth:.5,pressScale:1,ease:`cubic-bezier(0.2, 0, 0, 1)`,easeExit:`cubic-bezier(0.4, 0, 1, 1)`}),B=`(prefers-reduced-motion: reduce)`;function V(e){let t=e.ownerDocument.defaultView;if(!t)return z;let n=t.getComputedStyle(e),r=(e,t)=>{let r=n.getPropertyValue(e).trim(),i=Number.parseFloat(r);return Number.isFinite(i)?Math.max(0,i):t},i=(e,t)=>{let i=n.getPropertyValue(e).trim();return r(e,t)*(i.endsWith(`s`)&&!i.endsWith(`ms`)?1e3:1)},a=t.matchMedia?.(B).matches??!1,o=(e,t)=>a?120:i(`--stipe-motion-${e}`,t),s=(e,t)=>a?0:r(`--stipe-motion-${e}`,t);return{reduced:a,squish:o(`squish`,z.squish),fast:o(`fast`,z.fast),normal:o(`normal`,z.normal),slow:o(`slow`,z.slow),springDuration:o(`spring-duration`,z.springDuration),bounce:Math.min(1,s(`bounce`,z.bounce)),stretch:s(`stretch`,z.stretch),distance:s(`distance`,z.distance),stagger:a?0:i(`--stipe-motion-stagger`,z.stagger),blur:s(`blur`,z.blur),shake:s(`shake`,z.shake),steps:Math.floor(s(`steps`,z.steps)),fuse:r(`--stipe-motion-fuse`,z.fuse),pressDepth:a?0:r(`--stipe-press-depth`,z.pressDepth),pressScale:a?1:r(`--stipe-press-scale`,z.pressScale),ease:n.getPropertyValue(`--stipe-motion-ease`).trim()||z.ease,easeExit:n.getPropertyValue(`--stipe-motion-ease-exit`).trim()||z.easeExit}}function rn(e){let[t,n]=(0,N.useState)(()=>({...z,reduced:!0}));return(0,N.useLayoutEffect)(()=>{let t=e.current,r=t?.ownerDocument.defaultView;if(!t||!r)return;let i=()=>{let e=V(t);n(t=>JSON.stringify(t)===JSON.stringify(e)?t:e)};i();let a=new r.MutationObserver(i);for(let e=t;e;e=e.parentElement)a.observe(e,{attributes:!0,attributeFilter:[`data-theme`,`class`,`style`]});let o=r.matchMedia?.(B);return o?.addEventListener(`change`,i),()=>{a.disconnect(),o?.removeEventListener(`change`,i)}},[e]),t}function an(e,t){return e.reduced?0:Math.round(t*e.normal/z.normal)}function on(e,t){if(e.reduced)return 0;let n=t*e.bounce/z.bounce;return Math.min(.9,Math.max(0,n))}function sn(e,t){return e.reduced?0:Math.round(t*e.springDuration/z.springDuration)}function H(e,t){return e.steps>0?`steps(${String(e.steps)}, end)`:t}function U(e){return`animate`in e}var cn=globalThis;function ln(){return cn.matchMedia?.(B).matches??!1}function un(e){let t=cn.matchMedia?.(B);return t?.addEventListener(`change`,e),()=>{t?.removeEventListener(`change`,e)}}function dn(){return!0}function fn(){return(0,N.useSyncExternalStore)(un,ln,dn)}var pn=(0,N.forwardRef)(function({asChild:e=!1,className:t,...n},r){let i=A(`absolute h-px w-px overflow-hidden whitespace-nowrap border-0 p-0 [clip:rect(0,0,0,0)]`,t);return e?(0,P.jsx)(Kt,{...n,className:i,ref:r}):(0,P.jsx)(`span`,{...n,className:i,ref:r})}),mn=(e=10,t)=>{let n=t?Be:He;return t=>n(ze(t,0,1)*e)*(1/e)},hn=(0,N.forwardRef)(function({id:e,transform:t},n){return(0,P.jsxs)(`radialGradient`,{ref:n,id:e,gradientUnits:`userSpaceOnUse`,cx:`-1.2`,cy:`-1.6`,r:`5.6`,gradientTransform:t,children:[(0,P.jsx)(`stop`,{offset:`0`,stopColor:`color-mix(in oklab, var(--color-white) calc(var(--depth) * 50%), currentColor)`}),(0,P.jsx)(`stop`,{offset:`1`,stopColor:`currentColor`})]})});function gn({id:e}){return(0,P.jsx)(`filter`,{id:e,x:`-50%`,y:`-50%`,width:`200%`,height:`200%`,children:(0,P.jsx)(`feDropShadow`,{dx:`0`,dy:`1.5`,stdDeviation:`1`,floodColor:`currentColor`,style:{floodOpacity:`calc(var(--depth) * 0.6)`}})})}function _n({id:e}){return(0,P.jsxs)(`filter`,{id:e,x:`-10%`,y:`-10%`,width:`120%`,height:`120%`,colorInterpolationFilters:`sRGB`,children:[(0,P.jsx)(`feGaussianBlur`,{in:`SourceAlpha`,stdDeviation:`0.3`,result:`soft-edge`}),(0,P.jsx)(`feOffset`,{in:`soft-edge`,dx:`0.25`,dy:`0.45`,result:`lower-edge`}),(0,P.jsx)(`feComposite`,{in:`SourceAlpha`,in2:`lower-edge`,operator:`out`,result:`inner-shadow`}),(0,P.jsx)(`feFlood`,{floodColor:`var(--color-black)`,floodOpacity:`calc(var(--depth) * 0.28)`}),(0,P.jsx)(`feComposite`,{in2:`inner-shadow`,operator:`in`,result:`shade`}),(0,P.jsx)(`feOffset`,{in:`soft-edge`,dx:`-0.2`,dy:`-0.35`,result:`upper-edge`}),(0,P.jsx)(`feComposite`,{in:`SourceAlpha`,in2:`upper-edge`,operator:`out`,result:`inner-highlight`}),(0,P.jsx)(`feFlood`,{floodColor:`var(--color-white)`,floodOpacity:`calc(var(--depth) * 0.7)`}),(0,P.jsx)(`feComposite`,{in2:`inner-highlight`,operator:`in`,result:`highlight`}),(0,P.jsxs)(`feMerge`,{children:[(0,P.jsx)(`feMergeNode`,{in:`SourceGraphic`}),(0,P.jsx)(`feMergeNode`,{in:`shade`}),(0,P.jsx)(`feMergeNode`,{in:`highlight`})]})]})}var vn=Object.freeze({alphaIntercept:-8,alphaSlope:18,blurStdDeviation:2});function yn({id:e,values:t=Mt}){return(0,P.jsxs)(`filter`,{id:e,x:`-50%`,y:`-50%`,width:`200%`,height:`200%`,children:[(0,P.jsx)(`feGaussianBlur`,{in:`SourceGraphic`,stdDeviation:t.blurStdDeviation,result:`blur`}),(0,P.jsx)(`feColorMatrix`,{in:`blur`,values:`1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 ${String(t.alphaSlope)} ${String(t.alphaIntercept)}`,result:`gooey`}),(0,P.jsx)(`feComposite`,{in:`SourceGraphic`,in2:`gooey`,operator:`atop`})]})}function bn(e,t){let n=e.ownerDocument,r=!0,i=()=>{t(r&&!n.hidden)},a=globalThis,o=`IntersectionObserver`in globalThis&&a.IntersectionObserver?new a.IntersectionObserver(t=>{let n=t.find(t=>t.target===e);n&&(r=n.isIntersecting,i())}):void 0;return o?.observe(e),n.addEventListener(`visibilitychange`,i),i(),()=>{o?.disconnect(),n.removeEventListener(`visibilitychange`,i)}}function xn(e){let t=Math.max(0,Math.min(1,e));return t*t*(3-2*t)}function Sn(e,t){let n=Math.max(0,Math.min(1,(t-(e-1)*.085)/.68));return Math.sin(n*Math.PI)**2}function Cn(e,t,n){let r=n*Math.PI*2,i=t*2.1,a=Math.sin(r*2+i)*.15,o={rx:4*(1+a),ry:4/(1+a)};if(e===`line`){let e=7.5+4*Math.cos(r+(t===2?-.45:0));return{cx:(t-1)*e,cy:Math.sin(r+i)*.7,...o}}if(e===`square`){let e=4.7+2.7*Math.cos(r);return{cx:(t%2?1:-1)*e,cy:(t<2?-1:1)*e,...o}}if(e===`donut`){let e=xn(n/.66)*Math.PI*2,o=Math.min(e,t*Math.PI/8)-Math.PI/2,s=xn((n-.79)/.21),c=8+Math.sin(r*2+i)*.35*Math.sin(n*Math.PI);return{cx:Math.cos(o)*c*(1-s),cy:Math.sin(o)*c*(1-s)-8*s,rx:3.6*(1+a*Math.sin(n*Math.PI)),ry:3.6/(1+a*Math.sin(n*Math.PI))}}if(e===`bloom`){if(t===0){let e=[1,2,3,4].reduce((e,t)=>e+Sn(t,n),0),t=Math.sqrt(49-e*4);return{cx:Math.sin(r)*.4,cy:Math.sin(r*2)*.4,rx:t*(1+a),ry:t/(1+a)}}let e=Sn(t,n),i=(t-1)*Math.PI/2-Math.PI/4+Math.sin(r)*.22;return{cx:Math.cos(i)*14*e,cy:Math.sin(i)*14*e,rx:3.2*(1+a),ry:3.2/(1+a)}}return{cx:Math.sin(r+i)*6+Math.sin(r*3+i)*2.5,cy:Math.cos(r*2+i)*6,...o}}var wn={line:1700,square:1900,donut:3e3,wander:4600,bloom:2800},Tn=2;function En({variant:e,pace:t=`working`}){let n=`caps-loader-${(0,N.useId)().replaceAll(`:`,``)}`,r=(0,N.useRef)(null),i=(0,N.useRef)(null),a=rn(i),{reduced:o}=a,s=e===`donut`?16:e===`bloom`?5:e===`square`?4:3;return(0,N.useLayoutEffect)(()=>{if(o||!r.current||!i.current)return;let n=[...r.current.querySelectorAll(`ellipse`)].map((n,r)=>Ue(n,{keyframes:Array.from({length:48},(n,i)=>({...Cn(e,r,(i+1)/48),duration:an(a,wn[e]*(t===`idle`?Tn:1))/48})),ease:`linear`,loop:!0})),s=bn(i.current,e=>{for(let t of n)e?t.resume():t.pause()});return()=>{s();for(let e of n)e.revert()}},[e,t,o,a]),(0,P.jsxs)(`svg`,{ref:i,"aria-hidden":`true`,focusable:`false`,viewBox:e===`line`?`-20 -10 40 20`:`-20 -20 40 40`,children:[(0,P.jsxs)(`defs`,{children:[(0,P.jsx)(yn,{id:n,values:vn}),(0,P.jsx)(hn,{id:`${n}-surface`,transform:e===`line`?`matrix(3.4 0 0 1.4 0 0)`:`matrix(3 0 0 3 0 0)`}),(0,P.jsx)(gn,{id:`${n}-shadow`}),(0,P.jsx)(`mask`,{id:`${n}-mask`,maskUnits:`userSpaceOnUse`,x:`-20`,y:`-20`,width:`40`,height:`40`,style:{maskType:`alpha`},children:(0,P.jsx)(`g`,{ref:r,fill:`currentColor`,filter:`url(#${n})`,children:Array.from({length:s},(t,n)=>(0,P.jsx)(`ellipse`,{...Cn(e,n,0)},n))})})]}),(0,P.jsx)(`g`,{filter:`url(#${n}-shadow)`,children:(0,P.jsx)(`rect`,{x:`-20`,y:`-20`,width:`40`,height:`40`,fill:`url(#${n}-surface)`,mask:`url(#${n}-mask)`})})]})}var Dn={sm:`caps-loader-sm`,md:`caps-loader-md`,lg:`caps-loader-lg`,fill:`caps-loader-fill`},On={neutral:`text-base-content`,accent:`text-accent`,primary:`text-primary`,success:`text-success`,current:`text-current`},W=(0,N.forwardRef)(function({"aria-label":e,"aria-labelledby":t,className:n,decorative:r=!1,label:i=`Loading`,size:a=`md`,variant:o=`line`,pace:s=`working`,tone:c=`neutral`,...l},u){let d=`${(0,N.useId)()}-label`,f=!r&&e===void 0&&t===void 0;return(0,P.jsxs)(`span`,{...l,"aria-label":r?void 0:e,"aria-hidden":r||void 0,"aria-labelledby":r?void 0:t??(e===void 0?d:void 0),className:A(`caps-loader`,Dn[a],On[c],n),"data-variant":o,"data-pace":s,role:r?void 0:`status`,ref:u,children:[(0,P.jsx)(En,{variant:o,pace:s}),f?(0,P.jsx)(pn,{id:d,children:i}):null]})}),kn=`disabled:bg-base-200 disabled:text-base-content disabled:outline-1 disabled:outline-solid disabled:outline-base-content/25 aria-disabled:bg-base-200 aria-disabled:text-base-content aria-disabled:outline-1 aria-disabled:outline-solid aria-disabled:outline-base-content/25`,An=Lt(`btn caps-button disabled:pointer-events-none`,{variants:{variant:{primary:`btn-primary caps-button-filled`,secondary:`btn-secondary caps-button-filled`,accent:`btn-accent caps-button-filled`,destructive:`btn-error caps-button-filled`,outline:`btn-outline ${kn}`,ghost:`btn-ghost`,"ghost-destructive":`btn-ghost caps-button-ghost-destructive`,link:`btn-link ${kn}`},size:{xs:`btn-xs`,sm:`btn-sm`,default:`btn-md`,lg:`btn-lg`,icon:`btn-square btn-md`,menubar:`caps-button-menubar`}},defaultVariants:{variant:`primary`,size:`default`}}),jn=(0,N.forwardRef)(function({asChild:e=!1,children:t,className:n,disabled:r,loading:i=!1,result:a,resultLabel:o,onResultEnd:s,size:c=`default`,variant:l=`primary`,...u},d){let f=A(An({size:c,variant:l}),n),p=(0,N.useRef)(a).current,m=(0,N.useRef)(null);return(0,N.useImperativeHandle)(d,()=>m.current),Mn(m,i,a),e?(0,P.jsx)(Kt,{...u,"aria-busy":i?!0:u[`aria-busy`],"aria-disabled":r===!0||i?!0:void 0,className:f,ref:m,children:t}):(0,P.jsx)(`button`,{...u,"aria-busy":i?!0:u[`aria-busy`],className:f,disabled:r===!0||i,ref:m,type:u.type??`button`,children:a===void 0&&o===void 0?(0,P.jsxs)(P.Fragment,{children:[i?(0,P.jsx)(W,{decorative:!0,size:`sm`,tone:`current`,variant:`wander`}):null,t]}):(0,P.jsx)(Ln,{label:o,loading:i,onResultEnd:s,result:a,settled:p,children:t})})});function Mn(e,t,n){let r=(0,N.useRef)(null),i=(0,N.useRef)(null),a=(0,N.useRef)(null);(0,N.useLayoutEffect)(()=>{let o=e.current;if(!o)return;let s=JSON.stringify([t,n??null,o.textContent]),c=s!==i.current;i.current=s;let l=a.current;if(!c&&l)return;let u=l?o.offsetWidth:r.current;l&&(a.current=null,l.cancel(),o.style.removeProperty(`overflow`),o.style.removeProperty(`white-space`));let d=o.offsetWidth;if(r.current=d>0?d:null,!c||u===null||d===0||Math.abs(u-d)<1||!U(o))return;let f=V(o);if(f.reduced)return;let p=o.animate([{width:`${String(u)}px`},{width:`${String(d)}px`}],{duration:f.normal,easing:H(f,f.ease)});a.current=p,o.style.overflow=`clip`,o.style.whiteSpace=`nowrap`;let m=()=>{a.current===p&&(a.current=null,o.style.removeProperty(`overflow`),o.style.removeProperty(`white-space`))};p.onfinish=m,p.oncancel=m})}var Nn=1100;function Pn(e,t){let n=t.bounce/.3,r=1+.05*Math.min(1.4,.4+n),i=1-.02*Math.min(1.4,n);return e.animate([{transform:`scale(1)`},{transform:`scale(${String(r)})`,offset:.35},{transform:`scale(${String(i)})`,offset:.7},{transform:`scale(1)`}],{duration:t.springDuration,easing:H(t,`ease-out`)})}function Fn(e,t){let n=t.shake;return e.animate([{transform:`none`},{transform:`translateX(${String(-n)}px)`},{transform:`translateX(${String(n)}px)`},{transform:`translateX(${String(-n*.6)}px)`},{transform:`translateX(${String(n*.3)}px)`},{transform:`none`}],{duration:t.slow*1.3,easing:H(t,`linear`)})}function In(e,t,n){let r=n.distance+2,i=`blur(${String(n.blur)}px)`;return[e.animate([{opacity:1,transform:`none`,filter:`blur(0px)`},{opacity:0,transform:`translateY(${String(-r)}px)`,filter:i}],{duration:n.fast,easing:H(n,n.ease)}),t.animate([{opacity:0,transform:`translateY(${String(r)}px)`,filter:i},{opacity:1,transform:`none`,filter:`blur(0px)`}],{duration:n.normal,easing:H(n,n.ease),fill:`backwards`})]}function Ln({children:e,label:t,loading:n,onResultEnd:r,result:i,settled:a}){let o=(0,N.useRef)(null),s=fn(),[c,l]=(0,N.useState)(!1),[u,d]=(0,N.useState)(!1);c&&!u&&d(!0);let f=(0,N.useRef)(a),p=(0,N.useRef)(r);(0,N.useEffect)(()=>{p.current=r},[r]),(0,N.useLayoutEffect)(()=>{let e=f.current;if(f.current=i,i===e)return;if(i===`done`){l(!0);let e=setTimeout(()=>{p.current?p.current():l(!1)},Nn);return()=>{clearTimeout(e)}}l(!1);let t=o.current;if(i!==`failed`||!t||!U(t))return;let n=V(t);if(n.shake<=0)return;let r=Fn(t,n);return()=>{r.cancel()}},[i,s]);let m=(0,N.useRef)(c);return(0,N.useLayoutEffect)(()=>{let e=o.current;if(!e||m.current===c)return;m.current=c;let t=e.querySelector(`[data-face="label"]`),n=e.querySelector(`[data-face="result"]`);if(!t||!n||!U(e)){c||d(!1);return}let r=V(e),i=c?In(t,n,r):In(n,t,r);if(c||i[0]?.addEventListener(`finish`,()=>{d(!1)}),c&&!r.reduced){i.push(Pn(e.closest(`button`)??e,r));let t=n.querySelector(`path`);t&&i.push(t.animate([{strokeDashoffset:1},{strokeDashoffset:0}],{duration:r.normal*1.4,delay:r.fast/2,easing:H(r,r.ease),fill:`backwards`}))}return()=>{for(let e of i)e.cancel()}},[c,s]),(0,P.jsxs)(`span`,{ref:o,className:`caps-button-faces`,"data-showing":c?`result`:`label`,children:[(0,P.jsxs)(`span`,{className:`caps-button-face`,"data-face":`label`,"aria-hidden":c?!0:void 0,children:[n||c?(0,P.jsx)(W,{decorative:!0,size:`sm`,tone:`current`,variant:`wander`}):null,e]}),u?(0,P.jsxs)(`span`,{className:`caps-button-face`,"data-face":`result`,"aria-hidden":!c||void 0,children:[(0,P.jsx)(`svg`,{className:`caps-button-check`,viewBox:`0 0 24 24`,"aria-hidden":`true`,focusable:`false`,children:(0,P.jsx)(`path`,{d:`M4.5 12.5 9.5 17.5 19.5 6.5`,pathLength:1})}),t===void 0?e:t]}):null]})}var Rn={xs:`size-3`,sm:`size-[var(--stipe-icon-size-sm)]`,md:`size-[var(--stipe-icon-size-md)]`,lg:`size-[var(--stipe-icon-size-lg)]`},zn=(0,N.forwardRef)(function({active:e=!1,icon:t,iconSize:n=`xs`,className:r,reveal:i=!1,size:a=`xs`,tone:o=`default`,variant:s=`ghost`,...c},l){let u=a===`responsive`;return(0,P.jsx)(jn,{...c,resultLabel:c.result===void 0?void 0:null,ref:l,size:u?`sm`:a,variant:s,className:A(`caps-icon-button btn-circle`,u&&`caps-icon-button-responsive md:btn-xs`,e&&`text-accent`,i&&`scale-0 transition-transform group-hover:scale-100 focus-visible:scale-100`,o===`destructive`&&`hover:text-error`,r),children:(0,P.jsx)(`span`,{"aria-hidden":`true`,className:A(`inline-flex shrink-0 [&>svg]:size-full [&>svg]:[stroke-width:var(--stipe-icon-stroke)]`,Rn[n]),children:t})})}),Bn=Object.freeze({ease:`linear`,duration:0});function Vn(e,t){let n=sn(e,t.duration);return n<=0?Bn:e.steps>0?{ease:mn(e.steps),duration:n}:{ease:Ve({bounce:on(e,t.bounce),duration:n}),duration:n}}function Hn(e,t){let n=an(e,t.duration);return{ease:e.steps>0?mn(e.steps):t.ease,duration:n}}var Un=ce(`Check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),Wn=ce(`RotateCcw`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}]]),Gn=ce(`X`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]);h({operation:x(`read-library`),computerId:l});var G=C.pipe(D(E(4096)),D(Fe(e=>e.startsWith(`/`)&&e!==`/`&&!e.includes(`\0`)&&!e.endsWith(`/`)&&!e.split(`/`).some(e=>e===`.`||e===`..`))));h({path:c(G)});var Kn=`modulepreload`,qn=function(e,t){return new URL(e,t).href},Jn={},Yn=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function s(e){return import.meta.resolve?import.meta.resolve(e):new URL(e,import.meta.url).href}r=o(t.map(t=>{if(t=qn(t,n),t=s(t),t in Jn)return;Jn[t]=!0;let r=t.endsWith(`.css`);for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}let i=document.createElement(`link`);if(i.rel=r?`stylesheet`:Kn,r||(i.as=`script`),i.crossOrigin=``,i.href=t,a&&i.setAttribute(`nonce`,a),document.head.appendChild(i),r)return new Promise((e,n)=>{i.addEventListener(`load`,e),i.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})};function Xn(e,t){return e.computerId===void 0||e.computerId===t}var Zn=`@cf/black-forest-labs/flux-2-klein-4b`,Qn=`Image creation is unavailable for this Computer right now.`,K={landscape:{height:768,width:1024},portrait:{height:1024,width:768},square:{height:1024,width:1024}},$n=[`landscape`,`portrait`,`square`];function er(e){return e instanceof De&&e.stage===`provider`&&e.provider!==void 0&&`reason`in e.provider&&e.provider.reason===`credits_exhausted`}function tr(e){return er(e)?{title:`AI Gateway credits unavailable`,message:`Cloudflare AI Gateway couldn't fund this request. Check the account's credits and billing in the Cloudflare dashboard under AI Gateway, or choose a Workers AI model such as Flux.${e.code===`MEDIA_PROVIDER_FAILURE_UNCHARGED`?` You weren't charged.`:``}`,retryable:!1}:Re(e,{INSUFFICIENT_CREDIT:{title:`Couldn’t create image`,message:`Media generation needs Team credits. Add credits in Billing, then retry.`}})}function nr(){return{destination:void 0,height:768,model:Zn,prompt:``,references:[],steps:void 0,width:1024}}function rr(e,t,n=`png`){if(e.trim().length===0)throw Error(`Media generation token must not be empty.`);let r=e.trim();if(!/^[a-zA-Z0-9]+(?:-[a-zA-Z0-9]+)*$/.test(r))throw Error(`Media generation basename contains invalid characters.`);return`${t.replace(/\/$/,``)}/generated-${r}.${n}`}function ir(e,t,n){let r=e.destination?.trim();if(r)return r;let i=n?.outputFormats.includes(`png`)?`png`:n?.outputFormats[0]??`png`,a=n?.kind===`video`?`mp4`:i===`jpeg`?`jpg`:i;return rr(Tt({count:4}),t,a)}function ar(e){return e?.kind===`video`?`Generate video`:`Generate image`}function or(e,t,n=!1){if(e===void 0)return`Creating media…`;if(e.kind!==`video`)return`Creating image…`;if(t===void 0)return`Creating video… Videos take about 2 minutes`;let r=Math.max(0,Math.floor(t/1e3));return`Creating video… ${String(Math.floor(r/60))}:${String(r%60).padStart(2,`0`)} elapsed${n?` since reopening`:``} · Videos take about 2 minutes`}var sr=(e,t)=>t===0?e:sr(t,e%t),cr=(e,t,n)=>{if(n!==void 0)return`${String(e)} × ${String(t)} · ${String(n[0])}:${String(n[1])}`;let r=sr(e,t);return`${String(e)} × ${String(t)} · ${String(e/r)}:${String(t/r)}`},lr=[[16,9],[21,9]],q=16;function ur(e){let t=e.input.maxDimension;if(e.kind!==`image`||e.input.dimensions!==`own`||!e.input.maxDimensionDocumented||t===null)return[];let n=Math.floor(t/q)*q;return lr.map(([e,t])=>{let r=Math.round(n*t/e/q)*q;return{value:`${String(n)}x${String(r)}`,label:cr(n,r,[e,t]),width:n,height:r}})}function dr(e,t,n){if(e?.input.dimensions===`none`)return null;let r=e?.video?.formats.find(e=>e.width===t&&e.height===n);if(r!==void 0)return`${r.resolution} ${r.aspectRatio}`;let i=sr(t,n),a=t/i,o=n/i;return a<=21&&o<=21?`${String(a)}:${String(o)}`:`${String(t)} × ${String(n)}`}function fr(e){return e?.video!==void 0&&e.video!==null?e.video.formats.map(e=>({value:`${String(e.width)}x${String(e.height)}`,label:`${e.resolution} · ${e.aspectRatio} · ${String(e.width)} × ${String(e.height)}`,width:e.width,height:e.height})):e!==void 0&&e.sizes!==null?e.sizes.flatMap(e=>{let t=/^(\d+)x(\d+)$/u.exec(e);if(t===null)return[];let n=Number(t[1]),r=Number(t[2]);return[{value:e,label:cr(n,r),width:n,height:r}]}):[...$n.map(e=>({value:e,label:cr(K[e].width,K[e].height),...K[e]})),...e===void 0?[]:ur(e)]}function pr(e,t,n){return n?.kind===`video`&&t.kind===`video`||t.input.dimensions!==`none`&&Le(Te(Cr(()=>t))({model:t.id,width:e.width,height:e.height}))?{width:e.width,height:e.height}:{width:t.input.defaultWidth,height:t.input.defaultHeight}}function mr(e){return e.label.split(` — `)[0]??e.label}function hr(e,t){return e.find(e=>e.id===t)}function gr(e,t){return{...e,height:t.input.defaultHeight,model:t.id,steps:t.input.steps===`fixed`?void 0:t.input.defaultSteps??void 0,durationSeconds:t.video?.defaultSeconds,generateAudio:t.video?.defaultGenerateAudio??void 0,width:t.input.defaultWidth}}var _r={"first-frame":`First frame`,"last-frame":`Last frame`,reference:`Reference`};function vr(e,t,n){let r=t[n]?.role,i=r===void 0?0:e.indexOf(r)+1;return[...e.slice(i),...e.slice(0,i)].find(e=>e!==r&&(e===`reference`||!t.some((t,r)=>r!==n&&t.role===e)))}function yr(e){return e?.video?.referenceRoles??[]}function br(e,t){let n=yr(t);if(t?.video==null)return e.map(({path:e,computerId:t})=>t===void 0?{path:e}:{path:e,computerId:t});let r=e.map(e=>e.role!==void 0&&n.includes(e.role)?e.role:void 0),i=e=>r.includes(e),a=n.includes(`last-frame`),o=i(`reference`)||!i(`first-frame`)&&!i(`last-frame`)&&e.length>(a?2:1);return e.map((e,t)=>{let s=r[t];return s===void 0&&(s=o&&n.includes(`reference`)?`reference`:!i(`first-frame`)&&n.includes(`first-frame`)?`first-frame`:a&&!i(`last-frame`)?`last-frame`:n.includes(`reference`)?`reference`:`first-frame`,r[t]=s),{...e,role:s}})}function xr(e,t,n){let r=t.video;if(r===null||e.length===0)return;let i=t=>e.filter(e=>e.role===t).length,a=i(`first-frame`),o=i(`last-frame`),s=i(`reference`);if(a>1||o>1)return r.referenceRoles.includes(`last-frame`)?`${t.label} takes one first frame and one last frame.`:`${t.label} takes one first frame.`;if(o>0&&a===0)return`A last frame needs a first frame as well.`;if(s>0&&a+o>0)return`Frames and references cannot be mixed. Use a first and last frame, or references.`;if(s>r.maxReferenceImages)return r.maxReferenceImages===0?`${t.label} takes no reference images.`:`${t.label} takes up to ${String(r.maxReferenceImages)} reference images.`;if(s>0&&n!==void 0&&!r.referenceResolutions.some(e=>e===n))return`${t.label} takes reference images only at ${r.referenceResolutions.join(`, `)}.`}function Sr(e,t){let n=t.video?.formats.find(t=>t.width===e.width&&t.height===e.height);if(t.kind===`video`&&n===void 0)throw Error(`Choose a supported video resolution and aspect ratio.`);let r={height:e.height,model:e.model,prompt:e.prompt.trim(),width:e.width};return n!==void 0&&(r.resolution=n.resolution,r.aspectRatio=n.aspectRatio),e.steps!==void 0&&(r.steps=e.steps),e.durationSeconds!==void 0&&(r.durationSeconds=e.durationSeconds),e.references.length>0&&(r.references=br(e.references,t)),t.video?.supportsAudio===!0&&e.generateAudio!==void 0&&(r.generateAudio=e.generateAudio),{destination:{path:e.destination?.trim()??``},settings:r}}function Cr(e){return h({model:C,width:S,height:S,durationSeconds:Ne(Oe(S)),steps:Ne(Oe(S))}).check(Fe(t=>{let n=e(t.model);if(!Number.isSafeInteger(t.width)||t.width<1)return{path:[`width`],issue:`Width must be a positive integer.`};if(!Number.isSafeInteger(t.height)||t.height<1)return{path:[`height`],issue:`Height must be a positive integer.`};if(n!==void 0){if(n.input.dimensions===`own`){let e=n.input.maxDimension??4096;if(t.width<256||t.height<256)return{path:[t.width<256?`width`:`height`],issue:`${n.label} requires dimensions of at least 256 × 256.`};if(t.width>e||t.height>e)return{path:[t.width>e?`width`:`height`],issue:`${n.label} accepts dimensions up to ${String(e)}.`}}if(n.sizes!==null&&!n.sizes.includes(`${String(t.width)}x${String(t.height)}`))return{path:[`width`],issue:`${n.label} accepts only these sizes: ${n.sizes.join(`, `)}.`};if(n.video!==null&&t.durationSeconds!==void 0&&(!Number.isSafeInteger(t.durationSeconds)||t.durationSeconds<n.video.minSeconds||t.durationSeconds>n.video.maxSeconds))return{path:[`durationSeconds`],issue:`${n.label} makes clips from ${String(n.video.minSeconds)} to ${String(n.video.maxSeconds)} seconds.`};if(n.input.steps===`fixed`&&t.steps!==void 0)return{path:[`steps`],issue:`${n.label} uses fixed steps.`};if(t.steps!==void 0&&(!Number.isSafeInteger(t.steps)||t.steps<1||n.input.maxSteps!==null&&t.steps>n.input.maxSteps))return{path:[`steps`],issue:`${n.label} accepts at most ${String(n.input.maxSteps??`the provider limit`)} steps.`}}}))}function wr(e,t){let n=e.trim().length;return n>t.maxPromptLength?{length:n,excess:n-t.maxPromptLength}:null}function Tr(e,t){if(e.destination?.trim().length===0)return`A destination file path is required.`;if(e.prompt.trim().length===0)return t?.kind===`video`?`Describe the video to generate.`:`Describe the image to generate.`;if(t===void 0)return`Choose a model from the granted registry.`;let n=wr(e.prompt,t);if(n!==null)return`${t.label} accepts prompts up to ${String(t.maxPromptLength)} characters; this one is ${String(n.length)}. Shorten it by ${String(n.excess)}.`;let r=Te(Cr(()=>t))(e);if(ee(r))return u()(r.failure.issue).issues.map(e=>e.message).join(` `);if(e.references.length>t.input.maxReferences)return`${t.label} accepts at most ${String(t.input.maxReferences)} reference images.`;if(e.references.length>0&&t.input.referenceField===null)return`${t.label} does not accept reference images.`;if(t.video!==null){let n=t.video.formats.find(t=>t.width===e.width&&t.height===e.height);return xr(br(e.references,t),t,n?.resolution)}}var J=l,Er=l.pipe(D(E(1024))),Dr=n(Er).pipe(D(E(200)));k([h({operation:x(`read-notices`),computerId:J}),h({operation:x(`dismiss-notices`),computerId:J,keys:Dr})]);var Or=h({keys:Dr});async function kr(e,t){return w(Or)(await e.require(L).request(JSON.stringify(t)))}k([h({operation:x(`read-folder`),computerId:J}),h({operation:x(`select-folder`),computerId:J,path:G})]);var Ar=h({path:G,configured:te});async function jr(e,t){return w(Ar)(await e.require(L).request(JSON.stringify(t)))}var Mr=2048,Nr=8e3,Pr=[{name:`Anime cel`,text:`Anime cel illustration with clean ink outlines, flat cel shading, and a limited palette of saturated colors. Soft painted backgrounds, expressive eyes, and crisp highlights, in the look of a hand-drawn animation frame.`},{name:`Cinematic film still`,text:`Cinematic film still shot on anamorphic lenses with shallow depth of field. Moody, motivated lighting, subtle film grain, and a considered color grade, composed like a frame from a feature film.`},{name:`Watercolor`,text:`Soft watercolor painting on textured paper, with translucent washes, visible pigment bleeds, and gentle color gradients. Loose brushwork, white paper left showing at the edges, and a calm, airy mood.`},{name:`Pixel art`,text:`Pixel art with a limited color palette, crisp square pixels, and no anti-aliasing. Clear readable silhouettes, dithered shading, and the charm of a classic 16-bit game sprite or scene.`},{name:`Product photo`,text:`Professional product photograph on a seamless studio background. Soft diffused lighting with gentle shadows, sharp focus across the subject, accurate colors, and clean, minimal composition suited to a catalog.`},{name:`Comic ink`,text:`Comic book panel with bold black ink linework, hatching and crosshatched shadows, and flat vivid colors. Dynamic angles, strong contrast, and a printed halftone texture.`}].map((e,t)=>({...e,id:-(t+1),builtIn:!0})),Y=C.pipe(D(ne(1)),D(E(64))),Fr=C.pipe(D(ne(1)),D(E(Nr))),X=l,Ir=h({id:b,name:Y,text:Fr,builtIn:te});k([h({operation:x(`list-styles`),computerId:X}),h({operation:x(`save-style`),computerId:X,id:oe(b),name:Y,text:Fr}),h({operation:x(`delete-style`),computerId:X,id:b}),h({operation:x(`read-print-style`),computerId:X,path:l})]);var Lr=h({styles:n(Ir).pipe(D(E(50+Pr.length)))}),Rr=h({style:c(Y)});function zr(e,t){let n=t.trim();return e===void 0?n:`${e.trim()}\n\n${n}`}function Br(e){return e?.maxPromptLength??Mr}function Vr(e,t,n,r=[]){if(e.length<=t)return;let i=`${String(e.length)} characters; this model accepts at most ${String(t)}.`,a=r.map(e=>`@${e}`).join(`, `);return n!==void 0&&a!==``?`The "${n}" style and your prompt with ${a} expanded total ${i}`:n===void 0?a===``?`The prompt is ${i}`:`Your prompt with ${a} expanded is ${i}`:`The "${n}" style and your prompt total ${i}`}var Z=e=>e.require(L),Q=e=>JSON.stringify(e),Hr=w(Lr);async function Ur(e,t){return Hr(await Z(e).request(Q({operation:`list-styles`,computerId:t})))}async function Wr(e,t,n){return Hr(await Z(e).request(Q({operation:`save-style`,computerId:t,id:n.id,name:n.name,text:n.text})))}async function Gr(e,t,n){return Hr(await Z(e).request(Q({operation:`delete-style`,computerId:t,id:n})))}async function Kr(e,t,n){return w(Rr)(await Z(e).request(Q({operation:`read-print-style`,computerId:t,path:n})))}var qr=8,Jr=C.pipe(D(ne(1)),D(E(32)),D(Ae(/^[\p{L}\p{N}_-]+$/u))),Yr=C.pipe(D(E(500))),Xr=l.pipe(D(E(4096))),Zr=n(h({path:Xr})).pipe(D(E(8))),Qr=l,$r=h({id:b,name:Jr,description:Yr,references:Zr});k([h({operation:x(`list-characters`),computerId:Qr}),h({operation:x(`save-character`),computerId:Qr,id:oe(b),name:Jr,description:Yr,references:Zr}),h({operation:x(`delete-character`),computerId:Qr,id:b})]);var ei=h({characters:n($r).pipe(D(E(50)))}),ti=(e,t)=>e.toLowerCase()===t.toLowerCase(),ni=/(?<![\p{L}\p{N}_@-])@([\p{L}\p{N}_-]+)/gu;function ri(e){let t=[];for(let n of e.matchAll(ni)){let e=n.at(1);e!==void 0&&!t.some(t=>ti(t,e))&&t.push(e)}return t}function ii(e,t){let n=[];return{prompt:e.replace(ni,(e,r)=>{let i=t.find(e=>ti(e.name,r));if(i===void 0)return e;let a=!n.includes(i);return a&&n.push(i),a&&i.description.trim()!==``?`${i.name} (${i.description.trim()})`:i.name}),characters:n}}function ai(e,t,n){let r=e.trim();return zr(t,ii(r,n).prompt).length-r.length}function oi(e,t){let n=ri(e),r=t.filter(e=>!n.some(t=>ti(t,e)));return r.length===0?e:`${r.map(e=>`@${e}`).join(` `)} ${e}`}function si(e,t,n){let r=(e,t)=>e.path===t&&(e.computerId===void 0||e.computerId===n),i=[...e];for(let e of t)for(let t of e.references)i.some(e=>r(e,t.path))||i.push({path:t.path});return i}function ci(e){let t=ii(oi(e.prompt,e.names??[]),e.saved),n=si(e.references,t.characters,e.computerId),r=n.length-e.references.length;if(e.model!==void 0&&r>0&&n.length>e.model.maxReferences){let n=t.characters.map(e=>e.name).join(`, `);return{kind:`refused`,message:e.model.maxReferences===0?`${e.model.label} does not take reference images, so it cannot use ${n}.`:`${n} add ${String(r)} reference ${r===1?`image`:`images`} to your ${String(e.references.length)}; ${e.model.label} accepts at most ${String(e.model.maxReferences)}.`}}return{kind:`ready`,prompt:t.prompt,references:n,characters:t.characters}}function li(e,t){let n=/(?<![\p{L}\p{N}_@-])@([\p{L}\p{N}_-]*)$/u.exec(e.slice(0,t));return n===null?null:{start:n.index,query:n.at(1)??``}}function ui(e,t){let n=t.toLowerCase(),r=e=>e.name.toLowerCase();return[...e.filter(e=>r(e).startsWith(n)),...e.filter(e=>!r(e).startsWith(n)&&r(e).includes(n))].slice(0,qr)}var di=e=>e.require(L),fi=e=>JSON.stringify(e),pi=w(ei);async function mi(e,t){return pi(await di(e).request(fi({operation:`list-characters`,computerId:t})))}async function hi(e,t,n){return pi(await di(e).request(fi({operation:`save-character`,computerId:t,id:n.id,name:n.name,description:n.description,references:n.references})))}async function gi(e,t,n){return pi(await di(e).request(fi({operation:`delete-character`,computerId:t,id:n})))}var $={models:e=>F.of(e,`prints`,`models`),folder:e=>F.of(e,`prints`,`folder`),dismissals:e=>F.of(e,`prints`,`dismissals`),styles:e=>F.of(e,`prints`,`styles`),printStyle:(e,t)=>F.of(e,`prints`,`print-style`,t),characters:e=>F.of(e,`prints`,`characters`)};function _i(e){return{...I(e,be,$.models(e),async(t,n)=>{if(!e)throw Error(`Prints is disconnected`);let r=await xe(e.capabilities);return n.throwIfAborted(),r}),enabled:!!(e?.context.get().computerId&&e.capabilities.has(be)),structuralSharing:!1}}function vi(e){let t=e?.context.get().computerId;return{...I(e,L,$.folder(e),async(n,r)=>{if(!e||!t)throw Error(`No Computer selected`);let i=await jr(e.capabilities,{operation:`read-folder`,computerId:t});if(r.throwIfAborted(),e.context.get().computerId!==t)throw new g(`Computer selection changed`,{code:`SELECTION_CHANGED`,retryable:!1});return i}),enabled:!!(t&&e.capabilities.has(L))}}function yi(e){let t=e?.context.get().computerId;return{...I(e,L,$.dismissals(e),async(n,r)=>{if(!e||!t)throw Error(`No Computer selected`);let i=await kr(e.capabilities,{operation:`read-notices`,computerId:t});return r.throwIfAborted(),i}),enabled:!!(t&&e.capabilities.has(L))}}function bi(e){let t=e?.context.get().computerId;return{...I(e,L,$.styles(e),async(n,r)=>{if(!e||!t)throw Error(`No Computer selected`);let i=await Ur(e.capabilities,t);return r.throwIfAborted(),i}),enabled:!!(t&&e.capabilities.has(L))}}function xi(e,t){let n=e?.context.get().computerId;return{...I(e,L,$.printStyle(e,t??``),async(r,i)=>{if(!e||!n||t===null)throw Error(`No print selected`);let a=await Kr(e.capabilities,n,t);return i.throwIfAborted(),a}),enabled:!!(n&&t!==null&&e.capabilities.has(L))}}function Si(e){let t=e?.context.get().computerId;return{...I(e,L,$.characters(e),async(n,r)=>{if(!e||!t)throw Error(`No Computer selected`);let i=await mi(e.capabilities,t);return r.throwIfAborted(),i}),enabled:!!(t&&e.capabilities.has(L))}}function Ci({checked:e}){let t=`caps-switch-${(0,N.useId)().replaceAll(`:`,``)}`,n=(0,N.useRef)(null),r=(0,N.useRef)(null),i=(0,N.useRef)(e).current,a=(0,N.useRef)(e),o=fn();return(0,N.useLayoutEffect)(()=>{if(!n.current||!r.current)return;let t=o||a.current===e;a.current=e;let i=e?16:8,s=V(n.current),c=Vn(s,{bounce:.25,duration:440}),l=Hn(s,{ease:`inOutSine`,duration:100}),u=Ue(n.current,t?{x:2,y:2,width:i,height:8,duration:0}:{x:[{to:e?2.5:1.5,...l},{to:2,...c}],y:[{to:1.5,...l},{to:2,...c}],height:[{to:9,...l},{to:8,...c}],width:[{to:e?7:16.5,...l},{to:i,...c}]}),d=Ue(r.current,{gradientTransform:e?`matrix(2 0 0 1 10 6)`:`matrix(1 0 0 1 6 6)`,...t?{duration:0}:{delay:l.duration,...c}});return()=>{u.cancel(),d.cancel()}},[e,o]),(0,P.jsxs)(`svg`,{className:`caps-switch-visual`,width:`40`,height:`24`,viewBox:`0 0 20 12`,"aria-hidden":`true`,focusable:`false`,children:[(0,P.jsxs)(`defs`,{children:[(0,P.jsx)(hn,{ref:r,id:`${t}-surface`,transform:i?`matrix(2 0 0 1 10 6)`:`matrix(1 0 0 1 6 6)`}),(0,P.jsx)(gn,{id:`${t}-shadow`}),(0,P.jsx)(_n,{id:`${t}-inset`}),(0,P.jsx)(`clipPath`,{id:`${t}-track`,children:(0,P.jsx)(`rect`,{x:`1`,y:`1`,width:`18`,height:`10`,rx:`5`})})]}),(0,P.jsx)(`rect`,{className:`caps-switch-track`,filter:`url(#${t}-inset)`,x:`0.5`,y:`0.5`,width:`19`,height:`11`,rx:`5.5`}),(0,P.jsx)(`g`,{clipPath:`url(#${t}-track)`,children:(0,P.jsx)(`rect`,{ref:n,x:`2`,y:`2`,width:i?16:8,height:`8`,rx:`4`,fill:`url(#${t}-surface)`,filter:`url(#${t}-shadow)`})})]})}var wi=(0,N.forwardRef)(function({className:e,checked:t,defaultChecked:n=!1,onChange:r,onCheckedChange:i,...a},o){let s=(0,N.useRef)(null),[c,l]=(0,N.useState)(n),u=t??c;return(0,N.useImperativeHandle)(o,()=>{if(!s.current)throw Error(`Switch input is not mounted`);return s.current},[]),(0,N.useEffect)(()=>{let e=s.current?.form;if(!e||t!==void 0)return;let r=e=>{queueMicrotask(()=>{!e.defaultPrevented&&s.current&&l(n)})};return e.addEventListener(`reset`,r),()=>{e.removeEventListener(`reset`,r)}},[t,n,a.form]),(0,P.jsxs)(`span`,{className:`caps-switch`,"data-checked":u,children:[(0,P.jsx)(`input`,{...a,checked:u,className:A(`caps-switch-input`,e),onChange:e=>{t===void 0&&l(e.target.checked),r?.(e),i?.(e.target.checked)},ref:s,role:`switch`,type:`checkbox`}),(0,P.jsx)(Ci,{checked:u})]})}),Ti=(0,N.forwardRef)(function({className:e,density:t=`regular`,...n},r){return(0,P.jsx)(`ul`,{...n,className:A(`list`,t===`compact`&&`list-sm`,e),ref:r})}),Ei=(0,N.forwardRef)(function({className:e,...t},n){return(0,P.jsx)(`li`,{...t,className:A(`list-row`,e),ref:n})});(0,N.forwardRef)(function({className:e,icon:t,label:n,children:r,...i},a){return(0,P.jsxs)(`li`,{...i,className:A(`list-row caps-fact`,e),ref:a,children:[(0,P.jsxs)(`span`,{className:`caps-fact-label`,children:[t?(0,P.jsx)(`span`,{className:`caps-fact-icon`,"aria-hidden":`true`,children:t}):null,n]}),(0,P.jsx)(`span`,{className:`caps-fact-value`,children:r})]})});var Di=(0,N.forwardRef)(function({aside:e,children:t,className:n,level:r=2,...i},a){return(0,P.jsxs)(r===3?`h3`:`h2`,{...i,className:A(`caps-data-list-heading`,n),ref:a,children:[(0,P.jsx)(`span`,{children:t}),e===void 0?null:(0,P.jsx)(`span`,{className:`caps-data-list-heading-aside`,children:e})]})});export{Gn as $,_r as A,At,Xn as B,dt as Bt,Br as C,Vt as Ct,jr as D,jt as Dt,kr as E,L as Et,gr as F,_t as Ft,yr as G,mr as H,Qe as Ht,ar as I,gt as It,fr as J,br as K,ir as L,ft as Lt,K as M,yt as Mt,nr as N,vt as Nt,Zn as O,I as Ot,tr as P,ht as Pt,G as Q,Sr as R,mt as Rt,Vr as S,zt as St,Y as T,Lt as Tt,vr as U,Ke as Ut,hr as V,ct as Vt,xr as W,qe as Wt,Tr as X,pr as Y,Yn as Z,ci as _,an as _t,vi as a,zn as at,zr as b,fn as bt,xi as c,bn as ct,bi as d,gn as dt,Wn as et,ai as f,hn as ft,li as g,H as gt,ii as h,U as ht,wi as i,Vn as it,$n as j,F as jt,Qn as k,kt,$ as l,yn as lt,gi as m,pn as mt,Di as n,Bn as nt,_i as o,jn as ot,Jr as p,vn as pt,dr as q,Ei as r,Hn as rt,yi as s,W as st,Ti as t,Un as tt,Si as u,_n as ut,hi as v,V as vt,Wr as w,Rt as wt,Gr as x,Bt as xt,ui as y,rn as yt,or as z,pt as zt};
|