@fungi.computer/prints 0.10.25 → 0.10.27
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-B1QNh92h.js → data-list-XRmQUP8_.js} +1 -1
- package/dist/assets/{index-DWmyNBns.js → index-BSfy-57J.js} +3 -3
- package/dist/assets/{log-event-GKCGl2Xo.js → log-event-CuAUsjqK.js} +1 -1
- package/dist/assets/{media-BQCjwzlh.js → media-DlmW7SfA.js} +1 -1
- package/dist/assets/{print-download-button-BxrQk-8w.js → print-download-button-B-SmBDH9.js} +1 -1
- package/dist/assets/{print-info-drawer-CTtxo6Ib.js → print-info-drawer-BCIEBOgU.js} +2 -2
- package/dist/index.html +4 -4
- package/package.json +6 -6
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{$t as t,An as n,At as r,Bn as i,Bt as a,C as o,Cn as s,D as c,Dr as l,Dt as u,En as d,Et as ee,F as f,Ft as p,Gt as m,Hn as h,Ht as g,It as _,Jt as te,Kt as v,Lt as y,M as ne,Mt as b,N as re,Nt as ie,O as x,On as ae,Ot as oe,Pt as se,Qt as ce,Rn as S,Rt as le,T as ue,Un as de,Ut as fe,Vn as pe,Vt as C,Wt as me,Xt as w,Zt as he,_ as ge,_n as T,an as E,ar as _e,bn as D,c as O,cn as k,dn as A,en as ve,fn as j,g as ye,gn as be,h as xe,hi as Se,in as Ce,j as we,jt as Te,kn as Ee,kt as De,ln as Oe,mn as M,n as ke,o as Ae,on as je,or as Me,pn as Ne,qr as Pe,qt as Fe,rn as Ie,sn as Le,sr as Re,t as ze,ti as Be,tn as N,w as Ve,wn as P,x as He,yn as F,zn as I,zt as Ue}from"./media-BQCjwzlh.js";import{a as We,i as Ge,n as Ke,o as qe,r as Je}from"./modules-C4mfDnjH.js";function Ye(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=>{_(e,()=>t.signal,()=>n=!0)},u=Ue(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?le:y;return{pages:c(e.pages,o,s),pageParams:c(e.pageParams,r,s)}};if(i&&a.length){let e=i===`backward`,t=e?Xe:L,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:L(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 L(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 Xe(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}function Ze(e,t){return t?L(e,t)!=null:!1}function Qe(e,t){return!t||!e.getPreviousPageParam?!1:Xe(e,t)!=null}var $e=class extends u{#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=nt(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=nt(this.options);e.data!==void 0&&(this.setState(tt(e.data,e.dataUpdatedAt)),this.#t=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus===`idle`&&this.#r.remove(this)}setData(e,t){let n=te(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(v).catch(v):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=>w(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===t||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0&&this.observers.some(e=>w(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:!ve(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,i=e=>{Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(this.#s=!0,n.signal)})},a=()=>{let e=Ue(this.options,t),n=(()=>{let e={client:this.#i,queryKey:this.queryKey,meta:this.meta};return i(e),e})();return this.#s=!1,this.options.persister?this.options.persister(e,n,this):e(n)},o=(()=>{let e={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#i,state:this.state,fetchFn:a};return i(e),e})();(this.#e===`infinite`?Ye(this.options.pages):this.options.behavior)?.onFetch(o,this),this.#n=this.state,(this.state.fetchStatus===`idle`||this.state.fetchMeta!==o.fetchOptions?.meta)&&this.#c({type:`fetch`,meta:o.fetchOptions?.meta});let s=this.#a=r({initialPromise:t?.initialPromise,fn:o.fetchFn,onCancel:e=>{e instanceof oe&&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:o.options.retry,retryDelay:o.options.retryDelay,networkMode:o.options.networkMode,canRun:()=>!0});try{let e=await s.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 oe){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===s&&(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,...et(t.data,this.options),fetchMeta:e.meta??null};case`success`:let n={...t,...tt(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),b.batch(()=>{this.observers.slice().forEach(e=>{e.onQueryUpdate()}),this.#r.notify({query:this,type:`updated`,action:e})})}};function et(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:De(t.networkMode)?`fetching`:`paused`,...e===void 0&&{error:null,status:`pending`}}}function tt(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:`success`}}function nt(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 rt=class extends se{#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),at(this.#t,this.options)?this.#m():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return ot(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return ot(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#b(),this.#x(),this.#t.removeObserver(this)}setOptions(e){let t=this.options,n=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 w(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),t._defaulted&&!he(this.options,t)&&this.#e.getQueryCache().notify({type:`observerOptionsUpdated`,query:this.#t,observer:this});let r=this.hasListeners();r&&st(this.#t,n,this.options,t)&&this.#m(),this.updateResult(),r&&(this.#t!==n||w(this.options.enabled,this.#t)!==w(t.enabled,this.#t)||w(this.options.staleTime,this.#t)!==w(t.staleTime,this.#t))&&this.#g();let i=this.#_();r&&(this.#t!==n||w(this.options.enabled,this.#t)!==w(t.enabled,this.#t)||i!==this.#f)&&this.#v(i)}getOptimisticResult(e){let t=this.#e.getQueryCache().build(this.#e,e),n=this.createResult(t,e);return he(this.getCurrentResult(),n)||(this.#r=n,this.#a=this.options,this.#i=this.#t.state),n}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(v)),t}#h(e){return!p()&&w(this.options.enabled,this.#t)!==!1&&fe(e)}#g(){this.#b();let e=w(this.options.staleTime,this.#t);if(this.#r.isStale||!this.#h(e))return;let t=ve(this.#r.dataUpdatedAt,e)+1;this.#u=N.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=N.setInterval(()=>{(this.options.refetchIntervalInBackground||ie.isFocused())&&this.#m()},this.#f))}#y(){this.#g(),this.#v(this.#_())}#b(){this.#u!==void 0&&(N.clearTimeout(this.#u),this.#u=void 0)}#x(){this.#d!==void 0&&(N.clearInterval(this.#d),this.#d=void 0)}createResult(e,t){let n=this.#t,r=this.options,i=this.#r,a=this.#i,o=this.#a,s=e===n?this.#n:e.state,{state:c}=e,l={...c},u=!1,d;if(t._optimisticResults){let i=this.hasListeners(),a=!i&&at(e,t),o=i&&st(e,n,t,r);(a||o)&&(l={...l,...et(c.data,e.options)}),t._optimisticResults===`isRestoring`&&(l.fetchStatus=`idle`)}let{error:ee,errorUpdatedAt:f,status:p}=l;d=l.data;let m=!1;if(t.placeholderData!==void 0&&d===void 0&&p===`pending`){let e;i?.isPlaceholderData&&t.placeholderData===o?.placeholderData?(e=i.data,m=!0):e=typeof t.placeholderData==`function`?t.placeholderData(this.#l?.state.data,this.#l):t.placeholderData,e!==void 0&&(p=`success`,d=te(i?.data,e,t),u=!0)}if(t.select&&d!==void 0&&!m){if(i&&d===a?.data&&t.select===this.#s)d=this.#c;else try{this.#s=t.select,d=t.select(d),d=te(i?.data,d,t),this.#c=d,this.#o=null}catch(e){this.#o=e}}else d===void 0&&(this.#o=null);this.#o&&(ee=this.#o,d=this.#c,f=Date.now(),p=`error`,u=!1);let h=l.fetchStatus===`fetching`,g=p===`pending`,_=p===`error`,v=g&&h,y=d!==void 0;return{status:p,fetchStatus:l.fetchStatus,isPending:g,isSuccess:p===`success`,isError:_,isInitialLoading:v,isLoading:v,data:d,dataUpdatedAt:l.dataUpdatedAt,error:ee,errorUpdatedAt:f,failureCount:l.fetchFailureCount,failureReason:l.fetchFailureReason,errorUpdateCount:l.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:l.dataUpdateCount>s.dataUpdateCount||l.errorUpdateCount>s.errorUpdateCount,isFetching:h,isRefetching:h&&!g,isLoadingError:_&&!y,isPaused:l.fetchStatus===`paused`,isPlaceholderData:u,isRefetchError:_&&y,isStale:ct(e,t),refetch:this.refetch,isEnabled:w(t.enabled,e)!==!1}}updateResult(){let e=this.#r,t=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),he(t,e))return;this.#r=t;let n=(()=>{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)})})();b.batch(()=>{n&&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 it(e,t){return w(t.enabled,e)!==!1&&e.state.data===void 0&&(e.state.status!==`error`||w(t.retryOnMount,e)!==!1)}function at(e,t){return it(e,t)||e.state.data!==void 0&&ot(e,t,t.refetchOnMount)}function ot(e,t,n){if(w(t.enabled,e)!==!1&&w(t.staleTime,e)!==`static`){let r=typeof n==`function`?n(e):n;return r===`always`||r!==!1&&ct(e,t)}return!1}function st(e,t,n,r){return(e!==t||w(r.enabled,e)===!1)&&(!n.suspense||e.state.status!==`error`)&&ct(e,n)}function ct(e,t){return w(t.enabled,e)!==!1&&e.isStaleByTime(w(t.staleTime,e))}var lt=class extends se{#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 ee({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=R(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=R(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=R(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=R(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){b.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=>me(t,e))}findAll(e={}){return this.getAll().filter(t=>me(e,t))}notify(e){b.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return b.batch(()=>Promise.all(e.map(e=>e.continue().catch(v))))}};function R(e){return e.options.scope?.id}var ut=class extends se{#e;constructor(e={}){super(),this.config=e,this.#e=new Map}build(e,t,n){let r=t.queryKey,i=t.queryHash??g(r,t),a=this.get(i);return a||(a=new $e({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(){b.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=>m(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>m(e,t)):t}notify(e){b.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){b.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){b.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},dt=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new ut,this.#t=e.mutationCache||new lt,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=ie.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=Te.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(w(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,o=a(t,i);if(o!==void 0)return this.#e.build(this,r).setData(o,{...n,manual:!0})}setQueriesData(e,t,n){return b.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;b.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return b.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=b.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(v).catch(v)}invalidateQueries(e,t={}){return b.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=b.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(v)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(v)}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(w(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(w(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(v).catch(v)}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(v).catch(v)}ensureInfiniteQueryData(e){return e._type=`infinite`,this.ensureQueryData(e)}resumePausedMutations(){return Te.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(C(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{Fe(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(C(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{Fe(e,t.mutationKey)&&Object.assign(n,t.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;let n={...this.#n.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return n.queryHash||=g(n.queryKey,n),n.refetchOnReconnect===void 0&&(n.refetchOnReconnect=n.networkMode!==`always`),n.throwOnError===void 0&&(n.throwOnError=!!n.suspense),!n.networkMode&&n.persister&&(n.networkMode=`offlineFirst`),n.queryFn===t&&(n.enabled=!1),n}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()}},z=e(Se(),1),ft=z.createContext(!1),pt=()=>z.useContext(ft);ft.Provider;var B=Ce();function mt(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var ht=z.createContext(mt()),gt=()=>z.useContext(ht),_t=(e,t,n)=>{let r=n?.state.error&&typeof e.throwOnError==`function`?ce(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||r)&&(t.isReset()||(e.retryOnMount=!1))},vt=e=>{z.useEffect(()=>{e.clearReset()},[e])},yt=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||ce(n,[e.error,r])),bt=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))}},xt=(e,t)=>e?.suspense&&t.isPending,St=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function Ct(e,t,n){let r=pt(),i=gt(),a=Ie(n),o=a.defaultQueryOptions(e),s=a.getQueryCache().get(o.queryHash),c=e.subscribed!==!1;o._optimisticResults=r?`isRestoring`:c?`optimistic`:void 0,bt(o),_t(o,i,s),vt(i);let[l]=z.useState(()=>new t(a,o)),u=l.getOptimisticResult(o),d=!r&&c;if(z.useSyncExternalStore(z.useCallback(e=>{let t=d?l.subscribe(b.batchCalls(e)):v;return l.updateResult(),t},[l,d]),()=>l.getCurrentResult(),()=>l.getCurrentResult()),z.useEffect(()=>{l.setOptions(o)},[o,l]),xt(o,u))throw St(o,l,i);if(yt({result:u,errorResetBoundary:i,throwOnError:o.throwOnError,query:s,suspense:o.suspense}))throw u.error;return o.notifyOnChangeProps?u:l.trackResult(u)}function wt(e,t){return Ct(e,rt,t)}function Tt(e){return e}function Et(e){return e}var Dt=`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(`.`),Ot=`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 kt(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 At(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=[kt(Dt)];for(let e=1;e<t;e++)r.push(kt(Ot));return r.join(n)}function jt(e){return e instanceof E?e:new E(`App operation failed`,{cause:e,code:`HOST_FAILURE`,retryable:!1})}var Mt=new WeakMap,V={of(e,...t){return[e?.identity.surfaceId??null,e?.context.get().computerId??null,...t]}};function Nt(e){let t={};return e&&Mt.set(t,e),t}function Pt(){let e=new dt({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&&Mt.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 H(e,t,n,r){let i=e?.context.get().computerId;return Tt({queryKey:n,meta:Nt(e),enabled:e!==null,retry:!1,queryFn:async({signal:n})=>{try{if(!e)throw new E(`No App connection`,{code:`DISCONNECTED`,retryable:!0});if(e.context.get().computerId!==i)throw new E(`The selected Computer changed`,{code:`SELECTION_CHANGED`,retryable:!1});return await r(e.capabilities.require(t),n)}catch(e){throw jt(e)}}})}function Ft(e){return Et({mutationKey:e.queryKey,scope:{id:C(e.queryKey)},mutationFn:async(t,n)=>{try{return await e.mutationFn(t,n)}catch(e){throw jt(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 U=f(`app.backend`,1,Pe(()=>ne({request:re(we(Be().transform(e=>l(e))))}))),It=f(`app.methods`,1,Pe(()=>ne({call:re(we(Be().transform(e=>l(e))))}))),Lt=(0,z.forwardRef)(function({className:e,size:t=`md`,depth:n=`shallow`,placement:r=`standalone`,...i},a){return(0,B.jsx)(`div`,{...i,ref:a,"data-surface-size":t,"data-surface-depth":n,"data-surface-placement":r,className:x(`caps-surface`,e)})}),Rt=(0,z.forwardRef)(function({className:e,...t},n){return(0,B.jsx)(`div`,{...t,ref:n,className:x(`caps-screen`,e)})});(0,z.forwardRef)(function({children:e,className:t,depth:n=`deep`,fit:r=`content`,density:i=`normal`,...a},o){let s=r===`fill`;return(0,B.jsx)(Lt,{...a,className:x(t,s&&`flex min-h-0 flex-1`),depth:n,ref:o,children:(0,B.jsx)(`div`,{className:x(`caps-display-gasket`,s&&`flex min-h-0 min-w-0 flex-1`),"data-display-density":i,children:(0,B.jsx)(Rt,{className:x(s&&`flex min-h-0 min-w-0 flex-1 overflow-hidden`),children:e})})})}),(0,z.forwardRef)(function({className:e,icon:t,status:n,title:r,...i},a){return(0,B.jsxs)(`header`,{...i,className:x(`caps-screen-header`,e),ref:a,children:[t?(0,B.jsx)(`span`,{className:`caps-screen-header-icon`,"aria-hidden":`true`,children:t}):null,(0,B.jsx)(`span`,{className:`caps-screen-header-title`,children:r}),n?(0,B.jsx)(`span`,{className:`caps-screen-header-status`,children:n}):null]})}),(0,z.forwardRef)(function({appearance:e,className:t,...n},r){return(0,B.jsx)(`div`,{...n,className:x(`caps-screen-cells`,t),"data-appearance":e===`compact`?e:void 0,ref:r})}),(0,z.forwardRef)(function({children:e,className:t,legend:n,readout:r,icon:i,appearance:a,wide:o=!1,...s},c){return(0,B.jsxs)(`div`,{...s,className:x(`caps-screen-cell`,t),"data-wide":o||void 0,"data-appearance":a===`compact`?a:void 0,ref:c,children:[i?(0,B.jsx)(`span`,{className:`caps-screen-cell-icon`,children:i}):null,n?(0,B.jsx)(`span`,{className:`caps-screen-cell-legend`,children:n}):null,r?(0,B.jsx)(`span`,{className:`caps-screen-cell-readout`,children:r}):null,a===`compact`?(0,B.jsx)(`div`,{className:`caps-screen-cell-controls`,children:e}):e]})});var zt=(e=10,t)=>{let n=t?Ge:qe;return t=>n(We(t,0,1)*e)*(1/e)},Bt=Object.freeze({ease:`linear`,duration:0});function Vt(e,t){let n=o(e,t.duration);return n<=0?Bt:e.steps>0?{ease:zt(e.steps),duration:n}:{ease:Ke({bounce:He(e,t.bounce),duration:n}),duration:n}}function Ht(e,t){let n=Ve(e,t.duration);return{ease:e.steps>0?zt(e.steps):t.ease,duration:n}}var Ut=O(`Check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),Wt=O(`FileImage`,[[`path`,{d:`M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z`,key:`1rqfz7`}],[`path`,{d:`M14 2v4a2 2 0 0 0 2 2h4`,key:`tnqrlb`}],[`circle`,{cx:`10`,cy:`12`,r:`2`,key:`737tya`}],[`path`,{d:`m20 17-1.296-1.296a2.41 2.41 0 0 0-3.408 0L9 22`,key:`wt3hpn`}]]),Gt=O(`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`}]]),Kt=O(`X`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]);D({operation:j(`read-library`),computerId:M});var W=F.pipe(d(S(4096)),d(pe(e=>e.startsWith(`/`)&&e!==`/`&&!e.includes(`\0`)&&!e.endsWith(`/`)&&!e.split(`/`).some(e=>e===`.`||e===`..`))));D({path:be(W)});var qt=`modulepreload`,Jt=function(e,t){return new URL(e,t).href},Yt={},Xt=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=Jt(t,n),t=s(t),t in Yt)return;Yt[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`:qt,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 Zt(e,t){return e.computerId===void 0||e.computerId===t}var Qt=`@cf/black-forest-labs/flux-2-klein-4b`,$t=`Image creation is unavailable for this Computer right now.`,G={landscape:{height:768,width:1024},portrait:{height:1024,width:768},square:{height:1024,width:1024}},en=[`landscape`,`portrait`,`square`];function tn(e){return e instanceof ze&&e.stage===`provider`&&e.provider!==void 0&&`reason`in e.provider&&e.provider.reason===`credits_exhausted`}function nn(e){return tn(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}:Le(e,{INSUFFICIENT_CREDIT:{title:`Couldn’t create image`,message:`Media generation needs Team credits. Add credits in Billing, then retry.`},MEDIA_PROVIDER_FAILURE:{title:`Generation failed`,message:`The model stopped before it finished. Retry, or pick another model.`},MEDIA_PROVIDER_FAILURE_UNCHARGED:{title:`Generation failed`,message:`The model stopped before it finished. You weren’t charged. Retry, or pick another model.`},SAFETY_FILTER_REFUSED:{title:`Generation refused`,message:`The model refused this prompt. Change the prompt or reference image, then retry.`},TIMEOUT:{title:`Still waiting`,message:`The model didn’t answer in time. Retry to ask again.`},SETUP_REQUIRED:{title:`Setup needed`,message:`This model isn’t connected. Connect one in Settings, then retry.`},DISCONNECTED:{title:`Connection lost`,message:`Prints lost its connection. Reopen it, then retry.`},HOST_FAILURE:{title:`Couldn’t create image`,message:`The service couldn’t finish this just now. Retry in a moment.`}})}function rn(e){let t=ae(D({code:Ne(je)}))(e);return{reason:t._tag===`Some`?t.value.code:tn(e)?`INSUFFICIENT_CREDIT`:`UNKNOWN`,message:nn(e).message}}function an(){return{destination:void 0,height:768,model:Qt,prompt:``,references:[],steps:void 0,width:1024}}function on(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 sn(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 on(At({count:4}),t,a)}function cn(e){return e?.kind===`video`?`Generate video`:`Generate image`}function ln(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 un=(e,t)=>t===0?e:un(t,e%t),dn=(e,t,n)=>{if(n!==void 0)return`${String(e)} × ${String(t)} · ${String(n[0])}:${String(n[1])}`;let r=un(e,t);return`${String(e)} × ${String(t)} · ${String(e/r)}:${String(t/r)}`},fn=[[16,9],[21,9]],K=16;function pn(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/K)*K;return fn.map(([e,t])=>{let r=Math.round(n*t/e/K)*K;return{value:`${String(n)}x${String(r)}`,label:dn(n,r,[e,t]),width:n,height:r}})}function mn(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=un(t,n),a=t/i,o=n/i;return a<=21&&o<=21?`${String(a)}:${String(o)}`:`${String(t)} × ${String(n)}`}function hn(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:dn(n,r),width:n,height:r}]}):[...en.map(e=>({value:e,label:dn(G[e].width,G[e].height),...G[e]})),...e===void 0?[]:pn(e)]}function gn(e,t,n){return n?.kind===`video`&&t.kind===`video`||t.input.dimensions!==`none`&&Re(Ee(En(()=>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 _n(e){return e.label.split(` — `)[0]??e.label}function vn(e,t){return e.find(e=>e.id===t)}function yn(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 bn={"first-frame":`First frame`,"last-frame":`Last frame`,reference:`Reference`};function xn(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 Sn(e){return e?.video?.referenceRoles??[]}function Cn(e,t){let n=Sn(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 wn(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 Tn(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=Cn(e.references,t)),t.video?.supportsAudio===!0&&e.generateAudio!==void 0&&(r.generateAudio=e.generateAudio),{destination:{path:e.destination?.trim()??``},settings:r}}function En(e){return D({model:F,width:T,height:T,durationSeconds:de(s(T)),steps:de(s(T))}).check(pe(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 Dn(e,t){let n=e.trim().length;return n>t.maxPromptLength?{length:n,excess:n-t.maxPromptLength}:null}function On(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=Dn(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=Ee(En(()=>t))(e);if(Me(r))return _e()(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 wn(Cn(e.references,t),t,n?.resolution)}}var q=M,kn=M.pipe(d(S(1024))),An=k(kn).pipe(d(S(200)));P([D({operation:j(`read-notices`),computerId:q}),D({operation:j(`dismiss-notices`),computerId:q,keys:An})]);var jn=D({keys:An});async function Mn(e,t){return n(jn)(await e.require(U).request(JSON.stringify(t)))}P([D({operation:j(`read-folder`),computerId:q}),D({operation:j(`select-folder`),computerId:q,path:W})]);var Nn=D({path:W,configured:Oe});async function Pn(e,t){return n(Nn)(await e.require(U).request(JSON.stringify(t)))}var Fn=2048,In=8e3,Ln=[{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})),J=F.pipe(d(I(1)),d(S(64))),Rn=F.pipe(d(I(1)),d(S(In))),Y=M,zn=D({id:A,name:J,text:Rn,builtIn:Oe});P([D({operation:j(`list-styles`),computerId:Y}),D({operation:j(`save-style`),computerId:Y,id:h(A),name:J,text:Rn}),D({operation:j(`delete-style`),computerId:Y,id:A}),D({operation:j(`read-print-style`),computerId:Y,path:M})]);var Bn=D({styles:k(zn).pipe(d(S(50+Ln.length)))}),Vn=D({style:be(J)});function Hn(e,t){let n=t.trim();return e===void 0?n:`${e.trim()}\n\n${n}`}function Un(e){return e?.maxPromptLength??Fn}function Wn(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 X=e=>e.require(U),Z=e=>JSON.stringify(e),Gn=n(Bn);async function Kn(e,t){return Gn(await X(e).request(Z({operation:`list-styles`,computerId:t})))}async function qn(e,t,n){return Gn(await X(e).request(Z({operation:`save-style`,computerId:t,id:n.id,name:n.name,text:n.text})))}async function Jn(e,t,n){return Gn(await X(e).request(Z({operation:`delete-style`,computerId:t,id:n})))}async function Yn(e,t,r){return n(Vn)(await X(e).request(Z({operation:`read-print-style`,computerId:t,path:r})))}var Xn=8,Q=F.pipe(d(I(1)),d(S(32)),d(i(/^[\p{L}\p{N}_-]+$/u))),Zn=F.pipe(d(S(500))),Qn=M.pipe(d(S(4096))),$n=k(D({path:Qn})).pipe(d(S(8))),er=M,tr=D({id:A,name:Q,description:Zn,references:$n});P([D({operation:j(`list-characters`),computerId:er}),D({operation:j(`save-character`),computerId:er,id:h(A),name:Q,description:Zn,references:$n}),D({operation:j(`delete-character`),computerId:er,id:A})]);var nr=D({characters:k(tr).pipe(d(S(50)))}),rr=(e,t)=>e.toLowerCase()===t.toLowerCase(),ir=/(?<![\p{L}\p{N}_@-])@([\p{L}\p{N}_-]+)/gu;function ar(e){let t=[];for(let n of e.matchAll(ir)){let e=n.at(1);e!==void 0&&!t.some(t=>rr(t,e))&&t.push(e)}return t}function or(e,t){let n=[];return{prompt:e.replace(ir,(e,r)=>{let i=t.find(e=>rr(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 sr(e,t,n){let r=e.trim();return Hn(t,or(r,n).prompt).length-r.length}function cr(e,t){let n=ar(e),r=t.filter(e=>!n.some(t=>rr(t,e)));return r.length===0?e:`${r.map(e=>`@${e}`).join(` `)} ${e}`}function lr(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 ur(e){let t=or(cr(e.prompt,e.names??[]),e.saved),n=lr(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 dr(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 fr(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,Xn)}var pr=e=>e.require(U),mr=e=>JSON.stringify(e),hr=n(nr);async function gr(e,t){return hr(await pr(e).request(mr({operation:`list-characters`,computerId:t})))}async function _r(e,t,n){return hr(await pr(e).request(mr({operation:`save-character`,computerId:t,id:n.id,name:n.name,description:n.description,references:n.references})))}async function vr(e,t,n){return hr(await pr(e).request(mr({operation:`delete-character`,computerId:t,id:n})))}var $={models:e=>V.of(e,`prints`,`models`),folder:e=>V.of(e,`prints`,`folder`),dismissals:e=>V.of(e,`prints`,`dismissals`),styles:e=>V.of(e,`prints`,`styles`),printStyle:(e,t)=>V.of(e,`prints`,`print-style`,t),characters:e=>V.of(e,`prints`,`characters`)};function yr(e){return{...H(e,ke,$.models(e),async(t,n)=>{if(!e)throw Error(`Prints is disconnected`);let r=await Ae(e.capabilities);return n.throwIfAborted(),r}),enabled:!!(e?.context.get().computerId&&e.capabilities.has(ke)),structuralSharing:!1}}function br(e){let t=e?.context.get().computerId;return{...H(e,U,$.folder(e),async(n,r)=>{if(!e||!t)throw Error(`No Computer selected`);let i=await Pn(e.capabilities,{operation:`read-folder`,computerId:t});if(r.throwIfAborted(),e.context.get().computerId!==t)throw new E(`Computer selection changed`,{code:`SELECTION_CHANGED`,retryable:!1});return i}),enabled:!!(t&&e.capabilities.has(U))}}function xr(e){let t=e?.context.get().computerId;return{...H(e,U,$.dismissals(e),async(n,r)=>{if(!e||!t)throw Error(`No Computer selected`);let i=await Mn(e.capabilities,{operation:`read-notices`,computerId:t});return r.throwIfAborted(),i}),enabled:!!(t&&e.capabilities.has(U))}}function Sr(e){let t=e?.context.get().computerId;return{...H(e,U,$.styles(e),async(n,r)=>{if(!e||!t)throw Error(`No Computer selected`);let i=await Kn(e.capabilities,t);return r.throwIfAborted(),i}),enabled:!!(t&&e.capabilities.has(U))}}function Cr(e,t){let n=e?.context.get().computerId;return{...H(e,U,$.printStyle(e,t??``),async(r,i)=>{if(!e||!n||t===null)throw Error(`No print selected`);let a=await Yn(e.capabilities,n,t);return i.throwIfAborted(),a}),enabled:!!(n&&t!==null&&e.capabilities.has(U))}}function wr(e){let t=e?.context.get().computerId;return{...H(e,U,$.characters(e),async(n,r)=>{if(!e||!t)throw Error(`No Computer selected`);let i=await gr(e.capabilities,t);return r.throwIfAborted(),i}),enabled:!!(t&&e.capabilities.has(U))}}function Tr({checked:e}){let t=`caps-switch-${(0,z.useId)().replaceAll(`:`,``)}`,n=(0,z.useRef)(null),r=(0,z.useRef)(null),i=(0,z.useRef)(e).current,a=(0,z.useRef)(e),o=c();return(0,z.useLayoutEffect)(()=>{if(!n.current||!r.current)return;let t=o||a.current===e;a.current=e;let i=e?16:8,s=ue(n.current),c=Vt(s,{bounce:.25,duration:440}),l=Ht(s,{ease:`inOutSine`,duration:100}),u=Je(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=Je(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,B.jsxs)(`svg`,{className:`caps-switch-visual`,width:`40`,height:`24`,viewBox:`0 0 20 12`,"aria-hidden":`true`,focusable:`false`,children:[(0,B.jsxs)(`defs`,{children:[(0,B.jsx)(ge,{ref:r,id:`${t}-surface`,transform:i?`matrix(2 0 0 1 10 6)`:`matrix(1 0 0 1 6 6)`}),(0,B.jsx)(ye,{id:`${t}-shadow`}),(0,B.jsx)(xe,{id:`${t}-inset`}),(0,B.jsx)(`clipPath`,{id:`${t}-track`,children:(0,B.jsx)(`rect`,{x:`1`,y:`1`,width:`18`,height:`10`,rx:`5`})})]}),(0,B.jsx)(`rect`,{className:`caps-switch-track`,filter:`url(#${t}-inset)`,x:`0.5`,y:`0.5`,width:`19`,height:`11`,rx:`5.5`}),(0,B.jsx)(`g`,{clipPath:`url(#${t}-track)`,children:(0,B.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 Er=(0,z.forwardRef)(function({className:e,checked:t,defaultChecked:n=!1,onChange:r,onCheckedChange:i,...a},o){let s=(0,z.useRef)(null),[c,l]=(0,z.useState)(n),u=t??c;return(0,z.useImperativeHandle)(o,()=>{if(!s.current)throw Error(`Switch input is not mounted`);return s.current},[]),(0,z.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,B.jsxs)(`span`,{className:`caps-switch`,"data-checked":u,children:[(0,B.jsx)(`input`,{...a,checked:u,className:x(`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,B.jsx)(Tr,{checked:u})]})}),Dr=(0,z.forwardRef)(function({className:e,density:t=`regular`,...n},r){return(0,B.jsx)(`ul`,{...n,className:x(`list`,t===`compact`&&`list-sm`,e),ref:r})}),Or=(0,z.forwardRef)(function({className:e,...t},n){return(0,B.jsx)(`li`,{...t,className:x(`list-row`,e),ref:n})});(0,z.forwardRef)(function({className:e,icon:t,label:n,children:r,...i},a){return(0,B.jsxs)(`li`,{...i,className:x(`list-row caps-fact`,e),ref:a,children:[(0,B.jsxs)(`span`,{className:`caps-fact-label`,children:[t?(0,B.jsx)(`span`,{className:`caps-fact-icon`,"aria-hidden":`true`,children:t}):null,n]}),(0,B.jsx)(`span`,{className:`caps-fact-value`,children:r})]})});var kr=(0,z.forwardRef)(function({aside:e,children:t,className:n,level:r=2,...i},a){return(0,B.jsxs)(r===3?`h3`:`h2`,{...i,className:x(`caps-data-list-heading`,n),ref:a,children:[(0,B.jsx)(`span`,{children:t}),e===void 0?null:(0,B.jsx)(`span`,{className:`caps-data-list-heading-aside`,children:e})]})});export{W as $,bn as A,ln as B,Un as C,gt as Ct,Pn as D,Qe as Dt,Mn as E,Ze as Et,yn as F,wn as G,vn as H,cn as I,mn as J,Sn as K,sn as L,G as M,an as N,Qt as O,nn as P,Xt as Q,rn as R,Wn as S,vt as St,J as T,rt as Tt,_n as U,Zt as V,xn as W,gn as X,hn as Y,On as Z,ur as _,bt as _t,br as a,Ht as at,Hn as b,_t as bt,Cr as c,Lt as ct,Sr as d,H as dt,Kt as et,sr as f,Pt as ft,dr as g,Ct as gt,or as h,wt as ht,Er as i,Bt as it,en as j,$t as k,$ as l,U as lt,vr as m,V as mt,kr as n,Wt as nt,yr as o,Vt as ot,Q as p,Ft as pt,Cn as q,Or as r,Ut as rt,xr as s,Rt as st,Dr as t,Gt as tt,wr as u,It as ut,_r as v,St as vt,qn as w,pt as wt,Jn as x,yt as xt,fr as y,xt as yt,Tn as z};
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{$t as t,An as n,At as r,Bn as i,Bt as a,C as o,Cn as s,D as c,Dr as l,Dt as u,En as d,Et as ee,F as f,Ft as p,Gt as m,Hn as h,Ht as g,It as _,Jt as te,Kt as v,Lt as y,M as ne,Mt as b,N as re,Nt as ie,O as x,On as ae,Ot as oe,Pt as se,Qt as ce,Rn as S,Rt as le,T as ue,Un as de,Ut as fe,Vn as pe,Vt as C,Wt as me,Xt as w,Zt as he,_ as ge,_n as T,an as E,ar as _e,bn as D,c as O,cn as k,dn as A,en as ve,fn as j,g as ye,gn as be,h as xe,hi as Se,in as Ce,j as we,jt as Te,kn as Ee,kt as De,ln as Oe,mn as M,n as ke,o as Ae,on as je,or as Me,pn as Ne,qr as Pe,qt as Fe,rn as Ie,sn as Le,sr as Re,t as ze,ti as Be,tn as N,w as Ve,wn as P,x as He,yn as F,zn as I,zt as Ue}from"./media-DlmW7SfA.js";import{a as We,i as Ge,n as Ke,o as qe,r as Je}from"./modules-C4mfDnjH.js";function Ye(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=>{_(e,()=>t.signal,()=>n=!0)},u=Ue(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?le:y;return{pages:c(e.pages,o,s),pageParams:c(e.pageParams,r,s)}};if(i&&a.length){let e=i===`backward`,t=e?Xe:L,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:L(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 L(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 Xe(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}function Ze(e,t){return t?L(e,t)!=null:!1}function Qe(e,t){return!t||!e.getPreviousPageParam?!1:Xe(e,t)!=null}var $e=class extends u{#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=nt(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=nt(this.options);e.data!==void 0&&(this.setState(tt(e.data,e.dataUpdatedAt)),this.#t=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus===`idle`&&this.#r.remove(this)}setData(e,t){let n=te(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(v).catch(v):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=>w(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===t||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0&&this.observers.some(e=>w(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:!ve(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,i=e=>{Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(this.#s=!0,n.signal)})},a=()=>{let e=Ue(this.options,t),n=(()=>{let e={client:this.#i,queryKey:this.queryKey,meta:this.meta};return i(e),e})();return this.#s=!1,this.options.persister?this.options.persister(e,n,this):e(n)},o=(()=>{let e={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#i,state:this.state,fetchFn:a};return i(e),e})();(this.#e===`infinite`?Ye(this.options.pages):this.options.behavior)?.onFetch(o,this),this.#n=this.state,(this.state.fetchStatus===`idle`||this.state.fetchMeta!==o.fetchOptions?.meta)&&this.#c({type:`fetch`,meta:o.fetchOptions?.meta});let s=this.#a=r({initialPromise:t?.initialPromise,fn:o.fetchFn,onCancel:e=>{e instanceof oe&&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:o.options.retry,retryDelay:o.options.retryDelay,networkMode:o.options.networkMode,canRun:()=>!0});try{let e=await s.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 oe){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===s&&(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,...et(t.data,this.options),fetchMeta:e.meta??null};case`success`:let n={...t,...tt(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),b.batch(()=>{this.observers.slice().forEach(e=>{e.onQueryUpdate()}),this.#r.notify({query:this,type:`updated`,action:e})})}};function et(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:De(t.networkMode)?`fetching`:`paused`,...e===void 0&&{error:null,status:`pending`}}}function tt(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:`success`}}function nt(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 rt=class extends se{#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),at(this.#t,this.options)?this.#m():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return ot(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return ot(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#b(),this.#x(),this.#t.removeObserver(this)}setOptions(e){let t=this.options,n=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 w(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),t._defaulted&&!he(this.options,t)&&this.#e.getQueryCache().notify({type:`observerOptionsUpdated`,query:this.#t,observer:this});let r=this.hasListeners();r&&st(this.#t,n,this.options,t)&&this.#m(),this.updateResult(),r&&(this.#t!==n||w(this.options.enabled,this.#t)!==w(t.enabled,this.#t)||w(this.options.staleTime,this.#t)!==w(t.staleTime,this.#t))&&this.#g();let i=this.#_();r&&(this.#t!==n||w(this.options.enabled,this.#t)!==w(t.enabled,this.#t)||i!==this.#f)&&this.#v(i)}getOptimisticResult(e){let t=this.#e.getQueryCache().build(this.#e,e),n=this.createResult(t,e);return he(this.getCurrentResult(),n)||(this.#r=n,this.#a=this.options,this.#i=this.#t.state),n}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(v)),t}#h(e){return!p()&&w(this.options.enabled,this.#t)!==!1&&fe(e)}#g(){this.#b();let e=w(this.options.staleTime,this.#t);if(this.#r.isStale||!this.#h(e))return;let t=ve(this.#r.dataUpdatedAt,e)+1;this.#u=N.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=N.setInterval(()=>{(this.options.refetchIntervalInBackground||ie.isFocused())&&this.#m()},this.#f))}#y(){this.#g(),this.#v(this.#_())}#b(){this.#u!==void 0&&(N.clearTimeout(this.#u),this.#u=void 0)}#x(){this.#d!==void 0&&(N.clearInterval(this.#d),this.#d=void 0)}createResult(e,t){let n=this.#t,r=this.options,i=this.#r,a=this.#i,o=this.#a,s=e===n?this.#n:e.state,{state:c}=e,l={...c},u=!1,d;if(t._optimisticResults){let i=this.hasListeners(),a=!i&&at(e,t),o=i&&st(e,n,t,r);(a||o)&&(l={...l,...et(c.data,e.options)}),t._optimisticResults===`isRestoring`&&(l.fetchStatus=`idle`)}let{error:ee,errorUpdatedAt:f,status:p}=l;d=l.data;let m=!1;if(t.placeholderData!==void 0&&d===void 0&&p===`pending`){let e;i?.isPlaceholderData&&t.placeholderData===o?.placeholderData?(e=i.data,m=!0):e=typeof t.placeholderData==`function`?t.placeholderData(this.#l?.state.data,this.#l):t.placeholderData,e!==void 0&&(p=`success`,d=te(i?.data,e,t),u=!0)}if(t.select&&d!==void 0&&!m){if(i&&d===a?.data&&t.select===this.#s)d=this.#c;else try{this.#s=t.select,d=t.select(d),d=te(i?.data,d,t),this.#c=d,this.#o=null}catch(e){this.#o=e}}else d===void 0&&(this.#o=null);this.#o&&(ee=this.#o,d=this.#c,f=Date.now(),p=`error`,u=!1);let h=l.fetchStatus===`fetching`,g=p===`pending`,_=p===`error`,v=g&&h,y=d!==void 0;return{status:p,fetchStatus:l.fetchStatus,isPending:g,isSuccess:p===`success`,isError:_,isInitialLoading:v,isLoading:v,data:d,dataUpdatedAt:l.dataUpdatedAt,error:ee,errorUpdatedAt:f,failureCount:l.fetchFailureCount,failureReason:l.fetchFailureReason,errorUpdateCount:l.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:l.dataUpdateCount>s.dataUpdateCount||l.errorUpdateCount>s.errorUpdateCount,isFetching:h,isRefetching:h&&!g,isLoadingError:_&&!y,isPaused:l.fetchStatus===`paused`,isPlaceholderData:u,isRefetchError:_&&y,isStale:ct(e,t),refetch:this.refetch,isEnabled:w(t.enabled,e)!==!1}}updateResult(){let e=this.#r,t=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),he(t,e))return;this.#r=t;let n=(()=>{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)})})();b.batch(()=>{n&&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 it(e,t){return w(t.enabled,e)!==!1&&e.state.data===void 0&&(e.state.status!==`error`||w(t.retryOnMount,e)!==!1)}function at(e,t){return it(e,t)||e.state.data!==void 0&&ot(e,t,t.refetchOnMount)}function ot(e,t,n){if(w(t.enabled,e)!==!1&&w(t.staleTime,e)!==`static`){let r=typeof n==`function`?n(e):n;return r===`always`||r!==!1&&ct(e,t)}return!1}function st(e,t,n,r){return(e!==t||w(r.enabled,e)===!1)&&(!n.suspense||e.state.status!==`error`)&&ct(e,n)}function ct(e,t){return w(t.enabled,e)!==!1&&e.isStaleByTime(w(t.staleTime,e))}var lt=class extends se{#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 ee({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=R(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=R(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=R(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=R(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){b.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=>me(t,e))}findAll(e={}){return this.getAll().filter(t=>me(e,t))}notify(e){b.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return b.batch(()=>Promise.all(e.map(e=>e.continue().catch(v))))}};function R(e){return e.options.scope?.id}var ut=class extends se{#e;constructor(e={}){super(),this.config=e,this.#e=new Map}build(e,t,n){let r=t.queryKey,i=t.queryHash??g(r,t),a=this.get(i);return a||(a=new $e({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(){b.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=>m(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>m(e,t)):t}notify(e){b.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){b.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){b.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},dt=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new ut,this.#t=e.mutationCache||new lt,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=ie.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=Te.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(w(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,o=a(t,i);if(o!==void 0)return this.#e.build(this,r).setData(o,{...n,manual:!0})}setQueriesData(e,t,n){return b.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;b.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return b.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=b.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(v).catch(v)}invalidateQueries(e,t={}){return b.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=b.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(v)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(v)}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(w(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(w(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(v).catch(v)}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(v).catch(v)}ensureInfiniteQueryData(e){return e._type=`infinite`,this.ensureQueryData(e)}resumePausedMutations(){return Te.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(C(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{Fe(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(C(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{Fe(e,t.mutationKey)&&Object.assign(n,t.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;let n={...this.#n.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return n.queryHash||=g(n.queryKey,n),n.refetchOnReconnect===void 0&&(n.refetchOnReconnect=n.networkMode!==`always`),n.throwOnError===void 0&&(n.throwOnError=!!n.suspense),!n.networkMode&&n.persister&&(n.networkMode=`offlineFirst`),n.queryFn===t&&(n.enabled=!1),n}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()}},z=e(Se(),1),ft=z.createContext(!1),pt=()=>z.useContext(ft);ft.Provider;var B=Ce();function mt(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var ht=z.createContext(mt()),gt=()=>z.useContext(ht),_t=(e,t,n)=>{let r=n?.state.error&&typeof e.throwOnError==`function`?ce(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||r)&&(t.isReset()||(e.retryOnMount=!1))},vt=e=>{z.useEffect(()=>{e.clearReset()},[e])},yt=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||ce(n,[e.error,r])),bt=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))}},xt=(e,t)=>e?.suspense&&t.isPending,St=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function Ct(e,t,n){let r=pt(),i=gt(),a=Ie(n),o=a.defaultQueryOptions(e),s=a.getQueryCache().get(o.queryHash),c=e.subscribed!==!1;o._optimisticResults=r?`isRestoring`:c?`optimistic`:void 0,bt(o),_t(o,i,s),vt(i);let[l]=z.useState(()=>new t(a,o)),u=l.getOptimisticResult(o),d=!r&&c;if(z.useSyncExternalStore(z.useCallback(e=>{let t=d?l.subscribe(b.batchCalls(e)):v;return l.updateResult(),t},[l,d]),()=>l.getCurrentResult(),()=>l.getCurrentResult()),z.useEffect(()=>{l.setOptions(o)},[o,l]),xt(o,u))throw St(o,l,i);if(yt({result:u,errorResetBoundary:i,throwOnError:o.throwOnError,query:s,suspense:o.suspense}))throw u.error;return o.notifyOnChangeProps?u:l.trackResult(u)}function wt(e,t){return Ct(e,rt,t)}function Tt(e){return e}function Et(e){return e}var Dt=`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(`.`),Ot=`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 kt(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 At(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=[kt(Dt)];for(let e=1;e<t;e++)r.push(kt(Ot));return r.join(n)}function jt(e){return e instanceof E?e:new E(`App operation failed`,{cause:e,code:`HOST_FAILURE`,retryable:!1})}var Mt=new WeakMap,V={of(e,...t){return[e?.identity.surfaceId??null,e?.context.get().computerId??null,...t]}};function Nt(e){let t={};return e&&Mt.set(t,e),t}function Pt(){let e=new dt({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&&Mt.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 H(e,t,n,r){let i=e?.context.get().computerId;return Tt({queryKey:n,meta:Nt(e),enabled:e!==null,retry:!1,queryFn:async({signal:n})=>{try{if(!e)throw new E(`No App connection`,{code:`DISCONNECTED`,retryable:!0});if(e.context.get().computerId!==i)throw new E(`The selected Computer changed`,{code:`SELECTION_CHANGED`,retryable:!1});return await r(e.capabilities.require(t),n)}catch(e){throw jt(e)}}})}function Ft(e){return Et({mutationKey:e.queryKey,scope:{id:C(e.queryKey)},mutationFn:async(t,n)=>{try{return await e.mutationFn(t,n)}catch(e){throw jt(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 U=f(`app.backend`,1,Pe(()=>ne({request:re(we(Be().transform(e=>l(e))))}))),It=f(`app.methods`,1,Pe(()=>ne({call:re(we(Be().transform(e=>l(e))))}))),Lt=(0,z.forwardRef)(function({className:e,size:t=`md`,depth:n=`shallow`,placement:r=`standalone`,...i},a){return(0,B.jsx)(`div`,{...i,ref:a,"data-surface-size":t,"data-surface-depth":n,"data-surface-placement":r,className:x(`caps-surface`,e)})}),Rt=(0,z.forwardRef)(function({className:e,...t},n){return(0,B.jsx)(`div`,{...t,ref:n,className:x(`caps-screen`,e)})});(0,z.forwardRef)(function({children:e,className:t,depth:n=`deep`,fit:r=`content`,density:i=`normal`,...a},o){let s=r===`fill`;return(0,B.jsx)(Lt,{...a,className:x(t,s&&`flex min-h-0 flex-1`),depth:n,ref:o,children:(0,B.jsx)(`div`,{className:x(`caps-display-gasket`,s&&`flex min-h-0 min-w-0 flex-1`),"data-display-density":i,children:(0,B.jsx)(Rt,{className:x(s&&`flex min-h-0 min-w-0 flex-1 overflow-hidden`),children:e})})})}),(0,z.forwardRef)(function({className:e,icon:t,status:n,title:r,...i},a){return(0,B.jsxs)(`header`,{...i,className:x(`caps-screen-header`,e),ref:a,children:[t?(0,B.jsx)(`span`,{className:`caps-screen-header-icon`,"aria-hidden":`true`,children:t}):null,(0,B.jsx)(`span`,{className:`caps-screen-header-title`,children:r}),n?(0,B.jsx)(`span`,{className:`caps-screen-header-status`,children:n}):null]})}),(0,z.forwardRef)(function({appearance:e,className:t,...n},r){return(0,B.jsx)(`div`,{...n,className:x(`caps-screen-cells`,t),"data-appearance":e===`compact`?e:void 0,ref:r})}),(0,z.forwardRef)(function({children:e,className:t,legend:n,readout:r,icon:i,appearance:a,wide:o=!1,...s},c){return(0,B.jsxs)(`div`,{...s,className:x(`caps-screen-cell`,t),"data-wide":o||void 0,"data-appearance":a===`compact`?a:void 0,ref:c,children:[i?(0,B.jsx)(`span`,{className:`caps-screen-cell-icon`,children:i}):null,n?(0,B.jsx)(`span`,{className:`caps-screen-cell-legend`,children:n}):null,r?(0,B.jsx)(`span`,{className:`caps-screen-cell-readout`,children:r}):null,a===`compact`?(0,B.jsx)(`div`,{className:`caps-screen-cell-controls`,children:e}):e]})});var zt=(e=10,t)=>{let n=t?Ge:qe;return t=>n(We(t,0,1)*e)*(1/e)},Bt=Object.freeze({ease:`linear`,duration:0});function Vt(e,t){let n=o(e,t.duration);return n<=0?Bt:e.steps>0?{ease:zt(e.steps),duration:n}:{ease:Ke({bounce:He(e,t.bounce),duration:n}),duration:n}}function Ht(e,t){let n=Ve(e,t.duration);return{ease:e.steps>0?zt(e.steps):t.ease,duration:n}}var Ut=O(`Check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),Wt=O(`FileImage`,[[`path`,{d:`M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z`,key:`1rqfz7`}],[`path`,{d:`M14 2v4a2 2 0 0 0 2 2h4`,key:`tnqrlb`}],[`circle`,{cx:`10`,cy:`12`,r:`2`,key:`737tya`}],[`path`,{d:`m20 17-1.296-1.296a2.41 2.41 0 0 0-3.408 0L9 22`,key:`wt3hpn`}]]),Gt=O(`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`}]]),Kt=O(`X`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]);D({operation:j(`read-library`),computerId:M});var W=F.pipe(d(S(4096)),d(pe(e=>e.startsWith(`/`)&&e!==`/`&&!e.includes(`\0`)&&!e.endsWith(`/`)&&!e.split(`/`).some(e=>e===`.`||e===`..`))));D({path:be(W)});var qt=`modulepreload`,Jt=function(e,t){return new URL(e,t).href},Yt={},Xt=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=Jt(t,n),t=s(t),t in Yt)return;Yt[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`:qt,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 Zt(e,t){return e.computerId===void 0||e.computerId===t}var Qt=`@cf/black-forest-labs/flux-2-klein-4b`,$t=`Image creation is unavailable for this Computer right now.`,G={landscape:{height:768,width:1024},portrait:{height:1024,width:768},square:{height:1024,width:1024}},en=[`landscape`,`portrait`,`square`];function tn(e){return e instanceof ze&&e.stage===`provider`&&e.provider!==void 0&&`reason`in e.provider&&e.provider.reason===`credits_exhausted`}function nn(e){return tn(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}:Le(e,{INSUFFICIENT_CREDIT:{title:`Couldn’t create image`,message:`Media generation needs Team credits. Add credits in Billing, then retry.`},MEDIA_PROVIDER_FAILURE:{title:`Generation failed`,message:`The model stopped before it finished. Retry, or pick another model.`},MEDIA_PROVIDER_FAILURE_UNCHARGED:{title:`Generation failed`,message:`The model stopped before it finished. You weren’t charged. Retry, or pick another model.`},SAFETY_FILTER_REFUSED:{title:`Generation refused`,message:`The model refused this prompt. Change the prompt or reference image, then retry.`},TIMEOUT:{title:`Still waiting`,message:`The model didn’t answer in time. Retry to ask again.`},SETUP_REQUIRED:{title:`Setup needed`,message:`This model isn’t connected. Connect one in Settings, then retry.`},DISCONNECTED:{title:`Connection lost`,message:`Prints lost its connection. Reopen it, then retry.`},HOST_FAILURE:{title:`Couldn’t create image`,message:`The service couldn’t finish this just now. Retry in a moment.`}})}function rn(e){let t=ae(D({code:Ne(je)}))(e);return{reason:t._tag===`Some`?t.value.code:tn(e)?`INSUFFICIENT_CREDIT`:`UNKNOWN`,message:nn(e).message}}function an(){return{destination:void 0,height:768,model:Qt,prompt:``,references:[],steps:void 0,width:1024}}function on(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 sn(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 on(At({count:4}),t,a)}function cn(e){return e?.kind===`video`?`Generate video`:`Generate image`}function ln(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 un=(e,t)=>t===0?e:un(t,e%t),dn=(e,t,n)=>{if(n!==void 0)return`${String(e)} × ${String(t)} · ${String(n[0])}:${String(n[1])}`;let r=un(e,t);return`${String(e)} × ${String(t)} · ${String(e/r)}:${String(t/r)}`},fn=[[16,9],[21,9]],K=16;function pn(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/K)*K;return fn.map(([e,t])=>{let r=Math.round(n*t/e/K)*K;return{value:`${String(n)}x${String(r)}`,label:dn(n,r,[e,t]),width:n,height:r}})}function mn(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=un(t,n),a=t/i,o=n/i;return a<=21&&o<=21?`${String(a)}:${String(o)}`:`${String(t)} × ${String(n)}`}function hn(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:dn(n,r),width:n,height:r}]}):[...en.map(e=>({value:e,label:dn(G[e].width,G[e].height),...G[e]})),...e===void 0?[]:pn(e)]}function gn(e,t,n){return n?.kind===`video`&&t.kind===`video`||t.input.dimensions!==`none`&&Re(Ee(En(()=>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 _n(e){return e.label.split(` — `)[0]??e.label}function vn(e,t){return e.find(e=>e.id===t)}function yn(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 bn={"first-frame":`First frame`,"last-frame":`Last frame`,reference:`Reference`};function xn(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 Sn(e){return e?.video?.referenceRoles??[]}function Cn(e,t){let n=Sn(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 wn(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 Tn(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=Cn(e.references,t)),t.video?.supportsAudio===!0&&e.generateAudio!==void 0&&(r.generateAudio=e.generateAudio),{destination:{path:e.destination?.trim()??``},settings:r}}function En(e){return D({model:F,width:T,height:T,durationSeconds:de(s(T)),steps:de(s(T))}).check(pe(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 Dn(e,t){let n=e.trim().length;return n>t.maxPromptLength?{length:n,excess:n-t.maxPromptLength}:null}function On(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=Dn(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=Ee(En(()=>t))(e);if(Me(r))return _e()(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 wn(Cn(e.references,t),t,n?.resolution)}}var q=M,kn=M.pipe(d(S(1024))),An=k(kn).pipe(d(S(200)));P([D({operation:j(`read-notices`),computerId:q}),D({operation:j(`dismiss-notices`),computerId:q,keys:An})]);var jn=D({keys:An});async function Mn(e,t){return n(jn)(await e.require(U).request(JSON.stringify(t)))}P([D({operation:j(`read-folder`),computerId:q}),D({operation:j(`select-folder`),computerId:q,path:W})]);var Nn=D({path:W,configured:Oe});async function Pn(e,t){return n(Nn)(await e.require(U).request(JSON.stringify(t)))}var Fn=2048,In=8e3,Ln=[{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})),J=F.pipe(d(I(1)),d(S(64))),Rn=F.pipe(d(I(1)),d(S(In))),Y=M,zn=D({id:A,name:J,text:Rn,builtIn:Oe});P([D({operation:j(`list-styles`),computerId:Y}),D({operation:j(`save-style`),computerId:Y,id:h(A),name:J,text:Rn}),D({operation:j(`delete-style`),computerId:Y,id:A}),D({operation:j(`read-print-style`),computerId:Y,path:M})]);var Bn=D({styles:k(zn).pipe(d(S(50+Ln.length)))}),Vn=D({style:be(J)});function Hn(e,t){let n=t.trim();return e===void 0?n:`${e.trim()}\n\n${n}`}function Un(e){return e?.maxPromptLength??Fn}function Wn(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 X=e=>e.require(U),Z=e=>JSON.stringify(e),Gn=n(Bn);async function Kn(e,t){return Gn(await X(e).request(Z({operation:`list-styles`,computerId:t})))}async function qn(e,t,n){return Gn(await X(e).request(Z({operation:`save-style`,computerId:t,id:n.id,name:n.name,text:n.text})))}async function Jn(e,t,n){return Gn(await X(e).request(Z({operation:`delete-style`,computerId:t,id:n})))}async function Yn(e,t,r){return n(Vn)(await X(e).request(Z({operation:`read-print-style`,computerId:t,path:r})))}var Xn=8,Q=F.pipe(d(I(1)),d(S(32)),d(i(/^[\p{L}\p{N}_-]+$/u))),Zn=F.pipe(d(S(500))),Qn=M.pipe(d(S(4096))),$n=k(D({path:Qn})).pipe(d(S(8))),er=M,tr=D({id:A,name:Q,description:Zn,references:$n});P([D({operation:j(`list-characters`),computerId:er}),D({operation:j(`save-character`),computerId:er,id:h(A),name:Q,description:Zn,references:$n}),D({operation:j(`delete-character`),computerId:er,id:A})]);var nr=D({characters:k(tr).pipe(d(S(50)))}),rr=(e,t)=>e.toLowerCase()===t.toLowerCase(),ir=/(?<![\p{L}\p{N}_@-])@([\p{L}\p{N}_-]+)/gu;function ar(e){let t=[];for(let n of e.matchAll(ir)){let e=n.at(1);e!==void 0&&!t.some(t=>rr(t,e))&&t.push(e)}return t}function or(e,t){let n=[];return{prompt:e.replace(ir,(e,r)=>{let i=t.find(e=>rr(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 sr(e,t,n){let r=e.trim();return Hn(t,or(r,n).prompt).length-r.length}function cr(e,t){let n=ar(e),r=t.filter(e=>!n.some(t=>rr(t,e)));return r.length===0?e:`${r.map(e=>`@${e}`).join(` `)} ${e}`}function lr(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 ur(e){let t=or(cr(e.prompt,e.names??[]),e.saved),n=lr(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 dr(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 fr(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,Xn)}var pr=e=>e.require(U),mr=e=>JSON.stringify(e),hr=n(nr);async function gr(e,t){return hr(await pr(e).request(mr({operation:`list-characters`,computerId:t})))}async function _r(e,t,n){return hr(await pr(e).request(mr({operation:`save-character`,computerId:t,id:n.id,name:n.name,description:n.description,references:n.references})))}async function vr(e,t,n){return hr(await pr(e).request(mr({operation:`delete-character`,computerId:t,id:n})))}var $={models:e=>V.of(e,`prints`,`models`),folder:e=>V.of(e,`prints`,`folder`),dismissals:e=>V.of(e,`prints`,`dismissals`),styles:e=>V.of(e,`prints`,`styles`),printStyle:(e,t)=>V.of(e,`prints`,`print-style`,t),characters:e=>V.of(e,`prints`,`characters`)};function yr(e){return{...H(e,ke,$.models(e),async(t,n)=>{if(!e)throw Error(`Prints is disconnected`);let r=await Ae(e.capabilities);return n.throwIfAborted(),r}),enabled:!!(e?.context.get().computerId&&e.capabilities.has(ke)),structuralSharing:!1}}function br(e){let t=e?.context.get().computerId;return{...H(e,U,$.folder(e),async(n,r)=>{if(!e||!t)throw Error(`No Computer selected`);let i=await Pn(e.capabilities,{operation:`read-folder`,computerId:t});if(r.throwIfAborted(),e.context.get().computerId!==t)throw new E(`Computer selection changed`,{code:`SELECTION_CHANGED`,retryable:!1});return i}),enabled:!!(t&&e.capabilities.has(U))}}function xr(e){let t=e?.context.get().computerId;return{...H(e,U,$.dismissals(e),async(n,r)=>{if(!e||!t)throw Error(`No Computer selected`);let i=await Mn(e.capabilities,{operation:`read-notices`,computerId:t});return r.throwIfAborted(),i}),enabled:!!(t&&e.capabilities.has(U))}}function Sr(e){let t=e?.context.get().computerId;return{...H(e,U,$.styles(e),async(n,r)=>{if(!e||!t)throw Error(`No Computer selected`);let i=await Kn(e.capabilities,t);return r.throwIfAborted(),i}),enabled:!!(t&&e.capabilities.has(U))}}function Cr(e,t){let n=e?.context.get().computerId;return{...H(e,U,$.printStyle(e,t??``),async(r,i)=>{if(!e||!n||t===null)throw Error(`No print selected`);let a=await Yn(e.capabilities,n,t);return i.throwIfAborted(),a}),enabled:!!(n&&t!==null&&e.capabilities.has(U))}}function wr(e){let t=e?.context.get().computerId;return{...H(e,U,$.characters(e),async(n,r)=>{if(!e||!t)throw Error(`No Computer selected`);let i=await gr(e.capabilities,t);return r.throwIfAborted(),i}),enabled:!!(t&&e.capabilities.has(U))}}function Tr({checked:e}){let t=`caps-switch-${(0,z.useId)().replaceAll(`:`,``)}`,n=(0,z.useRef)(null),r=(0,z.useRef)(null),i=(0,z.useRef)(e).current,a=(0,z.useRef)(e),o=c();return(0,z.useLayoutEffect)(()=>{if(!n.current||!r.current)return;let t=o||a.current===e;a.current=e;let i=e?16:8,s=ue(n.current),c=Vt(s,{bounce:.25,duration:440}),l=Ht(s,{ease:`inOutSine`,duration:100}),u=Je(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=Je(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,B.jsxs)(`svg`,{className:`caps-switch-visual`,width:`40`,height:`24`,viewBox:`0 0 20 12`,"aria-hidden":`true`,focusable:`false`,children:[(0,B.jsxs)(`defs`,{children:[(0,B.jsx)(ge,{ref:r,id:`${t}-surface`,transform:i?`matrix(2 0 0 1 10 6)`:`matrix(1 0 0 1 6 6)`}),(0,B.jsx)(ye,{id:`${t}-shadow`}),(0,B.jsx)(xe,{id:`${t}-inset`}),(0,B.jsx)(`clipPath`,{id:`${t}-track`,children:(0,B.jsx)(`rect`,{x:`1`,y:`1`,width:`18`,height:`10`,rx:`5`})})]}),(0,B.jsx)(`rect`,{className:`caps-switch-track`,filter:`url(#${t}-inset)`,x:`0.5`,y:`0.5`,width:`19`,height:`11`,rx:`5.5`}),(0,B.jsx)(`g`,{clipPath:`url(#${t}-track)`,children:(0,B.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 Er=(0,z.forwardRef)(function({className:e,checked:t,defaultChecked:n=!1,onChange:r,onCheckedChange:i,...a},o){let s=(0,z.useRef)(null),[c,l]=(0,z.useState)(n),u=t??c;return(0,z.useImperativeHandle)(o,()=>{if(!s.current)throw Error(`Switch input is not mounted`);return s.current},[]),(0,z.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,B.jsxs)(`span`,{className:`caps-switch`,"data-checked":u,children:[(0,B.jsx)(`input`,{...a,checked:u,className:x(`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,B.jsx)(Tr,{checked:u})]})}),Dr=(0,z.forwardRef)(function({className:e,density:t=`regular`,...n},r){return(0,B.jsx)(`ul`,{...n,className:x(`list`,t===`compact`&&`list-sm`,e),ref:r})}),Or=(0,z.forwardRef)(function({className:e,...t},n){return(0,B.jsx)(`li`,{...t,className:x(`list-row`,e),ref:n})});(0,z.forwardRef)(function({className:e,icon:t,label:n,children:r,...i},a){return(0,B.jsxs)(`li`,{...i,className:x(`list-row caps-fact`,e),ref:a,children:[(0,B.jsxs)(`span`,{className:`caps-fact-label`,children:[t?(0,B.jsx)(`span`,{className:`caps-fact-icon`,"aria-hidden":`true`,children:t}):null,n]}),(0,B.jsx)(`span`,{className:`caps-fact-value`,children:r})]})});var kr=(0,z.forwardRef)(function({aside:e,children:t,className:n,level:r=2,...i},a){return(0,B.jsxs)(r===3?`h3`:`h2`,{...i,className:x(`caps-data-list-heading`,n),ref:a,children:[(0,B.jsx)(`span`,{children:t}),e===void 0?null:(0,B.jsx)(`span`,{className:`caps-data-list-heading-aside`,children:e})]})});export{W as $,bn as A,ln as B,Un as C,gt as Ct,Pn as D,Qe as Dt,Mn as E,Ze as Et,yn as F,wn as G,vn as H,cn as I,mn as J,Sn as K,sn as L,G as M,an as N,Qt as O,nn as P,Xt as Q,rn as R,Wn as S,vt as St,J as T,rt as Tt,_n as U,Zt as V,xn as W,gn as X,hn as Y,On as Z,ur as _,bt as _t,br as a,Ht as at,Hn as b,_t as bt,Cr as c,Lt as ct,Sr as d,H as dt,Kt as et,sr as f,Pt as ft,dr as g,Ct as gt,or as h,wt as ht,Er as i,Bt as it,en as j,$t as k,$ as l,U as lt,vr as m,V as mt,kr as n,Wt as nt,yr as o,Vt as ot,Q as p,Ft as pt,Cn as q,Or as r,Ut as rt,xr as s,Rt as st,Dr as t,Gt as tt,wr as u,It as ut,_r as v,St as vt,qn as w,pt as wt,Jn as x,yt as xt,fr as y,xt as yt,Tn as z};
|