@fungi.computer/prints 0.18.0 → 0.18.2

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.
Files changed (33) hide show
  1. package/dist/assets/audio-waveform-Be5wRu8s.js +1 -0
  2. package/dist/assets/audio-waveform-view-DbTyVH72.js +1 -0
  3. package/dist/assets/button-oE2Hrd5D.js +83 -0
  4. package/dist/assets/computer-Bfe-Ioxr.js +1 -0
  5. package/dist/assets/dialog-BXLOuKaF.js +1 -0
  6. package/dist/assets/dist-DAokFn5x.js +1 -0
  7. package/dist/assets/dropdown-menu-CAHLGfkb.js +1 -0
  8. package/dist/assets/ellipsis-DlNHenkt.js +1 -0
  9. package/dist/assets/generation-quote-DcaCSlvV.js +2 -0
  10. package/dist/assets/heart-BquDo4lf.js +1 -0
  11. package/dist/assets/images-CQ3EhUoY.js +1 -0
  12. package/dist/assets/index-D-LwJiG1.js +2 -0
  13. package/dist/assets/keycap-D2RkH2IS.js +1 -0
  14. package/dist/assets/library-rail-DVjIWa9C.js +1266 -0
  15. package/dist/assets/library-view-BBAeJjj6.js +1 -0
  16. package/dist/assets/log-event-B3BGsDWO.js +1 -0
  17. package/dist/assets/{print-download-button-CwK9wdo2.js → print-download-button-BNNi_aoW.js} +2 -2
  18. package/dist/assets/print-info-drawer-DDZan_oj.js +2 -0
  19. package/dist/assets/print-viewer-D7p4Tznx.js +2 -0
  20. package/dist/assets/prints-folder-dialog--W4H7Jx6.js +1 -0
  21. package/dist/assets/query-CYqgVHJ7.js +1 -0
  22. package/dist/assets/status-DNJRO5m5.js +1 -0
  23. package/dist/assets/textarea-LIOZDOK4.js +1 -0
  24. package/dist/assets/upload-queue-BHAaEiPu.js +1 -0
  25. package/dist/assets/useMutation-DH-cbXIA.js +1 -0
  26. package/dist/assets/useTriggerFocusGuards-Bddw7Qdn.js +1 -0
  27. package/dist/index.html +20 -4
  28. package/package.json +7 -7
  29. package/dist/assets/generation-quote-D7I39kF2.js +0 -2
  30. package/dist/assets/index-C0hNF6s0.js +0 -1267
  31. package/dist/assets/local-images-B-ZLs6V_.js +0 -1
  32. package/dist/assets/log-event-BpFScFqd.js +0 -83
  33. package/dist/assets/print-info-drawer-B1PQWwH2.js +0 -2
@@ -0,0 +1 @@
1
+ import{r as e,t}from"./rolldown-runtime-hePW80VL.js";import{C as n,S as r,Vn as i,d as a,l as o,m as s}from"./button-oE2Hrd5D.js";var c=n(),l=e(i(),1),u=(0,l.createContext)(void 0),d=(0,l.createContext)(null);function f(e){let t=(0,l.useContext)(d);return t===null?Object.hasOwn(globalThis,`document`)?document.body:null:t[e]}function p(e){let t=(0,l.useContext)(u),n=(0,l.useRef)(e);n.current=e,(0,l.useEffect)(()=>t?.(()=>{n.current()}),[t])}var m=t((e=>{var t=i();function n(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var r=typeof Object.is==`function`?Object.is:n,a=t.useState,o=t.useEffect,s=t.useLayoutEffect,c=t.useDebugValue;function l(e,t){var n=t(),r=a({inst:{value:n,getSnapshot:t}}),i=r[0].inst,l=r[1];return s(function(){i.value=n,i.getSnapshot=t,u(i)&&l({inst:i})},[e,n,t]),o(function(){return u(i)&&l({inst:i}),e(function(){u(i)&&l({inst:i})})},[e]),c(n),n}function u(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!r(e,n)}catch{return!0}}function d(e,t){return t()}var f=typeof window>`u`||window.document===void 0||window.document.createElement===void 0?d:l;e.useSyncExternalStore=t.useSyncExternalStore===void 0?f:t.useSyncExternalStore})),h=t(((e,t)=>{t.exports=m()})),g=t((e=>{var t=i(),n=h();function r(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var a=typeof Object.is==`function`?Object.is:r,o=n.useSyncExternalStore,s=t.useRef,c=t.useEffect,l=t.useMemo,u=t.useDebugValue;e.useSyncExternalStoreWithSelector=function(e,t,n,r,i){var d=s(null);if(d.current===null){var f={hasValue:!1,value:null};d.current=f}else f=d.current;d=l(function(){function e(e){if(!o){if(o=!0,s=e,e=r(e),i!==void 0&&f.hasValue){var t=f.value;if(i(t,e))return c=t}return c=e}if(t=c,a(s,e))return t;var n=r(e);return i!==void 0&&i(t,n)?(s=e,t):(s=e,c=n)}var o=!1,s,c,l=n===void 0?null:n;return[function(){return e(t())},l===null?void 0:function(){return e(l())}]},[t,n,r,i]);var p=o(e,d[0],d[1]);return c(function(){f.hasValue=!0,f.value=p},[p]),u(p),p}})),_=t(((e,t)=>{t.exports=g()})),v={...l},y={};function b(e,t){let n=l.useRef(y);return n.current===y&&(n.current=e(t)),n}var x=v.useInsertionEffect,S=x&&x!==v.useLayoutEffect?x:e=>e();function C(e){let t=b(w).current;return t.next=e,S(t.effect),t.trampoline}function w(){let e={next:void 0,callback:T,trampoline:(...t)=>e.callback?.(...t),effect:()=>{e.callback=e.next}};return e}function T(){}function E(){}var D=Object.freeze([]),O=Object.freeze({});function k(e){l.useEffect(e,D)}var A=0,j=class e{static create(){return new e}currentId=A;start(e,t){this.clear(),this.currentId=setTimeout(()=>{this.currentId=A,t()},e)}isStarted(){return this.currentId!==A}clear=()=>{this.currentId!==A&&(clearTimeout(this.currentId),this.currentId=A)};disposeEffect=()=>this.clear};function M(){let e=b(j.create).current;return k(e.disposeEffect),e}function N(e,t){return function(n,...r){let i=new URL(e);return i.searchParams.set(`code`,n.toString()),r.forEach(e=>i.searchParams.append(`args[]`,e)),`${t} error #${n}; visit ${i} for the full message.`}}var P=N(`https://base-ui.com/production-error`,`Base UI`);function F(e,t,n,r){let i=b(L).current;return ee(i,e,t,n,r)&&ne(i,[e,t,n,r]),i.callback}function I(e){let t=b(L).current;return te(t,e)&&ne(t,e),t.callback}function L(){return{callback:null,cleanup:null,refs:[]}}function ee(e,t,n,r,i){return e.refs[0]!==t||e.refs[1]!==n||e.refs[2]!==r||e.refs[3]!==i}function te(e,t){return e.refs.length!==t.length||e.refs.some((e,n)=>e!==t[n])}function ne(e,t){if(e.refs=t,t.every(e=>e==null)){e.callback=null;return}e.callback=n=>{if(e.cleanup&&=(e.cleanup(),null),n!=null){let r=Array(t.length).fill(null);for(let e=0;e<t.length;e+=1){let i=t[e];if(i!=null)switch(typeof i){case`function`:{let t=i(n);typeof t==`function`&&(r[e]=t);break}case`object`:i.current=n}}e.cleanup=()=>{for(let e=0;e<t.length;e+=1){let n=t[e];if(n!=null)switch(typeof n){case`function`:{let t=r[e];typeof t==`function`?t():n(null);break}case`object`:n.current=null}}}}}}var R=e(r(),1),z=18;function re(e){return z>=e}function B(e){if(!l.isValidElement(e))return null;let t=e,n=t.props;return(re(19)?n?.ref:t.ref)??null}function ie(e,t){if(e&&!t)return e;if(!e&&t)return t;if(e||t)return{...e,...t}}function ae(e,t){let n={};for(let r in e){let i=e[r];if(t?.hasOwnProperty(r)){let e=t[r](i);e!=null&&Object.assign(n,e);continue}i===!0?n[`data-${r.toLowerCase()}`]=``:i&&(n[`data-${r.toLowerCase()}`]=i.toString())}return n}function oe(e,t){return typeof e==`function`?e(t):e}function se(e,t){return typeof e==`function`?e(t):e}var ce={};function V(e,t,n,r,i){if(!n&&!r&&!i&&!e)return H(t);let a=H(e);return t&&(a=ue(a,t)),n&&(a=ue(a,n)),r&&(a=ue(a,r)),i&&(a=ue(a,i)),a}function le(e){if(e.length===0)return ce;if(e.length===1)return H(e[0]);let t=H(e[0]);for(let n=1;n<e.length;n+=1)t=ue(t,e[n]);return t}function H(e){return me(e)?{...e(ce)}:de(e)}function ue(e,t){return me(t)?t(e):fe(e,t)}function de(e){let t={...e};for(let e in t){let n=t[e];pe(e,n)&&(t[e]=ge(n))}return t}function fe(e,t){if(!t)return e;for(let n in t){let r=t[n];switch(n){case`style`:e[n]=ie(e.style,r);break;case`className`:e[n]=ve(e.className,r);break;default:e[n]=pe(n,r)?he(e[n],r):r}}return e}function pe(e,t){let n=e.charCodeAt(0),r=e.charCodeAt(1),i=e.charCodeAt(2);return n===111&&r===110&&i>=65&&i<=90&&(typeof t==`function`||t===void 0)}function me(e){return typeof e==`function`}function he(e,t){return t?e?(...n)=>{let r=n[0];if(ye(r)){let i=r;_e(i);let a=t(...n);return i.baseUIHandlerPrevented||e?.(...n),a}let i=t(...n);return e?.(...n),i}:ge(t):e}function ge(e){return e&&((...t)=>{let n=t[0];return ye(n)&&_e(n),e(...t)})}function _e(e){return e.preventBaseUIHandler=()=>{e.baseUIHandlerPrevented=!0},e}function ve(e,t){return t?e?t+` `+e:t:e}function ye(e){return typeof e==`object`&&!!e&&`nativeEvent`in e}function be(e,t,n={}){let r=t.render;n.enabled!==!1&&(r=we(r));let i=xe(t,n,r);if(n.enabled===!1)return null;let a=n.state??O;return Te(e,r,i,a)}function xe(e,t,n){let{className:r,style:i}=e,{state:a=O,ref:o,props:s,stateAttributesMapping:c,enabled:l=!0}=t,u=l?oe(r,a):void 0,d=l?se(i,a):void 0,f=l?ae(a,c):O,p=l&&s?Se(s):void 0,m=l?ie(f,p)??{}:O;return typeof document<`u`&&(l?m.ref=Array.isArray(o)?I([m.ref,B(n),...o]):F(m.ref,B(n),o):F(null,null)),l?(u!==void 0&&(m.className=ve(m.className,u)),d!==void 0&&(m.style=ie(m.style,d)),m):O}function Se(e){return Array.isArray(e)?le(e):V(void 0,e)}var Ce=Symbol.for(`react.lazy`);function we(e){if(e?.$$typeof!==Ce)return e;let t=l.Children.toArray(e)[0];return l.isValidElement(t)?t:e}function Te(e,t,n,r){if(t){if(typeof t==`function`)return t(n,r);let e=V(n,t.props);return e.ref=n.ref,l.cloneElement(t,e)}return Ee(e,n)}function Ee(e,t){return e===`button`?(0,l.createElement)(`button`,{type:`button`,...t,key:t.key}):e===`img`?(0,l.createElement)(`img`,{alt:``,...t,key:t.key}):l.createElement(e,t)}function De(){let[,e]=l.useState({});return l.useCallback(()=>{e({})},[])}var Oe=0;function ke(e,t=`mui`){let n=l.useRef(void 0),r=De(),i=e??n.current;return l.useEffect(()=>{n.current??(Oe+=1,n.current=`${t}-${Oe}`,e??r())},[e,t,r]),i}var Ae=v.useId;function je(e,t){if(Ae!==void 0){let n=Ae();return e??(t?`${t}-${n}`:n)}return ke(e,t)}function Me(e){return je(e,`base-ui`)}function Ne(){return typeof window<`u`}function U(e){return Fe(e)?(e.nodeName||``).toLowerCase():`#document`}function W(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Pe(e){return((Fe(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function Fe(e){return Ne()?e instanceof Node||e instanceof W(e).Node:!1}function G(e){return Ne()?e instanceof Element||e instanceof W(e).Element:!1}function K(e){return Ne()?e instanceof HTMLElement||e instanceof W(e).HTMLElement:!1}function Ie(e){return!Ne()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof W(e).ShadowRoot}function Le(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=Je(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function Re(e){return/^(table|td|th)$/.test(U(e))}function ze(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var Be=/transform|translate|scale|rotate|perspective|filter/,Ve=/paint|layout|strict|content/,He=e=>!!e&&e!==`none`,Ue;function We(e){let t=G(e)?Je(e):e;return He(t.transform)||He(t.translate)||He(t.scale)||He(t.rotate)||He(t.perspective)||!Ke()&&(He(t.backdropFilter)||He(t.filter))||Be.test(t.willChange||``)||Ve.test(t.contain||``)}function Ge(e){let t=Xe(e);for(;K(t)&&!qe(t);){if(We(t))return t;if(ze(t))return null;t=Xe(t)}return null}function Ke(){return Ue??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),Ue}function qe(e){return/^(html|body|#document)$/.test(U(e))}function Je(e){return W(e).getComputedStyle(e)}function Ye(e){return G(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Xe(e){if(U(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||Ie(e)&&e.host||Pe(e);return Ie(t)?t.host:t}function Ze(e){let t=Xe(e);return qe(t)?(e.ownerDocument||e).body:K(t)&&Le(t)?t:Ze(t)}function Qe(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=Ze(e),i=r===e.ownerDocument?.body,a=W(r);if(i){let e=$e(a);return t.concat(a,a.visualViewport||[],Le(r)?r:[],e&&n?Qe(e):[])}return t.concat(r,Qe(r,[],n))}function $e(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function et(){return typeof navigator>`u`?{userAgent:``,platform:``,maxTouchPoints:0}:{userAgent:navigator.userAgent,platform:navigator.platform??``,maxTouchPoints:navigator.maxTouchPoints??0}}var{userAgent:tt,platform:nt,maxTouchPoints:rt}=et(),it=tt.toLowerCase(),at=nt.toLowerCase(),ot=/^i(os$|p)/.test(at)||at===`macintel`&&rt>1,st=`android`,ct=at===st||it.includes(st),lt=!ot&&at.startsWith(`mac`);at.startsWith(`win`),!ct&&/^(linux|chrome os)/.test(at);var ut=lt||ot,dt=typeof CSS<`u`&&!!CSS.supports?.(`-webkit-backdrop-filter:none`);!dt&&it.includes(`firefox`),!dt&&it.includes(`chrom`);var ft=ut,pt=/jsdom|happydom/.test(it);function mt(e){let t=e.activeElement;for(;t?.shadowRoot?.activeElement!=null;)t=t.shadowRoot.activeElement;return t}function q(e,t){if(!e||!t)return!1;let n=t.getRootNode?.();if(e.contains(t))return!0;if(n&&Ie(n)){let n=t;for(;n;){if(e===n)return!0;n=n.parentNode||n.host}}return!1}function ht(e,t){let n=e;for(;n;){if(G(n)&&n.matches(t))return n;n=n.assignedSlot??n.parentNode??(Ie(n)?n.host:null)}return null}function gt(e){return`composedPath`in e?e.composedPath()[0]??e.target:e.target}var _t=`data-base-ui-focusable`,vt=`input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])`,yt=`ArrowLeft`,bt=`ArrowRight`,xt=`ArrowUp`,St=`ArrowDown`,Ct=`data-starting-style`,wt=`data-ending-style`,Tt={[Ct]:``},Et={[wt]:``},Dt={transitionStatus(e){return e===`starting`?Tt:e===`ending`?Et:null}},Ot=`data-open`,kt=`data-closed`,At=Ct,jt=wt,Mt=`data-anchor-hidden`,Nt=`data-popup-open`,Pt=`data-pressed`,Ft={[Nt]:``},It={[Nt]:``,[Pt]:``},Lt={[Ot]:``},Rt={[kt]:``},zt={[Mt]:``},Bt={open(e){return e?Ft:null}},Vt={open(e){return e?It:null}},Ht={open(e){return e?Lt:Rt},anchorHidden(e){return e?zt:null}},Ut={...Ht,...Dt},Wt=`data-trigger-disabled`;function Gt(e,t){if(!G(e))return!1;let n=e;if(t.hasElement(n))return!n.hasAttribute(Wt);for(let[,e]of t.entries())if(q(e,n))return!e.hasAttribute(Wt);return!1}function Kt(e,t){if(t==null)return!1;if(`composedPath`in e)return e.composedPath().includes(t);let n=e;return n.target!=null&&t.contains(n.target)}function qt(e){return e.matches(`html,body`)}function Jt(e){return K(e)&&e.matches(`input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])`)}function Yt(e){return ht(e,`button,a[href],[role="button"],select,[tabindex]:not([tabindex="-1"]),${vt}`)!=null}function Xt(e){return e?e.getAttribute(`role`)===`combobox`&&Jt(e):!1}function Zt(e){if(!e||pt)return!0;try{return e.matches(`:focus-visible`)}catch{return!0}}function Qt(e){return e?e.hasAttribute(`data-base-ui-focusable`)?e:e.querySelector(`[data-base-ui-focusable]`)||e:null}function $t(e,t,n=!0){return e.filter(e=>e.parentId===t).flatMap(t=>[...!n||t.context?.open?[t]:[],...$t(e,t.id,n)])}function en(e,t){let n=[],r=e.find(e=>e.id===t)?.parentId;for(;r;){let t=e.find(e=>e.id===r);r=t?.parentId,t&&(n=n.concat(t))}return n}function tn(e){e.preventDefault(),e.stopPropagation()}function nn(e){return`nativeEvent`in e}function rn(e){return e.pointerType===``&&e.isTrusted?!0:ct&&e.pointerType?e.type===`click`&&e.buttons===1:e.detail===0&&!e.pointerType}function an(e){return pt?!1:!ct&&e.width===0&&e.height===0||e.type===`pointerdown`&&e.width===1&&e.height===1&&e.pressure===0&&e.detail===0&&e.pointerType===`mouse`&&(ct||e.buttons===0)||e.width<1&&e.height<1&&e.pressure===0&&e.detail===0&&e.pointerType===`touch`}function on(e,t){let n=[`mouse`,`pen`];return t||n.push(``,void 0),n.includes(e)}function sn(e){let t=e.type;return t===`click`||t===`mousedown`||t===`keydown`||t===`keyup`}var cn=Math.min,ln=Math.max,un=Math.round,dn=Math.floor,fn=e=>({x:e,y:e}),pn={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function mn(e,t,n){return ln(e,cn(t,n))}function hn(e,t){return typeof e==`function`?e(t):e}function gn(e){return e.split(`-`)[0]}function _n(e){return e.split(`-`)[1]}function vn(e){return e===`x`?`y`:`x`}function yn(e){return e===`y`?`height`:`width`}function bn(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function xn(e){return vn(bn(e))}function Sn(e,t,n){n===void 0&&(n=!1);let r=_n(e),i=xn(e),a=yn(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=jn(o)),[o,jn(o)]}function Cn(e){let t=jn(e);return[wn(e),t,wn(t)]}function wn(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var Tn=[`left`,`right`],En=[`right`,`left`],Dn=[`top`,`bottom`],On=[`bottom`,`top`];function kn(e,t,n){switch(e){case`top`:case`bottom`:return n?t?En:Tn:t?Tn:En;case`left`:case`right`:return t?Dn:On;default:return[]}}function An(e,t,n,r){let i=_n(e),a=kn(gn(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(wn)))),a}function jn(e){let t=gn(e);return pn[t]+e.slice(t.length)}function Mn(e){return{top:e.top??0,right:e.right??0,bottom:e.bottom??0,left:e.left??0}}function Nn(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:Mn(e)}function Pn(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function Fn(e,t){return t<0||t>=e.length}function In(e,t){return zn(e.current,{disabledIndices:t})}function Ln(e,t){return zn(e.current,{decrement:!0,startingIndex:e.current.length,disabledIndices:t})}function Rn(e,t,n){let{decrement:r,loopFocus:i,allowEscape:a,disabledIndices:o,minIndex:s,maxIndex:c}=n,l=()=>zn(e,{startingIndex:t,decrement:r,disabledIndices:o}),u,d=!1;if(!i)u=r?Math.max(s,l()):Math.min(c,l());else if(r?t<=s:t>=c){let n=r?-1:e.length;a&&t!==n?u=-1:(u=r?c:s,d=!0)}else u=l();return{index:Fn(e,u)?-1:u,wrapped:d}}function zn(e,{startingIndex:t=-1,decrement:n=!1,disabledIndices:r,amount:i=1}={}){let a=t;do a+=n?-i:i;while(a>=0&&a<=e.length-1&&Bn(e,a,r));return a}function Bn(e,t,n){if(typeof n==`function`?n(t):n?.includes(t)??!1)return!0;let r=e[t];return r?!Hn(r)||r.matches(`:disabled`)?!0:!n&&(r.hasAttribute(`disabled`)||r.getAttribute(`aria-disabled`)===`true`):!1}function Vn(e){return e.visibility===`hidden`||e.visibility===`collapse`}function Hn(e,t=e?Je(e):null){return!e||!e.isConnected||!t||Vn(t)?!1:typeof e.checkVisibility==`function`?e.checkVisibility():t.display!==`none`&&t.display!==`contents`}function J(e){return e?.ownerDocument||document}var Un=`a[href],button,input,select,textarea,summary,details,iframe,object,embed,[tabindex],[contenteditable]:not([contenteditable="false"]),audio[controls],video[controls]`;function Wn(e){let t=e.assignedSlot;if(t)return t;if(e.parentElement)return e.parentElement;let n=e.getRootNode();return Ie(n)?n.host:null}function Gn(e){for(let t of Array.from(e.children))if(U(t)===`summary`)return t;return null}function Kn(e,t){let n=Gn(t);return!!n&&(e===n||q(n,e))}function qn(e){let t=e?U(e):``;return e!=null&&e.matches(Un)&&(t!==`summary`||e.parentElement!=null&&U(e.parentElement)===`details`&&Gn(e.parentElement)===e)&&(t!==`details`||Gn(e)==null)&&(t!==`input`||e.type!==`hidden`)}function Jn(e){if(!qn(e)||!e.isConnected||e.matches(`:disabled`))return!1;for(let t=e;t;t=Wn(t)){let n=t!==e,r=U(t)===`slot`;if(t.hasAttribute(`inert`)||n&&U(t)===`details`&&!t.open&&!Kn(e,t)||t.hasAttribute(`hidden`)||!r&&!Yn(t,n))return!1}return!0}function Yn(e,t){let n=Je(e);return t?n.display!==`none`:Hn(e,n)}function Xn(e){let t=e.tabIndex;if(t<0){let t=U(e);if(t===`details`||t===`audio`||t===`video`||K(e)&&e.isContentEditable)return 0}return t}function Zn(e){if(U(e)!==`input`)return null;let t=e;return t.type===`radio`&&t.name!==``?t:null}function Qn(e,t){let n=Zn(e);if(!n)return!0;let r=t.find(e=>{let t=Zn(e);return t?.name===n.name&&t.form===n.form&&t.checked});return r?r===n:t.find(e=>{let t=Zn(e);return t?.name===n.name&&t.form===n.form})===n}function $n(e){if(K(e)&&U(e)===`slot`){let t=e.assignedElements({flatten:!0});if(t.length>0)return t}return K(e)&&e.shadowRoot?Array.from(e.shadowRoot.children):Array.from(e.children)}function er(e,t){$n(e).forEach(e=>{qn(e)&&t.push(e),er(e,t)})}function tr(e,t,n){$n(e).forEach(e=>{K(e)&&e.matches(t)&&n.push(e),tr(e,t,n)})}function nr(e){return Jn(e)&&Xn(e)>=0}function rr(e){let t=[];return er(e,t),t.filter(Jn)}function ir(e){let t=rr(e);return t.filter(e=>Xn(e)>=0&&Qn(e,t))}function ar(e,t){let n=ir(e),r=n.length;if(r===0)return;let i=mt(J(e)),a=n.indexOf(i);return n[a===-1?t===1?0:r-1:a+t]}function or(e){return ar(J(e).body,1)||e}function sr(e){return ar(J(e).body,-1)||e}function cr(e,t,n){if(!e)return null;let r=[];er(J(e).body,r);let i=r.indexOf(e);if(i===-1)return null;let a=r.filter(Jn);for(let e=1;e<r.length;e+=1){let o=r[(i+t*e+r.length)%r.length];if(!q(n,o)&&nr(o)&&Qn(o,a))return o}return r[i]}function lr(e,t){let n=t||e.currentTarget,r=e.relatedTarget;return!r||!q(n,r)}function ur(e){ir(e).forEach(e=>{e.dataset.tabindex=e.getAttribute(`tabindex`)||``,e.setAttribute(`tabindex`,`-1`)})}function dr(e){let t=[];tr(e,`[data-tabindex]`,t),t.forEach(e=>{let t=e.dataset.tabindex;delete e.dataset.tabindex,t?e.setAttribute(`tabindex`,t):e.removeAttribute(`tabindex`)})}var Y=typeof document<`u`?l.useLayoutEffect:()=>{},fr=h(),pr=_(),mr=l.createContext(void 0);function hr(){return l.useContext(mr)?.direction??`ltr`}function gr(e,t){return e.getAnimations(t).filter(e=>{let t=e.effect?.getTiming();return t?.duration!==1/0&&t?.iterations!==1/0})}function X(e,t,n,r){return e.addEventListener(t,n,r),()=>{e.removeEventListener(t,n,r)}}var _r=l.createContext(void 0);function vr(e=!1){let t=l.useContext(_r);if(t===void 0&&!e)throw Error(P(16));return t}function yr(e){let{focusableWhenDisabled:t,disabled:n,composite:r=!1,tabIndex:i=0,isNativeButton:a}=e,o=r&&t!==!1,s=r&&t===!1;return{props:l.useMemo(()=>{let e={onKeyDown(e){n&&t&&e.key!==`Tab`&&e.preventDefault()}};return r||(e.tabIndex=i,!a&&n&&(e.tabIndex=t?i:-1)),(a&&(t||o)||!a&&n)&&(e[`aria-disabled`]=n),a&&(!t||s)&&(e.disabled=n),e},[r,n,t,o,s,a,i])}}function br(e,t,{detail:n=0,pointerType:r=``}={}){e.dispatchEvent(new(W(e)).PointerEvent(`click`,{bubbles:!0,cancelable:!0,composed:!0,detail:n,pointerType:r,shiftKey:t.shiftKey,ctrlKey:t.ctrlKey,altKey:t.altKey,metaKey:t.metaKey}))}function xr(e={}){let{disabled:t=!1,focusableWhenDisabled:n,tabIndex:r=0,native:i=!0,composite:a}=e,o=l.useRef(null),s=vr(!0),c=a??s!==void 0,{props:u}=yr({focusableWhenDisabled:n,disabled:t,composite:c,tabIndex:r,isNativeButton:i}),d=l.useCallback(()=>{let e=o.current;Sr(e)&&c&&t&&u.disabled===void 0&&e.disabled&&(e.disabled=!1)},[t,u.disabled,c]);return Y(d,[d]),{getButtonProps:l.useCallback((e={})=>{let{onClick:n,onMouseDown:r,onKeyUp:a,onKeyDown:o,onPointerDown:s,...l}=e;return V({onClick(e){if(t){e.preventDefault();return}n?.(e)},onMouseDown(e){t||r?.(e)},onKeyDown(e){if(t||(_e(e),o?.(e),e.baseUIHandlerPrevented))return;let n=e.target===e.currentTarget,r=e.currentTarget,a=Sr(r),s=!i&&Cr(r),l=n&&(i?a:!s),u=e.key===`Enter`,d=e.key===` `,f=r.getAttribute(`role`),p=f?.startsWith(`menuitem`)||f===`option`||f===`gridcell`;if(n&&c&&d){if(e.defaultPrevented&&p)return;e.preventDefault(),(!i||a)&&(e.preventBaseUIHandler(),br(r,e));return}if(!l||i||!d&&!u){n&&s&&d&&e.preventDefault();return}e.defaultPrevented||(e.preventDefault(),u&&(e.preventBaseUIHandler(),br(r,e)))},onKeyUp(e){if(!t){if(_e(e),a?.(e),e.target===e.currentTarget&&i&&c&&Sr(e.currentTarget)&&e.key===` `){e.preventDefault();return}e.baseUIHandlerPrevented||e.target===e.currentTarget&&!i&&!c&&!e.defaultPrevented&&e.key===` `&&(e.preventBaseUIHandler(),br(e.currentTarget,e))}},onPointerDown(e){if(t){e.preventDefault();return}s?.(e)}},i?{type:`button`}:{role:`button`},u,l)},[t,u,c,i]),buttonRef:C(e=>{o.current=e,d()})}}function Sr(e){return K(e)&&e.tagName===`BUTTON`}function Cr(e){return K(e)&&e.tagName===`A`&&!!e.href}function Z(e,t,n,r){let i=!1,a=!1,o=r??O;return{reason:e,event:t??new Event(`base-ui`),cancel(){i=!0},allowPropagation(){a=!0},get isCanceled(){return i},get isPropagationAllowed(){return a},trigger:n,...o}}function wr(e,t,n){let r=n??O;return{reason:e,event:t??new Event(`base-ui`),...r}}var Tr=`none`,Er=`trigger-press`,Dr=`trigger-hover`,Or=`trigger-focus`,kr=`outside-press`,Ar=`item-press`,jr=`close-press`,Mr=`focus-out`,Nr=`escape-key`,Pr=`list-navigation`,Fr=`keyboard`,Ir=`pointer`,Lr=`cancel-open`,Rr=`sibling-open`,zr=`imperative-action`;function Br(e,t){return t!=null&&!on(t)?0:typeof e==`function`?e():e}function Vr(e,t,n){let r=Br(e,n);return typeof r==`number`?r:r?.[t]}function Hr(e){return typeof e==`function`?e():e}function Ur(e,t){return t||e===`click`||e===`mousedown`}function Wr(e){return e?.includes(`mouse`)&&e!==`mousedown`}function Gr(...e){return()=>{for(let t=0;t<e.length;t+=1){let n=e[t];n&&n()}}}function Q(e){let t=b(Kr,e).current;return t.next=e,Y(t.effect),t}function Kr(e){let t={current:e,next:e,effect:()=>{t.current=t.next}};return t}var qr=null;globalThis.requestAnimationFrame;var Jr=new class{callbacks=[];callbacksCount=0;nextId=1;startId=1;isScheduled=!1;tick=e=>{this.isScheduled=!1;let t=this.callbacks,n=this.callbacksCount;if(this.callbacks=[],this.callbacksCount=0,this.startId=this.nextId,n>0)for(let n=0;n<t.length;n+=1)t[n]?.(e)};request(e){let t=this.nextId;return this.nextId+=1,this.callbacks.push(e),this.callbacksCount+=1,this.isScheduled||=(requestAnimationFrame(this.tick),!0),t}cancel(e){let t=e-this.startId;t<0||t>=this.callbacks.length||this.callbacks[t]!==null&&(this.callbacks[t]=null,--this.callbacksCount)}},Yr=class e{static create(){return new e}static request(e){return Jr.request(e)}static cancel(e){return Jr.cancel(e)}currentId=qr;request(e){this.cancel(),this.currentId=Jr.request(()=>{this.currentId=qr,e()})}cancel=()=>{this.currentId!==qr&&(Jr.cancel(this.currentId),this.currentId=qr)};disposeEffect=()=>this.cancel};function Xr(){let e=b(Yr.create).current;return k(e.disposeEffect),e}var Zr={clipPath:`inset(50%)`,overflow:`hidden`,whiteSpace:`nowrap`,border:0,padding:0,width:1,height:1,margin:-1},Qr={...Zr,position:`fixed`,margin:0,top:0,left:0};({...Zr});var $r=l.forwardRef(function(e,t){let[n,r]=l.useState();Y(()=>{ft&&dt&&r(`button`)},[]);let i={tabIndex:0,role:n};return(0,c.jsx)(`span`,{...e,ref:t,style:Qr,"aria-hidden":!n||void 0,...i,"data-base-ui-focus-guard":``})});function ei(e){return`data-base-ui-${e}`}var ti=0;function ni(e,t={}){let{preventScroll:n=!1,sync:r=!1,shouldFocus:i}=t;cancelAnimationFrame(ti);function a(){i&&!i()||e?.focus({preventScroll:n})}if(r)return a(),E;let o=requestAnimationFrame(a);return ti=o,()=>{ti===o&&(cancelAnimationFrame(o),ti=0)}}var ri=`data-base-ui-inert`,ii=new WeakMap,ai=new WeakSet,oi=new WeakMap,si=0;function ci(e){return e?Ie(e)?e.host:ci(e.parentNode):null}var li=(e,t)=>t.map(t=>{if(e.contains(t))return t;let n=ci(t);return e.contains(n)?n:null}).filter(e=>e!=null),ui=e=>{let t=new Set;return e.forEach(e=>{let n=e;for(;n&&!t.has(n);)t.add(n),n=n.parentNode}),t},di=(e,t,n)=>{let r=[],i=e=>{!e||n.has(e)||Array.from(e.children).forEach(e=>{U(e)!==`script`&&(t.has(e)?i(e):r.push(e))})};return i(e),r};function fi(e,t,n,{mark:r=!0}){let i=li(t,e),a=r?di(t,ui(i),new Set(i)):[],o=[],s=[];if(n){let e=li(t,Array.from(t.querySelectorAll(`[aria-live]`))),n=i.concat(e);di(t,ui(n),new Set(n)).forEach(e=>{let t=e.getAttribute(`aria-hidden`),n=t!==null&&t!==`false`,r=(ii.get(e)||0)+1;ii.set(e,r),o.push(e),r===1&&n&&ai.add(e),n||e.setAttribute(`aria-hidden`,`true`)})}return r&&a.forEach(e=>{let t=(oi.get(e)||0)+1;oi.set(e,t),s.push(e),t===1&&e.setAttribute(ri,``)}),si+=1,()=>{o.forEach(e=>{let t=(ii.get(e)||0)-1;ii.set(e,t),t||(ai.has(e)||e.removeAttribute(`aria-hidden`),ai.delete(e))}),r&&s.forEach(e=>{let t=(oi.get(e)||0)-1;oi.set(e,t),t||e.removeAttribute(ri)}),--si,si||(ii=new WeakMap,ai=new WeakSet,oi=new WeakMap)}}function pi(e,t={}){let{ariaHidden:n=!1,mark:r=!0}=t,i=J(e[0]).body;return fi(e,i,n,{mark:r})}var mi={style:{transition:`none`}},hi=`data-base-ui-click-trigger`,gi={fallbackAxisSide:`none`},_i={fallbackAxisSide:`end`},vi={clipPath:`inset(50%)`,position:`fixed`,top:0,left:0},yi=l.createContext(null),bi=()=>l.useContext(yi),xi=ei(`portal`);function Si(e={}){let{ref:t,container:n,componentProps:r=O,elementProps:i}=e,a=je(),o=bi()?.portalNode,[s,c]=l.useState(null),[u,d]=l.useState(null),f=C(e=>{e!==null&&d(e)}),p=l.useRef(null);Y(()=>{if(n===null){p.current&&(p.current=null,d(null),c(null));return}let e=(n&&(Fe(n)?n:n.current))??o??document.body;if(e==null){p.current&&(p.current=null,d(null),c(null));return}p.current!==e&&(p.current=e,d(null),c(e))},[n,o]);let m=be(`div`,r,{ref:[t,f],props:[{id:a,[xi]:``},i]}),h=s&&m?R.createPortal(m,s):null;return{node:u,nodeId:l.isValidElement(m)?m.props.id:void 0,subtree:h}}var Ci=l.forwardRef(function(e,t){let{render:n,className:r,style:i,children:a,container:o,portalOwnerRole:s,...u}=e,{node:d,nodeId:f,subtree:p}=Si({container:o,ref:t,componentProps:e,elementProps:u}),m=l.useRef(null),h=l.useRef(null),g=l.useRef(null),_=l.useRef(null),[v,y]=l.useState(null),b=l.useRef(!1),x=v?.modal,S=v?.open,C=!!v&&!v.modal&&v.open&&!!d;l.useEffect(()=>{if(!d||x)return;function e(e){d&&e.relatedTarget&&lr(e)&&(e.type===`focusin`?b.current&&=(dr(d),!1):(ur(d),b.current=!0))}return Gr(X(d,`focusin`,e,!0),X(d,`focusout`,e,!0))},[d,x]),Y(()=>{!d||S!==!0||!b.current||(dr(d),b.current=!1)},[S,d]);let w=l.useMemo(()=>({beforeOutsideRef:m,afterOutsideRef:h,beforeInsideRef:g,afterInsideRef:_,portalNode:d,setFocusManagerState:y}),[d]);return(0,c.jsxs)(l.Fragment,{children:[p,(0,c.jsxs)(yi.Provider,{value:w,children:[C&&d&&(0,c.jsx)($r,{"data-type":`outside`,ref:m,onFocus:e=>{lr(e,d)?g.current?.focus():sr(v?v.domReference:null)?.focus()}}),C&&d&&(0,c.jsx)(`span`,{role:s,"aria-owns":f,style:vi}),d&&R.createPortal(a,d),C&&d&&(0,c.jsx)($r,{"data-type":`outside`,ref:h,onFocus:e=>{lr(e,d)?_.current?.focus():(or(v?v.domReference:null)?.focus(),v?.closeOnFocusOut&&v?.onOpenChange(!1,Z(`focus-out`,e.nativeEvent)))}})]})]})});function wi(){let e=new Map;return{emit(t,n){e.get(t)?.forEach(e=>e(n))},on(t,n){e.has(t)||e.set(t,new Set),e.get(t).add(n)},off(t,n){e.get(t)?.delete(n)}}}var Ti=class{nodesRef={current:[]};events=wi();addNode(e){this.nodesRef.current.push(e)}removeNode(e){let t=this.nodesRef.current.findIndex(t=>t===e);t!==-1&&this.nodesRef.current.splice(t,1)}},Ei=l.createContext(null),Di=l.createContext(null),Oi=()=>l.useContext(Ei)?.id||null,ki=e=>{let t=l.useContext(Di);return e??t};function Ai(e){let t=je(),n=ki(e),r=Oi();return Y(()=>{if(!t)return;let e={id:t,parentId:r};return n?.addNode(e),()=>{n?.removeNode(e)}},[n,t,r]),t}function ji(e){let{children:t,id:n}=e,r=Oi();return(0,c.jsx)(Ei.Provider,{value:l.useMemo(()=>({id:n,parentId:r}),[n,r]),children:t})}function Mi(e){let{children:t,externalTree:n}=e,r=b(()=>n??new Ti).current;return(0,c.jsx)(Di.Provider,{value:r,children:t})}function Ni(e){return e==null?e:`current`in e?e.current:e}function Pi(e,t){let n=W(gt(e));return e instanceof n.KeyboardEvent?`keyboard`:e instanceof n.FocusEvent?t||`keyboard`:`pointerType`in e?e.pointerType||(rn(e)?`keyboard`:t||`mouse`):`touches`in e?`touch`:e instanceof n.MouseEvent?t||(e.detail===0?`keyboard`:`mouse`):``}var Fi=20,Ii=[];function Li(){Ii=Ii.filter(e=>e.deref()?.isConnected)}function Ri(e){Li(),e&&U(e)!==`body`&&(Ii.push(new WeakRef(e)),Ii.length>Fi&&(Ii=Ii.slice(-20)))}function zi(){return Li(),Ii[Ii.length-1]?.deref()}function Bi(e){return e?nr(e)?e:ir(e)[0]||e:null}function Vi(e){if(e.hasAttribute(`tabindex`)&&!e.hasAttribute(`data-tabindex`)||!e.getAttribute(`role`)?.includes(`dialog`))return;let t=rr(e).filter(e=>{let t=e.getAttribute(`data-tabindex`)||``;return nr(e)||e.hasAttribute(`data-tabindex`)&&!t.startsWith(`-`)}),n=e.getAttribute(`tabindex`);t.length===0?n!==`0`&&(e.setAttribute(`tabindex`,`0`),e.setAttribute(`data-tabindex`,`0`)):(n!==`-1`||e.hasAttribute(`data-tabindex`)&&e.getAttribute(`data-tabindex`)!==`-1`)&&(e.setAttribute(`tabindex`,`-1`),e.setAttribute(`data-tabindex`,`-1`))}function Hi(e){let{context:t,children:n,disabled:r=!1,initialFocus:i=!0,returnFocus:a=!0,explicitReturnFocus:o,restoreFocus:s=!1,modal:u=!0,closeOnFocusOut:d=!0,openInteractionType:f=``,nextFocusableElement:p,previousFocusableElement:m,beforeContentFocusGuardRef:h,externalTree:g,getInsideElements:_}=e,v=t.useState(`open`),y=t.useState(`domReferenceElement`),b=t.useState(`floatingElement`),{events:x,dataRef:S}=t.context,w=C(()=>S.current.floatingContext?.nodeId),T=i===!1,E=Xt(y)&&T,D=Q(i),O=Q(a),k=Q(o),A=Q(f),j=Q(v),N=ki(g),P=bi(),I=l.useRef(!1),L=l.useRef(!1),ee=l.useRef(!1),te=l.useRef(null),ne=l.useRef(``),R=l.useRef(``),z=l.useRef(null),re=l.useRef(null),B=F(z,h,P?.beforeInsideRef),ie=F(re,P?.afterInsideRef),ae=M(),oe=M(),se=Xr(),ce=P!=null,V=Qt(b),le=C((e=V)=>e?ir(e):[]),H=C(()=>_?.().filter(e=>e!=null)??[]);l.useEffect(()=>{if(r||!u)return;function e(e){e.key===`Tab`&&q(V,mt(J(V)))&&le().length===0&&!E&&tn(e)}return X(J(V),`keydown`,e)},[r,V,u,E,le]),l.useEffect(()=>{if(r||!v)return;let e=J(V);function t(){ee.current=!1}function n(e){let t=gt(e),n=H(),r=q(b,t)||q(y,t)||q(P?.portalNode,t)||n.some(e=>e===t||q(e,t));ee.current=!r,R.current=e.pointerType||`keyboard`,ht(t,`[data-base-ui-click-trigger]`)&&(L.current=!0,oe.start(0,()=>{L.current=!1}))}function i(){R.current=`keyboard`}return Gr(X(e,`pointerdown`,n,!0),X(e,`pointerup`,t,!0),X(e,`pointercancel`,t,!0),X(e,`keydown`,i,!0),t)},[r,b,y,V,v,P,oe,H]),l.useEffect(()=>{if(r||!d)return;let e=J(V);function n(){L.current=!0,oe.start(0,()=>{L.current=!1})}function i(e){let t=gt(e);nr(t)&&(te.current=t)}function a(n){let r=n.relatedTarget,i=n.currentTarget,a=gt(n);u&&r==null&&a!=null&&q(b,a)&&Ri(a),queueMicrotask(()=>{let o=w(),c=t.context.triggerElements,l=H(),d=r?.hasAttribute(ei(`focus-guard`))&&[z.current,re.current,P?.beforeInsideRef.current,P?.afterInsideRef.current,P?.beforeOutsideRef.current,P?.afterOutsideRef.current,Ni(m),Ni(p)].includes(r),f=!(q(y,r)||q(b,r)||q(r,b)||q(P?.portalNode,r)||l.some(e=>e===r||q(e,r))||c.hasMatchingElement(e=>q(e,r))||d||N&&($t(N.nodesRef.current,o).find(e=>q(e.context?.elements.floating,r)||q(e.context?.elements.domReference,r))||en(N.nodesRef.current,o).find(e=>[e.context?.elements.floating,Qt(e.context?.elements.floating)].includes(r)||e.context?.elements.domReference===r)));if(i===y&&V&&Vi(V),s&&i!==y&&!Hn(a)&&mt(e)===e.body){if(K(V)&&(V.focus(),s===`popup`)){se.request(()=>{V.focus()});return}let e=le(),t=te.current,n=(t&&e.includes(t)?t:null)||e[e.length-1]||V;K(n)&&n.focus()}if(S.current.insideReactTree){S.current.insideReactTree=!1;return}(E||!u)&&r&&f&&!L.current&&(E||r!==zi())&&(I.current=!0,t.setOpen(!1,Z(Mr,n)))})}function o(){ee.current||(S.current.insideReactTree=!0,ae.start(0,()=>{S.current.insideReactTree=!1}))}let c=K(y)?y:null;if(!(!b&&!c))return Gr(c&&X(c,`focusout`,a),c&&X(c,`pointerdown`,n),b&&X(b,`focusin`,i),b&&X(b,`focusout`,a),b&&P&&X(b,`focusout`,o,!0))},[r,y,b,V,u,N,P,t,d,s,le,E,w,S,ae,oe,se,p,m,H]),l.useEffect(()=>{if(r||!b||!v)return;let e=Array.from(P?.portalNode?.querySelectorAll(`[${ei(`portal`)}]`)||[]),t=(N?en(N.nodesRef.current,w()):[]).find(e=>Xt(e.context?.elements.domReference||null))?.context?.elements.domReference,n=pi([b,...e,z.current,re.current,P?.beforeOutsideRef.current,P?.afterOutsideRef.current,...H(),t,Ni(m),Ni(p),E?y:null].filter(e=>e!=null),{ariaHidden:u||E,mark:!1}),i=pi([b,...e].filter(e=>e!=null));return()=>{i(),n()}},[v,r,y,b,u,P,E,N,w,p,m,H]),Y(()=>{if(!v||r||!K(V))return;ne.current=``,R.current=``;let e=J(V),t=mt(e);queueMicrotask(()=>{let n=D.current,r=typeof n==`function`?n(A.current||``):n;if(r===void 0||r===!1||q(V,t))return;let i=null,a=()=>(i??=le(V),i[0]||V),o;o=r===!0||r===null?a():Ni(r),o||=a();let s=q(V,mt(e)),c=S.current.openEvent,l=c?.type===`mousedown`&&rn(c);ni(o,{sync:l,preventScroll:o===V,shouldFocus(){if(!j.current)return!1;if(s)return!0;let t=mt(e);return!(t!==o&&q(V,t))}})})},[r,v,V,le,D,A,j,S]);let ue=l.useRef(null);Y(()=>{if(r||!V){ue.current=null;return}ue.current&&=(ue.current.cancelled=!0,null);let e=J(V),t=mt(e),n=A.current==null;Ri(t);function i(e){if(e.open||(ne.current=Pi(e.nativeEvent,R.current)),(e.reason===`focus-out`&&e.triggerElement?.hasAttribute(ei(`focus-guard`))||e.reason===`trigger-hover`&&e.nativeEvent.type===`mouseleave`)&&(I.current=!0),e.reason===`outside-press`){if(e.nested)I.current=!1;else if(rn(e.nativeEvent)||an(e.nativeEvent))I.current=!1;else{let e=!1;J(V).createElement(`div`).focus({get preventScroll(){return e=!0,!1}}),e?I.current=!1:I.current=!0}}}x.on(`openchange`,i);function a(e){let r=O.current,i=typeof r==`function`?r(e):r;if(i===void 0||i===!1)return null;i===null&&(i=!0);let a=y?.isConnected?y:null,o=t?.isConnected&&U(t)!==`body`?t:null,s=n?o||a:a||o;return s||=zi()||null,typeof i==`boolean`?s:Ni(i)||s||null}return()=>{x.off(`openchange`,i);let t=mt(e),n=H(),r=q(b,t)||n.some(e=>e===t||q(e,t))||N&&$t(N.nodesRef.current,w(),!1).some(e=>q(e.context?.elements.floating,t)),o=O.current,s=ne.current,c=a(s),l={cancelled:!1};ue.current=l,queueMicrotask(()=>{ue.current===l&&(ue.current=null);let n=Bi(c),i=k.current??typeof o!=`boolean`;if(!l.cancelled&&o&&!I.current&&K(n)&&(!(!i&&n!==t&&t!==e.body)||r)){let e={preventScroll:!0};s===`keyboard`&&(e.focusVisible=!0),n.focus(e)}I.current=!1})}},[r,b,V,O,k,A,x,N,y,w,H]),Y(()=>{if(!dt||v||!b)return;let e=mt(J(b));!K(e)||!Jt(e)||q(b,e)&&e.blur()},[v,b]),Y(()=>{if(!(r||!P))return P.setFocusManagerState({modal:u,closeOnFocusOut:d,open:v,onOpenChange:t.setOpen,domReference:y}),()=>{P.setFocusManagerState(null)}},[r,P,u,v,t,d,y]),Y(()=>{if(!(r||!V))return Vi(V),()=>{queueMicrotask(Li)}},[r,V]);let de=!r&&(!u||!E)&&(ce||u);return(0,c.jsxs)(l.Fragment,{children:[de&&(0,c.jsx)($r,{"data-type":`inside`,ref:B,onFocus:e=>{if(u){let e=le();ni(e[e.length-1])}else P?.portalNode&&(I.current=!1,lr(e,P.portalNode)?or(y)?.focus():Ni(m??P.beforeOutsideRef)?.focus())}}),n,de&&(0,c.jsx)($r,{"data-type":`inside`,ref:ie,onFocus:e=>{u?ni(le()[0]):P?.portalNode&&(d&&(I.current=!0),lr(e,P.portalNode)?sr(y)?.focus():Ni(p??P.afterOutsideRef)?.focus())}})]})}function Ui(e,t={}){let{enabled:n=!0,event:r=`click`,toggle:i=!0,ignoreMouse:a=!1,stickIfOpen:o=!0,touchOpenDelay:s=0,reason:c=Er}=t,u=e.context.dataRef,d=l.useRef(void 0),f=Xr(),p=M(),m=l.useMemo(()=>{function t(t,n,r,i){let a=Z(c,n,r);t&&i===`touch`&&s>0?p.start(s,()=>{e.setOpen(!0,a)}):e.setOpen(t,a)}function n(t,n,r){let a=u.current.openEvent,s=e.select(`domReferenceElement`)!==n;return t&&s||!t||!i?!0:a&&(typeof o==`function`?o():o)?!r(a.type):!1}return{onPointerDown(e){d.current=on(e.pointerType,!0)&&an(e.nativeEvent)?`virtual`:e.pointerType},onMouseDown(i){let o=d.current,s=i.nativeEvent,c=e.select(`open`);if(i.button!==0||r===`click`||on(o,!0)&&a)return;let l=n(c,i.currentTarget,e=>e===`click`||e===`mousedown`),u=gt(s),p=Jt(u);if(p||o===`virtual`){t(l,s,p?u:i.currentTarget,o);return}let m=i.currentTarget;f.request(()=>{t(l,s,m,o)})},onClick(i){if(r===`mousedown-only`)return;let o=d.current;if(r===`mousedown`&&o){d.current=void 0;return}on(o,!0)&&a||t(n(e.select(`open`),i.currentTarget,e=>e===`click`||e===`mousedown`||e===`keydown`||e===`keyup`),i.nativeEvent,i.currentTarget,o)},onKeyDown(){d.current=void 0}}},[u,r,a,c,e,o,i,f,p,s]);return l.useMemo(()=>n?{reference:m}:O,[n,m])}function Wi(){return!1}function Gi(e){return{escapeKey:typeof e==`boolean`?e:e?.escapeKey??!1,outsidePress:typeof e==`boolean`?e:e?.outsidePress??!0}}function Ki(e,t={}){let{enabled:n=!0,escapeKey:r=!0,outsidePress:i=!0,outsidePressEvent:a=`sloppy`,referencePress:o=Wi,bubbles:s,externalTree:c}=t,u=e.useState(`open`),d=e.useState(`floatingElement`),{dataRef:f,events:p}=e.context,m=ki(c),h=C(typeof i==`function`?i:()=>!1),g=typeof i==`function`?h:i,_=g!==!1,v=C(()=>a),{escapeKey:y,outsidePress:b}=Gi(s),x=l.useRef(!1),S=l.useRef(!1),w=l.useRef(!1),T=l.useRef(!1),E=l.useRef(!1),D=l.useRef(``),O=l.useRef(null),k=M(),A=M(),N=M(),P=C(()=>{A.clear(),f.current.insideReactTree=!1}),F=C(e=>{let t=f.current.floatingContext?.nodeId;return(m?$t(m.nodesRef.current,t):[]).some(t=>t.context?.open&&!t.context.dataRef.current[e])}),I=C(t=>Kt(t,e.select(`floatingElement`))||Kt(t,e.select(`domReferenceElement`))),L=C(t=>{o()&&e.setOpen(!1,Z(Er,t.nativeEvent))}),ee=C(t=>{if(!u||!n||!r||t.key!==`Escape`)return;let i=nn(t)?t.nativeEvent:t;if(E.current||i.isComposing||!y&&F(`__escapeKeyBubbles`))return;let a=Z(Nr,i);e.setOpen(!1,a),a.isCanceled||t.preventDefault(),!y&&!a.isPropagationAllowed&&t.stopPropagation()}),te=C(()=>{f.current.insideReactTree=!0,A.start(0,P)}),ne=C(t=>{if(!u||!n||t.button!==0)return;let r=gt(t.nativeEvent);q(e.select(`floatingElement`),r)&&(x.current||(x.current=!0,S.current=!1))}),R=C(e=>{!u||!n||(e.defaultPrevented||e.nativeEvent.defaultPrevented)&&x.current&&(S.current=!0)});l.useEffect(()=>{function e(e){e.open||(T.current=!1)}return p.on(`openchange`,e),()=>{p.off(`openchange`,e)}},[p]),l.useEffect(()=>P,[P]),l.useEffect(()=>{if(!u||!n)return u||(T.current=!1,E.current=!1,D.current=``,O.current=null),P;f.current.__escapeKeyBubbles=y,f.current.__outsidePressBubbles=b;let t=new j,i=J(d);function a(){N.clear(),E.current=!0}function o(){E.current=!0,N.start(dt?5:0,()=>{E.current=!1})}function s(){w.current=!0,t.start(0,()=>{w.current=!1})}function c(){x.current=!1,S.current=!1}function l(){let e=D.current,t=e===`pen`||!e?`mouse`:e,n=v(),r=typeof n==`function`?n():n;return typeof r==`string`?r:r[t]}function p(e){let t=l();return t===`intentional`&&e.type!==`click`||t===`sloppy`&&e.type===`click`}function h(e){let t=f.current.floatingContext?.nodeId,n=m&&$t(m.nodesRef.current,t).some(t=>Kt(e,t.context?.elements.floating));return I(e)||n}function C(n){if(p(n)){n.type!==`click`&&!I(n)&&(t.clear(),w.current=!1),P();return}if(f.current.insideReactTree){P();return}let r=gt(n),i=`[${ei(`inert`)}]`,a=G(r)?r.getRootNode():null,o=Array.from((Ie(a)?a:J(e.select(`floatingElement`))).querySelectorAll(i)),s=e.context.triggerElements;if(r&&(s.hasElement(r)||s.hasMatchingElement(e=>q(e,r))))return;let c=G(r)?r:null;for(;c&&!qe(c);){let e=Xe(c);if(qe(e)||!G(e))break;c=e}if(!(o.length&&G(r)&&!qt(r)&&!q(r,e.select(`floatingElement`))&&o.every(e=>!q(c,e)))){if(K(r)&&!(`touches`in n)){let e=qe(r),t=Je(r),i=/auto|scroll/,a=e||i.test(t.overflowX),o=e||i.test(t.overflowY),s=a&&r.clientWidth>0&&r.scrollWidth>r.clientWidth,c=o&&r.clientHeight>0&&r.scrollHeight>r.clientHeight,l=t.direction===`rtl`,u=c&&(l?n.offsetX<=r.offsetWidth-r.clientWidth:n.offsetX>r.clientWidth),d=s&&n.offsetY>r.clientHeight;if(u||d)return}if(!h(n)){if(l()===`intentional`){if(n.detail!==0&&!rn(n)&&!T.current)return;if(w.current){t.clear(),w.current=!1;return}}typeof g==`function`&&!g(n)||F(`__outsidePressBubbles`)||(e.setOpen(!1,Z(kr,n)),P())}}}function A(t){l()!==`sloppy`||t.pointerType===`touch`||!e.select(`open`)||!n||I(t)||C(t)}function M(t){if(l()!==`sloppy`||!e.select(`open`)||!n||I(t))return;let r=t.touches[0];r&&(O.current={startTime:Date.now(),startX:r.clientX,startY:r.clientY,dismissOnTouchEnd:!1,dismissOnMouseDown:!0},k.start(1e3,()=>{O.current&&(O.current.dismissOnTouchEnd=!1,O.current.dismissOnMouseDown=!1)}))}function L(e,t){let n=gt(e);if(!n)return;let r=X(n,e.type,()=>{t(e),r()})}function te(e){D.current=`touch`,L(e,M)}function ne(e){k.clear(),e.type===`pointerdown`&&(e.button===0&&(T.current=!0),D.current=e.pointerType),!(e.type===`mousedown`&&O.current&&!O.current.dismissOnMouseDown)&&L(e,e=>{e.type===`pointerdown`?A(e):C(e)})}function R(e){if(e.type===`pointercancel`&&(T.current=!1),!x.current)return;let n=S.current;if(c(),l()===`intentional`){if(e.type===`pointercancel`){n&&s();return}if(!h(e)){if(n){s();return}typeof g==`function`&&!g(e)||(t.clear(),w.current=!0,P())}}}function z(e){if(l()!==`sloppy`||!O.current||I(e))return;let t=e.touches[0];if(!t)return;let n=Math.abs(t.clientX-O.current.startX),r=Math.abs(t.clientY-O.current.startY),i=Math.sqrt(n*n+r*r);i>5&&(O.current.dismissOnTouchEnd=!0),i>10&&(C(e),k.clear(),O.current=null)}function re(e){L(e,z)}function B(e){l()!==`sloppy`||!O.current||I(e)||(O.current.dismissOnTouchEnd&&C(e),k.clear(),O.current=null)}function ie(e){L(e,B)}let ae=Gr(r&&Gr(X(i,`keydown`,ee),X(i,`compositionstart`,a),X(i,`compositionend`,o)),_&&Gr(X(i,`click`,ne,!0),X(i,`pointerdown`,ne,!0),X(i,`pointerup`,R,!0),X(i,`pointercancel`,R,!0),X(i,`mousedown`,ne,!0),X(i,`mouseup`,R,!0),X(i,`touchstart`,te,{capture:!0,passive:!0}),X(i,`touchmove`,re,{capture:!0,passive:!0}),X(i,`touchend`,ie,{capture:!0,passive:!0})));return()=>{ae(),t.clear(),c(),w.current=!1}},[f,d,r,_,g,u,n,y,b,ee,P,v,F,I,m,e,k,N]);let z=l.useMemo(()=>({onKeyDown:ee,onPointerDown:L,onClick:L}),[ee,L]),re=l.useMemo(()=>({onKeyDown:ee,onPointerDown:R,onMouseDown:R,onClickCapture:te,onMouseDownCapture(e){te(),ne(e)},onPointerDownCapture(e){te(),ne(e)},onMouseUpCapture:te,onTouchEndCapture:te,onTouchMoveCapture:te}),[ee,te,ne,R]);return l.useMemo(()=>n?{reference:z,floating:re,trigger:z}:{},[n,z,re])}function qi(e){let{popupStore:t,treatPopupAsFloatingElement:n=!1,floatingRootContext:r,floatingId:i,nested:a,onOpenChange:o}=e,s=t.useState(`open`),c=t.useState(`activeTriggerElement`),l=t.useState(n?`popupElement`:`positionerElement`),u=o;return t.useSyncedValue(`floatingId`,i),Y(()=>{let e={open:s,floatingId:i,referenceElement:c,floatingElement:l};G(c)&&(e.domReferenceElement=c),r.state.positionReference===r.state.referenceElement&&(e.positionReference=c),r.update(e)},[s,i,c,l,r]),r.context.onOpenChange=u,r.context.nested=a,r}function Ji(e,t=!1,n=!1,r=!1){let[i,a]=l.useState(e&&t?`idle`:void 0),[o,s]=l.useState(e&&!r);return e&&!o&&(s(!0),a(`starting`)),!e&&o&&i!==`ending`&&!n&&a(`ending`),!e&&!o&&i===`ending`&&a(void 0),Y(()=>{if(!e&&o&&i!==`ending`&&n){let e=Yr.request(()=>{a(`ending`)});return()=>{Yr.cancel(e)}}},[e,o,i,n]),Y(()=>{if(!e||t||i===void 0)return;let n=Yr.request(()=>{a(void 0)});return()=>{Yr.cancel(n)}},[t,e,i]),Y(()=>{if(!e||!t)return;e&&o&&i!==`idle`&&a(`starting`);let n=Yr.request(()=>{a(`idle`)});return()=>{Yr.cancel(n)}},[t,e,o,i]),{mounted:o,setMounted:s,transitionStatus:i}}var Yi=null;function Xi(e){if(!Yi){let e=[];Yi=e,queueMicrotask(()=>{Yi=null,R.flushSync(()=>{for(let t of e)t()})})}Yi.push(e)}function Zi(e,t=!1,n=!1){let r=Xr();return C((i,a=null)=>{r.cancel();let o=Ni(e);if(o==null)return;let s=o,c=()=>{if(!n){R.flushSync(i);return}Xi(()=>{a?.aborted||i()})};if(typeof s.getAnimations!=`function`||globalThis.BASE_UI_ANIMATIONS_DISABLED){i();return}function l(){Promise.all(gr(s).map(e=>e.finished.then(E))).then(()=>{a?.aborted||c()},()=>{if(!a?.aborted){if(gr(s).some(e=>e.pending||e.playState!==`finished`)){l();return}c()}})}if(t){let e=Ct;if(!s.hasAttribute(e)){r.request(l);return}let t=new MutationObserver(()=>{s.hasAttribute(e)||(t.disconnect(),l())});t.observe(s,{attributes:!0,attributeFilter:[e]}),a?.addEventListener(`abort`,()=>t.disconnect(),{once:!0});return}r.request(l)})}function Qi(e){let{enabled:t=!0,open:n,ref:r,batch:i=!1,onComplete:a}=e,o=C(a),s=Zi(r,n,i);l.useEffect(()=>{if(!t)return;let e=new AbortController;return s(o,e.signal),()=>{e.abort()}},[t,n,o,s])}function $i(e){let{open:t,ref:n,preventUnmountOnClose:r,setPreventUnmountOnClose:i,onUnmount:a,animateInitialOpen:o}=e,s=C(i),{mounted:c,setMounted:u,transitionStatus:d}=Ji(t,!1,!1,o),f=!t&&r;Y(()=>{t&&s(!1)},[t,s]);let p=l.useRef(c),m=l.useRef(!1),h=De(),g=()=>{p.current=!1,u(!1),a()};Y(()=>{p.current=c,m.current&&(m.current=!1,!t&&c&&g())});let _=C(()=>{if(p.current){if(t){m.current=!0,h();return}g()}});return Qi({enabled:c&&!t&&!f,open:t,ref:n,onComplete(){t||_()}}),{mounted:c,transitionStatus:d,preventUnmountingOnClose:f,forceUnmount:_}}var ea={tabIndex:-1,[_t]:``};function ta(e){return t=>t!==`touch`||e.current}function na(e,t=!1){let n=je(),r=Oi()!=null,i=b(()=>e(n,r)).current;return qi({popupStore:i,treatPopupAsFloatingElement:t,floatingRootContext:i.state.floatingRootContext,floatingId:n,nested:r,onOpenChange:i.setOpen}),i}function ra({handle:e,store:t}){return Y(()=>e.attachStore(t),[e,t]),null}function ia(e){let t=e.context.triggerElements.size;e.select(`open`)&&e.state.triggerCount!==t&&e.set(`triggerCount`,t)}function aa(e,t){let n=l.useRef(null);return C(r=>{let i=n.current;if(i!==null){if(i.element===r&&i.store===t&&i.id===e)return;n.current=null;let a=i.store;a.context.triggerElements.getById(i.id)===i.element&&(a.context.triggerElements.delete(i.id),ia(a))}r!==null&&e!==void 0&&(n.current={store:t,id:e,element:r},t.context.triggerElements.add(e,r),ia(t))})}function oa(e,t,n,r=!1){let i=e.preventUnmountingOnClose;t?i=!1:r&&(i=!0);let a=n?.id??null,o=e.activeTriggerId,s=e.activeTriggerElement;return(a||t)&&(o=a,s=n??null),{open:t,preventUnmountingOnClose:i,activeTriggerId:o,activeTriggerElement:s,openedWithoutTrigger:t?n==null:e.openedWithoutTrigger}}function sa(e){let t=!1;return e.preventUnmountOnClose=()=>{t=!0},()=>t}function ca(e,t,n,r){let i=n.useState(`isMountedByTrigger`,e),a=aa(e,n),o=C(t=>{let i=n.select(`open`),a=n.select(`activeTriggerId`);if(a===e){let e={activeTriggerElement:t,...i?r:null};n.update(e);return}if(a==null&&i&&!n.state.openedWithoutTrigger){let i={activeTriggerId:e??null,activeTriggerElement:t,...r};n.update(i)}}),s=C(e=>{a(e),e&&o(e)});return Y(()=>(s(t.current),()=>s(null)),[s,t,n,e]),Y(()=>{if(i){let e={activeTriggerElement:t.current,...r};n.update(e)}},[i,n,t,...Object.values(r)]),{registerTrigger:s,isMountedByThisTrigger:i}}function la(e,t={}){let{closeOnActiveTriggerUnmount:n=!1}=t,r=l.useRef(null),i=e.useState(`open`);Y(()=>{if(!i){r.current=null,e.state.triggerCount!==0&&e.set(`triggerCount`,0),e.state.openedWithoutTrigger&&e.set(`openedWithoutTrigger`,!1);return}let t=e.context.triggerElements.size,a={};e.state.triggerCount!==t&&(a.triggerCount=t);let o=e.select(`activeTriggerId`),s=null;if(o){let t=e.context.triggerElements.getById(o);if(t)r.current=o,t!==e.state.activeTriggerElement&&(a.activeTriggerElement=t);else{for(let[t,n]of e.context.triggerElements.entries())if(n===e.state.activeTriggerElement){a.activeTriggerId=t,a.activeTriggerElement=n,r.current=t;break}a.activeTriggerId===void 0&&(r.current===o?s=o:r.current=null)}}else r.current=null;if(!s&&!o&&!e.state.openedWithoutTrigger&&t===1){let t=e.context.triggerElements.entries().next();if(!t.done){let[e,n]=t.value;a.activeTriggerId=e,a.activeTriggerElement=n,r.current=e}}(a.triggerCount!==void 0||a.activeTriggerId!==void 0||a.activeTriggerElement!==void 0)&&e.update(a),s&&n&&queueMicrotask(()=>{if(e.select(`open`)&&e.select(`activeTriggerId`)===s&&!e.context.triggerElements.getById(s)){let t=Z(Tr);e.setOpen(!1,t),t.isCanceled||e.update({activeTriggerId:null,activeTriggerElement:null})}})},[i,e,e.useState(`triggerCount`),e.useState(`activeTriggerId`),e.useState(`activeTriggerElement`),n])}function ua(e,t,n,r){let{mounted:i,transitionStatus:a,forceUnmount:o}=$i({open:e,ref:t.context.popupRef,preventUnmountOnClose:t.useState(`preventUnmountingOnClose`),setPreventUnmountOnClose:e=>t.set(`preventUnmountingOnClose`,e),animateInitialOpen:r,onUnmount(){t.update({activeTriggerId:null,activeTriggerElement:null,mounted:!1,preventUnmountingOnClose:!1}),n?.(),t.context.onOpenChangeComplete?.(!1)}});return b(()=>(t.set(`mounted`,i),null)),t.useSyncedValues({mounted:i,transitionStatus:a}),{forceUnmount:o,transitionStatus:a}}function da(e,t){e.useSyncedValues(t),Y(()=>()=>{e.update({activeTriggerProps:O,inactiveTriggerProps:O,popupProps:O})},[e])}function fa(e,t){Y(()=>{!t&&e.state.openMethod!==null&&e.set(`openMethod`,null)},[t,e]),Y(()=>()=>{e.state.openMethod!==null&&e.set(`openMethod`,null)},[e])}var pa=class{idMap=new Map;add(e,t){this.idMap.set(e,t)}delete(e){this.idMap.delete(e)}hasElement(e){for(let t of this.idMap.values())if(t===e)return!0;return!1}hasMatchingElement(e){for(let t of this.idMap.values())if(e(t))return!0;return!1}getById(e){return this.idMap.get(e)}entries(){return this.idMap.entries()}elements(){return this.idMap.values()}get size(){return this.idMap.size}},ma=[],ha=void 0;function ga(){return ha}function _a(e){ma.push(e)}function va(e){let t=(t,n)=>{let r=b(ba).current,i;try{ha=r;for(let e of ma)e.before(r);i=e(t,n);for(let e of ma)e.after(r);r.didInitialize=!0}finally{ha=void 0}return i};return t.displayName=e.displayName||e.name,t}function ya(e){return l.forwardRef(va(e))}function ba(){return{didInitialize:!1}}var xa=re(19)?wa:Ta;function Sa(e,t,n,r,i){return xa(e,t,n,r,i)}function Ca(e,t,n,r,i){let a=l.useCallback(()=>t(e.getSnapshot(),n,r,i),[e,t,n,r,i]);return(0,fr.useSyncExternalStore)(e.subscribe,a,a)}_a({before(e){e.syncIndex=0,e.didInitialize||(e.syncTick=1,e.syncHooks=[],e.didChangeStore=!0,e.getSnapshot=()=>{let t=!1;for(let n=0;n<e.syncHooks.length;n+=1){let r=e.syncHooks[n],i=r.selector(r.store.state,r.a1,r.a2,r.a3);Object.is(r.value,i)||(t=!0,r.value=i)}return t&&(e.syncTick+=1),e.syncTick})},after(e){e.syncHooks.length>0&&(e.didChangeStore&&(e.didChangeStore=!1,e.subscribe=t=>{let n=new Set;for(let t of e.syncHooks)n.add(t.store);let r=[];for(let e of n)r.push(e.subscribe(t));return()=>{for(let e of r)e()}}),(0,fr.useSyncExternalStore)(e.subscribe,e.getSnapshot,e.getSnapshot))}});function wa(e,t,n,r,i){let a=ga();if(!a)return Ca(e,t,n,r,i);let o=a.syncIndex;a.syncIndex+=1;let s;return a.didInitialize?(s=a.syncHooks[o],(s.store!==e||s.selector!==t||!Object.is(s.a1,n)||!Object.is(s.a2,r)||!Object.is(s.a3,i))&&(s.store!==e&&(a.didChangeStore=!0),s.store=e,s.selector=t,s.a1=n,s.a2=r,s.a3=i,s.value=t(e.getSnapshot(),n,r,i))):(s={store:e,selector:t,a1:n,a2:r,a3:i,value:t(e.getSnapshot(),n,r,i)},a.syncHooks.push(s)),s.value}function Ta(e,t,n,r,i){return(0,pr.useSyncExternalStoreWithSelector)(e.subscribe,e.getSnapshot,e.getSnapshot,e=>t(e,n,r,i))}var Ea=class{static create(e){return new this(e)}constructor(e){this.state=e,this.listeners=new Set,this.updateTick=0}subscribe=e=>(this.listeners.add(e),()=>{this.listeners.delete(e)});getSnapshot=()=>this.state;setState(e){if(this.state===e)return;this.state=e,this.updateTick+=1;let t=this.updateTick;for(let n of this.listeners){if(t!==this.updateTick)return;n(e)}}update(e){for(let t in e)if(!Object.is(this.state[t],e[t])){this.setState({...this.state,...e});return}}set(e,t){Object.is(this.state[e],t)||this.setState({...this.state,[e]:t})}notifyAll(){let e={...this.state};this.setState(e)}use(e,t,n,r){return Sa(this,e,t,n,r)}},Da=class extends Ea{constructor(e,t={},n){super(e),this.context=t,this.selectors=n}useSyncedValue(e,t){l.useDebugValue(e);let n=this;Y(()=>{n.state[e]!==t&&n.set(e,t)},[n,e,t])}useSyncedValueWithCleanup(e,t){let n=this;Y(()=>(n.state[e]!==t&&n.set(e,t),()=>{n.set(e,void 0)}),[n,e,t])}useSyncedValues(e){let t=this;Y(()=>{t.update(e)},[t,...Object.values(e)])}useControlledProp(e,t){l.useDebugValue(e);let n=this,r=t!==void 0;Y(()=>{r&&!Object.is(n.state[e],t)&&n.setState({...n.state,[e]:t})},[n,e,t,r])}select(e,t,n,r){let i=this.selectors[e];return i(this.state,t,n,r)}useState(e,t,n,r){return l.useDebugValue(e),Sa(this,this.selectors[e],t,n,r)}useContextCallback(e,t){l.useDebugValue(e);let n=C(t??E);this.context[e]=n}useStateSetter(e){let t=l.useRef(void 0);return t.current===void 0&&(t.current=t=>{this.set(e,t)}),t.current}observe(e,t){let n;n=typeof e==`function`?e:this.selectors[e];let r=n(this.state);return t(r,r,this),this.subscribe(e=>{let i=n(e);if(!Object.is(r,i)){let e=r;r=i,t(i,e,this)}})}},Oa={open:e=>e.open,transitionStatus:e=>e.transitionStatus,domReferenceElement:e=>e.domReferenceElement,referenceElement:e=>e.positionReference??e.referenceElement,floatingElement:e=>e.floatingElement,floatingId:e=>e.floatingId},ka=class extends Da{constructor(e){let{syncOnly:t,nested:n,onOpenChange:r,triggerElements:i,...a}=e;super({...a,positionReference:a.referenceElement,domReferenceElement:a.referenceElement},{onOpenChange:r,dataRef:{current:{}},events:wi(),nested:n,triggerElements:i},Oa),this.syncOnly=t}syncOpenEvent=(e,t)=>{(!e||!this.state.open||t!=null&&sn(t))&&(this.context.dataRef.current.openEvent=e?t:void 0)};dispatchOpenChange=(e,t)=>{this.syncOpenEvent(e,t.event);let n={open:e,reason:t.reason,nativeEvent:t.event,nested:this.context.nested,triggerElement:t.trigger};this.context.events.emit(`openchange`,n)};setOpen=(e,t)=>{if(this.syncOnly){this.context.onOpenChange?.(e,t);return}this.dispatchOpenChange(e,t),this.context.onOpenChange?.(e,t)}};function Aa(e,t,n=!1){return{open:!1,openProp:void 0,mounted:!1,transitionStatus:void 0,floatingRootContext:new ka({open:!1,transitionStatus:void 0,floatingElement:null,referenceElement:null,triggerElements:e,floatingId:t,syncOnly:!0,nested:n,onOpenChange:void 0}),floatingId:t,triggerCount:0,preventUnmountingOnClose:!1,payload:void 0,activeTriggerId:null,activeTriggerElement:null,openedWithoutTrigger:!1,triggerIdProp:void 0,popupElement:null,positionerElement:null,activeTriggerProps:O,inactiveTriggerProps:O,popupProps:O}}var ja=e=>e.triggerIdProp??e.activeTriggerId,Ma=e=>e.openProp??e.open,Na=e=>(e.popupElement?.id??e.floatingId)||void 0;function Pa(e,t){return t!==void 0&&Ma(e)&&ja(e)===t}function Fa(e,t){return Pa(e,t)?!0:t!==void 0&&Ma(e)&&ja(e)==null&&!e.openedWithoutTrigger&&e.triggerCount===1}var Ia={open:Ma,mounted:e=>e.mounted,transitionStatus:e=>Ma(e)&&!e.mounted?`starting`:e.transitionStatus,floatingRootContext:e=>e.floatingRootContext,triggerCount:e=>e.triggerCount,preventUnmountingOnClose:e=>e.preventUnmountingOnClose,payload:e=>e.payload,activeTriggerId:ja,activeTriggerElement:e=>e.mounted?e.activeTriggerElement:null,popupId:Na,isTriggerActive:(e,t)=>t!==void 0&&ja(e)===t,isOpenedByTrigger:(e,t)=>Pa(e,t),isMountedByTrigger:(e,t)=>t!==void 0&&ja(e)===t&&e.mounted,triggerProps:(e,t)=>t?e.activeTriggerProps:e.inactiveTriggerProps,triggerPopupId:(e,t)=>Fa(e,t)?Na(e):void 0,popupProps:e=>e.popupProps,popupElement:e=>e.popupElement,positionerElement:e=>e.positionerElement};function La(e){let t=l.useCallback(t=>e===void 0?E:e.subscribeStore(t),[e]),n=l.useCallback(()=>e===void 0?void 0:e.store,[e]);return(0,fr.useSyncExternalStore)(t,n,()=>e?.serverStore)}var Ra=class e{pointerType=void 0;interactedInside=!1;handler=void 0;blockMouseMove=!0;performedPointerEventsMutation=!1;pointerEventsScopeElement=null;pointerEventsReferenceElement=null;pointerEventsFloatingElement=null;restTimeoutPending=!1;openChangeTimeout=new j;restTimeout=new j;handleCloseOptions=void 0;static create(){return new e}dispose=()=>{this.openChangeTimeout.clear(),this.restTimeout.clear()};disposeEffect=()=>this.dispose},za=new WeakMap;function Ba(e){if(!e.performedPointerEventsMutation)return;let t=e.pointerEventsScopeElement;t&&za.get(t)===e&&(e.pointerEventsScopeElement?.style.removeProperty(`pointer-events`),e.pointerEventsReferenceElement?.style.removeProperty(`pointer-events`),e.pointerEventsFloatingElement?.style.removeProperty(`pointer-events`),za.delete(t)),e.performedPointerEventsMutation=!1,e.pointerEventsScopeElement=null,e.pointerEventsReferenceElement=null,e.pointerEventsFloatingElement=null}function Va(e,t){let{scopeElement:n,referenceElement:r,floatingElement:i}=t,a=za.get(n);a&&a!==e&&Ba(a),Ba(e),e.performedPointerEventsMutation=!0,e.pointerEventsScopeElement=n,e.pointerEventsReferenceElement=r,e.pointerEventsFloatingElement=i,za.set(n,e),n.style.pointerEvents=`none`,r.style.pointerEvents=`auto`,i.style.pointerEvents=`auto`}function Ha(e){let t=e.context.dataRef.current,n=b(()=>t.hoverInteractionState??Ra.create()).current;return t.hoverInteractionState||=n,k(t.hoverInteractionState.disposeEffect),t.hoverInteractionState}function Ua(e,t={}){let{enabled:n=!0,closeDelay:r=0,nodeId:i}=t,a=e.useState(`open`),o=e.useState(`floatingElement`),s=e.useState(`domReferenceElement`),{dataRef:c}=e.context,u=ki(),d=Oi(),f=Ha(e),p=M(),m=C(()=>Ur(c.current.openEvent?.type,f.interactedInside)),h=C(()=>Wr(c.current.openEvent?.type)),g=C(()=>{Ba(f)});Y(()=>{a||(f.pointerType=void 0,f.restTimeoutPending=!1,f.interactedInside=!1,g())},[a,f,g]),l.useEffect(()=>g,[g]),Y(()=>{if(n&&a&&f.handleCloseOptions?.blockPointerEvents&&h()&&G(s)&&o){let e=s,t=o,n=J(o),r=u?.nodesRef.current.find(e=>e.id===d)?.context?.elements.floating;r&&(r.style.pointerEvents=``);let i=f.pointerEventsScopeElement===t?null:f.pointerEventsScopeElement,a=r===t?null:r,c=f.handleCloseOptions?.getScope?.()??i??a??ht(e,`[data-rootownerid]`)??n.body;return Va(f,{scopeElement:c,referenceElement:e,floatingElement:t}),()=>{g()}}},[n,a,s,o,f,h,u,d,g]),l.useEffect(()=>{if(!n)return;function t(){return!!(u&&d&&$t(u.nodesRef.current,d).length>0)}function a(t){let n=Vr(r,`close`,f.pointerType),i=()=>{e.setOpen(!1,Z(Dr,t)),u?.events.emit(`floating.closed`,t)};n?f.openChangeTimeout.start(n,i):(f.openChangeTimeout.clear(),i())}function s(e){let t=gt(e);if(!Yt(t)){f.interactedInside=!1;return}f.interactedInside=ht(t,`[aria-haspopup]`)!=null}function l(){f.openChangeTimeout.clear(),p.clear(),u?.events.off(`floating.closed`,v),g()}function _(n){if(t()&&u){u.events.on(`floating.closed`,v);return}if(Gt(n.relatedTarget,e.context.triggerElements))return;let r=c.current.floatingContext?.nodeId??i,o=n.relatedTarget;if(!(u&&r&&G(o)&&$t(u.nodesRef.current,r,!1).some(e=>q(e.context?.elements.floating,o)))){if(f.handler){f.handler(n);return}g(),h()&&!m()&&a(n)}}function v(n){!u||!d||t()||p.start(0,()=>{u.events.off(`floating.closed`,v),e.setOpen(!1,Z(Dr,n)),u.events.emit(`floating.closed`,n)})}let y=o;return Gr(y&&X(y,`mouseenter`,l),y&&X(y,`mouseleave`,_),y&&X(y,`pointerdown`,s,!0),()=>{u?.events.off(`floating.closed`,v)})},[n,o,e,c,r,i,h,m,g,f,u,d,p])}var Wa={current:null};function Ga(e,t={}){let{enabled:n=!0,delay:r=0,handleClose:i=null,mouseOnly:a=!1,restMs:o=0,move:s=!0,triggerElementRef:c=Wa,externalTree:u,isActiveTrigger:d=!0,getHandleCloseContext:f,isClosing:p,shouldOpen:m,guardStaleOpen:h=!1}=t,{dataRef:g,events:_}=e.context,v=ki(u),y=Ha(e),b=l.useRef(!1),x=Q(i),S=Q(r),w=Q(o),T=Q(n),E=Q(m),D=Q(p),O=C(()=>Ur(g.current.openEvent?.type,y.interactedInside)),k=C(()=>E.current?.()!==!1),A=C((t,n,r)=>{let i=e.context.triggerElements;if(i.hasElement(n))return!t||!q(t,n);if(!G(r))return!1;let a=r;return i.hasMatchingElement(e=>q(e,a))&&(!t||!q(t,a))}),j=C(()=>{y.handler&&=(J(e.select(`domReferenceElement`)).removeEventListener(`mousemove`,y.handler),void 0)}),M=C(()=>{Ba(y)});return d&&(y.handleCloseOptions=i?.__options),l.useEffect(()=>j,[j]),l.useEffect(()=>{if(!n)return;function e(e){e.open?b.current=!1:(b.current=e.reason===Dr,j(),y.openChangeTimeout.clear(),y.restTimeout.clear(),y.blockMouseMove=!0,y.restTimeoutPending=!1)}return _.on(`openchange`,e),()=>{_.off(`openchange`,e)}},[n,_,y,j]),l.useEffect(()=>{if(!n)return;function t(t,n=!0){let r=Vr(S.current,`close`,y.pointerType);r?y.openChangeTimeout.start(r,()=>{e.setOpen(!1,Z(Dr,t)),v?.events.emit(`floating.closed`,t)}):n&&(y.openChangeTimeout.clear(),e.setOpen(!1,Z(Dr,t)),v?.events.emit(`floating.closed`,t))}let r=c.current??(d?e.select(`domReferenceElement`):null);if(!G(r))return;function i(t){if(y.openChangeTimeout.clear(),y.blockMouseMove=!1,a&&!on(y.pointerType))return;let n=Hr(w.current),r=Vr(S.current,`open`,y.pointerType),i=gt(t),o=t.currentTarget??null,s=e.select(`domReferenceElement`),c=o;if(G(i)&&!e.context.triggerElements.hasElement(i)){for(let t of e.context.triggerElements.elements())if(q(t,i)){c=t;break}}G(o)&&G(s)&&!e.context.triggerElements.hasElement(o)&&q(o,s)&&(c=s);let l=c!=null&&A(s,c,i),u=e.select(`open`),d=D.current?.()??e.select(`transitionStatus`)===`ending`,f=!u&&d&&b.current,p=!l&&G(c)&&G(s)&&q(s,c)&&f,m=n>0&&!r,h=l&&(u||f)||p,g=!u||l;if(h){k()&&e.setOpen(!0,Z(Dr,t,c));return}m||(r?y.openChangeTimeout.start(r,()=>{g&&k()&&e.setOpen(!0,Z(Dr,t,c))}):g&&k()&&e.setOpen(!0,Z(Dr,t,c)))}function o(n){if(O()){M();return}j();let r=J(e.select(`domReferenceElement`));y.restTimeout.clear(),y.restTimeoutPending=!1;let i=g.current.floatingContext??f?.();if(!Gt(n.relatedTarget,e.context.triggerElements)){if(x.current&&i){e.select(`open`)||y.openChangeTimeout.clear();let a=c.current;y.handler=x.current({...i,tree:v,x:n.clientX,y:n.clientY,onClose(){M(),j(),T.current&&!O()&&a===e.select(`domReferenceElement`)&&t(n,!0)}}),r.addEventListener(`mousemove`,y.handler),y.handler(n);return}(y.pointerType!==`touch`||!q(e.select(`floatingElement`),n.relatedTarget))&&t(n)}}function l(e){q(r,e.relatedTarget)||(y.openChangeTimeout.clear(),y.restTimeout.clear(),y.restTimeoutPending=!1)}let u=h?X(r,`mouseout`,l):void 0;return s?Gr(X(r,`mousemove`,i,{once:!0}),X(r,`mouseenter`,i),X(r,`mouseleave`,o),u):Gr(X(r,`mouseenter`,i),X(r,`mouseleave`,o),u)},[j,M,g,S,e,n,x,y,d,A,O,a,s,w,c,v,T,f,D,k,h]),l.useMemo(()=>{if(!n)return;function t(e){y.pointerType=e.pointerType}return{onPointerDown:t,onPointerEnter:t,onMouseMove(t){let{nativeEvent:n}=t,r=t.currentTarget,i=e.select(`domReferenceElement`),o=e.select(`open`),s=A(i,r,t.target);if(a&&!on(y.pointerType))return;if(o&&s&&y.handleCloseOptions?.blockPointerEvents){let t=e.select(`floatingElement`);if(t){let e=y.handleCloseOptions?.getScope?.()??r.ownerDocument.body;Va(y,{scopeElement:e,referenceElement:r,floatingElement:t})}}let c=Hr(w.current);if(o&&!s||c===0||!s&&y.restTimeoutPending&&t.movementX**2+t.movementY**2<2)return;y.restTimeout.clear();function l(){if(y.restTimeoutPending=!1,O())return;let t=e.select(`open`);!y.blockMouseMove&&(!t||s)&&k()&&e.setOpen(!0,Z(Dr,n,r))}y.pointerType===`touch`?R.flushSync(()=>{l()}):s&&o?l():(y.restTimeoutPending=!0,y.restTimeout.start(c,l))}}},[n,y,O,A,a,e,w,k])}var Ka=.1,qa=Ka*Ka,$=.5;function Ja(e,t,n,r,i,a){return r>=t!=a>=t&&e<=(i-n)*(t-r)/(a-r)+n}function Ya(e,t,n,r,i,a,o,s,c,l){let u=!1;return Ja(e,t,n,r,i,a)&&(u=!u),Ja(e,t,i,a,o,s)&&(u=!u),Ja(e,t,o,s,c,l)&&(u=!u),Ja(e,t,c,l,n,r)&&(u=!u),u}function Xa(e,t,n){return e>=n.x&&e<=n.x+n.width&&t>=n.y&&t<=n.y+n.height}function Za(e,t,n,r,i,a){return e>=Math.min(n,i)&&e<=Math.max(n,i)&&t>=Math.min(r,a)&&t<=Math.max(r,a)}function Qa(e={}){let{blockPointerEvents:t=!1}=e,n=new j,r=({x:e,y:t,placement:r,elements:i,onClose:a,nodeId:o,tree:s})=>{let c=r?.split(`-`)[0],l=!1,u=null,d=null,f=typeof performance<`u`?performance.now():0;function p(e,t){let n=performance.now(),r=n-f;if(u===null||d===null||r===0)return u=e,d=t,f=n,!1;let i=e-u,a=t-d,o=i*i+a*a,s=r*r*qa;return u=e,d=t,f=n,o<s}function m(){n.clear(),a()}return function(r){n.clear();let a=i.domReference,u=i.floating;if(!a||!u||c==null||e==null||t==null)return;let{clientX:d,clientY:f}=r,h=gt(r),g=r.type===`mouseleave`,_=q(u,h),v=q(a,h);if(_&&(l=!0,!g))return;if(v&&(l=!1,!g)){l=!0;return}if(g&&G(r.relatedTarget)&&q(u,r.relatedTarget))return;function y(){return!!(s&&$t(s.nodesRef.current,o).length>0)}function b(){y()||m()}if(y())return;let x=a.getBoundingClientRect(),S=u.getBoundingClientRect(),C=e>S.right-S.width/2,w=t>S.bottom-S.height/2,T=S.width>x.width,E=S.height>x.height,D=(T?x:S).left,O=(T?x:S).right,k=(E?x:S).top,A=(E?x:S).bottom;if(c===`top`&&t>=x.bottom-1||c===`bottom`&&t<=x.top+1||c===`left`&&e>=x.right-1||c===`right`&&e<=x.left+1){b();return}let j=!1;switch(c){case`top`:j=Za(d,f,D,x.top+1,O,S.bottom-1);break;case`bottom`:j=Za(d,f,D,S.top+1,O,x.bottom-1);break;case`left`:j=Za(d,f,S.right-1,A,x.left+1,k);break;case`right`:j=Za(d,f,x.right-1,A,S.left+1,k)}if(j)return;if(l&&!Xa(d,f,x)){b();return}if(!g&&p(d,f)){b();return}let M=!1;switch(c){case`top`:{let n=T?$/2:$*4,r=T||C?e+n:e-n,i=T?e-n:C?e+n:e-n,a=t+$+1,o=C||T?S.bottom-$:S.top,s=C?T?S.bottom-$:S.top:S.bottom-$;M=Ya(d,f,r,a,i,a,S.left,o,S.right,s);break}case`bottom`:{let n=T?$/2:$*4,r=T||C?e+n:e-n,i=T?e-n:C?e+n:e-n,a=t-$,o=C||T?S.top+$:S.bottom,s=C?T?S.top+$:S.bottom:S.top+$;M=Ya(d,f,r,a,i,a,S.left,o,S.right,s);break}case`left`:{let n=E?$/2:$*4,r=E||w?t+n:t-n,i=E?t-n:w?t+n:t-n,a=e+$+1,o=w||E?S.right-$:S.left,s=w?E?S.right-$:S.left:S.right-$;M=Ya(d,f,o,S.top,s,S.bottom,a,r,a,i);break}case`right`:{let n=E?$/2:$*4,r=E||w?t+n:t-n,i=E?t-n:w?t+n:t-n,a=e-$,o=w||E?S.left+$:S.right,s=w?E?S.left+$:S.right:S.left+$;M=Ya(d,f,a,r,a,i,o,S.top,s,S.bottom);break}}M?l||n.start(40,b):b()}};return r.__options={...e,blockPointerEvents:t},r}function $a(e,t,n){let{reference:r,floating:i}=e,a=bn(t),o=xn(t),s=yn(o),c=gn(t),l=a===`y`,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2,p;switch(c){case`top`:p={x:u,y:r.y-i.height};break;case`bottom`:p={x:u,y:r.y+r.height};break;case`right`:p={x:r.x+r.width,y:d};break;case`left`:p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}let m=_n(t);return m&&(p[o]+=f*(m===`end`?1:-1)*(n&&l?-1:1)),p}async function eo(e,t){t===void 0&&(t={});let{x:n,y:r,platform:i,rects:a,elements:o,strategy:s}=e,{boundary:c=`clippingAncestors`,rootBoundary:l=`viewport`,elementContext:u=`floating`,altBoundary:d=!1,padding:f=0}=hn(t,e),p=Nn(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=Pn(await i.getClippingRect({element:await(i.isElement==null?void 0:i.isElement(m))??!0?m:m.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:c,rootBoundary:l,strategy:s})),g=u===`floating`?{x:n,y:r,width:a.floating.width,height:a.floating.height}:a.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),v=await(i.isElement==null?void 0:i.isElement(_))&&await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1},y=Pn(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:g,offsetParent:_,strategy:s}):g);return{top:(h.top-y.top+p.top)/v.y,bottom:(y.bottom-h.bottom+p.bottom)/v.y,left:(h.left-y.left+p.left)/v.x,right:(y.right-h.right+p.right)/v.x}}var to=50,no=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:eo},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=$a(l,r,c),f=r,p=0,m={};for(let n=0;n<a.length;n++){let h=a[n];if(!h)continue;let{name:g,fn:_}=h,{x:v,y,data:b,reset:x}=await _({x:u,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:m,rects:l,platform:s,elements:{reference:e,floating:t}});u=v??u,d=y??d,m[g]={...m[g],...b},x&&p<to&&(p++,typeof x==`object`&&(x.placement&&(f=x.placement),x.rects&&(l=x.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):x.rects),{x:u,y:d}=$a(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},ro=function(e){return e===void 0&&(e={}),{name:`flip`,options:e,async fn(t){var n;let{placement:r,middlewareData:i,rects:a,initialPlacement:o,platform:s,elements:c}=t,{mainAxis:l=!0,crossAxis:u=!0,fallbackPlacements:d,fallbackStrategy:f=`bestFit`,fallbackAxisSideDirection:p=`none`,flipAlignment:m=!0,...h}=hn(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=gn(r),_=bn(o),v=gn(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[jn(o)]:Cn(o)),x=p!==`none`;!d&&x&&b.push(...An(o,m,p,y));let S=[o,...b],C=await s.detectOverflow(t,h),w=[],T=i.flip?.overflows||[];if(l&&w.push(C[g]),u){let e=Sn(r,a,y);w.push(C[e[0]],C[e[1]])}if(T=[...T,{placement:r,overflows:w}],!w.every(e=>e<=0)){let e=(i.flip?.index||0)+1,t=S[e];if(t&&(u!==`alignment`||_===bn(t)||T.every(e=>bn(e.placement)!==_||e.overflows[0]>0)))return{data:{index:e,overflows:T},reset:{placement:t}};let n=T.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(f){case`bestFit`:{let e=T.filter(e=>{if(x){let t=bn(e.placement);return t===_||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=o}if(r!==n)return{reset:{placement:n}}}return{}}}},io=new Set([`left`,`top`]);async function ao(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=gn(n),s=_n(n),c=bn(n)===`y`,l=io.has(o)?-1:1,u=a&&c?-1:1,d=hn(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d==`number`?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m==`number`&&(p=s===`end`?m*-1:m),c?{x:p*u,y:f*l}:{x:f*l,y:p*u}}var oo=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,async fn(t){var n;let{x:r,y:i,placement:a,middlewareData:o}=t,s=await ao(t,e);return a===o.offset?.placement&&(n=o.arrow)!=null&&n.alignmentOffset?{}:{x:r+s.x,y:i+s.y,data:{...s,placement:a}}}}},so=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,async fn(t){let{x:n,y:r,placement:i,platform:a}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=hn(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=bn(i),p=vn(f),m=u[p],h=u[f],g=(e,t)=>mn(t+d[e===`y`?`top`:`left`],t,t-d[e===`y`?`bottom`:`right`]);o&&(m=g(p,m)),s&&(h=g(f,h));let _=c.fn({...t,[p]:m,[f]:h});return{..._,data:{x:_.x-n,y:_.y-r,enabled:{[p]:o,[f]:s}}}}}},co=function(e){return e===void 0&&(e={}),{options:e,fn(t){let{x:n,y:r,placement:i,rects:a,middlewareData:o}=t,{offset:s=0,mainAxis:c=!0,crossAxis:l=!0}=hn(e,t),u={x:n,y:r},d=bn(i),f=vn(d),p=u[f],m=u[d],h=hn(s,t),g=typeof h==`number`?{mainAxis:h,crossAxis:0}:{mainAxis:h.mainAxis??0,crossAxis:h.crossAxis??0};if(c){let e=f===`y`?`height`:`width`,t=a.reference[f]-a.floating[e]+g.mainAxis,n=a.reference[f]+a.reference[e]-g.mainAxis;p<t?p=t:p>n&&(p=n)}if(l){let e=f===`y`?`width`:`height`,t=io.has(gn(i)),n=a.reference[d]-a.floating[e]+(t&&o.offset?.[d]||0)+(t?0:g.crossAxis),r=a.reference[d]+a.reference[e]+(t?0:o.offset?.[d]||0)-(t?g.crossAxis:0);m<n?m=n:m>r&&(m=r)}return{[f]:p,[d]:m}}}},lo=function(e){return e===void 0&&(e={}),{name:`size`,options:e,async fn(t){let{placement:n,rects:r,platform:i,elements:a}=t,{apply:o=()=>{},...s}=hn(e,t),c=await i.detectOverflow(t,s),l=gn(n),u=_n(n),d=bn(n)===`y`,{width:f,height:p}=r.floating,m,h;l===`top`||l===`bottom`?(m=l,h=u===(await(i.isRTL==null?void 0:i.isRTL(a.floating))?`start`:`end`)?`left`:`right`):(h=l,m=u===`end`?`top`:`bottom`);let g=p-c.top-c.bottom,_=f-c.left-c.right,v=cn(p-c[m],g),y=cn(f-c[h],_),b=t.middlewareData.shift,x=!b,S=v,C=y;b!=null&&b.enabled.x&&(C=_),b!=null&&b.enabled.y&&(S=g),x&&!u&&(d?C=f-2*ln(c.left,c.right):S=p-2*ln(c.top,c.bottom)),await o({...t,availableWidth:C,availableHeight:S});let w=await i.getDimensions(a.floating);return f!==w.width||p!==w.height?{reset:{rects:!0}}:{}}}};function uo(e){let t=Je(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=K(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=un(n)!==a||un(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function fo(e){return G(e)?e:e.contextElement}function po(e){let t=fo(e);if(!K(t))return fn(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=uo(t),o=(a?un(n.width):n.width)/r,s=(a?un(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var mo=fn(0);function ho(e){let t=W(e);return!Ke()||!t.visualViewport?mo:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function go(e,t,n){return t===void 0&&(t=!1),!!n&&t&&n===W(e)}function _o(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=fo(e),o=fn(1);t&&(r?G(r)&&(o=po(r)):o=po(e));let s=go(a,n,r)?ho(a):fn(0),c=(i.left+s.x)/o.x,l=(i.top+s.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(a&&r){let e=W(a),t=G(r)?W(r):r,n=e,i=$e(n);for(;i&&t!==n;){let e=po(i),t=i.getBoundingClientRect(),r=Je(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,l*=e.y,u*=e.x,d*=e.y,c+=a,l+=o,n=W(i),i=$e(n)}}return Pn({width:u,height:d,x:c,y:l})}function vo(e,t){let n=Ye(e).scrollLeft;return t?t.left+n:_o(Pe(e)).left+n}function yo(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-vo(e,n),y:n.top+t.scrollTop}}function bo(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=Pe(r),s=t?ze(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=fn(1),u=fn(0),d=K(r);if((d||!a)&&((U(r)!==`body`||Le(o))&&(c=Ye(r)),d)){let e=_o(r);l=po(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?yo(o,c):fn(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+f.x,y:n.y*l.y-c.scrollTop*l.y+u.y+f.y}}function xo(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function So(e){let t=Ye(e),n=e.ownerDocument.body,r=ln(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),i=ln(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight),a=-t.scrollLeft+vo(e),o=-t.scrollTop;return Je(n).direction===`rtl`&&(a+=ln(e.clientWidth,n.clientWidth)-r),{width:r,height:i,x:a,y:o}}var Co=25;function wo(e,t,n){n===void 0&&(n=`viewport`);let r=n===`layoutViewport`,i=W(e),a=Pe(e),o=i.visualViewport,s=a.clientWidth,c=a.clientHeight,l=0,u=0;if(o){let e=!Ke()||t===`fixed`;r?e||(l=-o.offsetLeft,u=-o.offsetTop):(s=o.width,c=o.height,e&&(l=o.offsetLeft,u=o.offsetTop))}if(vo(a)<=0){let e=a.ownerDocument,t=e.body,n=getComputedStyle(t),r=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,i=Math.abs(a.clientWidth-t.clientWidth-r),o=getComputedStyle(a).scrollbarGutter===`stable both-edges`?i/2:i;o<=Co&&(s-=o)}return{width:s,height:c,x:l,y:u}}function To(e,t){let n=_o(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=po(e);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function Eo(e,t,n){let r;if(t===`viewport`||t===`layoutViewport`)r=wo(e,n,t);else if(t===`document`)r=So(Pe(e));else if(G(t))r=To(t,n);else{let n=ho(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return Pn(r)}function Do(e,t){let n=t.get(e);if(n)return n;let r=Qe(e,[],!1).filter(e=>G(e)&&U(e)!==`body`),i=null,a=Je(e).position===`fixed`,o=a?Xe(e):e;for(;G(o)&&!qe(o);){let e=Je(o),t=We(o),n=i?i.position:a?`fixed`:``;!t&&(n===`fixed`||n===`absolute`&&e.position===`static`)?r=r.filter(e=>e!==o):i=e,o=Xe(o)}return t.set(e,r),r}function Oo(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?ze(t)?[]:Do(t,this._c):[].concat(n),r],o=Eo(t,a[0],i),s=o.top,c=o.right,l=o.bottom,u=o.left;for(let e=1;e<a.length;e++){let n=Eo(t,a[e],i);s=ln(n.top,s),c=cn(n.right,c),l=cn(n.bottom,l),u=ln(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function ko(e){let{width:t,height:n}=uo(e);return{width:t,height:n}}function Ao(e,t,n){let r=K(t),i=Pe(t),a=n===`fixed`,o=_o(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=fn(0);if((r||!a)&&((U(t)!==`body`||Le(i))&&(s=Ye(t)),r)){let e=_o(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}!r&&i&&(c.x=vo(i));let l=i&&!r&&!a?yo(i,s):fn(0);return{x:o.left+s.scrollLeft-c.x-l.x,y:o.top+s.scrollTop-c.y-l.y,width:o.width,height:o.height}}function jo(e){return Je(e).position===`static`}function Mo(e,t){if(!K(e)||Je(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return Pe(e)===n&&(n=n.ownerDocument.body),n}function No(e,t){let n=W(e);if(ze(e))return n;if(!K(e)){let t=Xe(e);for(;t&&!qe(t);){if(G(t)&&!jo(t))return t;t=Xe(t)}return n}let r=Mo(e,t);for(;r&&Re(r)&&jo(r);)r=Mo(r,t);return r&&qe(r)&&jo(r)&&!We(r)?n:r||Ge(e)||n}var Po=async function(e){let t=this.getOffsetParent||No,n=this.getDimensions,r=await n(e.floating);return{reference:Ao(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Fo(e){return Je(e).direction===`rtl`}var Io={convertOffsetParentRelativeRectToViewportRelativeRect:bo,getDocumentElement:Pe,getClippingRect:Oo,getOffsetParent:No,getElementRects:Po,getClientRects:xo,getDimensions:ko,getScale:po,isElement:G,isRTL:Fo};function Lo(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Ro(e,t,n){let r=null,i,a=Pe(e);function o(){var e;clearTimeout(i),(e=r)==null||e.disconnect(),r=null}function s(n,c){n===void 0&&(n=!1),c===void 0&&(c=1),o();let l=e.getBoundingClientRect(),{left:u,top:d,width:f,height:p}=l;if(n||t(),!f||!p)return;let m=dn(d),h=dn(a.clientWidth-(u+f)),g=dn(a.clientHeight-(d+p)),_=dn(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:ln(0,cn(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(!Lo(l,e.getBoundingClientRect()))return s();if(n!==c){if(!y)return s();n?s(!1,n):i=setTimeout(()=>{s(!1,1e-7)},1e3)}y=!1}try{r=new IntersectionObserver(b,{...v,root:a.ownerDocument})}catch{r=new IntersectionObserver(b,v)}r.observe(e)}let c=W(e),l=()=>s(n);return c.addEventListener(`resize`,l),s(!0),()=>{c.removeEventListener(`resize`,l),o()}}function zo(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver==`function`,layoutShift:s=typeof IntersectionObserver==`function`,animationFrame:c=!1}=r,l=fo(e),u=i||a?[...l?Qe(l):[],...t?Qe(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n),a&&e.addEventListener(`resize`,n)});let d=l&&s?Ro(l,n,a):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&t&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),t&&p.observe(t));let m,h=c?_o(e):null;c&&g();function g(){let t=_o(e);h&&!Lo(h,t)&&n(),h=t,m=requestAnimationFrame(g)}return n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener(`scroll`,n),a&&e.removeEventListener(`resize`,n)}),d?.(),(e=p)==null||e.disconnect(),p=null,c&&cancelAnimationFrame(m)}}var Bo=oo,Vo=so,Ho=ro,Uo=lo,Wo=co,Go=(e,t,n)=>{let r=new Map,i=n??{},a={...Io,...i.platform,_c:r};return no(e,t,{...i,platform:a})},Ko=typeof document<`u`?l.useLayoutEffect:function(){};function qo(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e==`function`&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e==`object`){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!qo(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){let n=i[r];if(!(n===`_owner`&&e.$$typeof)&&!qo(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function Jo(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Yo(e,t){let n=Jo(e);return Math.round(t*n)/n}function Xo(e){let t=l.useRef(e);return Ko(()=>{t.current=e}),t}function Zo(e){e===void 0&&(e={});let{placement:t=`bottom`,strategy:n=`absolute`,middleware:r=[],platform:i,elements:{reference:a,floating:o}={},transform:s=!0,whileElementsMounted:c,open:u}=e,[d,f]=l.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[p,m]=l.useState(r);qo(p,r)||m(r);let[h,g]=l.useState(null),[_,v]=l.useState(null),y=l.useCallback(e=>{e!==C.current&&(C.current=e,g(e))},[]),b=l.useCallback(e=>{e!==w.current&&(w.current=e,v(e))},[]),x=a||h,S=o||_,C=l.useRef(null),w=l.useRef(null),T=l.useRef(d),E=c!=null,D=Xo(c),O=Xo(i),k=Xo(u),A=l.useCallback(()=>{if(!C.current||!w.current)return;let e={placement:t,strategy:n,middleware:p};O.current&&(e.platform=O.current),Go(C.current,w.current,e).then(e=>{let t={...e,isPositioned:k.current!==!1};j.current&&!qo(T.current,t)&&(T.current=t,R.flushSync(()=>{f(t)}))})},[p,t,n,O,k]);Ko(()=>{u===!1&&T.current.isPositioned&&(T.current.isPositioned=!1,f(e=>({...e,isPositioned:!1})))},[u]);let j=l.useRef(!1);Ko(()=>(j.current=!0,()=>{j.current=!1}),[]),Ko(()=>{if(x&&(C.current=x),S&&(w.current=S),x&&S){if(D.current)return D.current(x,S,A);A()}},[x,S,A,D,E]);let M=l.useMemo(()=>({reference:C,floating:w,setReference:y,setFloating:b}),[y,b]),N=l.useMemo(()=>({reference:x,floating:S}),[x,S]),P=l.useMemo(()=>{let e={position:n,left:0,top:0};if(!N.floating)return e;let t=Yo(N.floating,d.x),r=Yo(N.floating,d.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...Jo(N.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,N.floating,d.x,d.y]);return l.useMemo(()=>({...d,update:A,refs:M,elements:N,floatingStyles:P}),[d,A,M,N,P])}var Qo=(e,t)=>{let n=Bo(e);return{name:n.name,fn:n.fn,options:[e,t]}},$o=(e,t)=>{let n=Vo(e);return{name:n.name,fn:n.fn,options:[e,t]}},es=(e,t)=>({fn:Wo(e).fn,options:[e,t]}),ts=(e,t)=>{let n=Ho(e);return{name:n.name,fn:n.fn,options:[e,t]}},ns=(e,t)=>{let n=Uo(e);return{name:n.name,fn:n.fn,options:[e,t]}},rs=new Set([`ArrowUp`,`ArrowDown`,`ArrowLeft`,`ArrowRight`,`Home`,`End`]);function is(e){return re(19)?e:e?`true`:void 0}var as=l.forwardRef(function(e,t){let{cutout:n,...r}=e,i;if(n){let e=n.getBoundingClientRect();i=`polygon(0% 0%,100% 0%,100% 100%,0% 100%,0% 0%,${e.left}px ${e.top}px,${e.left}px ${e.bottom}px,${e.right}px ${e.bottom}px,${e.right}px ${e.top}px,${e.left}px ${e.top}px)`}return(0,c.jsx)(`div`,{ref:t,role:`presentation`,"data-base-ui-inert":``,...r,style:{position:`fixed`,inset:0,userSelect:`none`,WebkitUserSelect:`none`,clipPath:i}})}),os={},ss={},cs=``;function ls(e,t){return Le(e)?e:t}function us(e,t,n){return/hidden|clip/.test(e.getComputedStyle(ls(t,n)).overflowY)}function ds(e){if(typeof document>`u`)return!1;let t=J(e);return W(t).innerWidth-t.documentElement.clientWidth>0}function fs(e){if(!(typeof CSS<`u`&&CSS.supports&&CSS.supports(`scrollbar-gutter`,`stable`))||typeof document>`u`)return!1;let t=J(e),n=t.documentElement,r=t.body,i=ls(n,r),a=i.style.overflowY,o=n.style.scrollbarGutter;n.style.scrollbarGutter=`stable`,i.style.overflowY=`scroll`;let s=i.offsetWidth;i.style.overflowY=`hidden`;let c=i.offsetWidth;return i.style.overflowY=a,n.style.scrollbarGutter=o,s===c}function ps(e){let t=J(e),n=t.documentElement,r=t.body,i=ls(n,r),a={overflowY:i.style.overflowY,overflowX:i.style.overflowX};return Object.assign(i.style,{overflowY:`hidden`,overflowX:`hidden`}),()=>{Object.assign(i.style,a)}}function ms(e){let t=J(e),n=t.documentElement,r=t.body,i=W(n),a=0,o=0,s=!1,c=Yr.create();if(dt&&(i.visualViewport?.scale??1)!==1)return()=>{};function l(){let t=i.getComputedStyle(n),c=i.getComputedStyle(r),l=(t.scrollbarGutter||``).includes(`both-edges`)?`stable both-edges`:`stable`;a=n.scrollTop,o=n.scrollLeft,os={scrollbarGutter:n.style.scrollbarGutter,overflowY:n.style.overflowY,overflowX:n.style.overflowX},cs=n.style.scrollBehavior,ss={position:r.style.position,height:r.style.height,width:r.style.width,boxSizing:r.style.boxSizing,overflowY:r.style.overflowY,overflowX:r.style.overflowX,scrollBehavior:r.style.scrollBehavior};let u=n.scrollHeight>n.clientHeight,d=n.scrollWidth>n.clientWidth,f=t.overflowY===`scroll`||c.overflowY===`scroll`,p=t.overflowX===`scroll`||c.overflowX===`scroll`,m=Math.max(0,i.innerWidth-r.clientWidth),h=Math.max(0,i.innerHeight-r.clientHeight),g=parseFloat(c.marginTop)+parseFloat(c.marginBottom),_=parseFloat(c.marginLeft)+parseFloat(c.marginRight),v=ls(n,r);if(s=fs(e),s){n.style.scrollbarGutter=l,v.style.overflowY=`hidden`,v.style.overflowX=`hidden`;return}Object.assign(n.style,{scrollbarGutter:l,overflowY:`hidden`,overflowX:`hidden`}),(u||f)&&(n.style.overflowY=`scroll`),(d||p)&&(n.style.overflowX=`scroll`),Object.assign(r.style,{position:`relative`,height:g||h?`calc(100dvh - ${g+h}px)`:`100dvh`,width:_||m?`calc(100vw - ${_+m}px)`:`100vw`,boxSizing:`border-box`,overflowY:`hidden`,overflowX:`hidden`,scrollBehavior:`unset`}),r.scrollTop=a,r.scrollLeft=o,n.setAttribute(`data-base-ui-scroll-locked`,``),n.style.scrollBehavior=`unset`}function u(){Object.assign(n.style,os),Object.assign(r.style,ss),s||(n.scrollTop=a,n.scrollLeft=o,n.removeAttribute(`data-base-ui-scroll-locked`),n.style.scrollBehavior=cs)}function d(){u(),c.request(l)}l();let f=X(i,`resize`,d);return()=>{c.cancel(),u(),typeof i.removeEventListener==`function`&&f()}}var hs=new class{lockCount=0;restore=null;timeoutLock=j.create();timeoutUnlock=j.create();acquire(e){return this.lockCount+=1,this.lockCount===1&&this.restore===null&&this.timeoutLock.start(0,()=>this.lock(e)),this.release}release=()=>{--this.lockCount,this.lockCount===0&&this.restore&&this.timeoutUnlock.start(0,this.unlock)};unlock=()=>{this.lockCount===0&&this.restore&&(this.restore?.(),this.restore=null)};lock(e){if(this.lockCount===0||this.restore!==null)return;let t=J(e),n=t.documentElement,r=t.body,i=W(n);if(us(i,n,r)){let t=new i.MutationObserver(()=>{us(i,n,r)||(t.disconnect(),this.restore=null,this.lock(e))}),a={attributes:!0};t.observe(n,a),t.observe(r,a),this.restore=()=>t.disconnect();return}let a=ot||!ds(e);this.restore=a?ps(e):ms(e)}};function gs(e=!0,t=null){Y(()=>{if(e)return hs.acquire(t)},[e,t])}function _s(e){let t=l.useRef(``),n=l.useCallback(n=>{n.defaultPrevented||(t.current=n.pointerType,e(n,n.pointerType))},[e]);return{onClick:l.useCallback(n=>{if(n.detail===0){e(n,`keyboard`);return}`pointerType`in n?e(n,n.pointerType):e(n,t.current),t.current=``},[e]),onPointerDown:n}}function vs(e,t){let n=l.useRef(e),r=C(t);Y(()=>{n.current!==e&&r(n.current),n.current=e},[e,r])}function ys(e,t){let{onClick:n,onPointerDown:r}=_s(C((n,r)=>{(typeof e==`function`?e():e)||t(r||(ot?`touch`:``))}));return l.useMemo(()=>({onClick:n,onPointerDown:r}),[n,r])}function bs(e){let[t,n]=l.useState(null),r=ys(e,n);return vs(e,t=>{t&&!e&&n(null)}),l.useMemo(()=>({openMethod:t,triggerProps:r}),[t,r])}var xs=`data-glide-stand-in`;function Ss(e,t){let n=e.getBoundingClientRect(),r=t.getBoundingClientRect();return{x:r.left-n.left+e.scrollLeft-e.clientLeft,y:r.top-n.top+e.scrollTop-e.clientTop,width:r.width,height:r.height}}function Cs(e){return{transform:`translate(${String(e.x)}px, ${String(e.y)}px)`,width:`${String(e.width)}px`,height:`${String(e.height)}px`}}function ws(e){let t=(0,l.useRef)(null);return(0,l.useCallback)(n=>{t.current?.(),t.current=n?Ts(n,e):null},[e])}function Ts(e,t){if(!o(e))return()=>void 0;let n=e.ownerDocument,r=e.querySelector(t),i=r?Ss(e,r):null,c=null,l=null,u=new Set,d=()=>{for(let e of u)e.removeAttribute(xs);u.clear(),c&&(c.hidden=!0),l=null},f=()=>{if(c)return c;let t=n.createElement(`span`);return t.className=`caps-glide`,t.setAttribute(`aria-hidden`,`true`),e.prepend(t),e.classList.add(`caps-glide-host`),getComputedStyle(e).position===`static`&&e.classList.add(`caps-glide-anchor`),c=t,t},p=(t,n)=>{let r=s(e),o=Ss(e,t),p=l&&c?Ss(e,c):i;if(i=o,l?.cancel(),d(),r.reduced||p===null||Math.abs(p.y-o.y)<1&&Math.abs(p.x-o.x)<1)return;t.setAttribute(xs,`measure`);let m=getComputedStyle(t),h=m.backgroundColor,g=m.borderRadius;for(let e of[t,n])e&&(e.setAttribute(xs,``),u.add(e));let _=f();_.hidden=!1,_.style.backgroundColor=h,_.style.borderRadius=g;let v=_.animate([Cs(p),Cs(o)],{duration:r.normal,easing:a(r,r.ease),fill:`forwards`});l=v,v.addEventListener(`finish`,()=>{l===v&&d()})},m=()=>{let n=e.querySelector(t);if(n===r)return;let i=r;r=n,n&&p(n,i)},h=new MutationObserver(m);return h.observe(e,{subtree:!0,attributes:!0,attributeFilter:[`data-highlighted`,`data-active`,`data-navigation`,`aria-selected`]}),e.addEventListener(`pointerover`,m),e.addEventListener(`pointerout`,m),()=>{h.disconnect(),e.removeEventListener(`pointerover`,m),e.removeEventListener(`pointerout`,m),l?.cancel(),d(),c?.remove()}}var Es=l.createContext(void 0);function Ds(e){let t=l.useContext(Es);if(t===void 0&&!e)throw Error(P(69));return t}function Os(e){return e===`starting`?mi:O}function ks(e){let{nodeId:t,externalTree:n,rootContext:r}=e,i=r.useState(`referenceElement`),a=r.useState(`floatingElement`),o=r.useState(`domReferenceElement`),s=r.useState(`open`),c=r.useState(`floatingId`),[u,d]=l.useState(null),f=l.useRef(null),p=ki(n),m=l.useMemo(()=>({reference:i,floating:a,domReference:o}),[i,a,o]),h=Zo({...e,elements:{...m,...u&&{reference:u}}}),g=l.useCallback(e=>{let t=G(e)?{getBoundingClientRect:()=>e.getBoundingClientRect(),getClientRects:()=>e.getClientRects(),contextElement:e}:e;d(t),h.refs.setReference(t)},[h.refs]),_=l.useMemo(()=>({...h.refs,setPositionReference:g,domReference:f}),[h.refs,g]),v=l.useMemo(()=>({...h.elements,domReference:o}),[h.elements,o]),y=l.useMemo(()=>({...h,dataRef:r.context.dataRef,open:s,onOpenChange:r.setOpen,events:r.context.events,floatingId:c,refs:_,elements:v,nodeId:t,rootStore:r}),[h,_,v,t,r,s,c]);return Y(()=>{o&&(f.current=o)},[o]),Y(()=>{r.context.dataRef.current.floatingContext=y;let e=p?.nodesRef.current.find(e=>e.id===t);e&&(e.context=y)}),l.useMemo(()=>({...h,context:y,refs:_,elements:v,rootStore:r}),[h,_,v,y,r])}var As=e=>({name:`arrow`,options:e,async fn(t){let{x:n,y:r,placement:i,rects:a,platform:o,elements:s,middlewareData:c}=t,{element:l,padding:u=0}=hn(e,t)||{};if(l==null)return{};let d=Nn(u),f={x:n,y:r},p=xn(i),m=yn(p),h=await o.getDimensions(l),g=p===`y`,_=g?`top`:`left`,v=g?`bottom`:`right`,y=g?`clientHeight`:`clientWidth`,b=a.reference[m]+a.reference[p]-f[p]-a.floating[m],x=f[p]-a.reference[p],S=s.floating[y]||a.floating[m],C=b/2-x/2,w=S/2-h[m]/2-1,T=Math.min(d[_],w),E=Math.min(d[v],w),D=T,O=S-h[m]-E,k=S/2-h[m]/2+C,A=mn(D,k,O),j=!c.arrow&&_n(i)!=null&&k!==A&&a.reference[m]/2-(k<D?T:E)-h[m]/2<0,M=j?k<D?k-D:k-O:0;return{[p]:f[p]+M,data:{[p]:A,centerOffset:k-A-M,...j&&{alignmentOffset:M}},reset:j}}}),js=(e,t)=>{let{name:n,fn:r}=As(e);return{name:n,fn:r,options:[e,t]}},Ms={name:`hide`,async fn(e){let{width:t,height:n,x:r,y:i}=e.rects.reference,a=t===0&&n===0&&r===0&&i===0,o=await e.platform.detectOverflow(e,{elementContext:`reference`});return{data:{referenceHidden:o.top-n>=0||o.right-t>=0||o.bottom-n>=0||o.left-t>=0||a}}}},Ns={sideX:`left`,sideY:`top`},Ps=`--available-width`,Fs=`--available-height`,Is=`--anchor-width`,Ls=`--anchor-height`,Rs=`--transform-origin`,zs=Ps,Bs=Fs;function Vs(e,t,n){let r=e===`inline-start`||e===`inline-end`;return{top:`top`,right:r?n?`inline-start`:`inline-end`:`right`,bottom:`bottom`,left:r?n?`inline-end`:`inline-start`:`left`}[t]}function Hs(e,t,n){let{rects:r,placement:i}=e;return{side:Vs(t,gn(i),n),align:_n(i)||`center`,anchor:{width:r.reference.width,height:r.reference.height},positioner:{width:r.floating.width,height:r.floating.height}}}function Us(e){return Ws(e,ks)}function Ws(e,t){let{anchor:n,positionMethod:r=`absolute`,side:i=`bottom`,sideOffset:a=0,align:o=`center`,alignOffset:s=0,collisionBoundary:c,collisionPadding:u=5,sticky:d=!1,arrowPadding:f=5,disableAnchorTracking:p=!1,inline:m,keepMounted:h=!1,floatingRootContext:g,mounted:_,collisionAvoidance:v,shift:y,nodeId:b,adaptiveOrigin:x,lazyFlip:S=!1,externalTree:w}=e,T=v.side||`flip`,E=v.align||`flip`,D=v.fallbackAxisSide||`end`,O=y?.crossAxis??!1,k=y?.rootBoundary,A=typeof n==`function`?n:void 0,j=C(A),M=A?j:n,N=Q(n),P=Q(_),F=hr()===`rtl`,[I,L]=l.useState(null);!_&&I!==null&&L(null);let ee=S===`placement`,te=I?gn(I):null,ne=I&&ee?_n(I)||`center`:null,R=te||{top:`top`,right:`right`,bottom:`bottom`,left:`left`,"inline-end":F?`left`:`right`,"inline-start":F?`right`:`left`}[i],z=ne||o,re=z===`center`?R:`${R}-${z}`,B=u;typeof B==`number`?B={top:B,right:B,bottom:B,left:B}:B&&={top:B.top||0,right:B.right||0,bottom:B.bottom||0,left:B.left||0};let ie=+(i===`bottom`),ae=+(i===`top`),oe=+(i===`right`),se=+(i===`left`),ce={boundary:c===`clipping-ancestors`?`clippingAncestors`:c,padding:B},V=l.useRef(null),le=Q(a),H=Q(s),ue=typeof a==`function`?0:a,de=typeof s==`function`?0:s,fe=[];m&&fe.push(m),fe.push(Qo(e=>{let t=Hs(e,i,F),n=typeof le.current==`function`?le.current(t):le.current,r=typeof H.current==`function`?H.current(t):H.current;return{mainAxis:n,crossAxis:r,alignmentAxis:r}},[ue,de,F,i]));let pe=E===`none`&&T!==`shift`,me=!pe&&(d||O||T===`shift`),he=T===`none`?null:ts({...ce,padding:{top:B.top+1+ie,right:B.right+1+se,bottom:B.bottom+1+ae,left:B.left+1+oe},mainAxis:!O&&T===`flip`,crossAxis:E===`flip`&&`alignment`,fallbackAxisSideDirection:D}),ge=pe?null:$o({...ce,rootBoundary:k,mainAxis:E!==`none`,crossAxis:me,limiter:d||O?void 0:es(e=>{if(!V.current)return{};let{width:t,height:n}=V.current.getBoundingClientRect(),r=bn(gn(e.placement)),i=r===`y`?t:n,a=r===`y`?B.left+B.right:B.top+B.bottom;return{offset:i/2+a/2}})},[ce,d,O,k,B,E]);T===`shift`||E===`shift`||z===`center`?fe.push(ge,he):fe.push(he,ge),fe.push(ns({...ce,apply({elements:{floating:e},availableWidth:t,availableHeight:n,rects:r}){if(!P.current)return;let i=e.style;i.setProperty(zs,`${t}px`),i.setProperty(Bs,`${n}px`);let a=W(e).devicePixelRatio||1,{x:o,y:s,width:c,height:l}=r.reference,u=(Math.round((o+c)*a)-Math.round(o*a))/a,d=(Math.round((s+l)*a)-Math.round(s*a))/a;i.setProperty(Is,`${u}px`),i.setProperty(Ls,`${d}px`)}}),js(e=>({element:V.current||J(e.elements.floating).createElement(`div`),padding:V.current?f:0}),[f]),{name:`transformOrigin`,fn(e){let{elements:{floating:t},middlewareData:n,placement:r,platform:o,rects:s,y:c}=e,l=gn(r),u=_n(r),d=bn(l)===`y`,f=V.current,p=typeof a==`function`?a(Hs(e,i,F)):a,m;m=!f&&u&&Math.abs(d?n.shift?.x||0:n.shift?.y||0)<=1?u===`start`===(d&&o.isRTL?.(t)===!0)?`100%`:`0%`:`${(d?n.arrow?.x||0:n.arrow?.y||0)+(d?f?.clientWidth||0:f?.clientHeight||0)/2}px`;let h=l===`top`||l===`left`?`calc(100% + ${p}px)`:`${-p}px`;return me&&d&&Math.abs(n.shift?.y||0)>p&&(h=`${s.reference.y+s.reference.height/2-c}px`),t.style.setProperty(Rs,d?`${m} ${h}`:`${h} ${m}`),{}}},Ms,x),Y(()=>{!_&&g&&g.update({referenceElement:null,floatingElement:null,domReferenceElement:null,positionReference:null})},[_,g]);let _e=l.useMemo(()=>({ancestorScroll:!p,elementResize:!p&&typeof ResizeObserver<`u`,layoutShift:!p&&typeof IntersectionObserver<`u`}),[p]),{refs:ve,elements:ye,x:be,y:xe,middlewareData:Se,update:Ce,placement:we,context:Te,isPositioned:Ee,floatingStyles:De}=t({rootContext:g,open:h?_:void 0,placement:re,middleware:fe,strategy:r,whileElementsMounted:h?void 0:(...e)=>zo(...e,_e),nodeId:b,externalTree:w}),{sideX:Oe,sideY:ke}=Se.adaptiveOrigin||Ns,Ae=Ee?r:`fixed`,je=l.useMemo(()=>{let e;return e=Ee?x?{position:Ae,[Oe]:be,[ke]:xe}:{...De,position:Ae}:{position:Ae,top:0,left:0},e[zs]=`100vw`,e[Bs]=`100vh`,Ee||(e.opacity=0),e},[x,Ae,Oe,be,ke,xe,De,Ee]),Me=l.useRef(null);Y(()=>{if(!_)return;let e=N.current,t=typeof e==`function`?e():e,n=(Gs(t)?t.current:t)||null;n!==Me.current&&(ve.setPositionReference(n),Me.current=n)},[_,ve,M,N]),l.useEffect(()=>{if(!_)return;let e=N.current;typeof e!=`function`&&Gs(e)&&e.current!==Me.current&&(ve.setPositionReference(e.current),Me.current=e.current)},[_,ve,M,N]),l.useEffect(()=>{if(h&&_&&ye.reference&&ye.floating)return zo(ye.reference,ye.floating,Ce,_e)},[h,_,ye,Ce,_e]);let Ne=gn(we),U=Vs(i,Ne,F),Pe=_n(we)||`center`,Fe=!!Se.hide?.referenceHidden;Y(()=>{S&&_&&Ee&&(Ne!==R||ee&&Pe!==z)&&L(we)},[S,ee,_,Ee,we,Ne,Pe,R,z]);let G=l.useMemo(()=>({position:`absolute`,top:Se.arrow?.y,left:Se.arrow?.x}),[Se.arrow]),K=Se.arrow?.centerOffset!==0;return l.useMemo(()=>({positionerStyles:je,arrowStyles:G,arrowRef:V,arrowUncentered:K,side:U,align:Pe,physicalSide:Ne,anchorHidden:Fe,refs:ve,context:Te,isPositioned:Ee,update:Ce}),[je,G,V,K,U,Pe,Ne,Fe,ve,Te,Ee,Ce])}function Gs(e){return e!=null&&`current`in e}function Ks(e){let{store:t,domReference:n,positionerElement:r,open:i}=e,a=l.useRef(null),o=l.useRef(null),s=Zi(r);Y(()=>{i||(o.current?.abort(),o.current=null,t.state.instantType===`trigger-change`&&t.set(`instantType`,void 0))},[i,t]),Y(()=>{let e=n,r=a.current;if(e&&(a.current=e),!r||!e||e===r||!t.select(`open`))return;t.set(`instantType`,void 0);let i=new AbortController;return o.current=i,s(()=>{t.select(`open`)&&t.set(`instantType`,`trigger-change`)},i.signal),()=>{i.abort()}},[n,s,t])}function qs(e,t,{styles:n,transitionStatus:r,props:i,refs:a,hidden:o,inert:s=!1}){let c={...n};return s&&(c.pointerEvents=`none`),be(`div`,e,{state:t,ref:a,props:[{role:`presentation`,hidden:o,style:c},Os(r),i],stateAttributesMapping:Ht})}var Js=20;function Ys(e,t,n,r){let[i,a]=l.useState(!1);Y(()=>{if(!e||!t||n==null){a(!1);return}let r=J(n).documentElement.clientWidth,i=n.offsetWidth;a(r>0&&i>0&&i>=r-Js)},[e,t,n]),gs(e&&(!t||i),r)}function Xs(e,t){function n(n,r,i){let a=n.currentTarget;R.flushSync(()=>{e.setOpen(!1,Z(Mr,n.nativeEvent,a))}),cr(a.isConnected?a:t.current,r,i)?.focus()}function r(t){n(t,-1,e.select(`positionerElement`))}function i(t){let r=e.select(`positionerElement`);r&&lr(t,r)?e.context.beforeContentFocusGuardRef.current?.focus():n(t,1,r)}return{handlePreFocusGuardFocus:r,handleFocusTargetFocus:i}}export{ni as $,St as $t,la as A,Ln as At,Ki as B,Gt as Bt,ya as C,O as Cn,br as Ct,sa as D,_ as Dn,hr as Dt,ra as E,b as En,gr as Et,ca as F,Bn as Ft,Ai as G,Ut as Gt,Hi as H,Jt as Ht,Qi as I,rn as It,Ti as J,kt as Jt,Oi as K,Vt as Kt,Zi as L,an as Lt,da as M,Rn as Mt,na as N,Hn as Nt,ta as O,p as On,Y as Ot,fa as P,Fn as Pt,_i as Q,Dt as Qt,Ji as R,tn as Rt,va as S,D as Sn,xr as St,ea as T,C as Tn,X as Tt,ji as U,Zt as Ut,Ui as V,Xt as Vt,Mi as W,Ht as Wt,hi as X,Ot as Xt,Ci as Y,jt as Yt,gi as Z,At as Zt,Ua as _,V as _n,Or as _t,Us as a,gt as an,Lr as at,Ia as b,j as bn,Z as bt,ws as c,lt as cn,Mr as ct,gs as d,G as dn,Fr as dt,yt as en,ei as et,as as f,K as fn,Pr as ft,Ga as g,be as gn,Rr as gt,Qa as h,we as hn,Ir as ht,Ks as i,q as in,Gr as it,ua as j,In as jt,oa as k,f as kn,J as kt,bs as l,Xe as ln,zr as lt,rs as m,Me as mn,kr as mt,Ys as n,xt as nn,Xr as nt,Os as o,pt as on,jr as ot,is as p,qe as pn,Tr as pt,ki as q,Bt as qt,qs as r,mt as rn,Q as rt,Ds as s,dt as sn,Nr as st,Xs as t,bt as tn,$r as tt,ys as u,W as un,Ar as ut,La as v,F as vn,Dr as vt,pa as w,E as wn,vr as wt,Da as x,M as xn,wr as xt,Aa as y,P as yn,Er as yt,qi as z,Qt as zt};
package/dist/index.html CHANGED
@@ -4,12 +4,28 @@
4
4
  <meta charset="UTF-8" />
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1" />
6
6
  <title>Media</title>
7
- <script type="module" crossorigin src="./assets/index-C0hNF6s0.js"></script>
7
+ <script type="module" crossorigin src="./assets/index-D-LwJiG1.js"></script>
8
8
  <link rel="modulepreload" crossorigin href="./assets/rolldown-runtime-hePW80VL.js">
9
9
  <link rel="modulepreload" crossorigin href="./assets/modules-C4mfDnjH.js">
10
- <link rel="modulepreload" crossorigin href="./assets/log-event-BpFScFqd.js">
11
- <link rel="modulepreload" crossorigin href="./assets/generation-quote-D7I39kF2.js">
12
- <link rel="modulepreload" crossorigin href="./assets/local-images-B-ZLs6V_.js">
10
+ <link rel="modulepreload" crossorigin href="./assets/button-oE2Hrd5D.js">
11
+ <link rel="modulepreload" crossorigin href="./assets/dist-DAokFn5x.js">
12
+ <link rel="modulepreload" crossorigin href="./assets/query-CYqgVHJ7.js">
13
+ <link rel="modulepreload" crossorigin href="./assets/library-view-BBAeJjj6.js">
14
+ <link rel="modulepreload" crossorigin href="./assets/log-event-B3BGsDWO.js">
15
+ <link rel="modulepreload" crossorigin href="./assets/audio-waveform-Be5wRu8s.js">
16
+ <link rel="modulepreload" crossorigin href="./assets/computer-Bfe-Ioxr.js">
17
+ <link rel="modulepreload" crossorigin href="./assets/status-DNJRO5m5.js">
18
+ <link rel="modulepreload" crossorigin href="./assets/useTriggerFocusGuards-Bddw7Qdn.js">
19
+ <link rel="modulepreload" crossorigin href="./assets/dropdown-menu-CAHLGfkb.js">
20
+ <link rel="modulepreload" crossorigin href="./assets/keycap-D2RkH2IS.js">
21
+ <link rel="modulepreload" crossorigin href="./assets/audio-waveform-view-DbTyVH72.js">
22
+ <link rel="modulepreload" crossorigin href="./assets/useMutation-DH-cbXIA.js">
23
+ <link rel="modulepreload" crossorigin href="./assets/textarea-LIOZDOK4.js">
24
+ <link rel="modulepreload" crossorigin href="./assets/generation-quote-DcaCSlvV.js">
25
+ <link rel="modulepreload" crossorigin href="./assets/ellipsis-DlNHenkt.js">
26
+ <link rel="modulepreload" crossorigin href="./assets/heart-BquDo4lf.js">
27
+ <link rel="modulepreload" crossorigin href="./assets/upload-queue-BHAaEiPu.js">
28
+ <link rel="modulepreload" crossorigin href="./assets/dialog-BXLOuKaF.js">
13
29
  <link rel="stylesheet" crossorigin href="./assets/index-BM24cAh6.css">
14
30
  </head>
15
31
  <body>
package/package.json CHANGED
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "name": "@fungi.computer/prints",
3
3
  "description": "Prints: generate images and video into a gallery on your Computer, an App for Oyster",
4
- "version": "0.18.0",
4
+ "version": "0.18.2",
5
5
  "author": "Levi <levi@technomancy.dev>",
6
6
  "type": "module",
7
7
  "dependencies": {
8
- "@fungi.computer/agar": "0.18.1",
8
+ "@fungi.computer/agar": "0.19.0",
9
9
  "@fungi.computer/cairn": "0.1.0",
10
- "@fungi.computer/caps": "0.11.7",
11
- "@fungi.computer/parakeet": "0.12.1",
10
+ "@fungi.computer/caps": "0.12.0",
11
+ "@fungi.computer/parakeet": "0.12.3",
12
12
  "@fungi.computer/sigils": "0.3.2",
13
13
  "@fungi.computer/whistle": "0.3.0",
14
14
  "@tanstack/react-form": "1.33.2",
@@ -20,12 +20,12 @@
20
20
  "react-dom": "18.3.1",
21
21
  "zod": "4.4.3",
22
22
  "@tanstack/react-query": "5.102.8",
23
- "@fungi.computer/darkroom": "0.11.1",
23
+ "@fungi.computer/darkroom": "0.11.3",
24
24
  "@fungi.computer/gills": "0.3.0",
25
25
  "@pierre/trees": "1.0.0-beta.6"
26
26
  },
27
27
  "devDependencies": {
28
- "@fungi.computer/puffball": "0.9.0",
28
+ "@fungi.computer/puffball": "0.9.1",
29
29
  "@ladle/react": "5.1.1",
30
30
  "@tailwindcss/cli": "4.2.1",
31
31
  "@tailwindcss/vite": "4.2.1",
@@ -40,7 +40,7 @@
40
40
  "vite": "8.2.2",
41
41
  "vite-plugin-singlefile": "2.3.3",
42
42
  "@cloudflare/workers-types": "5.20260828.1",
43
- "@fungi.computer/oyster": "0.33.0",
43
+ "@fungi.computer/oyster": "0.35.0",
44
44
  "eslint": "10.9.1",
45
45
  "jsdom": "29.0.1",
46
46
  "@types/node": "24.13.3"
@@ -1,2 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-hePW80VL.js";import{$t as t,A as n,An as r,Bt as i,C as a,Cn as o,D as s,Dn as c,E as l,En as u,Fn as d,Ft as f,Gn as p,Gt as m,Ht as h,I as g,In as _,It as v,Jn as y,Jr as b,Jt as x,Kn as S,Kt as C,L as w,Ln as T,Lt as ee,M as te,N as E,Nn as D,Nt as O,O as k,Or as A,P as j,Pt as ne,Qt as M,R as N,Rt as re,S as ie,Ut as ae,V as oe,Vt as se,Wt as ce,Xn as le,Xr as ue,Xt as de,Yn as fe,Yt as pe,Zr as me,Zt as he,_i as ge,an as _e,b as ve,bn as ye,ci as be,cn as xe,di as Se,dn as Ce,en as we,fi as Te,fn as P,fr as Ee,g as De,gi as Oe,gn as ke,h as Ae,hi as je,hn as Me,hr as Ne,in as Pe,j as Fe,jn as Ie,k as Le,l as Re,li as ze,m as F,mi as Be,mn as Ve,mr as He,n as Ue,oi as We,on as Ge,p as Ke,pi as qe,pn as Je,qn as Ye,qt as Xe,r as Ze,ri as Qe,rn as I,s as $e,si as et,sn as tt,t as nt,tn as rt,ui as it,un as at,v as ot,vn as L,w as st,wn as ct,x as lt,xn as R,y as ut,yn as z,z as dt,zt as B}from"./log-event-BpFScFqd.js";import{a as ft,i as pt,n as mt,o as ht,r as V}from"./modules-C4mfDnjH.js";function gt(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=>{ae(e,()=>t.signal,()=>n=!0)},u=C(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?m:ce;return{pages:c(e.pages,o,s),pageParams:c(e.pageParams,r,s)}};if(i&&a.length){let e=i===`backward`,t=e?vt:_t,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:_t(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 _t(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 vt(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}function yt(e,t){return t?_t(e,t)!=null:!1}function bt(e,t){return!t||!e.getPreviousPageParam?!1:vt(e,t)!=null}var xt=class extends ne{#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=wt(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=wt(this.options);e.data!==void 0&&(this.setState(Ct(e.data,e.dataUpdatedAt)),this.#t=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus===`idle`&&this.#r.remove(this)}setData(e,t){let n=rt(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 n=this.#a?.promise;return this.#a?.cancel(e),n?n.then(t).catch(t):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=>I(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Ge||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0&&this.observers.some(e=>I(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:!tt(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(e=>e.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#a?.continue()}onOnline(){this.observers.find(e=>e.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#a?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#r.notify({type:`observerAdded`,query:this,observer:e}))}removeObserver(e){let t=this.observers.indexOf(e);t!==-1&&(this.observers.splice(t,1),this.observers.length||(this.#a&&(this.#s||this.state.fetchStatus===`paused`&&this.state.status===`pending`?this.#a.cancel({revert:!0}):this.#a.cancelRetry()),this.scheduleGc()),this.#r.notify({type:`observerRemoved`,query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||this.#c({type:`invalidate`})}async fetch(e,t){if(this.state.fetchStatus!==`idle`&&this.#a?.status()!==`rejected`){if(this.state.data!==void 0&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#a)return this.#a.continueRetry(),this.#a.promise}if(e&&this.setOptions(e),!this.options.queryFn){let e=this.observers.find(e=>e.options.queryFn);e&&this.setOptions(e.options)}let n=new AbortController,r=e=>{Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(this.#s=!0,n.signal)})},i=()=>{let e=C(this.options,t),n=(()=>{let e={client:this.#i,queryKey:this.queryKey,meta:this.meta};return r(e),e})();return this.#s=!1,this.options.persister?this.options.persister(e,n,this):e(n)},a=(()=>{let e={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#i,state:this.state,fetchFn:i};return r(e),e})();(this.#e===`infinite`?gt(this.options.pages):this.options.behavior)?.onFetch(a,this),this.#n=this.state,(this.state.fetchStatus===`idle`||this.state.fetchMeta!==a.fetchOptions?.meta)&&this.#c({type:`fetch`,meta:a.fetchOptions?.meta});let o=this.#a=ee({initialPromise:t?.initialPromise,fn:a.fetchFn,onCancel:e=>{e instanceof f&&e.revert&&this.setState({...this.#n,fetchStatus:`idle`}),n.abort()},onFail:(e,t)=>{this.#c({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#c({type:`pause`})},onContinue:()=>{this.#c({type:`continue`})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0});try{let e=await o.start();if(e===void 0)throw Error(`${this.queryHash} data is undefined`);return this.setData(e),this.#r.config.onSuccess?.(e,this),this.#r.config.onSettled?.(e,this.state.error,this),e}catch(e){if(e instanceof f){if(e.silent)return this.#a.promise;if(e.revert){if(this.state.data===void 0)throw e;return this.state.data}}throw this.#c({type:`error`,error:e}),this.#r.config.onError?.(e,this),this.#r.config.onSettled?.(this.state.data,e,this),e}finally{this.#a===o&&(this.#a=void 0),this.scheduleGc()}}#c(e){let t=t=>{switch(e.type){case`failed`:return{...t,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case`pause`:return{...t,fetchStatus:`paused`};case`continue`:return{...t,fetchStatus:`fetching`};case`fetch`:return{...t,...St(t.data,this.options),fetchMeta:e.meta??null};case`success`:let n={...t,...Ct(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 St(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:v(t.networkMode)?`fetching`:`paused`,...e===void 0&&{error:null,status:`pending`}}}function Ct(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:`success`}}function wt(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 Tt=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),Dt(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 I(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&&!Pe(this.options,t)&&this.#e.getQueryCache().notify({type:`observerOptionsUpdated`,query:this.#t,observer:this});let r=this.hasListeners();r&&kt(this.#t,n,this.options,t)&&this.#m(),this.updateResult(),r&&(this.#t!==n||I(this.options.enabled,this.#t)!==I(t.enabled,this.#t)||I(this.options.staleTime,this.#t)!==I(t.staleTime,this.#t))&&this.#g();let i=this.#_();r&&(this.#t!==n||I(this.options.enabled,this.#t)!==I(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 Pe(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 n=this.#t.fetch(this.options,e);return e?.throwOnError||(n=n.catch(t)),n}#h(e){return!h()&&I(this.options.enabled,this.#t)!==!1&&de(e)}#g(){this.#b();let e=I(this.options.staleTime,this.#t);if(this.#r.isStale||!this.#h(e))return;let t=tt(this.#r.dataUpdatedAt,e)+1;this.#u=xe.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=xe.setInterval(()=>{(this.options.refetchIntervalInBackground||i.isFocused())&&this.#m()},this.#f))}#y(){this.#g(),this.#v(this.#_())}#b(){this.#u!==void 0&&(xe.clearTimeout(this.#u),this.#u=void 0)}#x(){this.#d!==void 0&&(xe.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&&Dt(e,t),o=i&&kt(e,n,t,r);(a||o)&&(l={...l,...St(c.data,e.options)}),t._optimisticResults===`isRestoring`&&(l.fetchStatus=`idle`)}let{error:f,errorUpdatedAt:p,status:m}=l;d=l.data;let h=!1;if(t.placeholderData!==void 0&&d===void 0&&m===`pending`){let e;i?.isPlaceholderData&&t.placeholderData===o?.placeholderData?(e=i.data,h=!0):e=typeof t.placeholderData==`function`?t.placeholderData(this.#l?.state.data,this.#l):t.placeholderData,e!==void 0&&(m=`success`,d=rt(i?.data,e,t),u=!0)}if(t.select&&d!==void 0&&!h){if(i&&d===a?.data&&t.select===this.#s)d=this.#c;else try{this.#s=t.select,d=t.select(d),d=rt(i?.data,d,t),this.#c=d,this.#o=null}catch(e){this.#o=e}}else d===void 0&&(this.#o=null);this.#o&&(f=this.#o,d=this.#c,p=Date.now(),m=`error`,u=!1);let g=l.fetchStatus===`fetching`,_=m===`pending`,v=m===`error`,y=_&&g,b=d!==void 0;return{status:m,fetchStatus:l.fetchStatus,isPending:_,isSuccess:m===`success`,isError:v,isInitialLoading:y,isLoading:y,data:d,dataUpdatedAt:l.dataUpdatedAt,error:f,errorUpdatedAt:p,failureCount:l.fetchFailureCount,failureReason:l.fetchFailureReason,errorUpdateCount:l.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:l.dataUpdateCount>s.dataUpdateCount||l.errorUpdateCount>s.errorUpdateCount,isFetching:g,isRefetching:g&&!_,isLoadingError:v&&!b,isPaused:l.fetchStatus===`paused`,isPlaceholderData:u,isRefetchError:v&&b,isStale:At(e,t),refetch:this.refetch,isEnabled:I(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),Pe(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 Et(e,t){return I(t.enabled,e)!==!1&&e.state.data===void 0&&(e.state.status!==`error`||I(t.retryOnMount,e)!==!1)}function Dt(e,t){return Et(e,t)||e.state.data!==void 0&&Ot(e,t,t.refetchOnMount)}function Ot(e,t,n){if(I(t.enabled,e)!==!1&&I(t.staleTime,e)!==`static`){let r=typeof n==`function`?n(e):n;return r===`always`||r!==!1&&At(e,t)}return!1}function kt(e,t,n,r){return(e!==t||I(r.enabled,e)===!1)&&(!n.suspense||e.state.status!==`error`)&&At(e,n)}function At(e,t){return I(t.enabled,e)!==!1&&e.isStaleByTime(I(t.staleTime,e))}var jt=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 O({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=Mt(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=Mt(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=Mt(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=Mt(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=>he(t,e))}findAll(e={}){return this.getAll().filter(t=>he(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(t))))}};function Mt(e){return e.options.scope?.id}var Nt=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??pe(r,t),a=this.get(i);return a||(a=new xt({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()})})}},Pt=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new Nt,this.#t=e.mutationCache||new jt,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=i.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=re.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(I(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return this.#e.findAll(e).map(({queryKey:e,state:t})=>[e,t.data])}setQueryData(e,t,n){let r=this.defaultQueryOptions({queryKey:e}),i=this.#e.get(r.queryHash)?.state.data,a=Xe(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...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,n={}){let r={revert:!0,...n},i=B.batch(()=>this.#e.findAll(e).map(e=>e.cancel(r)));return Promise.all(i).then(t).catch(t)}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,n={}){let r={...n,cancelRefetch:n.cancelRefetch??!0},i=B.batch(()=>this.#e.findAll(e).filter(e=>!e.isDisabled()&&!e.isStatic()).map(e=>{let n=e.fetch(void 0,r);return r.throwOnError||(n=n.catch(t)),e.state.fetchStatus===`paused`?Promise.resolve():n}));return Promise.all(i).then(t)}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(I(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(I(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(t).catch(t)}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(t).catch(t)}ensureInfiniteQueryData(e){return e._type=`infinite`,this.ensureQueryData(e)}resumePausedMutations(){return re.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(x(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{we(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(x(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{we(e,t.mutationKey)&&Object.assign(n,t.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;let t={...this.#n.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||=pe(t.queryKey,t),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!==`always`),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode=`offlineFirst`),t.queryFn===Ge&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#n.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}},H=e(ge(),1),Ft=H.createContext(!1),It=()=>H.useContext(Ft);Ft.Provider;var U=Ce();function Lt(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var Rt=H.createContext(Lt()),zt=()=>H.useContext(Rt),Bt=(e,t,n)=>{let r=n?.state.error&&typeof e.throwOnError==`function`?_e(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||r)&&(t.isReset()||(e.retryOnMount=!1))},Vt=e=>{H.useEffect(()=>{e.clearReset()},[e])},Ht=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||_e(n,[e.error,r])),Ut=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))}},Wt=(e,t)=>e?.suspense&&t.isPending,Gt=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function Kt(e,n,r){let i=It(),a=zt(),o=at(r),s=o.defaultQueryOptions(e),c=o.getQueryCache().get(s.queryHash),l=e.subscribed!==!1;s._optimisticResults=i?`isRestoring`:l?`optimistic`:void 0,Ut(s),Bt(s,a,c),Vt(a);let[u]=H.useState(()=>new n(o,s)),d=u.getOptimisticResult(s),f=!i&&l;if(H.useSyncExternalStore(H.useCallback(e=>{let n=f?u.subscribe(B.batchCalls(e)):t;return u.updateResult(),n},[u,f]),()=>u.getCurrentResult(),()=>u.getCurrentResult()),H.useEffect(()=>{u.setOptions(s)},[s,u]),Wt(s,d))throw Gt(s,u,a);if(Ht({result:d,errorResetBoundary:a,throwOnError:s.throwOnError,query:c,suspense:s.suspense}))throw d.error;return s.notifyOnChangeProps?d:u.trackResult(d)}function qt(e,t){return Kt(e,Tt,t)}function Jt(e){return e}function Yt(e){return e}var Xt=`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(`.`),Zt=`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 Qt(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 $t(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=[Qt(Xt)];for(let e=1;e<t;e++)r.push(Qt(Zt));return r.join(n)}var en=Oe(`ZodMiniType`,(e,t)=>{if(!e._zod)throw Error(`Uninitialized schema in ZodMiniType.`);be.init(e,t),e.def=t,e.type=t.type,e.parse=(t,n)=>ze(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>Se(e,t,n),e.parseAsync=async(t,n)=>it(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>Te(e,t,n),e.check=(...n)=>e.clone({...t,checks:[...t.checks??[],...n.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]},{parent:!0}),e.with=e.check,e.clone=(t,n)=>qe(e,t,n),e.brand=()=>e,e.register=((t,n)=>(t.add(e,n),e)),e.apply=t=>t(e)}),tn=Oe(`ZodMiniObject`,(e,t)=>{et.init(e,t),en.init(e,t),Be(e,`shape`,()=>t.shape)});function nn(e,t){return new tn({type:`object`,shape:e??{},...je(t)})}var rn=Oe(`ZodMiniLiteral`,(e,t)=>{We.init(e,t),en.init(e,t)});function an(e,t){return new rn({type:`literal`,values:Array.isArray(e)?e:[e],...je(t)})}var on=ue({status:me()}),sn=3,cn=/network ?(?:changed|error)|failed to fetch|load failed|network connection was lost/iu;function ln(e){let t=[];for(let n=e;n!==void 0&&t.length<5;n=n instanceof Error?n.cause:void 0)t.push(n);return t}function un(e){return ln(e).some(e=>{if(e instanceof TypeError)return!0;if(e instanceof P)return e.code===`HOST_FAILURE`&&e.retryable;let t=on.safeParse(e);return t.success?t.data.status>=500:e instanceof Error&&cn.test(e.message)})}function dn(e,t){return e<sn&&un(t)}function fn(e){return 250*2**e}function pn(e){return e instanceof P?e:new P(`App operation failed`,{cause:e,code:`HOST_FAILURE`,retryable:!1})}var mn=new WeakMap,W={of(e,...t){return[e?.identity.surfaceId??null,e?.context.get().computerId??null,...t]}};function hn(e){let t={};return e&&mn.set(t,e),t}function gn(){let e=new Pt({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&&mn.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 G(e,t,n,r){let i=e?.context.get().computerId;return Jt({queryKey:n,meta:hn(e),enabled:e!==null,retry:dn,retryDelay:fn,queryFn:async({signal:n})=>{try{if(!e)throw new P(`No App connection`,{code:`DISCONNECTED`,retryable:!0});if(e.context.get().computerId!==i)throw new P(`The selected Computer changed`,{code:`SELECTION_CHANGED`,retryable:!1});return await r(e.capabilities.require(t),n)}catch(e){throw pn(e)}}})}function _n(e){return Yt({mutationKey:e.queryKey,scope:{id:x(e.queryKey)},mutationFn:async(t,n)=>{try{return await e.mutationFn(t,n)}catch(e){throw pn(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 K=oe(`app.backend`,1,b(()=>N({request:dt(w(Qe().transform(e=>A(e))))}))),vn=oe(`app.methods`,1,b(()=>N({call:dt(w(Qe().transform(e=>A(e))))}))),yn=72e4,bn=(0,H.forwardRef)(function({className:e,size:t=`md`,depth:n=`shallow`,placement:r=`standalone`,...i},a){return(0,U.jsx)(`div`,{...i,ref:a,"data-surface-size":t,"data-surface-depth":n,"data-surface-placement":r,className:j(`caps-surface`,e)})}),xn=(0,H.forwardRef)(function({className:e,...t},n){return(0,U.jsx)(`div`,{...t,ref:n,className:j(`caps-screen`,e)})});(0,H.forwardRef)(function({children:e,className:t,depth:n=`deep`,fit:r=`content`,density:i=`normal`,...a},o){let s=r===`fill`;return(0,U.jsx)(bn,{...a,className:j(t,s&&`flex min-h-0 flex-1`),depth:n,ref:o,children:(0,U.jsx)(`div`,{className:j(`caps-display-gasket`,s&&`flex min-h-0 min-w-0 flex-1`),"data-display-density":i,children:(0,U.jsx)(xn,{className:j(s&&`flex min-h-0 min-w-0 flex-1 overflow-hidden`),children:e})})})}),(0,H.forwardRef)(function({className:e,icon:t,status:n,title:r,...i},a){return(0,U.jsxs)(`header`,{...i,className:j(`caps-screen-header`,e),ref:a,children:[t?(0,U.jsx)(`span`,{className:`caps-screen-header-icon`,"aria-hidden":`true`,children:t}):null,(0,U.jsx)(`span`,{className:`caps-screen-header-title`,children:r}),n?(0,U.jsx)(`span`,{className:`caps-screen-header-status`,children:n}):null]})}),(0,H.forwardRef)(function({appearance:e,className:t,...n},r){return(0,U.jsx)(`div`,{...n,className:j(`caps-screen-cells`,t),"data-appearance":e===`compact`?e:void 0,ref:r})}),(0,H.forwardRef)(function({children:e,className:t,legend:n,readout:r,icon:i,appearance:a,wide:o=!1,...s},c){return(0,U.jsxs)(`div`,{...s,className:j(`caps-screen-cell`,t),"data-wide":o||void 0,"data-appearance":a===`compact`?a:void 0,ref:c,children:[i?(0,U.jsx)(`span`,{className:`caps-screen-cell-icon`,children:i}):null,n?(0,U.jsx)(`span`,{className:`caps-screen-cell-legend`,children:n}):null,r?(0,U.jsx)(`span`,{className:`caps-screen-cell-readout`,children:r}):null,a===`compact`?(0,U.jsx)(`div`,{className:`caps-screen-cell-controls`,children:e}):e]})});var Sn=(e=10,t)=>{let n=t?pt:ht;return t=>n(ft(t,0,1)*e)*(1/e)},q=Object.freeze({ease:`linear`,duration:0});function J(e,t){let n=Le(e,t.duration);return n<=0?q:e.steps>0?{ease:Sn(e.steps),duration:n}:{ease:mt({bounce:s(e,t.bounce),duration:n}),duration:n}}function Y(e,t){let r=n(e,t.duration);return{ease:e.steps>0?Sn(e.steps):t.ease,duration:r}}var Cn={dot:{y:-4,height:8,cy:0},pill:{y:-16,height:32,cy:0},bang:{y:-16,height:20,cy:12}};function wn({className:e,glyph:t,motion:r}){let i=`caps-status-${(0,H.useId)().replaceAll(`:`,``)}`,o=(0,H.useRef)(null),s=(0,H.useRef)(null),c=(0,H.useRef)(null),l=(0,H.useRef)(null),u=(0,H.useRef)(null),d=(0,H.useRef)(null),f=(0,H.useRef)(Cn[t]).current,p=(0,H.useRef)(t===`dot`?1:4).current,m=(0,H.useRef)(+(t===`bang`)).current,h=(0,H.useRef)(t),g=te(l),{reduced:_}=g;return(0,H.useLayoutEffect)(()=>{if(!o.current||!s.current||!u.current||!d.current)return;let e=Cn[t],r=_||h.current===t;h.current=t;let i=Fe(o.current),a=r?{duration:0}:J(i,{bounce:.3,duration:360}),c=V(o.current,{y:e.y,height:e.height,...a}),l=V(s.current,{cy:e.cy,...r?{duration:0}:{delay:n(i,35),...J(i,{bounce:.3,duration:420})}}),f=V(u.current,{gradientTransform:`matrix(1 0 0 ${t===`dot`?`1`:`4`} 0 0)`,...a}),p=V(d.current,{opacity:+(t===`bang`),...r?q:Y(i,{ease:`inOutSine`,duration:220})});return()=>{c.cancel(),l.cancel(),f.cancel(),p.cancel()}},[t,_]),(0,H.useLayoutEffect)(()=>{if(!c.current||!l.current||_||r===`none`)return;let e=r===`pulse`?V(c.current,{opacity:[1,.45],...Y(g,{ease:`inOutSine`,duration:750}),alternate:!0,loop:!0}):V(c.current,{keyframes:{"0%":{translateY:0,scaleX:1,scaleY:1},"18%":{translateY:.25,scaleX:1.1,scaleY:.91},"42%":{translateY:-1.3,scaleX:.94,scaleY:1.06},"62%":{translateY:-1.65,scaleX:1,scaleY:1},"82%":{translateY:.15,scaleX:1.06,scaleY:.95},"100%":{translateY:0,scaleX:1,scaleY:1}},...Y(g,{ease:`inOutSine`,duration:1e3}),loop:!0}),t=ut(l.current,t=>{t?e.resume():e.pause()});return()=>{t(),e.revert()}},[r,_,g]),(0,U.jsxs)(`svg`,{ref:l,"aria-hidden":`true`,className:`caps-status-bead ${e??``}`,width:`8`,height:`8`,viewBox:`-4 -4 8 8`,focusable:`false`,children:[(0,U.jsxs)(`defs`,{children:[(0,U.jsx)(ve,{id:i,values:st}),(0,U.jsx)(a,{ref:u,id:`${i}-surface`,transform:`matrix(1 0 0 ${String(p)} 0 0)`}),(0,U.jsxs)(`radialGradient`,{id:`${i}-drop-light`,gradientUnits:`userSpaceOnUse`,cx:`-1.2`,cy:`10.4`,r:`5.6`,children:[(0,U.jsx)(`stop`,{offset:`0`,stopColor:`var(--color-white)`,style:{stopOpacity:`calc(var(--depth) * 0.5)`}}),(0,U.jsx)(`stop`,{offset:`1`,stopColor:`var(--color-white)`,stopOpacity:`0`})]}),(0,U.jsx)(ie,{id:`${i}-shadow`}),(0,U.jsx)(`mask`,{id:`${i}-silhouette`,maskUnits:`userSpaceOnUse`,x:`-12`,y:`-24`,width:`24`,height:`48`,style:{maskType:`alpha`},children:(0,U.jsxs)(`g`,{fill:`var(--color-white)`,filter:`url(#${i})`,children:[(0,U.jsx)(`rect`,{ref:o,x:`-4`,y:f.y,width:`8`,height:f.height,rx:`4`}),(0,U.jsx)(`circle`,{ref:s,cx:`0`,cy:f.cy,r:`4`})]})})]}),(0,U.jsx)(`g`,{ref:c,filter:`url(#${i}-shadow)`,children:(0,U.jsxs)(`g`,{mask:`url(#${i}-silhouette)`,children:[(0,U.jsx)(`rect`,{x:`-12`,y:`-24`,width:`24`,height:`48`,fill:`url(#${i}-surface)`}),(0,U.jsx)(`rect`,{ref:d,x:`-12`,y:`-24`,width:`24`,height:`48`,fill:`url(#${i}-drop-light)`,opacity:m})]})})]})}var Tn=.28;function En(e,t){switch(e){case`ring`:return{dashes:1,track:0,arc:0,sweep:0,disc:0,tick:0,cross:0};case`arc`:return{dashes:0,track:1,arc:1,sweep:t===void 0?Tn:Math.min(1,Math.max(0,t)),disc:0,tick:0,cross:0};case`check`:return{dashes:0,track:0,arc:1,sweep:1,disc:1,tick:1,cross:0};case`cross`:return{dashes:0,track:0,arc:1,sweep:1,disc:1,tick:0,cross:1}}}var Dn=7.25;function On({className:e,glyph:t,progress:n}){let r=`caps-status-mark-${(0,H.useId)().replaceAll(`:`,``)}`,i=(0,H.useRef)(null),o=(0,H.useRef)(null),s=(0,H.useRef)(null),c=(0,H.useRef)(null),l=(0,H.useRef)(null),u=(0,H.useRef)(null),d=(0,H.useRef)(null),f=(0,H.useRef)(null),p=(0,H.useRef)(En(t,n)).current,m=(0,H.useRef)(t),h=E();(0,H.useLayoutEffect)(()=>{let e=i.current,r=o.current,a=s.current,l=c.current,p=u.current,g=d.current,_=f.current;if(!e||!r||!a||!l||!p||!g||!_)return;let v=En(t,n),y=m.current;m.current=t;let b=Fe(e),x=h||y===t&&t!==`arc`,S=x?h?{ease:b.ease,duration:b.fast}:q:Y(b,{ease:`outQuad`,duration:160}),C=(t===`check`||t===`cross`)&&!x,w=Y(b,{ease:`inOutSine`,duration:220}),T=[V(r,{opacity:v.dashes,...S}),V(a,{opacity:v.track*.28,...S}),V(l,{opacity:v.arc,"stroke-dasharray":`${String(v.sweep)} 1`,...x?h?q:S:w}),V(p,{r:v.disc*Dn,...C?{delay:w.duration*.7,...J(b,{bounce:.35,duration:360})}:h?q:Y(b,{ease:`inCubic`,duration:140})}),V(g,{"stroke-dashoffset":1-v.tick,...C&&v.tick>0?{delay:w.duration*.7+b.fast,...Y(b,{ease:`outCubic`,duration:240})}:q}),V(_,{"stroke-dashoffset":1-v.cross,...C&&v.cross>0?{delay:w.duration*.7+b.fast,...Y(b,{ease:`outCubic`,duration:240})}:q})];return t===`cross`&&C&&b.shake>0&&T.push(V(e,{translateX:[0,-b.shake,b.shake,-b.shake/2,0],delay:w.duration+b.fast,...Y(b,{ease:`linear`,duration:300})})),()=>{for(let e of T)e.cancel()}},[t,n,h]);let g=t===`arc`&&n===void 0&&!h;return(0,H.useLayoutEffect)(()=>{if(!g||!l.current||!i.current)return;let e=Fe(i.current),t=V(l.current,{rotate:[0,360],...Y(e,{ease:`linear`,duration:900}),loop:!0}),n=ut(i.current,e=>{e?t.resume():t.pause()});return()=>{n(),t.revert()}},[g]),(0,U.jsxs)(`svg`,{ref:i,"aria-hidden":`true`,className:`caps-status-mark ${e??``}`,viewBox:`0 0 16 16`,focusable:`false`,children:[(0,U.jsxs)(`defs`,{children:[(0,U.jsx)(a,{id:`${r}-surface`,transform:`matrix(1.6 0 0 1.6 8 8)`}),(0,U.jsxs)(`mask`,{id:`${r}-knock`,maskUnits:`userSpaceOnUse`,x:`0`,y:`0`,width:`16`,height:`16`,children:[(0,U.jsx)(`rect`,{width:`16`,height:`16`,fill:`var(--color-white)`}),(0,U.jsx)(`path`,{ref:d,d:`M4.9 8.3 7.1 10.5 11.2 5.9`,fill:`none`,stroke:`var(--color-black)`,strokeWidth:`1.9`,strokeLinecap:`round`,strokeLinejoin:`round`,pathLength:1,strokeDasharray:`1 1`,strokeDashoffset:1-p.tick}),(0,U.jsx)(`path`,{ref:f,d:`M5.4 5.4 10.6 10.6 M10.6 5.4 5.4 10.6`,fill:`none`,stroke:`var(--color-black)`,strokeWidth:`1.9`,strokeLinecap:`round`,pathLength:1,strokeDasharray:`1 1`,strokeDashoffset:1-p.cross})]})]}),(0,U.jsx)(`circle`,{ref:o,cx:`8`,cy:`8`,r:`6.25`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeDasharray:`1.7 2.2`,opacity:p.dashes}),(0,U.jsx)(`circle`,{ref:s,cx:`8`,cy:`8`,r:`6.25`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,opacity:p.track*.28}),(0,U.jsx)(`g`,{ref:l,className:`caps-status-mark-spin`,children:(0,U.jsx)(`circle`,{ref:c,cx:`8`,cy:`8`,r:`6.25`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,pathLength:1,strokeDasharray:`${String(p.sweep)} 1`,transform:`rotate(-90 8 8)`,opacity:p.arc})}),(0,U.jsx)(`circle`,{ref:u,cx:`8`,cy:`8`,r:p.disc*Dn,fill:`url(#${r}-surface)`,mask:`url(#${r}-knock)`})]})}var kn=new Set([`ring`,`arc`,`check`,`cross`]);function An(e){return kn.has(e)}var jn={neutral:`text-base-content`,primary:`text-primary`,secondary:`text-secondary`,accent:`text-accent`,success:`text-success`,info:`text-info`,warning:`text-warning`,error:`text-error`},Mn=(0,H.forwardRef)(function({className:e,label:t,glyph:n=`dot`,motion:r=`none`,tone:i=`neutral`,size:a=`default`,appearance:o=`plain`,progress:s,...c},l){return(0,U.jsxs)(`span`,{...c,className:j(`caps-status`,a===`compact`&&`caps-status-compact`,o===`chip`&&`caps-status-chip`,e),"data-tone":o===`chip`?i:void 0,"data-glyph":n,"data-motion":r,ref:l,children:[An(n)?(0,U.jsx)(On,{className:jn[i],glyph:n,progress:s}):(0,U.jsx)(wn,{className:jn[i],glyph:n,motion:r}),t===void 0?null:(0,U.jsx)(`span`,{children:t})]})}),Nn=F(`ArrowUp`,[[`path`,{d:`m5 12 7-7 7 7`,key:`hav0vg`}],[`path`,{d:`M12 19V5`,key:`x0mq9r`}]]),Pn=F(`Check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),Fn=F(`ChevronDown`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]),In=F(`ChevronUp`,[[`path`,{d:`m18 15-6-6-6 6`,key:`153udz`}]]),Ln=F(`Clock`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`polyline`,{points:`12 6 12 12 16 14`,key:`68esgv`}]]),Rn=F(`Cpu`,[[`rect`,{width:`16`,height:`16`,x:`4`,y:`4`,rx:`2`,key:`14l7u7`}],[`rect`,{width:`6`,height:`6`,x:`9`,y:`9`,rx:`1`,key:`5aljv4`}],[`path`,{d:`M15 2v2`,key:`13l42r`}],[`path`,{d:`M15 20v2`,key:`15mkzm`}],[`path`,{d:`M2 15h2`,key:`1gxd5l`}],[`path`,{d:`M2 9h2`,key:`1bbxkp`}],[`path`,{d:`M20 15h2`,key:`19e6y8`}],[`path`,{d:`M20 9h2`,key:`19tzq7`}],[`path`,{d:`M9 2v2`,key:`165o2o`}],[`path`,{d:`M9 20v2`,key:`i2bqo8`}]]),zn=F(`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`}]]),Bn=F(`FolderInput`,[[`path`,{d:`M2 9V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-1`,key:`fm4g5t`}],[`path`,{d:`M2 13h10`,key:`pgb2dq`}],[`path`,{d:`m9 16 3-3-3-3`,key:`6m91ic`}]]),Vn=F(`Heart`,[[`path`,{d:`M19 14c1.49-1.46 3-3.21 3-5.5A5.5 5.5 0 0 0 16.5 3c-1.76 0-3 .5-4.5 2-1.5-1.5-2.74-2-4.5-2A5.5 5.5 0 0 0 2 8.5c0 2.3 1.5 4.05 3 5.5l7 7Z`,key:`c3ymky`}]]),Hn=F(`Images`,[[`path`,{d:`M18 22H4a2 2 0 0 1-2-2V6`,key:`pblm9e`}],[`path`,{d:`m22 13-1.296-1.296a2.41 2.41 0 0 0-3.408 0L11 18`,key:`nf6bnh`}],[`circle`,{cx:`12`,cy:`8`,r:`2`,key:`1822b1`}],[`rect`,{width:`16`,height:`16`,x:`6`,y:`2`,rx:`2`,key:`12espp`}]]),Un=F(`Maximize2`,[[`polyline`,{points:`15 3 21 3 21 9`,key:`mznyad`}],[`polyline`,{points:`9 21 3 21 3 15`,key:`1avn1i`}],[`line`,{x1:`21`,x2:`14`,y1:`3`,y2:`10`,key:`ota7mn`}],[`line`,{x1:`3`,x2:`10`,y1:`21`,y2:`14`,key:`1atl0r`}]]),Wn=F(`RotateCcw`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}]]),Gn=F(`Square`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}]]),Kn=F(`X`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]);c({operation:z(`read-library`),computerId:R});var qn=u.pipe(D(p(4096)),D(y(e=>e.startsWith(`/`)&&e!==`/`&&!e.includes(`\0`)&&!e.endsWith(`/`)&&!e.split(`/`).some(e=>e===`.`||e===`..`))));c({path:o(qn)});var Jn=(0,H.createContext)(null),Yn=(0,H.forwardRef)(function({children:e,defaultValue:t,onValueChange:n,value:r,...i},a){let[o,s]=(0,H.useState)(t),c=r??o,l=(0,H.useId)(),u=e=>{r===void 0&&s(e),n?.(e)},d=(e,t)=>`${l}-${e}-${encodeURIComponent(t)}`;return(0,U.jsx)(Jn.Provider,{value:{onValueChange:u,panelId:e=>d(`panel`,e),selectedValue:c,tabId:e=>d(`tab`,e)},children:(0,U.jsx)(`div`,{...i,className:j(`w-full`,i.className),ref:a,children:e})})});function Xn(){let e=(0,H.useContext)(Jn);if(!e)throw Error(`Tabs parts must be used inside <Tabs>`);return e}var Zn=(0,H.forwardRef)(function({className:e,variant:t=`bordered`,...n},r){return(0,U.jsx)(`div`,{...n,"aria-orientation":n[`aria-orientation`]??`horizontal`,className:j(t===`segmented`?`tabs caps-tabs-segmented w-full`:`tabs tabs-border flex w-full items-center gap-xs`,e),"data-variant":t,ref:r,role:`tablist`})}),Qn=(0,H.forwardRef)(function({className:e,disabled:t,onClick:n,onKeyDown:r,value:i,...a},o){let s=Xn(),c=s.selectedValue===i,l=e=>{let t=e.currentTarget.closest(`[role="tablist"]`);if(!(t instanceof HTMLElement))return;let n=Array.from(t.querySelectorAll(`[role="tab"]`)).filter(e=>!e.disabled&&e.getAttribute(`aria-disabled`)!==`true`),r=n.indexOf(e.currentTarget);if(r<0||n.length===0)return;let a;if(e.key===`ArrowRight`)a=(r+1)%n.length;else if(e.key===`ArrowLeft`)a=(r-1+n.length)%n.length;else if(e.key===`Home`)a=0;else if(e.key===`End`)a=n.length-1;else return;e.preventDefault();let o=n[a];o?.focus(),o&&s.onValueChange(o.dataset.tabValue??i)};return(0,U.jsx)(`button`,{...a,"aria-controls":s.panelId(i),"aria-disabled":t?!0:void 0,"aria-selected":c,className:j(`tab whitespace-nowrap text-base-content transition-colors focus-visible:outline-none focus-visible:ring-2 caps-focus-color`,c&&`tab-active`,e),"data-tab-value":i,disabled:t,id:s.tabId(i),onClick:e=>{n?.(e),!e.defaultPrevented&&!t&&s.onValueChange(i)},onKeyDown:e=>{r?.(e),e.defaultPrevented||l(e)},ref:o,role:`tab`,tabIndex:t?-1:c?0:-1,type:a.type??`button`})});(0,H.forwardRef)(function({children:e,className:t,forceMount:n=!1,value:r,...i},a){let o=Xn(),s=o.selectedValue===r;return!s&&!n?null:(0,U.jsx)(`div`,{...i,"aria-labelledby":o.tabId(r),className:j(`mt-md focus-visible:outline-none`,t),hidden:!s,id:o.panelId(r),ref:a,role:`tabpanel`,tabIndex:0,children:e})});var $n=yn+18e4,er=`4 generations are running. Wait for one to finish.`,tr=c({error:z(`generation_limit`),limit:L,message:u}),nr=class extends P{constructor(e){super(e,{code:`CONFLICT`,retryable:!0})}};function rr(e,t){return e.computerId===void 0||e.computerId===t}var ir=`@cf/black-forest-labs/flux-2-klein-4b`,ar=`Image creation is unavailable for this Computer right now.`,X={landscape:{height:768,width:1024},portrait:{height:1024,width:768},square:{height:1024,width:1024}},or=[`landscape`,`portrait`,`square`];function sr(e){return e instanceof Ue&&e.stage===`provider`&&e.provider!==void 0&&`reason`in e.provider&&e.provider.reason===`credits_exhausted`}function cr(e){if(!(e instanceof Ue)||e.stage!==`provider`)return;let t=e.provider;if(t===void 0||!(`code`in t))return;let n=e.code===`MEDIA_PROVIDER_FAILURE_UNCHARGED`?` You weren’t charged.`:``,r=(e,t,r)=>({title:e,message:t+n,retryable:r});switch(t.reason){case`content_refused`:return r(`Generation refused`,`The model refused this prompt (content policy). Try rewording it.`,!1);case`invalid_input`:return r(`Generation failed`,t.detail===void 0?`The provider rejected the input. Check the prompt and the reference image’s size and format.`:`The provider rejected the input: ${t.detail}.`,!1);case`rate_limited`:return r(`Generation failed`,`The provider is overloaded. Retry in a minute.`,!0);case`provider_unavailable`:return r(`Generation failed`,`The provider is having an outage. Retry in a minute.`,!0);case`timeout`:return r(`Still waiting`,`The model took too long to answer. Retry to ask again.`,!0);case`spending_limit`:return r(`Generation failed`,`The provider’s daily allowance is used up. Try another model, or retry tomorrow.`,!1);case`credits_exhausted`:return;case void 0:return t.detail===void 0?void 0:r(`Generation failed`,`The model stopped before it finished: ${t.detail}. Retry, or pick another model.`,!1)}}function lr(e){if(e instanceof nr)return{title:`Too many generations`,message:e.message,retryable:!0};if(sr(e))return{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};let t=cr(e);return t===void 0?Ve(e,{INSUFFICIENT_CREDIT:{title:`Couldn’t create image`,message:`Media generation needs Team credits. Add credits in Billing, then retry.`},DAILY_LIMIT_REACHED:{title:`Couldn’t create image`,message:`Today's spending limit for this Oyster is used up. It resets at 00:00 UTC.`},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.`}}):t}function ur(e){let t=d(c({code:ye(Je)}))(e);return{reason:t._tag===`Some`?t.value.code:sr(e)?`INSUFFICIENT_CREDIT`:`UNKNOWN`,message:lr(e).message}}function dr(){return{destination:void 0,height:768,model:ir,prompt:``,references:[],steps:void 0,width:1024}}function fr(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 pr(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`:n?.kind===`audio`?`mp3`:i===`jpeg`?`jpg`:i;return fr($t({count:4}),t,a)}function mr(e){return e?.kind===`audio`?e.audio?.mode===`music`?`Generate music`:`Generate speech`:e?.kind===`video`?`Generate video`:`Generate image`}function hr(e){return e.filter(e=>e.kind!==`audio`&&e.transform===null)}function gr(e){return e.filter(e=>e.kind===`audio`)}function _r(e){let{references:t,width:n,height:r,...i}=e.settings;return{...i,references:t??[],destination:e.destination.path,width:n??1,height:r??1}}function vr(e,t){return e?.kind===`audio`?Re:{width:t.width,height:t.height}}function yr(e,t,n=!1){if(e===void 0)return`Creating media…`;if(e.kind===`audio`)return e.audio?.mode===`music`?`Composing music…`:`Making speech…`;if(e.transform?.operation===`remove_background`)return`Removing background…`;if(e.transform?.operation===`upscale`)return`Upscaling…`;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 br=(e,t)=>t===0?e:br(t,e%t),xr=(e,t,n)=>n===void 0?`${String(e)} × ${String(t)} · ${Or(e,t)}`:`${String(e)} × ${String(t)} · ${String(n[0])}:${String(n[1])}`,Sr=[[1,1],[4,3],[3,4],[3,2],[2,3],[16,9],[9,16],[21,9]],Z=16,Cr=256,wr=4e6,Tr=1048576;function Er(e,t,n,r){let i=Math.floor((e.input.maxDimension??4096)/Z)*Z,a=e=>Math.round(e/Z)*Z,o=e=>Math.min(i,Math.max(Cr,e)),s=br(t,n),c=t/s*Z,l=n/s*Z,u=r&&e.input.maxDimensionDocumented,d,f;if(Math.max(c,l)<=i/4){let e=u?Math.floor(i/Math.max(c,l)):Math.max(1,Math.round(Math.sqrt(Tr/(c*l))));d=c*e,f=l*e}else{let e=t/n;d=u?e>=1?i:a(i*e):a(Math.sqrt(Tr*e)),f=u?e>=1?a(i/e):i:a(d/e)}let p=Math.max(d,f)/i;return p>1&&(d=a(d/p),f=a(f/p)),{width:o(d),height:o(f)}}function Dr(e){if(e.kind!==`image`||e.input.dimensions!==`own`)return[];let t=new Set,n=new Set;for(let e of or){let{width:r,height:i}=X[e],a=br(r,i);n.add(`${String(r/a)}:${String(i/a)}`),t.add(`${String(r)}x${String(i)}`)}let r=[];for(let[i,a]of Sr){let o=n.has(`${String(i)}:${String(a)}`)?[]:[{size:Er(e,i,a,!1),group:`Standard`}];e.input.maxDimensionDocumented&&o.push({size:Er(e,i,a,!0),group:`Largest`});for(let{size:{width:e,height:n},group:s}of o){let o=`${String(e)}x${String(n)}`;t.has(o)||(t.add(o),r.push({value:o,label:xr(e,n,[i,a]),width:e,height:n,group:s}))}}return r}function Or(e,t){let n=e/t,r=Sr.find(([e,t])=>Math.abs(n/(e/t)-1)<=.02);if(r!==void 0)return`${String(r[0])}:${String(r[1])}`;let i=br(e,t),a=e/i,o=t/i;return a<=21&&o<=21?`${String(a)}:${String(o)}`:`${n.toFixed(2)}:1`}function kr(e,t,n){if(e?.kind!==`image`||e.input.dimensions!==`own`||!(t>0&&n>0))return;let r=Math.log(t/n);if(e.sizes!==null){let t;for(let n of e.sizes){let e=/^(\d+)x(\d+)$/u.exec(n);if(e===null)continue;let i=Number(e[1]),a=Number(e[2]),o=Math.abs(Math.log(i/a)-r);(t===void 0||o<t.gap-1e-9)&&(t={width:i,height:a,gap:o})}return t===void 0?void 0:{width:t.width,height:t.height}}let i=Sr.find(([e,r])=>Math.abs(t/n/(e/r)-1)<=.02);return i===void 0?Er(e,t,n,!1):Er(e,i[0],i[1],!1)}function Ar(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=br(t,n),a=t/i,o=n/i;return a<=21&&o<=21?`${String(a)}:${String(o)}`:`${String(t)} × ${String(n)}`}function jr(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:xr(n,r),width:n,height:r,group:n*r>=wr?`Largest`:`Standard`}]}):[...or.map(e=>({value:e,label:xr(X[e].width,X[e].height),...X[e],group:`Standard`})),...e===void 0?[]:Dr(e)]}function Mr(e,t,n){return n?.kind===`video`&&t.kind===`video`||t.input.dimensions!==`none`&&Ne(_(Hr(()=>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 Nr(e){return e.label.split(` — `)[0]??e.label}function Pr(e,t){return e.find(e=>e.id===t)}function Fr(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??t.audio?.seconds?.default,voiceId:t.audio?.defaultVoiceId??void 0,generateAudio:t.video?.defaultGenerateAudio??void 0,width:t.input.defaultWidth}}var Ir={"first-frame":`First frame`,"last-frame":`Last frame`,reference:`Reference`};function Lr(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 Rr(e){return e?.video?.referenceRoles??[]}function zr(e,t,n=!1){let r=Rr(t);if(t?.video==null)return e.map(({path:e,computerId:t})=>t===void 0?{path:e}:{path:e,computerId:t});let i=e.map(e=>e.role!==void 0&&r.includes(e.role)?e.role:void 0),a=e=>i.includes(e),o=r.includes(`last-frame`),s=n&&r.includes(`reference`)||a(`reference`)||!a(`first-frame`)&&!a(`last-frame`)&&e.length>(o?2:1);return e.map((e,t)=>{let n=i[t];return n===void 0&&(n=s&&r.includes(`reference`)?`reference`:!a(`first-frame`)&&r.includes(`first-frame`)?`first-frame`:o&&!a(`last-frame`)?`last-frame`:r.includes(`reference`)?`reference`:`first-frame`,i[t]=n),{...e,role:n}})}function Br(e,t,n){let r=t.video;if(r===null||e.length===0)return;let i=t=>e.filter(e=>e.role===t).length,a=i(`first-frame`),o=i(`last-frame`),s=i(`reference`);if(a>1||o>1)return r.referenceRoles.includes(`last-frame`)?`${t.label} takes one first frame and one last frame.`:`${t.label} takes one first frame.`;if(o>0&&a===0)return`A last frame needs a first frame as well.`;if(s>0&&a+o>0)return`Frames and references cannot be mixed. Use a first and last frame, or references.`;if(s>r.maxReferenceImages)return r.maxReferenceImages===0?`${t.label} takes no reference images.`:`${t.label} takes up to ${String(r.maxReferenceImages)} reference images.`;if(s>0&&n!==void 0&&!r.referenceResolutions.some(e=>e===n))return`${t.label} takes reference images only at ${r.referenceResolutions.join(`, `)}.`}function Vr(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.`);if(t.kind===`audio`){let n={model:e.model,prompt:e.prompt.trim()};return t.audio?.mode===`speech`&&e.voiceId!==void 0&&(n.voiceId=e.voiceId),t.audio?.mode===`music`&&e.durationSeconds!==void 0&&(n.durationSeconds=e.durationSeconds),{destination:{path:e.destination?.trim()??``},settings:n}}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=zr(e.references,t)),t.video?.supportsAudio===!0&&e.generateAudio!==void 0&&(r.generateAudio=e.generateAudio),{destination:{path:e.destination?.trim()??``},settings:r}}function Hr(e){return c({model:u,width:ct,height:ct,durationSeconds:le(r(ct)),steps:le(r(ct))}).check(y(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.audio?.seconds!=null&&t.durationSeconds!==void 0&&(!Number.isSafeInteger(t.durationSeconds)||t.durationSeconds<n.audio.seconds.min||t.durationSeconds>n.audio.seconds.max))return{path:[`durationSeconds`],issue:`${n.label} makes tracks from ${String(n.audio.seconds.min)} to ${String(n.audio.seconds.max)} seconds.`};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 Ur(e,t){let n=e.trim().length;return n>t.maxPromptLength?{length:n,excess:n-t.maxPromptLength}:null}function Wr(e,t){if(e.destination?.trim().length===0)return`A destination file path is required.`;if(e.prompt.trim().length===0)return t?.kind===`video`?`Describe the video to generate.`:t?.kind===`audio`?t.audio?.mode===`music`?`Describe the music to generate.`:`Write what the voice should say.`:`Describe the image to generate.`;if(t===void 0)return`Choose a model from the granted registry.`;let n=Ur(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=_(Hr(()=>t))(e);if(He(r))return Ee()(r.failure.issue).issues.map(e=>e.message).join(` `);if(e.references.length>t.input.maxReferences)return`${t.label} accepts at most ${String(t.input.maxReferences)} reference images.`;if(e.references.length>0&&t.input.referenceField===null)return`${t.label} does not accept reference images.`;if(t.video!==null){let n=t.video.formats.find(t=>t.width===e.width&&t.height===e.height);return Br(zr(e.references,t),t,n?.resolution)}}function Gr(e,t=`length`){let n=Math.max(0,t===`length`?Math.ceil(e):Math.floor(e)),r=Math.floor(n/60);return`${String(r)}:${String(n%60).padStart(2,`0`)}`}function Kr(e,t=64){let n=e.reduce((e,t)=>Math.max(e,t.length),0);if(n===0||t<=0)return Object.freeze(Array.from({length:Math.max(t,0)},()=>0));let r=Array.from({length:t},()=>0);for(let i=0;i<t;i+=1){let a=Math.floor(i*n/t),o=Math.max(a+1,Math.floor((i+1)*n/t)),s=0;for(let t of e){let e=Math.min(o,t.length);for(let n=a;n<e;n+=1)s=Math.max(s,Math.abs(t[n]??0))}r[i]=s}let i=r.reduce((e,t)=>Math.max(e,t),0);return Object.freeze(i===0?r:r.map(e=>e/i))}async function qr(e,t=64){let n=await new OfflineAudioContext(1,1,44100).decodeAudioData(e);return{peaks:Kr(Array.from({length:n.numberOfChannels},(e,t)=>n.getChannelData(t)),t),durationSeconds:n.duration}}var Jr=new Map;async function Yr(e,t){let n=await fetch(e);if(!n.ok)throw Error(`audio responded ${String(n.status)}`);return qr(await n.arrayBuffer(),t)}function Xr(e,t){let n=`${String(t)}:${e}`,r=Jr.get(n);if(r!==void 0)return r;let i=Yr(e,t).catch(e=>{throw Jr.delete(n),e});return Jr.set(n,i),i}function Zr(e,t=64){let[n,r]=(0,H.useState)({status:`loading`});return(0,H.useEffect)(()=>{if(e===``){r({status:`failed`});return}let n=!0;return r({status:`loading`}),Xr(e,t).then(e=>{n&&r({status:`ready`,...e})},e=>{nt(`decode-audio-waveform`,e),n&&r({status:`failed`})}),()=>{n=!1}},[e,t]),n}function Qr(e,t){Ke.error(e,{id:t,toasterId:`prints-generation-notices`})}var $r=`modulepreload`,ei=function(e,t){return new URL(e,t).href},ti={},ni=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=ei(t,n),t=s(t),t in ti)return;ti[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`:$r,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)})},ri={remove_background:`Remove background`,upscale:`Upscale`};function ii(e,t){return e.find(e=>e.transform?.operation===t)}function ai(e,t){let n=t.width*t.height/1e6;return(e.transform?.sizes??[]).map(({megapixels:e})=>({megapixels:e,disabledReason:n>=e?`This image is already ${n.toFixed(1)} MP.`:void 0}))}function oi(e,t){let n=e.transform?.source;if(n===void 0)return`${e.label} is not an image action.`;if(t.width*t.height>n.maxPixels)return`This image is over ${String(n.maxPixels/1e6)} MP, the most ${e.label} takes.`}function si(e,t,n){let r=e.transform;if(r===null)throw Error(`${e.id} is not an image action`);let i={computerId:t.computerId,path:t.path};if(r.operation===`upscale`){let t=n??r.defaultMegapixels;if(t===null)throw Error(`${e.id} needs an output size`);return{model:e.id,prompt:`${ri.upscale} to ${String(t)} MP`,references:[i],targetMegapixels:t}}return{model:e.id,prompt:ri[r.operation],references:[i]}}var ci=e=>{let t=e.lastIndexOf(`/`);return t<=0?`/`:e.slice(0,t)};function li(e,t,n){let r=si(e,t,n),i={model:e.id,prompt:r.prompt,references:r.references??[],width:t.width,height:t.height},a=pr(i,ci(t.path),e);return{input:{destination:{path:a},settings:r},draft:{...i,destination:a}}}var ui=R,di=R.pipe(D(p(1024))),fi=Me(di).pipe(D(p(200)));Ie([c({operation:z(`read-notices`),computerId:ui}),c({operation:z(`dismiss-notices`),computerId:ui,keys:fi})]);var pi=c({keys:fi});async function mi(e,t){return T(pi)(await e.require(K).request(JSON.stringify(t)))}Ie([c({operation:z(`read-folder`),computerId:ui}),c({operation:z(`select-folder`),computerId:ui,path:qn})]);var hi=c({path:qn,configured:ke});async function gi(e,t){return T(hi)(await e.require(K).request(JSON.stringify(t)))}var _i=2048,vi=8e3,yi=[{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})),bi=u.pipe(D(S(1)),D(p(64))),xi=u.pipe(D(S(1)),D(p(vi))),Si=R,Ci=c({id:L,name:bi,text:xi,builtIn:ke});Ie([c({operation:z(`list-styles`),computerId:Si}),c({operation:z(`save-style`),computerId:Si,id:fe(L),name:bi,text:xi}),c({operation:z(`delete-style`),computerId:Si,id:L}),c({operation:z(`read-print-style`),computerId:Si,path:R})]);var wi=c({styles:Me(Ci).pipe(D(p(50+yi.length)))}),Ti=c({style:o(bi)});function Ei(e,t){let n=t.trim();return e===void 0?n:`${e.trim()}\n\n${n}`}function Di(e){return e?.maxPromptLength??_i}function Oi(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 ki=e=>e.require(K),Ai=e=>JSON.stringify(e),ji=T(wi);async function Mi(e,t){return ji(await ki(e).request(Ai({operation:`list-styles`,computerId:t})))}async function Ni(e,t,n){return ji(await ki(e).request(Ai({operation:`save-style`,computerId:t,id:n.id,name:n.name,text:n.text})))}async function Pi(e,t,n){return ji(await ki(e).request(Ai({operation:`delete-style`,computerId:t,id:n})))}async function Fi(e,t,n){return T(Ti)(await ki(e).request(Ai({operation:`read-print-style`,computerId:t,path:n})))}var Ii=/(?<![\p{L}\p{N}_@-])@image(\d+)(?![\p{L}\p{N}_-])/giu,Q=e=>`image${String(e)}`;function Li(e){let t=[];for(let n of e.matchAll(Ii)){let e=Number(n.at(1));t.includes(e)||t.push(e)}return t}var Ri=(e,t)=>JSON.stringify([e.computerId??t,e.path]),zi={labels:new Map,next:1};function Bi(e,t,n){let r=Li(n).length>0;if(t.length===0)return e.labels.size===0&&(e.next===1||r)?e:r?{labels:new Map,next:e.next}:zi;let i=e.labels.size>0&&t.every(t=>!e.labels.has(t))?zi:e,a=new Map,o=i.next;for(let e of t)a.has(e)||(a.set(e,i.labels.get(e)??o),i.labels.has(e)||(o+=1));return a.size===e.labels.size&&o===e.next&&[...a].every(([t,n])=>e.labels.get(t)===n)?e:{labels:a,next:o}}function Vi(e,t){return t.map(t=>e.labels.get(t)??0)}function Hi(e,t){let n=0;return e.map(e=>{if(t?.kind===`video`){if(e.role===`first-frame`)return`the first frame`;if(e.role===`last-frame`)return`the last frame`}return n+=1,`image ${String(n)}`})}function Ui(e,t,n){let r=[],i=e.replace(Ii,(e,i)=>{let a=t.indexOf(Number(i)),o=a<0?void 0:n.at(a);if(o===void 0){let t=Q(Number(i));return r.includes(t)||r.push(t),e}return o});return r.length===0?{kind:`ready`,prompt:i}:{kind:`missing`,labels:r}}function Wi(e,t){return e.replace(Ii,(e,n)=>{let r=t(Number(n));return r===void 0||r<1?e:`@${Q(r)}`})}var Gi=8,Ki=u.pipe(D(S(1)),D(p(32)),D(Ye(/^[\p{L}\p{N}_-]+$/u)),D(Ye(/^(?!image\d+$)/iu))),qi=u.pipe(D(p(500))),Ji=R.pipe(D(p(4096))),Yi=Me(c({path:Ji})).pipe(D(p(8))),Xi=R,Zi=c({id:L,name:Ki,description:qi,references:Yi});Ie([c({operation:z(`list-characters`),computerId:Xi}),c({operation:z(`save-character`),computerId:Xi,id:fe(L),name:Ki,description:qi,references:Yi}),c({operation:z(`delete-character`),computerId:Xi,id:L})]);var Qi=c({characters:Me(Zi).pipe(D(p(50)))}),$i=(e,t)=>e.toLowerCase()===t.toLowerCase(),ea=/(?<![\p{L}\p{N}_@-])@([\p{L}\p{N}_-]+)/gu;function ta(e){let t=[];for(let n of e.matchAll(ea)){let e=n.at(1);e!==void 0&&!t.some(t=>$i(t,e))&&t.push(e)}return t}function na(e,t){let n=[];return{prompt:e.replace(ea,(e,r)=>{let i=t.find(e=>$i(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 ra(e,t,n){let r=e.trim();return Ei(t,na(r,n).prompt).length-r.length}function ia(e,t){let n=ta(e),r=t.filter(e=>!n.some(t=>$i(t,e)));return r.length===0?e:`${r.map(e=>`@${e}`).join(` `)} ${e}`}function aa(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 oa(e){return{kind:`ready`,prompt:e,references:[],characters:[]}}function sa(e){let t=ia(e.prompt,e.names??[]),n=na(t,e.saved),r=aa(e.references,n.characters,e.computerId),i=(e.wording??(e=>Hi(e,void 0)))(r),a=Ui(t,e.labels??e.references.map((e,t)=>t+1),i.slice(0,e.references.length));if(a.kind===`missing`)return{kind:`refused`,message:`${a.labels.map(e=>`@${e}`).join(`, `)} ${a.labels.length===1?`names a reference that is`:`name references that are`} not attached. Remove ${a.labels.length===1?`it`:`them`} from the prompt or attach the image again.`};let o=r.length-e.references.length;if(e.model!==void 0&&o>0&&r.length>e.model.maxReferences){let t=n.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 ${t}.`:`${t} add ${String(o)} reference ${o===1?`image`:`images`} to your ${String(e.references.length)}; ${e.model.label} accepts at most ${String(e.model.maxReferences)}.`}}return{kind:`ready`,prompt:na(a.prompt,e.saved).prompt,references:r,characters:n.characters}}function ca(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 la(e,t,n){let r=n.toLowerCase(),i=e=>Q(e.number).toLowerCase();return[...[...t.filter(e=>i(e).startsWith(r)),...t.filter(e=>!i(e).startsWith(r)&&i(e).includes(r))].map(e=>({kind:`reference`,reference:e})),...ua(e,n).map(e=>({kind:`character`,character:e}))]}function ua(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,Gi)}var da=e=>e.require(K),fa=e=>JSON.stringify(e),pa=T(Qi);async function ma(e,t){return pa(await da(e).request(fa({operation:`list-characters`,computerId:t})))}async function ha(e,t,n){return pa(await da(e).request(fa({operation:`save-character`,computerId:t,id:n.id,name:n.name,description:n.description,references:n.references})))}async function ga(e,t,n){return pa(await da(e).request(fa({operation:`delete-character`,computerId:t,id:n})))}var $={models:e=>W.of(e,`prints`,`models`),folder:e=>W.of(e,`prints`,`folder`),dismissals:e=>W.of(e,`prints`,`dismissals`),styles:e=>W.of(e,`prints`,`styles`),printStyle:(e,t)=>W.of(e,`prints`,`print-style`,t),characters:e=>W.of(e,`prints`,`characters`)};function _a(e){return{...G(e,Ze,$.models(e),async(t,n)=>{if(!e)throw Error(`Prints is disconnected`);let r=await $e(e.capabilities);return n.throwIfAborted(),r}),enabled:!!(e?.context.get().computerId&&e.capabilities.has(Ze)),structuralSharing:!1}}function va(e){let t=e?.context.get().computerId;return{...G(e,K,$.folder(e),async(n,r)=>{if(!e||!t)throw Error(`No Computer selected`);let i=await gi(e.capabilities,{operation:`read-folder`,computerId:t});if(r.throwIfAborted(),e.context.get().computerId!==t)throw new P(`Computer selection changed`,{code:`SELECTION_CHANGED`,retryable:!1});return i}),enabled:!!(t&&e.capabilities.has(K))}}function ya(e){let t=e?.context.get().computerId;return{...G(e,K,$.dismissals(e),async(n,r)=>{if(!e||!t)throw Error(`No Computer selected`);let i=await mi(e.capabilities,{operation:`read-notices`,computerId:t});return r.throwIfAborted(),i}),enabled:!!(t&&e.capabilities.has(K))}}function ba(e){let t=e?.context.get().computerId;return{...G(e,K,$.styles(e),async(n,r)=>{if(!e||!t)throw Error(`No Computer selected`);let i=await Mi(e.capabilities,t);return r.throwIfAborted(),i}),enabled:!!(t&&e.capabilities.has(K))}}function xa(e,t){let n=e?.context.get().computerId;return{...G(e,K,$.printStyle(e,t??``),async(r,i)=>{if(!e||!n||t===null)throw Error(`No print selected`);let a=await Fi(e.capabilities,n,t);return i.throwIfAborted(),a}),enabled:!!(n&&t!==null&&e.capabilities.has(K))}}function Sa(e){let t=e?.context.get().computerId;return{...G(e,K,$.characters(e),async(n,r)=>{if(!e||!t)throw Error(`No Computer selected`);let i=await ma(e.capabilities,t);return r.throwIfAborted(),i}),enabled:!!(t&&e.capabilities.has(K))}}function Ca({checked:e}){let t=`caps-switch-${(0,H.useId)().replaceAll(`:`,``)}`,n=(0,H.useRef)(null),r=(0,H.useRef)(null),i=(0,H.useRef)(e).current,o=(0,H.useRef)(e),s=E();return(0,H.useLayoutEffect)(()=>{if(!n.current||!r.current)return;let t=s||o.current===e;o.current=e;let i=e?16:8,a=Fe(n.current),c=J(a,{bounce:.25,duration:440}),l=Y(a,{ease:`inOutSine`,duration:100}),u=V(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=V(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,s]),(0,U.jsxs)(`svg`,{className:`caps-switch-visual`,width:`40`,height:`24`,viewBox:`0 0 20 12`,"aria-hidden":`true`,focusable:`false`,children:[(0,U.jsxs)(`defs`,{children:[(0,U.jsx)(a,{ref:r,id:`${t}-surface`,transform:i?`matrix(2 0 0 1 10 6)`:`matrix(1 0 0 1 6 6)`}),(0,U.jsx)(ie,{id:`${t}-shadow`}),(0,U.jsx)(lt,{id:`${t}-inset`}),(0,U.jsx)(`clipPath`,{id:`${t}-track`,children:(0,U.jsx)(`rect`,{x:`1`,y:`1`,width:`18`,height:`10`,rx:`5`})})]}),(0,U.jsx)(`rect`,{className:`caps-switch-track`,filter:`url(#${t}-inset)`,x:`0.5`,y:`0.5`,width:`19`,height:`11`,rx:`5.5`}),(0,U.jsx)(`g`,{clipPath:`url(#${t}-track)`,children:(0,U.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 wa=(0,H.forwardRef)(function({className:e,checked:t,defaultChecked:n=!1,onChange:r,onCheckedChange:i,...a},o){let s=(0,H.useRef)(null),[c,l]=(0,H.useState)(n),u=t??c;return(0,H.useImperativeHandle)(o,()=>{if(!s.current)throw Error(`Switch input is not mounted`);return s.current},[]),(0,H.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,U.jsxs)(`span`,{className:`caps-switch`,"data-checked":u,children:[(0,U.jsx)(`input`,{...a,checked:u,className:j(`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,U.jsx)(Ca,{checked:u})]})});function Ta(e,t=/Mac|iPhone|iPad/u.test(globalThis.navigator.userAgent)){if(e.startsWith(`<leader>`)){let t=e.replaceAll(`<leader>`,`Ctrl K `).trimEnd();return e.endsWith(` `)?`${t} Space`:t}return e.split(` `).map(e=>e.split(`+`).map(e=>e===`mod`?t?`⌘`:`Ctrl`:e===`escape`?`Esc`:e.length===1?e.toUpperCase():e.charAt(0).toUpperCase()+e.slice(1)).join(e===`ctrl+k`||e===`mod+k`?` `:`+`)).join(` `)}function Ea(e){let t=new Map;for(let n of e.bindings)t.set(n.commandId,[...t.get(n.commandId)??[],Ta(n.binding)]);return e.slash.map(e=>({alias:e.alias,commandId:e.commandId,command:e.command,title:e.title,description:e.description,category:e.category,order:e.order,grammar:e.arguments,consumesDraft:e.consumesDraft,keys:t.get(e.commandId)??[],availability:e.availability}))}function Da(e,t){let n=e.toLocaleLowerCase(),r=t.toLocaleLowerCase();if(r.length===0)return{tier:0,spread:0,indices:[]};let i=e=>Array.from({length:r.length},(t,n)=>e+n);if(n.startsWith(r))return{tier:0,spread:n.length-r.length,indices:i(0)};let a=n.search(RegExp(`[-_\\s]${r.replaceAll(/[.*+?^${}()|[\]\\]/gu,`\\$&`)}`,`u`));if(a>=0)return{tier:1,spread:a,indices:i(a+1)};let o=n.indexOf(r);if(o>=0)return{tier:2,spread:o,indices:i(o)};let s=[],c=0;for(let e of r){let t=n.indexOf(e,c);if(t<0)return;s.push(t),c=t+1}let l=s[0]??0;return{tier:3,spread:(s.at(-1)??0)-l-r.length+1,indices:s}}function Oa(e,t,n,r){return e.map(e=>({entry:e,match:Da(t(e),n)})).filter(e=>e.match!==void 0).sort((e,n)=>e.match.tier-n.match.tier||e.match.spread-n.match.spread||r(e.entry)-r(n.entry)||t(e.entry).localeCompare(t(n.entry))).map(({entry:e,match:t})=>({entry:e,indices:t.indices}))}var ka=[`help`,`login`,`model`];function Aa(e,t,n={}){if(!t.startsWith(`/`)||t.includes(`
2
- `))return{kind:`none`};let r=t.search(/\s/u);if(r<0){let r=t.slice(1);return{kind:`commands`,query:r,items:Oa(e.filter(e=>e.availability.status===`available`&&(r.length===0?e.category===(n.idleCategory??`Conversation`)||ka.includes(e.alias):e.category!==`Advanced`||e.alias.toLocaleLowerCase().startsWith(r.toLocaleLowerCase()))),e=>e.alias,r,e=>{let t=ka.indexOf(e.alias);return r.length===0&&t>=0?t-ka.length:e.order}).map(({entry:e,indices:t})=>({command:e,label:`/${e.alias}`,matches:t.map(e=>e+1),insert:e.grammar===void 0?`/${e.alias}`:`/${e.alias} `}))}}let i=t.slice(1,r),a=e.find(e=>e.alias===i);if(a?.grammar===void 0||a.availability.status!==`available`)return{kind:`none`};let o=t.slice(r).trimStart(),s=(o.includes(` `)?[]:a.grammar.words??[]).filter(e=>e.word.toLocaleLowerCase().startsWith(o.toLocaleLowerCase())).map(e=>({word:e,label:e.word,matches:Array.from({length:o.length},(e,t)=>t),insert:`/${i} ${e.word}`}));return{kind:`arguments`,command:a,query:o,hint:`/${i} ${a.grammar.hint}`,items:s}}var ja=nn({keyCode:an(229)});function Ma(e){return e.nativeEvent.isComposing||Se(ja,e.nativeEvent).success}function Na(e,t){return e.animate(t.reduced?[{opacity:1},{opacity:0}]:[{opacity:1,transform:`none`},{opacity:0,transform:`translateY(-120%)`}],{duration:t.reduced?t.fast:t.normal,easing:k(t,t.easeExit),fill:`backwards`})}function Pa(e,t){let n=-12*Math.min(1.5,t.bounce/.3);return e.animate(t.reduced?[{opacity:0},{opacity:1}]:[{opacity:0,transform:`translateY(70%)`},{opacity:1,transform:`translateY(${String(n)}%)`,offset:.6},{opacity:1,transform:`none`}],{duration:t.reduced?t.fast:t.springDuration,easing:k(t,t.ease),fill:`backwards`})}function Fa(e,t,n){return e.animate([{opacity:1-n},{opacity:n}],{duration:t.reduced?t.fast:t.normal,delay:n===1&&!t.reduced?t.fast/2:0,easing:k(t,t.ease),fill:`backwards`})}function Ia(e,t){let n=1+.05*Math.min(1.5,.4+t.bounce/.3);return e.animate([{transform:`scale(1)`},{transform:`scale(${String(n)})`,offset:.4},{transform:`scale(1)`}],{duration:t.springDuration,easing:k(t,`ease-out`)})}var La=(0,H.forwardRef)(function({state:e,onStop:t,stopLabel:n=`Stop`,iconSize:r=20,onClick:i,disabled:a,className:o,tone:s=`primary`,"aria-label":c,...u},d){let f=(0,H.useRef)(null);(0,H.useImperativeHandle)(d,()=>f.current);let p=(0,H.useRef)(e);(0,H.useLayoutEffect)(()=>{let t=f.current,n=p.current;if(p.current=e,!t||n===e||!l(t))return;let r=t.querySelector(`[data-glyph="arrow"]`),i=t.querySelector(`[data-glyph="busy"]`);if(!r||!i)return;let a=Fe(t),o=[];return e===`busy`?o.push(Na(r,a),Fa(i,a,1)):n===`busy`&&o.push(Fa(i,a,0),Pa(r,a)),n===`empty`&&e===`ready`&&!a.reduced&&o.push(Ia(t,a)),()=>{for(let e of o)e.cancel()}},[e]);let m=e===`busy`,h=m&&t!==void 0;return(0,U.jsx)(Ae,{...u,ref:f,className:j(`caps-send-action`,o),tone:s,"aria-busy":m?!0:void 0,"aria-label":h?n:c,"data-send-state":e,disabled:a===!0||e===`empty`||m&&!h,onClick:h?t:i,label:null,icon:(0,U.jsxs)(`span`,{className:`caps-send-glyph`,"data-state":e,children:[(0,U.jsx)(`span`,{"data-glyph":`arrow`,children:(0,U.jsx)(Nn,{"aria-hidden":`true`,size:r})}),(0,U.jsx)(`span`,{"data-glyph":`busy`,children:t===void 0?(0,U.jsx)(ot,{decorative:!0,size:`sm`}):(0,U.jsx)(Gn,{"aria-hidden":`true`,fill:`currentColor`,size:Math.round(r*.7)})})]})})}),Ra=new Intl.NumberFormat(`en-US`,{style:`currency`,currency:`USD`,minimumFractionDigits:2,maximumFractionDigits:2}),za=new Intl.NumberFormat(`en-US`,{style:`currency`,currency:`USD`,minimumFractionDigits:2,maximumFractionDigits:5});function Ba(e,t){if(!Number.isFinite(e))throw RangeError(`Money amount must be finite`);let n=e!==0&&Math.abs(e)<.01;return n&&(t?.precision!==`exact`||Math.abs(e)<1e-5)?e<0?`>-$0.01`:`<$0.01`:n?za.format(e):Ra.format(e)}var Va=(0,H.forwardRef)(function({className:e,...t},n){return(0,U.jsx)(`div`,{...t,ref:n,className:j(`caps-popover-anchor`,e)})}),Ha=(0,H.forwardRef)(function({className:e,open:t,side:n=`top`,...r},i){return t?(0,U.jsx)(`div`,{...r,ref:i,className:j(`caps-popover`,e),"data-side":n}):null}),Ua=(0,H.forwardRef)(function({active:e,className:t,onMouseDown:n,...r},i){return(0,U.jsx)(`div`,{role:`option`,"aria-selected":e,...r,ref:i,className:j(`caps-popover-option`,t),"data-active":e,onMouseDown:e=>{e.preventDefault(),n?.(e)}})});function Wa({items:e,openId:t,onOpenChange:n,leading:r,trailing:i,renderTrigger:a,placement:o=`housing`,align:s=`end`,hostInset:c,className:l,...u}){let d=(0,H.useId)(),f=(0,H.useRef)(null),p=(0,H.useRef)(null),m=(0,H.useRef)(new Map),h=e.find(e=>e.id===t&&!e.disabled),g=h?.id,_=()=>{g&&m.current.get(g)?.focus(),n(null)};return(0,H.useEffect)(()=>{g&&p.current?.focus()},[g]),(0,H.useEffect)(()=>{c===void 0?f.current?.style.removeProperty(`--caps-status-tray-host-inset`):f.current?.style.setProperty(`--caps-status-tray-host-inset`,`${String(Math.max(0,c))}px`)},[c]),(0,H.useEffect)(()=>{if(!g)return;let e=e=>{e.key!==`Escape`||e.defaultPrevented||(e.preventDefault(),m.current.get(g)?.focus(),n(null))},t=e=>{!(e.target instanceof Node)||f.current?.contains(e.target)||f.current?.querySelector(`[aria-haspopup="menu"][aria-expanded="true"]`)||n(null)};return document.addEventListener(`keydown`,e),document.addEventListener(`pointerdown`,t,!0),()=>{document.removeEventListener(`keydown`,e),document.removeEventListener(`pointerdown`,t,!0)}},[g,n]),(0,U.jsxs)(Va,{...u,ref:f,className:j(`caps-status-tray`,l),"data-placement":o,"data-align":s,children:[h?(0,U.jsxs)(Ha,{open:!0,ref:p,tabIndex:-1,side:`top`,id:`${d}-${h.id}`,role:`dialog`,"aria-labelledby":`${d}-title`,className:`caps-status-tray-panel`,"data-status-tray-panel":h.id,children:[(0,U.jsxs)(`div`,{className:`caps-status-tray-head`,children:[h.tone?(0,U.jsx)(Mn,{size:`compact`,tone:h.tone,glyph:h.glyph??`dot`}):null,(0,U.jsx)(`span`,{id:`${d}-title`,className:`caps-status-tray-title`,children:h.title??h.label}),h.actions,(0,U.jsx)(De,{"aria-label":`Close tray`,icon:(0,U.jsx)(Kn,{"aria-hidden":`true`}),onClick:_})]}),(0,U.jsx)(`div`,{className:`caps-status-tray-body`,children:h.content})]}):null,o===`host`?null:(0,U.jsxs)(`div`,{className:`caps-status-tray-row`,children:[r,(0,U.jsx)(`div`,{className:`caps-status-tray-chips`,children:e.map(e=>{let r={ref:t=>{t?m.current.set(e.id,t):m.current.delete(e.id)},type:`button`,className:a?void 0:`caps-status-tray-chip`,"aria-expanded":g===e.id,"aria-controls":g===e.id?`${d}-${e.id}`:void 0,"aria-label":e.accessibleLabel,disabled:e.disabled,title:e.disabled?e.accessibleLabel:void 0,"aria-haspopup":`dialog`,"data-status-tray-chip":e.id,onClick:()=>{n(t===e.id?null:e.id)},children:(0,U.jsxs)(U.Fragment,{children:[e.tone?(0,U.jsx)(Mn,{size:`compact`,glyph:e.glyph??`dot`,motion:e.motion??`none`,tone:e.tone}):null,(0,U.jsx)(`span`,{className:`caps-status-tray-label`,children:e.label}),e.count!==void 0&&e.count>0?(0,U.jsx)(`span`,{className:`caps-status-tray-count`,children:e.count}):null]})};return(0,U.jsxs)(H.Fragment,{children:[a?a(r):(0,U.jsx)(`button`,{...r}),e.after]},e.id)})}),i]})]})}function Ga({children:e,className:t,...n}){return(0,U.jsx)(`div`,{...n,className:j(`caps-status-tray-list`,t),children:e})}function Ka({icon:e,primary:t,secondary:n,actions:r,className:i,...a}){return(0,U.jsxs)(`div`,{...a,className:j(`caps-status-tray-item`,i),children:[e?(0,U.jsx)(`span`,{className:`caps-status-tray-icon`,children:e}):null,(0,U.jsxs)(`span`,{className:`caps-status-tray-text`,children:[(0,U.jsx)(`span`,{className:`caps-status-tray-primary`,children:t}),n?(0,U.jsx)(`span`,{className:`caps-status-tray-secondary`,children:n}):null]}),r?(0,U.jsx)(`span`,{className:`caps-status-tray-actions`,children:r}):null]})}function qa({children:e=`All caught up.`,title:t}){return(0,U.jsxs)(`div`,{className:`caps-status-tray-note`,children:[t?(0,U.jsx)(`strong`,{className:`caps-status-tray-note-title`,children:t}):null,(0,U.jsx)(`p`,{children:e})]})}var Ja=(0,H.forwardRef)(function({className:e,invalid:t,...n},r){return(0,U.jsx)(`textarea`,{...n,"aria-invalid":t?!0:n[`aria-invalid`]===!1?void 0:n[`aria-invalid`],className:j(`textarea textarea-bordered w-full`,t&&`textarea-error`,e),ref:r})});function Ya(e,t){return`${e}-${String(t)}`}function Xa(e){switch(e.key){case`ArrowDown`:return`next`;case`ArrowUp`:return`previous`;case`Enter`:return e.shiftKey?null:`accept`;case`Tab`:return`accept`;case`Escape`:return`dismiss`;default:return null}}function Za(e){return{role:`combobox`,"aria-autocomplete":`list`,"aria-expanded":e.open,"aria-controls":e.open?e.listId:void 0,"aria-activedescendant":e.open?Ya(e.listId,e.selected):void 0}}function Qa({open:e,rows:t,selected:n,listId:r,label:i,kind:a,hint:o,empty:s,onHighlight:c,onChoose:l}){return(0,U.jsx)(Ha,{open:e,side:`top`,"data-parakeet-slash":``,children:(0,U.jsxs)(`div`,{className:`parakeet-slash-menu`,"data-kind":a,children:[o===void 0?null:(0,U.jsx)(`p`,{className:`parakeet-slash-hint`,children:o}),t.length===0?s===void 0?null:(0,U.jsx)(`p`,{className:`parakeet-slash-hint`,children:s}):(0,U.jsx)(`div`,{id:r,role:`listbox`,"aria-label":i,children:t.map((e,t)=>(0,U.jsxs)(Ua,{id:Ya(r,t),active:t===n,"aria-disabled":e.disabled===!0||void 0,"data-disabled":e.disabled===!0,onMouseEnter:()=>{c(t)},onClick:()=>{l(t)},children:[e.media===void 0?null:(0,U.jsx)(`span`,{"aria-hidden":`true`,className:`parakeet-slash-media`,children:e.media}),(0,U.jsx)(`span`,{className:`parakeet-slash-label`,children:e.label}),(0,U.jsx)(`span`,{className:`parakeet-slash-detail`,children:e.detail}),e.keys===void 0||e.keys.length===0?null:(0,U.jsx)(`kbd`,{className:`parakeet-slash-keys`,children:e.keys})]},e.key))})]})})}var $a=(0,H.forwardRef)(function({className:e,density:t=`regular`,...n},r){return(0,U.jsx)(`ul`,{...n,className:j(`list`,t===`compact`&&`list-sm`,e),ref:r})}),eo=(0,H.forwardRef)(function({className:e,...t},n){return(0,U.jsx)(`li`,{...t,className:j(`list-row`,e),ref:n})});(0,H.forwardRef)(function({className:e,icon:t,label:n,children:r,...i},a){return(0,U.jsxs)(`li`,{...i,className:j(`list-row caps-fact`,e),ref:a,children:[(0,U.jsxs)(`span`,{className:`caps-fact-label`,children:[t?(0,U.jsx)(`span`,{className:`caps-fact-icon`,"aria-hidden":`true`,children:t}):null,n]}),(0,U.jsx)(`span`,{className:`caps-fact-value`,children:r})]})});var to=(0,H.forwardRef)(function({aside:e,children:t,className:n,level:r=2,...i},a){return(0,U.jsxs)(r===3?`h3`:`h2`,{...i,className:j(`caps-data-list-heading`,n),ref:a,children:[(0,U.jsx)(`span`,{children:t}),e===void 0?null:(0,U.jsx)(`span`,{className:`caps-data-list-heading-aside`,children:e})]})}),no=g(`card caps-card`,{variants:{variant:{surface:`caps-card-surface`,outline:`caps-card-outline`,interactive:`caps-card-interactive`,game:`caps-card-game caps-card-interactive`,fit:`caps-card-fit`},density:{regular:``,compact:`caps-card-compact`}},defaultVariants:{variant:`surface`,density:`regular`}}),ro=(0,H.forwardRef)(function({className:e,density:t,featured:n=!1,state:r,variant:i,...a},o){return(0,U.jsx)(`div`,{...a,className:j(no({density:t,variant:i}),n&&`caps-card-featured`,e),"data-state":r,ref:o})});(0,H.forwardRef)(function({className:e,density:t,variant:n,width:r=`default`,...i},a){return(0,U.jsx)(`main`,{className:`caps-centered-card-stage`,children:(0,U.jsx)(ro,{...i,className:j(`caps-centered-card`,r===`wide`&&`caps-centered-card-wide`,e),ref:a,variant:n??`surface`,...t?{density:t}:{}})})}),(0,H.forwardRef)(function({alignment:e=`start`,className:t,...n},r){return(0,U.jsx)(`div`,{...n,className:j(`caps-card-header`,e===`center`&&`caps-card-header-centered`,t),ref:r})}),(0,H.forwardRef)(function({className:e,level:t=3,...n},r){return(0,U.jsx)(t===2?`h2`:`h3`,{...n,className:j(`caps-card-title`,e),ref:r})}),(0,H.forwardRef)(function({className:e,...t},n){return(0,U.jsx)(`p`,{...t,className:j(`caps-card-description`,e),ref:n})}),(0,H.forwardRef)(function({className:e,...t},n){return(0,U.jsx)(`div`,{...t,className:j(`caps-card-content`,e),ref:n})}),(0,H.forwardRef)(function({className:e,...t},n){return(0,U.jsx)(`div`,{...t,className:j(`caps-card-footer`,e),ref:n})});var io=(0,H.forwardRef)(function({action:e,attachments:t,className:n,input:r,toolbar:i,...a},o){return(0,U.jsxs)(`div`,{...a,ref:o,className:j(`caps-composer`,n),children:[t===void 0?null:(0,U.jsx)(`div`,{className:`caps-composer-attachments`,children:t}),(0,U.jsx)(`div`,{className:`caps-composer-input`,children:r}),i===void 0&&e===void 0?null:(0,U.jsxs)(`div`,{className:`caps-composer-bar`,children:[(0,U.jsx)(`div`,{className:`caps-composer-toolbar`,children:i}),e]})]})});function ao({draft:e,hasAttachments:t=!1,busy:n,queueWhileBusy:r=!1,blocked:i=!1}){let a=!i&&(e.trim().length>0||t);return n&&(!r||!a)?`busy`:a?`ready`:`empty`}function oo({attachments:e,action:t,children:n,className:r,input:i,menu:a,row:o,...s}){return(0,U.jsxs)(Va,{className:`parakeet-composer-anchor`,children:[a,(0,U.jsxs)(ro,{...s,className:j(`parakeet-composer-shell`,r),children:[(0,U.jsx)(io,{action:t,attachments:e,input:i,toolbar:o===void 0?void 0:(0,U.jsx)(Wa,{className:`parakeet-composer-row`,align:`start`,items:o.items,openId:o.openId,onOpenChange:o.onOpenChange,renderTrigger:({children:e,...t})=>(0,U.jsx)(Ae,{...t,label:e,expanded:t[`aria-expanded`]===!0}),leading:o.controls,trailing:(0,U.jsxs)(`span`,{className:`parakeet-composer-trailing`,children:[o.status,o.readout==null?null:(0,U.jsx)(`span`,{className:`parakeet-composer-readout`,children:o.readout}),(0,U.jsx)(`span`,{className:`parakeet-composer-action`,children:o.action})]})})}),n]})]})}var so=1e5;function co(e){return!Number.isFinite(e)||e<=0?null:Ba(e/so)}var lo=`prints-prompt-counter`;function uo({busy:e,disabled:t,disabledReason:n,draft:r,label:i,onGenerate:a,promptOver:o}){return(0,U.jsx)(La,{"aria-describedby":o?lo:void 0,"aria-label":i,className:`prints-generate`,"data-generation-submit":!0,disabled:t||o,onClick:a,state:ao({draft:r,busy:e}),title:(t||o)&&n?n:i})}function fo({addedLength:e,length:t,maxLength:n}){return`${String(t)} / ${String(n)} characters. This model accepts up to ${String(n)}; shorten the prompt${e>0?` or its style and characters`:``} by ${String(t-n)} or pick another model.`}var po=.8;function mo(e){let t=window.getComputedStyle(e),n=Number.parseFloat(t.lineHeight);return(Number.isFinite(n)?n:26)+Number.parseFloat(t.paddingTop)+Number.parseFloat(t.paddingBottom)}function ho({caretRequest:e,layout:t,onOverflow:n,onOver:r,disabled:i,maxLength:a,addedLength:o=0,menu:s,mentionCount:c,onCaret:l,onChange:u,onMentionDismiss:d,onMentionMove:f,onMentionPick:p,onSend:m,onSlashMove:h,onSlashPick:g,placeholder:_,slashCount:v,value:y}){let b=(0,H.useRef)(null),x=(0,H.useRef)(y),[S,C]=(0,H.useState)([]),[w,T]=(0,H.useState)(-1),[ee,te]=(0,H.useState)(!1),E=(0,H.useRef)(!1),D=(0,H.useRef)(!1);x.current=y,(0,H.useLayoutEffect)(()=>{if(ee||i||!D.current)return;D.current=!1;let e=b.current;e&&e.ownerDocument.activeElement===e.ownerDocument.body&&e.focus({preventScroll:!0})},[i,ee]),(0,H.useLayoutEffect)(()=>{let t=b.current;!t||e?.value!==y||(t.setSelectionRange(e.caret,e.caret),t.focus({preventScroll:!0}))},[e,y]);let{cap:O,collapsed:k,fullscreen:A}=t;(0,H.useLayoutEffect)(()=>{let e=b.current;if(!e)return;if(A){e.style.height=``,n(!1);return}e.style.height=`auto`;let t=e.scrollHeight;e.style.height=`${String(k?mo(e):Math.min(t,O))}px`,n(!k&&t>O+1),k&&(e.scrollTop=0),k&&t>e.clientHeight+1?e.setAttribute(`data-clipped`,``):e.removeAttribute(`data-clipped`)},[y,O,k,A,n]),(0,H.useLayoutEffect)(()=>{let e=b.current;!e||!A||(e.setSelectionRange(e.value.length,e.value.length),e.scrollTop=e.scrollHeight)},[A]);let j=(0,H.useCallback)(async()=>{let e=x.current.trim();if(!(!e||i||E.current)){if(a!==void 0&&e.length+o>a){r(fo({addedLength:o,length:e.length+o,maxLength:a}));return}D.current=b.current===b.current?.ownerDocument.activeElement,E.current=!0,te(!0);try{if(!await m())return;C(t=>t.at(-1)===e?t:[...t,e].slice(-20)),T(-1)}finally{E.current=!1,te(!1)}}},[i,a,r,m,o]),ne=y.trim().length,M=ne>0?ne+o:0,N=a!==void 0&&M>a,re=a!==void 0&&M>=Math.floor(a*po);return(0,U.jsxs)(`div`,{className:`relative min-w-0 flex-1`,children:[(0,U.jsx)(Ja,{"aria-invalid":N?!0:void 0,"aria-label":`Prompt`,className:`w-full`,"data-generation-prompt":!0,"data-counting":re?``:void 0,...Za(s),disabled:i===!0||ee,onChange:e=>{u(e.currentTarget.value),l(e.currentTarget.selectionStart),T(-1)},onScroll:e=>{k&&(e.currentTarget.scrollTop=0)},onSelect:e=>{l(e.currentTarget.selectionStart)},onKeyDown:e=>{if(Ma(e))return;let t=Xa(e);if(c>0&&t!==null){e.preventDefault(),t===`next`?f(1):t===`previous`?f(-1):t===`accept`?p():d();return}if(y.startsWith(`/`)&&t!==null&&(v>0||t===`dismiss`||e.key===`Enter`)){if(e.preventDefault(),t===`dismiss`)u(y.slice(1));else if(v)t===`next`?h(1):t===`previous`?h(-1):g();else return;return}if(e.key===`Enter`&&!e.shiftKey){e.preventDefault(),j();return}if(e.key===`ArrowUp`&&b.current?.selectionStart===0&&S.length&&(w===-1||w>0)){e.preventDefault();let t=w===-1?S.length-1:w-1;T(t),u(S[t]);return}if(e.key===`ArrowDown`&&w!==-1){e.preventDefault();let t=w+1;t>=S.length?(T(-1),u(``)):(T(t),u(S[t]))}},placeholder:_,ref:b,style:{maxHeight:A?void 0:O},rows:1,value:y}),re?(0,U.jsxs)(`p`,{className:`prints-prompt-counter ${N?`text-error`:`text-dim`}`,"data-prompt-counter":!0,id:lo,role:`status`,title:N?fo({addedLength:o,length:M,maxLength:a}):void 0,children:[`${String(M)} / ${String(a)}`,N?(0,U.jsxs)(`span`,{className:`sr-only`,children:[` `,fo({addedLength:o,length:M,maxLength:a})]}):null]}):null]})}function go({index:e,listId:t,matches:n,onHighlight:r,onPick:i}){return(0,U.jsx)(Qa,{open:!0,rows:n.map(e=>({key:e.id,label:`/${e.slash}`,detail:e.description??e.title})),selected:e,listId:t,label:`Commands`,kind:`commands`,empty:`No matching commands`,onHighlight:r,onChoose:i})}function _o(e,t){let[n,r]=(0,H.useState)(0),i=t.startsWith(`/`),a=(0,H.useMemo)(()=>{if(!i)return[];let n=Aa(e.map((e,t)=>({alias:e.slash,commandId:e.id,command:e.command,title:e.title,description:e.description,category:`Prompt`,order:t,keys:[],availability:{status:`available`}})),t,{idleCategory:`Prompt`});return n.kind===`commands`?n.items.flatMap(({command:t})=>e.find(e=>e.id===t.commandId)??[]):[]},[t,e,i]);return(0,H.useEffect)(()=>{r(0)},[t]),{moveSlash:e=>{r(t=>a.length?(t+e+a.length)%a.length:0)},highlightSlash:r,resetSlash:()=>{r(0)},slashIndex:n,slashMatches:a,slashOpen:i}}function vo({images:e,index:t,listId:n,matches:r,onHighlight:i,onPick:a}){return(0,U.jsx)(Qa,{open:!0,rows:r.map(t=>{if(t.kind===`reference`)return{key:Q(t.reference.number),label:`@${Q(t.reference.number)}`,detail:t.reference.name,media:(0,U.jsx)(`span`,{className:`prints-character-thumb mask mask-squircle`,children:t.reference.url?(0,U.jsx)(`img`,{src:t.reference.url,alt:``}):null})};let{character:n}=t,r=n.references.at(0)?.path,i=e.find(e=>e.path===r);return{key:String(n.id),label:`@${n.name}`,detail:n.description||void 0,media:(0,U.jsx)(`span`,{className:`prints-character-thumb mask mask-squircle`,children:i?(0,U.jsx)(`img`,{src:i.url,alt:``}):null})}}),selected:t,listId:n,label:`References and characters`,kind:`characters`,onHighlight:i,onChoose:a})}var yo=e=>e.kind===`reference`?Q(e.reference.number):e.character.name;function bo(e,t,n,r){return ta(e).flatMap(e=>{let i=/^image(\d+)$/i.exec(e);if(i!==null){let t=n.find(e=>e.number===Number(i.at(1)));return[{key:e.toLowerCase(),label:`@${e.toLowerCase()}`,url:t?.url,valid:t!==void 0}]}let a=t.find(t=>t.name.toLowerCase()===e.toLowerCase());if(a===void 0)return[];let o=a.references.at(0)?.path;return[{key:`character:${String(a.id)}`,label:`@${a.name}`,url:r.find(e=>e.path===o)?.url,valid:!0}]})}function xo({tokens:e}){return e.length===0?null:(0,U.jsx)(`ul`,{className:`prints-mention-tokens`,"aria-label":`Mentioned in the prompt`,children:e.map(e=>(0,U.jsxs)(`li`,{className:`prints-mention-token`,"data-mention-token":e.label,"data-invalid":e.valid?void 0:``,title:e.valid?void 0:`No longer attached`,children:[(0,U.jsx)(`span`,{className:`prints-mention-thumb mask mask-squircle`,children:e.url?(0,U.jsx)(`img`,{src:e.url,alt:``}):null}),(0,U.jsx)(`span`,{children:e.label}),e.valid?null:(0,U.jsx)(`span`,{children:` · not attached`})]},e.key))})}function So(e,t,n){let[r,i]=(0,H.useState)(0),[a,o]=(0,H.useState)(0),[s,c]=(0,H.useState)(null),[l,u]=(0,H.useState)(null),d=s===n?null:ca(n,r),f=d?la(e,t,d.query):[];return(0,H.useEffect)(()=>{o(0)},[n]),{caretRequest:l,matches:f,index:a,setCaret:i,highlight:o,dismiss:()=>{c(n)},move:e=>{o(t=>f.length?(t+e+f.length)%f.length:0)},complete:e=>{let t=f.at(e);if(!d||!t)return null;let a=yo(t),o=`${n.slice(0,d.start)}@${a} ${n.slice(r)}`,s=d.start+a.length+2;return u({value:o,caret:s}),i(s),o}}}function Co(e,t,n){let[r,i]=(0,H.useState)(zi),a=e.map(e=>Ri(e,n)),o=Bi(r,a,t);return o!==r&&i(o),Vi(o,a)}var wo=400;function To(e){let{draft:t,model:n}=e;if(n===void 0||t.prompt.trim()===``)return null;let r=Li(t.prompt).length>0,i=n.kind===`audio`?oa(t.prompt):sa({prompt:t.prompt,saved:e.characters,references:t.references,labels:e.labels,wording:e=>Hi(zr(e,n,r),n),computerId:e.computerId,model:{label:n.label,maxReferences:n.input.maxReferences}});if(i.kind===`refused`)return null;let a=zr(i.references,n,r),o={...t,prompt:Ei(n.kind===`audio`?void 0:e.styleText,i.prompt),references:a};return Wr(o,n)!==void 0||n.video!==null&&!n.video.formats.some(e=>e.width===o.width&&e.height===o.height)?null:Vr(o,n).settings}function Eo(e,t){let n=e===null?null:JSON.stringify(e),r=(0,H.useRef)(e);r.current=e;let[i,a]=(0,H.useState)({key:n,settings:e});return(0,H.useEffect)(()=>{let e=setTimeout(()=>{a({key:n,settings:r.current})},t);return()=>{clearTimeout(e)}},[n,t]),i}function Do(e,t){return Jt({queryKey:[`prints`,`quote`,e?.computerId??null,t.key],enabled:e!==void 0&&t.settings!==null,queryFn:()=>e===void 0||t.settings===null?null:e.quote(t.settings),staleTime:6e4,retry:!1})}function Oo(e,t){let n=t===null?null:JSON.stringify(t),r=Eo(t,wo),i=qt(Do(e,r));return t===null||e===void 0?{state:`idle`}:r.key!==n||i.isPending?{state:`loading`}:i.isError||i.data==null?{state:`unavailable`}:{state:`ready`,price:co(i.data.costMilliunits)}}function ko(e,t){let n=Oo(e,t);return n.state===`ready`?n.price:null}export{ri as $,Bn as $t,xa as A,bt as An,Or as At,ha as B,$n as Bt,Ka as C,Bt as Cn,yr as Ct,va as D,It as Dn,Nr as Dt,wa as E,zt as En,Pr as Et,Ki as F,Mr as Ft,Ei as G,Qn as Gt,Q as H,tr as Ht,ga as I,xr as It,Di as J,Gn as Jt,Pi as K,qn as Kt,na as L,Wr as Lt,Sa as M,zr as Mt,ba as N,Ar as Nt,_a as O,Tt as On,Lr as Ot,ra as P,jr as Pt,gi as Q,Vn as Qt,oa as R,vr as Rt,qa as S,Wt as Sn,Vr as St,Ea as T,Vt as Tn,kr as Tt,Hi as U,Yn as Ut,Li as V,er as Vt,Wi as W,Zn as Wt,bi as X,Un as Xt,Ni as Y,Wn as Yt,mi as Z,Hn as Zt,to as _,W as _n,Fr as _t,ho as a,Pn as an,ni as at,Wa as b,Ut as bn,pr as bt,go as c,Y as cn,Zr as ct,_o as d,bn as dn,Ir as dt,zn as en,li as et,So as f,K as fn,or as ft,$a as g,_n as gn,lr as gt,oo as h,gn as hn,dr as ht,uo as i,Fn as in,ai as it,$ as j,Rr as jt,ya as k,yt as kn,hr as kt,bo as l,J as ln,ir as lt,co as m,G as mn,gr as mt,ko as n,Ln as nn,oi as nt,vo as o,Mn as on,Qr as ot,Co as p,vn as pn,X as pt,Oi as q,Kn as qt,Oo as r,In as rn,si as rt,xo as s,q as sn,Gr as st,To as t,Rn as tn,ii as tt,fo as u,xn as un,ar as ut,eo as v,qt as vn,_r as vt,Ma as w,Ht as wn,rr as wt,Ga as x,Gt as xn,ur as xt,Ja as y,Kt as yn,mr as yt,sa as z,nr as zt};