@fungi.computer/prints 0.20.28 → 0.20.30

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 (23) hide show
  1. package/dist/assets/{arrow-right-BN9sFB76.js → arrow-right-Cil61IdP.js} +1 -1
  2. package/dist/assets/{data-list-CmmlMJB1.js → data-list-DZFNpnhE.js} +1 -1
  3. package/dist/assets/{dialog-C9_ukab9.js → dialog-BRD5snH9.js} +1 -1
  4. package/dist/assets/{images-Yd0FwcEN.js → images-DbqVEI92.js} +1 -1
  5. package/dist/assets/{index-B6wPyk8x.js → index-CVMeg7VN.js} +3 -3
  6. package/dist/assets/{index-CGWzoDpA.css → index-DE94KKOl.css} +1 -1
  7. package/dist/assets/{library-dialogs-0ZSodLWS.js → library-dialogs-CDgHHvX1.js} +2 -2
  8. package/dist/assets/library-folders-dialog-sN7pQ-iH.js +1 -0
  9. package/dist/assets/{library-rail-BWvTDKYy.js → library-rail-pQsc3ZAQ.js} +1 -1
  10. package/dist/assets/{print-download-button-CY0MVFL1.js → print-download-button-Co7rFQDM.js} +1 -1
  11. package/dist/assets/{print-info-drawer-l12Feb31.js → print-info-drawer-XZdc15CI.js} +2 -2
  12. package/dist/assets/{print-viewer-Bo6rgETj.js → print-viewer-1AxfZFoO.js} +2 -2
  13. package/dist/assets/{prints-activity-tray-fBvz4KPN.js → prints-activity-tray-Dzuo0oQf.js} +1 -1
  14. package/dist/assets/prints-folder-dialog-2uX7-Mza.js +1 -0
  15. package/dist/assets/{prompt-character-controls-CULFAqk_.js → prompt-character-controls-CYM-yAvH.js} +1 -1
  16. package/dist/assets/{prompt-styles-dialog-C78A_y2L.js → prompt-styles-dialog-BZhT0MLL.js} +1 -1
  17. package/dist/assets/{reference-lightbox-CRP9rCzA.js → reference-lightbox-BhAciijE.js} +1 -1
  18. package/dist/assets/{rotate-ccw-DHbQhmV7.js → rotate-ccw-B5gjJwtq.js} +1 -1
  19. package/dist/assets/{upload-queue-D8LJnTgK.js → upload-queue-ByN0V68V.js} +1 -1
  20. package/dist/index.html +2 -2
  21. package/package.json +7 -7
  22. package/dist/assets/library-folders-dialog-K8RdUGuo.js +0 -1
  23. package/dist/assets/prints-folder-dialog-F7K-fTDo.js +0 -1
@@ -1,4 +1,4 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./prints-activity-tray-fBvz4KPN.js","./data-list-CmmlMJB1.js","./upload-queue-D8LJnTgK.js","./rotate-ccw-DHbQhmV7.js","./prompt-styles-dialog-C78A_y2L.js","./dialog-C9_ukab9.js","./prompt-character-controls-CULFAqk_.js","./reference-lightbox-CRP9rCzA.js","./arrow-right-BN9sFB76.js","./library-dialogs-0ZSodLWS.js","./library-folders-dialog-K8RdUGuo.js","./library-rail-BWvTDKYy.js","./images-Yd0FwcEN.js","./print-viewer-Bo6rgETj.js","./prints-folder-dialog-F7K-fTDo.js","./print-info-drawer-l12Feb31.js"])))=>i.map(i=>d[i]);
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./prints-activity-tray-Dzuo0oQf.js","./data-list-DZFNpnhE.js","./upload-queue-ByN0V68V.js","./rotate-ccw-B5gjJwtq.js","./prompt-styles-dialog-BZhT0MLL.js","./dialog-BRD5snH9.js","./prompt-character-controls-CYM-yAvH.js","./reference-lightbox-BhAciijE.js","./arrow-right-Cil61IdP.js","./library-dialogs-CDgHHvX1.js","./library-folders-dialog-sN7pQ-iH.js","./library-rail-pQsc3ZAQ.js","./images-DbqVEI92.js","./print-viewer-1AxfZFoO.js","./prints-folder-dialog-2uX7-Mza.js","./print-info-drawer-XZdc15CI.js"])))=>i.map(i=>d[i]);
2
2
  var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),s=(e,n)=>{let r={};for(var i in e)t(r,i,{get:e[i],enumerable:!0});return n||t(r,Symbol.toStringTag,{value:`Module`}),r},c=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},l=(n,r,o)=>(o=n==null?{}:e(i(n)),c(r||!n||!n.__esModule||!a.call(n,`default`)?t(o,`default`,{value:n,enumerable:!0}):o,n));(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var u=o((e=>{var t=Symbol.for(`react.element`),n=Symbol.for(`react.portal`),r=Symbol.for(`react.fragment`),i=Symbol.for(`react.strict_mode`),a=Symbol.for(`react.profiler`),o=Symbol.for(`react.provider`),s=Symbol.for(`react.context`),c=Symbol.for(`react.forward_ref`),l=Symbol.for(`react.suspense`),u=Symbol.for(`react.memo`),d=Symbol.for(`react.lazy`),f=Symbol.iterator;function p(e){return typeof e!=`object`||!e?null:(e=f&&e[f]||e[`@@iterator`],typeof e==`function`?e:null)}var m={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},h=Object.assign,g={};function _(e,t,n){this.props=e,this.context=t,this.refs=g,this.updater=n||m}_.prototype.isReactComponent={},_.prototype.setState=function(e,t){if(typeof e!=`object`&&typeof e!=`function`&&e!=null)throw Error(`setState(...): takes an object of state variables to update or a function which returns an object of state variables.`);this.updater.enqueueSetState(this,e,t,`setState`)},_.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,`forceUpdate`)};function v(){}v.prototype=_.prototype;function y(e,t,n){this.props=e,this.context=t,this.refs=g,this.updater=n||m}var b=y.prototype=new v;b.constructor=y,h(b,_.prototype),b.isPureReactComponent=!0;var x=Array.isArray,S=Object.prototype.hasOwnProperty,C={current:null},w={key:!0,ref:!0,__self:!0,__source:!0};function T(e,n,r){var i,a={},o=null,s=null;if(n!=null)for(i in n.ref!==void 0&&(s=n.ref),n.key!==void 0&&(o=``+n.key),n)S.call(n,i)&&!w.hasOwnProperty(i)&&(a[i]=n[i]);var c=arguments.length-2;if(c===1)a.children=r;else if(1<c){for(var l=Array(c),u=0;u<c;u++)l[u]=arguments[u+2];a.children=l}if(e&&e.defaultProps)for(i in c=e.defaultProps,c)a[i]===void 0&&(a[i]=c[i]);return{$$typeof:t,type:e,key:o,ref:s,props:a,_owner:C.current}}function E(e,n){return{$$typeof:t,type:e.type,key:n,ref:e.ref,props:e.props,_owner:e._owner}}function D(e){return typeof e==`object`&&!!e&&e.$$typeof===t}function O(e){var t={"=":`=0`,":":`=2`};return`$`+e.replace(/[=:]/g,function(e){return t[e]})}var k=/\/+/g;function A(e,t){return typeof e==`object`&&e&&e.key!=null?O(``+e.key):t.toString(36)}function j(e,r,i,a,o){var s=typeof e;(s===`undefined`||s===`boolean`)&&(e=null);var c=!1;if(e===null)c=!0;else switch(s){case`string`:case`number`:c=!0;break;case`object`:switch(e.$$typeof){case t:case n:c=!0}}if(c)return c=e,o=o(c),e=a===``?`.`+A(c,0):a,x(o)?(i=``,e!=null&&(i=e.replace(k,`$&/`)+`/`),j(o,r,i,``,function(e){return e})):o!=null&&(D(o)&&(o=E(o,i+(!o.key||c&&c.key===o.key?``:(``+o.key).replace(k,`$&/`)+`/`)+e)),r.push(o)),1;if(c=0,a=a===``?`.`:a+`:`,x(e))for(var l=0;l<e.length;l++){s=e[l];var u=a+A(s,l);c+=j(s,r,i,u,o)}else if(u=p(e),typeof u==`function`)for(e=u.call(e),l=0;!(s=e.next()).done;)s=s.value,u=a+A(s,l++),c+=j(s,r,i,u,o);else if(s===`object`)throw r=String(e),Error(`Objects are not valid as a React child (found: `+(r===`[object Object]`?`object with keys {`+Object.keys(e).join(`, `)+`}`:r)+`). If you meant to render a collection of children, use an array instead.`);return c}function M(e,t,n){if(e==null)return e;var r=[],i=0;return j(e,r,``,``,function(e){return t.call(n,e,i++)}),r}function N(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(t){(e._status===0||e._status===-1)&&(e._status=1,e._result=t)},function(t){(e._status===0||e._status===-1)&&(e._status=2,e._result=t)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var P={current:null},F={transition:null},I={ReactCurrentDispatcher:P,ReactCurrentBatchConfig:F,ReactCurrentOwner:C};function L(){throw Error(`act(...) is not supported in production builds of React.`)}e.Children={map:M,forEach:function(e,t,n){M(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return M(e,function(){t++}),t},toArray:function(e){return M(e,function(e){return e})||[]},only:function(e){if(!D(e))throw Error(`React.Children.only expected to receive a single React element child.`);return e}},e.Component=_,e.Fragment=r,e.Profiler=a,e.PureComponent=y,e.StrictMode=i,e.Suspense=l,e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=I,e.act=L,e.cloneElement=function(e,n,r){if(e==null)throw Error(`React.cloneElement(...): The argument must be a React element, but you passed `+e+`.`);var i=h({},e.props),a=e.key,o=e.ref,s=e._owner;if(n!=null){if(n.ref!==void 0&&(o=n.ref,s=C.current),n.key!==void 0&&(a=``+n.key),e.type&&e.type.defaultProps)var c=e.type.defaultProps;for(l in n)S.call(n,l)&&!w.hasOwnProperty(l)&&(i[l]=n[l]===void 0&&c!==void 0?c[l]:n[l])}var l=arguments.length-2;if(l===1)i.children=r;else if(1<l){c=Array(l);for(var u=0;u<l;u++)c[u]=arguments[u+2];i.children=c}return{$$typeof:t,type:e.type,key:a,ref:o,props:i,_owner:s}},e.createContext=function(e){return e={$$typeof:s,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},e.Provider={$$typeof:o,_context:e},e.Consumer=e},e.createElement=T,e.createFactory=function(e){var t=T.bind(null,e);return t.type=e,t},e.createRef=function(){return{current:null}},e.forwardRef=function(e){return{$$typeof:c,render:e}},e.isValidElement=D,e.lazy=function(e){return{$$typeof:d,_payload:{_status:-1,_result:e},_init:N}},e.memo=function(e,t){return{$$typeof:u,type:e,compare:t===void 0?null:t}},e.startTransition=function(e){var t=F.transition;F.transition={};try{e()}finally{F.transition=t}},e.unstable_act=L,e.useCallback=function(e,t){return P.current.useCallback(e,t)},e.useContext=function(e){return P.current.useContext(e)},e.useDebugValue=function(){},e.useDeferredValue=function(e){return P.current.useDeferredValue(e)},e.useEffect=function(e,t){return P.current.useEffect(e,t)},e.useId=function(){return P.current.useId()},e.useImperativeHandle=function(e,t,n){return P.current.useImperativeHandle(e,t,n)},e.useInsertionEffect=function(e,t){return P.current.useInsertionEffect(e,t)},e.useLayoutEffect=function(e,t){return P.current.useLayoutEffect(e,t)},e.useMemo=function(e,t){return P.current.useMemo(e,t)},e.useReducer=function(e,t,n){return P.current.useReducer(e,t,n)},e.useRef=function(e){return P.current.useRef(e)},e.useState=function(e){return P.current.useState(e)},e.useSyncExternalStore=function(e,t,n){return P.current.useSyncExternalStore(e,t,n)},e.useTransition=function(){return P.current.useTransition()},e.version=`18.3.1`})),d=o(((e,t)=>{t.exports=u()})),f;function p(e,t,n){function r(n,r){if(n._zod||Object.defineProperty(n,"_zod",{value:{def:r,constr:o,traits:new Set},enumerable:!1}),n._zod.traits.has(e))return;n._zod.traits.add(e),t(n,r);let i=o.prototype,a=Object.keys(i);for(let e=0;e<a.length;e++){let t=a[e];t in n||(n[t]=i[t].bind(n))}}let i=n?.Parent??Object;class a extends i{}Object.defineProperty(a,"name",{value:e});function o(e){var t;let i=n?.Parent?new a:this;r(i,e),(t=i._zod).deferred??(t.deferred=[]);for(let e of i._zod.deferred)e();return i}return Object.defineProperty(o,"init",{value:r}),Object.defineProperty(o,Symbol.hasInstance,{value:t=>n?.Parent&&t instanceof n.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(o,"name",{value:e}),o}var m=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},h=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}};(f=globalThis).__zod_globalConfig??(f.__zod_globalConfig={});var g=globalThis.__zod_globalConfig;function _(e){return e&&Object.assign(g,e),g}function v(e){let t=Object.values(e).filter(e=>typeof e==`number`);return Object.entries(e).filter(([e,n])=>t.indexOf(+e)===-1).map(([e,t])=>t)}function y(e,t){return typeof t==`bigint`?t.toString():t}function b(e){return{get value(){{let t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function x(e){return e==null}function S(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function C(e,t){let n=e/t,r=Math.round(n),i=2**-52*Math.max(Math.abs(n),1);return Math.abs(n-r)<i?0:n-r}var w=Symbol(`evaluating`);function T(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==w)return r===void 0&&(r=w,r=n()),r},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function E(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function D(...e){let t={};for(let n of e){let e=Object.getOwnPropertyDescriptors(n);Object.assign(t,e)}return Object.defineProperties({},t)}function O(e){return JSON.stringify(e)}function k(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}var A=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function j(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var M=b(()=>{if(g.jitless||typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function N(e){if(j(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return j(n)!==!1&&Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)!==!1}function P(e){return N(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}var F=new Set([`string`,`number`,`symbol`]);function I(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function L(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function R(e){let t=e;if(!t)return{};if(typeof t==`string`)return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error==`string`?{...t,error:()=>t.error}:t}function z(e){return Object.keys(e).filter(t=>e[t]._zod.optin===`optional`&&e[t]._zod.optout===`optional`)}var ee={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function te(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.pick() cannot be used on object schemas containing refinements`);return L(e,D(e._zod.def,{get shape(){let e={};for(let r in t){if(!(r in n.shape))throw Error(`Unrecognized key: "${r}"`);t[r]&&(e[r]=n.shape[r])}return E(this,`shape`,e),e},checks:[]}))}function B(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.omit() cannot be used on object schemas containing refinements`);return L(e,D(e._zod.def,{get shape(){let r={...e._zod.def.shape};for(let e in t){if(!(e in n.shape))throw Error(`Unrecognized key: "${e}"`);t[e]&&delete r[e]}return E(this,`shape`,r),r},checks:[]}))}function ne(e,t){if(!N(t))throw Error(`Invalid input to extend: expected a plain object`);let n=e._zod.def.checks;if(n&&n.length>0){let n=e._zod.def.shape;for(let e in t)if(Object.getOwnPropertyDescriptor(n,e)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return L(e,D(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return E(this,`shape`,n),n}}))}function re(e,t){if(!N(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return L(e,D(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return E(this,`shape`,n),n}}))}function V(e,t){if(e._zod.def.checks?.length)throw Error(`.merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.`);return L(e,D(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return E(this,`shape`,n),n},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]}))}function H(e,t,n){let r=t._zod.def.checks;if(r&&r.length>0)throw Error(`.partial() cannot be used on object schemas containing refinements`);return L(t,D(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in r))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t])}else for(let t in r)i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t];return E(this,`shape`,i),i},checks:[]}))}function ie(e,t,n){return L(t,D(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in i))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=new e({type:`nonoptional`,innerType:r[t]}))}else for(let t in r)i[t]=new e({type:`nonoptional`,innerType:r[t]});return E(this,`shape`,i),i}}))}function ae(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function oe(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue===!1)return!0;return!1}function se(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function ce(e){return typeof e==`string`?e:e?.message}function le(e,t,n){let r=e.message?e.message:ce(e.inst?._zod.def?.error?.(e))??ce(t?.error?.(e))??ce(n.customError?.(e))??ce(n.localeError?.(e))??`Invalid input`,{inst:i,continue:a,input:o,...s}=e;return s.path??=[],s.message=r,t?.reportInput&&(s.input=o),s}function ue(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function de(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}var fe=(e,t)=>{e.name=`$ZodError`,Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,y,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},pe=p(`$ZodError`,fe),me=p(`$ZodError`,fe,{Parent:Error});function he(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?(n[i.path[0]]=n[i.path[0]]||[],n[i.path[0]].push(t(i))):r.push(t(i));return{formErrors:r,fieldErrors:n}}function ge(e,t=e=>e.message){let n={_errors:[]},r=(e,i=[])=>{for(let a of e.issues)if(a.code===`invalid_union`&&a.errors.length)a.errors.map(e=>r({issues:e},[...i,...a.path]));else if(a.code===`invalid_key`)r({issues:a.issues},[...i,...a.path]);else if(a.code===`invalid_element`)r({issues:a.issues},[...i,...a.path]);else{let e=[...i,...a.path];if(e.length===0)n._errors.push(t(a));else{let r=n,i=0;for(;i<e.length;){let n=e[i];i===e.length-1?(r[n]=r[n]||{_errors:[]},r[n]._errors.push(t(a))):r[n]=r[n]||{_errors:[]},r=r[n],i++}}}};return r(e),n}var _e=e=>(t,n,r,i)=>{let a=r?{...r,async:!1}:{async:!1},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise)throw new m;if(o.issues.length){let t=new((i?.Err)??e)(o.issues.map(e=>le(e,a,_())));throw A(t,i?.callee),t}return o.value},ve=_e(me),ye=e=>async(t,n,r,i)=>{let a=r?{...r,async:!0}:{async:!0},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise&&(o=await o),o.issues.length){let t=new((i?.Err)??e)(o.issues.map(e=>le(e,a,_())));throw A(t,i?.callee),t}return o.value},be=ye(me),xe=e=>(t,n,r)=>{let i=r?{...r,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new m;return a.issues.length?{success:!1,error:new(e??pe)(a.issues.map(e=>le(e,i,_())))}:{success:!0,data:a.value}},Se=xe(me),Ce=e=>async(t,n,r)=>{let i=r?{...r,async:!0}:{async:!0},a=t._zod.run({value:n,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?{success:!1,error:new e(a.issues.map(e=>le(e,i,_())))}:{success:!0,data:a.value}},we=Ce(me),Te=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return _e(e)(t,n,i)},Ee=e=>(t,n,r)=>_e(e)(t,n,r),De=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return ye(e)(t,n,i)},Oe=e=>async(t,n,r)=>ye(e)(t,n,r),ke=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return xe(e)(t,n,i)},Ae=e=>(t,n,r)=>xe(e)(t,n,r),je=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return Ce(e)(t,n,i)},Me=e=>async(t,n,r)=>Ce(e)(t,n,r),Ne=/^[cC][0-9a-z]{6,}$/,Pe=/^[0-9a-z]+$/,Fe=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Ie=/^[0-9a-vA-V]{20}$/,Le=/^[A-Za-z0-9]{27}$/,Re=/^[a-zA-Z0-9_-]{21}$/,ze=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Be=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,Ve=e=>e?RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,He=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Ue=`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`;function We(){return new RegExp(Ue,`u`)}var Ge=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Ke=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,qe=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,Je=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Ye=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Xe=/^[A-Za-z0-9_-]*$/,Ze=/^https?$/,Qe=/^\+[1-9]\d{6,14}$/,$e=`(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))`,et=RegExp(`^${$e}$`);function tt(e){let t=`(?:[01]\\d|2[0-3]):[0-5]\\d`;return typeof e.precision==`number`?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function nt(e){return RegExp(`^${tt(e)}$`)}function rt(e){let t=tt({precision:e.precision}),n=[`Z`];e.local&&n.push(``),e.offset&&n.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);let r=`${t}(?:${n.join(`|`)})`;return RegExp(`^${$e}T(?:${r})$`)}var it=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??``}}`:`[\\s\\S]*`;return RegExp(`^${t}$`)},at=/^-?\d+$/,ot=/^-?\d+(?:\.\d+)?$/,st=/^(?:true|false)$/i,ct=/^null$/i,lt=/^[^A-Z]*$/,ut=/^[^a-z]*$/,dt=p(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),ft={number:`number`,bigint:`bigint`,object:`date`},pt=p(`$ZodCheckLessThan`,(e,t)=>{dt.init(e,t);let n=ft[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.maximum:n.exclusiveMaximum)??1/0;t.value<r&&(t.inclusive?n.maximum=t.value:n.exclusiveMaximum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:n,code:`too_big`,maximum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),mt=p(`$ZodCheckGreaterThan`,(e,t)=>{dt.init(e,t);let n=ft[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.minimum:n.exclusiveMinimum)??-1/0;t.value>r&&(t.inclusive?n.minimum=t.value:n.exclusiveMinimum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:n,code:`too_small`,minimum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),ht=p(`$ZodCheckMultipleOf`,(e,t)=>{dt.init(e,t),e._zod.onattach.push(e=>{var n;(n=e._zod.bag).multipleOf??(n.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw Error(`Cannot mix number and bigint in multiple_of check.`);(typeof n.value==`bigint`?n.value%t.value===BigInt(0):C(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:`not_multiple_of`,divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),gt=p(`$ZodCheckNumberFormat`,(e,t)=>{dt.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[i,a]=ee[t.format];e._zod.onattach.push(e=>{let r=e._zod.bag;r.format=t.format,r.minimum=i,r.maximum=a,n&&(r.pattern=at)}),e._zod.check=o=>{let s=o.value;if(n){if(!Number.isInteger(s)){o.issues.push({expected:r,format:t.format,code:`invalid_type`,continue:!1,input:s,inst:e});return}if(!Number.isSafeInteger(s)){s>0?o.issues.push({input:s,code:`too_big`,maximum:2**53-1,note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort}):o.issues.push({input:s,code:`too_small`,minimum:-(2**53-1),note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}s<i&&o.issues.push({origin:`number`,input:s,code:`too_small`,minimum:i,inclusive:!0,inst:e,continue:!t.abort}),s>a&&o.issues.push({origin:`number`,input:s,code:`too_big`,maximum:a,inclusive:!0,inst:e,continue:!t.abort})}}),_t=p(`$ZodCheckMaxLength`,(e,t)=>{var n;dt.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!x(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.maximum??1/0;t.maximum<n&&(e._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{let r=n.value;if(r.length<=t.maximum)return;let i=ue(r);n.issues.push({origin:i,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),vt=p(`$ZodCheckMinLength`,(e,t)=>{var n;dt.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!x(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.minimum??-1/0;t.minimum>n&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let r=n.value;if(r.length>=t.minimum)return;let i=ue(r);n.issues.push({origin:i,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),yt=p(`$ZodCheckLengthEquals`,(e,t)=>{var n;dt.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!x(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length}),e._zod.check=n=>{let r=n.value,i=r.length;if(i===t.length)return;let a=ue(r),o=i>t.length;n.issues.push({origin:a,...o?{code:`too_big`,maximum:t.length}:{code:`too_small`,minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),bt=p(`$ZodCheckStringFormat`,(e,t)=>{var n,r;dt.init(e,t),e._zod.onattach.push(e=>{let n=e._zod.bag;n.format=t.format,t.pattern&&(n.patterns??=new Set,n.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),xt=p(`$ZodCheckRegex`,(e,t)=>{bt.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:`regex`,input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),St=p(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=lt,bt.init(e,t)}),Ct=p(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=ut,bt.init(e,t)}),wt=p(`$ZodCheckIncludes`,(e,t)=>{dt.init(e,t);let n=I(t.includes),r=new RegExp(typeof t.position==`number`?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(r)}),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:`string`,code:`invalid_format`,format:`includes`,includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),Tt=p(`$ZodCheckStartsWith`,(e,t)=>{dt.init(e,t);let n=RegExp(`^${I(t.prefix)}.*`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`starts_with`,prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),Et=p(`$ZodCheckEndsWith`,(e,t)=>{dt.init(e,t);let n=RegExp(`.*${I(t.suffix)}$`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`ends_with`,suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),Dt=p(`$ZodCheckOverwrite`,(e,t)=>{dt.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}}),Ot=class{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),--this.indent}write(e){if(typeof e==`function`){e(this,{execution:`sync`}),e(this,{execution:`async`});return}let t=e.split(`
3
3
  `).filter(e=>e),n=Math.min(...t.map(e=>e.length-e.trimStart().length)),r=t.map(e=>e.slice(n)).map(e=>` `.repeat(this.indent*2)+e);for(let e of r)this.content.push(e)}compile(){let e=Function,t=this?.args,n=[...(this?.content??[``]).map(e=>` ${e}`)];return new e(...t,n.join(`
4
4
  `))}},kt={major:4,minor:4,patch:3},At=p(`$ZodType`,(e,t)=>{var n;e??={},e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=kt;let r=[...e._zod.def.checks??[]];e._zod.traits.has(`$ZodCheck`)&&r.unshift(e);for(let t of r)for(let n of t._zod.onattach)n(e);if(r.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let t=(e,t,n)=>{let r=ae(e),i;for(let a of t){if(a._zod.def.when){if(oe(e)||!a._zod.def.when(e))continue}else if(r)continue;let t=e.issues.length,o=a._zod.check(e);if(o instanceof Promise&&n?.async===!1)throw new m;if(i||o instanceof Promise)i=(i??Promise.resolve()).then(async()=>{await o,e.issues.length!==t&&(r||=ae(e,t))});else{if(e.issues.length===t)continue;r||=ae(e,t)}}return i?i.then(()=>e):e},n=(n,i,a)=>{if(ae(n))return n.aborted=!0,n;let o=t(i,r,a);if(o instanceof Promise){if(a.async===!1)throw new m;return o.then(t=>e._zod.parse(t,a))}return e._zod.parse(o,a)};e._zod.run=(i,a)=>{if(a.skipChecks)return e._zod.parse(i,a);if(a.direction===`backward`){let t=e._zod.parse({value:i.value,issues:[]},{...a,skipChecks:!0});return t instanceof Promise?t.then(e=>n(e,i,a)):n(t,i,a)}let o=e._zod.parse(i,a);if(o instanceof Promise){if(a.async===!1)throw new m;return o.then(e=>t(e,r,a))}return t(o,r,a)}}T(e,`~standard`,()=>({validate:t=>{try{let n=Se(e,t);return n.success?{value:n.data}:{issues:n.error?.issues}}catch{return we(e,t).then(e=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:`zod`,version:1}))}),jt=p(`$ZodString`,(e,t)=>{At.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??it(e._zod.bag),e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value==`string`||n.issues.push({expected:`string`,code:`invalid_type`,input:n.value,inst:e}),n}}),Mt=p(`$ZodStringFormat`,(e,t)=>{bt.init(e,t),jt.init(e,t)}),Nt=p(`$ZodGUID`,(e,t)=>{t.pattern??=Be,Mt.init(e,t)}),Pt=p(`$ZodUUID`,(e,t)=>{if(t.version){let e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(e===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??=Ve(e)}else t.pattern??=Ve();Mt.init(e,t)}),Ft=p(`$ZodEmail`,(e,t)=>{t.pattern??=He,Mt.init(e,t)}),It=p(`$ZodURL`,(e,t)=>{Mt.init(e,t),e._zod.check=n=>{try{let r=n.value.trim();if(!t.normalize&&t.protocol?.source===Ze.source&&!/^https?:\/\//i.test(r)){n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid URL format`,input:n.value,inst:e,continue:!t.abort});return}let i=new URL(r);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(i.hostname)||n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid hostname`,pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(i.protocol.endsWith(`:`)?i.protocol.slice(0,-1):i.protocol)||n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid protocol`,pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),n.value=t.normalize?i.href:r;return}catch{n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort})}}}),Lt=p(`$ZodEmoji`,(e,t)=>{t.pattern??=We(),Mt.init(e,t)}),Rt=p(`$ZodNanoID`,(e,t)=>{t.pattern??=Re,Mt.init(e,t)}),zt=p(`$ZodCUID`,(e,t)=>{t.pattern??=Ne,Mt.init(e,t)}),Bt=p(`$ZodCUID2`,(e,t)=>{t.pattern??=Pe,Mt.init(e,t)}),Vt=p(`$ZodULID`,(e,t)=>{t.pattern??=Fe,Mt.init(e,t)}),Ht=p(`$ZodXID`,(e,t)=>{t.pattern??=Ie,Mt.init(e,t)}),Ut=p(`$ZodKSUID`,(e,t)=>{t.pattern??=Le,Mt.init(e,t)}),Wt=p(`$ZodISODateTime`,(e,t)=>{t.pattern??=rt(t),Mt.init(e,t)}),Gt=p(`$ZodISODate`,(e,t)=>{t.pattern??=et,Mt.init(e,t)}),Kt=p(`$ZodISOTime`,(e,t)=>{t.pattern??=nt(t),Mt.init(e,t)}),qt=p(`$ZodISODuration`,(e,t)=>{t.pattern??=ze,Mt.init(e,t)}),Jt=p(`$ZodIPv4`,(e,t)=>{t.pattern??=Ge,Mt.init(e,t),e._zod.bag.format=`ipv4`}),Yt=p(`$ZodIPv6`,(e,t)=>{t.pattern??=Ke,Mt.init(e,t),e._zod.bag.format=`ipv6`,e._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:`invalid_format`,format:`ipv6`,input:n.value,inst:e,continue:!t.abort})}}}),Xt=p(`$ZodCIDRv4`,(e,t)=>{t.pattern??=qe,Mt.init(e,t)}),Zt=p(`$ZodCIDRv6`,(e,t)=>{t.pattern??=Je,Mt.init(e,t),e._zod.check=n=>{let r=n.value.split(`/`);try{if(r.length!==2)throw Error();let[e,t]=r;if(!t)throw Error();let n=Number(t);if(`${n}`!==t||n<0||n>128)throw Error();new URL(`http://[${e}]`)}catch{n.issues.push({code:`invalid_format`,format:`cidrv6`,input:n.value,inst:e,continue:!t.abort})}}});function Qt(e){if(e===``)return!0;if(/\s/.test(e)||e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}var $t=p(`$ZodBase64`,(e,t)=>{t.pattern??=Ye,Mt.init(e,t),e._zod.bag.contentEncoding=`base64`,e._zod.check=n=>{Qt(n.value)||n.issues.push({code:`invalid_format`,format:`base64`,input:n.value,inst:e,continue:!t.abort})}});function en(e){if(!Xe.test(e))return!1;let t=e.replace(/[-_]/g,e=>e===`-`?`+`:`/`);return Qt(t.padEnd(Math.ceil(t.length/4)*4,`=`))}var tn=p(`$ZodBase64URL`,(e,t)=>{t.pattern??=Xe,Mt.init(e,t),e._zod.bag.contentEncoding=`base64url`,e._zod.check=n=>{en(n.value)||n.issues.push({code:`invalid_format`,format:`base64url`,input:n.value,inst:e,continue:!t.abort})}}),nn=p(`$ZodE164`,(e,t)=>{t.pattern??=Qe,Mt.init(e,t)});function rn(e,t=null){try{let n=e.split(`.`);if(n.length!==3)return!1;let[r]=n;if(!r)return!1;let i=JSON.parse(atob(r));return!(`typ`in i&&i?.typ!==`JWT`||!i.alg||t&&(!(`alg`in i)||i.alg!==t))}catch{return!1}}var an=p(`$ZodJWT`,(e,t)=>{Mt.init(e,t),e._zod.check=n=>{rn(n.value,t.alg)||n.issues.push({code:`invalid_format`,format:`jwt`,input:n.value,inst:e,continue:!t.abort})}}),on=p(`$ZodNumber`,(e,t)=>{At.init(e,t),e._zod.pattern=e._zod.bag.pattern??ot,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}let i=n.value;if(typeof i==`number`&&!Number.isNaN(i)&&Number.isFinite(i))return n;let a=typeof i==`number`?Number.isNaN(i)?`NaN`:Number.isFinite(i)?void 0:`Infinity`:void 0;return n.issues.push({expected:`number`,code:`invalid_type`,input:i,inst:e,...a?{received:a}:{}}),n}}),sn=p(`$ZodNumberFormat`,(e,t)=>{gt.init(e,t),on.init(e,t)}),cn=p(`$ZodBoolean`,(e,t)=>{At.init(e,t),e._zod.pattern=st,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=!!n.value}catch{}let i=n.value;return typeof i==`boolean`||n.issues.push({expected:`boolean`,code:`invalid_type`,input:i,inst:e}),n}}),ln=p(`$ZodNull`,(e,t)=>{At.init(e,t),e._zod.pattern=ct,e._zod.values=new Set([null]),e._zod.parse=(t,n)=>{let r=t.value;return r===null||t.issues.push({expected:`null`,code:`invalid_type`,input:r,inst:e}),t}}),un=p(`$ZodUnknown`,(e,t)=>{At.init(e,t),e._zod.parse=e=>e}),dn=p(`$ZodNever`,(e,t)=>{At.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:`never`,code:`invalid_type`,input:t.value,inst:e}),t)}),fn=p(`$ZodVoid`,(e,t)=>{At.init(e,t),e._zod.parse=(t,n)=>{let r=t.value;return r===void 0||t.issues.push({expected:`void`,code:`invalid_type`,input:r,inst:e}),t}});function pn(e,t,n){e.issues.length&&t.issues.push(...se(n,e.issues)),t.value[n]=e.value}var mn=p(`$ZodArray`,(e,t)=>{At.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!Array.isArray(i))return n.issues.push({expected:`array`,code:`invalid_type`,input:i,inst:e}),n;n.value=Array(i.length);let a=[];for(let e=0;e<i.length;e++){let o=i[e],s=t.element._zod.run({value:o,issues:[]},r);s instanceof Promise?a.push(s.then(t=>pn(t,n,e))):pn(s,n,e)}return a.length?Promise.all(a).then(()=>n):n}});function hn(e,t,n,r,i,a){let o=n in r;if(e.issues.length){if(i&&a&&!o)return;t.issues.push(...se(n,e.issues))}if(!o&&!i){e.issues.length||t.issues.push({code:`invalid_type`,expected:`nonoptional`,input:void 0,path:[n]});return}e.value===void 0?o&&(t.value[n]=void 0):t.value[n]=e.value}function gn(e){let t=Object.keys(e.shape);for(let n of t)if(!e.shape?.[n]?._zod?.traits?.has(`$ZodType`))throw Error(`Invalid element at key "${n}": expected a Zod schema`);let n=z(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function _n(e,t,n,r,i,a){let o=[],s=i.keySet,c=i.catchall._zod,l=c.def.type,u=c.optin===`optional`,d=c.optout===`optional`;for(let i in t){if(i===`__proto__`||s.has(i))continue;if(l===`never`){o.push(i);continue}let a=c.run({value:t[i],issues:[]},r);a instanceof Promise?e.push(a.then(e=>hn(e,n,i,t,u,d))):hn(a,n,i,t,u,d)}return o.length&&n.issues.push({code:`unrecognized_keys`,keys:o,input:t,inst:a}),e.length?Promise.all(e).then(()=>n):n}var vn=p(`$ZodObject`,(e,t)=>{if(At.init(e,t),!Object.getOwnPropertyDescriptor(t,`shape`)?.get){let e=t.shape;Object.defineProperty(t,"shape",{get:()=>{let n={...e};return Object.defineProperty(t,"shape",{value:n}),n}})}let n=b(()=>gn(t));T(e._zod,`propValues`,()=>{let e=t.shape,n={};for(let t in e){let r=e[t]._zod;if(r.values){n[t]??(n[t]=new Set);for(let e of r.values)n[t].add(e)}}return n});let r=j,i=t.catchall,a;e._zod.parse=(t,o)=>{a??=n.value;let s=t.value;if(!r(s))return t.issues.push({expected:`object`,code:`invalid_type`,input:s,inst:e}),t;t.value={};let c=[],l=a.shape;for(let e of a.keys){let n=l[e],r=n._zod.optin===`optional`,i=n._zod.optout===`optional`,a=n._zod.run({value:s[e],issues:[]},o);a instanceof Promise?c.push(a.then(n=>hn(n,t,e,s,r,i))):hn(a,t,e,s,r,i)}return i?_n(c,s,t,o,n.value,e):c.length?Promise.all(c).then(()=>t):t}}),yn=p(`$ZodObjectJIT`,(e,t)=>{vn.init(e,t);let n=e._zod.parse,r=b(()=>gn(t)),i=e=>{let t=new Ot([`shape`,`payload`,`ctx`]),n=r.value,i=e=>{let t=O(e);return`shape[${t}]._zod.run({ value: input[${t}], issues: [] }, ctx)`};t.write(`const input = payload.value;`);let a=Object.create(null),o=0;for(let e of n.keys)a[e]=`key_${o++}`;t.write(`const newResult = {};`);for(let r of n.keys){let n=a[r],o=O(r),s=e[r],c=s?._zod?.optin===`optional`,l=s?._zod?.optout===`optional`;t.write(`const ${n} = ${i(r)};`),c&&l?t.write(`
@@ -81,5 +81,5 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
81
81
  `+i[o].replace(` at new `,` at `);return e.displayName&&c.includes(`<anonymous>`)&&(c=c.replace(`<anonymous>`,e.displayName)),c}while(1<=o&&0<=s);break}}}finally{te=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:``)?ee(e):``}function ne(e){switch(e.tag){case 5:return ee(e.type);case 16:return ee(`Lazy`);case 13:return ee(`Suspense`);case 19:return ee(`SuspenseList`);case 0:case 2:case 15:return e=B(e.type,!1),e;case 11:return e=B(e.type.render,!1),e;case 1:return e=B(e.type,!0),e;default:return``}}function re(e){if(e==null)return null;if(typeof e==`function`)return e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case T:return`Fragment`;case w:return`Portal`;case D:return`Profiler`;case E:return`StrictMode`;case j:return`Suspense`;case M:return`SuspenseList`}if(typeof e==`object`)switch(e.$$typeof){case k:return(e.displayName||`Context`)+`.Consumer`;case O:return(e._context.displayName||`Context`)+`.Provider`;case A:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case N:return t=e.displayName||null,t===null?re(e.type)||`Memo`:t;case P:t=e._payload,e=e._init;try{return re(e(t))}catch{}}return null}function V(e){var t=e.type;switch(e.tag){case 24:return`Cache`;case 9:return(t.displayName||`Context`)+`.Consumer`;case 10:return(t._context.displayName||`Context`)+`.Provider`;case 18:return`DehydratedFragment`;case 11:return e=t.render,e=e.displayName||e.name||``,t.displayName||(e===``?`ForwardRef`:`ForwardRef(`+e+`)`);case 7:return`Fragment`;case 5:return t;case 4:return`Portal`;case 3:return`Root`;case 6:return`Text`;case 16:return re(t);case 8:return t===E?`StrictMode`:`Mode`;case 22:return`Offscreen`;case 12:return`Profiler`;case 21:return`Scope`;case 13:return`Suspense`;case 19:return`SuspenseList`;case 25:return`TracingMarker`;case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t==`function`)return t.displayName||t.name||null;if(typeof t==`string`)return t}return null}function H(e){switch(typeof e){case`boolean`:case`number`:case`string`:case`undefined`:return e;case`object`:return e;default:return``}}function ie(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()===`input`&&(t===`checkbox`||t===`radio`)}function ae(e){var t=ie(e)?`checked`:`value`,n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=``+e[t];if(!e.hasOwnProperty(t)&&n!==void 0&&typeof n.get==`function`&&typeof n.set==`function`){var i=n.get,a=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(e){r=``+e,a.call(this,e)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(e){r=``+e},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function oe(e){e._valueTracker||=ae(e)}function se(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r=``;return e&&(r=ie(e)?e.checked?`true`:`false`:e.value),e=r,e!==n&&(t.setValue(e),!0)}function ce(e){if(e||=typeof document<`u`?document:void 0,e===void 0)return null;try{return e.activeElement||e.body}catch{return e.body}}function le(e,t){var n=t.checked;return R({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function ue(e,t){var n=t.defaultValue==null?``:t.defaultValue,r=t.checked==null?t.defaultChecked:t.checked;n=H(t.value==null?n:t.value),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type===`checkbox`||t.type===`radio`?t.checked!=null:t.value!=null}}function de(e,t){t=t.checked,t!=null&&x(e,`checked`,t,!1)}function fe(e,t){de(e,t);var n=H(t.value),r=t.type;if(n!=null)r===`number`?(n===0&&e.value===``||e.value!=n)&&(e.value=``+n):e.value!==``+n&&(e.value=``+n);else if(r===`submit`||r===`reset`){e.removeAttribute(`value`);return}t.hasOwnProperty(`value`)?me(e,t.type,n):t.hasOwnProperty(`defaultValue`)&&me(e,t.type,H(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function pe(e,t,n){if(t.hasOwnProperty(`value`)||t.hasOwnProperty(`defaultValue`)){var r=t.type;if(!(r!==`submit`&&r!==`reset`||t.value!==void 0&&t.value!==null))return;t=``+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==``&&(e.name=``),e.defaultChecked=!!e._wrapperState.initialChecked,n!==``&&(e.name=n)}function me(e,t,n){(t!==`number`||ce(e.ownerDocument)!==e)&&(n==null?e.defaultValue=``+e._wrapperState.initialValue:e.defaultValue!==``+n&&(e.defaultValue=``+n))}var he=Array.isArray;function ge(e,t,n,r){if(e=e.options,t){t={};for(var i=0;i<n.length;i++)t[`$`+n[i]]=!0;for(n=0;n<e.length;n++)i=t.hasOwnProperty(`$`+e[n].value),e[n].selected!==i&&(e[n].selected=i),i&&r&&(e[n].defaultSelected=!0)}else{for(n=``+H(n),t=null,i=0;i<e.length;i++){if(e[i].value===n){e[i].selected=!0,r&&(e[i].defaultSelected=!0);return}t!==null||e[i].disabled||(t=e[i])}t!==null&&(t.selected=!0)}}function _e(e,t){if(t.dangerouslySetInnerHTML!=null)throw Error(r(91));return R({},t,{value:void 0,defaultValue:void 0,children:``+e._wrapperState.initialValue})}function ve(e,t){var n=t.value;if(n==null){if(n=t.children,t=t.defaultValue,n!=null){if(t!=null)throw Error(r(92));if(he(n)){if(1<n.length)throw Error(r(93));n=n[0]}t=n}t??=``,n=t}e._wrapperState={initialValue:H(n)}}function ye(e,t){var n=H(t.value),r=H(t.defaultValue);n!=null&&(n=``+n,n!==e.value&&(e.value=n),t.defaultValue==null&&e.defaultValue!==n&&(e.defaultValue=n)),r!=null&&(e.defaultValue=``+r)}function be(e){var t=e.textContent;t===e._wrapperState.initialValue&&t!==``&&t!==null&&(e.value=t)}function xe(e){switch(e){case`svg`:return`http://www.w3.org/2000/svg`;case`math`:return`http://www.w3.org/1998/Math/MathML`;default:return`http://www.w3.org/1999/xhtml`}}function Se(e,t){return e==null||e===`http://www.w3.org/1999/xhtml`?xe(t):e===`http://www.w3.org/2000/svg`&&t===`foreignObject`?`http://www.w3.org/1999/xhtml`:e}var Ce,we=function(e){return typeof MSApp<`u`&&MSApp.execUnsafeLocalFunction?function(t,n,r,i){MSApp.execUnsafeLocalFunction(function(){return e(t,n,r,i)})}:e}(function(e,t){if(e.namespaceURI!==`http://www.w3.org/2000/svg`||`innerHTML`in e)e.innerHTML=t;else{for(Ce||=document.createElement(`div`),Ce.innerHTML=`<svg>`+t.valueOf().toString()+`</svg>`,t=Ce.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Te(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Ee={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},De=[`Webkit`,`ms`,`Moz`,`O`];Object.keys(Ee).forEach(function(e){De.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Ee[t]=Ee[e]})});function Oe(e,t,n){return t==null||typeof t==`boolean`||t===``?``:n||typeof t!=`number`||t===0||Ee.hasOwnProperty(e)&&Ee[e]?(``+t).trim():t+`px`}function ke(e,t){for(var n in e=e.style,t)if(t.hasOwnProperty(n)){var r=n.indexOf(`--`)===0,i=Oe(n,t[n],r);n===`float`&&(n=`cssFloat`),r?e.setProperty(n,i):e[n]=i}}var Ae=R({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function je(e,t){if(t){if(Ae[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(r(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(r(60));if(typeof t.dangerouslySetInnerHTML!=`object`||!(`__html`in t.dangerouslySetInnerHTML))throw Error(r(61))}if(t.style!=null&&typeof t.style!=`object`)throw Error(r(62))}}function Me(e,t){if(e.indexOf(`-`)===-1)return typeof t.is==`string`;switch(e){case`annotation-xml`:case`color-profile`:case`font-face`:case`font-face-src`:case`font-face-uri`:case`font-face-format`:case`font-face-name`:case`missing-glyph`:return!1;default:return!0}}var Ne=null;function Pe(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Fe=null,Ie=null,Le=null;function Re(e){if(e=zi(e)){if(typeof Fe!=`function`)throw Error(r(280));var t=e.stateNode;t&&(t=Vi(t),Fe(e.stateNode,e.type,t))}}function ze(e){Ie?Le?Le.push(e):Le=[e]:Ie=e}function Be(){if(Ie){var e=Ie,t=Le;if(Le=Ie=null,Re(e),t)for(e=0;e<t.length;e++)Re(t[e])}}function Ve(e,t){return e(t)}function He(){}var Ue=!1;function We(e,t,n){if(Ue)return e(t,n);Ue=!0;try{return Ve(e,t,n)}finally{Ue=!1,(Ie!==null||Le!==null)&&(He(),Be())}}function Ge(e,t){var n=e.stateNode;if(n===null)return null;var i=Vi(n);if(i===null)return null;n=i[t];a:switch(t){case`onClick`:case`onClickCapture`:case`onDoubleClick`:case`onDoubleClickCapture`:case`onMouseDown`:case`onMouseDownCapture`:case`onMouseMove`:case`onMouseMoveCapture`:case`onMouseUp`:case`onMouseUpCapture`:case`onMouseEnter`:(i=!i.disabled)||(e=e.type,i=e!==`button`&&e!==`input`&&e!==`select`&&e!==`textarea`),e=!i;break a;default:e=!1}if(e)return null;if(n&&typeof n!=`function`)throw Error(r(231,t,typeof n));return n}var Ke=!1;if(c)try{var qe={};Object.defineProperty(qe,"passive",{get:function(){Ke=!0}}),window.addEventListener(`test`,qe,qe),window.removeEventListener(`test`,qe,qe)}catch{Ke=!1}function Je(e,t,n,r,i,a,o,s,c){var l=Array.prototype.slice.call(arguments,3);try{t.apply(n,l)}catch(e){this.onError(e)}}var Ye=!1,Xe=null,Ze=!1,Qe=null,$e={onError:function(e){Ye=!0,Xe=e}};function et(e,t,n,r,i,a,o,s,c){Ye=!1,Xe=null,Je.apply($e,arguments)}function tt(e,t,n,i,a,o,s,c,l){if(et.apply(this,arguments),Ye){if(Ye){var u=Xe;Ye=!1,Xe=null}else throw Error(r(198));Ze||(Ze=!0,Qe=u)}}function nt(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function rt(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function it(e){if(nt(e)!==e)throw Error(r(188))}function at(e){var t=e.alternate;if(!t){if(t=nt(e),t===null)throw Error(r(188));return t===e?e:null}for(var n=e,i=t;;){var a=n.return;if(a===null)break;var o=a.alternate;if(o===null){if(i=a.return,i!==null){n=i;continue}break}if(a.child===o.child){for(o=a.child;o;){if(o===n)return it(a),e;if(o===i)return it(a),t;o=o.sibling}throw Error(r(188))}if(n.return!==i.return)n=a,i=o;else{for(var s=!1,c=a.child;c;){if(c===n){s=!0,n=a,i=o;break}if(c===i){s=!0,i=a,n=o;break}c=c.sibling}if(!s){for(c=o.child;c;){if(c===n){s=!0,n=o,i=a;break}if(c===i){s=!0,i=o,n=a;break}c=c.sibling}if(!s)throw Error(r(189))}}if(n.alternate!==i)throw Error(r(190))}if(n.tag!==3)throw Error(r(188));return n.stateNode.current===n?e:t}function ot(e){return e=at(e),e===null?null:st(e)}function st(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var t=st(e);if(t!==null)return t;e=e.sibling}return null}var ct=n.unstable_scheduleCallback,lt=n.unstable_cancelCallback,ut=n.unstable_shouldYield,dt=n.unstable_requestPaint,ft=n.unstable_now,pt=n.unstable_getCurrentPriorityLevel,mt=n.unstable_ImmediatePriority,ht=n.unstable_UserBlockingPriority,gt=n.unstable_NormalPriority,_t=n.unstable_LowPriority,vt=n.unstable_IdlePriority,yt=null,bt=null;function xt(e){if(bt&&typeof bt.onCommitFiberRoot==`function`)try{bt.onCommitFiberRoot(yt,e,void 0,(e.current.flags&128)==128)}catch{}}var St=Math.clz32?Math.clz32:Tt,Ct=Math.log,wt=Math.LN2;function Tt(e){return e>>>=0,e===0?32:31-(Ct(e)/wt|0)|0}var Et=64,Dt=4194304;function Ot(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function kt(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,i=e.suspendedLanes,a=e.pingedLanes,o=n&268435455;if(o!==0){var s=o&~i;s===0?(a&=o,a!==0&&(r=Ot(a))):r=Ot(s)}else o=n&~i,o===0?a!==0&&(r=Ot(a)):r=Ot(o);if(r===0)return 0;if(t!==0&&t!==r&&(t&i)===0&&(i=r&-r,a=t&-t,i>=a||i===16&&a&4194240))return t;if(r&4&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0<t;)n=31-St(t),i=1<<n,r|=e[n],t&=~i;return r}function At(e,t){switch(e){case 1:case 2:case 4:return t+250;case 8:case 16:case 32:case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function jt(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,i=e.expirationTimes,a=e.pendingLanes;0<a;){var o=31-St(a),s=1<<o,c=i[o];c===-1?((s&n)===0||(s&r)!==0)&&(i[o]=At(s,t)):c<=t&&(e.expiredLanes|=s),a&=~s}}function Mt(e){return e=e.pendingLanes&-1073741825,e===0?e&1073741824?1073741824:0:e}function Nt(){var e=Et;return Et<<=1,!(Et&4194240)&&(Et=64),e}function Pt(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function Ft(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-St(t),e[t]=n}function It(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0<n;){var i=31-St(n),a=1<<i;t[i]=0,r[i]=-1,e[i]=-1,n&=~a}}function Lt(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-St(n),i=1<<r;i&t|e[r]&t&&(e[r]|=t),n&=~i}}var Rt=0;function zt(e){return e&=-e,1<e?4<e?e&268435455?16:536870912:4:1}var Bt,Vt,Ht,Ut,Wt,Gt=!1,Kt=[],qt=null,Jt=null,Yt=null,Xt=new Map,Zt=new Map,Qt=[],$t=`mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset submit`.split(` `);function en(e,t){switch(e){case`focusin`:case`focusout`:qt=null;break;case`dragenter`:case`dragleave`:Jt=null;break;case`mouseover`:case`mouseout`:Yt=null;break;case`pointerover`:case`pointerout`:Xt.delete(t.pointerId);break;case`gotpointercapture`:case`lostpointercapture`:Zt.delete(t.pointerId)}}function tn(e,t,n,r,i,a){return e===null||e.nativeEvent!==a?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:a,targetContainers:[i]},t!==null&&(t=zi(t),t!==null&&Vt(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,i!==null&&t.indexOf(i)===-1&&t.push(i),e)}function nn(e,t,n,r,i){switch(t){case`focusin`:return qt=tn(qt,e,t,n,r,i),!0;case`dragenter`:return Jt=tn(Jt,e,t,n,r,i),!0;case`mouseover`:return Yt=tn(Yt,e,t,n,r,i),!0;case`pointerover`:var a=i.pointerId;return Xt.set(a,tn(Xt.get(a)||null,e,t,n,r,i)),!0;case`gotpointercapture`:return a=i.pointerId,Zt.set(a,tn(Zt.get(a)||null,e,t,n,r,i)),!0}return!1}function rn(e){var t=Ri(e.target);if(t!==null){var n=nt(t);if(n!==null){if(t=n.tag,t===13){if(t=rt(n),t!==null){e.blockedOn=t,Wt(e.priority,function(){Ht(n)});return}}else if(t===3&&n.stateNode.current.memoizedState.isDehydrated){e.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}e.blockedOn=null}function an(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=gn(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);Ne=r,n.target.dispatchEvent(r),Ne=null}else return t=zi(n),t!==null&&Vt(t),e.blockedOn=n,!1;t.shift()}return!0}function on(e,t,n){an(e)&&n.delete(t)}function sn(){Gt=!1,qt!==null&&an(qt)&&(qt=null),Jt!==null&&an(Jt)&&(Jt=null),Yt!==null&&an(Yt)&&(Yt=null),Xt.forEach(on),Zt.forEach(on)}function cn(e,t){e.blockedOn===t&&(e.blockedOn=null,Gt||(Gt=!0,n.unstable_scheduleCallback(n.unstable_NormalPriority,sn)))}function ln(e){function t(t){return cn(t,e)}if(0<Kt.length){cn(Kt[0],e);for(var n=1;n<Kt.length;n++){var r=Kt[n];r.blockedOn===e&&(r.blockedOn=null)}}for(qt!==null&&cn(qt,e),Jt!==null&&cn(Jt,e),Yt!==null&&cn(Yt,e),Xt.forEach(t),Zt.forEach(t),n=0;n<Qt.length;n++)r=Qt[n],r.blockedOn===e&&(r.blockedOn=null);for(;0<Qt.length&&(n=Qt[0],n.blockedOn===null);)rn(n),n.blockedOn===null&&Qt.shift()}var un=S.ReactCurrentBatchConfig,dn=!0;function fn(e,t,n,r){var i=Rt,a=un.transition;un.transition=null;try{Rt=1,mn(e,t,n,r)}finally{Rt=i,un.transition=a}}function pn(e,t,n,r){var i=Rt,a=un.transition;un.transition=null;try{Rt=4,mn(e,t,n,r)}finally{Rt=i,un.transition=a}}function mn(e,t,n,r){if(dn){var i=gn(e,t,n,r);if(i===null)ui(e,t,r,hn,n),en(e,r);else if(nn(i,e,t,n,r))r.stopPropagation();else if(en(e,r),t&4&&-1<$t.indexOf(e)){for(;i!==null;){var a=zi(i);if(a!==null&&Bt(a),a=gn(e,t,n,r),a===null&&ui(e,t,r,hn,n),a===i)break;i=a}i!==null&&r.stopPropagation()}else ui(e,t,r,null,n)}}var hn=null;function gn(e,t,n,r){if(hn=null,e=Pe(r),e=Ri(e),e!==null){if(t=nt(e),t===null)e=null;else if(n=t.tag,n===13){if(e=rt(t),e!==null)return e;e=null}else if(n===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}return hn=e,null}function _n(e){switch(e){case`cancel`:case`click`:case`close`:case`contextmenu`:case`copy`:case`cut`:case`auxclick`:case`dblclick`:case`dragend`:case`dragstart`:case`drop`:case`focusin`:case`focusout`:case`input`:case`invalid`:case`keydown`:case`keypress`:case`keyup`:case`mousedown`:case`mouseup`:case`paste`:case`pause`:case`play`:case`pointercancel`:case`pointerdown`:case`pointerup`:case`ratechange`:case`reset`:case`resize`:case`seeked`:case`submit`:case`touchcancel`:case`touchend`:case`touchstart`:case`volumechange`:case`change`:case`selectionchange`:case`textInput`:case`compositionstart`:case`compositionend`:case`compositionupdate`:case`beforeblur`:case`afterblur`:case`beforeinput`:case`blur`:case`fullscreenchange`:case`focus`:case`hashchange`:case`popstate`:case`select`:case`selectstart`:return 1;case`drag`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`mousemove`:case`mouseout`:case`mouseover`:case`pointermove`:case`pointerout`:case`pointerover`:case`scroll`:case`toggle`:case`touchmove`:case`wheel`:case`mouseenter`:case`mouseleave`:case`pointerenter`:case`pointerleave`:return 4;case`message`:switch(pt()){case mt:return 1;case ht:return 4;case gt:case _t:return 16;case vt:return 536870912;default:return 16}default:return 16}}var vn=null,yn=null,bn=null;function xn(){if(bn)return bn;var e,t=yn,n=t.length,r,i=`value`in vn?vn.value:vn.textContent,a=i.length;for(e=0;e<n&&t[e]===i[e];e++);var o=n-e;for(r=1;r<=o&&t[n-r]===i[a-r];r++);return bn=i.slice(e,1<r?1-r:void 0)}function Sn(e){var t=e.keyCode;return`charCode`in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function Cn(){return!0}function wn(){return!1}function Tn(e){function t(t,n,r,i,a){for(var o in this._reactName=t,this._targetInst=r,this.type=n,this.nativeEvent=i,this.target=a,this.currentTarget=null,e)e.hasOwnProperty(o)&&(t=e[o],this[o]=t?t(i):i[o]);return this.isDefaultPrevented=(i.defaultPrevented==null?!1===i.returnValue:i.defaultPrevented)?Cn:wn,this.isPropagationStopped=wn,this}return R(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var e=this.nativeEvent;e&&(e.preventDefault?e.preventDefault():typeof e.returnValue!=`unknown`&&(e.returnValue=!1),this.isDefaultPrevented=Cn)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():typeof e.cancelBubble!=`unknown`&&(e.cancelBubble=!0),this.isPropagationStopped=Cn)},persist:function(){},isPersistent:Cn}),t}var En={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Dn=Tn(En),On=R({},En,{view:0,detail:0}),kn=Tn(On),An,jn,Mn,Nn=R({},On,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Wn,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return`movementX`in e?e.movementX:(e!==Mn&&(Mn&&e.type===`mousemove`?(An=e.screenX-Mn.screenX,jn=e.screenY-Mn.screenY):jn=An=0,Mn=e),An)},movementY:function(e){return`movementY`in e?e.movementY:jn}}),Pn=Tn(Nn),Fn=Tn(R({},Nn,{dataTransfer:0})),In=Tn(R({},On,{relatedTarget:0})),Ln=Tn(R({},En,{animationName:0,elapsedTime:0,pseudoElement:0})),Rn=Tn(R({},En,{clipboardData:function(e){return`clipboardData`in e?e.clipboardData:window.clipboardData}})),zn=Tn(R({},En,{data:0})),Bn={Esc:`Escape`,Spacebar:` `,Left:`ArrowLeft`,Up:`ArrowUp`,Right:`ArrowRight`,Down:`ArrowDown`,Del:`Delete`,Win:`OS`,Menu:`ContextMenu`,Apps:`ContextMenu`,Scroll:`ScrollLock`,MozPrintableKey:`Unidentified`},Vn={8:`Backspace`,9:`Tab`,12:`Clear`,13:`Enter`,16:`Shift`,17:`Control`,18:`Alt`,19:`Pause`,20:`CapsLock`,27:`Escape`,32:` `,33:`PageUp`,34:`PageDown`,35:`End`,36:`Home`,37:`ArrowLeft`,38:`ArrowUp`,39:`ArrowRight`,40:`ArrowDown`,45:`Insert`,46:`Delete`,112:`F1`,113:`F2`,114:`F3`,115:`F4`,116:`F5`,117:`F6`,118:`F7`,119:`F8`,120:`F9`,121:`F10`,122:`F11`,123:`F12`,144:`NumLock`,145:`ScrollLock`,224:`Meta`},Hn={Alt:`altKey`,Control:`ctrlKey`,Meta:`metaKey`,Shift:`shiftKey`};function Un(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=Hn[e])?!!t[e]:!1}function Wn(){return Un}var Gn=Tn(R({},On,{key:function(e){if(e.key){var t=Bn[e.key]||e.key;if(t!==`Unidentified`)return t}return e.type===`keypress`?(e=Sn(e),e===13?`Enter`:String.fromCharCode(e)):e.type===`keydown`||e.type===`keyup`?Vn[e.keyCode]||`Unidentified`:``},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Wn,charCode:function(e){return e.type===`keypress`?Sn(e):0},keyCode:function(e){return e.type===`keydown`||e.type===`keyup`?e.keyCode:0},which:function(e){return e.type===`keypress`?Sn(e):e.type===`keydown`||e.type===`keyup`?e.keyCode:0}})),Kn=Tn(R({},Nn,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0})),qn=Tn(R({},On,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Wn})),Jn=Tn(R({},En,{propertyName:0,elapsedTime:0,pseudoElement:0})),Yn=Tn(R({},Nn,{deltaX:function(e){return`deltaX`in e?e.deltaX:`wheelDeltaX`in e?-e.wheelDeltaX:0},deltaY:function(e){return`deltaY`in e?e.deltaY:`wheelDeltaY`in e?-e.wheelDeltaY:`wheelDelta`in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0})),Xn=[9,13,27,32],Zn=c&&`CompositionEvent`in window,Qn=null;c&&`documentMode`in document&&(Qn=document.documentMode);var $n=c&&`TextEvent`in window&&!Qn,er=c&&(!Zn||Qn&&8<Qn&&11>=Qn),tr=` `,nr=!1;function rr(e,t){switch(e){case`keyup`:return Xn.indexOf(t.keyCode)!==-1;case`keydown`:return t.keyCode!==229;case`keypress`:case`mousedown`:case`focusout`:return!0;default:return!1}}function ir(e){return e=e.detail,typeof e==`object`&&`data`in e?e.data:null}var ar=!1;function or(e,t){switch(e){case`compositionend`:return ir(t);case`keypress`:return t.which===32?(nr=!0,tr):null;case`textInput`:return e=t.data,e===tr&&nr?null:e;default:return null}}function sr(e,t){if(ar)return e===`compositionend`||!Zn&&rr(e,t)?(e=xn(),bn=yn=vn=null,ar=!1,e):null;switch(e){case`paste`:return null;case`keypress`:if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case`compositionend`:return er&&t.locale!==`ko`?null:t.data;default:return null}}var cr={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function lr(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t===`input`?!!cr[e.type]:t===`textarea`}function ur(e,t,n,r){ze(r),t=fi(t,`onChange`),0<t.length&&(n=new Dn(`onChange`,`change`,null,n,r),e.push({event:n,listeners:t}))}var dr=null,fr=null;function pr(e){ii(e,0)}function mr(e){if(se(Bi(e)))return e}function hr(e,t){if(e===`change`)return t}var gr=!1;if(c){var _r;if(c){var vr=`oninput`in document;if(!vr){var yr=document.createElement(`div`);yr.setAttribute(`oninput`,`return;`),vr=typeof yr.oninput==`function`}_r=vr}else _r=!1;gr=_r&&(!document.documentMode||9<document.documentMode)}function br(){dr&&(dr.detachEvent(`onpropertychange`,xr),fr=dr=null)}function xr(e){if(e.propertyName===`value`&&mr(fr)){var t=[];ur(t,fr,e,Pe(e)),We(pr,t)}}function Sr(e,t,n){e===`focusin`?(br(),dr=t,fr=n,dr.attachEvent(`onpropertychange`,xr)):e===`focusout`&&br()}function Cr(e){if(e===`selectionchange`||e===`keyup`||e===`keydown`)return mr(fr)}function wr(e,t){if(e===`click`)return mr(t)}function Tr(e,t){if(e===`input`||e===`change`)return mr(t)}function Er(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var Dr=typeof Object.is==`function`?Object.is:Er;function Or(e,t){if(Dr(e,t))return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!t)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++){var i=n[r];if(!l.call(t,i)||!Dr(e[i],t[i]))return!1}return!0}function kr(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Ar(e,t){var n=kr(e);e=0;for(var r;n;){if(n.nodeType===3){if(r=e+n.textContent.length,e<=t&&r>=t)return{node:n,offset:t-e};e=r}a:{for(;n;){if(n.nextSibling){n=n.nextSibling;break a}n=n.parentNode}n=void 0}n=kr(n)}}function jr(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?jr(e,t.parentNode):`contains`in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Mr(){for(var e=window,t=ce();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href==`string`}catch{n=!1}if(n)e=t.contentWindow;else break;t=ce(e.document)}return t}function Nr(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t===`input`&&(e.type===`text`||e.type===`search`||e.type===`tel`||e.type===`url`||e.type===`password`)||t===`textarea`||e.contentEditable===`true`)}function Pr(e){var t=Mr(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&jr(n.ownerDocument.documentElement,n)){if(r!==null&&Nr(n)){if(t=r.start,e=r.end,e===void 0&&(e=t),`selectionStart`in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var i=n.textContent.length,a=Math.min(r.start,i);r=r.end===void 0?a:Math.min(r.end,i),!e.extend&&a>r&&(i=r,r=a,a=i),i=Ar(n,a);var o=Ar(n,r);i&&o&&(e.rangeCount!==1||e.anchorNode!==i.node||e.anchorOffset!==i.offset||e.focusNode!==o.node||e.focusOffset!==o.offset)&&(t=t.createRange(),t.setStart(i.node,i.offset),e.removeAllRanges(),a>r?(e.addRange(t),e.extend(o.node,o.offset)):(t.setEnd(o.node,o.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus==`function`&&n.focus(),n=0;n<t.length;n++)e=t[n],e.element.scrollLeft=e.left,e.element.scrollTop=e.top}}var Fr=c&&`documentMode`in document&&11>=document.documentMode,Ir=null,Lr=null,Rr=null,zr=!1;function Br(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;zr||Ir==null||Ir!==ce(r)||(r=Ir,`selectionStart`in r&&Nr(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),Rr&&Or(Rr,r)||(Rr=r,r=fi(Lr,`onSelect`),0<r.length&&(t=new Dn(`onSelect`,`select`,null,t,n),e.push({event:t,listeners:r}),t.target=Ir)))}function Vr(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n[`Webkit`+e]=`webkit`+t,n[`Moz`+e]=`moz`+t,n}var Hr={animationend:Vr(`Animation`,`AnimationEnd`),animationiteration:Vr(`Animation`,`AnimationIteration`),animationstart:Vr(`Animation`,`AnimationStart`),transitionend:Vr(`Transition`,`TransitionEnd`)},Ur={},Wr={};c&&(Wr=document.createElement(`div`).style,`AnimationEvent`in window||(delete Hr.animationend.animation,delete Hr.animationiteration.animation,delete Hr.animationstart.animation),`TransitionEvent`in window||delete Hr.transitionend.transition);function Gr(e){if(Ur[e])return Ur[e];if(!Hr[e])return e;var t=Hr[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in Wr)return Ur[e]=t[n];return e}var Kr=Gr(`animationend`),qr=Gr(`animationiteration`),Jr=Gr(`animationstart`),Yr=Gr(`transitionend`),Xr=new Map,Zr=`abort auxClick cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel`.split(` `);function Qr(e,t){Xr.set(e,t),o(t,[e])}for(var $r=0;$r<Zr.length;$r++){var ei=Zr[$r];Qr(ei.toLowerCase(),`on`+(ei[0].toUpperCase()+ei.slice(1)))}Qr(Kr,`onAnimationEnd`),Qr(qr,`onAnimationIteration`),Qr(Jr,`onAnimationStart`),Qr(`dblclick`,`onDoubleClick`),Qr(`focusin`,`onFocus`),Qr(`focusout`,`onBlur`),Qr(Yr,`onTransitionEnd`),s(`onMouseEnter`,[`mouseout`,`mouseover`]),s(`onMouseLeave`,[`mouseout`,`mouseover`]),s(`onPointerEnter`,[`pointerout`,`pointerover`]),s(`onPointerLeave`,[`pointerout`,`pointerover`]),o(`onChange`,`change click focusin focusout input keydown keyup selectionchange`.split(` `)),o(`onSelect`,`focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange`.split(` `)),o(`onBeforeInput`,[`compositionend`,`keypress`,`textInput`,`paste`]),o(`onCompositionEnd`,`compositionend focusout keydown keypress keyup mousedown`.split(` `)),o(`onCompositionStart`,`compositionstart focusout keydown keypress keyup mousedown`.split(` `)),o(`onCompositionUpdate`,`compositionupdate focusout keydown keypress keyup mousedown`.split(` `));var ti=`abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting`.split(` `),ni=new Set(`cancel close invalid load scroll toggle`.split(` `).concat(ti));function ri(e,t,n){var r=e.type||`unknown-event`;e.currentTarget=n,tt(r,t,void 0,e),e.currentTarget=null}function ii(e,t){t=!!(t&4);for(var n=0;n<e.length;n++){var r=e[n],i=r.event;r=r.listeners;a:{var a=void 0;if(t)for(var o=r.length-1;0<=o;o--){var s=r[o],c=s.instance,l=s.currentTarget;if(s=s.listener,c!==a&&i.isPropagationStopped())break a;ri(i,s,l),a=c}else for(o=0;o<r.length;o++){if(s=r[o],c=s.instance,l=s.currentTarget,s=s.listener,c!==a&&i.isPropagationStopped())break a;ri(i,s,l),a=c}}}if(Ze)throw e=Qe,Ze=!1,Qe=null,e}function ai(e,t){var n=t[Fi];n===void 0&&(n=t[Fi]=new Set);var r=e+`__bubble`;n.has(r)||(li(t,e,2,!1),n.add(r))}function oi(e,t,n){var r=0;t&&(r|=4),li(n,e,r,t)}var si=`_reactListening`+Math.random().toString(36).slice(2);function ci(e){if(!e[si]){e[si]=!0,i.forEach(function(t){t!==`selectionchange`&&(ni.has(t)||oi(t,!1,e),oi(t,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[si]||(t[si]=!0,oi(`selectionchange`,!1,t))}}function li(e,t,n,r){switch(_n(t)){case 1:var i=fn;break;case 4:i=pn;break;default:i=mn}n=i.bind(null,t,n,e),i=void 0,!Ke||t!==`touchstart`&&t!==`touchmove`&&t!==`wheel`||(i=!0),r?i===void 0?e.addEventListener(t,n,!0):e.addEventListener(t,n,{capture:!0,passive:i}):i===void 0?e.addEventListener(t,n,!1):e.addEventListener(t,n,{passive:i})}function ui(e,t,n,r,i){var a=r;if(!(t&1)&&!(t&2)&&r!==null)a:for(;;){if(r===null)return;var o=r.tag;if(o===3||o===4){var s=r.stateNode.containerInfo;if(s===i||s.nodeType===8&&s.parentNode===i)break;if(o===4)for(o=r.return;o!==null;){var c=o.tag;if((c===3||c===4)&&(c=o.stateNode.containerInfo,c===i||c.nodeType===8&&c.parentNode===i))return;o=o.return}for(;s!==null;){if(o=Ri(s),o===null)return;if(c=o.tag,c===5||c===6){r=a=o;continue a}s=s.parentNode}}r=r.return}We(function(){var r=a,i=Pe(n),o=[];a:{var s=Xr.get(e);if(s!==void 0){var c=Dn,l=e;switch(e){case`keypress`:if(Sn(n)===0)break a;case`keydown`:case`keyup`:c=Gn;break;case`focusin`:l=`focus`,c=In;break;case`focusout`:l=`blur`,c=In;break;case`beforeblur`:case`afterblur`:c=In;break;case`click`:if(n.button===2)break a;case`auxclick`:case`dblclick`:case`mousedown`:case`mousemove`:case`mouseup`:case`mouseout`:case`mouseover`:case`contextmenu`:c=Pn;break;case`drag`:case`dragend`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`dragstart`:case`drop`:c=Fn;break;case`touchcancel`:case`touchend`:case`touchmove`:case`touchstart`:c=qn;break;case Kr:case qr:case Jr:c=Ln;break;case Yr:c=Jn;break;case`scroll`:c=kn;break;case`wheel`:c=Yn;break;case`copy`:case`cut`:case`paste`:c=Rn;break;case`gotpointercapture`:case`lostpointercapture`:case`pointercancel`:case`pointerdown`:case`pointermove`:case`pointerout`:case`pointerover`:case`pointerup`:c=Kn}var u=!!(t&4),d=!u&&e===`scroll`,f=u?s===null?null:s+`Capture`:s;u=[];for(var p=r,m;p!==null;){m=p;var h=m.stateNode;if(m.tag===5&&h!==null&&(m=h,f!==null&&(h=Ge(p,f),h!=null&&u.push(di(p,h,m)))),d)break;p=p.return}0<u.length&&(s=new c(s,l,null,n,i),o.push({event:s,listeners:u}))}}if(!(t&7)){a:{if(s=e===`mouseover`||e===`pointerover`,c=e===`mouseout`||e===`pointerout`,s&&n!==Ne&&(l=n.relatedTarget||n.fromElement)&&(Ri(l)||l[Pi]))break a;if((c||s)&&(s=i.window===i?i:(s=i.ownerDocument)?s.defaultView||s.parentWindow:window,c?(l=n.relatedTarget||n.toElement,c=r,l=l?Ri(l):null,l!==null&&(d=nt(l),l!==d||l.tag!==5&&l.tag!==6)&&(l=null)):(c=null,l=r),c!==l)){if(u=Pn,h=`onMouseLeave`,f=`onMouseEnter`,p=`mouse`,(e===`pointerout`||e===`pointerover`)&&(u=Kn,h=`onPointerLeave`,f=`onPointerEnter`,p=`pointer`),d=c==null?s:Bi(c),m=l==null?s:Bi(l),s=new u(h,p+`leave`,c,n,i),s.target=d,s.relatedTarget=m,h=null,Ri(i)===r&&(u=new u(f,p+`enter`,l,n,i),u.target=m,u.relatedTarget=d,h=u),d=h,c&&l)b:{for(u=c,f=l,p=0,m=u;m;m=pi(m))p++;for(m=0,h=f;h;h=pi(h))m++;for(;0<p-m;)u=pi(u),p--;for(;0<m-p;)f=pi(f),m--;for(;p--;){if(u===f||f!==null&&u===f.alternate)break b;u=pi(u),f=pi(f)}u=null}else u=null;c!==null&&mi(o,s,c,u,!1),l!==null&&d!==null&&mi(o,d,l,u,!0)}}a:{if(s=r?Bi(r):window,c=s.nodeName&&s.nodeName.toLowerCase(),c===`select`||c===`input`&&s.type===`file`)var g=hr;else if(lr(s)){if(gr)g=Tr;else{g=Cr;var _=Sr}}else(c=s.nodeName)&&c.toLowerCase()===`input`&&(s.type===`checkbox`||s.type===`radio`)&&(g=wr);if(g&&=g(e,r)){ur(o,g,n,i);break a}_&&_(e,s,r),e===`focusout`&&(_=s._wrapperState)&&_.controlled&&s.type===`number`&&me(s,`number`,s.value)}switch(_=r?Bi(r):window,e){case`focusin`:(lr(_)||_.contentEditable===`true`)&&(Ir=_,Lr=r,Rr=null);break;case`focusout`:Rr=Lr=Ir=null;break;case`mousedown`:zr=!0;break;case`contextmenu`:case`mouseup`:case`dragend`:zr=!1,Br(o,n,i);break;case`selectionchange`:if(Fr)break;case`keydown`:case`keyup`:Br(o,n,i)}var v;if(Zn)b:{switch(e){case`compositionstart`:var y=`onCompositionStart`;break b;case`compositionend`:y=`onCompositionEnd`;break b;case`compositionupdate`:y=`onCompositionUpdate`;break b}y=void 0}else ar?rr(e,n)&&(y=`onCompositionEnd`):e===`keydown`&&n.keyCode===229&&(y=`onCompositionStart`);y&&(er&&n.locale!==`ko`&&(ar||y!==`onCompositionStart`?y===`onCompositionEnd`&&ar&&(v=xn()):(vn=i,yn=`value`in vn?vn.value:vn.textContent,ar=!0)),_=fi(r,y),0<_.length&&(y=new zn(y,e,null,n,i),o.push({event:y,listeners:_}),v?y.data=v:(v=ir(n),v!==null&&(y.data=v)))),(v=$n?or(e,n):sr(e,n))&&(r=fi(r,`onBeforeInput`),0<r.length&&(i=new zn(`onBeforeInput`,`beforeinput`,null,n,i),o.push({event:i,listeners:r}),i.data=v))}ii(o,t)})}function di(e,t,n){return{instance:e,listener:t,currentTarget:n}}function fi(e,t){for(var n=t+`Capture`,r=[];e!==null;){var i=e,a=i.stateNode;i.tag===5&&a!==null&&(i=a,a=Ge(e,n),a!=null&&r.unshift(di(e,a,i)),a=Ge(e,t),a!=null&&r.push(di(e,a,i))),e=e.return}return r}function pi(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5);return e||null}function mi(e,t,n,r,i){for(var a=t._reactName,o=[];n!==null&&n!==r;){var s=n,c=s.alternate,l=s.stateNode;if(c!==null&&c===r)break;s.tag===5&&l!==null&&(s=l,i?(c=Ge(n,a),c!=null&&o.unshift(di(n,c,s))):i||(c=Ge(n,a),c!=null&&o.push(di(n,c,s)))),n=n.return}o.length!==0&&e.push({event:t,listeners:o})}var hi=/\r\n?/g,gi=/\u0000|\uFFFD/g;function _i(e){return(typeof e==`string`?e:``+e).replace(hi,`
82
82
  `).replace(gi,``)}function vi(e,t,n){if(t=_i(t),_i(e)!==t&&n)throw Error(r(425))}function yi(){}var bi=null,xi=null;function Si(e,t){return e===`textarea`||e===`noscript`||typeof t.children==`string`||typeof t.children==`number`||typeof t.dangerouslySetInnerHTML==`object`&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var Ci=typeof setTimeout==`function`?setTimeout:void 0,wi=typeof clearTimeout==`function`?clearTimeout:void 0,Ti=typeof Promise==`function`?Promise:void 0,Ei=typeof queueMicrotask==`function`?queueMicrotask:Ti===void 0?Ci:function(e){return Ti.resolve(null).then(e).catch(Di)};function Di(e){setTimeout(function(){throw e})}function Oi(e,t){var n=t,r=0;do{var i=n.nextSibling;if(e.removeChild(n),i&&i.nodeType===8){if(n=i.data,n===`/$`){if(r===0){e.removeChild(i),ln(t);return}r--}else n!==`$`&&n!==`$?`&&n!==`$!`||r++}n=i}while(n);ln(t)}function ki(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t===`$`||t===`$!`||t===`$?`)break;if(t===`/$`)return null}}return e}function Ai(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`$`||n===`$!`||n===`$?`){if(t===0)return e;t--}else n===`/$`&&t++}e=e.previousSibling}return null}var ji=Math.random().toString(36).slice(2),Mi=`__reactFiber$`+ji,Ni=`__reactProps$`+ji,Pi=`__reactContainer$`+ji,Fi=`__reactEvents$`+ji,Ii=`__reactListeners$`+ji,Li=`__reactHandles$`+ji;function Ri(e){var t=e[Mi];if(t)return t;for(var n=e.parentNode;n;){if(t=n[Pi]||n[Mi]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=Ai(e);e!==null;){if(n=e[Mi])return n;e=Ai(e)}return t}e=n,n=e.parentNode}return null}function zi(e){return e=e[Mi]||e[Pi],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function Bi(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(r(33))}function Vi(e){return e[Ni]||null}var Hi=[],Ui=-1;function Wi(e){return{current:e}}function Gi(e){0>Ui||(e.current=Hi[Ui],Hi[Ui]=null,Ui--)}function Ki(e,t){Ui++,Hi[Ui]=e.current,e.current=t}var qi={},Ji=Wi(qi),Yi=Wi(!1),Xi=qi;function Zi(e,t){var n=e.type.contextTypes;if(!n)return qi;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var i={},a;for(a in n)i[a]=t[a];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=i),i}function Qi(e){return e=e.childContextTypes,e!=null}function $i(){Gi(Yi),Gi(Ji)}function ea(e,t,n){if(Ji.current!==qi)throw Error(r(168));Ki(Ji,t),Ki(Yi,n)}function ta(e,t,n){var i=e.stateNode;if(t=t.childContextTypes,typeof i.getChildContext!=`function`)return n;for(var a in i=i.getChildContext(),i)if(!(a in t))throw Error(r(108,V(e)||`Unknown`,a));return R({},n,i)}function na(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||qi,Xi=Ji.current,Ki(Ji,e),Ki(Yi,Yi.current),!0}function ra(e,t,n){var i=e.stateNode;if(!i)throw Error(r(169));n?(e=ta(e,t,Xi),i.__reactInternalMemoizedMergedChildContext=e,Gi(Yi),Gi(Ji),Ki(Ji,e)):Gi(Yi),Ki(Yi,n)}var ia=null,aa=!1,oa=!1;function sa(e){ia===null?ia=[e]:ia.push(e)}function ca(e){aa=!0,sa(e)}function la(){if(!oa&&ia!==null){oa=!0;var e=0,t=Rt;try{var n=ia;for(Rt=1;e<n.length;e++){var r=n[e];do r=r(!0);while(r!==null)}ia=null,aa=!1}catch(t){throw ia!==null&&(ia=ia.slice(e+1)),ct(mt,la),t}finally{Rt=t,oa=!1}}return null}var ua=[],da=0,fa=null,pa=0,ma=[],U=0,ha=null,ga=1,_a=``;function va(e,t){ua[da++]=pa,ua[da++]=fa,fa=e,pa=t}function ya(e,t,n){ma[U++]=ga,ma[U++]=_a,ma[U++]=ha,ha=e;var r=ga;e=_a;var i=32-St(r)-1;r&=~(1<<i),n+=1;var a=32-St(t)+i;if(30<a){var o=i-i%5;a=(r&(1<<o)-1).toString(32),r>>=o,i-=o,ga=1<<32-St(t)+i|n<<i|r,_a=a+e}else ga=1<<a|n<<i|r,_a=e}function ba(e){e.return!==null&&(va(e,1),ya(e,1,0))}function xa(e){for(;e===fa;)fa=ua[--da],ua[da]=null,pa=ua[--da],ua[da]=null;for(;e===ha;)ha=ma[--U],ma[U]=null,_a=ma[--U],ma[U]=null,ga=ma[--U],ma[U]=null}var Sa=null,Ca=null,wa=!1,Ta=null;function Ea(e,t){var n=Ql(5,null,null,0);n.elementType=`DELETED`,n.stateNode=t,n.return=e,t=e.deletions,t===null?(e.deletions=[n],e.flags|=16):t.push(n)}function Da(e,t){switch(e.tag){case 5:var n=e.type;return t=t.nodeType!==1||n.toLowerCase()!==t.nodeName.toLowerCase()?null:t,t!==null&&(e.stateNode=t,Sa=e,Ca=ki(t.firstChild),!0);case 6:return t=e.pendingProps===``||t.nodeType!==3?null:t,t!==null&&(e.stateNode=t,Sa=e,Ca=null,!0);case 13:return t=t.nodeType===8?t:null,t!==null&&(n=ha===null?null:{id:ga,overflow:_a},e.memoizedState={dehydrated:t,treeContext:n,retryLane:1073741824},n=Ql(18,null,null,0),n.stateNode=t,n.return=e,e.child=n,Sa=e,Ca=null,!0);default:return!1}}function Oa(e){return!!(e.mode&1)&&!(e.flags&128)}function ka(e){if(wa){var t=Ca;if(t){var n=t;if(!Da(e,t)){if(Oa(e))throw Error(r(418));t=ki(n.nextSibling);var i=Sa;t&&Da(e,t)?Ea(i,n):(e.flags=e.flags&-4097|2,wa=!1,Sa=e)}}else{if(Oa(e))throw Error(r(418));e.flags=e.flags&-4097|2,wa=!1,Sa=e}}}function Aa(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;Sa=e}function ja(e){if(e!==Sa)return!1;if(!wa)return Aa(e),wa=!0,!1;var t;if((t=e.tag!==3)&&!(t=e.tag!==5)&&(t=e.type,t=t!==`head`&&t!==`body`&&!Si(e.type,e.memoizedProps)),t&&=Ca){if(Oa(e))throw Ma(),Error(r(418));for(;t;)Ea(e,t),t=ki(t.nextSibling)}if(Aa(e),e.tag===13){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(r(317));a:{for(e=e.nextSibling,t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`/$`){if(t===0){Ca=ki(e.nextSibling);break a}t--}else n!==`$`&&n!==`$!`&&n!==`$?`||t++}e=e.nextSibling}Ca=null}}else Ca=Sa?ki(e.stateNode.nextSibling):null;return!0}function Ma(){for(var e=Ca;e;)e=ki(e.nextSibling)}function Na(){Ca=Sa=null,wa=!1}function Pa(e){Ta===null?Ta=[e]:Ta.push(e)}var Fa=S.ReactCurrentBatchConfig;function Ia(e,t,n){if(e=n.ref,e!==null&&typeof e!=`function`&&typeof e!=`object`){if(n._owner){if(n=n._owner,n){if(n.tag!==1)throw Error(r(309));var i=n.stateNode}if(!i)throw Error(r(147,e));var a=i,o=``+e;return t!==null&&t.ref!==null&&typeof t.ref==`function`&&t.ref._stringRef===o?t.ref:(t=function(e){var t=a.refs;e===null?delete t[o]:t[o]=e},t._stringRef=o,t)}if(typeof e!=`string`)throw Error(r(284));if(!n._owner)throw Error(r(290,e))}return e}function La(e,t){throw e=Object.prototype.toString.call(t),Error(r(31,e===`[object Object]`?`object with keys {`+Object.keys(t).join(`, `)+`}`:e))}function Ra(e){var t=e._init;return t(e._payload)}function za(e){function t(t,n){if(e){var r=t.deletions;r===null?(t.deletions=[n],t.flags|=16):r.push(n)}}function n(n,r){if(!e)return null;for(;r!==null;)t(n,r),r=r.sibling;return null}function i(e,t){for(e=new Map;t!==null;)t.key===null?e.set(t.index,t):e.set(t.key,t),t=t.sibling;return e}function a(e,t){return e=tu(e,t),e.index=0,e.sibling=null,e}function o(t,n,r){return t.index=r,e?(r=t.alternate,r===null?(t.flags|=2,n):(r=r.index,r<n?(t.flags|=2,n):r)):(t.flags|=1048576,n)}function s(t){return e&&t.alternate===null&&(t.flags|=2),t}function c(e,t,n,r){return t===null||t.tag!==6?(t=au(n,e.mode,r),t.return=e,t):(t=a(t,n),t.return=e,t)}function l(e,t,n,r){var i=n.type;return i===T?d(e,t,n.props.children,r,n.key):t!==null&&(t.elementType===i||typeof i==`object`&&i&&i.$$typeof===P&&Ra(i)===t.type)?(r=a(t,n.props),r.ref=Ia(e,t,n),r.return=e,r):(r=nu(n.type,n.key,n.props,null,e.mode,r),r.ref=Ia(e,t,n),r.return=e,r)}function u(e,t,n,r){return t===null||t.tag!==4||t.stateNode.containerInfo!==n.containerInfo||t.stateNode.implementation!==n.implementation?(t=ou(n,e.mode,r),t.return=e,t):(t=a(t,n.children||[]),t.return=e,t)}function d(e,t,n,r,i){return t===null||t.tag!==7?(t=ru(n,e.mode,r,i),t.return=e,t):(t=a(t,n),t.return=e,t)}function f(e,t,n){if(typeof t==`string`&&t!==``||typeof t==`number`)return t=au(``+t,e.mode,n),t.return=e,t;if(typeof t==`object`&&t){switch(t.$$typeof){case C:return n=nu(t.type,t.key,t.props,null,e.mode,n),n.ref=Ia(e,null,t),n.return=e,n;case w:return t=ou(t,e.mode,n),t.return=e,t;case P:var r=t._init;return f(e,r(t._payload),n)}if(he(t)||L(t))return t=ru(t,e.mode,n,null),t.return=e,t;La(e,t)}return null}function p(e,t,n,r){var i=t===null?null:t.key;if(typeof n==`string`&&n!==``||typeof n==`number`)return i===null?c(e,t,``+n,r):null;if(typeof n==`object`&&n){switch(n.$$typeof){case C:return n.key===i?l(e,t,n,r):null;case w:return n.key===i?u(e,t,n,r):null;case P:return i=n._init,p(e,t,i(n._payload),r)}if(he(n)||L(n))return i===null?d(e,t,n,r,null):null;La(e,n)}return null}function m(e,t,n,r,i){if(typeof r==`string`&&r!==``||typeof r==`number`)return e=e.get(n)||null,c(t,e,``+r,i);if(typeof r==`object`&&r){switch(r.$$typeof){case C:return e=e.get(r.key===null?n:r.key)||null,l(t,e,r,i);case w:return e=e.get(r.key===null?n:r.key)||null,u(t,e,r,i);case P:var a=r._init;return m(e,t,n,a(r._payload),i)}if(he(r)||L(r))return e=e.get(n)||null,d(t,e,r,i,null);La(t,r)}return null}function h(r,a,s,c){for(var l=null,u=null,d=a,h=a=0,g=null;d!==null&&h<s.length;h++){d.index>h?(g=d,d=null):g=d.sibling;var _=p(r,d,s[h],c);if(_===null){d===null&&(d=g);break}e&&d&&_.alternate===null&&t(r,d),a=o(_,a,h),u===null?l=_:u.sibling=_,u=_,d=g}if(h===s.length)return n(r,d),wa&&va(r,h),l;if(d===null){for(;h<s.length;h++)d=f(r,s[h],c),d!==null&&(a=o(d,a,h),u===null?l=d:u.sibling=d,u=d);return wa&&va(r,h),l}for(d=i(r,d);h<s.length;h++)g=m(d,r,h,s[h],c),g!==null&&(e&&g.alternate!==null&&d.delete(g.key===null?h:g.key),a=o(g,a,h),u===null?l=g:u.sibling=g,u=g);return e&&d.forEach(function(e){return t(r,e)}),wa&&va(r,h),l}function g(a,s,c,l){var u=L(c);if(typeof u!=`function`)throw Error(r(150));if(c=u.call(c),c==null)throw Error(r(151));for(var d=u=null,h=s,g=s=0,_=null,v=c.next();h!==null&&!v.done;g++,v=c.next()){h.index>g?(_=h,h=null):_=h.sibling;var y=p(a,h,v.value,l);if(y===null){h===null&&(h=_);break}e&&h&&y.alternate===null&&t(a,h),s=o(y,s,g),d===null?u=y:d.sibling=y,d=y,h=_}if(v.done)return n(a,h),wa&&va(a,g),u;if(h===null){for(;!v.done;g++,v=c.next())v=f(a,v.value,l),v!==null&&(s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return wa&&va(a,g),u}for(h=i(a,h);!v.done;g++,v=c.next())v=m(h,a,g,v.value,l),v!==null&&(e&&v.alternate!==null&&h.delete(v.key===null?g:v.key),s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return e&&h.forEach(function(e){return t(a,e)}),wa&&va(a,g),u}function _(e,r,i,o){if(typeof i==`object`&&i&&i.type===T&&i.key===null&&(i=i.props.children),typeof i==`object`&&i){switch(i.$$typeof){case C:a:{for(var c=i.key,l=r;l!==null;){if(l.key===c){if(c=i.type,c===T){if(l.tag===7){n(e,l.sibling),r=a(l,i.props.children),r.return=e,e=r;break a}}else if(l.elementType===c||typeof c==`object`&&c&&c.$$typeof===P&&Ra(c)===l.type){n(e,l.sibling),r=a(l,i.props),r.ref=Ia(e,l,i),r.return=e,e=r;break a}n(e,l);break}t(e,l),l=l.sibling}i.type===T?(r=ru(i.props.children,e.mode,o,i.key),r.return=e,e=r):(o=nu(i.type,i.key,i.props,null,e.mode,o),o.ref=Ia(e,r,i),o.return=e,e=o)}return s(e);case w:a:{for(l=i.key;r!==null;){if(r.key===l){if(r.tag===4&&r.stateNode.containerInfo===i.containerInfo&&r.stateNode.implementation===i.implementation){n(e,r.sibling),r=a(r,i.children||[]),r.return=e,e=r;break a}n(e,r);break}t(e,r),r=r.sibling}r=ou(i,e.mode,o),r.return=e,e=r}return s(e);case P:return l=i._init,_(e,r,l(i._payload),o)}if(he(i))return h(e,r,i,o);if(L(i))return g(e,r,i,o);La(e,i)}return typeof i==`string`&&i!==``||typeof i==`number`?(i=``+i,r!==null&&r.tag===6?(n(e,r.sibling),r=a(r,i),r.return=e,e=r):(n(e,r),r=au(i,e.mode,o),r.return=e,e=r),s(e)):n(e,r)}return _}var Ba=za(!0),Va=za(!1),Ha=Wi(null),Ua=null,Wa=null,Ga=null;function Ka(){Ga=Wa=Ua=null}function qa(e){var t=Ha.current;Gi(Ha),e._currentValue=t}function Ja(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)===t?r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t):(e.childLanes|=t,r!==null&&(r.childLanes|=t)),e===n)break;e=e.return}}function Ya(e,t){Ua=e,Ga=Wa=null,e=e.dependencies,e!==null&&e.firstContext!==null&&((e.lanes&t)!==0&&(Ls=!0),e.firstContext=null)}function Xa(e){var t=e._currentValue;if(Ga!==e){if(e={context:e,memoizedValue:t,next:null},Wa===null){if(Ua===null)throw Error(r(308));Wa=e,Ua.dependencies={lanes:0,firstContext:e}}else Wa=Wa.next=e}return t}var Za=null;function Qa(e){Za===null?Za=[e]:Za.push(e)}function $a(e,t,n,r){var i=t.interleaved;return i===null?(n.next=n,Qa(t)):(n.next=i.next,i.next=n),t.interleaved=n,eo(e,r)}function eo(e,t){e.lanes|=t;var n=e.alternate;for(n!==null&&(n.lanes|=t),n=e,e=e.return;e!==null;)e.childLanes|=t,n=e.alternate,n!==null&&(n.childLanes|=t),n=e,e=e.return;return n.tag===3?n.stateNode:null}var W=!1;function to(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function no(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function ro(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function io(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,Kc&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,eo(e,n)}return i=r.interleaved,i===null?(t.next=t,Qa(r)):(t.next=i.next,i.next=t),r.interleaved=t,eo(e,n)}function ao(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,n&4194240)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Lt(e,n)}}function oo(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,a=null;if(n=n.firstBaseUpdate,n!==null){do{var o={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};a===null?i=a=o:a=a.next=o,n=n.next}while(n!==null);a===null?i=a=t:a=a.next=t}else i=a=t;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:a,shared:r.shared,effects:r.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function so(e,t,n,r){var i=e.updateQueue;W=!1;var a=i.firstBaseUpdate,o=i.lastBaseUpdate,s=i.shared.pending;if(s!==null){i.shared.pending=null;var c=s,l=c.next;c.next=null,o===null?a=l:o.next=l,o=c;var u=e.alternate;u!==null&&(u=u.updateQueue,s=u.lastBaseUpdate,s!==o&&(s===null?u.firstBaseUpdate=l:s.next=l,u.lastBaseUpdate=c))}if(a!==null){var d=i.baseState;o=0,u=l=c=null,s=a;do{var f=s.lane,p=s.eventTime;if((r&f)===f){u!==null&&(u=u.next={eventTime:p,lane:0,tag:s.tag,payload:s.payload,callback:s.callback,next:null});a:{var m=e,h=s;switch(f=t,p=n,h.tag){case 1:if(m=h.payload,typeof m==`function`){d=m.call(p,d,f);break a}d=m;break a;case 3:m.flags=m.flags&-65537|128;case 0:if(m=h.payload,f=typeof m==`function`?m.call(p,d,f):m,f==null)break a;d=R({},d,f);break a;case 2:W=!0}}s.callback!==null&&s.lane!==0&&(e.flags|=64,f=i.effects,f===null?i.effects=[s]:f.push(s))}else p={eventTime:p,lane:f,tag:s.tag,payload:s.payload,callback:s.callback,next:null},u===null?(l=u=p,c=d):u=u.next=p,o|=f;if(s=s.next,s===null){if(s=i.shared.pending,s===null)break;f=s,s=f.next,f.next=null,i.lastBaseUpdate=f,i.shared.pending=null}}while(1);if(u===null&&(c=d),i.baseState=c,i.firstBaseUpdate=l,i.lastBaseUpdate=u,t=i.shared.interleaved,t!==null){i=t;do o|=i.lane,i=i.next;while(i!==t)}else a===null&&(i.shared.lanes=0);el|=o,e.lanes=o,e.memoizedState=d}}function co(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;t<e.length;t++){var i=e[t],a=i.callback;if(a!==null){if(i.callback=null,i=n,typeof a!=`function`)throw Error(r(191,a));a.call(i)}}}var lo={},uo=Wi(lo),fo=Wi(lo),po=Wi(lo);function mo(e){if(e===lo)throw Error(r(174));return e}function ho(e,t){switch(Ki(po,t),Ki(fo,e),Ki(uo,lo),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:Se(null,``);break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=Se(t,e)}Gi(uo),Ki(uo,t)}function go(){Gi(uo),Gi(fo),Gi(po)}function _o(e){mo(po.current);var t=mo(uo.current),n=Se(t,e.type);t!==n&&(Ki(fo,e),Ki(uo,n))}function vo(e){fo.current===e&&(Gi(uo),Gi(fo))}var yo=Wi(0);function bo(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||n.data===`$?`||n.data===`$!`))return t}else if(t.tag===19&&t.memoizedProps.revealOrder!==void 0){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var xo=[];function So(){for(var e=0;e<xo.length;e++)xo[e]._workInProgressVersionPrimary=null;xo.length=0}var Co=S.ReactCurrentDispatcher,wo=S.ReactCurrentBatchConfig,To=0,Eo=null,Do=null,Oo=null,ko=!1,Ao=!1,jo=0,Mo=0;function No(){throw Error(r(321))}function Po(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!Dr(e[n],t[n]))return!1;return!0}function Fo(e,t,n,i,a,o){if(To=o,Eo=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,Co.current=e===null||e.memoizedState===null?_s:vs,e=n(i,a),Ao){o=0;do{if(Ao=!1,jo=0,25<=o)throw Error(r(301));o+=1,Oo=Do=null,t.updateQueue=null,Co.current=ys,e=n(i,a)}while(Ao)}if(Co.current=gs,t=Do!==null&&Do.next!==null,To=0,Oo=Do=Eo=null,ko=!1,t)throw Error(r(300));return e}function Io(){var e=jo!==0;return jo=0,e}function Lo(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Oo===null?Eo.memoizedState=Oo=e:Oo=Oo.next=e,Oo}function Ro(){if(Do===null){var e=Eo.alternate;e=e===null?null:e.memoizedState}else e=Do.next;var t=Oo===null?Eo.memoizedState:Oo.next;if(t!==null)Oo=t,Do=e;else{if(e===null)throw Error(r(310));Do=e,e={memoizedState:Do.memoizedState,baseState:Do.baseState,baseQueue:Do.baseQueue,queue:Do.queue,next:null},Oo===null?Eo.memoizedState=Oo=e:Oo=Oo.next=e}return Oo}function zo(e,t){return typeof t==`function`?t(e):t}function Bo(e){var t=Ro(),n=t.queue;if(n===null)throw Error(r(311));n.lastRenderedReducer=e;var i=Do,a=i.baseQueue,o=n.pending;if(o!==null){if(a!==null){var s=a.next;a.next=o.next,o.next=s}i.baseQueue=a=o,n.pending=null}if(a!==null){o=a.next,i=i.baseState;var c=s=null,l=null,u=o;do{var d=u.lane;if((To&d)===d)l!==null&&(l=l.next={lane:0,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null}),i=u.hasEagerState?u.eagerState:e(i,u.action);else{var f={lane:d,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null};l===null?(c=l=f,s=i):l=l.next=f,Eo.lanes|=d,el|=d}u=u.next}while(u!==null&&u!==o);l===null?s=i:l.next=c,Dr(i,t.memoizedState)||(Ls=!0),t.memoizedState=i,t.baseState=s,t.baseQueue=l,n.lastRenderedState=i}if(e=n.interleaved,e!==null){a=e;do o=a.lane,Eo.lanes|=o,el|=o,a=a.next;while(a!==e)}else a===null&&(n.lanes=0);return[t.memoizedState,n.dispatch]}function Vo(e){var t=Ro(),n=t.queue;if(n===null)throw Error(r(311));n.lastRenderedReducer=e;var i=n.dispatch,a=n.pending,o=t.memoizedState;if(a!==null){n.pending=null;var s=a=a.next;do o=e(o,s.action),s=s.next;while(s!==a);Dr(o,t.memoizedState)||(Ls=!0),t.memoizedState=o,t.baseQueue===null&&(t.baseState=o),n.lastRenderedState=o}return[o,i]}function Ho(){}function Uo(e,t){var n=Eo,i=Ro(),a=t(),o=!Dr(i.memoizedState,a);if(o&&(i.memoizedState=a,Ls=!0),i=i.queue,es(Ko.bind(null,n,i,e),[e]),i.getSnapshot!==t||o||Oo!==null&&Oo.memoizedState.tag&1){if(n.flags|=2048,Yo(9,Go.bind(null,n,i,a,t),void 0,null),qc===null)throw Error(r(349));To&30||Wo(n,t,a)}return a}function Wo(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=Eo.updateQueue,t===null?(t={lastEffect:null,stores:null},Eo.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function Go(e,t,n,r){t.value=n,t.getSnapshot=r,qo(t)&&Jo(e)}function Ko(e,t,n){return n(function(){qo(t)&&Jo(e)})}function qo(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!Dr(e,n)}catch{return!0}}function Jo(e){var t=eo(e,1);t!==null&&bl(t,e,1,-1)}function G(e){var t=Lo();return typeof e==`function`&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:zo,lastRenderedState:e},t.queue=e,e=e.dispatch=fs.bind(null,Eo,e),[t.memoizedState,e]}function Yo(e,t,n,r){return e={tag:e,create:t,destroy:n,deps:r,next:null},t=Eo.updateQueue,t===null?(t={lastEffect:null,stores:null},Eo.updateQueue=t,t.lastEffect=e.next=e):(n=t.lastEffect,n===null?t.lastEffect=e.next=e:(r=n.next,n.next=e,e.next=r,t.lastEffect=e)),e}function Xo(){return Ro().memoizedState}function Zo(e,t,n,r){var i=Lo();Eo.flags|=e,i.memoizedState=Yo(1|t,n,void 0,r===void 0?null:r)}function Qo(e,t,n,r){var i=Ro();r=r===void 0?null:r;var a=void 0;if(Do!==null){var o=Do.memoizedState;if(a=o.destroy,r!==null&&Po(r,o.deps)){i.memoizedState=Yo(t,n,a,r);return}}Eo.flags|=e,i.memoizedState=Yo(1|t,n,a,r)}function $o(e,t){return Zo(8390656,8,e,t)}function es(e,t){return Qo(2048,8,e,t)}function ts(e,t){return Qo(4,2,e,t)}function ns(e,t){return Qo(4,4,e,t)}function rs(e,t){if(typeof t==`function`)return e=e(),t(e),function(){t(null)};if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function is(e,t,n){return n=n==null?null:n.concat([e]),Qo(4,4,rs.bind(null,t,e),n)}function as(){}function os(e,t){var n=Ro();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&Po(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function ss(e,t){var n=Ro();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&Po(t,r[1])?r[0]:(e=e(),n.memoizedState=[e,t],e)}function cs(e,t,n){return To&21?(Dr(n,t)||(n=Nt(),Eo.lanes|=n,el|=n,e.baseState=!0),t):(e.baseState&&(e.baseState=!1,Ls=!0),e.memoizedState=n)}function ls(e,t){var n=Rt;Rt=n!==0&&4>n?n:4,e(!0);var r=wo.transition;wo.transition={};try{e(!1),t()}finally{Rt=n,wo.transition=r}}function us(){return Ro().memoizedState}function ds(e,t,n){var r=yl(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},ps(e))ms(t,n);else if(n=$a(e,t,n,r),n!==null){var i=vl();bl(n,e,r,i),hs(n,t,r)}}function fs(e,t,n){var r=yl(e),i={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(ps(e))ms(t,i);else{var a=e.alternate;if(e.lanes===0&&(a===null||a.lanes===0)&&(a=t.lastRenderedReducer,a!==null))try{var o=t.lastRenderedState,s=a(o,n);if(i.hasEagerState=!0,i.eagerState=s,Dr(s,o)){var c=t.interleaved;c===null?(i.next=i,Qa(t)):(i.next=c.next,c.next=i),t.interleaved=i;return}}catch{}n=$a(e,t,i,r),n!==null&&(i=vl(),bl(n,e,r,i),hs(n,t,r))}}function ps(e){var t=e.alternate;return e===Eo||t!==null&&t===Eo}function ms(e,t){Ao=ko=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function hs(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Lt(e,n)}}var gs={readContext:Xa,useCallback:No,useContext:No,useEffect:No,useImperativeHandle:No,useInsertionEffect:No,useLayoutEffect:No,useMemo:No,useReducer:No,useRef:No,useState:No,useDebugValue:No,useDeferredValue:No,useTransition:No,useMutableSource:No,useSyncExternalStore:No,useId:No,unstable_isNewReconciler:!1},_s={readContext:Xa,useCallback:function(e,t){return Lo().memoizedState=[e,t===void 0?null:t],e},useContext:Xa,useEffect:$o,useImperativeHandle:function(e,t,n){return n=n==null?null:n.concat([e]),Zo(4194308,4,rs.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Zo(4194308,4,e,t)},useInsertionEffect:function(e,t){return Zo(4,2,e,t)},useMemo:function(e,t){var n=Lo();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=Lo();return t=n===void 0?t:n(t),r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=ds.bind(null,Eo,e),[r.memoizedState,e]},useRef:function(e){var t=Lo();return e={current:e},t.memoizedState=e},useState:G,useDebugValue:as,useDeferredValue:function(e){return Lo().memoizedState=e},useTransition:function(){var e=G(!1),t=e[0];return e=ls.bind(null,e[1]),Lo().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var i=Eo,a=Lo();if(wa){if(n===void 0)throw Error(r(407));n=n()}else{if(n=t(),qc===null)throw Error(r(349));To&30||Wo(i,t,n)}a.memoizedState=n;var o={value:n,getSnapshot:t};return a.queue=o,$o(Ko.bind(null,i,o,e),[e]),i.flags|=2048,Yo(9,Go.bind(null,i,o,n,t),void 0,null),n},useId:function(){var e=Lo(),t=qc.identifierPrefix;if(wa){var n=_a,r=ga;n=(r&~(1<<32-St(r)-1)).toString(32)+n,t=`:`+t+`R`+n,n=jo++,0<n&&(t+=`H`+n.toString(32)),t+=`:`}else n=Mo++,t=`:`+t+`r`+n.toString(32)+`:`;return e.memoizedState=t},unstable_isNewReconciler:!1},vs={readContext:Xa,useCallback:os,useContext:Xa,useEffect:es,useImperativeHandle:is,useInsertionEffect:ts,useLayoutEffect:ns,useMemo:ss,useReducer:Bo,useRef:Xo,useState:function(){return Bo(zo)},useDebugValue:as,useDeferredValue:function(e){return cs(Ro(),Do.memoizedState,e)},useTransition:function(){return[Bo(zo)[0],Ro().memoizedState]},useMutableSource:Ho,useSyncExternalStore:Uo,useId:us,unstable_isNewReconciler:!1},ys={readContext:Xa,useCallback:os,useContext:Xa,useEffect:es,useImperativeHandle:is,useInsertionEffect:ts,useLayoutEffect:ns,useMemo:ss,useReducer:Vo,useRef:Xo,useState:function(){return Vo(zo)},useDebugValue:as,useDeferredValue:function(e){var t=Ro();return Do===null?t.memoizedState=e:cs(t,Do.memoizedState,e)},useTransition:function(){return[Vo(zo)[0],Ro().memoizedState]},useMutableSource:Ho,useSyncExternalStore:Uo,useId:us,unstable_isNewReconciler:!1};function bs(e,t){if(e&&e.defaultProps){for(var n in t=R({},t),e=e.defaultProps,e)t[n]===void 0&&(t[n]=e[n]);return t}return t}function xs(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:R({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var Ss={isMounted:function(e){return(e=e._reactInternals)?nt(e)===e:!1},enqueueSetState:function(e,t,n){e=e._reactInternals;var r=vl(),i=yl(e),a=ro(r,i);a.payload=t,n!=null&&(a.callback=n),t=io(e,a,i),t!==null&&(bl(t,e,i,r),ao(t,e,i))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=vl(),i=yl(e),a=ro(r,i);a.tag=1,a.payload=t,n!=null&&(a.callback=n),t=io(e,a,i),t!==null&&(bl(t,e,i,r),ao(t,e,i))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=vl(),r=yl(e),i=ro(n,r);i.tag=2,t!=null&&(i.callback=t),t=io(e,i,r),t!==null&&(bl(t,e,r,n),ao(t,e,r))}};function Cs(e,t,n,r,i,a,o){return e=e.stateNode,typeof e.shouldComponentUpdate==`function`?e.shouldComponentUpdate(r,a,o):t.prototype&&t.prototype.isPureReactComponent?!Or(n,r)||!Or(i,a):!0}function ws(e,t,n){var r=!1,i=qi,a=t.contextType;return typeof a==`object`&&a?a=Xa(a):(i=Qi(t)?Xi:Ji.current,r=t.contextTypes,a=(r=r!=null)?Zi(e,i):qi),t=new t(n,a),e.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=Ss,e.stateNode=t,t._reactInternals=e,r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=i,e.__reactInternalMemoizedMaskedChildContext=a),t}function Ts(e,t,n,r){e=t.state,typeof t.componentWillReceiveProps==`function`&&t.componentWillReceiveProps(n,r),typeof t.UNSAFE_componentWillReceiveProps==`function`&&t.UNSAFE_componentWillReceiveProps(n,r),t.state!==e&&Ss.enqueueReplaceState(t,t.state,null)}function Es(e,t,n,r){var i=e.stateNode;i.props=n,i.state=e.memoizedState,i.refs={},to(e);var a=t.contextType;typeof a==`object`&&a?i.context=Xa(a):(a=Qi(t)?Xi:Ji.current,i.context=Zi(e,a)),i.state=e.memoizedState,a=t.getDerivedStateFromProps,typeof a==`function`&&(xs(e,t,a,n),i.state=e.memoizedState),typeof t.getDerivedStateFromProps==`function`||typeof i.getSnapshotBeforeUpdate==`function`||typeof i.UNSAFE_componentWillMount!=`function`&&typeof i.componentWillMount!=`function`||(t=i.state,typeof i.componentWillMount==`function`&&i.componentWillMount(),typeof i.UNSAFE_componentWillMount==`function`&&i.UNSAFE_componentWillMount(),t!==i.state&&Ss.enqueueReplaceState(i,i.state,null),so(e,n,i,r),i.state=e.memoizedState),typeof i.componentDidMount==`function`&&(e.flags|=4194308)}function Ds(e,t){try{var n=``,r=t;do n+=ne(r),r=r.return;while(r);var i=n}catch(e){i=`
83
83
  Error generating stack: `+e.message+`
84
- `+e.stack}return{value:e,source:t,stack:i,digest:null}}function Os(e,t,n){return{value:e,source:null,stack:n??null,digest:t??null}}function ks(e,t){try{console.error(t.value)}catch(e){setTimeout(function(){throw e})}}var As=typeof WeakMap==`function`?WeakMap:Map;function js(e,t,n){n=ro(-1,n),n.tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){cl||(cl=!0,ll=r),ks(e,t)},n}function Ms(e,t,n){n=ro(-1,n),n.tag=3;var r=e.type.getDerivedStateFromError;if(typeof r==`function`){var i=t.value;n.payload=function(){return r(i)},n.callback=function(){ks(e,t)}}var a=e.stateNode;return a!==null&&typeof a.componentDidCatch==`function`&&(n.callback=function(){ks(e,t),typeof r!=`function`&&(ul===null?ul=new Set([this]):ul.add(this));var n=t.stack;this.componentDidCatch(t.value,{componentStack:n===null?``:n})}),n}function Ns(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new As;var i=new Set;r.set(t,i)}else i=r.get(t),i===void 0&&(i=new Set,r.set(t,i));i.has(n)||(i.add(n),e=Gl.bind(null,e,t,n),t.then(e,e))}function Ps(e){do{var t;if((t=e.tag===13)&&(t=e.memoizedState,t=t===null||t.dehydrated!==null),t)return e;e=e.return}while(e!==null);return null}function Fs(e,t,n,r,i){return e.mode&1?(e.flags|=65536,e.lanes=i,e):(e===t?e.flags|=65536:(e.flags|=128,n.flags|=131072,n.flags&=-52805,n.tag===1&&(n.alternate===null?n.tag=17:(t=ro(-1,1),t.tag=2,io(n,t,1))),n.lanes|=1),e)}var Is=S.ReactCurrentOwner,Ls=!1;function Rs(e,t,n,r){t.child=e===null?Va(t,null,n,r):Ba(t,e.child,n,r)}function zs(e,t,n,r,i){n=n.render;var a=t.ref;return Ya(t,i),r=Fo(e,t,n,r,a,i),n=Io(),e!==null&&!Ls?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i,ac(e,t,i)):(wa&&n&&ba(t),t.flags|=1,Rs(e,t,r,i),t.child)}function Bs(e,t,n,r,i){if(e===null){var a=n.type;return typeof a==`function`&&!$l(a)&&a.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(t.tag=15,t.type=a,Vs(e,t,a,r,i)):(e=nu(n.type,null,r,t,t.mode,i),e.ref=t.ref,e.return=t,t.child=e)}if(a=e.child,(e.lanes&i)===0){var o=a.memoizedProps;if(n=n.compare,n=n===null?Or:n,n(o,r)&&e.ref===t.ref)return ac(e,t,i)}return t.flags|=1,e=tu(a,r),e.ref=t.ref,e.return=t,t.child=e}function Vs(e,t,n,r,i){if(e!==null){var a=e.memoizedProps;if(Or(a,r)&&e.ref===t.ref){if(Ls=!1,t.pendingProps=r=a,(e.lanes&i)!==0)e.flags&131072&&(Ls=!0);else return t.lanes=e.lanes,ac(e,t,i)}}return Ws(e,t,n,r,i)}function Hs(e,t,n){var r=t.pendingProps,i=r.children,a=e===null?null:e.memoizedState;if(r.mode===`hidden`){if(!(t.mode&1))t.memoizedState={baseLanes:0,cachePool:null,transitions:null},Ki(Zc,Xc),Xc|=n;else{if(!(n&1073741824))return e=a===null?n:a.baseLanes|n,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,Ki(Zc,Xc),Xc|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=a===null?n:a.baseLanes,Ki(Zc,Xc),Xc|=r}}else a===null?r=n:(r=a.baseLanes|n,t.memoizedState=null),Ki(Zc,Xc),Xc|=r;return Rs(e,t,i,n),t.child}function Us(e,t){var n=t.ref;(e===null&&n!==null||e!==null&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function Ws(e,t,n,r,i){var a=Qi(n)?Xi:Ji.current;return a=Zi(t,a),Ya(t,i),n=Fo(e,t,n,r,a,i),r=Io(),e!==null&&!Ls?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i,ac(e,t,i)):(wa&&r&&ba(t),t.flags|=1,Rs(e,t,n,i),t.child)}function Gs(e,t,n,r,i){if(Qi(n)){var a=!0;na(t)}else a=!1;if(Ya(t,i),t.stateNode===null)ic(e,t),ws(t,n,r),Es(t,n,r,i),r=!0;else if(e===null){var o=t.stateNode,s=t.memoizedProps;o.props=s;var c=o.context,l=n.contextType;typeof l==`object`&&l?l=Xa(l):(l=Qi(n)?Xi:Ji.current,l=Zi(t,l));var u=n.getDerivedStateFromProps,d=typeof u==`function`||typeof o.getSnapshotBeforeUpdate==`function`;d||typeof o.UNSAFE_componentWillReceiveProps!=`function`&&typeof o.componentWillReceiveProps!=`function`||(s!==r||c!==l)&&Ts(t,o,r,l),W=!1;var f=t.memoizedState;o.state=f,so(t,r,o,i),c=t.memoizedState,s!==r||f!==c||Yi.current||W?(typeof u==`function`&&(xs(t,n,u,r),c=t.memoizedState),(s=W||Cs(t,n,s,r,f,c,l))?(d||typeof o.UNSAFE_componentWillMount!=`function`&&typeof o.componentWillMount!=`function`||(typeof o.componentWillMount==`function`&&o.componentWillMount(),typeof o.UNSAFE_componentWillMount==`function`&&o.UNSAFE_componentWillMount()),typeof o.componentDidMount==`function`&&(t.flags|=4194308)):(typeof o.componentDidMount==`function`&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=c),o.props=r,o.state=c,o.context=l,r=s):(typeof o.componentDidMount==`function`&&(t.flags|=4194308),r=!1)}else{o=t.stateNode,no(e,t),s=t.memoizedProps,l=t.type===t.elementType?s:bs(t.type,s),o.props=l,d=t.pendingProps,f=o.context,c=n.contextType,typeof c==`object`&&c?c=Xa(c):(c=Qi(n)?Xi:Ji.current,c=Zi(t,c));var p=n.getDerivedStateFromProps;(u=typeof p==`function`||typeof o.getSnapshotBeforeUpdate==`function`)||typeof o.UNSAFE_componentWillReceiveProps!=`function`&&typeof o.componentWillReceiveProps!=`function`||(s!==d||f!==c)&&Ts(t,o,r,c),W=!1,f=t.memoizedState,o.state=f,so(t,r,o,i);var m=t.memoizedState;s!==d||f!==m||Yi.current||W?(typeof p==`function`&&(xs(t,n,p,r),m=t.memoizedState),(l=W||Cs(t,n,l,r,f,m,c)||!1)?(u||typeof o.UNSAFE_componentWillUpdate!=`function`&&typeof o.componentWillUpdate!=`function`||(typeof o.componentWillUpdate==`function`&&o.componentWillUpdate(r,m,c),typeof o.UNSAFE_componentWillUpdate==`function`&&o.UNSAFE_componentWillUpdate(r,m,c)),typeof o.componentDidUpdate==`function`&&(t.flags|=4),typeof o.getSnapshotBeforeUpdate==`function`&&(t.flags|=1024)):(typeof o.componentDidUpdate!=`function`||s===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof o.getSnapshotBeforeUpdate!=`function`||s===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=m),o.props=r,o.state=m,o.context=c,r=l):(typeof o.componentDidUpdate!=`function`||s===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof o.getSnapshotBeforeUpdate!=`function`||s===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),r=!1)}return Ks(e,t,n,r,a,i)}function Ks(e,t,n,r,i,a){Us(e,t);var o=!!(t.flags&128);if(!r&&!o)return i&&ra(t,n,!1),ac(e,t,a);r=t.stateNode,Is.current=t;var s=o&&typeof n.getDerivedStateFromError!=`function`?null:r.render();return t.flags|=1,e!==null&&o?(t.child=Ba(t,e.child,null,a),t.child=Ba(t,null,s,a)):Rs(e,t,s,a),t.memoizedState=r.state,i&&ra(t,n,!0),t.child}function qs(e){var t=e.stateNode;t.pendingContext?ea(e,t.pendingContext,t.pendingContext!==t.context):t.context&&ea(e,t.context,!1),ho(e,t.containerInfo)}function Js(e,t,n,r,i){return Na(),Pa(i),t.flags|=256,Rs(e,t,n,r),t.child}var Ys={dehydrated:null,treeContext:null,retryLane:0};function Xs(e){return{baseLanes:e,cachePool:null,transitions:null}}function Zs(e,t,n){var r=t.pendingProps,i=yo.current,a=!1,o=!!(t.flags&128),s;if((s=o)||(s=e!==null&&e.memoizedState===null?!1:!!(i&2)),s?(a=!0,t.flags&=-129):(e===null||e.memoizedState!==null)&&(i|=1),Ki(yo,i&1),e===null)return ka(t),e=t.memoizedState,e!==null&&(e=e.dehydrated,e!==null)?(t.lanes=t.mode&1?e.data===`$!`?8:1073741824:1,null):(o=r.children,e=r.fallback,a?(r=t.mode,a=t.child,o={mode:`hidden`,children:o},!(r&1)&&a!==null?(a.childLanes=0,a.pendingProps=o):a=iu(o,r,0,null),e=ru(e,r,n,null),a.return=t,e.return=t,a.sibling=e,t.child=a,t.child.memoizedState=Xs(n),t.memoizedState=Ys,e):Qs(t,o));if(i=e.memoizedState,i!==null&&(s=i.dehydrated,s!==null))return ec(e,t,o,r,s,i,n);if(a){a=r.fallback,o=t.mode,i=e.child,s=i.sibling;var c={mode:`hidden`,children:r.children};return!(o&1)&&t.child!==i?(r=t.child,r.childLanes=0,r.pendingProps=c,t.deletions=null):(r=tu(i,c),r.subtreeFlags=i.subtreeFlags&14680064),s===null?(a=ru(a,o,n,null),a.flags|=2):a=tu(s,a),a.return=t,r.return=t,r.sibling=a,t.child=r,r=a,a=t.child,o=e.child.memoizedState,o=o===null?Xs(n):{baseLanes:o.baseLanes|n,cachePool:null,transitions:o.transitions},a.memoizedState=o,a.childLanes=e.childLanes&~n,t.memoizedState=Ys,r}return a=e.child,e=a.sibling,r=tu(a,{mode:`visible`,children:r.children}),!(t.mode&1)&&(r.lanes=n),r.return=t,r.sibling=null,e!==null&&(n=t.deletions,n===null?(t.deletions=[e],t.flags|=16):n.push(e)),t.child=r,t.memoizedState=null,r}function Qs(e,t){return t=iu({mode:`visible`,children:t},e.mode,0,null),t.return=e,e.child=t}function $s(e,t,n,r){return r!==null&&Pa(r),Ba(t,e.child,null,n),e=Qs(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function ec(e,t,n,i,a,o,s){if(n)return t.flags&256?(t.flags&=-257,i=Os(Error(r(422))),$s(e,t,s,i)):t.memoizedState===null?(o=i.fallback,a=t.mode,i=iu({mode:`visible`,children:i.children},a,0,null),o=ru(o,a,s,null),o.flags|=2,i.return=t,o.return=t,i.sibling=o,t.child=i,t.mode&1&&Ba(t,e.child,null,s),t.child.memoizedState=Xs(s),t.memoizedState=Ys,o):(t.child=e.child,t.flags|=128,null);if(!(t.mode&1))return $s(e,t,s,null);if(a.data===`$!`){if(i=a.nextSibling&&a.nextSibling.dataset,i)var c=i.dgst;return i=c,o=Error(r(419)),i=Os(o,i,void 0),$s(e,t,s,i)}if(c=(s&e.childLanes)!==0,Ls||c){if(i=qc,i!==null){switch(s&-s){case 4:a=2;break;case 16:a=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:a=32;break;case 536870912:a=268435456;break;default:a=0}a=(a&(i.suspendedLanes|s))===0?a:0,a!==0&&a!==o.retryLane&&(o.retryLane=a,eo(e,a),bl(i,e,a,-1))}return Pl(),i=Os(Error(r(421))),$s(e,t,s,i)}return a.data===`$?`?(t.flags|=128,t.child=e.child,t=ql.bind(null,e),a._reactRetry=t,null):(e=o.treeContext,Ca=ki(a.nextSibling),Sa=t,wa=!0,Ta=null,e!==null&&(ma[U++]=ga,ma[U++]=_a,ma[U++]=ha,ga=e.id,_a=e.overflow,ha=t),t=Qs(t,i.children),t.flags|=4096,t)}function tc(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),Ja(e.return,t,n)}function nc(e,t,n,r,i){var a=e.memoizedState;a===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:i}:(a.isBackwards=t,a.rendering=null,a.renderingStartTime=0,a.last=r,a.tail=n,a.tailMode=i)}function rc(e,t,n){var r=t.pendingProps,i=r.revealOrder,a=r.tail;if(Rs(e,t,r.children,n),r=yo.current,r&2)r=r&1|2,t.flags|=128;else{if(e!==null&&e.flags&128)a:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&tc(e,n,t);else if(e.tag===19)tc(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break a;for(;e.sibling===null;){if(e.return===null||e.return===t)break a;e=e.return}e.sibling.return=e.return,e=e.sibling}r&=1}if(Ki(yo,r),!(t.mode&1))t.memoizedState=null;else switch(i){case`forwards`:for(n=t.child,i=null;n!==null;)e=n.alternate,e!==null&&bo(e)===null&&(i=n),n=n.sibling;n=i,n===null?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null),nc(t,!1,i,n,a);break;case`backwards`:for(n=null,i=t.child,t.child=null;i!==null;){if(e=i.alternate,e!==null&&bo(e)===null){t.child=i;break}e=i.sibling,i.sibling=n,n=i,i=e}nc(t,!0,n,null,a);break;case`together`:nc(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function ic(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function ac(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),el|=t.lanes,(n&t.childLanes)===0)return null;if(e!==null&&t.child!==e.child)throw Error(r(153));if(t.child!==null){for(e=t.child,n=tu(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=tu(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function oc(e,t,n){switch(t.tag){case 3:qs(t),Na();break;case 5:_o(t);break;case 1:Qi(t.type)&&na(t);break;case 4:ho(t,t.stateNode.containerInfo);break;case 10:var r=t.type._context,i=t.memoizedProps.value;Ki(Ha,r._currentValue),r._currentValue=i;break;case 13:if(r=t.memoizedState,r!==null)return r.dehydrated===null?(n&t.child.childLanes)===0?(Ki(yo,yo.current&1),e=ac(e,t,n),e===null?null:e.sibling):Zs(e,t,n):(Ki(yo,yo.current&1),t.flags|=128,null);Ki(yo,yo.current&1);break;case 19:if(r=(n&t.childLanes)!==0,e.flags&128){if(r)return rc(e,t,n);t.flags|=128}if(i=t.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),Ki(yo,yo.current),r)break;return null;case 22:case 23:return t.lanes=0,Hs(e,t,n)}return ac(e,t,n)}var sc=function(e,t){for(var n=t.child;n!==null;){if(n.tag===5||n.tag===6)e.appendChild(n.stateNode);else if(n.tag!==4&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===t)break;for(;n.sibling===null;){if(n.return===null||n.return===t)return;n=n.return}n.sibling.return=n.return,n=n.sibling}},cc=function(e,t,n,r){var i=e.memoizedProps;if(i!==r){e=t.stateNode,mo(uo.current);var o=null;switch(n){case`input`:i=le(e,i),r=le(e,r),o=[];break;case`select`:i=R({},i,{value:void 0}),r=R({},r,{value:void 0}),o=[];break;case`textarea`:i=_e(e,i),r=_e(e,r),o=[];break;default:typeof i.onClick!=`function`&&typeof r.onClick==`function`&&(e.onclick=yi)}je(n,r);var s;for(u in n=null,i)if(!r.hasOwnProperty(u)&&i.hasOwnProperty(u)&&i[u]!=null){if(u===`style`){var c=i[u];for(s in c)c.hasOwnProperty(s)&&(n||={},n[s]=``)}else u!==`dangerouslySetInnerHTML`&&u!==`children`&&u!==`suppressContentEditableWarning`&&u!==`suppressHydrationWarning`&&u!==`autoFocus`&&(a.hasOwnProperty(u)?o||=[]:(o||=[]).push(u,null))}for(u in r){var l=r[u];if(c=i?.[u],r.hasOwnProperty(u)&&l!==c&&(l!=null||c!=null)){if(u===`style`){if(c){for(s in c)!c.hasOwnProperty(s)||l&&l.hasOwnProperty(s)||(n||={},n[s]=``);for(s in l)l.hasOwnProperty(s)&&c[s]!==l[s]&&(n||={},n[s]=l[s])}else n||(o||=[],o.push(u,n)),n=l}else u===`dangerouslySetInnerHTML`?(l=l?l.__html:void 0,c=c?c.__html:void 0,l!=null&&c!==l&&(o||=[]).push(u,l)):u===`children`?typeof l!=`string`&&typeof l!=`number`||(o||=[]).push(u,``+l):u!==`suppressContentEditableWarning`&&u!==`suppressHydrationWarning`&&(a.hasOwnProperty(u)?(l!=null&&u===`onScroll`&&ai(`scroll`,e),o||c===l||(o=[])):(o||=[]).push(u,l))}}n&&(o||=[]).push(`style`,n);var u=o;(t.updateQueue=u)&&(t.flags|=4)}},lc=function(e,t,n,r){n!==r&&(t.flags|=4)};function uc(e,t){if(!wa)switch(e.tailMode){case`hidden`:t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case`collapsed`:n=e.tail;for(var r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:r.sibling=null}}function dc(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,r=0;if(t)for(var i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags&14680064,r|=i.flags&14680064,i.return=e,i=i.sibling;else for(i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags,r|=i.flags,i.return=e,i=i.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function fc(e,t,n){var i=t.pendingProps;switch(xa(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return dc(t),null;case 1:return Qi(t.type)&&$i(),dc(t),null;case 3:return i=t.stateNode,go(),Gi(Yi),Gi(Ji),So(),i.pendingContext&&(i.context=i.pendingContext,i.pendingContext=null),(e===null||e.child===null)&&(ja(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,Ta!==null&&(wl(Ta),Ta=null))),dc(t),null;case 5:vo(t);var o=mo(po.current);if(n=t.type,e!==null&&t.stateNode!=null)cc(e,t,n,i,o),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!i){if(t.stateNode===null)throw Error(r(166));return dc(t),null}if(e=mo(uo.current),ja(t)){i=t.stateNode,n=t.type;var s=t.memoizedProps;switch(i[Mi]=t,i[Ni]=s,e=!!(t.mode&1),n){case`dialog`:ai(`cancel`,i),ai(`close`,i);break;case`iframe`:case`object`:case`embed`:ai(`load`,i);break;case`video`:case`audio`:for(o=0;o<ti.length;o++)ai(ti[o],i);break;case`source`:ai(`error`,i);break;case`img`:case`image`:case`link`:ai(`error`,i),ai(`load`,i);break;case`details`:ai(`toggle`,i);break;case`input`:ue(i,s),ai(`invalid`,i);break;case`select`:i._wrapperState={wasMultiple:!!s.multiple},ai(`invalid`,i);break;case`textarea`:ve(i,s),ai(`invalid`,i)}for(var c in je(n,s),o=null,s)if(s.hasOwnProperty(c)){var l=s[c];c===`children`?typeof l==`string`?i.textContent!==l&&(!0!==s.suppressHydrationWarning&&vi(i.textContent,l,e),o=[`children`,l]):typeof l==`number`&&i.textContent!==``+l&&(!0!==s.suppressHydrationWarning&&vi(i.textContent,l,e),o=[`children`,``+l]):a.hasOwnProperty(c)&&l!=null&&c===`onScroll`&&ai(`scroll`,i)}switch(n){case`input`:oe(i),pe(i,s,!0);break;case`textarea`:oe(i),be(i);break;case`select`:case`option`:break;default:typeof s.onClick==`function`&&(i.onclick=yi)}i=o,t.updateQueue=i,i!==null&&(t.flags|=4)}else{c=o.nodeType===9?o:o.ownerDocument,e===`http://www.w3.org/1999/xhtml`&&(e=xe(n)),e===`http://www.w3.org/1999/xhtml`?n===`script`?(e=c.createElement(`div`),e.innerHTML=`<script><\/script>`,e=e.removeChild(e.firstChild)):typeof i.is==`string`?e=c.createElement(n,{is:i.is}):(e=c.createElement(n),n===`select`&&(c=e,i.multiple?c.multiple=!0:i.size&&(c.size=i.size))):e=c.createElementNS(e,n),e[Mi]=t,e[Ni]=i,sc(e,t,!1,!1),t.stateNode=e;a:{switch(c=Me(n,i),n){case`dialog`:ai(`cancel`,e),ai(`close`,e),o=i;break;case`iframe`:case`object`:case`embed`:ai(`load`,e),o=i;break;case`video`:case`audio`:for(o=0;o<ti.length;o++)ai(ti[o],e);o=i;break;case`source`:ai(`error`,e),o=i;break;case`img`:case`image`:case`link`:ai(`error`,e),ai(`load`,e),o=i;break;case`details`:ai(`toggle`,e),o=i;break;case`input`:ue(e,i),o=le(e,i),ai(`invalid`,e);break;case`option`:o=i;break;case`select`:e._wrapperState={wasMultiple:!!i.multiple},o=R({},i,{value:void 0}),ai(`invalid`,e);break;case`textarea`:ve(e,i),o=_e(e,i),ai(`invalid`,e);break;default:o=i}for(s in je(n,o),l=o,l)if(l.hasOwnProperty(s)){var u=l[s];s===`style`?ke(e,u):s===`dangerouslySetInnerHTML`?(u=u?u.__html:void 0,u!=null&&we(e,u)):s===`children`?typeof u==`string`?(n!==`textarea`||u!==``)&&Te(e,u):typeof u==`number`&&Te(e,``+u):s!==`suppressContentEditableWarning`&&s!==`suppressHydrationWarning`&&s!==`autoFocus`&&(a.hasOwnProperty(s)?u!=null&&s===`onScroll`&&ai(`scroll`,e):u!=null&&x(e,s,u,c))}switch(n){case`input`:oe(e),pe(e,i,!1);break;case`textarea`:oe(e),be(e);break;case`option`:i.value!=null&&e.setAttribute(`value`,``+H(i.value));break;case`select`:e.multiple=!!i.multiple,s=i.value,s==null?i.defaultValue!=null&&ge(e,!!i.multiple,i.defaultValue,!0):ge(e,!!i.multiple,s,!1);break;default:typeof o.onClick==`function`&&(e.onclick=yi)}switch(n){case`button`:case`input`:case`select`:case`textarea`:i=!!i.autoFocus;break a;case`img`:i=!0;break a;default:i=!1}}i&&(t.flags|=4)}t.ref!==null&&(t.flags|=512,t.flags|=2097152)}return dc(t),null;case 6:if(e&&t.stateNode!=null)lc(e,t,e.memoizedProps,i);else{if(typeof i!=`string`&&t.stateNode===null)throw Error(r(166));if(n=mo(po.current),mo(uo.current),ja(t)){if(i=t.stateNode,n=t.memoizedProps,i[Mi]=t,(s=i.nodeValue!==n)&&(e=Sa,e!==null))switch(e.tag){case 3:vi(i.nodeValue,n,!!(e.mode&1));break;case 5:!0!==e.memoizedProps.suppressHydrationWarning&&vi(i.nodeValue,n,!!(e.mode&1))}s&&(t.flags|=4)}else i=(n.nodeType===9?n:n.ownerDocument).createTextNode(i),i[Mi]=t,t.stateNode=i}return dc(t),null;case 13:if(Gi(yo),i=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(wa&&Ca!==null&&t.mode&1&&!(t.flags&128))Ma(),Na(),t.flags|=98560,s=!1;else if(s=ja(t),i!==null&&i.dehydrated!==null){if(e===null){if(!s)throw Error(r(318));if(s=t.memoizedState,s=s===null?null:s.dehydrated,!s)throw Error(r(317));s[Mi]=t}else Na(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;dc(t),s=!1}else Ta!==null&&(wl(Ta),Ta=null),s=!0;if(!s)return t.flags&65536?t:null}return t.flags&128?(t.lanes=n,t):(i=i!==null,i!==(e!==null&&e.memoizedState!==null)&&i&&(t.child.flags|=8192,t.mode&1&&(e===null||yo.current&1?Qc===0&&(Qc=3):Pl())),t.updateQueue!==null&&(t.flags|=4),dc(t),null);case 4:return go(),e===null&&ci(t.stateNode.containerInfo),dc(t),null;case 10:return qa(t.type._context),dc(t),null;case 17:return Qi(t.type)&&$i(),dc(t),null;case 19:if(Gi(yo),s=t.memoizedState,s===null)return dc(t),null;if(i=!!(t.flags&128),c=s.rendering,c===null){if(i)uc(s,!1);else{if(Qc!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(c=bo(e),c!==null){for(t.flags|=128,uc(s,!1),i=c.updateQueue,i!==null&&(t.updateQueue=i,t.flags|=4),t.subtreeFlags=0,i=n,n=t.child;n!==null;)s=n,e=i,s.flags&=14680066,c=s.alternate,c===null?(s.childLanes=0,s.lanes=e,s.child=null,s.subtreeFlags=0,s.memoizedProps=null,s.memoizedState=null,s.updateQueue=null,s.dependencies=null,s.stateNode=null):(s.childLanes=c.childLanes,s.lanes=c.lanes,s.child=c.child,s.subtreeFlags=0,s.deletions=null,s.memoizedProps=c.memoizedProps,s.memoizedState=c.memoizedState,s.updateQueue=c.updateQueue,s.type=c.type,e=c.dependencies,s.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext}),n=n.sibling;return Ki(yo,yo.current&1|2),t.child}e=e.sibling}s.tail!==null&&ft()>ol&&(t.flags|=128,i=!0,uc(s,!1),t.lanes=4194304)}}else{if(!i){if(e=bo(c),e!==null){if(t.flags|=128,i=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),uc(s,!0),s.tail===null&&s.tailMode===`hidden`&&!c.alternate&&!wa)return dc(t),null}else 2*ft()-s.renderingStartTime>ol&&n!==1073741824&&(t.flags|=128,i=!0,uc(s,!1),t.lanes=4194304)}s.isBackwards?(c.sibling=t.child,t.child=c):(n=s.last,n===null?t.child=c:n.sibling=c,s.last=c)}return s.tail===null?(dc(t),null):(t=s.tail,s.rendering=t,s.tail=t.sibling,s.renderingStartTime=ft(),t.sibling=null,n=yo.current,Ki(yo,i?n&1|2:n&1),t);case 22:case 23:return Al(),i=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==i&&(t.flags|=8192),i&&t.mode&1?Xc&1073741824&&(dc(t),t.subtreeFlags&6&&(t.flags|=8192)):dc(t),null;case 24:return null;case 25:return null}throw Error(r(156,t.tag))}function pc(e,t){switch(xa(t),t.tag){case 1:return Qi(t.type)&&$i(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return go(),Gi(Yi),Gi(Ji),So(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return vo(t),null;case 13:if(Gi(yo),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(r(340));Na()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Gi(yo),null;case 4:return go(),null;case 10:return qa(t.type._context),null;case 22:case 23:return Al(),null;case 24:return null;default:return null}}var mc=!1,hc=!1,gc=typeof WeakSet==`function`?WeakSet:Set,K=null;function _c(e,t){var n=e.ref;if(n!==null){if(typeof n==`function`)try{n(null)}catch(n){Wl(e,t,n)}else n.current=null}}function vc(e,t,n){try{n()}catch(n){Wl(e,t,n)}}var yc=!1;function bc(e,t){if(bi=dn,e=Mr(),Nr(e)){if(`selectionStart`in e)var n={start:e.selectionStart,end:e.selectionEnd};else a:{n=(n=e.ownerDocument)&&n.defaultView||window;var i=n.getSelection&&n.getSelection();if(i&&i.rangeCount!==0){n=i.anchorNode;var a=i.anchorOffset,o=i.focusNode;i=i.focusOffset;try{n.nodeType,o.nodeType}catch{n=null;break a}var s=0,c=-1,l=-1,u=0,d=0,f=e,p=null;b:for(;;){for(var m;f!==n||a!==0&&f.nodeType!==3||(c=s+a),f!==o||i!==0&&f.nodeType!==3||(l=s+i),f.nodeType===3&&(s+=f.nodeValue.length),(m=f.firstChild)!==null;)p=f,f=m;for(;;){if(f===e)break b;if(p===n&&++u===a&&(c=s),p===o&&++d===i&&(l=s),(m=f.nextSibling)!==null)break;f=p,p=f.parentNode}f=m}n=c===-1||l===-1?null:{start:c,end:l}}else n=null}n||={start:0,end:0}}else n=null;for(xi={focusedElem:e,selectionRange:n},dn=!1,K=t;K!==null;)if(t=K,e=t.child,t.subtreeFlags&1028&&e!==null)e.return=t,K=e;else for(;K!==null;){t=K;try{var h=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(h!==null){var g=h.memoizedProps,_=h.memoizedState,v=t.stateNode;v.__reactInternalSnapshotBeforeUpdate=v.getSnapshotBeforeUpdate(t.elementType===t.type?g:bs(t.type,g),_)}break;case 3:var y=t.stateNode.containerInfo;y.nodeType===1?y.textContent=``:y.nodeType===9&&y.documentElement&&y.removeChild(y.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(r(163))}}catch(e){Wl(t,t.return,e)}if(e=t.sibling,e!==null){e.return=t.return,K=e;break}K=t.return}return h=yc,yc=!1,h}function xc(e,t,n){var r=t.updateQueue;if(r=r===null?null:r.lastEffect,r!==null){var i=r=r.next;do{if((i.tag&e)===e){var a=i.destroy;i.destroy=void 0,a!==void 0&&vc(t,n,a)}i=i.next}while(i!==r)}}function Sc(e,t){if(t=t.updateQueue,t=t===null?null:t.lastEffect,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function Cc(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t==`function`?t(e):t.current=e}}function wc(e){var t=e.alternate;t!==null&&(e.alternate=null,wc(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[Mi],delete t[Ni],delete t[Fi],delete t[Ii],delete t[Li])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function Tc(e){return e.tag===5||e.tag===3||e.tag===4}function Ec(e){a:for(;;){for(;e.sibling===null;){if(e.return===null||Tc(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue a;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Dc(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=yi));else if(r!==4&&(e=e.child,e!==null))for(Dc(e,t,n),e=e.sibling;e!==null;)Dc(e,t,n),e=e.sibling}function Oc(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(Oc(e,t,n),e=e.sibling;e!==null;)Oc(e,t,n),e=e.sibling}var kc=null,Ac=!1;function jc(e,t,n){for(n=n.child;n!==null;)Mc(e,t,n),n=n.sibling}function Mc(e,t,n){if(bt&&typeof bt.onCommitFiberUnmount==`function`)try{bt.onCommitFiberUnmount(yt,n)}catch{}switch(n.tag){case 5:hc||_c(n,t);case 6:var r=kc,i=Ac;kc=null,jc(e,t,n),kc=r,Ac=i,kc!==null&&(Ac?(e=kc,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):kc.removeChild(n.stateNode));break;case 18:kc!==null&&(Ac?(e=kc,n=n.stateNode,e.nodeType===8?Oi(e.parentNode,n):e.nodeType===1&&Oi(e,n),ln(e)):Oi(kc,n.stateNode));break;case 4:r=kc,i=Ac,kc=n.stateNode.containerInfo,Ac=!0,jc(e,t,n),kc=r,Ac=i;break;case 0:case 11:case 14:case 15:if(!hc&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){i=r=r.next;do{var a=i,o=a.destroy;a=a.tag,o!==void 0&&(a&2||a&4)&&vc(n,t,o),i=i.next}while(i!==r)}jc(e,t,n);break;case 1:if(!hc&&(_c(n,t),r=n.stateNode,typeof r.componentWillUnmount==`function`))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(e){Wl(n,t,e)}jc(e,t,n);break;case 21:jc(e,t,n);break;case 22:n.mode&1?(hc=(r=hc)||n.memoizedState!==null,jc(e,t,n),hc=r):jc(e,t,n);break;default:jc(e,t,n)}}function Nc(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new gc),t.forEach(function(t){var r=Jl.bind(null,e,t);n.has(t)||(n.add(t),t.then(r,r))})}}function Pc(e,t){var n=t.deletions;if(n!==null)for(var i=0;i<n.length;i++){var a=n[i];try{var o=e,s=t,c=s;a:for(;c!==null;){switch(c.tag){case 5:kc=c.stateNode,Ac=!1;break a;case 3:kc=c.stateNode.containerInfo,Ac=!0;break a;case 4:kc=c.stateNode.containerInfo,Ac=!0;break a}c=c.return}if(kc===null)throw Error(r(160));Mc(o,s,a),kc=null,Ac=!1;var l=a.alternate;l!==null&&(l.return=null),a.return=null}catch(e){Wl(a,t,e)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)Fc(t,e),t=t.sibling}function Fc(e,t){var n=e.alternate,i=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(Pc(t,e),Ic(e),i&4){try{xc(3,e,e.return),Sc(3,e)}catch(t){Wl(e,e.return,t)}try{xc(5,e,e.return)}catch(t){Wl(e,e.return,t)}}break;case 1:Pc(t,e),Ic(e),i&512&&n!==null&&_c(n,n.return);break;case 5:if(Pc(t,e),Ic(e),i&512&&n!==null&&_c(n,n.return),e.flags&32){var a=e.stateNode;try{Te(a,``)}catch(t){Wl(e,e.return,t)}}if(i&4&&(a=e.stateNode,a!=null)){var o=e.memoizedProps,s=n===null?o:n.memoizedProps,c=e.type,l=e.updateQueue;if(e.updateQueue=null,l!==null)try{c===`input`&&o.type===`radio`&&o.name!=null&&de(a,o),Me(c,s);var u=Me(c,o);for(s=0;s<l.length;s+=2){var d=l[s],f=l[s+1];d===`style`?ke(a,f):d===`dangerouslySetInnerHTML`?we(a,f):d===`children`?Te(a,f):x(a,d,f,u)}switch(c){case`input`:fe(a,o);break;case`textarea`:ye(a,o);break;case`select`:var p=a._wrapperState.wasMultiple;a._wrapperState.wasMultiple=!!o.multiple;var m=o.value;m==null?p!==!!o.multiple&&(o.defaultValue==null?ge(a,!!o.multiple,o.multiple?[]:``,!1):ge(a,!!o.multiple,o.defaultValue,!0)):ge(a,!!o.multiple,m,!1)}a[Ni]=o}catch(t){Wl(e,e.return,t)}}break;case 6:if(Pc(t,e),Ic(e),i&4){if(e.stateNode===null)throw Error(r(162));a=e.stateNode,o=e.memoizedProps;try{a.nodeValue=o}catch(t){Wl(e,e.return,t)}}break;case 3:if(Pc(t,e),Ic(e),i&4&&n!==null&&n.memoizedState.isDehydrated)try{ln(t.containerInfo)}catch(t){Wl(e,e.return,t)}break;case 4:Pc(t,e),Ic(e);break;case 13:Pc(t,e),Ic(e),a=e.child,a.flags&8192&&(o=a.memoizedState!==null,a.stateNode.isHidden=o,!o||a.alternate!==null&&a.alternate.memoizedState!==null||(al=ft())),i&4&&Nc(e);break;case 22:if(d=n!==null&&n.memoizedState!==null,e.mode&1?(hc=(u=hc)||d,Pc(t,e),hc=u):Pc(t,e),Ic(e),i&8192){if(u=e.memoizedState!==null,(e.stateNode.isHidden=u)&&!d&&e.mode&1)for(K=e,d=e.child;d!==null;){for(f=K=d;K!==null;){switch(p=K,m=p.child,p.tag){case 0:case 11:case 14:case 15:xc(4,p,p.return);break;case 1:_c(p,p.return);var h=p.stateNode;if(typeof h.componentWillUnmount==`function`){i=p,n=p.return;try{t=i,h.props=t.memoizedProps,h.state=t.memoizedState,h.componentWillUnmount()}catch(e){Wl(i,n,e)}}break;case 5:_c(p,p.return);break;case 22:if(p.memoizedState!==null){Bc(f);continue}}m===null?Bc(f):(m.return=p,K=m)}d=d.sibling}a:for(d=null,f=e;;){if(f.tag===5){if(d===null){d=f;try{a=f.stateNode,u?(o=a.style,typeof o.setProperty==`function`?o.setProperty(`display`,`none`,`important`):o.display=`none`):(c=f.stateNode,l=f.memoizedProps.style,s=l!=null&&l.hasOwnProperty(`display`)?l.display:null,c.style.display=Oe(`display`,s))}catch(t){Wl(e,e.return,t)}}}else if(f.tag===6){if(d===null)try{f.stateNode.nodeValue=u?``:f.memoizedProps}catch(t){Wl(e,e.return,t)}}else if((f.tag!==22&&f.tag!==23||f.memoizedState===null||f===e)&&f.child!==null){f.child.return=f,f=f.child;continue}if(f===e)break a;for(;f.sibling===null;){if(f.return===null||f.return===e)break a;d===f&&(d=null),f=f.return}d===f&&(d=null),f.sibling.return=f.return,f=f.sibling}}break;case 19:Pc(t,e),Ic(e),i&4&&Nc(e);break;case 21:break;default:Pc(t,e),Ic(e)}}function Ic(e){var t=e.flags;if(t&2){try{a:{for(var n=e.return;n!==null;){if(Tc(n)){var i=n;break a}n=n.return}throw Error(r(160))}switch(i.tag){case 5:var a=i.stateNode;i.flags&32&&(Te(a,``),i.flags&=-33),Oc(e,Ec(e),a);break;case 3:case 4:var o=i.stateNode.containerInfo;Dc(e,Ec(e),o);break;default:throw Error(r(161))}}catch(t){Wl(e,e.return,t)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function Lc(e,t,n){K=e,Rc(e,t,n)}function Rc(e,t,n){for(var r=!!(e.mode&1);K!==null;){var i=K,a=i.child;if(i.tag===22&&r){var o=i.memoizedState!==null||mc;if(!o){var s=i.alternate,c=s!==null&&s.memoizedState!==null||hc;s=mc;var l=hc;if(mc=o,(hc=c)&&!l)for(K=i;K!==null;)o=K,c=o.child,o.tag===22&&o.memoizedState!==null||c===null?Vc(i):(c.return=o,K=c);for(;a!==null;)K=a,Rc(a,t,n),a=a.sibling;K=i,mc=s,hc=l}zc(e,t,n)}else i.subtreeFlags&8772&&a!==null?(a.return=i,K=a):zc(e,t,n)}}function zc(e){for(;K!==null;){var t=K;if(t.flags&8772){var n=t.alternate;try{if(t.flags&8772)switch(t.tag){case 0:case 11:case 15:hc||Sc(5,t);break;case 1:var i=t.stateNode;if(t.flags&4&&!hc){if(n===null)i.componentDidMount();else{var a=t.elementType===t.type?n.memoizedProps:bs(t.type,n.memoizedProps);i.componentDidUpdate(a,n.memoizedState,i.__reactInternalSnapshotBeforeUpdate)}}var o=t.updateQueue;o!==null&&co(t,o,i);break;case 3:var s=t.updateQueue;if(s!==null){if(n=null,t.child!==null)switch(t.child.tag){case 5:n=t.child.stateNode;break;case 1:n=t.child.stateNode}co(t,s,n)}break;case 5:var c=t.stateNode;if(n===null&&t.flags&4){n=c;var l=t.memoizedProps;switch(t.type){case`button`:case`input`:case`select`:case`textarea`:l.autoFocus&&n.focus();break;case`img`:l.src&&(n.src=l.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(t.memoizedState===null){var u=t.alternate;if(u!==null){var d=u.memoizedState;if(d!==null){var f=d.dehydrated;f!==null&&ln(f)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(r(163))}hc||t.flags&512&&Cc(t)}catch(e){Wl(t,t.return,e)}}if(t===e){K=null;break}if(n=t.sibling,n!==null){n.return=t.return,K=n;break}K=t.return}}function Bc(e){for(;K!==null;){var t=K;if(t===e){K=null;break}var n=t.sibling;if(n!==null){n.return=t.return,K=n;break}K=t.return}}function Vc(e){for(;K!==null;){var t=K;try{switch(t.tag){case 0:case 11:case 15:var n=t.return;try{Sc(4,t)}catch(e){Wl(t,n,e)}break;case 1:var r=t.stateNode;if(typeof r.componentDidMount==`function`){var i=t.return;try{r.componentDidMount()}catch(e){Wl(t,i,e)}}var a=t.return;try{Cc(t)}catch(e){Wl(t,a,e)}break;case 5:var o=t.return;try{Cc(t)}catch(e){Wl(t,o,e)}}}catch(e){Wl(t,t.return,e)}if(t===e){K=null;break}var s=t.sibling;if(s!==null){s.return=t.return,K=s;break}K=t.return}}var Hc=Math.ceil,Uc=S.ReactCurrentDispatcher,Wc=S.ReactCurrentOwner,Gc=S.ReactCurrentBatchConfig,Kc=0,qc=null,Jc=null,Yc=0,Xc=0,Zc=Wi(0),Qc=0,$c=null,el=0,tl=0,nl=0,rl=null,il=null,al=0,ol=1/0,sl=null,cl=!1,ll=null,ul=null,dl=!1,fl=null,pl=0,ml=0,hl=null,gl=-1,_l=0;function vl(){return Kc&6?ft():gl===-1?gl=ft():gl}function yl(e){return e.mode&1?Kc&2&&Yc!==0?Yc&-Yc:Fa.transition===null?(e=Rt,e===0?(e=window.event,e=e===void 0?16:_n(e.type),e):e):(_l===0&&(_l=Nt()),_l):1}function bl(e,t,n,i){if(50<ml)throw ml=0,hl=null,Error(r(185));Ft(e,n,i),(!(Kc&2)||e!==qc)&&(e===qc&&(!(Kc&2)&&(tl|=n),Qc===4&&El(e,Yc)),xl(e,i),n===1&&Kc===0&&!(t.mode&1)&&(ol=ft()+500,aa&&la()))}function xl(e,t){var n=e.callbackNode;jt(e,t);var r=kt(e,e===qc?Yc:0);if(r===0)n!==null&&lt(n),e.callbackNode=null,e.callbackPriority=0;else if(t=r&-r,e.callbackPriority!==t){if(n!=null&&lt(n),t===1)e.tag===0?ca(Dl.bind(null,e)):sa(Dl.bind(null,e)),Ei(function(){!(Kc&6)&&la()}),n=null;else{switch(zt(r)){case 1:n=mt;break;case 4:n=ht;break;case 16:n=gt;break;case 536870912:n=vt;break;default:n=gt}n=Xl(n,Sl.bind(null,e))}e.callbackPriority=t,e.callbackNode=n}}function Sl(e,t){if(gl=-1,_l=0,Kc&6)throw Error(r(327));var n=e.callbackNode;if(Hl()&&e.callbackNode!==n)return null;var i=kt(e,e===qc?Yc:0);if(i===0)return null;if(i&30||(i&e.expiredLanes)!==0||t)t=Fl(e,i);else{t=i;var a=Kc;Kc|=2;var o=Nl();(qc!==e||Yc!==t)&&(sl=null,ol=ft()+500,jl(e,t));do try{Ll();break}catch(t){Ml(e,t)}while(1);Ka(),Uc.current=o,Kc=a,Jc===null?(qc=null,Yc=0,t=Qc):t=0}if(t!==0){if(t===2&&(a=Mt(e),a!==0&&(i=a,t=Cl(e,a))),t===1)throw n=$c,jl(e,0),El(e,i),xl(e,ft()),n;if(t===6)El(e,i);else{if(a=e.current.alternate,!(i&30)&&!Tl(a)&&(t=Fl(e,i),t===2&&(o=Mt(e),o!==0&&(i=o,t=Cl(e,o))),t===1))throw n=$c,jl(e,0),El(e,i),xl(e,ft()),n;switch(e.finishedWork=a,e.finishedLanes=i,t){case 0:case 1:throw Error(r(345));case 2:Bl(e,il,sl);break;case 3:if(El(e,i),(i&130023424)===i&&(t=al+500-ft(),10<t)){if(kt(e,0)!==0)break;if(a=e.suspendedLanes,(a&i)!==i){vl(),e.pingedLanes|=e.suspendedLanes&a;break}e.timeoutHandle=Ci(Bl.bind(null,e,il,sl),t);break}Bl(e,il,sl);break;case 4:if(El(e,i),(i&4194240)===i)break;for(t=e.eventTimes,a=-1;0<i;){var s=31-St(i);o=1<<s,s=t[s],s>a&&(a=s),i&=~o}if(i=a,i=ft()-i,i=(120>i?120:480>i?480:1080>i?1080:1920>i?1920:3e3>i?3e3:4320>i?4320:1960*Hc(i/1960))-i,10<i){e.timeoutHandle=Ci(Bl.bind(null,e,il,sl),i);break}Bl(e,il,sl);break;case 5:Bl(e,il,sl);break;default:throw Error(r(329))}}}return xl(e,ft()),e.callbackNode===n?Sl.bind(null,e):null}function Cl(e,t){var n=rl;return e.current.memoizedState.isDehydrated&&(jl(e,t).flags|=256),e=Fl(e,t),e!==2&&(t=il,il=n,t!==null&&wl(t)),e}function wl(e){il===null?il=e:il.push.apply(il,e)}function Tl(e){for(var t=e;;){if(t.flags&16384){var n=t.updateQueue;if(n!==null&&(n=n.stores,n!==null))for(var r=0;r<n.length;r++){var i=n[r],a=i.getSnapshot;i=i.value;try{if(!Dr(a(),i))return!1}catch{return!1}}}if(n=t.child,t.subtreeFlags&16384&&n!==null)n.return=t,t=n;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function El(e,t){for(t&=~nl,t&=~tl,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var n=31-St(t),r=1<<n;e[n]=-1,t&=~r}}function Dl(e){if(Kc&6)throw Error(r(327));Hl();var t=kt(e,0);if(!(t&1))return xl(e,ft()),null;var n=Fl(e,t);if(e.tag!==0&&n===2){var i=Mt(e);i!==0&&(t=i,n=Cl(e,i))}if(n===1)throw n=$c,jl(e,0),El(e,t),xl(e,ft()),n;if(n===6)throw Error(r(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,Bl(e,il,sl),xl(e,ft()),null}function Ol(e,t){var n=Kc;Kc|=1;try{return e(t)}finally{Kc=n,Kc===0&&(ol=ft()+500,aa&&la())}}function kl(e){fl!==null&&fl.tag===0&&!(Kc&6)&&Hl();var t=Kc;Kc|=1;var n=Gc.transition,r=Rt;try{if(Gc.transition=null,Rt=1,e)return e()}finally{Rt=r,Gc.transition=n,Kc=t,!(Kc&6)&&la()}}function Al(){Xc=Zc.current,Gi(Zc)}function jl(e,t){e.finishedWork=null,e.finishedLanes=0;var n=e.timeoutHandle;if(n!==-1&&(e.timeoutHandle=-1,wi(n)),Jc!==null)for(n=Jc.return;n!==null;){var r=n;switch(xa(r),r.tag){case 1:r=r.type.childContextTypes,r!=null&&$i();break;case 3:go(),Gi(Yi),Gi(Ji),So();break;case 5:vo(r);break;case 4:go();break;case 13:Gi(yo);break;case 19:Gi(yo);break;case 10:qa(r.type._context);break;case 22:case 23:Al()}n=n.return}if(qc=e,Jc=e=tu(e.current,null),Yc=Xc=t,Qc=0,$c=null,nl=tl=el=0,il=rl=null,Za!==null){for(t=0;t<Za.length;t++)if(n=Za[t],r=n.interleaved,r!==null){n.interleaved=null;var i=r.next,a=n.pending;if(a!==null){var o=a.next;a.next=i,r.next=o}n.pending=r}Za=null}return e}function Ml(e,t){do{var n=Jc;try{if(Ka(),Co.current=gs,ko){for(var i=Eo.memoizedState;i!==null;){var a=i.queue;a!==null&&(a.pending=null),i=i.next}ko=!1}if(To=0,Oo=Do=Eo=null,Ao=!1,jo=0,Wc.current=null,n===null||n.return===null){Qc=1,$c=t,Jc=null;break}a:{var o=e,s=n.return,c=n,l=t;if(t=Yc,c.flags|=32768,typeof l==`object`&&l&&typeof l.then==`function`){var u=l,d=c,f=d.tag;if(!(d.mode&1)&&(f===0||f===11||f===15)){var p=d.alternate;p?(d.updateQueue=p.updateQueue,d.memoizedState=p.memoizedState,d.lanes=p.lanes):(d.updateQueue=null,d.memoizedState=null)}var m=Ps(s);if(m!==null){m.flags&=-257,Fs(m,s,c,o,t),m.mode&1&&Ns(o,u,t),t=m,l=u;var h=t.updateQueue;if(h===null){var g=new Set;g.add(l),t.updateQueue=g}else h.add(l);break a}if(!(t&1)){Ns(o,u,t),Pl();break a}l=Error(r(426))}else if(wa&&c.mode&1){var _=Ps(s);if(_!==null){!(_.flags&65536)&&(_.flags|=256),Fs(_,s,c,o,t),Pa(Ds(l,c));break a}}o=l=Ds(l,c),Qc!==4&&(Qc=2),rl===null?rl=[o]:rl.push(o),o=s;do{switch(o.tag){case 3:o.flags|=65536,t&=-t,o.lanes|=t;var v=js(o,l,t);oo(o,v);break a;case 1:c=l;var y=o.type,b=o.stateNode;if(!(o.flags&128)&&(typeof y.getDerivedStateFromError==`function`||b!==null&&typeof b.componentDidCatch==`function`&&(ul===null||!ul.has(b)))){o.flags|=65536,t&=-t,o.lanes|=t;var x=Ms(o,c,t);oo(o,x);break a}}o=o.return}while(o!==null)}zl(n)}catch(e){t=e,Jc===n&&n!==null&&(Jc=n=n.return);continue}break}while(1)}function Nl(){var e=Uc.current;return Uc.current=gs,e===null?gs:e}function Pl(){(Qc===0||Qc===3||Qc===2)&&(Qc=4),qc===null||!(el&268435455)&&!(tl&268435455)||El(qc,Yc)}function Fl(e,t){var n=Kc;Kc|=2;var i=Nl();(qc!==e||Yc!==t)&&(sl=null,jl(e,t));do try{Il();break}catch(t){Ml(e,t)}while(1);if(Ka(),Kc=n,Uc.current=i,Jc!==null)throw Error(r(261));return qc=null,Yc=0,Qc}function Il(){for(;Jc!==null;)Rl(Jc)}function Ll(){for(;Jc!==null&&!ut();)Rl(Jc)}function Rl(e){var t=Yl(e.alternate,e,Xc);e.memoizedProps=e.pendingProps,t===null?zl(e):Jc=t,Wc.current=null}function zl(e){var t=e;do{var n=t.alternate;if(e=t.return,t.flags&32768){if(n=pc(n,t),n!==null){n.flags&=32767,Jc=n;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{Qc=6,Jc=null;return}}else if(n=fc(n,t,Xc),n!==null){Jc=n;return}if(t=t.sibling,t!==null){Jc=t;return}Jc=t=e}while(t!==null);Qc===0&&(Qc=5)}function Bl(e,t,n){var r=Rt,i=Gc.transition;try{Gc.transition=null,Rt=1,Vl(e,t,n,r)}finally{Gc.transition=i,Rt=r}return null}function Vl(e,t,n,i){do Hl();while(fl!==null);if(Kc&6)throw Error(r(327));n=e.finishedWork;var a=e.finishedLanes;if(n===null)return null;if(e.finishedWork=null,e.finishedLanes=0,n===e.current)throw Error(r(177));e.callbackNode=null,e.callbackPriority=0;var o=n.lanes|n.childLanes;if(It(e,o),e===qc&&(Jc=qc=null,Yc=0),!(n.subtreeFlags&2064)&&!(n.flags&2064)||dl||(dl=!0,Xl(gt,function(){return Hl(),null})),o=!!(n.flags&15990),n.subtreeFlags&15990||o){o=Gc.transition,Gc.transition=null;var s=Rt;Rt=1;var c=Kc;Kc|=4,Wc.current=null,bc(e,n),Fc(n,e),Pr(xi),dn=!!bi,xi=bi=null,e.current=n,Lc(n,e,a),dt(),Kc=c,Rt=s,Gc.transition=o}else e.current=n;if(dl&&(dl=!1,fl=e,pl=a),o=e.pendingLanes,o===0&&(ul=null),xt(n.stateNode,i),xl(e,ft()),t!==null)for(i=e.onRecoverableError,n=0;n<t.length;n++)a=t[n],i(a.value,{componentStack:a.stack,digest:a.digest});if(cl)throw cl=!1,e=ll,ll=null,e;return pl&1&&e.tag!==0&&Hl(),o=e.pendingLanes,o&1?e===hl?ml++:(ml=0,hl=e):ml=0,la(),null}function Hl(){if(fl!==null){var e=zt(pl),t=Gc.transition,n=Rt;try{if(Gc.transition=null,Rt=16>e?16:e,fl===null)var i=!1;else{if(e=fl,fl=null,pl=0,Kc&6)throw Error(r(331));var a=Kc;for(Kc|=4,K=e.current;K!==null;){var o=K,s=o.child;if(K.flags&16){var c=o.deletions;if(c!==null){for(var l=0;l<c.length;l++){var u=c[l];for(K=u;K!==null;){var d=K;switch(d.tag){case 0:case 11:case 15:xc(8,d,o)}var f=d.child;if(f!==null)f.return=d,K=f;else for(;K!==null;){d=K;var p=d.sibling,m=d.return;if(wc(d),d===u){K=null;break}if(p!==null){p.return=m,K=p;break}K=m}}}var h=o.alternate;if(h!==null){var g=h.child;if(g!==null){h.child=null;do{var _=g.sibling;g.sibling=null,g=_}while(g!==null)}}K=o}}if(o.subtreeFlags&2064&&s!==null)s.return=o,K=s;else b:for(;K!==null;){if(o=K,o.flags&2048)switch(o.tag){case 0:case 11:case 15:xc(9,o,o.return)}var v=o.sibling;if(v!==null){v.return=o.return,K=v;break b}K=o.return}}var y=e.current;for(K=y;K!==null;){s=K;var b=s.child;if(s.subtreeFlags&2064&&b!==null)b.return=s,K=b;else b:for(s=y;K!==null;){if(c=K,c.flags&2048)try{switch(c.tag){case 0:case 11:case 15:Sc(9,c)}}catch(e){Wl(c,c.return,e)}if(c===s){K=null;break b}var x=c.sibling;if(x!==null){x.return=c.return,K=x;break b}K=c.return}}if(Kc=a,la(),bt&&typeof bt.onPostCommitFiberRoot==`function`)try{bt.onPostCommitFiberRoot(yt,e)}catch{}i=!0}return i}finally{Rt=n,Gc.transition=t}}return!1}function Ul(e,t,n){t=Ds(n,t),t=js(e,t,1),e=io(e,t,1),t=vl(),e!==null&&(Ft(e,1,t),xl(e,t))}function Wl(e,t,n){if(e.tag===3)Ul(e,e,n);else for(;t!==null;){if(t.tag===3){Ul(t,e,n);break}if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError==`function`||typeof r.componentDidCatch==`function`&&(ul===null||!ul.has(r))){e=Ds(n,e),e=Ms(t,e,1),t=io(t,e,1),e=vl(),t!==null&&(Ft(t,1,e),xl(t,e));break}}t=t.return}}function Gl(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),t=vl(),e.pingedLanes|=e.suspendedLanes&n,qc===e&&(Yc&n)===n&&(Qc===4||Qc===3&&(Yc&130023424)===Yc&&500>ft()-al?jl(e,0):nl|=n),xl(e,t)}function Kl(e,t){t===0&&(e.mode&1?(t=Dt,Dt<<=1,!(Dt&130023424)&&(Dt=4194304)):t=1);var n=vl();e=eo(e,t),e!==null&&(Ft(e,t,n),xl(e,n))}function ql(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Kl(e,n)}function Jl(e,t){var n=0;switch(e.tag){case 13:var i=e.stateNode,a=e.memoizedState;a!==null&&(n=a.retryLane);break;case 19:i=e.stateNode;break;default:throw Error(r(314))}i!==null&&i.delete(t),Kl(e,n)}var Yl=function(e,t,n){if(e!==null){if(e.memoizedProps!==t.pendingProps||Yi.current)Ls=!0;else{if((e.lanes&n)===0&&!(t.flags&128))return Ls=!1,oc(e,t,n);Ls=!!(e.flags&131072)}}else Ls=!1,wa&&t.flags&1048576&&ya(t,pa,t.index);switch(t.lanes=0,t.tag){case 2:var i=t.type;ic(e,t),e=t.pendingProps;var a=Zi(t,Ji.current);Ya(t,n),a=Fo(null,t,i,e,a,n);var o=Io();return t.flags|=1,typeof a==`object`&&a&&typeof a.render==`function`&&a.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,Qi(i)?(o=!0,na(t)):o=!1,t.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,to(t),a.updater=Ss,t.stateNode=a,a._reactInternals=t,Es(t,i,e,n),t=Ks(null,t,i,!0,o,n)):(t.tag=0,wa&&o&&ba(t),Rs(null,t,a,n),t=t.child),t;case 16:i=t.elementType;a:{switch(ic(e,t),e=t.pendingProps,a=i._init,i=a(i._payload),t.type=i,a=t.tag=eu(i),e=bs(i,e),a){case 0:t=Ws(null,t,i,e,n);break a;case 1:t=Gs(null,t,i,e,n);break a;case 11:t=zs(null,t,i,e,n);break a;case 14:t=Bs(null,t,i,bs(i.type,e),n);break a}throw Error(r(306,i,``))}return t;case 0:return i=t.type,a=t.pendingProps,a=t.elementType===i?a:bs(i,a),Ws(e,t,i,a,n);case 1:return i=t.type,a=t.pendingProps,a=t.elementType===i?a:bs(i,a),Gs(e,t,i,a,n);case 3:a:{if(qs(t),e===null)throw Error(r(387));i=t.pendingProps,o=t.memoizedState,a=o.element,no(e,t),so(t,i,null,n);var s=t.memoizedState;if(i=s.element,o.isDehydrated){if(o={element:i,isDehydrated:!1,cache:s.cache,pendingSuspenseBoundaries:s.pendingSuspenseBoundaries,transitions:s.transitions},t.updateQueue.baseState=o,t.memoizedState=o,t.flags&256){a=Ds(Error(r(423)),t),t=Js(e,t,i,n,a);break a}if(i!==a){a=Ds(Error(r(424)),t),t=Js(e,t,i,n,a);break a}for(Ca=ki(t.stateNode.containerInfo.firstChild),Sa=t,wa=!0,Ta=null,n=Va(t,null,i,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling}else{if(Na(),i===a){t=ac(e,t,n);break a}Rs(e,t,i,n)}t=t.child}return t;case 5:return _o(t),e===null&&ka(t),i=t.type,a=t.pendingProps,o=e===null?null:e.memoizedProps,s=a.children,Si(i,a)?s=null:o!==null&&Si(i,o)&&(t.flags|=32),Us(e,t),Rs(e,t,s,n),t.child;case 6:return e===null&&ka(t),null;case 13:return Zs(e,t,n);case 4:return ho(t,t.stateNode.containerInfo),i=t.pendingProps,e===null?t.child=Ba(t,null,i,n):Rs(e,t,i,n),t.child;case 11:return i=t.type,a=t.pendingProps,a=t.elementType===i?a:bs(i,a),zs(e,t,i,a,n);case 7:return Rs(e,t,t.pendingProps,n),t.child;case 8:return Rs(e,t,t.pendingProps.children,n),t.child;case 12:return Rs(e,t,t.pendingProps.children,n),t.child;case 10:a:{if(i=t.type._context,a=t.pendingProps,o=t.memoizedProps,s=a.value,Ki(Ha,i._currentValue),i._currentValue=s,o!==null){if(Dr(o.value,s)){if(o.children===a.children&&!Yi.current){t=ac(e,t,n);break a}}else for(o=t.child,o!==null&&(o.return=t);o!==null;){var c=o.dependencies;if(c!==null){s=o.child;for(var l=c.firstContext;l!==null;){if(l.context===i){if(o.tag===1){l=ro(-1,n&-n),l.tag=2;var u=o.updateQueue;if(u!==null){u=u.shared;var d=u.pending;d===null?l.next=l:(l.next=d.next,d.next=l),u.pending=l}}o.lanes|=n,l=o.alternate,l!==null&&(l.lanes|=n),Ja(o.return,n,t),c.lanes|=n;break}l=l.next}}else if(o.tag===10)s=o.type===t.type?null:o.child;else if(o.tag===18){if(s=o.return,s===null)throw Error(r(341));s.lanes|=n,c=s.alternate,c!==null&&(c.lanes|=n),Ja(s,n,t),s=o.sibling}else s=o.child;if(s!==null)s.return=o;else for(s=o;s!==null;){if(s===t){s=null;break}if(o=s.sibling,o!==null){o.return=s.return,s=o;break}s=s.return}o=s}}Rs(e,t,a.children,n),t=t.child}return t;case 9:return a=t.type,i=t.pendingProps.children,Ya(t,n),a=Xa(a),i=i(a),t.flags|=1,Rs(e,t,i,n),t.child;case 14:return i=t.type,a=bs(i,t.pendingProps),a=bs(i.type,a),Bs(e,t,i,a,n);case 15:return Vs(e,t,t.type,t.pendingProps,n);case 17:return i=t.type,a=t.pendingProps,a=t.elementType===i?a:bs(i,a),ic(e,t),t.tag=1,Qi(i)?(e=!0,na(t)):e=!1,Ya(t,n),ws(t,i,a),Es(t,i,a,n),Ks(null,t,i,!0,e,n);case 19:return rc(e,t,n);case 22:return Hs(e,t,n)}throw Error(r(156,t.tag))};function Xl(e,t){return ct(e,t)}function Zl(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Ql(e,t,n,r){return new Zl(e,t,n,r)}function $l(e){return e=e.prototype,!(!e||!e.isReactComponent)}function eu(e){if(typeof e==`function`)return+!!$l(e);if(e!=null){if(e=e.$$typeof,e===A)return 11;if(e===N)return 14}return 2}function tu(e,t){var n=e.alternate;return n===null?(n=Ql(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function nu(e,t,n,i,a,o){var s=2;if(i=e,typeof e==`function`)$l(e)&&(s=1);else if(typeof e==`string`)s=5;else a:switch(e){case T:return ru(n.children,a,o,t);case E:s=8,a|=8;break;case D:return e=Ql(12,n,t,a|2),e.elementType=D,e.lanes=o,e;case j:return e=Ql(13,n,t,a),e.elementType=j,e.lanes=o,e;case M:return e=Ql(19,n,t,a),e.elementType=M,e.lanes=o,e;case F:return iu(n,a,o,t);default:if(typeof e==`object`&&e)switch(e.$$typeof){case O:s=10;break a;case k:s=9;break a;case A:s=11;break a;case N:s=14;break a;case P:s=16,i=null;break a}throw Error(r(130,e==null?e:typeof e,``))}return t=Ql(s,n,t,a),t.elementType=e,t.type=i,t.lanes=o,t}function ru(e,t,n,r){return e=Ql(7,e,r,t),e.lanes=n,e}function iu(e,t,n,r){return e=Ql(22,e,r,t),e.elementType=F,e.lanes=n,e.stateNode={isHidden:!1},e}function au(e,t,n){return e=Ql(6,e,null,t),e.lanes=n,e}function ou(e,t,n){return t=Ql(4,e.children===null?[]:e.children,e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function su(e,t,n,r,i){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Pt(0),this.expirationTimes=Pt(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Pt(0),this.identifierPrefix=r,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function cu(e,t,n,r,i,a,o,s,c){return e=new su(e,t,n,s,c),t===1?(t=1,!0===a&&(t|=8)):t=0,a=Ql(3,null,null,t),e.current=a,a.stateNode=e,a.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},to(a),e}function lu(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:w,key:r==null?null:``+r,children:e,containerInfo:t,implementation:n}}function uu(e){if(!e)return qi;e=e._reactInternals;a:{if(nt(e)!==e||e.tag!==1)throw Error(r(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break a;case 1:if(Qi(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break a}}t=t.return}while(t!==null);throw Error(r(171))}if(e.tag===1){var n=e.type;if(Qi(n))return ta(e,n,t)}return t}function du(e,t,n,r,i,a,o,s,c){return e=cu(n,r,!0,e,i,a,o,s,c),e.context=uu(null),n=e.current,r=vl(),i=yl(n),a=ro(r,i),a.callback=t??null,io(n,a,i),e.current.lanes=i,Ft(e,i,r),xl(e,r),e}function fu(e,t,n,r){var i=t.current,a=vl(),o=yl(i);return n=uu(n),t.context===null?t.context=n:t.pendingContext=n,t=ro(a,o),t.payload={element:e},r=r===void 0?null:r,r!==null&&(t.callback=r),e=io(i,t,o),e!==null&&(bl(e,i,o,a),ao(e,i,o)),o}function pu(e){if(e=e.current,!e.child)return null;switch(e.child.tag){case 5:return e.child.stateNode;default:return e.child.stateNode}}function mu(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function hu(e,t){mu(e,t),(e=e.alternate)&&mu(e,t)}function gu(){return null}var _u=typeof reportError==`function`?reportError:function(e){console.error(e)};function vu(e){this._internalRoot=e}yu.prototype.render=vu.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(r(409));fu(e,t,null,null)},yu.prototype.unmount=vu.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;kl(function(){fu(null,e,null,null)}),t[Pi]=null}};function yu(e){this._internalRoot=e}yu.prototype.unstable_scheduleHydration=function(e){if(e){var t=Ut();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Qt.length&&t!==0&&t<Qt[n].priority;n++);Qt.splice(n,0,e),n===0&&rn(e)}};function bu(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function xu(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==` react-mount-point-unstable `))}function Su(){}function Cu(e,t,n,r,i){if(i){if(typeof r==`function`){var a=r;r=function(){var e=pu(o);a.call(e)}}var o=du(t,r,e,0,null,!1,!1,``,Su);return e._reactRootContainer=o,e[Pi]=o.current,ci(e.nodeType===8?e.parentNode:e),kl(),o}for(;i=e.lastChild;)e.removeChild(i);if(typeof r==`function`){var s=r;r=function(){var e=pu(c);s.call(e)}}var c=cu(e,0,!1,null,null,!1,!1,``,Su);return e._reactRootContainer=c,e[Pi]=c.current,ci(e.nodeType===8?e.parentNode:e),kl(function(){fu(t,c,n,r)}),c}function wu(e,t,n,r,i){var a=n._reactRootContainer;if(a){var o=a;if(typeof i==`function`){var s=i;i=function(){var e=pu(o);s.call(e)}}fu(t,o,e,i)}else o=Cu(n,t,e,i,r);return pu(o)}Bt=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var n=Ot(t.pendingLanes);n!==0&&(Lt(t,n|1),xl(t,ft()),!(Kc&6)&&(ol=ft()+500,la()))}break;case 13:kl(function(){var t=eo(e,1);t!==null&&bl(t,e,1,vl())}),hu(e,1)}},Vt=function(e){if(e.tag===13){var t=eo(e,134217728);t!==null&&bl(t,e,134217728,vl()),hu(e,134217728)}},Ht=function(e){if(e.tag===13){var t=yl(e),n=eo(e,t);n!==null&&bl(n,e,t,vl()),hu(e,t)}},Ut=function(){return Rt},Wt=function(e,t){var n=Rt;try{return Rt=e,t()}finally{Rt=n}},Fe=function(e,t,n){switch(t){case`input`:if(fe(e,n),t=n.name,n.type===`radio`&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll(`input[name=`+JSON.stringify(``+t)+`][type="radio"]`),t=0;t<n.length;t++){var i=n[t];if(i!==e&&i.form===e.form){var a=Vi(i);if(!a)throw Error(r(90));se(i),fe(i,a)}}}break;case`textarea`:ye(e,n);break;case`select`:t=n.value,t!=null&&ge(e,!!n.multiple,t,!1)}},Ve=Ol,He=kl;var Tu={usingClientEntryPoint:!1,Events:[zi,Bi,Vi,ze,Be,Ol]},Eu={findFiberByHostInstance:Ri,bundleType:0,version:`18.3.1`,rendererPackageName:`react-dom`},Du={bundleType:Eu.bundleType,version:Eu.version,rendererPackageName:Eu.rendererPackageName,rendererConfig:Eu.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:S.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=ot(e),e===null?null:e.stateNode},findFiberByHostInstance:Eu.findFiberByHostInstance||gu,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:`18.3.1-next-f1338f8080-20240426`};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`){var Ou=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Ou.isDisabled&&Ou.supportsFiber)try{yt=Ou.inject(Du),bt=Ou}catch{}}e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Tu,e.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!bu(t))throw Error(r(200));return lu(e,t,null,n)},e.createRoot=function(e,t){if(!bu(e))throw Error(r(299));var n=!1,i=``,a=_u;return t!=null&&(!0===t.unstable_strictMode&&(n=!0),t.identifierPrefix!==void 0&&(i=t.identifierPrefix),t.onRecoverableError!==void 0&&(a=t.onRecoverableError)),t=cu(e,1,!1,null,null,n,!1,i,a),e[Pi]=t.current,ci(e.nodeType===8?e.parentNode:e),new vu(t)},e.findDOMNode=function(e){if(e==null)return null;if(e.nodeType===1)return e;var t=e._reactInternals;if(t===void 0)throw typeof e.render==`function`?Error(r(188)):(e=Object.keys(e).join(`,`),Error(r(268,e)));return e=ot(t),e=e===null?null:e.stateNode,e},e.flushSync=function(e){return kl(e)},e.hydrate=function(e,t,n){if(!xu(t))throw Error(r(200));return wu(null,e,t,!0,n)},e.hydrateRoot=function(e,t,n){if(!bu(e))throw Error(r(405));var i=n!=null&&n.hydratedSources||null,a=!1,o=``,s=_u;if(n!=null&&(!0===n.unstable_strictMode&&(a=!0),n.identifierPrefix!==void 0&&(o=n.identifierPrefix),n.onRecoverableError!==void 0&&(s=n.onRecoverableError)),t=du(t,null,e,1,n??null,a,!1,o,s),e[Pi]=t.current,ci(e),i)for(e=0;e<i.length;e++)n=i[e],a=n._getVersion,a=a(n._source),t.mutableSourceEagerHydrationData==null?t.mutableSourceEagerHydrationData=[n,a]:t.mutableSourceEagerHydrationData.push(n,a);return new yu(t)},e.render=function(e,t,n){if(!xu(t))throw Error(r(200));return wu(null,e,t,!1,n)},e.unmountComponentAtNode=function(e){if(!xu(e))throw Error(r(40));return e._reactRootContainer?(kl(function(){wu(null,null,e,!1,function(){e._reactRootContainer=null,e[Pi]=null})}),!0):!1},e.unstable_batchedUpdates=Ol,e.unstable_renderSubtreeIntoContainer=function(e,t,n,i){if(!xu(n))throw Error(r(200));if(e==null||e._reactInternals===void 0)throw Error(r(38));return wu(e,t,n,!1,i)},e.version=`18.3.1-next-f1338f8080-20240426`})),eT=o(((e,t)=>{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=$w()})),tT=o((e=>{var t=eT();e.createRoot=t.createRoot,e.hydrateRoot=t.hydrateRoot}))();function nT(e,t){console.error(JSON.stringify({source:`agar`,operation:e,failureKind:t instanceof Error?`Error`:`NonErrorThrown`}),cg(t))}var rT=Symbol(`workers-module`);Symbol.dispose||(Symbol.dispose=Symbol.for(`dispose`)),Symbol.asyncDispose||(Symbol.asyncDispose=Symbol.for(`asyncDispose`)),Promise.withResolvers||(Promise.withResolvers=function(){let e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}});var iT=globalThis[rT],aT=iT?iT.RpcTarget:class{},oT=async function(){}.constructor,sT=typeof Buffer<`u`?Buffer.prototype:void 0;function cT(e){switch(typeof e){case`boolean`:case`number`:case`string`:return`primitive`;case`undefined`:return`undefined`;case`object`:case`function`:break;case`bigint`:return`bigint`;default:return`unsupported`}if(e===null)return`primitive`;let t=Object.getPrototypeOf(e);switch(t){case Object.prototype:return`object`;case Function.prototype:case oT.prototype:return`function`;case Array.prototype:return`array`;case Date.prototype:return`date`;case Uint8Array.prototype:case sT:case ArrayBuffer.prototype:case DataView.prototype:case Int8Array.prototype:case Uint8ClampedArray.prototype:case Int16Array.prototype:case Uint16Array.prototype:case Int32Array.prototype:case Uint32Array.prototype:case BigInt64Array.prototype:case BigUint64Array.prototype:case Float32Array.prototype:case Float64Array.prototype:return`bytes`;case WritableStream.prototype:return`writable`;case ReadableStream.prototype:return`readable`;case URL.prototype:return`url`;case Headers.prototype:return`headers`;case Request.prototype:return`request`;case Response.prototype:return`response`;case Blob.prototype:return`blob`;case bT.prototype:return`stub`;case xT.prototype:return`rpc-promise`;default:if(iT){if(t==iT.RpcStub.prototype||e instanceof iT.ServiceStub)return`rpc-target`;if(t==iT.RpcPromise.prototype||t==iT.RpcProperty.prototype)return`rpc-thenable`}return e instanceof aT?`rpc-target`:e instanceof Error?`error`:`unsupported`}}function lT(){throw Error(`RPC map() implementation was not loaded.`)}var uT={applyMap:lT,sendMap:lT};function dT(){throw Error(`Stream implementation was not loaded.`)}var fT={createWritableStreamHook:dT,createWritableStreamFromHook:dT,createReadableStreamHook:dT},pT=class{stream(e,t){let n=this.call(e,t),r;try{r=n.pull()}catch(e){throw n.dispose(),e}let i;return r instanceof Promise?i=r.then(e=>{e.dispose()}):(r.dispose(),i=Promise.resolve()),{promise:i}}},mT=class extends pT{error;constructor(e){super(),this.error=e}call(e,t){return t.dispose(),this}map(e,t,n){for(let e of t)e.dispose();return this}get(e){return this}dup(){return this}pull(){return Promise.reject(this.error)}ignoreUnhandledRejections(){}dispose(){}onBroken(e){try{e(this.error)}catch(e){Promise.resolve(e)}}},hT=new mT(Error(`Attempted to use RPC stub after it has been disposed.`)),gT=(e,t,n)=>e.call(t,n);function _T(e,t){let n=gT;gT=e;try{return t()}finally{gT=n}}var vT=Symbol(`realStub`),yT={apply(e,t,n){let r=e.raw;return new xT(gT(r.hook,r.pathIfPromise||[],OT.fromAppParams(n)),[])},get(e,t,n){let r=e.raw;if(t===vT)return r;if(t in xT.prototype)return r[t];if(typeof t==`string`)return new xT(r.hook,r.pathIfPromise?[...r.pathIfPromise,t]:[t]);if(t===Symbol.dispose&&(!r.pathIfPromise||r.pathIfPromise.length==0))return()=>{r.hook.dispose(),r.hook=hT}},has(e,t){let n=e.raw;return t===vT?!0:t in xT.prototype?t in n:typeof t==`string`||t===Symbol.dispose&&(!n.pathIfPromise||n.pathIfPromise.length==0)},construct(e,t){throw Error(`An RPC stub cannot be used as a constructor.`)},defineProperty(e,t,n){throw Error(`Can't define properties on RPC stubs.`)},deleteProperty(e,t){throw Error(`Can't delete properties on RPC stubs.`)},getOwnPropertyDescriptor(e,t){},getPrototypeOf(e){return Object.getPrototypeOf(e.raw)},isExtensible(e){return!1},ownKeys(e){return[]},preventExtensions(e){return!0},set(e,t,n,r){throw Error(`Can't assign properties on RPC stubs.`)},setPrototypeOf(e,t){throw Error(`Can't override prototype of RPC stubs.`)}},bT=class e extends aT{constructor(e,t){if(super(),!(e instanceof pT)){let n=e;if(e=n instanceof aT||n instanceof Function?NT.create(n,void 0):new jT(OT.fromAppReturn(n)),t)throw TypeError(`RpcStub constructor expected one argument, received two.`)}this.hook=e,this.pathIfPromise=t;let n=()=>{};return n.raw=this,new Proxy(n,yT)}hook;pathIfPromise;dup(){let t=this[vT];return t.pathIfPromise?new e(t.hook.get(t.pathIfPromise)):new e(t.hook.dup())}onRpcBroken(e){this[vT].hook.onBroken(e)}map(e){let{hook:t,pathIfPromise:n}=this[vT];return uT.sendMap(t,n||[],e)}toString(){return`[object RpcStub]`}},xT=class extends bT{constructor(e,t){if(e instanceof pT)super(e,t??[]);else{if(t!==void 0)throw TypeError(`RpcPromise constructor expected one argument, received two.`);let n=cT(e);if(n===`rpc-promise`){let t=ET(e);if(t.pathIfPromise.length>0)super(t.hook,t.pathIfPromise);else{let e=t.hook;t.hook=hT,super(e,[])}}else if(n===`rpc-thenable`)super(NT.create(e,void 0),[]);else{let t=new PT(Promise.resolve(e).then(e=>new jT(OT.fromAppReturn(e))));t.ignoreUnhandledRejections(),super(t,[])}}}then(e,t){return DT(this).then(...arguments)}catch(e){return DT(this).catch(...arguments)}finally(e){return DT(this).finally(...arguments)}toString(){return`[object RpcPromise]`}};function ST(e){let{hook:t,pathIfPromise:n}=e[vT];return n&&n.length>0?t.get(n):t}function CT(e){let{hook:t,pathIfPromise:n}=e[vT];return n?t.get(n):t.dup()}function wT(e){let{hook:t,pathIfPromise:n}=e[vT];if(!(n&&n.length>0))return t}function TT(e){return e[vT].hook}function ET(e){return e[vT]}async function DT(e){let{hook:t,pathIfPromise:n}=e[vT];return n.length>0&&(t=t.get(n)),(await t.pull()).deliverResolve()}var OT=class e{value;source;hooks;promises;static fromAppParams(t){return new e(t,`params`)}static fromAppReturn(t){return new e(t,`return`)}static fromArray(t){let n=[],r=[],i=[];for(let e of t){e.ensureDeepCopied();for(let t of e.hooks)n.push(t);for(let t of e.promises)t.parent===e&&(t={parent:i,property:i.length,promise:t.promise}),r.push(t);i.push(e.value)}return new e(i,`owned`,n,r)}static forEvaluate(t,n){return new e(null,`owned`,t,n)}static deepCopyFrom(t,n,r){let i=new e(null,`owned`,[],[]);return i.value=i.deepCopy(t,n,`value`,i,!0,r),i}constructor(e,t,n,r){this.value=e,this.source=t,this.hooks=n,this.promises=r}rpcTargets;getHookForRpcTarget(e,t,n=!0){if(this.source===`params`){if(n){let t=e;typeof t.dup==`function`&&(e=t.dup())}return NT.create(e,t)}if(this.source===`return`){let r=this.rpcTargets?.get(e);return r?n?r.dup():(this.rpcTargets?.delete(e),r):(r=NT.create(e,t),n?(this.rpcTargets||=new Map,this.rpcTargets.set(e,r),r.dup()):r)}throw Error(`owned payload shouldn't contain raw RpcTargets`)}getHookForWritableStream(e,t,n=!0){if(this.source===`params`)return fT.createWritableStreamHook(e);if(this.source===`return`){let t=this.rpcTargets?.get(e);return t?n?t.dup():(this.rpcTargets?.delete(e),t):(t=fT.createWritableStreamHook(e),n?(this.rpcTargets||=new Map,this.rpcTargets.set(e,t),t.dup()):t)}throw Error(`owned payload shouldn't contain raw WritableStreams`)}getHookForReadableStream(e,t,n=!0){if(this.source===`params`)return fT.createReadableStreamHook(e);if(this.source===`return`){let t=this.rpcTargets?.get(e);return t?n?t.dup():(this.rpcTargets?.delete(e),t):(t=fT.createReadableStreamHook(e),n?(this.rpcTargets||=new Map,this.rpcTargets.set(e,t),t.dup()):t)}throw Error(`owned payload shouldn't contain raw ReadableStreams`)}deepCopy(e,t,n,r,i,a){switch(cT(e)){case`unsupported`:return e;case`primitive`:case`bigint`:case`date`:case`bytes`:case`blob`:case`url`:case`error`:case`undefined`:return e;case`array`:{let t=e,n=t.length,r=Array(n);for(let e=0;e<n;e++)r[e]=this.deepCopy(t[e],t,e,r,i,a);return r}case`object`:{let t={},n=e;for(let e in n)t[e]=this.deepCopy(n[e],n,e,t,i,a);return t}case`stub`:case`rpc-promise`:{let t=e,a;if(a=i?CT(t):ST(t),t instanceof xT){let e=new xT(a,[]);return this.promises.push({parent:r,property:n,promise:e}),e}return this.hooks.push(a),new bT(a)}case`function`:case`rpc-target`:{let n=e,r;return r=a?a.getHookForRpcTarget(n,t,i):NT.create(n,t),this.hooks.push(r),new bT(r)}case`rpc-thenable`:{let o=e,s;return s=a?new xT(a.getHookForRpcTarget(o,t,i),[]):new xT(NT.create(o,t),[]),this.promises.push({parent:r,property:n,promise:s}),s}case`writable`:{let n=e,r;return r=a?a.getHookForWritableStream(n,t,i):fT.createWritableStreamHook(n),this.hooks.push(r),n}case`readable`:{let n=e,r;return r=a?a.getHookForReadableStream(n,t,i):fT.createReadableStreamHook(n),this.hooks.push(r),n}case`headers`:return new Headers(e);case`request`:{let t=e;return t.body&&this.deepCopy(t.body,t,`body`,t,i,a),new Request(t)}case`response`:{let t=e;return t.body&&this.deepCopy(t.body,t,`body`,t,i,a),new Response(t.body,t)}default:throw Error(`unreachable`)}}ensureDeepCopied(){if(this.source!==`owned`){let e=this.source===`params`;this.hooks=[],this.promises=[];try{this.value=this.deepCopy(this.value,void 0,`value`,this,e,this)}catch(e){throw this.hooks=void 0,this.promises=void 0,e}if(this.source=`owned`,this.rpcTargets&&this.rpcTargets.size>0)throw Error(`Not all rpcTargets were accounted for in deep-copy?`);this.rpcTargets=void 0}}deliverTo(t,n,r){if(this.ensureDeepCopied(),this.value instanceof xT)e.deliverRpcPromiseTo(this.value,t,n,r);else{t[n]=this.value;for(let t of this.promises)e.deliverRpcPromiseTo(t.promise,t.parent,t.property,r)}}static deliverRpcPromiseTo(t,n,r,i){let a=wT(t);if(!a)throw Error(`property promises should have been resolved earlier`);let o=a.pull();o instanceof e?o.deliverTo(n,r,i):i.push(o.then(e=>{let t=[];if(e.deliverTo(n,r,t),t.length>0)return Promise.all(t)}))}async deliverCall(t,n){try{let r=[];this.deliverTo(this,`value`,r),r.length>0&&await Promise.all(r);let i=Function.prototype.apply.call(t,n,this.value);return i instanceof xT?e.fromAppReturn(i):e.fromAppReturn(await i)}finally{this.dispose()}}async deliverStreamWrite(t){try{let n=[];this.deliverTo(this,`value`,n),n.length>0&&await Promise.all(n);let r=this.value[0];return(this.hooks.length>0||this.promises.length>0)&&r instanceof Object?(Symbol.dispose in r||Object.defineProperty(r,Symbol.dispose,{value:()=>this.dispose(),writable:!0,enumerable:!1,configurable:!0}),await t.write(r),e.fromAppReturn(void 0)):(await t.write(r),this.dispose(),e.fromAppReturn(void 0))}catch(e){throw this.dispose(),e}}async deliverResolve(){try{let e=[];this.deliverTo(this,`value`,e),e.length>0&&await Promise.all(e);let t=this.value;return t instanceof Object&&(Symbol.dispose in t||Object.defineProperty(t,Symbol.dispose,{value:()=>this.dispose(),writable:!0,enumerable:!1,configurable:!0})),t}catch(e){throw this.dispose(),e}}dispose(){if(this.source===`owned`)this.hooks.forEach(e=>e.dispose()),this.promises.forEach(e=>e.promise[Symbol.dispose]());else if(this.source===`return`&&(this.disposeImpl(this.value,void 0),this.rpcTargets&&this.rpcTargets.size>0))throw Error(`Not all rpcTargets were accounted for in disposeImpl()?`);this.source=`owned`,this.hooks=[],this.promises=[]}disposeImpl(e,t){switch(cT(e)){case`unsupported`:case`primitive`:case`bigint`:case`bytes`:case`blob`:case`date`:case`url`:case`error`:case`undefined`:return;case`array`:{let t=e,n=t.length;for(let e=0;e<n;e++)this.disposeImpl(t[e],t);return}case`object`:{let t=e;for(let e in t)this.disposeImpl(t[e],t);return}case`stub`:case`rpc-promise`:{let t=wT(e);t&&t.dispose();return}case`function`:case`rpc-target`:{let t=e,n=this.rpcTargets?.get(t);n?(n.dispose(),this.rpcTargets.delete(t)):MT(t);return}case`rpc-thenable`:return;case`headers`:return;case`request`:{let t=e;t.body&&this.disposeImpl(t.body,t);return}case`response`:{let t=e;t.body&&this.disposeImpl(t.body,t);return}case`writable`:{let t=e,n=this.rpcTargets?.get(t);n?this.rpcTargets.delete(t):n=fT.createWritableStreamHook(t),n.dispose();return}case`readable`:{let t=e,n=this.rpcTargets?.get(t);n?this.rpcTargets.delete(t):n=fT.createReadableStreamHook(t),n.dispose();return}default:return}}ignoreUnhandledRejections(){this.hooks?(this.hooks.forEach(e=>{e.ignoreUnhandledRejections()}),this.promises.forEach(e=>TT(e.promise).ignoreUnhandledRejections())):this.ignoreUnhandledRejectionsImpl(this.value)}ignoreUnhandledRejectionsImpl(e){switch(cT(e)){case`unsupported`:case`primitive`:case`bigint`:case`bytes`:case`blob`:case`date`:case`error`:case`undefined`:case`function`:case`rpc-target`:case`writable`:case`readable`:case`url`:case`headers`:case`request`:case`response`:return;case`array`:{let t=e,n=t.length;for(let e=0;e<n;e++)this.ignoreUnhandledRejectionsImpl(t[e]);return}case`object`:{let t=e;for(let e in t)this.ignoreUnhandledRejectionsImpl(t[e]);return}case`stub`:case`rpc-promise`:TT(e).ignoreUnhandledRejections();return;case`rpc-thenable`:e.then(e=>{},e=>{});return;default:return}}};function kT(e,t,n,r){for(let i=0;i<n.length;i++){t=e;let a=n[i];if(a in Object.prototype){e=void 0;continue}switch(cT(e)){case`object`:case`function`:e=Object.hasOwn(e,a)?e[a]:void 0;break;case`array`:e=Number.isInteger(a)&&a>=0?e[a]:void 0;break;case`rpc-target`:case`rpc-thenable`:if(Object.hasOwn(e,a))throw TypeError(`Attempted to access property '${a}', which is an instance property of the RpcTarget. To avoid leaking private internals, instance properties cannot be accessed over RPC. If you want to make this property available over RPC, define it as a method or getter on the class, instead of an instance property.`);e=e[a],r=null;break;case`stub`:case`rpc-promise`:{let{hook:t,pathIfPromise:r}=ET(e);return{hook:t,remainingPath:r?r.concat(n.slice(i)):n.slice(i)}}case`writable`:e=void 0;break;case`readable`:e=void 0;break;case`primitive`:case`bigint`:case`bytes`:case`blob`:case`date`:case`error`:case`url`:case`headers`:case`request`:case`response`:e=void 0;break;case`undefined`:e=e[a];break;case`unsupported`:if(i===0)throw TypeError(`RPC stub points at a non-serializable type.`);{let e=n.slice(0,i).join(`.`),t=n.slice(0,i).join(`.`);throw TypeError(`'${e}' is not a serializable type, so property ${t} cannot be accessed.`)}default:throw TypeError(`unreachable`)}}if(e instanceof xT){let{hook:t,pathIfPromise:n}=ET(e);return{hook:t,remainingPath:n||[]}}return{value:e,parent:t,owner:r}}var AT=class extends pT{call(e,t){let n;try{let{value:t,owner:r}=this.getValue();n=kT(t,void 0,e,r)}catch(e){return t.dispose(),new mT(e)}return n.hook?n.hook.call(n.remainingPath,t):typeof n.value==`function`?new PT(t.deliverCall(n.value,n.parent).then(e=>new jT(e))):(t.dispose(),new mT(TypeError(`'${e.join(`.`)}' is not a function.`)))}map(e,t,n){try{let r;try{let{value:t,owner:n}=this.getValue();r=kT(t,void 0,e,n)}catch(e){for(let e of t)e.dispose();throw e}return r.hook?r.hook.map(r.remainingPath,t,n):uT.applyMap(r.value,r.parent,r.owner,t,n)}catch(e){return new mT(e)}}get(e){try{let{value:t,owner:n}=this.getValue();if(e.length===0&&n===null){if(t instanceof Object&&`then`in t)return this.dup();throw Error(`Can't dup an RpcTarget stub as a promise.`)}let r=kT(t,void 0,e,n);return r.hook?r.hook.get(r.remainingPath):new jT(OT.deepCopyFrom(r.value,r.parent,r.owner))}catch(e){return new mT(e)}}},jT=class e extends AT{constructor(e){super(),this.payload=e}payload;getPayload(){if(this.payload)return this.payload;throw Error(`Attempted to use an RPC StubHook after it was disposed.`)}getValue(){let e=this.getPayload();return{value:e.value,owner:e}}dup(){let t=this.getPayload();return new e(OT.deepCopyFrom(t.value,void 0,t))}pull(){return this.getPayload()}ignoreUnhandledRejections(){this.payload&&this.payload.ignoreUnhandledRejections()}dispose(){this.payload&&=(this.payload.dispose(),void 0)}onBroken(e){this.payload&&this.payload.value instanceof bT&&this.payload.value.onRpcBroken(e)}};function MT(e){if(Symbol.dispose in e)try{e[Symbol.dispose]()}catch(e){Promise.reject(e)}}var NT=class e extends AT{static create(t,n){return typeof t!=`function`&&(n=void 0),new e(t,n)}constructor(e,t,n){super(),this.target=e,this.parent=t,n?n.refcount&&(this.refcount=n.refcount,++this.refcount.count):Symbol.dispose in e&&(this.refcount={count:1})}target;parent;refcount;getTarget(){if(this.target)return this.target;throw Error(`Attempted to use an RPC StubHook after it was disposed.`)}getValue(){return{value:this.getTarget(),owner:null}}dup(){return new e(this.getTarget(),this.parent,this)}pull(){let e=this.getTarget();return`then`in e?Promise.resolve(e).then(e=>OT.fromAppReturn(e)):Promise.reject(Error(`Tried to resolve a non-promise stub.`))}ignoreUnhandledRejections(){}dispose(){this.target&&=(this.refcount&&--this.refcount.count==0&&MT(this.target),void 0)}onBroken(e){let t=this.target;t&&`then`in t&&Promise.resolve(t).then(()=>{},e)}},PT=class e extends pT{promise;resolution;constructor(e){super(),this.promise=e.then(e=>(this.resolution=e,e))}call(t,n){return n.ensureDeepCopied(),new e(this.promise.then(e=>e.call(t,n),e=>{throw n.dispose(),e}))}stream(e,t){return t.ensureDeepCopied(),{promise:this.promise.then(n=>n.stream(e,t).promise,e=>{throw t.dispose(),e})}}map(t,n,r){return new e(this.promise.then(e=>e.map(t,n,r),e=>{for(let e of n)e.dispose();throw e}))}get(t){return new e(this.promise.then(e=>e.get(t)))}dup(){return this.resolution?this.resolution.dup():new e(this.promise.then(e=>e.dup()))}pull(){return this.resolution?this.resolution.pull():this.promise.then(e=>e.pull())}ignoreUnhandledRejections(){this.resolution?this.resolution.ignoreUnhandledRejections():this.promise.then(e=>{e.ignoreUnhandledRejections()},e=>{})}dispose(){this.promise.then(e=>e.dispose(),()=>{})}onBroken(e){this.resolution?this.resolution.onBroken(e):this.promise.then(t=>{t.onBroken(e)},e)}},FT={maxBigIntDigits:16384,maxDepth:256,maxMessageSize:33554432},IT=new Uint8Array(new Uint16Array([1]).buffer)[0]===1,LT=[`ArrayBuffer`,`DataView`,`Int8Array`,`Uint8Array`,`Uint8ClampedArray`,`Int16Array`,`Uint16Array`,`Int32Array`,`Uint32Array`,`BigInt64Array`,`BigUint64Array`,`Float32Array`,`Float64Array`];function RT(e){return LT.includes(e)}var zT={ArrayBuffer:void 0,DataView:void 0,Int8Array:void 0,Uint8Array:void 0,Uint8ClampedArray:void 0,Int16Array:2,Uint16Array:2,Int32Array:4,Uint32Array:4,BigInt64Array:8,BigUint64Array:8,Float32Array:4,Float64Array:8},BT={ArrayBuffer:ArrayBuffer.prototype,DataView:DataView.prototype,Int8Array:Int8Array.prototype,Uint8ClampedArray:Uint8ClampedArray.prototype,Int16Array:Int16Array.prototype,Uint16Array:Uint16Array.prototype,Int32Array:Int32Array.prototype,Uint32Array:Uint32Array.prototype,BigInt64Array:BigInt64Array.prototype,BigUint64Array:BigUint64Array.prototype,Float32Array:Float32Array.prototype,Float64Array:Float64Array.prototype},VT=new Map;for(let e of Object.keys(BT))VT.set(BT[e],e);function HT(e,t){if(t!==2&&t!==4&&t!==8)throw RangeError(`Unsupported element size: ${t}`);let n=new DataView(e.buffer,e.byteOffset,e.byteLength);for(let r=0;r<e.byteLength;r+=t)switch(t){case 2:n.setUint16(r,n.getUint16(r,!1),!0);break;case 4:n.setUint32(r,n.getUint32(r,!1),!0);break;case 8:n.setBigUint64(r,n.getBigUint64(r,!1),!0)}}var UT=new class{exportStub(e){throw Error(`Cannot serialize RPC stubs without an RPC session.`)}exportPromise(e){throw Error(`Cannot serialize RPC stubs without an RPC session.`)}getImport(e){}unexport(e){}createPipe(e){throw Error(`Cannot create pipes without an RPC session.`)}onSendError(e){}};async function WT(e,t){let n=await new Response(e).blob();return n.type===t?n:n.slice(0,n.size,t)}var GT={__proto__:null,Error,EvalError,RangeError,ReferenceError,SyntaxError,TypeError,URIError,AggregateError},KT=class e{exporter;source;encodingLevel;constructor(e,t,n){this.exporter=e,this.source=t,this.encodingLevel=n}static devaluate(t,n,r=UT,i,a=`string`){let o=new e(r,i,a);try{return o.devaluateImpl(t,n,0)}catch(e){if(o.exports)try{r.unexport(o.exports)}catch{}throw e}}exports;devaluateImpl(e,t,n){if(n>=256)throw Error(`Serialization exceeded maximum allowed depth. (Does the message contain cycles?)`);switch(cT(e)){case`unsupported`:{let t;try{t=`Cannot serialize value: ${e}`}catch{t=`Cannot serialize value: (couldn't stringify value)`}throw TypeError(t)}case`primitive`:return typeof e==`number`&&!isFinite(e)?this.encodingLevel===`structuredClonable`?e:e===1/0?[`inf`]:e===-1/0?[`-inf`]:[`nan`]:e;case`object`:{let t=e,r={};for(let e in t)r[e]=this.devaluateImpl(t[e],t,n+1);return r}case`array`:{let t=e,r=t.length,i=Array(r);for(let e=0;e<r;e++)i[e]=this.devaluateImpl(t[e],t,n+1);return[i]}case`bigint`:return this.encodingLevel===`structuredClonable`?e:[`bigint`,e.toString()];case`date`:{if(this.encodingLevel===`structuredClonable`)return e;let t=e.getTime();return[`date`,Number.isNaN(t)?null:t]}case`bytes`:{let t=VT.get(Object.getPrototypeOf(e)),n;if(t===`ArrayBuffer`)n=new Uint8Array(e);else if(t===void 0)n=e;else{let r=e;n=new Uint8Array(r.buffer,r.byteOffset,r.byteLength);let i=zT[t];!IT&&i&&(n=n.slice(),HT(n,i))}if(this.encodingLevel===`structuredClonable`||this.encodingLevel===`jsonCompatibleWithBytes`)return t===void 0?[`bytes`,n]:[`bytes`,n,t];let r;if(n.toBase64)r=n.toBase64({omitPadding:!0});else if(typeof Buffer<`u`)r=(n instanceof Buffer?n:Buffer.from(n.buffer,n.byteOffset,n.byteLength)).toString(`base64`);else{let e=``;for(let t=0;t<n.length;t++)e+=String.fromCharCode(n[t]);r=btoa(e)}return r=r.replace(/=+$/,``),t===void 0?[`bytes`,r]:[`bytes`,r,t]}case`url`:return[`url`,e.href];case`headers`:return[`headers`,[...e]];case`request`:{let t=e,r={};t.method!==`GET`&&(r.method=t.method);let i=[...t.headers];if(i.length>0&&(r.headers=i),t.body)r.body=this.devaluateImpl(t.body,t,n+1),r.duplex=t.duplex||`half`;else if(t.body===void 0&&![`GET`,`HEAD`,`OPTIONS`,`TRACE`,`DELETE`].includes(t.method)){let e=t.arrayBuffer(),n=new ReadableStream({async start(t){try{t.enqueue(new Uint8Array(await e)),t.close()}catch(e){t.error(e)}}}),i=fT.createReadableStreamHook(n);r.body=[`readable`,this.exporter.createPipe(n,i)],r.duplex=t.duplex||`half`}t.cache&&t.cache!=="default"&&(r.cache=t.cache),t.redirect!==`follow`&&(r.redirect=t.redirect),t.integrity&&(r.integrity=t.integrity),t.mode&&t.mode!==`cors`&&(r.mode=t.mode),t.credentials&&t.credentials!==`same-origin`&&(r.credentials=t.credentials),t.referrer&&t.referrer!==`about:client`&&(r.referrer=t.referrer),t.referrerPolicy&&(r.referrerPolicy=t.referrerPolicy),t.keepalive&&(r.keepalive=t.keepalive);let a=t;return a.cf&&(r.cf=a.cf),a.encodeResponseBody&&a.encodeResponseBody!==`automatic`&&(r.encodeResponseBody=a.encodeResponseBody),[`request`,t.url,r]}case`response`:{let t=e,r=this.devaluateImpl(t.body,t,n+1),i={};t.status!==200&&(i.status=t.status),t.statusText&&(i.statusText=t.statusText);let a=[...t.headers];a.length>0&&(i.headers=a);let o=t;if(o.cf&&(i.cf=o.cf),o.encodeBody&&o.encodeBody!==`automatic`&&(i.encodeBody=o.encodeBody),o.webSocket)throw TypeError(`Can't serialize a Response containing a webSocket.`);return[`response`,r,i]}case`blob`:{let t=e,n=t.stream(),r=fT.createReadableStreamHook(n),i=this.exporter.createPipe(n,r);return[`blob`,t.type,[`readable`,i]]}case`error`:{let t=e,r=this.exporter.onSendError(t);r&&(t=r);let i=t,a,o=(e,r)=>{let i=this.exports?.length??0;try{let i=this.devaluateImpl(r,t,n+1);a||={},a[e]=i}catch{if(this.exports&&this.exports.length>i){let e=this.exports.splice(i);try{this.exporter.unexport(e)}catch{}}}};for(let e of Object.keys(t))e!==`name`&&e!==`message`&&e!==`stack`&&o(e,i[e]);`cause`in t&&o(`cause`,i.cause),t instanceof AggregateError&&o(`errors`,t.errors);let s=[`error`,t.name,t.message];return a?(s.push(r&&r.stack?r.stack:null),s.push(a)):r&&r.stack&&s.push(r.stack),s}case`undefined`:return this.encodingLevel===`structuredClonable`?void 0:[`undefined`];case`stub`:case`rpc-promise`:{if(!this.source)throw Error(`Can't serialize RPC stubs in this context.`);let{hook:t,pathIfPromise:n}=ET(e),r=this.exporter.getImport(t);return r===void 0?(t=n?t.get(n):t.dup(),this.devaluateHook(n?`promise`:`export`,t)):n?n.length>0?[`pipeline`,r,n]:[`pipeline`,r]:[`import`,r]}case`function`:case`rpc-target`:{if(!this.source)throw Error(`Can't serialize RPC stubs in this context.`);let n=this.source.getHookForRpcTarget(e,t);return this.devaluateHook(`export`,n)}case`rpc-thenable`:{if(!this.source)throw Error(`Can't serialize RPC stubs in this context.`);let n=this.source.getHookForRpcTarget(e,t);return this.devaluateHook(`promise`,n)}case`writable`:{if(!this.source)throw Error(`Can't serialize WritableStream in this context.`);let n=this.source.getHookForWritableStream(e,t);return this.devaluateHook(`writable`,n)}case`readable`:{if(!this.source)throw Error(`Can't serialize ReadableStream in this context.`);let n=e,r=this.source.getHookForReadableStream(n,t);return[`readable`,this.exporter.createPipe(n,r)]}default:throw Error(`unreachable`)}}devaluateHook(e,t){this.exports||=[];let n=e===`promise`?this.exporter.exportPromise(t):this.exporter.exportStub(t);return this.exports.push(n),[e,n]}};new class{importStub(e){throw Error(`Cannot deserialize RPC stubs without an RPC session.`)}importPromise(e){throw Error(`Cannot deserialize RPC stubs without an RPC session.`)}getExport(e){}getPipeReadable(e){throw Error(`Cannot retrieve pipe readable without an RPC session.`)}getLimits(){return FT}};function qT(e,t){return new xT(new PT(new Response(t).arrayBuffer().then(t=>{let n=new Uint8Array(t),r=new Request(e,{body:n});return new jT(OT.fromAppReturn(r))})),[])}function JT(e,t){return new xT(new PT(WT(e,t).then(e=>new jT(OT.fromAppReturn(e)))),[])}var YT=class e{importer;encodingLevel;limits;constructor(e,t=`string`){this.importer=e,this.encodingLevel=t,this.limits=e.getLimits()}hooks=[];promises=[];evaluate(e){return this.evaluateWithDepth(e,0)}evaluateWithDepth(e,t){let n=OT.forEvaluate(this.hooks,this.promises);try{return n.value=this.evaluateImpl(e,n,`value`,t),n}catch(e){throw n.dispose(),e}}evaluateCopy(e){return this.evaluate(structuredClone(e))}evaluateImpl(t,n,r,i){let a=this.limits.maxDepth;if(i>=a)throw TypeError(`Deserialization exceeded maximum allowed message depth of ${a}.`);if(this.encodingLevel===`structuredClonable`&&(t instanceof Date||typeof t==`bigint`))return t;if(t instanceof Array){if(t.length==1&&t[0]instanceof Array){let e=t[0];for(let t=0;t<e.length;t++)e[t]=this.evaluateImpl(e[t],e,t,i+1);return e}switch(t[0]){case`bigint`:if(typeof t[1]==`string`){let e=t[1],n=this.limits.maxBigIntDigits;if(e.length>n)throw TypeError(`Deserialized bigint exceeds maximum length of ${n} digits.`);return BigInt(e)}break;case`date`:if(t[1]===null)return new Date(NaN);if(typeof t[1]==`number`)return new Date(t[1]);break;case`bytes`:{let e;if(t[1]instanceof Uint8Array)e=t[1];else if(typeof t[1]==`string`){if(typeof Buffer<`u`)e=Buffer.from(t[1],`base64`);else if(Uint8Array.fromBase64)e=Uint8Array.fromBase64(t[1]);else{let n=atob(t[1]),r=n.length;e=new Uint8Array(r);for(let t=0;t<r;t++)e[t]=n.charCodeAt(t)}}else break;if(t.length===2)return e;if(typeof t[2]!=`string`)throw TypeError(`Unknown bytes type marker type: ${typeof t[2]}`);if(!RT(t[2])){let e=t[2].slice(0,64);throw TypeError(`Unknown bytes type marker: ${e}`)}let n=t[2],r=zT[n];if(r!==void 0&&e.byteLength%r!==0)throw TypeError(`Invalid byte length ${e.byteLength} for ${n}; expected a multiple of ${r}`);let i=e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength);switch(!IT&&r!==void 0&&HT(new Uint8Array(i),r),n){case`ArrayBuffer`:return i;case`DataView`:return new DataView(i);case`Int8Array`:return new Int8Array(i);case`Uint8Array`:return new Uint8Array(i);case`Uint8ClampedArray`:return new Uint8ClampedArray(i);case`Int16Array`:return new Int16Array(i);case`Uint16Array`:return new Uint16Array(i);case`Int32Array`:return new Int32Array(i);case`Uint32Array`:return new Uint32Array(i);case`BigInt64Array`:return new BigInt64Array(i);case`BigUint64Array`:return new BigUint64Array(i);case`Float32Array`:return new Float32Array(i);case`Float64Array`:return new Float64Array(i)}}case`error`:if(t.length>=3&&typeof t[1]==`string`&&typeof t[2]==`string`){let e=GT[t[1]]||Error,n=e===AggregateError?new e([],t[2]):new e(t[2]);if(typeof t[3]==`string`&&(n.stack=t[3]),t.length>=5){let e=t[4];if(!e||typeof e!=`object`||Array.isArray(e))break;let r=n,a=e;for(let e of Object.keys(a))if(e!==`name`&&e!==`message`&&e!==`stack`){if(e in Object.prototype||e===`toJSON`){this.evaluateImpl(a[e],n,e,i+1);continue}r[e]=this.evaluateImpl(a[e],n,e,i+1)}}return n}break;case`undefined`:if(t.length===1)return;break;case`inf`:return 1/0;case`-inf`:return-1/0;case`nan`:return NaN;case`url`:if(t.length===2&&typeof t[1]==`string`)return new URL(t[1]);break;case`headers`:if(t.length===2&&t[1]instanceof Array)return new Headers(t[1]);break;case`request`:{if(t.length!==3||typeof t[1]!=`string`)break;let e=t[1],a=t[2];if(typeof a!=`object`||!a)break;if(a.body&&(a.body=this.evaluateImpl(a.body,a,`body`,i+1),!(a.body===null||typeof a.body==`string`||a.body instanceof Uint8Array||a.body instanceof ReadableStream)))throw TypeError(`Request body must be of type ReadableStream.`);if(a.signal&&(a.signal=this.evaluateImpl(a.signal,a,`signal`,i+1),!(a.signal instanceof AbortSignal)))throw TypeError(`Request siganl must be of type AbortSignal.`);if(a.headers&&!(a.headers instanceof Array))throw TypeError(`Request headers must be serialized as an array of pairs.`);let o=new Request(e,a);if(a.body instanceof ReadableStream&&o.body===void 0){let e=qT(o,a.body);return this.promises.push({promise:e,parent:n,property:r}),e}return o}case`response`:{if(t.length!==3)break;let e=this.evaluateImpl(t[1],n,r,i+1);if(!(e===null||typeof e==`string`||e instanceof Uint8Array||e instanceof ReadableStream))throw TypeError(`Response body must be of type ReadableStream.`);let a=t[2];if(typeof a!=`object`||!a)break;if(a.webSocket)throw TypeError(`Can't deserialize a Response containing a webSocket.`);if(a.headers&&!(a.headers instanceof Array))throw TypeError(`Request headers must be serialized as an array of pairs.`);return new Response(e,a)}case`blob`:{if(t.length!==3||typeof t[1]!=`string`)break;let e=t[1],a=this.evaluateImpl(t[2],n,r,i+1);if(!(a instanceof ReadableStream))throw TypeError(`Blob content must be serialized as a ReadableStream.`);let o=JT(a,e);return this.promises.push({promise:o,parent:n,property:r}),o}case`import`:case`pipeline`:{if(t.length<2||t.length>4||typeof t[1]!=`number`)break;let a=this.importer.getExport(t[1]);if(!a)throw Error(`no such entry on exports table: ${t[1]}`);let o=t[0]==`pipeline`,s=e=>{if(o){let t=new xT(e,[]);return this.promises.push({promise:t,parent:n,property:r}),t}return this.hooks.push(e),new xT(e,[])};if(t.length==2)return s(o?a.get([]):a.dup());let c=t[2];if(!(c instanceof Array)||!c.every(e=>typeof e==`string`||typeof e==`number`))break;if(t.length==3)return s(a.get(c));let l=t[3];if(!(l instanceof Array))break;return l=new e(this.importer).evaluateWithDepth([l],i),s(a.call(c,l))}case`remap`:{if(t.length!==5||typeof t[1]!=`number`||!(t[2]instanceof Array)||!(t[3]instanceof Array)||!(t[4]instanceof Array))break;let e=this.importer.getExport(t[1]);if(!e)throw Error(`no such entry on exports table: ${t[1]}`);let i=t[2];if(!i.every(e=>typeof e==`string`||typeof e==`number`))break;let a=t[3].map(e=>{if(!(e instanceof Array)||e.length!==2||e[0]!==`import`&&e[0]!==`export`||typeof e[1]!=`number`)throw TypeError(`unknown map capture: ${JSON.stringify(e)}`);if(e[0]===`export`)return this.importer.importStub(e[1]);{let t=this.importer.getExport(e[1]);if(!t)throw Error(`no such entry on exports table: ${e[1]}`);return t.dup()}}),o=t[4],s=new xT(e.map(i,a,o),[]);return this.promises.push({promise:s,parent:n,property:r}),s}case`export`:case`promise`:if(typeof t[1]==`number`){if(t[0]==`promise`){let e=new xT(this.importer.importPromise(t[1]),[]);return this.promises.push({parent:n,property:r,promise:e}),e}{let e=this.importer.importStub(t[1]);return this.hooks.push(e),new bT(e)}}break;case`writable`:if(typeof t[1]==`number`){let e=this.importer.importStub(t[1]),n=fT.createWritableStreamFromHook(e);return this.hooks.push(e),n}break;case`readable`:if(typeof t[1]==`number`){let e=this.importer.getPipeReadable(t[1]),n=fT.createReadableStreamHook(e);return this.hooks.push(n),e}}throw TypeError(`unknown special value: ${JSON.stringify(t)}`)}if(t instanceof Object){let e=t;for(let t in e)t in Object.prototype||t===`toJSON`?(this.evaluateImpl(e[t],e,t,i+1),delete e[t]):e[t]=this.evaluateImpl(e[t],e,t,i+1);return e}return t}},XT=16,ZT=8,QT=16,$T=64;function eE(e){return 2+e.length*3}function tE(e,t,n=0){if(n>=$T)return ZT;switch(typeof e){case`string`:return eE(e);case`number`:return 16;case`bigint`:return 16;case`boolean`:return 8;case`undefined`:return 16;case`object`:{if(e===null)return 8;if(ArrayBuffer.isView(e)||e instanceof ArrayBuffer)return QT+e.byteLength;if(typeof Blob<`u`&&e instanceof Blob)return QT+e.size;if(e instanceof Date)return 16;if(t??=new WeakSet,t.has(e))return ZT;if(t.add(e),e instanceof Array){let r=XT;for(let i of e)r+=ZT+tE(i,t,n+1);return r}if(e instanceof Error){let r=XT+eE(e.name)+eE(e.message)+eE(e.stack??``);for(let i of Object.keys(e))r+=ZT+eE(i)+tE(e[i],t,n+1);return r}let r=XT;for(let i of Object.keys(e))r+=ZT+eE(i)+tE(e[i],t,n+1);return r}default:return 16}}var nE=class{session;importId;constructor(e,t,n){this.session=e,this.importId=t,n&&(this.activePull=Promise.withResolvers())}localRefcount=0;remoteRefcount=1;activePull;resolution;onBrokenRegistrations;resolve(e){if(this.localRefcount==0){e.dispose();return}if(this.resolution=e,this.sendRelease(),this.onBrokenRegistrations){for(let t of this.onBrokenRegistrations){let n=this.session.onBrokenCallbacks[t],r=this.session.onBrokenCallbacks.length;e.onBroken(n),this.session.onBrokenCallbacks[r]===n?delete this.session.onBrokenCallbacks[r]:delete this.session.onBrokenCallbacks[t]}this.onBrokenRegistrations=void 0}this.activePull&&=(this.activePull.resolve(),void 0)}async awaitResolution(){return this.activePull||=(this.session.sendPull(this.importId),Promise.withResolvers()),await this.activePull.promise,this.resolution.pull()}dispose(){this.resolution?this.resolution.dispose():(this.abort(Error(`RPC was canceled because the RpcPromise was disposed.`)),this.sendRelease())}abort(e){if(!this.resolution){if(this.resolution=new mT(e),this.activePull&&=(this.activePull.reject(e),void 0),this.onBrokenRegistrations)for(let e of this.onBrokenRegistrations)delete this.session.onBrokenCallbacks[e];this.onBrokenRegistrations=void 0}}onBroken(e){if(this.resolution)this.resolution.onBroken(e);else{let t=this.session.onBrokenCallbacks.length;this.session.onBrokenCallbacks.push(e),this.onBrokenRegistrations||=[],this.onBrokenRegistrations.push(t)}}sendRelease(){this.remoteRefcount>0&&(this.session.sendRelease(this.importId,this.remoteRefcount),this.remoteRefcount=0)}},rE=class e extends pT{isPromise;entry;constructor(e,t){super(),this.isPromise=e,++t.localRefcount,this.entry=t}collectPath(e){return this}getEntry(){if(this.entry)return this.entry;throw Error(`This RpcImportHook was already disposed.`)}getEntryTakingOwnership(e){try{return this.getEntry()}catch(t){throw e(),t}}call(e,t){let n=this.getEntryTakingOwnership(()=>t.dispose());return n.resolution?n.resolution.call(e,t):n.session.sendCall(n.importId,e,t)}stream(e,t){let n=this.getEntryTakingOwnership(()=>t.dispose());return n.resolution?n.resolution.stream(e,t):n.session.sendStream(n.importId,e,t)}map(e,t,n){let r=this.getEntryTakingOwnership(()=>{for(let e of t)e.dispose()});return r.resolution?r.resolution.map(e,t,n):r.session.sendMap(r.importId,e,t,n)}get(e){let t=this.getEntry();return t.resolution?t.resolution.get(e):t.session.sendCall(t.importId,e)}dup(){return new e(!1,this.getEntry())}pull(){let e=this.getEntry();if(!this.isPromise)throw Error(`Can't pull this hook because it's not a promise hook.`);return e.resolution?e.resolution.pull():e.awaitResolution()}ignoreUnhandledRejections(){}dispose(){let e=this.entry;this.entry=void 0,e&&--e.localRefcount===0&&e.dispose()}onBroken(e){this.entry&&this.entry.onBroken(e)}},iE=class extends rE{session;constructor(e){super(!1,e),this.session=e.session}dispose(){if(this.session){let e=this.session;this.session=void 0,e.shutdown()}}},aE=class{transport;options;exports=[];reverseExports=new Map;imports=[];abortReason;cancelReadLoop;nextExportId=-1;onBatchDone;pullCount=0;onBrokenCallbacks=[];encodingLevel;limits;constructor(e,t,n){this.transport=e,this.options=n;let r=`string`;if(`encodingLevel`in e){let t=e.encodingLevel;if(t!==void 0){if(t!==`string`&&t!==`jsonCompatible`&&t!==`jsonCompatibleWithBytes`&&t!==`structuredClonable`)throw TypeError(`Unknown transport encodingLevel: ${String(t)}`);r=t}}this.encodingLevel=r,this.limits={...FT,...n.limits},this.exports.push({hook:t,refcount:1}),this.imports.push(new nE(this,0,!1)),this.readLoop().catch(e=>this.abort(e))}getMainImport(){return new iE(this.imports[0])}shutdown(){this.abort(Error(`RPC session was shut down by disposing the main stub`),!1)}exportStub(e){if(this.abortReason)throw this.abortReason;let t=this.reverseExports.get(e);if(t!==void 0)return++this.exports[t].refcount,t;{let t=this.nextExportId--;return this.exports[t]={hook:e,refcount:1},this.reverseExports.set(e,t),this.watchExport(t,e),t}}exportPromise(e){if(this.abortReason)throw this.abortReason;let t=this.nextExportId--;return this.exports[t]={hook:e,refcount:1},this.reverseExports.set(e,t),this.ensureResolvingExport(t),t}unexport(e){for(let t of e)this.releaseExport(t,1)}watchExport(e,t){t.onBroken(n=>{queueMicrotask(()=>{if(this.abortReason===void 0&&this.exports[e]?.hook===t)try{this.send([`reject`,e,KT.devaluate(n,void 0,this,void 0,this.encodingLevel)])}catch(e){this.abort(e)}})})}releaseExport(e,t){let n=this.exports[e];if(!n)throw Error(`no such export ID: ${e}`);if(n.refcount<t)throw Error(`refcount would go negative: ${n.refcount} < ${t}`);n.refcount-=t,n.refcount===0&&(delete this.exports[e],this.reverseExports.delete(n.hook),n.hook.dispose())}onSendError(e){if(this.options.onSendError)return this.options.onSendError(e)}ensureResolvingExport(e){let t=this.exports[e];if(!t)throw Error(`no such export ID: ${e}`);if(!t.pull){let n=async()=>{let e=t.hook;for(;;){let t=await e.pull();if(t.value instanceof bT){let{hook:n,pathIfPromise:r}=ET(t.value);if(r&&r.length==0&&this.getImport(e)===void 0){e=n;continue}}return t}},r=t.autoRelease;++this.pullCount,t.pull=n().then(t=>{let n=KT.devaluate(t.value,void 0,this,t,this.encodingLevel);this.send([`resolve`,e,n]),r&&this.releaseExport(e,1)},t=>{this.send([`reject`,e,KT.devaluate(t,void 0,this,void 0,this.encodingLevel)]),r&&this.releaseExport(e,1)}).catch(t=>{try{this.send([`reject`,e,KT.devaluate(t,void 0,this,void 0,this.encodingLevel)]),r&&this.releaseExport(e,1)}catch(e){this.abort(e)}}).finally(()=>{--this.pullCount===0&&this.onBatchDone&&this.onBatchDone.resolve()})}}getImport(e){if(e instanceof rE&&e.entry&&e.entry.session===this)return e.entry.importId}importStub(e){if(this.abortReason)throw this.abortReason;let t=this.imports[e];return t||(t=new nE(this,e,!1),this.imports[e]=t),new rE(!1,t)}importPromise(e){if(this.abortReason)throw this.abortReason;if(this.imports[e])return new mT(Error(`Bug in RPC system: The peer sent a promise reusing an existing export ID.`));let t=new nE(this,e,!0);return this.imports[e]=t,new rE(!0,t)}getExport(e){return this.exports[e]?.hook}getPipeReadable(e){let t=this.exports[e];if(!t||!t.pipeReadable)throw Error(`Export ${e} is not a pipe or its readable end was already consumed.`);let n=t.pipeReadable;return t.pipeReadable=void 0,n}getLimits(){return this.limits}createPipe(e,t){if(this.abortReason)throw this.abortReason;this.send([`pipe`]);let n=this.imports.length,r=new nE(this,n,!1);this.imports.push(r);let i=new rE(!1,r),a=fT.createWritableStreamFromHook(i);return e.pipeTo(a).catch(()=>{}).finally(()=>t.dispose()),n}send(e){if(this.abortReason!==void 0)return 0;if(this.encodingLevel===`string`){let t;try{t=JSON.stringify(e)}catch(e){try{this.abort(e)}catch{}throw e}try{let e=this.transport.send(t);e!==void 0&&typeof e.catch==`function`&&e.catch(e=>this.abort(e,!1))}catch(e){queueMicrotask(()=>this.abort(e,!1))}return t.length}try{let t=this.transport.send(e);if(typeof t==`number`)return t;let n=t;n&&typeof n.then==`function`&&Promise.resolve(n).catch(e=>this.abort(e,!1));return}catch(e){queueMicrotask(()=>this.abort(e,!1));return}}sendCall(e,t,n){if(this.abortReason)throw n?.dispose(),this.abortReason;let r=[`pipeline`,e,t];if(n){let e;try{e=KT.devaluate(n.value,void 0,this,n,this.encodingLevel)}catch(e){throw n.dispose(),e}r.push(e[0])}this.send([`push`,r]);let i=new nE(this,this.imports.length,!1);return this.imports.push(i),new rE(!0,i)}sendStream(e,t,n){if(this.abortReason)throw n.dispose(),this.abortReason;let r=[`pipeline`,e,t],i;try{i=KT.devaluate(n.value,void 0,this,n,this.encodingLevel)}catch(e){throw n.dispose(),e}r.push(i[0]);let a=[`stream`,r],o=this.send(a);o===void 0&&(o=tE(a));let s=this.imports.length,c=new nE(this,s,!0);return c.remoteRefcount=0,c.localRefcount=1,this.imports.push(c),{promise:c.awaitResolution().then(e=>{e.dispose(),delete this.imports[s]},e=>{throw delete this.imports[s],e}),size:o}}sendMap(e,t,n,r){if(this.abortReason){for(let e of n)e.dispose();throw this.abortReason}let i=[`remap`,e,t,n.map(e=>{let t=this.getImport(e);return t===void 0?[`export`,this.exportStub(e)]:[`import`,t]}),r];this.send([`push`,i]);let a=new nE(this,this.imports.length,!1);return this.imports.push(a),new rE(!0,a)}sendPull(e){if(this.abortReason)throw this.abortReason;this.send([`pull`,e])}sendRelease(e,t){this.abortReason||(this.send([`release`,e,t]),delete this.imports[e])}abort(e,t=!0){if(this.abortReason===void 0){if(this.cancelReadLoop?.(e),this.cancelReadLoop=void 0,t)try{let t=[`abort`,KT.devaluate(e,void 0,this,void 0,this.encodingLevel)];if(this.encodingLevel===`string`){let e=this.transport.send(JSON.stringify(t));e!==void 0&&typeof e.catch==`function`&&e.catch(e=>{})}else{let e=this.transport.send(t);e&&typeof e.then==`function`&&Promise.resolve(e).catch(e=>{})}}catch{}if(e===void 0&&(e=`undefined`),this.abortReason=e,this.onBatchDone&&this.onBatchDone.reject(e),this.transport.abort)try{this.transport.abort(e)}catch(e){Promise.resolve(e)}for(let t of Object.values(this.onBrokenCallbacks))try{t(e)}catch(e){Promise.resolve(e)}for(let t in this.imports)this.imports[t].abort(e);for(let e in this.exports)this.exports[e].hook.dispose()}}async readLoop(){for(;!this.abortReason;){let e=Promise.withResolvers();this.cancelReadLoop=e.reject;let t;try{t=await Promise.race([this.transport.receive(),e.promise])}finally{this.cancelReadLoop===e.reject&&(this.cancelReadLoop=void 0)}if(this.encodingLevel===`string`&&t.length>this.limits.maxMessageSize)throw TypeError(`Incoming message exceeds maximum size of ${this.limits.maxMessageSize} UTF-16 code units.`);if(this.abortReason)break;let n=this.encodingLevel===`string`?JSON.parse(t):t;if(n instanceof Array)switch(n[0]){case`push`:if(n.length>1){let e=new jT(new YT(this,this.encodingLevel).evaluate(n[1]));e.ignoreUnhandledRejections(),this.exports.push({hook:e,refcount:1});continue}break;case`stream`:if(n.length>1){let e=new jT(new YT(this,this.encodingLevel).evaluate(n[1]));e.ignoreUnhandledRejections();let t=this.exports.length;this.exports.push({hook:e,refcount:1,autoRelease:!0}),this.ensureResolvingExport(t);continue}break;case`pipe`:{let{readable:e,writable:t}=new TransformStream,n=fT.createWritableStreamHook(t),r=this.exports.length;this.exports.push({hook:n,refcount:1,pipeReadable:e}),this.watchExport(r,n);continue}case`pull`:{let e=n[1];if(typeof e==`number`){this.ensureResolvingExport(e);continue}break}case`resolve`:case`reject`:{let e=n[1];if(typeof e==`number`&&n.length>2){let t=this.imports[e];if(t){if(n[0]==`resolve`)t.resolve(new jT(new YT(this,this.encodingLevel).evaluate(n[2])));else{let e=new YT(this,this.encodingLevel).evaluate(n[2]);e.dispose(),t.resolve(new mT(e.value))}}else n[0]==`resolve`&&new YT(this,this.encodingLevel).evaluate(n[2]).dispose();continue}break}case`release`:{let e=n[1],t=n[2];if(typeof e==`number`&&typeof t==`number`){this.releaseExport(e,t);continue}break}case`abort`:{let e=new YT(this,this.encodingLevel).evaluate(n[1]);e.dispose(),this.abort(e.value,!1);break}}throw Error(`bad RPC message: ${JSON.stringify(n)}`)}}async drain(){if(this.abortReason)throw this.abortReason;if(this.pullCount>0){let{promise:e,resolve:t,reject:n}=Promise.withResolvers();this.onBatchDone={resolve:t,reject:n},await e}}getStats(){let e={imports:0,exports:0};for(let t in this.imports)++e.imports;for(let t in this.exports)++e.exports;return e}},oE=class{#e;#t;constructor(e,t,n={}){let r;r=t?new jT(OT.fromAppReturn(t)):new mT(Error(`This connection has no main object.`)),this.#e=new aE(e,r,n),this.#t=new bT(this.#e.getMainImport())}getRemoteMain(){return this.#t}getStats(){return this.#e.getStats()}drain(){return this.#e.drain()}};function sE(e,t,n){return new oE(new cE(e),t,n).getRemoteMain()}var cE=class{encodingLevel=`structuredClonable`;constructor(e){this.#e=e,e.start(),e.addEventListener(`message`,e=>{this.#i||(e.data===null?this.#a(Error(`Peer closed MessagePort connection.`)):this.#t?(this.#t(e.data),this.#t=void 0,this.#n=void 0):this.#r.push(e.data))}),e.addEventListener(`messageerror`,e=>{this.#a(Error(`MessagePort message error.`))})}#e;#t;#n;#r=[];#i;send(e){if(this.#i)throw this.#i;this.#e.postMessage(e)}async receive(){if(this.#r.length>0)return this.#r.shift();if(this.#i)throw this.#i;return new Promise((e,t)=>{this.#t=e,this.#n=t})}abort(e){try{this.#e.postMessage(null)}catch{}this.#e.close(),this.#i||=e}#a(e){this.#i||(this.#i=e,this.#n&&=(this.#n(e),this.#t=void 0,void 0))}},lE,uE=class{context;captureMap=new Map;instructions=[];constructor(e,t){this.context=lE?{parent:lE,captures:[],subject:lE.capture(e),path:t}:{parent:void 0,captures:[],subject:e,path:t},lE=this}unregister(){lE=this.context.parent}makeInput(){return new fE(this,0)}makeOutput(e){let t;try{t=KT.devaluate(e.value,void 0,this,e)}finally{e.dispose()}return this.instructions.push(t),this.context.parent?(this.context.parent.instructions.push([`remap`,this.context.subject,this.context.path,this.context.captures.map(e=>[`import`,e]),this.instructions]),new fE(this.context.parent,this.context.parent.instructions.length)):this.context.subject.map(this.context.path,this.context.captures,this.instructions)}pushCall(e,t,n){let r=KT.devaluate(n.value,void 0,this,n);r=r[0];let i=this.capture(e.dup());return this.instructions.push([`pipeline`,i,t,r]),new fE(this,this.instructions.length)}pushGet(e,t){let n=this.capture(e.dup());return this.instructions.push([`pipeline`,n,t]),new fE(this,this.instructions.length)}capture(e){if(e instanceof fE&&e.mapper===this)return e.idx;let t=this.captureMap.get(e);if(t===void 0){if(this.context.parent){let t=this.context.parent.capture(e);this.context.captures.push(t)}else this.context.captures.push(e);t=-this.context.captures.length,this.captureMap.set(e,t)}return t}exportStub(e){throw Error(`Can't construct an RpcTarget or RPC callback inside a mapper function. Try creating a new RpcStub outside the callback first, then using it inside the callback.`)}exportPromise(e){return this.exportStub(e)}getImport(e){return this.capture(e)}unexport(e){}createPipe(e){throw Error(`Cannot send ReadableStream inside a mapper function.`)}onSendError(e){}};uT.sendMap=(e,t,n)=>{let r=new uE(e,t),i;try{i=OT.fromAppReturn(_T(r.pushCall.bind(r),()=>n(new xT(r.makeInput(),[]))))}finally{r.unregister()}if(i instanceof Promise)throw i.catch(e=>{}),Error(`RPC map() callbacks cannot be async.`);return new xT(r.makeOutput(i),[])};function dE(){throw Error(`Attempted to use an abstract placeholder from a mapper function. Please make sure your map function has no side effects.`)}var fE=class extends pT{mapper;idx;constructor(e,t){super(),this.mapper=e,this.idx=t}dup(){return this}dispose(){}get(e){if(e.length==0)return this;if(lE)return lE.pushGet(this,e);dE()}call(e,t){t.dispose(),dE()}map(e,t,n){for(let e of t)e.dispose();dE()}pull(){dE()}ignoreUnhandledRejections(){}onBroken(e){dE()}},pE=class{captures;variables;constructor(e,t){this.captures=e,this.variables=[t]}dispose(){for(let e of this.variables)e.dispose()}apply(e){try{if(e.length<1)throw Error(`Invalid empty mapper function.`);for(let t of e.slice(0,-1)){let e=new YT(this).evaluateCopy(t);if(e.value instanceof bT){let t=wT(e.value);if(t){this.variables.push(t);continue}}this.variables.push(new jT(e))}return new YT(this).evaluateCopy(e[e.length-1])}finally{for(let e of this.variables)e.dispose()}}importStub(e){throw Error(`A mapper function cannot refer to exports.`)}importPromise(e){return this.importStub(e)}getExport(e){return e<0?this.captures[-e-1]:this.variables[e]}getPipeReadable(e){throw Error(`A mapper function cannot use pipe readables.`)}getLimits(){return FT}};function mE(e,t,n,r,i){let a=new pE(r,new jT(OT.deepCopyFrom(e,t,n)));try{return a.apply(i)}finally{a.dispose()}}uT.applyMap=(e,t,n,r,i)=>{try{let a;if(e instanceof xT)throw Error(`applyMap() can't be called on RpcPromise`);if(e instanceof Array){let t=[];try{for(let a of e)t.push(mE(a,e,n,r,i))}catch(e){for(let e of t)e.dispose();throw e}a=OT.fromArray(t)}else a=e==null?OT.fromAppReturn(e):mE(e,t,n,r,i);return new jT(a)}finally{for(let e of r)e.dispose()}};var hE=class e extends pT{state;static create(t){let n=t.getWriter();return new e({refcount:1,writer:n,closed:!1})}constructor(e,t){super(),this.state=e,t&&++e.refcount}getState(){if(this.state)return this.state;throw Error(`Attempted to use a WritableStreamStubHook after it was disposed.`)}call(e,t){try{let n=this.getState();if(e.length!==1||typeof e[0]!=`string`)throw Error(`WritableStream stub only supports direct method calls`);let r=e[0];if(r!==`write`&&r!==`close`&&r!==`abort`)throw Error(`Unknown WritableStream method: ${r}`);return(r===`close`||r===`abort`)&&(n.closed=!0),new PT((r===`write`?t.deliverStreamWrite(n.writer):t.deliverCall(n.writer[r],n.writer)).then(e=>new jT(e)))}catch(e){return t.dispose(),new mT(e)}}map(e,t,n){for(let e of t)e.dispose();return new mT(Error(`Cannot use map() on a WritableStream`))}get(e){return new mT(Error(`Cannot access properties on a WritableStream stub`))}dup(){let t=this.getState();return new e(t,this)}pull(){return Promise.reject(Error(`Cannot pull a WritableStream stub`))}ignoreUnhandledRejections(){}dispose(){let e=this.state;this.state=void 0,e&&--e.refcount===0&&(e.closed||e.writer.abort(Error(`WritableStream RPC stub was disposed without calling close()`)).catch(()=>{}),e.writer.releaseLock())}onBroken(e){this.getState().writer.closed.then(void 0,e)}},gE=262144,_E=1073741824,vE=65536,yE=2,bE=1.25,xE=.9,SE=3,CE=class{now;window=gE;bytesInFlight=0;inStartupPhase=!0;delivered=0;deliveredTime=0;firstAckTime=0;firstAckDelivered=0;minRtt=1/0;roundsWithoutIncrease=0;lastRoundWindow=0;roundStartTime=0;constructor(e){this.now=e}onSend(e){this.bytesInFlight+=e;let t={sentTime:this.now(),size:e,deliveredAtSend:this.delivered,deliveredTimeAtSend:this.deliveredTime,windowAtSend:this.window,windowFullAtSend:this.bytesInFlight>=this.window};return{token:t,shouldBlock:t.windowFullAtSend}}onError(e){this.bytesInFlight-=e.size}onAck(e){let t=this.now();this.delivered+=e.size,this.deliveredTime=t,this.bytesInFlight-=e.size;let n=t-e.sentTime;if(this.minRtt=Math.min(this.minRtt,n),this.firstAckTime===0)this.firstAckTime=t,this.firstAckDelivered=this.delivered;else{let n,r;e.deliveredTimeAtSend===0?(n=this.firstAckTime,r=this.firstAckDelivered):(n=e.deliveredTimeAtSend,r=e.deliveredAtSend);let i=t-n,a=(this.delivered-r)/i,o=this.inStartupPhase?yE:bE,s=a*this.minRtt*o;s=Math.min(s,e.windowAtSend*o),s=e.windowFullAtSend?Math.max(s,e.windowAtSend*xE):Math.max(s,this.window),this.window=Math.max(Math.min(s,_E),vE),this.inStartupPhase&&e.sentTime>=this.roundStartTime&&(this.window>this.lastRoundWindow*bE?this.roundsWithoutIncrease=0:++this.roundsWithoutIncrease>=SE&&(this.inStartupPhase=!1),this.roundStartTime=t,this.lastRoundWindow=this.window)}return this.bytesInFlight<this.window}};function wE(e){let t,n=!1,r=new CE(()=>performance.now()),i,a,o=()=>{n||(n=!0,e.dispose())};return new WritableStream({start(n){e.onBroken(e=>{t===void 0&&(t=e,n.error(e),o()),a&&=(a(e),i=void 0,void 0)})},write(n,s){if(t!==void 0)throw t;let c=OT.fromAppParams([n]),{promise:l,size:u}=e.stream([`write`],c);if(u===void 0)return l.catch(e=>{throw t===void 0&&(t=e),e});{let{token:e,shouldBlock:n}=r.onSend(u);if(l.then(()=>{r.onAck(e)&&i&&(i(),i=void 0,a=void 0)},n=>{r.onError(e),t===void 0&&(t=n,s.error(n),o()),a&&=(a(n),i=void 0,void 0)}),n)return new Promise((e,t)=>{i=e,a=t})}},async close(){if(t!==void 0)throw o(),t;let{promise:n}=e.stream([`close`],OT.fromAppParams([]));try{await n}catch(e){throw t??e}finally{o()}},abort(n){if(t!==void 0)return;t=n??Error(`WritableStream was aborted`),a&&=(a(t),i=void 0,void 0);let{promise:r}=e.stream([`abort`],OT.fromAppParams([n]));r.then(()=>o(),()=>o())}})}var TE=class e extends pT{state;static create(t){return new e({refcount:1,stream:t,canceled:!1})}constructor(e,t){super(),this.state=e,t&&++e.refcount}call(e,t){return t.dispose(),new mT(Error(`Cannot call methods on a ReadableStream stub`))}map(e,t,n){for(let e of t)e.dispose();return new mT(Error(`Cannot use map() on a ReadableStream`))}get(e){return new mT(Error(`Cannot access properties on a ReadableStream stub`))}dup(){let t=this.state;if(!t)throw Error(`Attempted to dup a ReadableStreamStubHook after it was disposed.`);return new e(t,this)}pull(){return Promise.reject(Error(`Cannot pull a ReadableStream stub`))}ignoreUnhandledRejections(){}dispose(){let e=this.state;this.state=void 0,e&&--e.refcount===0&&(e.canceled||(e.canceled=!0,e.stream.locked||e.stream.cancel(Error(`ReadableStream RPC stub was disposed without being consumed`)).catch(()=>{})))}onBroken(e){}};fT.createWritableStreamHook=hE.create,fT.createWritableStreamFromHook=wE,fT.createReadableStreamHook=TE.create;var EE=bT,DE=aT,OE=sE;function kE(e){return e<32||e>=127&&e<=159||e===1564||e>=8203&&e<=8207||e===8232||e===8233||e>=8234&&e<=8238||e>=8294&&e<=8297||e===65279}function AE(e,t=80){let n=``;for(let t=0;t<e.length;t+=1){let r=e.charCodeAt(t);n+=kE(r)?` `:e.charAt(t)}return n=n.replace(/\s+/gu,` `).trim(),n.length<=t?n:`${n.slice(0,Math.max(0,t-1)).trimEnd()}…`}function jE(e,t){let n=e.find(e=>e.id===t.itemId);if(n===void 0||n.kind===`text`)return!1;if(n.kind===`menu`){let e=n.options.find(e=>e.id===t.optionId);return e!==void 0&&e.disabled!==!0}return t.optionId===void 0?n.kind!==`button`||n.disabled!==!0:!1}Object.freeze({publish:()=>Promise.resolve(),onBack:()=>()=>void 0,onForward:()=>()=>void 0,onActivate:()=>()=>void 0});function ME(e,t){if(t.kind===`action`){let n=[...e.primary??[],...e.menu??[]].find(e=>e.id===t.actionId);return n!==void 0&&n.disabled!==!0}let n=e.crumbs?.find(e=>e.id===t.crumbId);return n===void 0?!1:t.siblingId===void 0||n.siblings?.some(e=>e.id===t.siblingId)===!0}function NE(e){let t=e.trim().toLowerCase();if(!t)throw Error(`Invalid keymap token: token cannot be empty`);return t}function PE(e){let t=e.trim().toLowerCase();if(!t)throw Error(`Invalid key name: key name cannot be empty`);return t}function FE(e){return{name:PE(e.name),ctrl:e.ctrl??!1,shift:e.shift??!1,meta:e.meta??!1,super:e.super??!1,hyper:e.hyper||void 0}}function IE(e){return{name:e.name,ctrl:e.ctrl,shift:e.shift,meta:e.meta,super:e.super,hyper:e.hyper||void 0}}function LE(e,t){let n=IE(FE(e));return{stroke:n,display:t?.display??GE(n),match:t?.match??VE(n),tokenName:t?.tokenName?NE(t.tokenName):void 0}}function RE(e){return{stroke:IE(e.stroke),display:e.display,match:e.match,tokenName:e.tokenName,patternName:e.patternName,payloadKey:e.payloadKey}}function zE(e){return e.map(e=>RE(e))}function BE(e){return`match`in e?e.match:`stroke`in e?VE(e.stroke):VE(e)}function VE(e){return`key:${KE(FE(e))}`}function HE(e){let t=e.trim();if(!t)throw Error(`Invalid keymap match id: id cannot be empty`);return`text:${t}`}function UE(e,t){return`stroke`in e?t?.preferDisplay&&e.display?e.display:GE(e.stroke):GE(FE(e))}function WE(e,t){return e.map(e=>UE(e,t)).join(t?.separator??``)}function GE(e){let t=[];return e.ctrl&&t.push(`ctrl`),e.shift&&t.push(`shift`),e.meta&&t.push(`meta`),e.super&&t.push(`super`),e.hyper&&t.push(`hyper`),t.push(e.name===`return`?`enter`:e.name),t.join(`+`)}function KE(e){return`${e.name}:${+!!e.ctrl}:${+!!e.shift}:${+!!e.meta}:${+!!e.super}:${+!!e.hyper}`}var qE=Symbol(`keymap-extension-context`);function JE(e){return e.isDestroyed?null:e.getFocusedTarget()}function YE(e,t,n){let r=t??e.rootTarget,i=t!==null;for(;r;){if(n(r,i)===!1)return;r=e.getParentTarget(r),i=!1}}function XE(e,t){let n=new Set;return YE(e,t,e=>{n.add(e)}),n}function ZE(e,t,n){let r=[],i=XE(t,n),a=Array.isArray(e)?e:QE(e);for(let e of a)$E(t,e,n,i)&&r.push(e);return r}function QE(e){return[...e].sort((e,t)=>t.priority-e.priority||t.order-e.order)}function $E(e,t,n,r=XE(e,n)){let i=t.target;return i?e.isTargetDestroyed(i)?!1:t.targetMode===`focus`?i===n:r.has(i):!0}function eD(e){let t=e.binding.sequence[e.index];if(!t?.patternName)return 0;let n=e.patterns?.at(-1);return n?.name===t.patternName?n.values.length:0}function tD(e,t,n=!0){let r=e.binding.sequence[e.index];if(!r?.patternName)return!0;let i=t.get(r.patternName);return i?eD(e)>=i.min:n}function nD(e,t,n=!0){let r=e.binding.sequence[e.index];if(r?.patternName){let n=t.get(r.patternName);if(n&&eD(e)<n.max)return!0}return tD(e,t,n)&&e.index+1<e.binding.sequence.length}function rD(e,t){return e.index===e.binding.sequence.length-1&&tD(e,t,!1)}function iD(e,t,n,r){return{parent:e,depth:e?e.depth+1:0,stroke:t,match:n,pattern:r,children:new Map,patternChildren:[],bindings:[],reachableBindings:[]}}function aD(e,t){let n=iD(null,null,null);for(let r of e){if(r.event!==`press`)continue;let e=n;for(let n of r.sequence){let i;if(n.patternName){let r=t.get(n.patternName);i=e.patternChildren.find(e=>e.pattern?.name===n.patternName),i||(i=iD(e,n.stroke,n.match,r),e.patternChildren.push(i))}else i=e.children.get(n.match),i||(i=iD(e,n.stroke,n.match),e.children.set(n.match,i));i.reachableBindings.push(r),e=i}e.bindings.push(r)}return n}function oD(e,t){let n=[];for(let r of e){if(!tD(r,t))continue;let e=r.index+1,i=r.binding.sequence[e];i&&n.push({part:i,binding:r.binding,index:e,exact:e===r.binding.sequence.length-1,continues:e<r.binding.sequence.length-1})}return n}function sD(e,t,n,r){let i=n.patternName;if(!i)return{...e,index:t};let a=[...e.patterns??[]],o=a.at(-1);return o?.name===i?a[a.length-1]={...o,values:[...o.values,r],parts:[...o.parts,n]}:a.push({name:i,payloadKey:n.payloadKey??i,values:[r],parts:[n]}),{layer:e.layer,binding:e.binding,index:t,parts:[...e.parts,n],patterns:a}}function cD(e,t){let n=e.parts.at(-1);if(!n||n.patternName)return t.length;let r=t.indexOf(n.match);return r===-1?t.length:r}function lD(e,t,n,r,i,a,o,s,c){let l=t.sequence[n];if(l){if(l.patternName){let a=s(l.patternName,o);if(!a)return;let u=c(o,l.patternName,a);return sD({layer:e,binding:t,index:n,parts:r,patterns:i},n,u,a.value??o.name)}if(a.includes(l.match))return{layer:e,binding:t,index:n,parts:[...r,l],patterns:i}}}function uD(e,t,n,r,i,a){let o=e.binding.sequence[e.index];if(o?.patternName){let s=r.get(o.patternName);if(s&&eD(e)<s.max){let t=i(s.name,n);if(t){let r=a(n,s.name,t);return sD(e,e.index,r,t.value??n.name)}}return tD(e,r,!1)?lD(e.layer,e.binding,e.index+1,e.parts,e.patterns,t,n,i,a):void 0}return lD(e.layer,e.binding,e.index+1,e.parts,e.patterns,t,n,i,a)}function dD(e,t,n,r,i){let a=[],o=1/0;for(let s of e.bindings){if(s.event!==`press`)continue;let c=lD(e,s,0,[],void 0,t,n,r,i);if(!c)continue;let l=cD(c,t);l<o&&(o=l,a.length=0),l===o&&a.push(c)}return a}import.meta.require;function fD(e){let t=Object.create(null),n=(e,n)=>{let r=t[e];if(!r)return;let i=r.filter(e=>e!==n);i.length===0?delete t[e]:i.length!==r.length&&(t[e]=i)};return{hook(e,r){return t[e]=[...t[e]??[],r],()=>n(e,r)},has(e){return(t[e]?.length??0)>0},emit(n,...r){let i=t[n];if(i)for(let t of i)try{r.length===0?t():t(r[0])}catch(t){e(n,t)}}}}function pD(){let e=[];return{get:()=>e,set:t=>{e=t},remove(t){e=e.filter(e=>e!==t)},has:()=>e.length>0,clear:()=>{e=[]}}}function mD(){let e=pD();return{append(t){return e.set([...e.get(),t]),()=>e.remove(t)},prepend(t){return e.set([t,...e.get()]),()=>e.remove(t)},values:e.get,has:e.has,clear:e.clear}}function hD(){let e=pD(),t=0;return{register(n,r){let i={...r,listener:n,order:t++};return e.set([...e.get(),i].sort((e,t)=>t.priority-e.priority||e.order-t.order)),()=>e.remove(i)},entries:e.get,has:e.has,clear:e.clear}}function gD(e){return typeof e==`string`||!!e&&typeof e==`object`&&!Array.isArray(e)}function _D(e){if(!Array.isArray(e))return{ok:!1,reason:`Invalid keymap bindings: expected an array of binding objects`};for(let[t,n]of e.entries()){if(!n||typeof n!=`object`||Array.isArray(n))return{ok:!1,reason:`Invalid keymap binding at index ${t}: expected a binding object`};if(!gD(n.key))return{ok:!1,reason:`Invalid keymap binding at index ${t}: expected "key" to be a string or keystroke object`}}return{ok:!0}}function vD(e){let t=_D(e);if(!t.ok)throw Error(t.reason);return e.map(e=>({...e,key:typeof e.key==`string`?e.key:{...e.key}}))}function yD(e){return{...e,sequence:zE(e.sequence)}}function bD(e,t){let n=mD();return{prependLayerAnalyzer(e){return n.prepend(e)},appendLayerAnalyzer(e){return n.append(e)},clearLayerAnalyzers(){n.clear()},analyzeLayer(r){let i=n.values();if(i.length===0)return;let a=xD(r.bindings),o={target:r.target,order:r.order,sourceBindings:r.sourceBindings,bindings:a,hasTokenBindings:r.hasTokenBindings,checkCommandResolution(e){return t.getCommandResolutionStatus(e,r.commands)},warn(t,n,r){e.emitWarning(t,n,r)},warnOnce(t,n,r,i){e.warnOnce(t,n,r,i)},error(t,n,r){e.emitError(t,n,r)}};for(let t of i)try{t(o)}catch(t){e.emitError(`layer-analyzer-error`,t,`[Keymap] Error in layer analyzer:`)}}}}function xD(e){return e.map(t=>({sequence:zE(t.sequence),command:t.command,attrs:t.attrs,event:t.event,preventDefault:t.preventDefault,fallthrough:t.fallthrough,parsedBinding:yD(t.parsedBinding),sourceTarget:t.sourceTarget,sourceLayerOrder:t.sourceLayerOrder,bindingIndex:t.bindingIndex,hasCommandAtSequence:e.some(e=>e.event===`press`&&e.command!==void 0&&SD(e,t)),hasContinuations:e.some(e=>e.event===`press`&&CD(t,e))}))}function SD(e,t){return e.sequence.length===t.sequence.length&&e.sequence.every((e,n)=>e.match===t.sequence[n]?.match)}function CD(e,t){return e.sequence.length<t.sequence.length&&e.sequence.every((e,n)=>e.match===t.sequence[n]?.match)}function wD(){return{version:-1,notifyVersion:-1,focused:void 0,value:[],targets:new WeakMap}}function TD(){return{plain:wD(),bindings:wD(),metadata:wD(),bindingsAndMetadata:wD()}}function ED(e,t){if(t===void 0)return e.plain;let n=t.includeBindings===!0,r=t.includeMetadata===!0;return n?r?e.bindingsAndMetadata:e.bindings:r?e.metadata:e.plain}function DD(e,t,n){let r=n?e.targets.get(n):e.nullTarget;return r?.version===t?r:void 0}function OD(e,t,n,r){let i={version:t,value:r};n?e.targets.set(n,i):e.nullTarget=i}function kD(e,t){if(e===t)return!0;if(!e||!t||e.captures.length!==t.captures.length)return!1;for(let n=0;n<e.captures.length;n+=1){let r=e.captures[n],i=t.captures[n];if(!r||!i||r.layer!==i.layer||r.binding!==i.binding||r.index!==i.index||r.parts.length!==i.parts.length)return!1;for(let e=0;e<r.parts.length;e+=1)if(r.parts[e]?.match!==i.parts[e]?.match)return!1;let a=r.patterns??[],o=i.patterns??[];if(a.length!==o.length)return!1;for(let e=0;e<a.length;e+=1){let t=a[e],n=o[e];if(!t||!n||t.name!==n.name||t.values.length!==n.values.length)return!1;for(let e=0;e<t.values.length;e+=1)if(!Object.is(t.values[e],n.values[e]))return!1}}return!0}function AD(e){let t=e.parts.at(-1);if(!t||e.parts.length<=1)return;let n=e.index-1,r=e.patterns;if(t.patternName){let i=r?.at(-1);i?.name===t.patternName&&(i.values.length>1?(n=e.index,r=[...(r??[]).slice(0,-1),{...i,values:i.values.slice(0,-1),parts:i.parts.slice(0,-1)}]):r=(r??[]).slice(0,-1))}return{layer:e.layer,binding:e.binding,index:n,parts:e.parts.slice(0,-1),patterns:r}}function jD(e){let t=e.captures[0];if(!t||t.parts.length===0)return[];let n=[];for(let r=0;r<t.parts.length;r+=1){let i=t.parts[r];if(!i)continue;let a,o,s=!1,c=!1;for(let t of e.captures){let e=t.parts[r];if(e){if(a===void 0){a=e.display,o=e.tokenName;continue}!s&&a!==e.display&&(s=!0),!c&&o!==e.tokenName&&(c=!0)}}(a===void 0||s)&&(a=UE(i.stroke)),c&&(o=void 0),n.push(LE(i.stroke,{display:a,match:i.match,tokenName:o}))}return n}function MD(e){if(e.isDestroyed)throw Error(`Cannot use a keymap after its host was destroyed`);return e}function ND(e,t,n,r,i,a,o={}){let s=TD(),c=-1,l=[],u=()=>MD(t).getFocusedTarget(),d=()=>JE(t),f=t=>{let n=e.pending;kD(n,t)||(e.pending=t,o.onPendingSequenceChanged?.(n,t),V(),r.queueStateChange())},p=()=>{let t=e.pending;if(!t)return;let n=u(),r=a.getActiveCommandView(n),o=t.captures.filter(t=>e.layers.has(t.layer)&&C(t.layer,n)&&i.matchesConditions(t.layer)&&D(t.binding,n,r)&&nD(t,e.patterns));if(o.length===0){f(null);return}return o.length!==t.captures.length&&f({captures:o}),e.pending??void 0},m=()=>{t.isDestroyed||!e.pending||p()},h=()=>!t.isDestroyed&&e.pending!==null,g=()=>{if(c===e.cacheVersion)return l;let t=p(),n=t?jD(t):[];return(!t||T())&&(c=e.cacheVersion,l=n),n},_=()=>{let e=p();if(!e)return!1;let t=e.captures[0];if(!t||t.parts.length<=1)return f(null),!0;let n=[];for(let t of e.captures){let e=AD(t);e&&n.push(e)}return n.length===0?(f(null),!0):(f({captures:n}),!0)},v=t=>{let n=t?.includeBindings===!0,r=t?.includeMetadata===!0,i=ED(s,t);return i.notifyVersion===e.derivedVersion?i.value:y(i,n,r)},y=(n,r,i)=>{t.isDestroyed&&MD(t);let o=u(),s=DD(n,e.cacheVersion,o);if(s)return n.notifyVersion=e.derivedVersion,n.version=e.cacheVersion,n.focused=o,n.value=s.value,s.value;let c=a.getActiveCommandView(o),l=p(),d=l?[]:S(o),f=l?F(l.captures,r,i,o,c):j(d,r,i,o,c);return(l?T():w(d))&&(n.version=e.cacheVersion,n.notifyVersion=e.derivedVersion,n.focused=o,n.value=f,OD(n,e.cacheVersion,o,f)),f},b=(e,t)=>{let n=t?.includeBindings===!0,r=t?.includeMetadata===!0,i=u(),o=a.getActiveCommandView(i);return F(e,n,r,i,o)},x=(e,t)=>{let n=t?.includeBindings===!0,r=t?.includeMetadata===!0,i=e===d()?p():void 0,o=a.getActiveCommandView(e);return i?F(i.captures,n,r,e,o):j(S(e),n,r,e,o)},S=n=>e.activeLayersCacheVersion===e.cacheVersion&&e.activeLayersCacheFocused===n?e.activeLayersCache:(e.activeLayersCacheVersion=e.cacheVersion,e.activeLayersCacheFocused=n,e.activeLayersCache=ZE(e.sortedLayers,t,n),e.activeLayersCache),C=(e,n)=>$E(t,e,n),w=t=>!e.commandResolvers.has()&&e.activeKeyCacheBlockers===0,T=()=>!e.commandResolvers.has()&&e.activeKeyCacheBlockers===0,E=(e,t,n)=>{let r=[];for(let o of e)i.matchesConditions(o)&&a.isBindingVisible(o,t,n)&&r.push(o);return r},D=(e,t,n)=>i.matchesConditions(e)&&a.isBindingVisible(e,t,n),O=(e,t)=>{let n,r,i=!1,a=!1;for(let o of e){let e=o.sequence[t];if(e){if(n===void 0){n=e.display,r=e.tokenName;continue}!i&&n!==e.display&&(i=!0),!a&&r!==e.tokenName&&(a=!0)}}if(n===void 0||i){let r=e[0]?.sequence[t]?.stroke;n=r?UE(r):``}return a&&(r=void 0),{display:n,tokenName:r}},k=(e,t,n)=>({sequence:e.sequence,command:e.command,commandAttrs:a.getBindingCommandAttrs(e,t,n),attrs:e.attrs,event:e.event,preventDefault:e.preventDefault,fallthrough:e.fallthrough}),A=(e,t,n)=>e.map(e=>k(e,t,n)),j=(e,t,n,r,a)=>{let o=new Map,s=new Set;for(let n of e)n.root.children.size===0&&n.root.patternChildren.length===0||!i.matchesConditions(n)||(M(n.root.children.values(),o,s,t,r,a),M(n.root.patternChildren,o,s,t,r,a));return R(o,t,n,r,a)},M=(e,t,n,r,i,a)=>{for(let o of e){let e=o.match;if(!e||n.has(e)||!o.stroke)continue;let s=N(o,r,i,a);if(!s)continue;let c=t.get(e);c?ne(c,s,r):t.set(e,B(o.stroke,s,r)),s.stop&&n.add(e)}},N=(e,t,n,r)=>{if(!(e.children.size>0||e.patternChildren.length>0)){let i=te(P(e)?E(e.bindings,n,r):e.bindings,n,r);if(!i)return;let a=O(i.bindings,e.depth-1);return{display:a.display,tokenName:a.tokenName,continues:!1,firstBinding:i.bindings[0],commandBinding:i.commandBinding,bindings:t?[...i.bindings]:void 0,stop:i.stop}}let i=E(e.reachableBindings,n,r);if(i.length===0)return;let a=te(e.bindings,n,r),o=O(i,e.depth-1);return{display:o.display,tokenName:o.tokenName,continues:!0,firstBinding:a?.bindings[0],commandBinding:a?.commandBinding,bindings:t&&a?[...a.bindings]:void 0,stop:!0}},P=t=>{if(e.commandResolvers.has())return!0;for(let e of t.bindings)if(e.matchers.length>0)return!0;return!1},F=(t,n,r,i,a)=>{let o=new Map,s=new Set;return I(oD(t,e.patterns),o,s,n,i,a),R(o,n,r,i,a)},I=(e,t,n,r,i,a)=>{let o=new Set;for(let s of e)o.has(s.part.match)||(o.add(s.part.match),L(s,e,t,n,r,i,a))},L=(e,t,n,r,i,a,o)=>{let s=e.part.match;if(r.has(s))return;let c=z(e,t,i,a,o);if(!c)return;let l=n.get(s);l?ne(l,c,i):n.set(s,B(e.part.stroke,c,i)),c.stop&&r.add(s)},R=(e,t,n,r,i)=>{let a=[];for(let o of e.values()){let e=re(o,t,n,r,i);e&&a.push(e)}return a},z=(e,t,n,r,i)=>{let a=t.filter(t=>t.part.match===e.part.match),o=a.filter(e=>e.exact).map(e=>e.binding),s=te(o,r,i),c=a.some(e=>e.continues);if(!c&&!s)return;let l=ee(a);return{display:l.display,tokenName:l.tokenName,continues:c,firstBinding:s?.bindings[0],commandBinding:s?.commandBinding,bindings:n&&s?[...s.bindings]:void 0,stop:c||s?.stop===!0}},ee=e=>{let t,n,r=!1,i=!1;for(let a of e){let e=a.part;if(t===void 0){t=e.display,n=e.tokenName;continue}!r&&t!==e.display&&(r=!0),!i&&n!==e.tokenName&&(i=!0)}let a=e[0]?.part;return(t===void 0||r)&&(t=a?UE(a.stroke):``),i&&(n=void 0),{display:t,tokenName:n}},te=(e,t,n)=>{let r=[],o;for(let s of e)if(!(!i.matchesConditions(s)||!a.isBindingVisible(s,t,n))&&(r.push(s),s.command!==void 0&&(o??=s,!s.fallthrough)))return{bindings:r,commandBinding:o,stop:!0};if(r.length!==0)return{bindings:r,commandBinding:o,stop:!1}},B=(e,t,n)=>({stroke:e,display:t.display,tokenName:t.tokenName,continues:t.continues,firstBinding:t.firstBinding,commandBinding:t.commandBinding,bindings:n&&t.bindings?[...t.bindings]:void 0}),ne=(e,t,n)=>{if(!e.firstBinding&&t.firstBinding&&(e.firstBinding=t.firstBinding),!e.commandBinding&&t.commandBinding&&(e.commandBinding=t.commandBinding),t.continues&&(e.continues=!0),!(!n||!t.bindings||t.bindings.length===0)){if(!e.bindings){e.bindings=[...t.bindings];return}e.bindings.push(...t.bindings)}},re=(e,t,n,r,i)=>{if(!e.commandBinding&&!e.continues)return;let o={stroke:IE(e.stroke),display:e.display,continues:e.continues};if(e.tokenName&&(o.tokenName=e.tokenName),e.commandBinding&&(o.command=e.commandBinding.command),t&&e.bindings&&e.bindings.length>0&&(o.bindings=e.bindings.length===1?[k(e.bindings[0],r,i)]:A(e.bindings,r,i)),n){e.firstBinding?.attrs&&(o.bindingAttrs=e.firstBinding.attrs);let t=e.commandBinding?a.getBindingCommandAttrs(e.commandBinding,r,i):void 0;t&&(o.commandAttrs=t)}return o},V=()=>{n.has(`pendingSequence`)&&n.emit(`pendingSequence`,e.pending?jD(e.pending):[])};return{getFocusedTarget:u,getFocusedTargetIfAvailable:d,setPendingSequence:f,ensureValidPendingSequence:p,revalidatePendingSequenceIfNeeded:m,hasPendingSequenceState:h,getPendingSequence:g,popPendingSequence:_,getActiveKeys:v,getActiveKeysForCaptures:b,getActiveKeysForFocused:x,getActiveLayers:S,isLayerActiveForFocused:C,collectSequencePartsFromPending:jD,collectMatchingBindings:E,collectActiveBindings:A}}var PD=new Set([`name`,`run`,`fields`,`attrs`,`rejectedResult`]),FD=new Set([`key`,`cmd`,`event`,`preventDefault`,`fallthrough`]),ID=new Set([`target`,`targetMode`,`priority`,`bindings`,`commands`]);function LD(e){if(e===void 0||typeof e==`function`)return e;let t=e.trim();if(!t)throw Error(`Invalid keymap command: command cannot be empty`);return t}function RD(e){let t=e.trim();if(!t)throw Error(`Invalid keymap command name: name cannot be empty`);if(/\s/.test(t))throw Error(`Invalid keymap command name "${e}": command names cannot contain whitespace`);return t}function zD(e,t,n){let r=e.get(t);r?r.push(n):e.set(t,[n])}function BD(e){let t=[],n=new Map;for(let r of e.layers)for(let e of r.commands){let i={layer:r,commandState:e};t.push(i),zD(n,e.command.name,i)}return{entries:t,chainsByName:n}}function VD(e,t,n){let r=[],i=[],a=new Map,o=new Map;for(let s of e)if(s.commands.length!==0&&!(n&&!t.matchesConditions(s)))for(let e of s.commands){if(!t.matchesConditions(e))continue;let n={layer:s,commandState:e};r.push(n),zD(o,e.command.name,n),a.has(e.command.name)||(a.set(e.command.name,n),i.push(n))}return{layers:e,entries:r,reachable:i,reachableByName:a,chainsByName:o}}function HD(e,t,n,r){return(e.activeLayersCacheVersion!==e.cacheVersion||e.activeLayersCacheFocused!==r)&&(e.activeLayersCacheVersion=e.cacheVersion,e.activeLayersCacheFocused=r,e.activeLayersCache=ZE(e.sortedLayers,t,r)),VD(e.activeLayersCache,n,!0)}function UD(e,t,n,r){if(Object.prototype.hasOwnProperty.call(e,t)&&!Object.is(e[t],n))throw Error(`Conflicting keymap requirement for "${t}" from ${r}`);e[t]=n}function WD(e,t,n,r){if(Object.prototype.hasOwnProperty.call(e,t)&&!Object.is(e[t],n))throw Error(`Conflicting keymap attribute for "${t}" from ${r}`);e[t]=n}function GD(e){let t=`field ${e.fieldName}`;return{require(n,r){UD(e.requirements,n,r,t)},attr(n,r){if(!e.attrs)throw Error(`Keymap ${t} cannot publish attrs`);WD(e.attrs,n,r,t)},activeWhen(n){e.matchers.push(e.conditions.buildRuntimeMatcher(n,t))}}}function KD(e){let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}function qD(e,t){return e instanceof Error&&e.message?e.message:t}function JD(e){return!e||typeof e!=`object`&&typeof e!=`function`?!1:typeof e.then==`function`}function YD(e,t){let n=t?.deep===!0,r=t?.freeze===!0,i=t?.preserveNonPlainObjects===!0;if(Array.isArray(e)){let i=n?e.map(e=>YD(e,t)):[...e];return r?Object.freeze(i):i}if(e&&typeof e==`object`){if(i&&!KD(e))return e;let a={};for(let[r,i]of Object.entries(e))a[r]=n?YD(i,t):i;return r?Object.freeze(a):a}return e}var XD=[`name`],ZD=Object.freeze({}),QD=new WeakMap;function $D(e,t,n,r,i){let a=-1,o,s=-1,c,l,u=-1,d,f,p=-1,m,h=-1,g=new Map,_=t=>tO({commands:t,commandFields:e.commandFields,conditions:r,onError:(e,t,r)=>{n.emitError(e,t,r)}}),v=t=>R(()=>e.commandResolvers.prepend(t),t),y=t=>R(()=>e.commandResolvers.append(t),t),b=()=>{e.commandResolvers.has()&&n.runWithStateChangeBatch(()=>{e.commandResolvers.clear(),i.onCommandResolversChanged(),n.queueStateChange()})},x=e=>ie(e).map(e=>eO(e.commandState)),S=e=>{let t=H(e),n=ie(e,t);if(n.length===0)return[];let r=n.map(e=>({entry:e,command:eO(e.commandState),commandAttrs:e.commandState.attrs,bindings:[]})),i=new Map;for(let[e,t]of r.entries()){let n=i.get(t.command.name);n?n.push(e):i.set(t.command.name,[e])}return i.size>0&&ae(r,i,t),r.map(e=>({command:e.command,bindings:e.bindings}))},C=t=>{if(t.visibility===`registered`&&u===e.derivedVersion&&d===t.commands&&f)return f;let n=new Map;for(let e of t.commands)n.has(e)||n.set(e,[]);return n.size===0?n:(oe(n,H(t)),t.visibility===`registered`&&(u=e.derivedVersion,d=t.commands,f=n),n)},w=(e,t,n)=>{let r=M(t);if(n){let i=[],a=r.chainsByName.get(e);if(a)for(let e of a)i.push({target:e.layer.target,command:e.commandState.command,attrs:e.commandState.attrs,payload:n.payload});let o=fe(e,t,{mode:`active`,execution:n});return o.resolved&&i.push(o.resolved),{entries:i.length>0?i:void 0,hadError:o.hadError}}let i=[];for(let t of r.chainsByName.get(e)??[])i.push({target:t.layer.target,command:t.commandState.command,attrs:t.commandState.attrs});let a=fe(e,t,{mode:`active`});return a.resolved&&i.push(a.resolved),{entries:i.length>0?i:void 0,hadError:a.hadError}},T=t=>{if(h!==e.derivedVersion&&(h=e.derivedVersion,g=new Map),g.has(t))return g.get(t)??void 0;let n=B(te(t));return g.set(t,n??null),n},E=(e,t)=>B(M(t).chainsByName.get(e)),D=(e,t)=>fe(e,null,{mode:`registered`,execution:t}),O=(e,t,n)=>fe(e,t,{mode:`active`,execution:n}),k=(e,t)=>z(e,t)?.command,A=e=>ee(e)?.commandState.command,j=(e,n,i)=>{let a=N().chainsByName.get(e);if(!a||a.length===0)return;let o,s;for(let e of a){if(!$E(t,e.layer,n)){o??=e;continue}(!r.matchesConditions(e.layer)||!r.matchesConditions(e.commandState))&&(s??=e)}let c=s??o;if(c)return{reason:s?`disabled`:`inactive`,command:i?c.commandState.command:void 0}},M=n=>{if(s===e.derivedVersion&&c===n&&l)return l;let i=HD(e,t,r,n);return P()&&(s=e.derivedVersion,c=n,l=i),i},N=()=>a===e.derivedVersion&&o?o:(a=e.derivedVersion,o=BD(e),o),P=()=>e.activeCommandViewCacheBlockers===0,F=(e,t,n)=>e.command===void 0||e.run?!0:typeof e.command==`string`?n.reachableByName.has(e.command)?!0:ne(e.command,t,`active`)!==void 0:!1,I=(e,t,n)=>{if(typeof e.command!=`string`)return;let r=n.reachableByName.get(e.command);return r?r.commandState.attrs:ne(e.command,t,`active`)?.attrs},L=(e,n)=>{if(n?.some(t=>t.command.name===e)||N().chainsByName.has(e))return`resolved`;let r=fe(e,JE(t));return r.resolved||r.hadError?r.resolved?`resolved`:`error`:`unresolved`},R=(t,r)=>n.runWithStateChangeBatch(()=>{let a=t();return i.onCommandResolversChanged(),n.queueStateChange(),()=>{n.runWithStateChangeBatch(()=>{a(),!e.commandResolvers.values().includes(r)&&(i.onCommandResolversChanged(),n.queueStateChange())})}}),z=(e,t)=>{let n=M(t).reachableByName.get(e);return n?{target:n.layer.target,command:n.commandState.command,attrs:n.commandState.attrs}:ne(e,t,`active`)},ee=e=>te(e)?.[0],te=t=>{let n=[];for(let r of e.sortedLayers)for(let e of r.commands)e.command.name===t&&n.push({layer:r,commandState:e});return n.length>0?n:void 0},B=e=>{if(e?.length)return e.map(e=>({target:e.layer.target,command:e.commandState.command,attrs:e.commandState.attrs}))},ne=(e,t,n)=>fe(e,t,{mode:n}).resolved,re=()=>N().entries,V=()=>{if(p===e.derivedVersion&&m)return m;let t=new Map;for(let n of e.layers)for(let e of n.bindings){if(typeof e.command!=`string`)continue;let n=t.get(e.command);n?n.push(e):t.set(e.command,[e])}return p=e.derivedVersion,m=t,t},H=e=>{let n=e?.visibility??`reachable`,r=e&&Object.prototype.hasOwnProperty.call(e,`focused`)?e.focused??null:JE(t);return n===`registered`?{visibility:n,focused:r}:{visibility:n,focused:r,activeView:M(r)}},ie=(e,t=H(e))=>{let r;return r=t.visibility===`registered`?re():t.visibility===`active`?t.activeView?.entries??[]:t.activeView?.reachable??[],oO({entries:r,query:e,getCommand:e=>eO(e),onFilterError:e=>{n.emitError(`command-query-filter-error`,e,`[Keymap] Error in command query filter:`)}})},ae=(e,t,n)=>{se(n,n=>{ce(e,t,n)})},oe=(e,t)=>{if(t.visibility===`registered`){let t=V();for(let[n,r]of e){let e=N().chainsByName.get(n)?.[0]?.commandState.attrs;for(let i of t.get(n)??[])r.push(ue(i,e))}return}se(t,n=>{le(e,n,t)})},se=(t,n)=>{if(t.visibility===`registered`){for(let t of e.layers)for(let e of t.bindings)n(e);return}let i=t.activeView;if(i){for(let e of i.layers)if(!(e.bindings.length===0||!r.matchesConditions(e)))for(let a of e.bindings)r.matchesConditions(a)&&F(a,t.focused,i)&&n(a)}},ce=(e,t,n)=>{if(typeof n.command!=`string`)return;let r=t.get(n.command);if(!(!r||r.length===0))for(let t of r){let r=e[t];r&&r.bindings.push(ue(n,r.commandAttrs))}},le=(e,t,n)=>{if(typeof t.command!=`string`)return;let r=e.get(t.command);r&&r.push(ue(t,de(t,n)))},ue=(e,t)=>({sequence:e.sequence,command:e.command,commandAttrs:t,attrs:e.attrs,event:e.event,preventDefault:e.preventDefault,fallthrough:e.fallthrough}),de=(e,t)=>{if(typeof e.command!=`string`)return;if(t.visibility===`registered`)return N().chainsByName.get(e.command)?.[0]?.commandState.attrs;let n=t.activeView;if(n)return I(e,t.focused,n)},fe=(t,r,i)=>{let a=i?.mode??`active`,o=i?.execution??{input:t},s=nO(t,e.commandResolvers.values(),()=>he(r,a,o),e=>{n.emitError(`command-resolver-error`,e,`[Keymap] Error in command resolver for "${t}":`)}),c=s.resolved;if(c){let e=me(c.command.name,r,a);e?.commandState.command===c.command&&c.target===void 0&&(c={...c,target:e.layer.target},s.resolved=c)}if(c&&!c.attrs){let e=pe(c.command.name,r,a)??aO(c.command);e&&(s.resolved={...c,attrs:e})}return s},pe=(e,t,n)=>n===`registered`?ee(e)?.commandState.attrs:M(t).reachableByName.get(e)?.commandState.attrs,me=(e,t,n)=>n===`registered`?ee(e):M(t).reachableByName.get(e),he=(e,t,n)=>{let r=n.input,i=n.payload;return{context:{get input(){return r},get payload(){return i},setInput(e){r=e},setPayload(e){i=e},getCommand:n=>t===`registered`?A(n):k(n,e)},getExecutionFields(){return{input:r,payload:i}}}};return{normalizeCommands:_,prependCommandResolver:v,appendCommandResolver:y,clearCommandResolvers:b,getCommands:x,getCommandEntries:S,getCommandBindings:C,getResolvedCommandChain:w,getRegisteredResolvedEntries:T,getActiveRegisteredResolvedEntries:E,resolveRegisteredResolverFallback:D,resolveActiveResolverFallback:O,getTopCommand:k,getDispatchUnavailableCommandState:j,getActiveCommandView:M,isBindingVisible:F,getBindingCommandAttrs:I,getCommandResolutionStatus:L}}function eO(e){return e.command}function tO(e){let t=[],n=new Set;for(let r of e.commands)try{let i={},a=[],o=RD(r.name),s=rO(r),c={};if(n.has(o)){e.onError(`duplicate-command`,{command:o},`Duplicate keymap command "${o}" in the same layer`);continue}r.name=o;for(let[t,n]of Object.entries(s)){if(n===void 0)continue;let r=e.commandFields.get(t);r&&r(n,GD({fieldName:t,conditions:e.conditions,requirements:i,matchers:a,attrs:c}))}let l={command:r,fields:s,attrs:Object.keys(c).length===0?void 0:c,requires:Object.entries(i),matchers:a};n.add(l.command.name),t.push(l)}catch(t){e.onError(`register-command-failed`,t,qD(t,`Failed to register keymap command "${String(r.name)}"`));continue}return t}function nO(e,t,n,r){if(t.length===0)return{hadError:!1};let i=!1;for(let a of t){let t,o=n();try{t=a(e,o.context)}catch(e){i=!0,r(e);continue}if(t)return{hadError:i,resolved:iO(t,o.getExecutionFields())}}return{hadError:i}}function rO(e){let t={};for(let[n,r]of Object.entries(e))!PD.has(n)&&r!==void 0&&(t[n]=r);return Object.keys(t).length===0?ZD:t}function iO(e,t){return{command:e,input:t.input,payload:t.payload}}function aO(e){let t=rO(e);return t===ZD?void 0:t}function oO(e){let t=e.query?.namespace,n=sO(e.query?.limit);if(n===0)return[];let r=e.query?.search?.trim().toLowerCase()??``,i=XD;e.query?.searchIn&&e.query.searchIn.length>0&&(i=e.query.searchIn);let a=e.query?.filter,o,s,c;if(typeof a==`function`)s=a;else if(a){let e=Object.entries(a),t=[];for(let[n,r]of e){if(n===`name`){if(typeof r==`string`){c=new Set([r]);continue}if(Array.isArray(r)){let e=new Set;for(let t of r)typeof t==`string`&&e.add(t);c=e;continue}}t.push([n,r])}o=t.length>0?t:void 0}let l=[];for(let a of e.entries){let u=a.commandState;if(lO(u,t)&&cO(u,r,i)&&!(c&&!c.has(u.command.name))&&uO(u,o,e)){if(s){let t=!1;try{t=s(e.getCommand(u))}catch(t){e.onFilterError(t);continue}if(!t)continue}if(l.push(a),n!==void 0&&l.length>=n)break}}return l}function sO(e){if(e===void 0)return;let t=Math.floor(Number(e));return!Number.isFinite(t)||t<=0?0:t}function cO(e,t,n){if(!t)return!0;for(let r of n)if(dO(e,r,t))return!0;return!1}function lO(e,t){if(t===void 0)return!0;let n=e.fields;return Object.prototype.hasOwnProperty.call(n,`namespace`)?vO(n.namespace,t):!1}function uO(e,t,n){if(!t)return!0;for(let[r,i]of t)if(!hO(e,r,i,n))return!1;return!0}function dO(e,t,n){return fO(e,t)?.includes(n)===!0}function fO(e,t){let n=QD.get(e);if(n||(n=new Map,QD.set(e,n)),n.has(t))return n.get(t);let r=e.fields,i=e.attrs,a;t===`name`?a=e.command.name:Object.prototype.hasOwnProperty.call(r,t)?a=r[t]:i&&Object.prototype.hasOwnProperty.call(i,t)&&(a=i[t]);let o=pO(a);return n.set(t,o),o}function pO(e){if(Array.isArray(e)){let t=[];for(let n of e){let e=pO(n);e!==void 0&&t.push(e)}return t.length>0?t.join(`\0`):void 0}if(typeof e==`string`)return e.toLowerCase();if(typeof e==`number`||typeof e==`boolean`||typeof e==`bigint`)return String(e).toLowerCase()}function mO(e,t,n,r){try{return e(t,n)}catch(e){return r(e),!1}}function hO(e,t,n,r){return typeof n==`function`?gO(e,t,n,r):_O(e,t,n)}function gO(e,t,n,r){let i=e.command,a=e.fields,o=e.attrs,s,c=!1,l=()=>s??=r.getCommand(e);return t===`name`&&(c=!0,mO(n,i.name,l(),r.onFilterError))||Object.prototype.hasOwnProperty.call(a,t)&&(c=!0,mO(n,a[t],l(),r.onFilterError))||o&&Object.prototype.hasOwnProperty.call(o,t)&&(c=!0,mO(n,o[t],l(),r.onFilterError))?!0:!c&&mO(n,void 0,l(),r.onFilterError)}function _O(e,t,n){let r=e.command,i=e.fields,a=e.attrs;return t===`name`&&vO(r.name,n)||Object.prototype.hasOwnProperty.call(i,t)&&vO(i[t],n)?!0:!!a&&Object.prototype.hasOwnProperty.call(a,t)&&vO(a[t],n)}function vO(e,t){return Array.isArray(t)?t.some(t=>yO(e,t)):yO(e,t)}function yO(e,t){return Array.isArray(e)?e.some(e=>yO(e,t)):Object.is(e,t)}function bO(e,t,n,r,i){let a=(e,t,n,r,a,o)=>({keymap:i.keymap,event:e,focused:t,target:n,data:r,input:a,payload:o}),o=(t,n,r,i)=>{let a=typeof n==`function`?void 0:n,o=typeof n==`function`?n:n.run,s=i?a:void 0,c;try{c=o(a?{...r,command:a}:r)}catch(n){return e.emitError(`command-execution-error`,n,`[Keymap] Error running command "${t}":`),{status:`error`,result:s?{ok:!1,reason:`error`,command:s}:{ok:!1,reason:`error`}}}if(JD(c))return c.catch(n=>{e.emitError(`async-command-error`,n,`[Keymap] Async error in command "${t}":`)}),{status:`handled`,result:s?{ok:!0,command:s}:{ok:!0}};if(xO(c)){let e=c;return(!c.ok&&c.reason!==`not-found`&&i&&a&&!c.command||c.ok&&i&&a&&!c.command)&&(e={...c,command:a}),{status:c.ok?`handled`:`rejected`,result:e}}return c===!1?{status:`rejected`,result:s?{ok:!1,reason:`rejected`,command:s}:{ok:!1,reason:`rejected`}}:{status:`handled`,result:s?{ok:!0,command:s}:{ok:!0}}},s=(e,t,n,r,i,s,c,l)=>{let u;for(let d of t??[]){let t=o(e,d.command,a(n,r,i??d.target??null,s,e,c),l);if(t.status===`handled`||t.status===`error`)return[t.result,u];u=t.result}return[void 0,u]},c=(e,c,l)=>{let u;try{u=LD(e)}catch{return{ok:!1,reason:`invalid-args`}}if(typeof u!=`string`)return{ok:!1,reason:`not-found`};let d=c?.includeCommand===!0,f=c?.focused??n.getFocusedTargetIfAvailable(),p=c?.event??i.createCommandEvent(),m=t.getReadonlyData(),h=c?.payload,g=l===`registered`?r.getRegisteredResolvedEntries(u):r.getActiveRegisteredResolvedEntries(u,f),[_,v]=s(u,g,p,f,c?.target,m,h,d);if(_)return _;let y=v,b=l===`registered`?r.resolveRegisteredResolverFallback(u,{input:u,payload:h}):r.resolveActiveResolverFallback(u,f,{input:u,payload:h});if(b.resolved){let e=o(u,b.resolved.command,a(p,f,c?.target??b.resolved.target??null,m,b.resolved.input??u,b.resolved.payload),d);if(e.status===`handled`||e.status===`error`)return e.result;y=e.result}if(b.hadError)return{ok:!1,reason:`error`};if(l===`active`){let e=r.getDispatchUnavailableCommandState(u,f,d);if(e)return e.command?{ok:!1,reason:e.reason,command:e.command}:{ok:!1,reason:e.reason}}return y??{ok:!1,reason:`not-found`}};return{runCommand(e,t){return c(e,t,`registered`)},dispatchCommand(e,t){return c(e,t,`active`)},runBinding(e,n,i,s,c){let l=t.getReadonlyData();if(n.run)return o(typeof n.command==`string`?n.command:`<function>`,n.run,a(i,s,e.target??null,l,typeof n.command==`string`?n.command:`<function>`,c),!1).status!==`rejected`&&(SO(n,i),!0);if(typeof n.command!=`string`)return!1;let u=r.getResolvedCommandChain(n.command,s,c===void 0?void 0:{input:n.command,payload:c}).entries;for(let t of u??[])if(o(n.command,t.command,a(i,s,t.target??e.target??null,l,t.input??n.command,t.payload),!1).status!==`rejected`)return SO(n,i),!0;return!1}}}function xO(e){return typeof e==`object`&&!!e&&`ok`in e}function SO(e,t){e.preventDefault&&(t.preventDefault(),t.stopPropagation())}var CO=Object.freeze({}),wO=[],TO=[];function EO(e){if(Object.keys(e).length!==0)return YD(e,{freeze:!0})}function DO(e,t,n,r){let i=t=>NO(t,e.bindingParsers.values(),{tokens:e.tokens,patterns:e.patterns,layer:CO,parseObjectKey:(e,t)=>c(e,t)}),a=t=>{if(typeof t!=`string`)return[c(t)];let n=MO(t,e.bindingParsers.values(),{tokens:e.tokens,patterns:e.patterns,layer:CO,parseObjectKey:(e,t)=>c(e,t)});for(let e of n.unknownTokens)r.warnUnknownToken(e,t);return n.unknownTokens.length>0?[]:n.parts},o=(e,t)=>WE(a(e),t),s=(i,a,o,s,d)=>{let f=[],p=!1,m=e.bindingExpanders.values(),h=e.bindingParsers.values(),g=e.bindingFields,_=e.disambiguationResolvers.has(),v=r.warnUnknownField,y=r.warnUnknownToken;for(let[r,b]of i.entries()){let i;try{i=AO(b.key,m,{layer:d})}catch(e){t.emitError(`binding-expand-error`,e,qD(e,`Failed to expand keymap binding`));continue}for(let m of i){let i=m.key,x;try{x=typeof i==`string`?MO(i,h,{tokens:a,patterns:e.patterns,layer:d,parseObjectKey:(e,t)=>c(e,t)}):{parts:[c(i)],usedTokens:[],unknownTokens:[],hasTokenBindings:!1},x=jO(x,m)}catch(e){t.emitError(`binding-parse-error`,e,qD(e,`Failed to parse keymap binding`));continue}let S=x.parts;p||=x.hasTokenBindings;for(let e of x.unknownTokens)y(e,typeof i==`string`?i:String(i.name));if(!(x.unknownTokens.length>0))for(let i of u(b,S,a,h,d))try{let t=l(i.event),a=i.sequence,c={},u={},d=[];for(let e in i){if(e===`sequence`||FD.has(e))continue;let t=i[e];if(t===void 0)continue;let r=g.get(e);if(!r){v(`binding`,e);continue}r(t,GD({fieldName:e,conditions:n,requirements:c,matchers:d,attrs:u}))}let p=Object.keys(u).length>0?EO(u):void 0,m=LD(i.cmd),h={binding:b,sequence:a,command:m,event:t,parsedBinding:yD(i),sourceTarget:o,sourceLayerOrder:s,bindingIndex:r,requires:Object.keys(c).length>0?Object.entries(c):wO,matchers:d.length>0?d:TO,preventDefault:i.preventDefault!==!1,fallthrough:i.fallthrough??!1};if(p&&(h.attrs=p),typeof m==`function`&&(h.run=m),a.length===0)continue;if(t===`release`&&a.length>1)throw Error(`Keymap release bindings only support a single key stroke`);let y=a.at(-1);if(y?.patternName){let t=e.patterns.get(y.patternName);if(t&&t.max!==t.min)throw Error(`Keymap unbounded sequence patterns must be followed by a concrete continuation`)}t===`press`&&!_&&kO(f,h),f.push(h)}catch(e){t.emitError(`binding-compile-error`,e,qD(e,`Failed to compile keymap binding`))}}}return{bindings:f,hasTokenBindings:p}},c=(e,t)=>LE(e,t),l=e=>{if(e===void 0||e===`press`)return`press`;if(e===`release`)return`release`;throw Error(`Invalid keymap binding event "${String(e)}": expected "press" or "release"`)},u=(n,r,i,a,o)=>{let s=e.bindingTransformers.values();if(s.length===0)return[{...n,sequence:zE(r)}];let l={...n,sequence:zE(r)},u=[],d=!0,f=o??CO;for(let n of s)try{n(l,{layer:f,parseKey:t=>NO(t,a,{tokens:i,patterns:e.patterns,layer:f,parseObjectKey:(e,t)=>c(e,t)}),add:e=>{u.push(yD(e))},skipOriginal:()=>{d=!1}})}catch(e){t.emitError(`binding-transformer-error`,e,`[Keymap] Error in binding transformer:`)}return d?u.length===0?[l]:[l,...u]:u};return{parseTokenKey:i,parseKeySequence:a,formatKey:o,compileBindings:s}}function OO(e,t){if(e.length>=t.length)return!1;for(let n=0;n<e.length;n+=1)if(e[n]?.match!==t[n]?.match)return!1;return!0}function kO(e,t){for(let n of e)if(n.event===`press`&&(n.command!==void 0&&OO(n.sequence,t.sequence)||t.command!==void 0&&OO(t.sequence,n.sequence)))throw Error(`Keymap bindings cannot use the same sequence as both an exact match and a prefix in the same layer`)}function AO(e,t,n){if(typeof e!=`string`||t.length===0)return[{key:e}];let r=n?.layer??CO,i=[{key:e}];for(let e of t){let t=[];for(let n of i){let i=e({input:n.key,displays:n.displays,layer:r});if(!i){t.push(n);continue}if(i.length===0)throw Error(`Keymap binding expander must return at least one key sequence for "${n.key}"`);for(let e of i){if(!e||typeof e!=`object`||Array.isArray(e)||typeof e.key!=`string`)throw Error(`Keymap binding expander must return expansion objects with string keys for "${n.key}"`);if(e.displays!==void 0){if(!Array.isArray(e.displays))throw Error(`Keymap binding expander displays must be an array of strings for "${n.key}"`);for(let t of e.displays)if(typeof t!=`string`)throw Error(`Keymap binding expander displays must be an array of strings for "${n.key}"`)}t.push(e)}}i=t}return i}function jO(e,t){if(!t.displays)return e;if(t.displays.length!==e.parts.length)throw Error(`Keymap binding expansion displays length must match parsed sequence length for "${String(t.key)}"`);return{...e,parts:e.parts.map((e,n)=>({...e,display:t.displays[n]}))}}function MO(e,t,n){if(e.length===0)throw Error(`Invalid key sequence: sequence cannot be empty`);if(t.length===0)throw Error(`No keymap binding parsers are registered`);let r=n.tokens??new Map,i=n.patterns??new Map,a=n.layer??CO,o=n.parseObjectKey,s=[],c=new Set,l=new Set,u=0;for(;u<e.length;){let n=!1;for(let d of t){let t=d({input:e,index:u,layer:a,tokens:r,patterns:i,normalizeTokenName:NE,createMatch:HE,parseObjectKey:o});if(t){if(t.nextIndex<=u||t.nextIndex>e.length)throw Error(`Keymap binding parser must advance the input for "${e}" at index ${u}`);s.push(...t.parts);for(let e of t.usedTokens??[])c.add(e);for(let e of t.unknownTokens??[])l.add(e);u=t.nextIndex,n=!0;break}}if(!n)throw Error(`No keymap binding parser handled input at index ${u} in "${e}"`)}return{parts:s,usedTokens:[...c],unknownTokens:[...l],hasTokenBindings:c.size>0||l.size>0}}function NO(e,t,n){if(typeof e!=`string`)return n.parseObjectKey(e);let{parts:r}=MO(e,t,n),[i]=r;if(!i||r.length!==1)throw Error(`Invalid key "${String(e)}": expected a single key stroke`);return i}function PO(e){if(!e||typeof e!=`object`)return!1;let t=e;return typeof t.get==`function`&&typeof t.subscribe==`function`}function FO(e,t){let n=e=>e.requires.length===0&&e.matchers.length===0,r=e=>{try{return e.match()}catch(n){return t.emitError(`runtime-matcher-error`,n,`[Keymap] Error evaluating runtime matcher from ${e.source}:`),!1}},i=e=>{if(e.matchers.length===0)return!0;if(e.matchers.length===1){let[t]=e.matchers;return!t||r(t)}for(let t of e.matchers)if(!r(t))return!1;return!0},a=t=>{if(t.length===0)return!0;for(let[n,r]of t)if(!Object.is(e.data[n],r))return!1;return!0};return{buildRuntimeMatcher(e,t){if(typeof e==`function`)return{source:t,match:e};if(PO(e))return{source:t,match:()=>e.get(),subscribe:t=>e.subscribe(t)};throw Error(`Keymap ${t} expected a function or a reactive matcher`)},matchesConditions:e=>n(e)||a(e.requires)&&i(e)}}var IO=Symbol(`keymap-disambiguation-decision`),LO=Symbol(`keymap-deferred-disambiguation-decision`);function RO(e,t){return{[IO]:!0,action:e,handler:t}}function zO(e){return{[LO]:!0,action:e}}function BO(e){return!!e&&typeof e==`object`&&e[IO]===!0}function VO(e){return!!e&&typeof e==`object`&&e[LO]===!0}function HO(e,t){return t.aborted?Promise.resolve(!1):new Promise(n=>{let r=setTimeout(()=>{t.removeEventListener(`abort`,i),n(!0)},Math.max(0,e)),i=()=>{clearTimeout(r),t.removeEventListener(`abort`,i),n(!1)};t.addEventListener(`abort`,i,{once:!0})})}function UO(e,t,n,r){let i=e.get(n);if(i)try{return i.matcher(r)}catch(e){t.emitError(`sequence-pattern-match-error`,e,`[Keymap] Error matching sequence pattern "${i.name}":`);return}}function WO(e,t,n,r){let i=e.get(n)?.payloadKey??n;return{...LE({name:t.name,ctrl:t.ctrl,shift:t.shift,meta:t.meta,super:t.super??!1,hyper:t.hyper||void 0},{display:r.display??String(r.value??t.name)}),patternName:n,payloadKey:i}}function GO(e,t,n){if(!n?.patterns||n.patterns.length===0)return;let r={},i=!1;for(let a of n.patterns){let n=e.get(a.name),o;try{o=n?.finalize?n.finalize(a.values):a.values.length===1?a.values[0]:[...a.values]}catch(e){t.emitError(`sequence-pattern-finalize-error`,e,`[Keymap] Error finalizing sequence pattern "${a.name}":`);continue}let s=r[a.payloadKey];s===void 0?(r[a.payloadKey]=o,i=!0):Array.isArray(s)?s.push(o):r[a.payloadKey]=[s,o]}return i?r:void 0}function KO(e,t,n,r,i,a,o,s,c,l){let u={resolveKey:e=>o.parseTokenKey(e).match},d=null,f=0;function p(t,n,r){if(t===`key`){let t=r;return e.keyHooks.register(n,{priority:t?.priority??0,release:t?.release??!1})}if(t===`key:after`){let t=r;return e.keyAfterHooks.register(n,{priority:t?.priority??0,release:t?.release??!1})}let i=r;return e.rawHooks.register(n,{priority:i?.priority??0})}function m(t){return e.eventMatchResolvers.prepend(t)}function h(t){return e.eventMatchResolvers.append(t)}function g(){e.eventMatchResolvers.clear()}function _(t){return L(()=>e.disambiguationResolvers.prepend(t),t)}function v(t){return L(()=>e.disambiguationResolvers.append(t),t)}function y(){e.disambiguationResolvers.has()&&t.runWithStateChangeBatch(()=>{e.disambiguationResolvers.clear(),c.recompileBindings()})}function b(e,t){d&&ue()}function x(n){let r=e.rawHooks.entries();if(r.length===0)return!1;let i=!1,a={sequence:n,stop(){i=!0}};for(let e of r){try{e.listener(a)}catch(e){t.emitError(`raw-intercept-error`,e,`[Keymap] Error in raw intercept listener:`)}if(i)return!0}return!1}function S(e,t){return{sequence:zE(e.sequence),command:e.command,commandAttrs:s.getBindingCommandAttrs(e,t,s.getActiveCommandView(t)),attrs:e.attrs,event:e.event,preventDefault:e.preventDefault,fallthrough:e.fallthrough,sourceLayerOrder:e.sourceLayerOrder,bindingIndex:e.bindingIndex}}function C(e){l.has(`dispatch`)&&l.emit(`dispatch`,e)}function w(e,t,n,r){l.has(`dispatch`)&&C({phase:e,event:n.event,focused:r,layer:{order:t.order,priority:t.priority,target:t.target,targetMode:t.targetMode},binding:S(n,r),sequence:zE(n.sequence),command:n.command})}function T(e,t,n){if(!l.has(`dispatch`))return;let i=t[0],a=t.length>0?r.collectSequencePartsFromPending({captures:t}):[];C({phase:e,event:`press`,focused:n,layer:i?{order:i.layer.order,priority:i.layer.priority,target:i.layer.target,targetMode:i.layer.targetMode}:void 0,sequence:a})}function E(t){let n=e.keyAfterHooks.entries();for(let e of n)if(e.release===t)return n}function D(e){return e.sequence?zE(e.sequence):e.captures?r.collectSequencePartsFromPending({captures:e.captures}):[]}function O(e,t){return{handled:e!==`sequence-miss`,reason:e,captures:t}}function k(e,t){return{handled:t,reason:t?`binding-handled`:`binding-rejected`,sequence:e.sequence}}function A(e,t){return t.handled||e.reason===`no-match`?t:e}function j(e,i,a,o,s){let c={event:i,eventType:a?`release`:`press`,focused:o,handled:s.handled,reason:s.reason,sequence:D(s),pendingSequence:r.getPendingSequence(),setData:(e,t)=>{n.setData(e,t)},getData:e=>n.getData(e),consume:e=>{let t=e?.preventDefault??!0,n=e?.stopPropagation??!0;t&&i.preventDefault(),n&&i.stopPropagation()}};for(let n of e)if(n.release===a)try{n.listener(c)}catch(e){t.emitError(`key-after-intercept-error`,e,`[Keymap] Error in key:after intercept listener:`)}}function M(){return{handled:!1,reason:`no-match`}}function N(e){e.preventDefault(),e.stopPropagation()}function P(e,t,n,i){r.setPendingSequence({captures:t});let a=O(`sequence-pending`,t);return T(e,t,n),N(i),a}function F(e,t,n,i){let a=O(e,t);return T(`sequence-clear`,t,n),r.setPendingSequence(null),N(i),a}function I(i,a){a||ue();let o=E(a),s=o?r.getFocusedTarget():null,c=e.keyHooks.entries(),l={event:i,setData:(e,t)=>{n.setData(e,t)},getData:e=>n.getData(e),consume:e=>{let t=e?.preventDefault??!0,n=e?.stopPropagation??!0;t&&i.preventDefault(),n&&i.stopPropagation()}};for(let e of c)if(e.release===a){try{e.listener(l)}catch(e){t.emitError(`key-intercept-error`,e,`[Keymap] Error in key intercept listener:`)}if(i.propagationStopped){o&&j(o,i,a,s,{handled:!0,reason:`intercept-consumed`,sequence:[]});return}}if(a){let e=R(i);o&&j(o,i,a,s,e);return}let u=z(i);o&&j(o,i,a,s,u)}function L(n,r){return t.runWithStateChangeBatch(()=>{let i=e.disambiguationResolvers.has(),a=n();return!i&&e.disambiguationResolvers.has()&&c.recompileBindings(),()=>{t.runWithStateChangeBatch(()=>{let t=e.disambiguationResolvers.has();a(),!e.disambiguationResolvers.values().includes(r)&&t&&!e.disambiguationResolvers.has()&&c.recompileBindings()})}})}function R(e){let t=r.getFocusedTarget(),n=r.getActiveLayers(t),a=ge(e),o=M();for(let r of a)layerLoop:for(let a of n){if(a.bindings.length===0||!i.matchesConditions(a))continue;let n=_e(a,r,e,t);if(o=A(o,n.outcome),n.handled){if(n.stop)return o;continue layerLoop}}return o}function z(e){let t=r.getFocusedTarget(),n=r.ensureValidPendingSequence(),i=ge(e);if(n)return ee(n,i,e,t);let a=r.getActiveLayers(t),o=M();for(let n of i){let r=B(a,[n],e,t);if(o=A(o,r),r.handled)return o}return o}function ee(t,n,i,a){let o=s.getActiveCommandView(a),c=[];for(let r of t.captures){let t=uD(r,n,i,e.patterns,ve,ye);t&&c.push(t)}let l=c.reduce((e,t)=>Math.min(e,cD(t,n)),1/0),u=c.filter(e=>cD(e,n)===l);if(u.length===0||!u.some(e=>Ce(e,a,o))){let e=O(`sequence-miss`,t.captures);return T(`sequence-clear`,t.captures,a),r.setPendingSequence(null),e}return te(u,0,!1,i,a)}function te(t,n,i,a,o){let s=i,c=M(),l=new Set;for(let i=n;i<t.length;i+=1){let n=t[i];if(!n||l.has(n))continue;let u=me(t,i,n);if(u.length>0){if(s)continue;let e=he(t,n);return V(t,i,u,e,a,o,s)||P(`sequence-advance`,u,o,a)}if(!rD(n,e.patterns))continue;let d=he(t,n);for(let e of d)l.add(e);let f=we(n.layer,d,a,o);if(c=A(c,f.outcome),f.handled&&(s=!0,f.stop))return T(`sequence-clear`,t,o),r.setPendingSequence(null),c}return T(`sequence-clear`,t,o),r.setPendingSequence(null),c}function B(e,t,n,r){return ne(e,0,t,n,r)}function ne(t,n,r,a,o){let c=s.getActiveCommandView(o),l=M();for(let s=n;s<t.length;s+=1){let n=t[s];if(!n||!i.matchesConditions(n))continue;let u=be(n,r,a,o,c);if(u.length===0)continue;if(u.filter(t=>nD(t,e.patterns,!1)).length>0){let n=u.filter(t=>rD(t,e.patterns)),i=pe(t,s,r,a,o);return re(t,s,r,i,n,a,o)||P(`sequence-start`,i,o,a)}let d=we(n,u.filter(t=>rD(t,e.patterns)),a,o);if(l=A(l,d.outcome),d.handled&&d.stop)return l}return l}function re(e,t,n,i,a,o,s){return H({event:o,focused:s,continuationCaptures:i,exactBindingsSource:a.map(e=>e.binding),sequencePhase:`sequence-start`,runExact:()=>{r.setPendingSequence(null);let i=a[0]?.layer;if(!i)return M();let c=we(i,a,o,s);return c.stop?c.outcome:A(c.outcome,ne(e,t+1,n,o,s))}})}function V(e,t,n,i,a,o,s){return H({event:a,focused:o,continuationCaptures:n,exactBindingsSource:i.map(e=>e.binding),sequencePhase:`sequence-advance`,runExact:()=>{r.setPendingSequence(null);let n=i[0]?.layer;if(!n)return M();let c=we(n,i,a,o);return c.stop?c.outcome:A(c.outcome,te(e,t+1,s||c.handled,a,o))}})}function H(t){let{event:n,focused:i,continuationCaptures:a,exactBindingsSource:o,sequencePhase:c,runExact:l}=t;if(!e.disambiguationResolvers.has()||a.length===0)return;let u=s.getActiveCommandView(i),d=r.collectMatchingBindings(o,i,u);if(!d.some(e=>e.command!==void 0))return;let f=()=>P(c,a,i,n),p=()=>F(`sequence-cleared`,a,i,n),m,h=()=>(m??=r.collectSequencePartsFromPending({captures:a}),m),g=ae({event:n,focused:i,getSequence:h,exactBindings:d,continuationCaptures:a,activeView:u});return g?ie(g,a,l,f,p,i,h):(fe(h()),f())}function ie(e,t,n,r,i,a,o){if(e.action===`run-exact`)return n();if(e.action===`continue-sequence`)return r();if(e.action===`clear`)return i();let s=r();return oe(t,e.handler,a,o(),e=>{if(e){if(e.action===`run-exact`){n();return}if(e.action===`continue-sequence`){r();return}i()}}),s}function ae(i){let a,o,s,c,l={event:i.event,focused:i.focused,get sequence(){return a??=zE(i.getSequence()),a},get stroke(){let e=i.getSequence().at(-1);if(!e)throw Error(`Disambiguation context expected a non-empty sequence`);return c??={...e,stroke:IE(e.stroke)},c},get exact(){return o??=r.collectActiveBindings(i.exactBindings,i.focused,i.activeView).map(e=>({...e,sequence:zE(e.sequence)})),o},get continuations(){return s??=r.getActiveKeysForCaptures(i.continuationCaptures,{includeBindings:!0,includeMetadata:!0}),s},getData:e=>n.getData(e),setData:(e,t)=>{n.setData(e,t)},runExact:()=>RO(`run-exact`),continueSequence:()=>RO(`continue-sequence`),clear:()=>RO(`clear`),defer:e=>RO(`defer`,e)};for(let n of e.disambiguationResolvers.values()){let e;try{e=n(l)}catch(e){t.emitError(`disambiguation-resolver-error`,e,`[Keymap] Error in disambiguation resolver:`);continue}if(e!==void 0){if(JD(e)){t.emitError(`invalid-disambiguation-resolver-return`,e,`[Keymap] Disambiguation resolvers must return synchronously; use ctx.defer(...) for async handling`);continue}if(!BO(e)){t.emitError(`invalid-disambiguation-decision`,e,`[Keymap] Invalid disambiguation decision returned by resolver:`);continue}return e}}}function oe(e,t,n,r,i){ue();let a=new AbortController,o={id:f++,controller:a,captures:e,apply:i};d=o,queueMicrotask(()=>{se(o,t,n,r)})}function se(e,n,r,i){if(!de(e))return;let a={signal:e.controller.signal,sequence:zE(i),focused:r,sleep:t=>HO(t,e.controller.signal),runExact:()=>zO(`run-exact`),continueSequence:()=>zO(`continue-sequence`),clear:()=>zO(`clear`)},o;try{o=n(a)}catch(n){de(e)&&(t.emitError(`deferred-disambiguation-error`,n,`[Keymap] Error in deferred disambiguation handler:`),le(e));return}if(JD(o)){o.then(t=>{ce(e,t)}).catch(n=>{de(e)&&(t.emitError(`deferred-disambiguation-error`,n,`[Keymap] Error in deferred disambiguation handler:`),le(e))});return}ce(e,o)}function ce(e,n){if(de(e)){if(n!==void 0&&!VO(n)){t.emitError(`invalid-deferred-disambiguation-decision`,n,`[Keymap] Invalid deferred disambiguation decision returned by handler:`),le(e);return}le(e),e.apply(n)}}function le(e){de(e)&&(d=null)}function ue(){let e=d;e&&(d=null,e.controller.abort())}function de(e){return d===e}function fe(e){let n=WE(e,{preferDisplay:!0});t.warnOnce(`unresolved-disambiguation:${n}`,`unresolved-disambiguation`,{sequence:n},`[Keymap] Ambiguous exact/prefix sequence "${n}" fell back to prefix handling because no disambiguation resolver resolved it`)}function pe(t,n,r,a,o){let c=[],l=s.getActiveCommandView(o);for(let s=n;s<t.length;s+=1){let n=t[s];if(n&&i.matchesConditions(n))for(let t of be(n,r,a,o,l))nD(t,e.patterns,!1)&&c.push(t)}return c}function me(t,n,r){return t.filter((t,i)=>i>=n&&nD(t,e.patterns,!1)&&JO(t.parts,r.parts))}function he(t,n){return t.filter(t=>t.layer===n.layer&&rD(t,e.patterns)&&JO(t.parts,n.parts))}function ge(n){let r=e.eventMatchResolvers.values();if(r.length===0)return[];if(r.length===1)return qO(r[0],n,u,t);let i=[],a=new Set;for(let e of r){let r;try{r=e(n,u)}catch(e){t.emitError(`event-match-resolver-error`,e,`[Keymap] Error in event match resolver:`);continue}if(!(!r||r.length===0))for(let e of r){if(typeof e!=`string`){t.emitError(`invalid-event-match-resolver-candidate`,e,`[Keymap] Invalid event match resolver candidate:`);continue}a.has(e)||(a.add(e),i.push(e))}}return i}function _e(e,t,n,r){let o=!1,s=M();for(let c of e.bindings){if(c.event!==`release`)continue;let l=c.sequence[0];if(!l||l.match!==t||!i.matchesConditions(c))continue;let u=a.runBinding(e,c,n,r);if(s=A(s,k(c,u)),!u){w(`binding-reject`,e,c,r);continue}if(w(`binding-execute`,e,c,r),o=!0,!c.fallthrough)return{handled:!0,stop:!0,outcome:s}}return{handled:o,stop:!1,outcome:s}}function ve(n,r){return UO(e.patterns,t,n,r)}function ye(t,n,r){return WO(e.patterns,t,n,r)}function be(e,t,n,r,i){let a=dD(e,t,n,ve,ye);return a.some(e=>Ce(e,r,i))?a:[]}function xe(n){return GO(e.patterns,t,n)}function Se(e,t,n){return i.matchesConditions(e)&&s.isBindingVisible(e,t,n)}function Ce(e,t,n){return Se(e.binding,t,n)}function we(e,t,n,r){let o=!1,s=M();for(let c of t){let t=c.binding;if(!i.matchesConditions(t))continue;let l=a.runBinding(e,t,n,r,xe(c));if(s=A(s,k(t,l)),!l){w(`binding-reject`,e,t,r);continue}if(w(`binding-execute`,e,t,r),o=!0,!t.fallthrough)return{handled:!0,stop:!0,outcome:s}}return{handled:o,stop:!1,outcome:s}}return{intercept:p,prependEventMatchResolver:m,appendEventMatchResolver:h,clearEventMatchResolvers:g,prependDisambiguationResolver:_,appendDisambiguationResolver:v,clearDisambiguationResolvers:y,handlePendingSequenceChange:b,handleRawSequence:x,handleKeyEvent:I}}function qO(e,t,n,r){let i;try{i=e(t,n)}catch(e){return r.emitError(`event-match-resolver-error`,e,`[Keymap] Error in event match resolver:`),[]}if(!i||i.length===0)return[];if(i.length===1){let[e]=i;return typeof e==`string`?[e]:(r.emitError(`invalid-event-match-resolver-candidate`,e,`[Keymap] Invalid event match resolver candidate:`),[])}let a=[],o=new Set;for(let e of i){if(typeof e!=`string`){r.emitError(`invalid-event-match-resolver-candidate`,e,`[Keymap] Invalid event match resolver candidate:`);continue}o.has(e)||(o.add(e),a.push(e))}return a}function JO(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n+=1)if(e[n]?.match!==t[n]?.match)return!1;return!0}var YO=()=>{};function XO(e,t,n,r){if(n===void 0)return r;if(typeof n!=`number`||!Number.isInteger(n)||n<0)throw Error(`Keymap sequence pattern "${e}" ${t} must be a non-negative integer`);return n}function ZO(e,t){let{kind:n,reservedFields:r,registeredFields:i,emitError:a}=t,o=Object.entries(e),s=[];for(let[e,t]of o){if(r.has(e)){a(`reserved-${n}-field`,{field:e,kind:n},`Keymap ${n} field "${e}" is reserved`);continue}if(i.has(e)){a(`duplicate-${n}-field`,{field:e,kind:n},`Keymap ${n} field "${e}" is already registered`);continue}i.set(e,t),s.push([e,t])}return()=>{for(let[e,t]of s)i.get(e)===t&&i.delete(e)}}function QO(e,t,n,r,i){let a;try{a=NE(i.name)}catch(e){return t.emitError(`token-name-normalize-error`,e,qD(e,`Failed to register keymap token`)),YO}if(e.tokens.has(a)||e.patterns.has(a))return t.emitError(`duplicate-token`,{token:a},`Keymap token "${a}" is already registered`),YO;let o;try{if(o=n.parseTokenKey(i.key),o.patternName)throw Error(`Invalid key "${String(i.key)}": expected a concrete key stroke`)}catch(e){return t.emitError(`token-parse-error`,e,qD(e,`Failed to register keymap token "${a}"`)),YO}let s={stroke:o.stroke,match:o.match},c=new Map(e.tokens);c.set(a,s);try{r.applyTokenState(c)}catch(e){return t.emitError(`token-register-error`,e,qD(e,`Failed to register keymap token "${a}"`)),YO}return()=>{if(e.tokens.get(a)!==s)return;let n=new Map(e.tokens);n.delete(a);try{r.applyTokenState(n)}catch(e){t.emitError(`token-unregister-error`,e,qD(e,`Failed to unregister keymap token "${a}"`))}}}function $O(e,t,n,r){let i,a;try{i=NE(r.name);let e=XO(i,`min`,r.min,1),t=XO(i,`max`,r.max,2**53-1);if(t<e)throw Error(`Keymap sequence pattern "${i}" max must be greater than or equal to min`);a={name:i,display:r.display,payloadKey:r.payloadKey??i,match:HE(`pattern:${i}`),min:e,max:t,matcher:e=>r.match(e),finalize:r.finalize}}catch(e){return t.emitError(`sequence-pattern-register-error`,e,qD(e,`Failed to register keymap sequence pattern`)),YO}return e.tokens.has(i)||e.patterns.has(i)?(t.emitError(`duplicate-sequence-pattern`,{pattern:i},`Keymap sequence pattern "${i}" is already registered`),YO):(e.patterns.set(i,a),n.recompileBindings(),()=>{e.patterns.get(i)===a&&(e.patterns.delete(i),n.recompileBindings())})}function ek(e,t,n,r){return ZO(r,{kind:n,reservedFields:n===`layer`?ID:n===`binding`?FD:PD,registeredFields:n===`layer`?e.layerFields:n===`binding`?e.bindingFields:e.commandFields,emitError:(e,n,r)=>t.emitError(e,n,r)})}var tk=()=>{};function nk(e,t){return t.priority-e.priority||t.order-e.order}function rk(e){if(e.matchers.length>0)return!0;for(let t of e.commands)if(t.matchers.length>0)return!0;for(let t of e.bindings)if(t.matchers.length>0)return!0;return!1}function ik(e){if(e.commands.length===0)return!1;if(e.matchers.length>0)return!0;for(let t of e.commands)if(t.matchers.length>0)return!0;return!1}function ak(e,t,n,r,i){let a=n=>t.runWithStateChangeBatch(()=>{let a=n.target;if(a&&i.host.isTargetDestroyed(a))return t.emitError(`destroyed-layer-target`,{target:a},`Cannot register a keymap layer for a destroyed keymap target`),tk;let o,s,c,p,m,v,y;try{y=l(n),o=u(vD(n.bindings??[]),n);let e=d(n.commands??[],n);v=e.length===0?[]:i.commands.normalizeCommands(e),{requires:s,matchers:c,fields:p,attrs:m}=f(n)}catch(e){return t.emitError(`register-layer-failed`,e,qD(e,`Failed to register keymap layer`)),tk}let b=e.order++,x=i.compiler.compileBindings(o,e.tokens,a,b,p);if(x.bindings.length===0&&!x.hasTokenBindings&&v.length===0)return tk;i.diagnostics?.analyzeLayer({target:a,order:b,commands:v,sourceBindings:o,bindings:x.bindings,hasTokenBindings:x.hasTokenBindings});let S={order:b,target:a,targetMode:y,priority:n.priority??0,requires:s,matchers:c,fields:p,attrs:m,commands:v,sourceBindings:o,bindings:x.bindings,root:aD(x.bindings,e.patterns),hasTokenBindings:x.hasTokenBindings,activeKeyCacheBlocked:!1,activeCommandViewCacheBlocked:!1};_(S),e.layers.add(S),e.sortedLayers=[...e.sortedLayers,S].sort(nk),g(S);for(let e of S.commands)g(e);for(let e of S.bindings)g(e);return a&&(S.offTargetDestroy=i.host.onTargetDestroy(a,()=>{h(S)})),S.commands.length>0&&r.ensureValidPendingSequence(),t.queueStateChange(),()=>{h(S)}}),o=n=>{t.runWithStateChangeBatch(()=>{let i=new Map;for(let t of e.layers)t.hasTokenBindings&&i.set(t,p(t,n));e.tokens=n;let a=!1;for(let[e,t]of i)m(e,t)&&(a=!0);a&&r.setPendingSequence(null),i.size>0&&t.queueStateChange()})},s=()=>{t.runWithStateChangeBatch(()=>{let n=0,i=!1;for(let t of e.layers){if(t.sourceBindings.length===0)continue;let r=p(t,e.tokens);m(t,r)&&(i=!0),n+=1}i&&r.setPendingSequence(null),n>0&&t.queueStateChange()})},c=()=>{for(let t of e.layers){y(t);for(let e of t.commands)y(e);for(let e of t.bindings)y(e);t.offTargetDestroy?.(),t.offTargetDestroy=void 0}},l=e=>{if(e.targetMode){if(!e.target)throw Error(`Keymap targetMode "${e.targetMode}" requires a target`);return e.targetMode}return e.target?`focus-within`:void 0},u=(t,n)=>{let r=e.layerBindingsTransformers.values();if(r.length===0)return t;let i=t;for(let e of r){let t=e(i,{layer:n,validateBindings:e=>_D(e)});t&&(i=vD(t))}return i},d=(n,r)=>{let i=e.commandTransformers.values();if(n.length===0||i.length===0)return n;let a=[];for(let e of n){let n={...e},o=[],s=!0;for(let e of i)try{e(n,{layer:r,add(e){o.push({...e})},skipOriginal(){s=!1}})}catch(e){t.emitError(`command-transformer-error`,e,`[Keymap] Error in command transformer:`)}s&&a.push(n),a.push(...o)}return a},f=t=>{let r={},a=[],o=Object.create(null),s={};for(let[c,l]of Object.entries(t)){if(ID.has(c)||l===void 0)continue;o[c]=YD(l);let t=e.layerFields.get(c);if(!t){i.warnUnknownField(`layer`,c);continue}t(l,GD({fieldName:c,conditions:n,requirements:r,matchers:a,attrs:s}))}return{requires:Object.entries(r),matchers:a,fields:Object.keys(o).length>0?Object.freeze(o):void 0,attrs:Object.keys(s).length>0?YD(s,{freeze:!0}):void 0}},p=(e,t)=>i.compiler.compileBindings(e.sourceBindings,t,e.target,e.order,e.fields),m=(t,n)=>{i.diagnostics?.analyzeLayer({target:t.target,order:t.order,commands:t.commands,sourceBindings:t.sourceBindings,bindings:n.bindings,hasTokenBindings:n.hasTokenBindings}),v(t);for(let e of t.bindings)y(e);t.bindings=n.bindings,t.root=aD(n.bindings,e.patterns),t.hasTokenBindings=n.hasTokenBindings,_(t);for(let e of t.bindings)g(e);return e.pending?.captures.some(e=>e.layer===t)??!1},h=n=>{t.runWithStateChangeBatch(()=>{if(e.layers.delete(n)){e.sortedLayers=e.sortedLayers.filter(e=>e!==n),v(n),y(n);for(let e of n.commands)y(e);for(let e of n.bindings)y(e);n.offTargetDestroy?.(),n.offTargetDestroy=void 0,e.pending?.captures.some(e=>e.layer===n)?r.setPendingSequence(null):n.commands.length>0&&!i.host.isDestroyed&&r.ensureValidPendingSequence(),t.queueStateChange()}})},g=e=>{for(let n of e.matchers)if(n.subscribe)try{n.dispose=n.subscribe(()=>{if(!r.hasPendingSequenceState()){t.queueStateChange();return}t.runWithStateChangeBatch(()=>{r.revalidatePendingSequenceIfNeeded(),t.queueStateChange()})})}catch(e){t.emitError(`reactive-matcher-subscribe-error`,e,qD(e,`Failed to subscribe to reactive matcher from ${n.source}`))}},_=t=>{let n=rk(t),r=ik(t);t.activeKeyCacheBlocked=n,t.activeCommandViewCacheBlocked=r,n&&(e.activeKeyCacheBlockers+=1),r&&(e.activeCommandViewCacheBlockers+=1)},v=t=>{t.activeKeyCacheBlocked&&=(--e.activeKeyCacheBlockers,!1),t.activeCommandViewCacheBlocked&&=(--e.activeCommandViewCacheBlockers,!1)},y=e=>{for(let n of e.matchers)if(n.dispose){try{n.dispose()}catch(e){t.emitError(`reactive-matcher-dispose-error`,e,qD(e,`Failed to dispose reactive matcher from ${n.source}`))}n.dispose=void 0}};return{registerLayer:a,applyTokenState:o,recompileBindings:s,cleanup:c}}var ok=1e3;function sk(e,t,n){let r=(e,n,r)=>{if(!t.has(`warning`)){let t=`[${e}] ${r}`;n instanceof Error?console.warn(t,n):console.warn(t);return}t.emit(`warning`,{code:e,message:r,warning:n})},i=(e,n,r)=>{if(!t.has(`error`)){let t=`[${e}] ${r}`;n instanceof Error?console.error(t,n):console.error(t);return}t.emit(`error`,{code:e,message:r,error:n})},a=()=>{if(!(!e.stateChangePending||e.stateChangeDepth>0||e.flushingStateChange)){e.flushingStateChange=!0;try{let t=0;for(;e.stateChangePending&&e.stateChangeDepth===0;){if(t>=ok){e.stateChangePending=!1,i(`state-change-feedback-loop`,{iterations:ok},`[Keymap] Possible infinite state listener feedback loop detected after ${ok} iterations; pending state notifications were dropped`);break}t+=1,e.stateChangePending=!1,n.emit(`state`)}}finally{e.flushingStateChange=!1}}};return{runWithStateChangeBatch(t){e.stateChangeDepth+=1;try{return t()}finally{--e.stateChangeDepth,e.stateChangeDepth===0&&a()}},queueStateChange(t){e.derivedVersion+=1,t?.invalidateCaches!==!1&&(e.cacheVersion+=1),n.has(`state`)&&(e.stateChangePending=!0,e.stateChangeDepth===0&&!e.flushingStateChange&&a())},emitWarning:r,emitError:i,reportListenerError(e,t){if(e===`state`){i(`state-listener-error`,t,`[Keymap] Error in state listener:`);return}if(e===`pendingSequence`){i(`pending-sequence-listener-error`,t,`[Keymap] Error in pending sequence listener:`);return}e===`dispatch`&&i(`dispatch-listener-error`,t,`[Keymap] Error in dispatch listener:`)},warnOnce(t,n,i,a){e.usedWarningKeys.has(t)||(e.usedWarningKeys.add(t),r(n,i,a))}}}function ck(e,t,n){return{getData(t){return e.data[t]},setData(r,i){t.runWithStateChangeBatch(()=>{if(i===void 0){if(!(r in e.data))return;delete e.data[r],e.dataVersion+=1,n.ensureValidPendingSequence(),t.queueStateChange();return}Object.is(e.data[r],i)||(e.data[r]=i,e.dataVersion+=1,n.ensureValidPendingSequence(),t.queueStateChange())})},getReadonlyData(){return e.readonlyDataVersion===e.dataVersion?e.readonlyData:(e.readonlyData=Object.freeze({...e.data}),e.readonlyDataVersion=e.dataVersion,e.readonlyData)}}}var lk=Object.freeze({});function uk(){return{order:0,tokens:new Map,patterns:new Map,layerFields:new Map,layerBindingsTransformers:mD(),bindingExpanders:mD(),bindingParsers:mD(),bindingTransformers:mD(),bindingFields:new Map,commandTransformers:mD(),commandFields:new Map,eventMatchResolvers:mD(),disambiguationResolvers:mD(),keyHooks:hD(),keyAfterHooks:hD(),rawHooks:hD(),layers:new Set,sortedLayers:[],activeLayersCacheVersion:-1,activeLayersCacheFocused:void 0,activeLayersCache:[],activeKeyCacheBlockers:0,activeCommandViewCacheBlockers:0,commandResolvers:mD(),pending:null,data:{},dataVersion:0,readonlyDataVersion:-1,readonlyData:lk,cacheVersion:0,derivedVersion:0,stateChangeDepth:0,stateChangePending:!1,flushingStateChange:!1,usedWarningKeys:new Set}}function dk(e){return BE(e)}var fk=class{#e=uk();#t=!1;#n=new Map;#r=[];#i=fD(()=>{});#a;#o;#s;#c;#l;#u;#d;#f;#p;#m;#h;#g;#_;#v;#y;#b;getPendingSequence;getActiveKeys;constructor(e){if(this.#b=e,e.isDestroyed)throw Error(`Cannot create a keymap for a destroyed host`);this.#a=fD((e,t)=>{this.#o.reportListenerError(e,t)}),this.#o=sk(this.#e,this.#i,this.#a),this.#l=FO(this.#e,this.#o),this.#u=$D(this.#e,this.#b,this.#o,this.#l,{onCommandResolversChanged:()=>{this.#s.ensureValidPendingSequence()}}),this.#s=ND(this.#e,this.#b,this.#a,this.#o,this.#l,this.#u,{onPendingSequenceChanged:(e,t)=>{this.#p?.handlePendingSequenceChange(e,t)}}),this.#c=ck(this.#e,this.#o,this.#s),this.#d=bO(this.#o,this.#c,this.#s,this.#u,{keymap:this,createCommandEvent:()=>this.#b.createCommandEvent()}),this.#f=DO(this.#e,this.#o,this.#l,{warnUnknownField:(e,t)=>{this.#C(e,t)},warnUnknownToken:(e,t)=>{this.#w(e,t)}}),this.#h=bD(this.#o,this.#u),this.#m=ak(this.#e,this.#o,this.#l,this.#s,{compiler:this.#f,commands:this.#u,host:this.#b,diagnostics:this.#h,warnUnknownField:(e,t)=>{this.#C(e,t)}}),this.#p=KO(this.#e,this.#o,this.#c,this.#s,this.#l,this.#d,this.#f,this.#u,this.#m,this.#a),this.getPendingSequence=this.#s.getPendingSequence,this.getActiveKeys=this.#s.getActiveKeys,this.#g=e=>{this.#p.handleKeyEvent(e,!1)},this.#_=e=>{this.#p.handleKeyEvent(e,!0)},this.#v=e=>this.#p.handleRawSequence(e),this.#y=e=>{this.#S(e)},this.#r.push(this.#b.onKeyPress(this.#g)),this.#r.push(this.#b.onKeyRelease(this.#_)),this.#b.onRawInput&&this.#r.push(this.#b.onRawInput(this.#v)),this.#r.push(this.#b.onFocusChange(this.#y)),this.#b.onDestroy&&this.#r.push(this.#b.onDestroy(()=>{this.#x()}))}[qE](){return{state:this.#e,host:this.#b,conditions:this.#l,catalog:this.#u,activation:this.#s}}#x(){if(!this.#t){this.#t=!0,this.#s.setPendingSequence(null);for(let e of this.#n.values())e.dispose();this.#n.clear(),this.#m.cleanup();for(let e of this.#r.splice(0))e()}}setData(e,t){this.#c.setData(e,t)}getData(e){return this.#c.getData(e)}getHostMetadata(){return this.#b.metadata}hasPendingSequence(){return this.#s.ensureValidPendingSequence()!==void 0}createKeyMatcher(e){let t=this.#f.parseTokenKey(e).match;return e=>e?dk(e)===t:!1}parseKeySequence(e){return this.#f.parseKeySequence(e)}formatKey(e,t){return this.#f.formatKey(e,t)}clearPendingSequence(){this.#s.setPendingSequence(null)}popPendingSequence(){return this.#s.popPendingSequence()}getCommands(e){return this.#u.getCommands(e)}getCommandEntries(e){return this.#u.getCommandEntries(e)}getCommandBindings(e){return this.#u.getCommandBindings(e)}acquireResource(e,t){if(this.#t||this.#b.isDestroyed)throw Error(`Cannot use a keymap after its host was destroyed`);let n=this.#n.get(e);if(n)return n.count+=1,()=>{this.#T(e,n)};let r={count:1,dispose:t()};return this.#n.set(e,r),()=>{this.#T(e,r)}}runCommand(e,t){return this.#d.runCommand(e,t)}dispatchCommand(e,t){return this.#d.dispatchCommand(e,t)}on(e,t){return e===`warning`||e===`error`?this.#i.hook(e,t):this.#a.hook(e,t)}intercept(e,t,n){return this.#p.intercept(e,t,n)}registerLayer(e){return this.#m.registerLayer(e)}registerLayerFields(e){return ek(this.#e,this.#o,`layer`,e)}prependLayerBindingsTransformer(e){return this.#e.layerBindingsTransformers.prepend(e)}appendLayerBindingsTransformer(e){return this.#e.layerBindingsTransformers.append(e)}clearLayerBindingsTransformers(){this.#e.layerBindingsTransformers.clear()}prependBindingTransformer(e){return this.#e.bindingTransformers.prepend(e)}appendBindingTransformer(e){return this.#e.bindingTransformers.append(e)}clearBindingTransformers(){this.#e.bindingTransformers.clear()}prependCommandTransformer(e){return this.#e.commandTransformers.prepend(e)}appendCommandTransformer(e){return this.#e.commandTransformers.append(e)}clearCommandTransformers(){this.#e.commandTransformers.clear()}prependBindingParser(e){return this.#e.bindingParsers.prepend(e)}appendBindingParser(e){return this.#e.bindingParsers.append(e)}clearBindingParsers(){this.#e.bindingParsers.clear()}registerToken(e){return QO(this.#e,this.#o,this.#f,this.#m,e)}registerSequencePattern(e){return $O(this.#e,this.#o,this.#m,e)}prependBindingExpander(e){return this.#e.bindingExpanders.prepend(e)}appendBindingExpander(e){return this.#e.bindingExpanders.append(e)}clearBindingExpanders(){this.#e.bindingExpanders.clear()}registerBindingFields(e){return ek(this.#e,this.#o,`binding`,e)}registerCommandFields(e){return ek(this.#e,this.#o,`command`,e)}prependCommandResolver(e){return this.#u.prependCommandResolver(e)}appendCommandResolver(e){return this.#u.appendCommandResolver(e)}clearCommandResolvers(){this.#u.clearCommandResolvers()}prependLayerAnalyzer(e){return this.#h.prependLayerAnalyzer(e)}appendLayerAnalyzer(e){return this.#h.appendLayerAnalyzer(e)}clearLayerAnalyzers(){this.#h.clearLayerAnalyzers()}prependEventMatchResolver(e){return this.#p.prependEventMatchResolver(e)}appendEventMatchResolver(e){return this.#p.appendEventMatchResolver(e)}clearEventMatchResolvers(){this.#p.clearEventMatchResolvers()}prependDisambiguationResolver(e){return this.#p.prependDisambiguationResolver(e)}appendDisambiguationResolver(e){return this.#p.appendDisambiguationResolver(e)}clearDisambiguationResolvers(){this.#p.clearDisambiguationResolvers()}#S(e){this.#o.runWithStateChangeBatch(()=>{this.#s.setPendingSequence(null),this.#o.queueStateChange({invalidateCaches:!1})})}#C(e,t){this.#o.warnOnce(`${e}:${t}`,`unknown-${e}-field`,{field:t,kind:e},`[Keymap] Unknown ${e} field "${t}" was ignored`)}#w(e,t){this.#o.warnOnce(`token:${e}`,`unknown-token`,{token:e,sequence:t},`[Keymap] Unknown token "${e}" in key sequence "${t}"; binding was skipped until the token is registered`)}#T(e,t){this.#n.get(e)===t&&(--t.count,!(t.count>0)&&(t.dispose(),this.#n.delete(e)))}},pk=new Set(`up.down.left.right.clear.escape.return.linefeed.enter.tab.backspace.delete.insert.home.end.pageup.pagedown.space.lt.gt.plus.minus.equal.comma.period.slash.backslash.semicolon.quote.backquote.leftbracket.rightbracket.capslock.numlock.scrolllock.printscreen.pause.menu.apps.kp0.kp1.kp2.kp3.kp4.kp5.kp6.kp7.kp8.kp9.kpdecimal.kpdivide.kpmultiply.kpminus.kpplus.kpenter.kpequal.kpseparator.kpleft.kpright.kpup.kpdown.kppageup.kppagedown.kphome.kpend.kpinsert.kpdelete.mediaplay.mediapause.mediaplaypause.mediareverse.mediastop.mediafastforward.mediarewind.medianext.mediaprev.mediarecord.volumedown.volumeup.mute.leftshift.leftctrl.leftalt.leftsuper.lefthyper.leftmeta.rightshift.rightctrl.rightalt.rightsuper.righthyper.rightmeta.iso_level3_shift.iso_level5_shift.option.alt.meta.super.hyper.control.ctrl.shift`.split(`.`)),mk=new Set([`ctrl`,`control`,`shift`,`meta`,`alt`,`option`,`super`,`hyper`]),hk=_k(pk),gk=_k(mk);function _k(e){let t=new Map;for(let n of e){let e=n.charCodeAt(0);if(Number.isNaN(e))continue;let r=t.get(e);r||(r=[],t.set(e,r)),r.push(n)}for(let e of t.values())e.sort((e,t)=>t.length-e.length);return t}function vk(e){return e>=65&&e<=90?e+32:e}function yk(e){return e>=48&&e<=57}function bk(e,t,n){if(e.startsWith(t,n))return!0;if(n+t.length>e.length)return!1;for(let r=0;r<t.length;r+=1)if(vk(e.charCodeAt(n+r))!==t.charCodeAt(r))return!1;return!0}function xk(e,t,n){let r=t.charCodeAt(n);if(Number.isNaN(r))return;let i=e.get(vk(r));if(i){for(let e of i)if(bk(t,e,n))return e}}function Sk(e,t,n,r,i){return e.parseObjectKey(t,{display:n,match:r,tokenName:i})}function Ck(e,t){if(e===` `)return t.parseObjectKey({name:`space`},{display:`space`});if(e===`+`)return t.parseObjectKey({name:`+`},{display:`+`});let n=e.split(`+`),r=``,i=``,a=!1,o=!1,s=!1,c=!1,l=!1;for(let t of n){let n=t.trim();if(!n)continue;let u=n.toLowerCase();if(u===`ctrl`||u===`control`){a=!0;continue}if(u===`shift`){o=!0;continue}if(u===`meta`||u===`alt`||u===`option`){s=!0;continue}if(u===`super`){c=!0;continue}if(u===`hyper`){l=!0;continue}if(r)throw Error(`Invalid key "${e}": multiple key names are not supported`);r=n,i=u}if(!r)throw Error(`Invalid key "${e}": missing key name`);let u=[];return a&&u.push(`ctrl`),o&&u.push(`shift`),s&&u.push(`meta`),c&&u.push(`super`),l&&u.push(`hyper`),u.push(i),t.parseObjectKey({name:r,ctrl:a,shift:o,meta:s,super:c,hyper:l||void 0},{display:u.join(`+`)})}function wk(e,t){let n=e.trim().toLowerCase();return t.parseObjectKey({name:n},{display:n})}function Tk(e,t){let n=xk(hk,e,t);if(n)return n;if(vk(e.charCodeAt(t))!==102||!yk(e.charCodeAt(t+1)))return;let r=yk(e.charCodeAt(t+2))?t+3:t+2;return e.slice(t,r).toLowerCase()}function Ek(e,t){return xk(gk,e,t)}function Dk(e,t,n){let r=t,i=!1,a=!1,o=!1,s=!1,c=!1;for(;r<e.length;){let t=Ek(e,r);if(!t)break;let n=r+t.length;if(e[n]!==`+`)break;t===`ctrl`||t===`control`?i=!0:t===`shift`?a=!0:t===`meta`||t===`alt`||t===`option`?o=!0:t===`super`?s=!0:t===`hyper`&&(c=!0),r=n+1}if(r===t)return;let l=e[r];if(l===void 0)throw Error(`Invalid key "${e.slice(t)}": missing key name`);let u=Tk(e,r)??l,d=u===` `?`space`:u===`+`?`+`:u.toLowerCase(),f=[];return i&&f.push(`ctrl`),a&&f.push(`shift`),o&&f.push(`meta`),s&&f.push(`super`),c&&f.push(`hyper`),f.push(d),{part:n.parseObjectKey({name:u===` `?`space`:u,ctrl:i,shift:a,meta:o,super:s,hyper:c||void 0},{display:f.join(`+`)}),nextIndex:r+u.length}}var Ok=e=>{let{input:t,index:n,tokens:r,normalizeTokenName:i}=e;if(n===0&&t.includes(`+`)&&/\s/.test(t))return{parts:[Ck(t,e)],nextIndex:t.length};let a=t[n];if(a===void 0)return;if(a===`<`){let o=t.indexOf(`>`,n);if(o===-1)return{parts:[Ck(a,e)],nextIndex:n+1};let s=i(t.slice(n+1,o)),c=r.get(s);return c?{parts:[Sk(e,c.stroke,`<${s}>`,c.match,s)],nextIndex:o+1,usedTokens:[s]}:{parts:[],nextIndex:o+1,unknownTokens:[s]}}if(a===`{`){let r=t.indexOf(`}`,n);if(r===-1)return{parts:[Ck(a,e)],nextIndex:n+1};let o=i(t.slice(n+1,r)),s=e.patterns.get(o);return s?{parts:[{...e.parseObjectKey({name:o,ctrl:!1,shift:!1,meta:!1,super:!1},{display:s.display??`{${o}}`,match:s.match}),patternName:s.name,payloadKey:s.payloadKey}],nextIndex:r+1,usedTokens:[o]}:{parts:[],nextIndex:r+1,unknownTokens:[o]}}let o=Dk(t,n,e);if(o)return{parts:[o.part],nextIndex:o.nextIndex};let s=Tk(t,n);return s?{parts:[wk(s,e)],nextIndex:n+s.length}:{parts:[Ck(a,e)],nextIndex:n+1}},kk=(e,t)=>[t.resolveKey({name:e.name,ctrl:e.ctrl,shift:e.shift,meta:e.meta,super:e.super??!1,hyper:e.hyper||void 0})];function Ak(e){return e.appendBindingParser(e=>Ok(e))}function jk(e){return e.appendEventMatchResolver((e,t)=>kk(e,t))}function Mk(e){let t=Ak(e),n=jk(e);return()=>{n(),t()}}var Nk=Symbol(`keymap:mod-bindings`),Pk=/(^|[+,\s])mod(?=\s*\+)/i,Fk=/(^|[+,\s])mod(?=\s*\+)/gi;function Ik(e){let t=e.primaryModifier;return(t===`ctrl`||t===`super`)&&e.modifiers[t]!==`unsupported`?t:e.modifiers.ctrl===`unsupported`?`super`:`ctrl`}function Lk(e){if(e.includes(`,`))return[e];let t=e.trim();return t.includes(` `)?t.split(/\s+/):[e]}function Rk(e){return e.acquireResource(Nk,()=>e.appendBindingExpander(({input:t,displays:n})=>{if(!Pk.test(t))return;let r=Ik(e.getHostMetadata());return[{key:t.replace(Fk,(e,t)=>`${t}${r}`),displays:n??Lk(t)}]}))}var zk=new Map([[` `,`space`],[`Spacebar`,`space`],[`ArrowUp`,`up`],[`ArrowDown`,`down`],[`ArrowLeft`,`left`],[`ArrowRight`,`right`],[`Escape`,`escape`],[`Esc`,`escape`],[`Enter`,`return`],[`Backspace`,`backspace`],[`Delete`,`delete`],[`Tab`,`tab`],[`Home`,`home`],[`End`,`end`],[`PageUp`,`pageup`],[`PageDown`,`pagedown`],[`Insert`,`insert`],[`CapsLock`,`capslock`],[`NumLock`,`numlock`],[`ScrollLock`,`scrolllock`],[`ContextMenu`,`menu`],[`Meta`,`super`],[`OS`,`super`],[`Alt`,`alt`],[`Control`,`control`],[`Shift`,`shift`]]);function Bk(e){let t=e?.trim().toLowerCase();return t?t.includes(`mac`)||t.includes(`darwin`)?`macos`:t.includes(`win`)?`windows`:t.includes(`linux`)||t.includes(`x11`)?`linux`:`unknown`:`unknown`}function Vk(){let e=globalThis.navigator,t=e?.userAgentData?.platform,n=Bk(t);return n===`unknown`?Bk(e?.platform??e?.userAgent):n}function Hk(){let e=Vk();return{platform:e,primaryModifier:e===`macos`?`super`:e===`unknown`?`unknown`:`ctrl`,modifiers:{ctrl:`supported`,shift:`supported`,meta:`supported`,super:`supported`,hyper:`unsupported`}}}function Uk(e){return e.length===1&&!/^[a-z0-9]$/i.test(e)}function Wk(e){let t={name:e.name,ctrl:e.ctrl,shift:e.shift,meta:e.meta,super:e.super??!1,hyper:e.hyper||void 0};return!t.shift||!Uk(t.name)?[t]:[t,{...t,shift:!1}]}var Gk=class{name;ctrl;shift;meta;superKey;originalEvent;propagationStopped=!1;constructor(e,t,n,r,i,a){this.name=e,this.ctrl=t,this.shift=n,this.meta=r,this.superKey=i,this.originalEvent=a}get super(){return this.superKey}preventDefault(){this.originalEvent?.preventDefault()}stopPropagation(){this.propagationStopped=!0,this.originalEvent?.stopPropagation()}};function Kk(){return globalThis.MutationObserver}function qk(e){return zk.get(e)||(/^F\d{1,2}$/i.test(e)||e.length===1?e.toLowerCase():e.trim().toLowerCase().replace(/\s+/g,``))}function Jk(e){if(!e)return new Gk(`command`,!1,!1,!1,!1);let t=globalThis.KeyboardEvent;return new Gk(qk(e.key),e.ctrlKey,e.shiftKey,e.altKey,e.metaKey,t&&e instanceof t?e:void 0)}var Yk=class{metadata=Hk();rootTarget;isDestroyed=!1;observer;targetDestroyListeners=new Map;constructor(e){this.rootTarget=e}getFocusedTarget(){let e=this.rootTarget.ownerDocument.activeElement;return!e||typeof e!=`object`?null:e===this.rootTarget||this.rootTarget.contains(e)?e:null}getParentTarget(e){return e.parentElement}isTargetDestroyed(e){return e===this.rootTarget?!1:!e.isConnected||!this.rootTarget.contains(e)}onKeyPress(e){let t=t=>{e(Jk(t))};return this.rootTarget.addEventListener(`keydown`,t,{capture:!0}),()=>{this.rootTarget.removeEventListener(`keydown`,t,{capture:!0})}}onKeyRelease(e){let t=t=>{e(Jk(t))};return this.rootTarget.addEventListener(`keyup`,t,{capture:!0}),()=>{this.rootTarget.removeEventListener(`keyup`,t,{capture:!0})}}onFocusChange(e){let t=()=>{queueMicrotask(()=>{e(this.getFocusedTarget())})};return this.rootTarget.addEventListener(`focusin`,t,{capture:!0}),this.rootTarget.addEventListener(`focusout`,t,{capture:!0}),()=>{this.rootTarget.removeEventListener(`focusin`,t,{capture:!0}),this.rootTarget.removeEventListener(`focusout`,t,{capture:!0})}}onTargetDestroy(e,t){let n=this.targetDestroyListeners.get(e);return n||(n=new Set,this.targetDestroyListeners.set(e,n)),n.add(t),this.ensureObserver(),this.flushDisconnectedTargets(),()=>{let n=this.targetDestroyListeners.get(e);n&&(n.delete(t),n.size===0&&this.targetDestroyListeners.delete(e),this.targetDestroyListeners.size===0&&this.disconnectObserver())}}createCommandEvent(){return Jk()}ensureObserver(){if(this.observer||this.targetDestroyListeners.size===0)return;let e=Kk();e&&(this.observer=new e(()=>{this.flushDisconnectedTargets()}),this.observer.observe(this.rootTarget,{childList:!0,subtree:!0}))}disconnectObserver(){this.observer&&=(this.observer.disconnect(),void 0)}flushDisconnectedTargets(){for(let[e,t]of this.targetDestroyListeners)if(this.isTargetDestroyed(e)){this.targetDestroyListeners.delete(e);for(let e of[...t])e()}this.targetDestroyListeners.size===0&&this.disconnectObserver()}};function Xk(e){return new Yk(e)}var Zk=(e,t)=>Wk(e).map(e=>t.resolveKey(e)),Qk=[2,3],$k=`fungi.app.ready.v3`,eA=`fungi.app.ready`,tA=`fungi.app.connect`,nA=e=>eS.pipe(Y(MS(1)),Y(FS(e))),rA=e=>q(nA(e)),iA=tS.pipe(Y(AS()),Y(hS(Number.isSafeInteger,{message:`Expected a safe integer`}))),aA=iA.pipe(Y(DS(0))),oA=iA.pipe(Y(ES(0))),sA=J({appId:nA(160),releaseId:nA(160),surfaceId:nA(160)}),cA=J({editing:nS,surface:sS([nA(160),Qx])}),lA=sS([J({kind:Xx(`compose`),requestId:nA(160),text:nA(2e3)}),J({kind:Xx(`navigate`),requestId:nA(160),params:aS(J({key:nA(64),value:nA(4096)})).pipe(Y(FS(16)))})]),uA=Yx(cS([`granted`,`missing`])),dA=J({"agent.list":uA,"agent.manage":uA,"agent.read":uA,"agent.send":uA,"computer.list":uA,"computer.readFile":uA,"computer.writeFile":uA,"computer.execute":uA,"git.repository":uA,"workflow.publish":uA,"workflow.arm":uA,"workflow.run":uA,"app.events.emit":uA,"llm.generation":uA,"media.generation":uA,"media.share":uA}),fA=cS([`ready`,`missing`,`unknown`]),pA=J({models:fA,media:fA,git:fA,terminal:cS([`ready`,`exec-only`,`missing`,`unknown`]),terminalReason:q(eS)}),mA=cS([`model`,`media`,`git`,`computer`]),hA=cS([`opened`,`unavailable`]),gA=J({computerId:sS([nA(256),Qx]),computerName:q(lS(eS)),teamHasComputers:q(lS(nS)),computerAccessGranted:q(nS),setup:q(pA),permissions:q(dA),focus:cA,openRequest:sS([Qx,lA]),visibility:cS([`visible`,`hidden`])}),_A=cS([`connecting`,`connected`,`suspended`,`disconnected`,`disposing`,`disposed`]),vA=J({altKey:nS,ctrlKey:nS,id:nA(160),key:nA(64),metaKey:nS,shiftKey:nS}),yA=J({action:q(Zx),availability:q(Zx),category:nA(160),description:rA(512),id:nA(160),projections:q(Zx),title:nA(160)}),bA=J({arguments:q(Zx),commandId:nA(321),origin:cS([`agent`,`browser`,`keyboard`,`menu`,`palette`,`programmatic`,`slash`,`terminal`]),requestId:nA(160)}),xA=sS([J({result:q(Zx),status:Xx(`handled`)}),J({error:Zx,status:Xx(`failed`)})]),SA=e=>nA(e).pipe(Y(hS(e=>{for(let t=0;t<e.length;t+=1)if(kE(e.charCodeAt(t)))return!1;return!0},{message:`Expected one line of plain text`}))),CA={id:nA(64),text:SA(80),end:Yx(nS),priority:Yx(Xx(`low`))},wA=Yx(tS.pipe(Y(AS()),Y(kS({minimum:0,maximum:9999})))),TA=aS(sS([J({...CA,kind:Xx(`text`),tone:Yx(cS([`neutral`,`success`,`warning`,`error`]))}),J({...CA,kind:Xx(`button`),icon:Yx(cS([`folder`,`ports`,`processes`,`access`])),count:wA,tone:Yx(cS([`neutral`,`success`,`warning`,`error`])),busy:Yx(nS),title:Yx(SA(1024)),disabled:Yx(nS),opens:Yx(Xx(`dialog`)),expanded:Yx(nS)}),J({...CA,kind:Xx(`toggle`),pressed:nS}),J({...CA,kind:Xx(`menu`),count:wA,title:Yx(SA(1024)),options:aS(J({id:nA(64),text:SA(80),checked:Yx(nS),disabled:Yx(nS)})).pipe(Y(FS(16)),Y(hS(e=>new Set(e.map(e=>e.id)).size===e.length,{message:`Expected unique status option ids`})))})])).pipe(Y(FS(6)),Y(hS(e=>new Set(e.map(e=>e.id)).size===e.length,{message:`Expected unique status item ids`}))),EA=J({computerId:nA(256),path:nA(1024)}),DA=nA(80).pipe(Y(hS(e=>e.trim()===e,{message:`Expected a trimmed title`}))),OA=nA(64),kA=nA(80),AA=e=>new Set(e.map(e=>e.id)).size===e.length,jA=J({id:OA,label:kA,siblings:q(aS(J({id:OA,label:kA})).pipe(Y(FS(16)),Y(hS(AA,{message:`Expected unique crumb sibling ids`}))))}),MA=J({id:OA,label:kA,icon:q(Xx(`play`)),variant:q(cS([`primary`,`outline`,`ghost`])),tone:q(Xx(`destructive`)),disabled:q(nS)}),NA=e=>aS(MA).pipe(Y(FS(e)),Y(hS(AA,{message:`Expected unique header command ids`}))),PA={status:q(aS(J({id:OA,label:kA,presentation:q(Xx(`bead`)),tone:q(cS([`neutral`,`info`,`warning`,`success`,`error`]))})).pipe(Y(FS(4)),Y(hS(AA,{message:`Expected unique header status ids`})))),crumbs:q(aS(jA).pipe(Y(FS(8)),Y(hS(AA,{message:`Expected unique crumb ids`})))),primary:q(NA(3)),menu:q(NA(12))},FA=J({contractVersion:Xx(2),canGoBack:nS,canGoForward:nS,title:q(DA),...PA}),IA=J({canGoBack:nS,canGoForward:nS,title:q(eS),...PA}),LA=sS([J({kind:Xx(`crumb`),crumbId:OA,siblingId:q(OA)}),J({kind:Xx(`action`),actionId:OA})]),RA=lS(J({agentId:nA(256),sessionId:nA(256)})),zA=e=>q(aS(cS(e)).pipe(Y(FS(e.length)))),BA=J({agents:q(aS(cS([`agent.list`,`agent.manage`,`agent.read`,`agent.send`])).pipe(Y(FS(4)))),computers:q(aS(cS([`computer.list`,`computer.readFile`,`computer.writeFile`,`computer.execute`])).pipe(Y(FS(4)))),git:zA([`git.repository`]),workflows:zA([`workflow.publish`,`workflow.arm`,`workflow.run`]),events:zA([`app.events.emit`]),generation:zA([`llm.generation`,`media.generation`,`media.share`])}),VA=cS([`granted`,`declined`,`customize`]),HA=J({message:nA(512),tone:q(cS([`info`,`success`,`warning`,`error`]))}),UA=cS(eC);J({code:UA.pick([`DELIVERY_PENDING`])});var WA=J({code:UA,message:nA(512),retryable:nS,need:Yx(GS)}),GA=sS([J({protocolVersion:Xx(3),type:Xx($k)}),J({protocolVersion:Xx(2),type:Xx(eA)})]),KA=J({epoch:nA(160),protocolVersion:cS(Qk),type:Xx(tA)}),qA=J({epoch:nA(160),protocolVersion:cS(Qk)}),JA={[Symbol.dispose]:q(Zx)},YA=sS([J({...JA,ok:Xx(!0),value:Zx}),J({...JA,error:WA,ok:Xx(!1)})]);function XA(e,t,n=`PROTOCOL`){return kc(Kx(e,{onExcessProperty:`error`}),zd({onFailure:e=>{throw new X(`The peer sent malformed protocol data`,{cause:e,code:n,retryable:!1})},onSuccess:t}))}function ZA(e){return Object.freeze(e)}function QA(e,t){let n=e.arguments===void 0?void 0:$o(e.arguments),r={origin:e.origin,signal:t};return n!==void 0&&Object.assign(r,{arguments:n}),ZA(r)}var $A=XA(yA,e=>{let t={category:e.category,id:e.id,title:e.title};return e.action!==void 0&&Object.assign(t,{action:e.action}),e.availability!==void 0&&Object.assign(t,{availability:e.availability}),e.description!==void 0&&Object.assign(t,{description:e.description}),e.projections!==void 0&&Object.assign(t,{projections:e.projections}),ZA(Wj(()=>fs(t)))},`INVALID_ARGUMENT`),ej=XA(nA(321),e=>e),tj=XA(bA,e=>{let t=e.arguments===void 0?void 0:$o(e.arguments),n={commandId:e.commandId,origin:e.origin,requestId:e.requestId};return t!==void 0&&Object.assign(n,{arguments:t}),ZA(n)}),nj=XA(sS([$x,Zx]),e=>e===void 0?void 0:$o(e)),rj=XA(KA,e=>ZA(e));XA(qA,e=>ZA(e));var ij=XA(gA,e=>{let t={computerId:e.computerId,focus:ZA({...e.focus}),openRequest:e.openRequest===null?null:ZA({...e.openRequest}),visibility:e.visibility};return e.teamHasComputers!==void 0&&(t.teamHasComputers=e.teamHasComputers),e.computerName!==void 0&&(t.computerName=e.computerName),e.computerAccessGranted!==void 0&&(t.computerAccessGranted=e.computerAccessGranted),e.setup!==void 0&&(t.setup=ZA({...e.setup})),e.permissions!==void 0&&(t.permissions=ZA({...e.permissions})),ZA(t)}),aj=XA(WA,e=>ZA({...e})),oj=XA(cA,e=>ZA({...e}),`INVALID_ARGUMENT`),sj=XA(sA,e=>ZA({...e})),cj=XA(_A,e=>e),lj=XA(TA,e=>ZA(e.map(e=>e.kind===`menu`?ZA({...e,options:ZA(e.options.map(e=>ZA(e)))}):ZA(e))),`INVALID_ARGUMENT`),uj=XA(J({itemId:nA(64),optionId:Yx(nA(64)),anchor:Yx(J({start:tS.pipe(Y(kS({minimum:0,maximum:1e5}))),width:tS.pipe(Y(kS({minimum:0,maximum:1e5})))}))}),e=>ZA(e.anchor===void 0?{...e}:{...e,anchor:ZA({...e.anchor})}),`INVALID_ARGUMENT`),dj=XA(EA,e=>ZA({...e}),`INVALID_ARGUMENT`);function fj(e){let t={id:e.id,label:e.label};return e.presentation!==void 0&&(t={...t,presentation:e.presentation}),e.tone!==void 0&&(t={...t,tone:e.tone}),ZA(t)}function pj(e){let t={id:e.id,label:e.label};return e.siblings===void 0?ZA(t):ZA({...t,siblings:ZA(e.siblings.map(e=>ZA({...e})))})}function mj(e){let t={id:e.id,label:e.label};return e.icon!==void 0&&(t={...t,icon:e.icon}),e.variant!==void 0&&(t={...t,variant:e.variant}),e.tone!==void 0&&(t={...t,tone:e.tone}),e.disabled!==void 0&&(t={...t,disabled:e.disabled}),ZA(t)}function hj(e){let t={canGoBack:e.canGoBack,canGoForward:e.canGoForward};return e.title!==void 0&&(t={...t,title:e.title}),e.crumbs!==void 0&&(t={...t,crumbs:ZA(e.crumbs.map(pj))}),e.primary!==void 0&&(t={...t,primary:ZA(e.primary.map(mj))}),e.menu!==void 0&&(t={...t,menu:ZA(e.menu.map(mj))}),e.status!==void 0&&(t={...t,status:ZA(e.status.map(fj))}),ZA(t)}var gj=XA(FA,hj,`INVALID_ARGUMENT`),_j=XA(IA,e=>{let t=e.title?.trim();return vj({...hj({...e,title:t===void 0||t.length===0?void 0:t}),contractVersion:2})},`INVALID_ARGUMENT`),vj=XA(FA,e=>ZA({...hj(e),contractVersion:2}),`INVALID_ARGUMENT`),yj=XA(LA,e=>e.kind===`action`?ZA({...e}):ZA(e.siblingId===void 0?{kind:e.kind,crumbId:e.crumbId}:e),`INVALID_ARGUMENT`),bj=XA(RA,e=>e===null?null:ZA({...e}),`INVALID_ARGUMENT`),xj=XA(BA,e=>ZA({agents:ZA([...new Set(e.agents??[])]),computers:ZA([...new Set(e.computers??[])]),...e.git&&{git:ZA([...new Set(e.git)])},...e.workflows&&{workflows:ZA([...new Set(e.workflows)])},...e.events&&{events:ZA([...new Set(e.events)])},...e.generation&&{generation:ZA([...new Set(e.generation)])}}),`INVALID_ARGUMENT`),Sj=XA(mA,e=>e,`INVALID_ARGUMENT`);XA(GA,e=>ZA(e));var Cj=XA(nA(512),e=>e),wj=XA(HA,e=>ZA({...e}),`INVALID_ARGUMENT`);XA(J({id:nA(160),repeat:nS}),e=>ZA(e));var Tj=XA(aS(vA).pipe(Y(FS(64))),e=>{if(new Set(e.map(e=>e.id)).size!==e.length)throw new X(`Reserved chords are invalid`,{code:`PROTOCOL`,retryable:!1});return ZA(e.map(e=>ZA({...e})))});function Ej(e){return XA(J({value:Zx,version:aA}),t=>ZA({value:e(t.value),version:t.version}))}var Dj=Ej(ij),Oj=XA(J({capabilities:aS(Zx).pipe(Y(FS(128))),context:Zx}),e=>ZA({capabilities:ZA(e.capabilities.map(e=>Pj(e))),context:Dj(e.context)})),kj=Ej(cj),Aj=Ej(Tj),jj=Ej(Cj),Mj=kc(kj,e=>{if(e.value!==`connected`&&e.value!==`suspended`)throw new X(`The host lifecycle is invalid`,{code:`PROTOCOL`,retryable:!1});return ZA({value:e.value,version:e.version})});function Nj(e){return XA(J({handle:Zx,id:nA(160),version:oA}),t=>{if(!(t.handle instanceof EE)&&!(e&&t.handle instanceof DE))throw new X(`A capability handle is invalid`,{code:`PROTOCOL`,retryable:!1});return ZA({handle:t.handle,id:t.id,version:t.version})})}var Pj=Nj(!1),Fj=Nj(!0);function Ij(e){let t=e?Fj:Pj;return XA(J({capabilities:aS(Zx).pipe(Y(FS(128))),context:Zx,identity:Zx,lifecycle:Zx,reservedChords:Zx,theme:Zx}),e=>ZA({capabilities:ZA(e.capabilities.map(e=>t(e))),context:Dj(e.context),identity:sj(e.identity),lifecycle:Mj(e.lifecycle),reservedChords:Aj(e.reservedChords),theme:jj(e.theme)}))}var Lj=Ij(!1);Ij(!0);function Rj(e){return XA(YA,t=>t.ok?ZA({ok:!0,value:e(t.value)}):ZA({ok:!1,error:aj(t.error)}))}var zj=Rj(Lj),Bj=Rj(XA(J({commandId:nA(321)}),e=>ZA(e)));Rj(XA(xA,e=>{if(e.status===`failed`)return ZA({status:`failed`,error:Wj(()=>ts(e.error))});let t=e.result===void 0?void 0:$o(e.result);return ZA(t===void 0?{status:`handled`}:{status:`handled`,result:t})}));var Vj=Rj(XA($x,()=>void 0)),Hj=Rj(XA(VA,e=>e)),Uj=Rj(XA(hA,e=>e));Rj(XA(nS,e=>e)),Rj(XA(nS,e=>e));function Wj(e){try{return e()}catch(e){throw new X(`The command metadata is invalid`,{cause:e,code:`INVALID_ARGUMENT`,retryable:!1})}}var Gj=sS([J({kind:Xx(`saveFile`),name:nA(255).pipe(Y(vS(/^[^\p{Cc}/\\]+$/u))),mime:nA(255),bytes:US}),J({kind:Xx(`copyText`),text:eS})]);function Kj(e){let t=Kx(Gj,{onExcessProperty:`error`})(e);if(Id(t))return{kind:`refused`,reason:`invalid-request`};let n=t.success;return n.kind===`saveFile`?n.name===`.`||n.name===`..`?{kind:`refused`,reason:`invalid-request`}:n.bytes.byteLength>33554432?{kind:`refused`,reason:`too-large`}:{...n,bytes:new Uint8Array(n.bytes)}:n.text.length>1048576||new TextEncoder().encode(n.text).byteLength>1048576?{kind:`refused`,reason:`too-large`}:n}var qj=Rj(XA(sS([J({kind:Xx(`saved`)}),J({kind:Xx(`copied`)}),J({kind:Xx(`refused`),reason:cS([`no-user-gesture`,`too-large`,`invalid-request`,`unavailable`,`denied`,`busy`])})]),e=>ZA(e)));function Jj(e){return e instanceof X?{code:e.code,message:Xj(e.message),retryable:e.retryable,...e.need!==void 0&&{need:e.need}}:{code:`HOST_FAILURE`,message:`Host operation failed`,retryable:!1}}function Yj(e){try{let t=aj(e);return new X(t.message,{code:t.code,retryable:t.retryable,...t.need!==void 0&&{need:t.need}})}catch(e){return new X(`The host returned a malformed error`,{cause:e,code:`PROTOCOL`,retryable:!1})}}function Xj(e){return e.trim().slice(0,512)||`Host operation failed`}var Zj=e=>({ok:!0,value:e}),Qj=e=>({error:Jj(e),ok:!1});async function $j(e,t){let n,r=new Set;try{return n=await e,eM(t(n))}catch(e){throw tM(e)&&nM(e,r),e instanceof X?e:new X(`The remote operation failed`,{cause:e,code:`HOST_FAILURE`,retryable:!0})}finally{n!==e&&tM(n)&&nM(n,r)}}function eM(e){if(e.ok)return e.value;throw Yj(e.error)}function tM(e){return Kc(e)&&Symbol.dispose in e&&Hc(e[Symbol.dispose])}function nM(e,t){if(!t.has(e)){t.add(e);try{e[Symbol.dispose]()}catch(e){console.warn(`RPC result disposal failed`,e)}}}function rM(){let e=[],t=new Set;return{get:()=>e,subscribe:e=>(t.add(e),()=>t.delete(e)),update:n=>{e=n;for(let e of Array.from(t))try{e()}catch(e){console.warn(`App binding subscriber failed`,e)}}}}function iM(e){let t=Tj(e),n=new Set;return{get:()=>t,subscribe:e=>(n.add(e),()=>n.delete(e)),update:e=>{t=Tj(e);for(let e of Array.from(n))try{e()}catch(e){console.warn(`Reserved chord subscriber failed`,e)}}}}function aM(e){let t=!0,n,r=e.window.document.querySelector(`html`);if(!r)return()=>{t=!1};let i=Xk(r),a=new fk(i);Mk(a),Rk(a),a.prependEventMatchResolver(Zk);let o=sM(e.onBroken),s=dM(a,e.chords,e.remote,o),c=oM(e,o,()=>t,e=>{n=e},()=>n),l=i.onFocusChange(()=>{queueMicrotask(c)}),u=e=>()=>{queueMicrotask(()=>{c(e)})},d=u(!0),f=u(!1),p=()=>{let t=e.window.document.activeElement?.tagName;t!==`IFRAME`&&t!==`FRAME`&&t!==`OBJECT`&&t!==`EMBED`&&f()};e.window.addEventListener(`focus`,d),e.window.addEventListener(`blur`,p);let m=e.bindings,h=()=>cM(e.window.document,e.identity.surfaceId).editing,g=m===void 0?()=>void 0:lM(a,m,h),_=m===void 0?()=>void 0:m.subscribe(()=>{g(),g=lM(a,m,h)}),v=e.chords.subscribe(()=>{s(),s=dM(a,e.chords,e.remote,o)});return queueMicrotask(c),()=>{t&&(t=!1,l(),e.window.removeEventListener(`focus`,d),e.window.removeEventListener(`blur`,p),v(),s(),_(),g())}}function oM(e,t,n,r,i){return a=>{if(!n())return;let o=cM(e.window.document,e.identity.surfaceId),s=a===void 0?o:oj({editing:o.editing,surface:a?e.identity.surfaceId:null}),c=i();(a===!0||s.editing!==c?.editing||s.surface!==c.surface)&&(r(s),t(()=>e.remote.reportFocus(s)))}}function sM(e){return t=>{try{$j(t(),Vj).catch(t=>{nT(`browser-bridge.host-call`,t),e(t)})}catch(t){nT(`browser-bridge.host-call`,t),e(t)}}}function cM(e,t){let n=e.activeElement;return oj({editing:!!(n?.matches(`input, textarea, select, [contenteditable='true']`)===!0||n?.closest(`[contenteditable='true']`)),surface:e.hasFocus()?t:null})}function lM(e,t,n){let r=t.get();return e.registerLayer({bindings:r.map((e,t)=>({cmd:`app/${String(t)}`,key:e.key})),commands:r.map((e,t)=>({name:`app/${String(t)}`,run:t=>{let r=t.event.originalEvent;if(r?.defaultPrevented||r?.isComposing||uM(e.key)&&n())return!1;e.run()}})),priority:500})}function uM(e){return!/(?:^|\+)(?:ctrl|control|super|meta|cmd|alt|option|mod)\+/iu.test(e)}function dM(e,t,n,r){let i=t.get();return e.registerLayer({bindings:i.map(e=>({cmd:`reserved/${e.id}`,key:{ctrl:e.ctrlKey,meta:e.altKey,name:qk(e.key),shift:e.shiftKey,super:e.metaKey}})),commands:i.map(e=>({name:`reserved/${e.id}`,run:t=>{let i=t.event.originalEvent;if(i?.defaultPrevented||i?.isComposing)return!1;r(()=>n.invokeReservedChord(e.id,i?.repeat??!1))}})),priority:1e3})}function fM(e){let t=t=>{if(t.defaultPrevented||t.isComposing)return;let n=hM(t,e.mac);n!==null&&(t.preventDefault(),!t.repeat&&(n===`back`&&e.canGoBack()&&e.back(),n===`forward`&&e.canGoForward()&&e.forward()))},n=t=>{let n=mM(t.button);if(n===null)return;let r=t.defaultPrevented;t.preventDefault(),!(t.type!==`mouseup`||r)&&(n===`back`&&e.canGoBack()&&e.back(),n===`forward`&&e.canGoForward()&&e.forward())};e.window.addEventListener(`keydown`,t);for(let t of pM)e.window.addEventListener(t,n);return()=>{e.window.removeEventListener(`keydown`,t);for(let t of pM)e.window.removeEventListener(t,n)}}var pM=[`mousedown`,`mouseup`,`auxclick`];function mM(e){return e===3?`back`:e===4?`forward`:null}function hM(e,t){return e.shiftKey||e.ctrlKey?null:t?!e.metaKey||e.altKey?null:e.key===`[`?`back`:e.key===`]`?`forward`:gM(e.target)?null:e.key===`ArrowLeft`?`back`:e.key===`ArrowRight`?`forward`:null:!e.altKey||e.metaKey?null:e.key===`ArrowLeft`?`back`:e.key===`ArrowRight`?`forward`:null}function gM(e){return e instanceof HTMLElement?e.isContentEditable||e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement||e instanceof HTMLSelectElement:!1}function _M(){return!Uc(globalThis.navigator)&&/Mac|iPhone|iPad/u.test(globalThis.navigator.userAgent)}function vM(e){let t=e,n=new Set;return{get:()=>t,subscribe(e){n.add(e);let t=!0;return()=>{t&&(t=!1,n.delete(e))}},update(e){if(!Object.is(t,e)){t=e;for(let e of Array.from(n))try{e(t)}catch(e){console.warn(`App store subscriber failed`,e)}}}}}function yM(e){let t=new Map,n=vM(0),r=!1,i=e=>{let t=new Map;try{for(let n of e){let e=Pj(n),r=wM(e.id,e.version);if(t.has(r))throw xM(e.handle),new X(`Duplicate capability grant`,{code:`PROTOCOL`,retryable:!1});t.set(r,e.handle)}}catch(e){for(let e of t.values())xM(e);throw e}return t};for(let[n,r]of i(e))t.set(n,r);let a=e=>{for(let t of e)xM(t)},o=e=>{if(r)throw new X(`The app connection is disposed`,{code:`DISCONNECTED`,retryable:!0});let n=wM(e.id,e.version);return t.get(n)};return{directory:Object.freeze({get version(){return n.get()},subscribe:e=>n.subscribe(e),has(e){return!!o(e)},require(e){let t=o(e);if(!t)throw new X(`The capability is not granted`,{code:`CAPABILITY_DENIED`,retryable:!1});try{return e.schema.parse(t)}catch(e){throw new X(`The capability interface is malformed`,{cause:e,code:`PROTOCOL`,retryable:!1})}}}),replace(e){if(r)throw new X(`The app connection is disposed`,{code:`DISCONNECTED`,retryable:!0});let o=i(e),s=[...t.values()];t.clear();for(let[e,n]of o)t.set(e,n);a(s.filter(e=>![...o.values()].includes(e))),n.update(n.get()+1)},disconnect(){r||(r=!0,a(t.values()),t.clear(),n.update(n.get()+1))}}}var bM=Ka().transform(e=>{let t=qo(Object).safeParse(e);if(!t.success)return;let n=Object.create(t.data),r=qx(J({[Symbol.dispose]:q(pS(Function))}))(n);return{owner:t.data,dispose:r[Symbol.dispose]}});function xM(e){try{let t=bM.parse(e);if(t===void 0||CM.has(t.owner))return;CM.add(t.owner),t.dispose?.call(t.owner)}catch(e){console.warn(`RPC value disposal failed`,e)}}function SM(e){return{value:e,[Symbol.dispose](){xM(e)}}}var CM=new WeakSet;function wM(e,t){return`${e}@${String(t)}`}var TM=`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(`.`),EM=`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 DM(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 OM(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=[DM(TM)];for(let e=1;e<t;e++)r.push(DM(EM));return r.join(n)}var kM=[];for(let e=0;e<256;++e)kM.push((e+256).toString(16).slice(1));function AM(e,t=0){return(kM[e[t+0]]+kM[e[t+1]]+kM[e[t+2]]+kM[e[t+3]]+`-`+kM[e[t+4]]+kM[e[t+5]]+`-`+kM[e[t+6]]+kM[e[t+7]]+`-`+kM[e[t+8]]+kM[e[t+9]]+`-`+kM[e[t+10]]+kM[e[t+11]]+kM[e[t+12]]+kM[e[t+13]]+kM[e[t+14]]+kM[e[t+15]]).toLowerCase()}var jM,MM=new Uint8Array(16);function NM(){if(!jM){if(typeof crypto>`u`||!crypto.getRandomValues)throw Error(`crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported`);jM=crypto.getRandomValues.bind(crypto)}return jM(MM)}var PM={randomUUID:typeof crypto<`u`&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function FM(e,t,n){if(PM.randomUUID&&!t&&!e)return PM.randomUUID();e||={};let r=e.random??e.rng?.()??NM();if(r.length<16)throw Error(`Random bytes length must be >= 16`);if(r[6]=r[6]&15|64,r[8]=r[8]&63|128,t){if(n||=0,n<0||n+16>t.length)throw RangeError(`UUID byte range ${n}:${n+15} is out of buffer bounds`);for(let e=0;e<16;++e)t[n+e]=r[e];return t}return AM(r)}U().regex(/^replay_[a-f0-9]{64}$/);var IM=ya({version:`v4`}),LM=Wo(e=>IM.safeParse(e).success);function RM(){return LM.parse(FM())}var zM=class extends DE{#e=!0;#t;#n=new Map;constructor(e){super(),this.#t=e}cancel(e){try{return this.#n.get(ej(e))?.abort(),Promise.resolve(Zj(void 0))}catch(e){return Promise.resolve(Qj(e))}}dispose(){if(this.#e){this.#e=!1;for(let e of this.#n.values())e.abort();this.#n.clear()}}async invoke(e){try{if(!this.#e)throw new X(`The command is disposed`,{code:`DISCONNECTED`,retryable:!0});let t=tj(e);if(this.#n.has(t.requestId))throw new X(`Duplicate command request`,{code:`PROTOCOL`,retryable:!1});if(this.#n.size>=64)throw new X(`Too many command requests`,{code:`HOST_FAILURE`,retryable:!0});let n=new AbortController;this.#n.set(t.requestId,n);try{let e=nj(await this.#t(QA(t,n.signal)));return Zj(e===void 0?{status:`handled`}:{status:`handled`,result:e})}finally{this.#n.delete(t.requestId)}}catch(e){if(e instanceof xs)try{return Zj({status:`failed`,error:ts({code:e.code,message:e.message,details:e.details})})}catch(e){return Qj(e)}return Qj(e)}}[Symbol.dispose](){this.dispose()}};function BM(e){let t=[];for(let n of e.values()){let{commandId:e,definition:r,target:i}=n;if(e===void 0)continue;let a=r.availability?.status!==`unavailable`;for(let n of r.projections?.bindings?.values??[])n.trim().includes(` `)||n.startsWith(`<`)||t.push({key:n,run:()=>{a&&Promise.resolve().then(async()=>{let t=eM(await i.invoke({commandId:e,origin:`keyboard`,requestId:RM()}));if(t.status===`failed`)throw new xs(t.error.code,t.error.message,t.error.details)}).catch(e=>{console.warn(`App key command failed`,e)})}})}return t}function VM(e,t,n,r){let i=new Map,a=!1,o=()=>{r?.update(a?[]:BM(i))},s=e=>{try{n()}catch(t){console.warn(`App command failure callback failed`,t,e)}},c=e=>{try{$j(e(),Vj).catch(e=>{s(e)})}catch(e){console.warn(`App command RPC supervision failed`,e),s(e)}};return{commands:UM(e,t,i,()=>a,t=>{let n=i.get(t);if(!n)return;i.delete(t),n.target.dispose(),o();let r=n.commandId;!a&&r!==void 0&&c(()=>e.unregisterCommand(r))},o),dispose(){if(!a){a=!0;for(let e of i.values())e.target[Symbol.dispose]();i.clear(),o()}}}}function HM(e,t,n){let r=t.id;if(e.size>=128||e.has(r))throw n.dispose(),new X(`Command registration is unavailable`,{code:`INVALID_ARGUMENT`,retryable:!1});let i={commandId:void 0,definition:t,target:n};e.set(r,i);let a=!1;return{commit(e){a||(i.commandId=e)},release(){a||(a=!0,e.get(r)===i&&e.delete(r),n.dispose())},target:n}}function UM(e,t,n,r,i,a){return Object.freeze({async register(o,s){if(t(),!Hc(s))throw new X(`Command handler must be a function`,{code:`INVALID_ARGUMENT`,retryable:!1});let c=$A(o),l=new zM(s),u=HM(n,c,l);try{let t=await WM(e,c,u.target);r()&&await GM(e,t.commandId,l),u.commit(t.commandId),a()}catch(e){throw u.release(),e}let d=!0;return()=>{d&&(d=!1,i(c.id))}}})}async function WM(e,t,n){return $j(e.registerCommand(t,n),Bj)}async function GM(e,t,n){throw n.dispose(),await $j(e.unregisterCommand(t),Vj),new X(`The command controller is disposed`,{code:`DISCONNECTED`,retryable:!0})}var KM=Fx(e=>e instanceof EE),qM=class extends DE{#e=!1;#t;constructor(e){super(),this.#t=e}disconnect(e){try{if(this.#e)throw iN();let t=e===void 0?void 0:aj(e);return setTimeout(()=>this.#t.disconnect?.(t??cN()),0),Promise.resolve(Zj(void 0))}catch(e){return Promise.resolve(Qj(e))}}async requestClose(){try{if(this.#e)throw iN();return Zj(await(this.#t.beforeClose?.()??!0))}catch(e){return Qj(e)}}async requestBack(){try{if(this.#e)throw iN();return Zj(await(this.#t.back?.()??!1))}catch(e){return Qj(e)}}async requestForward(){try{if(this.#e)throw iN();return Zj(await(this.#t.forward?.()??!1))}catch(e){return Qj(e)}}async activateNavigation(e){try{if(this.#e)throw iN();let t=yj(e);return ME(this.#t.navigation,t)?Zj(await(this.#t.activate?.(t)??!1)):Zj(!1)}catch(e){return Qj(e)}}async activateStatus(e){try{if(this.#e)throw iN();let t=uj(e);return jE(this.#t.statusItems,t)?Zj(await(this.#t.statusAction?.(t)??!1)):Zj(!1)}catch(e){return Qj(e)}}[Symbol.dispose](){this.#e=!0}async updateContext(e){return this.#e?Qj(iN()):this.#n(e,`context`,ij,e=>{this.#t.context.update(e)})}reconfigure(e){let t=[];try{if(this.#e)throw iN();let n=Oj(e);if(n.context.version<=this.#t.versions.context)return Promise.resolve(Zj(void 0));for(let e of n.capabilities)t.push({...e,handle:qx(KM)(e.handle).dup()});if(!this.#t.capabilities)throw iN();return this.#t.capabilities.replace(t),t=[],this.#t.versions.context=n.context.version,this.#t.context.update(n.context.value),Promise.resolve(Zj(void 0))}catch(e){for(let e of t)xM(e.handle);return Promise.resolve(Qj(e))}}updateLifecycle(e){try{if(this.#e)throw iN();let t=Ej(cj)(e);if(t.version<=this.#t.versions.lifecycle)return Promise.resolve(Zj(void 0));if(!lN(this.#t.lifecycle.get(),t.value))throw new X(`The host sent an invalid lifecycle transition`,{code:`PROTOCOL`,retryable:!1});return this.#t.versions.lifecycle=t.version,this.#t.lifecycle.update(t.value),Promise.resolve(Zj(void 0))}catch(e){return Promise.resolve(Qj(e))}}async updateReservedChords(e){return this.#e?Qj(iN()):this.#n(e,`chords`,Tj,e=>{this.#t.chords.update(e)})}async updateTheme(e){return this.#e?Qj(iN()):this.#n(e,`theme`,Cj,e=>{this.#t.theme.update(e)})}#n(e,t,n,r){try{let i=Ej(n)(e);return i.version>this.#t.versions[t]&&(this.#t.versions[t]=i.version,r(i.value)),Promise.resolve(Zj(void 0))}catch(e){return Promise.resolve(Qj(e))}}};async function JM(e){let t=QM(),n=new qM(t),r=OE(e.port,n),i,a=ZM(r);try{performance.mark(`fungi.app-open.agar-rpc-connect-start`);let o=await Promise.race([r.connect({epoch:e.epoch,protocolVersion:e.protocolVersion}),a]);performance.mark(`fungi.app-open.agar-rpc-connect-ready`),i=o;let s=eM(zj(o));if(!e.isActive())throw XM();let c=$M({bootstrap:s,bootstrapOwner:i,options:e,remote:r,state:t,target:n});return performance.mark(`fungi.app-open.agar-root-created`),i=void 0,c}catch(t){return dN(t,e,n,r,i)}}function YM(e,t){e.context.update(t.context.value),e.theme.update(t.theme.value),e.lifecycle.update(t.lifecycle.value),e.chords.update(t.chords.value),e.versions.context=t.context.version,e.versions.theme=t.theme.version,e.versions.lifecycle=t.lifecycle.version,e.versions.chords=t.chords.version}function XM(){return new X(`App connection was cancelled`,{code:`CANCELLED`,retryable:!1})}function ZM(e){let t,n=new Promise((e,n)=>{t=n});return n.catch(e=>{nT(`app-session.rpc-disconnect`,e)}),e.onRpcBroken(()=>t?.(new X(`The app host disconnected`,{code:`DISCONNECTED`,retryable:!0}))),n}function QM(){return{statusItems:[],navigation:{canGoBack:!1,canGoForward:!1},bindings:rM(),chords:iM([]),context:vM({computerId:null,focus:{editing:!1,surface:null},openRequest:null,visibility:`hidden`}),lifecycle:vM(`connecting`),theme:vM(`default`),canGoBack:!1,canGoForward:!1,versions:{chords:-1,context:-1,lifecycle:-1,theme:-1}}}function $M(e){let t=sj(e.bootstrap.identity),n=uN(e.bootstrap);YM(e.state,n);let r=yM(e.bootstrap.capabilities);return e.state.capabilities=r,tN(e,t,r)}function eN(e,t,n){return aM({bindings:e.state.bindings,chords:e.state.chords,identity:t,onBroken:e=>{n({code:`DISCONNECTED`,message:e instanceof X?e.message:`The app host rejected a browser bridge operation`,retryable:!0})},remote:e.remote,window:e.options.window})}function tN(e,t,n){let r=!1,i=t=>{r||(r=!0,oN([()=>{t&&e.state.lifecycle.update(`disconnected`)},()=>{e.state.lifecycle.update(`disposing`)},l,u,()=>{o.dispose()},()=>{e.state.beforeClose=void 0,e.state.back=void 0,e.state.forward=void 0,e.state.activate=void 0,e.state.statusAction=void 0},()=>{n.disconnect()},()=>{e.target[Symbol.dispose]()},()=>{xM(e.bootstrapOwner)},()=>{xM(e.remote)},()=>{e.options.port.close()},()=>{e.state.lifecycle.update(`disposed`)},e.options.onDisposed],`app connection disposal`))},a=()=>{if(r)throw new X(`The app connection is disposed`,{code:`DISCONNECTED`,retryable:!0})},o=VM(e.remote,a,()=>{i({code:`DISCONNECTED`,message:`The app host rejected a terminal command operation`,retryable:!0})},e.state.bindings),s=rN(e.remote,a,e.state),c=nN(e.state,e.remote,a),l=eN(e,t,i),u=fM({window:e.options.window,mac:_M(),canGoBack:()=>e.state.canGoBack&&e.state.back!==void 0,back:()=>{let t=e.state.back;t&&Promise.resolve().then(t).catch(e=>{nT(`app-window.back-input`,e)})},canGoForward:()=>e.state.canGoForward&&e.state.forward!==void 0,forward:()=>{let t=e.state.forward;t&&Promise.resolve().then(t).catch(e=>{nT(`app-window.forward-input`,e)})}});return e.state.disconnect=i,e.remote.onRpcBroken(()=>{aN(i)}),sN({capabilities:n.directory,commands:o.commands,context:e.state.context,dispose:i,identity:t,lifecycle:e.state.lifecycle,theme:e.state.theme,ui:s,window:c})}function nN(e,t,n){let r=Object.freeze({async publish(r){n();let i=_j(r);e.canGoBack=i.canGoBack,e.canGoForward=i.canGoForward,e.navigation=gj(i),await $j(t.reportNavigation(i),Vj)},onActivate(t){if(n(),e.activate!==void 0)throw new X(`The App already owns navigation activations`,{code:`INVALID_ARGUMENT`,retryable:!1});e.activate=t;let r=!1;return()=>{r||(r=!0,e.activate===t&&(e.activate=void 0))}},onForward(t){if(n(),e.forward!==void 0)throw new X(`The App already owns Forward requests`,{code:`INVALID_ARGUMENT`,retryable:!1});e.forward=t;let r=!1;return()=>{r||(r=!0,e.forward===t&&(e.forward=void 0))}},onBack(t){if(n(),e.back!==void 0)throw new X(`The App already owns Back requests`,{code:`INVALID_ARGUMENT`,retryable:!1});e.back=t;let r=!1;return()=>{r||(r=!0,e.back===t&&(e.back=void 0))}}});return Object.freeze({navigation:r,onBeforeClose(t){if(n(),e.beforeClose!==void 0)throw new X(`The App already owns a close consultation`,{code:`INVALID_ARGUMENT`,retryable:!1});e.beforeClose=t;let r=!1;return()=>{r||(r=!0,e.beforeClose===t&&(e.beforeClose=void 0))}}})}function rN(e,t,n){return Object.freeze({async requestComputerChoice(){t(),await $j(e.requestComputerChoice(),Vj)},async requestBrowserAction(n){t();let r=Kj(n);return r.kind===`refused`?r:await $j(e.requestBrowserAction(r),qj)},onStatusAction(e){if(t(),n.statusAction!==void 0)throw new X(`The App already owns its status actions`,{code:`INVALID_ARGUMENT`,retryable:!1});n.statusAction=e;let r=!1;return()=>{r||(r=!0,n.statusAction===e&&(n.statusAction=void 0))}},async requestAppPermissions(n){return t(),await $j(e.requestAppPermissions(xj(n)),Hj)},async openDesktopSettings(){t(),await $j(e.openDesktopSettings(),Vj)},async openSetup(n){return t(),await $j(e.openSetup(Sj(n)),Uj)},async openTeamBilling(){t(),await $j(e.openTeamBilling(),Vj)},async openNavigation(n){t(),await $j(e.openNavigation(dj(n)),Vj)},async reportStatus(r){t();let i=lj(r);n.statusItems=i,await $j(e.reportStatus(i),Vj)},async reportAgentSessionSelection(n){t(),await $j(e.reportAgentSessionSelection(bj(n)),Vj)},async showToast(n){t(),await $j(e.showToast(wj(n)),Vj)}})}function iN(){return new X(`The app connection is disposed`,{code:`DISCONNECTED`,retryable:!0})}function aN(e){e({code:`DISCONNECTED`,message:`The app host disconnected`,retryable:!0})}function oN(e,t){for(let n of e)try{n()}catch(e){console.warn(`${t} cleanup failed`,e)}}function sN(e){return Object.freeze(e)}function cN(){return{code:`DISCONNECTED`,message:`The app host disconnected`,retryable:!1}}function lN(e,t){return e===t||e===`connected`&&t===`suspended`||e===`suspended`&&t===`connected`}function uN(e){let t=Ej(ij)(e.context),n=Ej(Cj)(e.theme),r=Ej(cj)(e.lifecycle),i=Ej(Tj)(e.reservedChords);if(r.value!==`connected`&&r.value!==`suspended`)throw new X(`The bootstrap lifecycle is invalid`,{code:`PROTOCOL`,retryable:!1});return{chords:i,context:t,lifecycle:r,theme:n}}function dN(e,t,n,r,i){throw oN([()=>{n[Symbol.dispose]()},()=>{i&&xM(i)},()=>{xM(r)},()=>{t.port.close()},t.onDisposed],`app connection rejection`),e instanceof X?e:new X(`Unable to establish the app RPC session`,{cause:e,code:`PROTOCOL`,retryable:!1})}var fN=!1,pN=class{options;#e;#t;#n=!1;#r;#i;constructor(e){this.options=e,this.#e=globalThis.window}start(){performance.mark(`fungi.app-open.agar-connect-start`);let e=this.#l();return e?Promise.reject(e):(fN=!0,this.#a())}#a(){return new Promise((e,t)=>{let n=(n,a)=>{this.#o(n,a,i,r,e,t)},r=()=>{n(hN())},i=e=>{this.#s(e,n,i)};this.#e.addEventListener(`message`,i),this.options.signal?.addEventListener(`abort`,r,{once:!0});let a=()=>{try{performance.mark(`fungi.app-open.agar-ready-sent`),this.#e.parent.postMessage({protocolVersion:3,type:$k},`*`),this.#e.parent.postMessage({protocolVersion:2,type:eA},`*`)}catch(e){nT(`connect.notify-host`,e),n(xN(e))}};this.#r=setInterval(a,200),this.#i=setTimeout(()=>{n(_N())},1e4),a()})}#o(e,t,n,r,i,a){if(!this.#n){if(this.#n=!0,this.#c(),this.#e.removeEventListener(`message`,n),this.options.signal?.removeEventListener(`abort`,r),e||!t){this.#t?.close(),fN=!1,a(e??_N());return}i(t)}}#s(e,t,n){if(!bN(e.data))return;if(performance.mark(`fungi.app-open.agar-connect-received`),e.source!==this.#e.parent||vN(e.origin)===void 0){t(yN());return}let r=SN(e,t);if(!r)return;let i=e.ports.length===1?e.ports[0]:void 0;if(!i){t(CN(`The app host did not transfer exactly one port`));return}this.#t=i,this.#c(),this.#e.removeEventListener(`message`,n),JM({epoch:r.epoch,protocolVersion:r.protocolVersion,isActive:()=>!this.#n,onDisposed:()=>{fN=!1},port:i,window:this.#e}).then(e=>{performance.mark(`fungi.app-open.agar-root-ready`),t(void 0,e)},e=>{t(gN(e))})}#c(){clearInterval(this.#r),clearTimeout(this.#i),this.#r=void 0,this.#i=void 0}#l(){if(this.options.signal?.aborted)return hN();if(fN)return new X(`An app connection is already live`,{code:`IDENTITY`,retryable:!1});if(Uc(globalThis.window)||this.#e.parent===this.#e)return new X(`The app host is unavailable`,{code:`DISCONNECTED`,retryable:!0})}};function mN(e){return new pN(e).start()}function hN(){return new X(`App connection was cancelled`,{code:`CANCELLED`,retryable:!1})}function gN(e){return e instanceof X?e:new X(`Unable to connect to the app host`,{cause:e,code:`PROTOCOL`,retryable:!1})}function _N(){return new X(`The app host disconnected`,{code:`DISCONNECTED`,retryable:!0})}function vN(e){if(!URL.canParse(e))return;let t=new URL(e).origin;return t===e?t:void 0}function yN(){return new X(`The app connection identity is invalid`,{code:`IDENTITY`,retryable:!1})}var bN=Ux(J({type:Xx(tA)}));function xN(e){return new X(`Unable to notify the app host`,{cause:e,code:`DISCONNECTED`,retryable:!0})}function SN(e,t){try{return rj(e.data)}catch(e){nT(`connect.decode-message`,e),t(e instanceof X?e:new X(`Malformed app connection`,{cause:e,code:`PROTOCOL`,retryable:!1}));return}}function CN(e){return new X(e,{code:`PROTOCOL`,retryable:!1})}function wN(e,t,n){e.style.isolation=`isolate`;let r=(0,tT.createRoot)(e),i=new AbortController,a=e.ownerDocument.documentElement,o=mC(a),s,c,l,u=!1,d=e=>{let i=(0,G.createElement)(TN,{state:e,render:n});r.render(t.queryClient?(0,G.createElement)(yC,{client:t.queryClient},i):i)},f=()=>{l?.(),l=void 0,c?.(),c=void 0;let e=s;s=void 0,e?.dispose(),u&&=(o===null?a.removeAttribute(`data-theme`):pC(o,a),!1)},{defaultView:p}=e.ownerDocument;return performance.mark(`fungi.app-open.react-root-render-start`),p?p.parent===p?d({app:null,status:`standalone`}):(d({app:null,status:`connecting`}),mN({host:`parent`,signal:i.signal}).then(e=>{if(i.signal.aborted){e.dispose();return}s=e;let t=()=>{let t=e.lifecycle.get();return t===`disposing`||t===`disconnected`||t===`disposed`?(f(),d({app:null,status:`ended`}),!0):!1};l=e.lifecycle.subscribe(t),!t()&&(u=!0,pC(e.theme.get(),a),c=e.theme.subscribe(e=>{pC(e,a)}),d({app:e,status:`live`}))}).catch(e=>{i.signal.aborted&&e instanceof X&&e.code===`CANCELLED`||(console.error(`${t.name} host connection failed`,e),f(),i.signal.aborted||d({app:null,status:`not-hosted`,error:e instanceof X?e:new X(`The App host is unavailable`,{cause:e,code:`HOST_FAILURE`,retryable:!0})}))})):d({app:null,status:`not-hosted`,error:new X(`The App document has no window`,{code:`DISCONNECTED`,retryable:!1})}),()=>{i.signal.aborted||(i.abort(),r.unmount(),f())}}function TN({state:e,render:t}){return(0,G.useLayoutEffect)(()=>{performance.mark(`fungi.app-open.react-initial-commit`)},[]),(0,G.useLayoutEffect)(()=>{e.app&&performance.mark(`fungi.app-open.react-connected-commit`)},[e.app]),(0,G.createElement)(G.Fragment,null,e.status===`not-hosted`?(0,G.createElement)(`p`,{role:`alert`},`App host connection unavailable. Open this App through its host to try again.`):null,t(e))}function EN(e){let t=(0,G.useCallback)(t=>e?.subscribe(t)??(()=>void 0),[e]),n=(0,G.useCallback)(()=>e?.get(),[e]);return(0,G.useSyncExternalStore)(t,n,n)}function DN(e){return EN(e?.context)??null}function ON(e){return DN(e)?.computerId??null}function kN(e,t,n,r){let i=(0,G.useRef)(t);i.current=t;let a=(0,G.useRef)(n);a.current=n;let o=(0,G.useRef)(r);o.current=r;let s=JSON.stringify(t),c=n!==void 0;(0,G.useEffect)(()=>{e&&e.ui.reportStatus(i.current).catch(e=>{o.current?o.current(e):console.error(`Window status report failed`,e)})},[e,s]),(0,G.useEffect)(()=>{if(!(!e||!c))return e.ui.onStatusAction(e=>a.current?.(e)??!1)},[e,c]),(0,G.useEffect)(()=>()=>{e?.ui.reportStatus([]).catch(e=>{console.error(`Window status report failed`,e)})},[e])}function AN(e,{sourceId:t,namespace:n},r){let i=(0,G.useMemo)(()=>Cs(),[]),a=(0,G.useMemo)(r,[r]);return(0,G.useEffect)(()=>{let e=i.contribute({sourceId:t,namespace:n,commands:a});return()=>{e.dispose()}},[i,t,n,a]),(0,G.useEffect)(()=>e?vc(e.commands,a):void 0,[e,a]),i}function jN(e,{canGoBack:t,canGoForward:n,title:r,crumbs:i,primary:a,menu:o,status:s,onBack:c,onForward:l,onCrumb:u,onAction:d}){let f=(0,G.useRef)(c),p=(0,G.useRef)(l),m=(0,G.useRef)(u),h=(0,G.useRef)(d);(0,G.useEffect)(()=>{f.current=c,p.current=l,m.current=u,h.current=d},[c,l,u,d]),(0,G.useEffect)(()=>{if(!e)return;let t=e.onBack(()=>f.current()),n=e.onForward(()=>p.current()),r=e.onActivate(e=>{if(e.kind===`action`){let t=h.current;return t?.(e.actionId),t!==void 0}let t=m.current;return e.siblingId===void 0?t?.(e.crumbId):t?.(e.crumbId,e.siblingId),t!==void 0});return()=>{t(),n(),r(),MN(e,{canGoBack:!1,canGoForward:!1})}},[e]);let g=JSON.stringify([i,a,o,s]),_=(0,G.useRef)({crumbs:i,primary:a,menu:o,status:s});(0,G.useEffect)(()=>{_.current={crumbs:i,primary:a,menu:o,status:s}},[i,a,o,s]),(0,G.useEffect)(()=>{if(!e)return;let i={canGoBack:t,canGoForward:n};r!==void 0&&(i={...i,title:r});let a=_.current;a.crumbs!==void 0&&(i={...i,crumbs:a.crumbs}),a.primary!==void 0&&(i={...i,primary:a.primary}),a.menu!==void 0&&(i={...i,menu:a.menu}),a.status!==void 0&&(i={...i,status:a.status}),MN(e,i)},[e,t,n,r,g])}function MN(e,t){e.publish(t).catch(e=>{e instanceof X&&e.code===`DISCONNECTED`||console.warn(`App navigation report failed`,e)})}var NN=class{id;version;#e;constructor(e,t,n){this.id=e,this.version=t,this.#e=n,Object.freeze(this)}get schema(){return this.#e}};function PN(e,t,n){return new NN(e,t,n)}function FN(e){let t=eo(e),n=qo(Object),r=eo(Object.fromEntries(Object.keys(e).map(e=>[e,Ka().optional()])));return Ka().transform(e=>{let i=n.parse(e),a=Object.create(i),o=r.parse(a),s=Object.fromEntries(Object.entries(o).flatMap(([e,t])=>t===void 0?[]:[[e,Ho().parse(t).bind(i)]]));return{...t.parse(s),[Symbol.dispose](){xM(e)}}})}function IN(e){return Ka().transform(t=>{try{return e.parse(t)}catch(e){throw e instanceof X?e:new X(`The capability returned malformed data`,{cause:e,code:`PROTOCOL`,retryable:!1})}finally{xM(t)}})}function LN(e){return Ho({output:Bo(Ka().transform(t=>{try{return e.parse(t)}catch(e){throw xM(t),e instanceof X?e:new X(`The capability returned a malformed result`,{cause:e,code:`PROTOCOL`,retryable:!1})}}))})}var RN=LN(IN(Xa()));FN({fetch:LN(qo(Response)),close:RN});var zN=p(`ZodMiniType`,(e,t)=>{if(!e._zod)throw Error(`Uninitialized schema in ZodMiniType.`);At.init(e,t),e.def=t,e.type=t.type,e.parse=(t,n)=>ve(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>Se(e,t,n),e.parseAsync=async(t,n)=>be(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>we(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)=>L(e,t,n),e.brand=()=>e,e.register=((t,n)=>(t.add(e,n),e)),e.apply=t=>t(e)}),BN=p(`ZodMiniObject`,(e,t)=>{vn.init(e,t),zN.init(e,t),T(e,`shape`,()=>t.shape)});function VN(e,t){return new BN({type:`object`,shape:e??{},...R(t)})}var HN=p(`ZodMiniLiteral`,(e,t)=>{Mn.init(e,t),zN.init(e,t)});function UN(e,t){return new HN({type:`literal`,values:Array.isArray(e)?e:[e],...R(t)})}var WN=to({status:Ra()}),GN=3,KN=/network ?(?:changed|error)|failed to fetch|load failed|network connection was lost/iu;function qN(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 JN(e){return qN(e).some(e=>{if(e instanceof TypeError)return!0;if(e instanceof X)return e.code===`HOST_FAILURE`&&e.retryable;let t=WN.safeParse(e);return t.success?t.data.status>=500:e instanceof Error&&KN.test(e.message)})}function YN(e,t){return e<GN&&JN(t)}function XN(e){return 250*2**e}function ZN(e){return e instanceof X?e:new X(`App operation failed`,{cause:e,code:`HOST_FAILURE`,retryable:!1})}var QN=new WeakMap,$N={of(e,...t){return[e?.identity.surfaceId??null,e?.context.get().computerId??null,...t]}};function eP(e){let t={};return e&&QN.set(t,e),t}function tP(){let e=new jw({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&&QN.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 nP(e,t,n,r){let i=e?.context.get().computerId;return Ww({queryKey:n,meta:eP(e),enabled:e!==null,retry:YN,retryDelay:XN,queryFn:async({signal:n})=>{try{if(!e)throw new X(`No App connection`,{code:`DISCONNECTED`,retryable:!0});if(e.context.get().computerId!==i)throw new X(`The selected Computer changed`,{code:`SELECTION_CHANGED`,retryable:!1});return await r(e.capabilities.require(t),n)}catch(e){throw ZN(e)}}})}function rP(e){return Yw({mutationKey:e.queryKey,scope:{id:MC(e.queryKey)},mutationFn:async(t,n)=>{try{return await e.mutationFn(t,n)}catch(e){throw ZN(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})})}PN(`app.backend`,1,Ro(()=>FN({request:LN(IN(Ka().transform(e=>$o(e))))})));var iP=PN(`app.methods`,1,Ro(()=>FN({call:LN(IN(Ka().transform(e=>$o(e))))})));PN(`app.region`,1,Ro(()=>FN({connect:LN(FN({messages:LN(qo(ReadableStream).transform(e=>e.pipeThrough(new TransformStream({transform(e,t){t.enqueue(U().parse(e))}})))),send:RN,close:RN}))})));var aP=72e4,oP=mo({png:`png`,jpeg:`jpeg`,webp:`webp`}),sP=mo({draft:`draft`,balanced:`balanced`,premium:`premium`,max:`max`}),cP=Ro(()=>W({transport:mo({json:`json`,multipart:`multipart`}),dimensions:mo({none:`none`,own:`own`}),maxDimension:Ra().int().positive().nullable(),maxDimensionDocumented:Ha(),defaultWidth:Ra().int().positive(),defaultHeight:Ra().int().positive(),steps:mo({steps:`steps`,num_steps:`num_steps`,fixed:`fixed`}),maxSteps:Ra().int().positive().nullable(),defaultSteps:Ra().int().nonnegative().nullable(),guidance:W({min:Ra().nonnegative(),max:Ra().positive(),default:Ra().nonnegative()}).readonly().refine(e=>e.min<=e.default&&e.default<=e.max,`guidance default must lie within its bounds`).nullable().default(null),referenceField:U().min(1).max(256).nullable(),maxReferences:Ra().int().nonnegative(),referenceDimension:Ra().int().positive().nullable(),referenceFormat:mo({png:`png`,webp:`webp`})}).readonly()),lP=mo({seedance25:`bytedance/seedance-2.5`,seedance:`bytedance/seedance-2.0`,seedanceFast:`bytedance/seedance-2.0-fast`,seedanceMini:`bytedance/seedance-2.0-mini`,veo:`google/veo-3.1`,veoFast:`google/veo-3.1-fast`,minimaxH3Max:`minimax/h3-max`}),uP=mo({p480:`480p`,p720:`720p`,p768:`768p`,p1080:`1080p`,p4k:`4k`}),dP=mo({wide:`16:9`,landscape:`4:3`,square:`1:1`,portrait:`3:4`,tall:`9:16`,ultrawide:`21:9`,ultratall:`9:21`}),fP=mo({first:`first-frame`,last:`last-frame`,reference:`reference`}),pP=Ro(()=>W({resolution:uP,aspectRatio:dP,width:Ra().int().positive(),height:Ra().int().positive()}).readonly()),mP=Ro(()=>W({minSeconds:Ra().int().positive(),maxSeconds:Ra().int().positive(),defaultSeconds:Ra().int().positive(),durations:Qa(Ra().int().positive()).readonly(),provider:mo({seedance:`seedance`,veo:`veo`,minimax:`minimax`}),formats:Qa(pP).readonly(),defaultResolution:uP,defaultAspectRatio:dP,supportsAudio:Ha(),defaultGenerateAudio:Ha().nullable(),referenceRoles:Qa(fP).readonly(),maxReferenceImages:Ra().int().nonnegative(),referenceResolutions:Qa(uP).readonly(),audioReferences:W({max:Ra().int().positive(),totalSeconds:Ra().int().positive()}).readonly().nullable(),prices:Qa(W({resolution:uP,silentMilliunitsPerSecond:Ra().int().positive(),audioMilliunitsPerSecond:Ra().int().positive()}).readonly()).readonly()}).readonly()),hP=mo({multilingual:`elevenlabs/eleven-multilingual-v2`,v3:`elevenlabs/eleven-v3`,music:`elevenlabs/music-v2`}),gP=Ro(()=>W({id:U().min(1).max(64),label:U().min(1).max(128)}).readonly()),_P=Ro(()=>W({provider:go(`elevenlabs`),mode:mo({speech:`speech`,music:`music`}),voices:Qa(gP).readonly(),defaultVoiceId:U().min(1).max(64).nullable(),seconds:W({min:Ra().int().positive(),max:Ra().int().positive(),default:Ra().int().positive()}).readonly().nullable(),milliunitsPerUnit:Ra().int().positive()}).readonly()),vP=32e3,yP=2048,bP=mo({remove_background:`remove_background`,upscale:`upscale`}),xP=Ro(()=>W({operation:bP,source:W({formats:Qa(oP).readonly(),maxBytes:Ra().int().positive(),maxPixels:Ra().int().positive()}).readonly(),defaultMegapixels:Ra().int().positive().nullable(),milliunits:Ra().int().positive().nullable(),sizes:Qa(W({megapixels:Ra().int().positive(),milliunits:Ra().int().positive()}).readonly()).readonly()}).readonly()),SP=[[4,.005],[8,.01],[16,.02],[32,.04],[64,.06],[128,.12]],CP=[4,8,16],wP=1e5,TP=.018,EP=8388608,DP=25e6,OP=mo({image:`image`,video_second:`video_second`,audio_second:`audio_second`,audio_character_block:`audio_character_block`}),kP=e=>e.kind===`video`?`video_second`:e.kind===`audio`?e.audio?.mode===`speech`?`audio_character_block`:`audio_second`:`image`,AP=W({id:U().min(1).max(256),label:U().min(1).max(512),kind:mo({image:`image`,video:`video`,audio:`audio`}),tier:sP,outputFormats:Qa(oP).max(3).readonly(),maxPromptLength:Ra().int().positive().max(vP),input:cP,sizes:Qa(U().regex(/^\d+x\d+$/u)).readonly().nullable(),video:mP.nullable(),audio:_P.nullable(),billingUnit:OP,transform:xP.nullable()}).readonly(),jP=e=>{let t={kind:`image`,sizes:null,video:null,audio:null,transform:null,outputFormats:Object.freeze([]),...e};return Object.freeze({...t,billingUnit:kP(t),input:Object.freeze(e.input)})},MP=3840,NP=8294400,PP=[[1,1],[4,3],[3,4],[3,2],[2,3],[16,9],[9,16],[21,9]],FP=(()=>{let e=new Set([`1024x1024`,`1024x1536`,`1536x1024`]),t=[],n=[];for(let[r,i]of PP){let a=((e,t)=>{let n=e,r=t;for(;r!==0;)[n,r]=[r,n%r];return n})(r,i),o=16*r/a,s=16*i/a,c=o*s,l=e=>`${String(o*e)}x${String(s*e)}`,u=Math.round(Math.sqrt(1048576/c)),d=[...e].find(e=>{let[t,n]=e.split(`x`).map(Number);return(t??0)*i===(n??0)*r});t.push(d??l(u)),n.push(l(Math.floor(Math.min(MP/Math.max(o,s),Math.sqrt(NP/c)))))}return Object.freeze([...t,...n])})(),IP=(e=>Object.freeze(PP.map(([t,n])=>{let r=t,i=n;for(;i!==0;)[r,i]=[i,r%i];let a=16*t/r,o=16*n/r,s=Math.round(Math.sqrt(e/(a*o)));return`${String(a*s)}x${String(o*s)}`})))(1327104),LP={"480p":480,"720p":720,"768p":768,"1080p":1080,"4k":2160},RP={"16:9":[16,9],"4:3":[4,3],"1:1":[1,1],"3:4":[3,4],"9:16":[9,16],"21:9":[21,9],"9:21":[9,21]},zP={maxSeconds:30,maxReferenceImages:30,audioReferences:{max:10,totalSeconds:30},maxPromptLength:25e3,resolutions:[`480p`,`720p`],aspects:dP.options.filter(e=>e!==dP.enum.ultratall)};function BP(e,t,n,r,i,a){let o=r===`seedance`,s=a?.resolutions??i.map(([e])=>e),c=a?.maxSeconds??(o?12:8),l=a?.maxReferenceImages??(o?4:0),u=a?a.aspects:o?dP.options:[dP.enum.wide,dP.enum.tall,dP.enum.square],d=Object.freeze(s.flatMap(e=>u.map(t=>{let[n,r]=RP[t],i=LP[e],a=Math.min(n,r);return Object.freeze({resolution:e,aspectRatio:t,width:Math.ceil(i*n/a/2)*2,height:Math.ceil(i*r/a/2)*2})}))),f=Object.freeze(o?Array.from({length:c-3},(e,t)=>t+4):[4,6,8]),p=Object.freeze({minSeconds:4,maxSeconds:c,defaultSeconds:o?5:6,durations:f,provider:r,formats:d,defaultResolution:`720p`,defaultAspectRatio:`16:9`,supportsAudio:!0,defaultGenerateAudio:!0,referenceRoles:Object.freeze(o?fP.options:[fP.enum.first]),maxReferenceImages:l,audioReferences:a===void 0?null:Object.freeze({...a.audioReferences}),referenceResolutions:Object.freeze(o?s.filter(e=>e!==`1080p`):[]),prices:Object.freeze(i.map(([e,t,n])=>Object.freeze({resolution:e,silentMilliunitsPerSecond:t,audioMilliunitsPerSecond:n})))});return jP({id:e,label:t,tier:n,maxPromptLength:a?.maxPromptLength??(o?1e4:yP),kind:`video`,video:p,sizes:Object.freeze(d.map(({width:e,height:t})=>`${String(e)}x${String(t)}`)),input:{transport:`json`,dimensions:`own`,maxDimension:Math.max(...d.map(({width:e,height:t})=>Math.max(e,t))),maxDimensionDocumented:!1,defaultWidth:1280,defaultHeight:720,steps:`fixed`,maxSteps:null,defaultSteps:null,guidance:null,referenceField:o?`image`:`image_input`,maxReferences:o?l:1,referenceDimension:null,referenceFormat:`png`}})}function VP(){let e=[`480p`,`768p`],t=[dP.enum.wide,dP.enum.landscape,dP.enum.square,dP.enum.portrait,dP.enum.tall,dP.enum.ultrawide],n=Object.freeze(e.flatMap(e=>t.map(t=>{let[n,r]=RP[t],i=LP[e],a=Math.min(n,r);return Object.freeze({resolution:e,aspectRatio:t,width:Math.ceil(i*n/a/2)*2,height:Math.ceil(i*r/a/2)*2})}))),r=uP.enum.p768,i=dP.enum.wide,a=n.find(e=>e.resolution===r&&e.aspectRatio===i);if(a===void 0)throw Error(`minimax/h3-max is missing its default format`);let o=Object.freeze(Array.from({length:11},(e,t)=>t+5)),s=Object.freeze({minSeconds:5,maxSeconds:15,defaultSeconds:5,durations:o,provider:`minimax`,formats:n,defaultResolution:r,defaultAspectRatio:i,defaultGenerateAudio:null,supportsAudio:!1,referenceRoles:Object.freeze([fP.enum.first,fP.enum.reference]),maxReferenceImages:4,audioReferences:null,referenceResolutions:Object.freeze(e),prices:Object.freeze([{resolution:uP.enum.p480,silentMilliunitsPerSecond:5e3,audioMilliunitsPerSecond:5e3},{resolution:uP.enum.p768,silentMilliunitsPerSecond:8e3,audioMilliunitsPerSecond:8e3}])});return jP({id:lP.enum.minimaxH3Max,label:`MiniMax H3 Max`,tier:`balanced`,maxPromptLength:7e3,kind:`video`,video:s,sizes:Object.freeze(n.map(({width:e,height:t})=>`${String(e)}x${String(t)}`)),input:{transport:`json`,dimensions:`own`,maxDimension:Math.max(...n.map(({width:e,height:t})=>Math.max(e,t))),maxDimensionDocumented:!1,defaultWidth:a.width,defaultHeight:a.height,steps:`fixed`,maxSteps:null,defaultSteps:null,guidance:null,referenceField:`image_url`,maxReferences:4,referenceDimension:null,referenceFormat:`png`}})}var HP=Object.freeze([Object.freeze({id:`JBFqnCBsd6RMkjVDRZzb`,label:`Default voice`})]);function UP(e,t,n,r){return GP(e,t,n,1e4,{provider:`elevenlabs`,mode:`speech`,voices:HP,defaultVoiceId:HP[0]?.id??null,seconds:null,milliunitsPerUnit:r})}function WP(){return GP(hP.enum.music,`Eleven Music v2`,`premium`,yP,{provider:`elevenlabs`,mode:`music`,voices:Object.freeze([]),defaultVoiceId:null,seconds:Object.freeze({min:3,max:600,default:30}),milliunitsPerUnit:250})}function GP(e,t,n,r,i){return jP({id:e,label:t,tier:n,maxPromptLength:r,kind:`audio`,audio:Object.freeze(i),input:{transport:`json`,dimensions:`none`,maxDimension:null,maxDimensionDocumented:!1,defaultWidth:1,defaultHeight:1,steps:`fixed`,maxSteps:null,defaultSteps:null,guidance:null,referenceField:null,maxReferences:0,referenceDimension:null,referenceFormat:`png`}})}function KP(e){let t=SP.find(([t])=>e<=t);if(t===void 0)throw Error(`no published upscale price for ${String(e)} MP`);return t[1]}function qP(e){return jP({id:e.id,label:e.label,tier:e.tier,outputFormats:Object.freeze([e.outputFormat]),maxPromptLength:256,transform:Object.freeze({operation:e.operation,source:Object.freeze({formats:Object.freeze([`png`,`jpeg`]),maxBytes:EP,maxPixels:DP}),defaultMegapixels:e.defaultMegapixels,milliunits:e.flatUsd===null?null:Math.round(e.flatUsd*wP),sizes:Object.freeze(e.sizes.map(({megapixels:e,usd:t})=>Object.freeze({megapixels:e,milliunits:Math.round(t*wP)})))}),input:{transport:`json`,dimensions:`none`,maxDimension:null,maxDimensionDocumented:!1,defaultWidth:1024,defaultHeight:1024,steps:`fixed`,maxSteps:null,defaultSteps:null,guidance:null,referenceField:`image`,maxReferences:1,referenceDimension:8192,referenceFormat:`png`}})}Object.freeze([jP({id:`@cf/black-forest-labs/flux-1-schnell`,maxPromptLength:2048,outputFormats:Object.freeze([`jpeg`]),tier:`draft`,label:`Flux 1 Schnell — cheap/fast sketches`,input:{transport:`json`,dimensions:`none`,maxDimension:null,maxDimensionDocumented:!1,defaultWidth:1024,defaultHeight:768,steps:`steps`,maxSteps:8,defaultSteps:4,guidance:null,referenceField:null,maxReferences:0,referenceDimension:512,referenceFormat:`png`}}),jP({id:`@cf/black-forest-labs/flux-2-klein-4b`,maxPromptLength:yP,tier:`balanced`,label:`Flux 2 Klein 4b — balanced default`,input:{transport:`multipart`,dimensions:`own`,maxDimension:1920,maxDimensionDocumented:!1,defaultWidth:1024,defaultHeight:768,steps:`fixed`,maxSteps:null,defaultSteps:4,guidance:null,referenceField:`input_image_`,maxReferences:4,referenceDimension:512,referenceFormat:`png`}}),jP({id:`@cf/black-forest-labs/flux-2-klein-9b`,maxPromptLength:yP,tier:`premium`,label:`Flux 2 Klein 9b — higher quality flux-2`,input:{transport:`multipart`,dimensions:`own`,maxDimension:1920,maxDimensionDocumented:!1,defaultWidth:1024,defaultHeight:768,steps:`fixed`,maxSteps:null,defaultSteps:4,guidance:null,referenceField:`input_image_`,maxReferences:4,referenceDimension:512,referenceFormat:`png`}}),jP({id:`@cf/black-forest-labs/flux-2-dev`,maxPromptLength:yP,tier:`max`,label:`Flux 2 Dev — best detailed quality, expensive`,input:{transport:`multipart`,dimensions:`own`,maxDimension:1920,maxDimensionDocumented:!1,defaultWidth:1024,defaultHeight:768,steps:`steps`,maxSteps:null,defaultSteps:20,guidance:null,referenceField:`input_image_`,maxReferences:4,referenceDimension:512,referenceFormat:`png`}}),jP({id:`@cf/leonardo/lucid-origin`,maxPromptLength:yP,tier:`premium`,label:`Leonardo Lucid Origin — premium prompt adherence`,input:{transport:`json`,dimensions:`own`,maxDimension:2500,maxDimensionDocumented:!0,defaultWidth:1120,defaultHeight:1120,steps:`num_steps`,maxSteps:40,defaultSteps:null,guidance:{min:0,max:10,default:5},referenceField:null,maxReferences:0,referenceDimension:512,referenceFormat:`png`}}),jP({id:`@cf/leonardo/phoenix-1.0`,maxPromptLength:yP,tier:`balanced`,label:`Leonardo Phoenix 1.0 — best prompt adherence`,input:{transport:`json`,dimensions:`own`,maxDimension:2048,maxDimensionDocumented:!0,defaultWidth:1024,defaultHeight:1024,steps:`num_steps`,maxSteps:50,defaultSteps:25,guidance:{min:2,max:10,default:3},referenceField:null,maxReferences:0,referenceDimension:512,referenceFormat:`png`}}),jP({id:`openai/gpt-image-2`,maxPromptLength:32e3,outputFormats:Object.freeze([`png`,`jpeg`,`webp`]),tier:`premium`,label:`GPT Image 2 — strong text and layout, premium`,sizes:FP,input:{transport:`json`,dimensions:`own`,maxDimension:MP,maxDimensionDocumented:!0,defaultWidth:1024,defaultHeight:1024,steps:`fixed`,maxSteps:null,defaultSteps:null,guidance:null,referenceField:`images`,maxReferences:16,referenceDimension:1024,referenceFormat:`webp`}}),jP({id:`bytedance/seedream-5-pro`,maxPromptLength:yP,outputFormats:Object.freeze([`jpeg`]),tier:`premium`,label:`Seedream 5 Pro — ByteDance, high-quality images`,sizes:IP,input:{transport:`json`,dimensions:`own`,maxDimension:1792,maxDimensionDocumented:!1,defaultWidth:1536,defaultHeight:864,steps:`fixed`,maxSteps:null,defaultSteps:null,guidance:null,referenceField:null,maxReferences:0,referenceDimension:512,referenceFormat:`png`}}),qP({id:`bria/remove-background`,label:`Remove background — Bria RMBG 2.0`,tier:`draft`,operation:`remove_background`,outputFormat:`png`,flatUsd:TP,sizes:[],defaultMegapixels:null}),qP({id:`pruna/p-image-upscale`,label:`Upscale — Pruna P-Image-Upscale`,tier:`draft`,operation:`upscale`,outputFormat:`webp`,flatUsd:null,sizes:CP.map(e=>({megapixels:e,usd:KP(e)})),defaultMegapixels:4}),BP(lP.enum.seedance25,`Seedance 2.5`,`balanced`,`seedance`,[[`480p`,10280,10280],[`720p`,23120,23120]],zP),BP(lP.enum.seedance,`Seedance 2.0`,`balanced`,`seedance`,[[`480p`,7e3,7e3],[`720p`,15e3,15e3],[`1080p`,37e3,37e3],[`4k`,78e3,78e3]]),BP(lP.enum.seedanceFast,`Seedance 2.0 Fast`,`draft`,`seedance`,[[`480p`,6e3,6e3],[`720p`,12e3,12e3]]),BP(lP.enum.seedanceMini,`Seedance 2.0 Mini`,`draft`,`seedance`,[[`480p`,4e3,4e3],[`720p`,9e3,9e3]]),BP(lP.enum.veo,`Veo 3.1`,`premium`,`veo`,[[`720p`,2e4,4e4],[`1080p`,2e4,4e4]]),BP(lP.enum.veoFast,`Veo 3.1 Fast`,`balanced`,`veo`,[[`720p`,8e3,1e4],[`1080p`,1e4,12e3]]),VP(),UP(hP.enum.multilingual,`Eleven Multilingual v2 — natural speech`,`balanced`,10),UP(hP.enum.v3,`Eleven v3 — expressive speech`,`premium`,10),WP()]),Qa(AP.unwrap().extend({billingUnit:OP.optional(),audio:_P.unwrap().nullable().default(null),transform:xP.unwrap().nullable().default(null),video:mP.unwrap().unwrap().extend({audioReferences:mP.unwrap().unwrap().shape.audioReferences.default(null),provider:mo({seedance:`seedance`,veo:`veo`,minimax:`minimax`,host:`host`})}).readonly().nullable()}).readonly()).min(1).max(256).superRefine((e,t)=>{let n=new Set;e.forEach((e,r)=>{let i=e=>{t.addIssue({code:`custom`,message:e,path:[r]})};n.has(e.id)&&i(`duplicate model id "${e.id}"`),n.add(e.id),e.kind===`video`!=(e.video!==null)&&i(`${e.id} must carry video bounds exactly when kind is video`),e.kind===`audio`!=(e.audio!==null)&&i(`${e.id} must carry audio bounds exactly when kind is audio`),e.billingUnit!==void 0&&e.billingUnit!==kP(e)&&i(`${e.id} billingUnit must be ${kP(e)} for ${e.kind===`image`?`an`:`a`} ${e.kind} model`);let a=e.video;a!==null&&((a.minSeconds>a.maxSeconds||a.durations.some(e=>e<a.minSeconds||e>a.maxSeconds)||!a.durations.includes(a.defaultSeconds))&&i(`${e.id} durations must sit inside min/max and include the default`),a.formats.some(({resolution:e,aspectRatio:t})=>e===a.defaultResolution&&t===a.defaultAspectRatio)||i(`${e.id} formats must include the default resolution and aspect`))})}).transform(e=>Object.freeze(e.map(e=>Object.freeze({...e,input:Object.freeze(e.input)}))));var JP=e=>U().min(1).max(e),YP=Ra().int().min(-(2**53-1)).max(2**53-1),XP=YP.positive(),ZP=YP.nonnegative(),QP=W({printId:JP(256),computerId:JP(256),kind:mo([`image`,`video`,`audio`]),prompt:JP(vP),model:JP(256),width:XP.nullable(),height:XP.nullable(),steps:ZP.nullable(),durationSeconds:ZP.nullable(),format:JP(32),bytes:XP,costMilliunits:ZP,actorKind:mo([`member`,`agent`]),actorId:JP(256),derivedFrom:JP(256).nullable(),createdAt:ZP,source:mo([`recorded`,`file`]),schemaVersion:XP}),$P=eo({printId:QP.shape.printId,path:U().startsWith(`/`).min(2).max(4096)});function eF(e,t){let n=e?.app??null,r=DN(n),i=r?.openRequest,a=r?.computerId,o=i?.kind===`navigate`?i.params.find(e=>e.key===`print`):void 0,s=QP.shape.printId.safeParse(o?.value),c=s.success?s.data:null,l=i?.kind===`navigate`?i.requestId:null,u=(0,G.useRef)({app:n,requestId:l,computerId:a});(u.current.app!==n||u.current.requestId!==l)&&(u.current={app:n,requestId:l,computerId:a});let d=u.current.computerId===a,f=Uw({...nP(n,iP,$N.of(n,`prints`,`navigate`,a,l,c),async(e,t)=>{if(!n||!a||!c||!l)throw Error(`No print selected`);let r=await e.call(`openOutput`,JSON.stringify({printId:c,byteLength:1}));if(t.throwIfAborted(),n.context.get().computerId!==a)throw Error(`Computer selection changed`);let i=$P.parse(r);if(i.printId!==c)throw Error(`Print selection changed`);return{path:i.path,requestId:l,computerId:a}}),enabled:!!(n&&d&&a&&l&&c&&n.capabilities.has(iP)),retry:!1,staleTime:1/0}),p=(0,G.useRef)(t);p.current=t;let m=(0,G.useRef)(void 0);return(0,G.useEffect)(()=>{let t=f.data;!e||!t||m.current===t||e.app.context.get().computerId!==t.computerId||(m.current=t,p.current(t.path,e,t.computerId))},[e,f.data]),{target:f.data??null,error:f.error}}var tF=sS([J({kind:Xx(`compose`),text:eS.pipe(Y(MS(1)),Y(FS(2e3)))}),J({kind:Xx(`navigate`),params:aS(J({key:eS.pipe(Y(MS(1)),Y(FS(64))),value:eS.pipe(Y(FS(1024)))})).pipe(Y(FS(16)))})]);sS([J({role:eS.pipe(Y(MS(1)),Y(FS(80))),intent:tF}),J({appId:eS.pipe(Y(MS(1)),Y(FS(128))),intent:tF})],{mode:`oneOf`});var nF=W({displayName:U().min(1).max(80).nullable()}).nullable(),rF=PN(`apps.open`,1,Ro(()=>FN({open:RN,role:LN(IN(nF))})));PN(`apps.call`,1,Ro(()=>FN({call:LN(IN(Ka().transform(e=>$o(e))))})));var iF=U().regex(/^[a-zA-Z0-9._-]{1,128}$/).refine(e=>e!==`.`&&e!==`..`),aF=U().regex(/^[0-9a-f]{40}$/);W({ref:U().startsWith(`refs/`).max(1024),before:aF,after:aF}),Ro(()=>U().min(1).max(512));var oF=`files`,sF=W({name:U(),email:U()}),cF=W({hash:aF,treeHash:aF,message:U(),author:sF,committer:sF,parents:Qa(aF),authoredAt:Ra(),committedAt:Ra()}),lF=W({name:U(),mode:U(),hash:aF,type:mo([`blob`,`tree`,`commit`])});W({ref:U(),commit:cF,path:U(),entries:Qa(lF)});var uF=65536,dF=U().min(1).max(1024).refine(e=>!e.startsWith(`/`)&&!e.includes(`\\`)&&!e.includes(`\0`)&&e.split(`/`).every(e=>e!==``&&e!==`.`&&e!==`..`&&e!==`.git`),`Choose a relative repository file path.`),fF=U().min(1).max(256),pF={repo:iF,branch:fF,path:dF},mF=mo([`pending`,`synced`,`conflict`,`failed`]),hF=W({text:U(),revision:Ra().int().positive(),state:mF,theirs:W({blob:aF.nullable(),commit:aF}).optional(),failure:mo([`branch_missing`,`access_changed`,`sync_failed`,`permanent_material`]).optional()});W({...pF,baseBlob:aF.nullable(),baseCommit:aF,text:U().max(uF),revision:Ra().int().positive().nullable()});var gF=ro([W({kind:go(`saved`),revision:Ra().int().positive(),state:go(`pending`)}),W({kind:go(`synced`),revision:Ra().int().positive(),commit:aF}),W({kind:go(`conflict`),revision:Ra().int().nonnegative(),theirs:hF.shape.theirs.optional()}),W({kind:go(`failed`),revision:Ra().int().positive(),reason:mo([`branch_missing`,`access_changed`,`sync_failed`,`permanent_material`])}),W({kind:go(`refused`),reason:mo([`not-source-writer`,`background-unavailable`])})]);W({...pF,revision:Ra().int().positive()}),ro([W({kind:mo([`discarded`,`not_found`])}),W({kind:go(`conflict`),revision:Ra().int().positive()})]),W({settled:Qa(W({...pF,result:gF})),more:Ha()}),W({version:Ra().int().positive().nullable(),commit:aF,blob:aF.nullable(),pending:hF.optional(),ref:U(),path:U(),size:Ra(),binary:Ha(),text:U().nullable()}),W({ref:U(),commits:Qa(W({commit:cF,agent:U().nullable()})),next:U().optional()}),W({ref:U(),commit:cF,paths:Qa(U()),truncated:Ha()}),W({kind:go(`rebuilding`)}),W({done:Ha(),cursor:U().nullable()}),ro([W({repository:iF,branch:fF,path:dF}),W({path:U().min(1).max(1024)})]);var _F=Gx(zS(J({error:Xx(`too_large`)})));async function vF(e,t){let n,r=()=>n??=e.close(),i=()=>{r().catch(e=>{nT(`files.read.abort-close`,e)})};t.signal?.addEventListener(`abort`,i,{once:!0});try{t.signal?.throwIfAborted();let n=await e.response();try{let e=qx(pS(Response))(n);if(e.status===413)throw new X(`App file exceeds the read bound`,{code:_F(await e.text())._tag===`Some`?`FILE_TOO_LARGE`:`PROTOCOL`,retryable:!1});if(!e.ok)throw Error(`App file unavailable (${String(e.status)})`);let r=await e.blob();return t.signal?.throwIfAborted(),new File([r],t.name,{type:r.type,lastModified:0})}finally{xM(n)}}finally{t.signal?.removeEventListener(`abort`,i);try{await r()}finally{e[Symbol.dispose]()}}}async function yF(e,t,n){let r,i=()=>r??=e.close(),a=()=>{i().catch(e=>{nT(`files.write.abort-close`,e)})};n.signal?.addEventListener(`abort`,a,{once:!0});try{n.signal?.throwIfAborted(),await e.write(t.stream())}finally{n.signal?.removeEventListener(`abort`,a);try{await i()}catch(e){nT(`files.write.remote-close`,e)}try{e[Symbol.dispose]()}catch(e){nT(`files.write.local-dispose`,e)}}}var bF=mo([`exec`,`write`,`media`]),xF=Ro(()=>W({error:go(`attachment_budget_exceeded`),kind:bF,retryAfterMs:Ra()})),SF=Ro(()=>W({error:go(`unavailable`),ref:U().min(1).max(128)}));Ro(()=>ro([W({error:mo([`revoked`,`not_granted`,`grantor_lost_authority`,`unavailable`])}),SF,xF])),Ro(()=>W({error:mo([`too_large`,`invalid_path`,`invalid`])})),Ro(()=>ro([W({error:mo([`not_granted`,`too_large`,`conflict`,`capacity`,`unfunded`,`admission_unavailable`,`backend_unavailable`,`unavailable`])}),SF])),Ro(()=>ro([W({error:mo([`capacity`,`unfunded`,`admission_unavailable`,`backend_unavailable`])}),SF])),Ro(()=>W({error:go(`timeout`),requestId:U()}));var CF=mo([`revoked`,`not_granted`,`grantor_lost_authority`,`attachment_budget_exceeded`,`too_large`,`invalid_path`,`invalid`,`not_found`,`conflict`,`timeout`,`capacity`,`unfunded`,`admission_unavailable`,`backend_unavailable`,`unavailable`]);Ro(()=>ro([W({error:CF.exclude([`attachment_budget_exceeded`,`timeout`])}),SF]));var wF=J({path:eS,entries:aS(J({name:eS,type:cS([`file`,`directory`,`symlink`]),size:tS,modifiedAt:tS})),nextOffset:lS(tS)}),TF=PN(`computer.list`,1,Ro(()=>FN({list:LN(IN(Ka().transform(e=>qx(wF)(e))))}))),EF=sS([J({state:cS([`running`,`sleeping`,`starting`])}),J({state:Xx(`start_failed`),reason:Yx(eS.pipe(Y(MS(1)),Y(FS(1024))))}),J({state:Xx(`queued`),position:tS.pipe(Y(AS()),Y(ES(0)))})]),DF=J({enabled:nS,effective:nS,blockedBy:lS(cS([`team`,`global`]))}),OF=J({computerId:LS,name:LS,runtime:EF,backends:aS(J({id:LS,kind:cS([`platform-container`,`on-box-vm`,`local`]),status:cS([`ready`,`queued`,`online`,`offline`]),queuePosition:lS(tS.pipe(Y(AS()),Y(ES(0)))),hostId:lS(eS),hostLabel:lS(eS),folderLabel:lS(eS),detachable:nS})),internet:DF});PN(`computer.instrument.read`,1,Ro(()=>FN({read:LN(IN(Ka().transform(e=>qx(OF)(e))))}))),PN(`computer.instrument.control`,1,Ro(()=>FN({start:LN(IN(Ka().transform(e=>qx(EF)(e)))),setInternetAccess:LN(IN(Ka().transform(e=>qx(DF)(e)))),detachLocal:LN(IN(Ka().transform(e=>qx(J({detached:nS}))(e))))})));var kF=sS([J({ports:aS(J({port:tS.pipe(Y(AS()),Y(kS({minimum:1,maximum:65535}))),previewUrl:LS,openMode:cS([`inline`,`external-only`])})).pipe(Y(FS(64)))}),J({error:Xx(`port_previews_not_configured`)})]),AF=J({port:tS.annotate({message:`Use a port from 1 to 65535.`}).check(AS({message:`Use a port from 1 to 65535.`}),kS({minimum:1,maximum:65535},{message:`Use a port from 1 to 65535.`})),exposed:nS}),jF=J({port:tS.pipe(Y(AS()),Y(kS({minimum:1,maximum:65535}))),removed:nS});PN(`computer.ports`,2,Ro(()=>FN({list:LN(IN(Ka().transform(e=>qx(kF)(e)))),expose:LN(IN(Ka().transform(e=>qx(AF)(e)))),unexpose:LN(IN(Ka().transform(e=>qx(jF)(e))))})));var MF=cS([`synced`,`pending`,`unknown`]),NF=J({port:lS(AF.fields.port),id:LS,command:LS,cwd:lS(eS),startedAt:tS.pipe(Y(AS()),Y(DS(0))),state:cS([`running`,`exited`,`uncertain`]),exitCode:lS(tS.pipe(Y(AS()))),sync:MF,endedAt:lS(tS.pipe(Y(AS()),Y(DS(0)))),endedReason:lS(Xx(`idle-sleep`))}),PF=J({processes:aS(NF)}),FF=J({process:NF,signalled:nS}),IF=J({process:NF,lines:aS(eS.pipe(Y(FS(2e3)))).pipe(Y(FS(200))),truncated:nS});J({requestId:LS.pipe(Y(FS(256))),command:LS.pipe(Y(FS(16384))),cwd:Yx(eS),port:Yx(AF.fields.port)}),PN(`computer.processes`,1,Ro(()=>FN({start:LN(IN(Ka().transform(e=>qx(NF)(e)))),list:LN(IN(Ka().transform(e=>qx(PF)(e)))),kill:LN(IN(Ka().transform(e=>qx(FF)(e)))),logs:LN(IN(Ka().transform(e=>qx(IF)(e))))}))),J({error:cS(CF.options),ref:q(eS)});var LF=PN(`computer.readFile`,1,Ro(()=>FN({open:LN(FN({response:LN(qo(Response)),close:RN}))})));async function RF(e,t,n){return await vF(await e.require(LF).open(t),{...n,name:t.path.split(`/`).at(-1)??`file`})}async function zF(e,t){return qx(wF)(await e.require(TF).list(t))}var BF=PN(`computer.writeFile`,3,Ro(()=>FN({open:LN(FN({write:RN,close:RN})),mkdir:RN,replace:LN(IN(Ka().transform(e=>qx(VF)(e))))}))),VF=sS([J({kind:Xx(`replaced`),path:LS,bytes:tS.pipe(Y(AS()),Y(DS(0)))}),J({kind:Xx(`conflict`)})]),HF=J({computerName:LS.pipe(Y(FS(256))),teamName:LS.pipe(Y(FS(256))),modelDoor:LS.pipe(Y(FS(256))),uptimeSeconds:tS.pipe(Y(AS()),Y(DS(0))),version:LS.pipe(Y(FS(64)))});PN(`computer.terminal`,2,Ro(()=>FN({open:LN(FN({information:LN(IN(Ka().transform(e=>qx(HF)(e)))),output:LN(qo(ReadableStream).transform(e=>e.pipeThrough(new TransformStream({transform(e,t){t.enqueue(qo(Uint8Array).parse(e))}})))),input:LN(qo(WritableStream)),resize:RN,close:RN}))})));async function UF(e,t,n){await yF(await e.require(BF).open({path:t.path}),t.content,n)}var WF=l(eT(),1);function GF(e){if(!e||typeof document>`u`)return;let t=document.head||document.getElementsByTagName(`head`)[0],n=document.createElement(`style`);n.type=`text/css`,t.appendChild(n),n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}var KF=e=>{switch(e){case`success`:return YF;case`info`:return ZF;case`warning`:return XF;case`error`:return QF;default:return null}},qF=Array(12).fill(0),JF=({visible:e,className:t})=>G.createElement(`div`,{className:[`sonner-loading-wrapper`,t].filter(Boolean).join(` `),"data-visible":e},G.createElement(`div`,{className:`sonner-spinner`},qF.map((e,t)=>G.createElement(`div`,{className:`sonner-loading-bar`,key:`spinner-bar-${t}`})))),YF=G.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 20 20`,fill:`currentColor`,height:`20`,width:`20`,"aria-hidden":`true`},G.createElement(`path`,{fillRule:`evenodd`,d:`M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z`,clipRule:`evenodd`})),XF=G.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,fill:`currentColor`,height:`20`,width:`20`,"aria-hidden":`true`},G.createElement(`path`,{fillRule:`evenodd`,d:`M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z`,clipRule:`evenodd`})),ZF=G.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 20 20`,fill:`currentColor`,height:`20`,width:`20`,"aria-hidden":`true`},G.createElement(`path`,{fillRule:`evenodd`,d:`M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z`,clipRule:`evenodd`})),QF=G.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 20 20`,fill:`currentColor`,height:`20`,width:`20`,"aria-hidden":`true`},G.createElement(`path`,{fillRule:`evenodd`,d:`M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z`,clipRule:`evenodd`})),$F=G.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`12`,height:`12`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`},G.createElement(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),G.createElement(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})),eI=()=>{let[e,t]=G.useState(document.hidden);return G.useEffect(()=>{let e=()=>{t(document.hidden)};return document.addEventListener(`visibilitychange`,e),()=>document.removeEventListener(`visibilitychange`,e)},[]),e},tI=1,nI=100,rI=e=>typeof e?.id==`number`||e?.id?.length>0?e.id:tI++,iI=new class{constructor(){this.subscribe=e=>(this.subscribers.push(e),this.getActiveToasts().forEach(t=>e(t)),()=>{let t=this.subscribers.indexOf(e);this.subscribers.splice(t,1)}),this.publish=e=>{this.subscribers.forEach(t=>t(e))},this.addToast=e=>{this.publish(e),this.toasts=[...this.toasts,e],this.trimHistory()},this.trimHistory=()=>{let e=this.toasts.length-nI;e<=0||(this.toasts=this.toasts.filter(t=>e>0&&this.dismissedToasts.has(t.id)?(this.dismissedToasts.delete(t.id),e--,!1):!0))},this.create=e=>{let{message:t,...n}=e,r=rI(e),i=this.pendingDismissals.get(r);i!==void 0&&(cancelAnimationFrame(i),this.pendingDismissals.delete(r),this.dismissedToasts.delete(r));let a=this.dismissedToasts.has(r),o=e.dismissible===void 0||e.dismissible;return a&&(this.dismissedToasts.delete(r),this.toasts=this.toasts.filter(e=>e.id!==r)),!a&&this.toasts.find(e=>e.id===r)?this.toasts=this.toasts.map(n=>n.id===r?(this.publish({...n,...e,id:r,title:t}),{...n,...e,id:r,dismissible:o,title:t}):n):this.addToast({title:t,...n,dismissible:o,id:r}),r},this.dismiss=e=>{if(e==null)return this.getActiveToasts().forEach(e=>{this.dismissedToasts.add(e.id),this.subscribers.forEach(t=>t({id:e.id,dismiss:!0}))}),e;this.dismissedToasts.add(e);let t=this.pendingDismissals.get(e);return t!==void 0&&cancelAnimationFrame(t),this.pendingDismissals.set(e,requestAnimationFrame(()=>{this.pendingDismissals.delete(e),this.subscribers.forEach(t=>t({id:e,dismiss:!0}))})),e},this.message=(e,t)=>this.create({...t,message:e,type:void 0}),this.error=(e,t)=>this.create({...t,message:e,type:`error`}),this.success=(e,t)=>this.create({...t,type:`success`,message:e}),this.info=(e,t)=>this.create({...t,type:`info`,message:e}),this.warning=(e,t)=>this.create({...t,type:`warning`,message:e}),this.loading=(e,t)=>this.create({...t,type:`loading`,message:e}),this.promise=(e,t)=>{if(!t)return;let n;t.loading!==void 0&&(n=this.create({...t,promise:e,type:`loading`,message:t.loading,description:typeof t.description==`function`?void 0:t.description}));let r=Promise.resolve(e instanceof Function?e():e),i=n!==void 0,a,o=r.then(async e=>{if(a=[`resolve`,e],G.isValidElement(e))i=!1,this.create({id:n,type:`default`,message:e});else if(oI(e)&&!e.ok){i=!1;let r=typeof t.error==`function`?await t.error(`HTTP error! status: ${e.status}`):t.error,a=typeof t.description==`function`?await t.description(`HTTP error! status: ${e.status}`):t.description,o=typeof r==`object`&&!G.isValidElement(r)?r:{message:r};this.create({id:n,type:`error`,description:a,...o})}else if(e instanceof Error){i=!1;let r=typeof t.error==`function`?await t.error(e):t.error,a=typeof t.description==`function`?await t.description(e):t.description,o=typeof r==`object`&&!G.isValidElement(r)?r:{message:r};this.create({id:n,type:`error`,description:a,...o})}else if(t.success!==void 0){i=!1;let r=typeof t.success==`function`?await t.success(e):t.success,a=typeof t.description==`function`?await t.description(e):t.description,o=typeof r==`object`&&!G.isValidElement(r)?r:{message:r};this.create({id:n,type:`success`,description:a,...o})}}).catch(async e=>{if(a=[`reject`,e],t.error!==void 0){i=!1;let r=typeof t.error==`function`?await t.error(e):t.error,a=typeof t.description==`function`?await t.description(e):t.description,o=typeof r==`object`&&!G.isValidElement(r)?r:{message:r};this.create({id:n,type:`error`,description:a,...o})}}).finally(()=>{i&&(this.dismiss(n),n=void 0),t.finally==null||t.finally.call(t)}),s=()=>new Promise((e,t)=>o.then(()=>a[0]===`reject`?t(a[1]):e(a[1])).catch(t));return typeof n!=`string`&&typeof n!=`number`?{unwrap:s}:Object.assign(n,{unwrap:s})},this.custom=(e,t)=>{let n=rI(t);return this.create({...t,jsx:e(n),id:n,type:void 0}),n},this.getActiveToasts=()=>this.toasts.filter(e=>!this.dismissedToasts.has(e.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set,this.pendingDismissals=new Map}},aI=(e,t)=>iI.message(e,t),oI=e=>e&&typeof e==`object`&&`ok`in e&&typeof e.ok==`boolean`&&`status`in e&&typeof e.status==`number`,sI=Object.assign(aI,{success:iI.success,info:iI.info,warning:iI.warning,error:iI.error,custom:iI.custom,message:iI.message,promise:iI.promise,dismiss:iI.dismiss,loading:iI.loading},{getHistory:()=>iI.toasts,getToasts:()=>iI.getActiveToasts()});GF(`[data-sonner-toaster][dir=ltr],html[dir=ltr]{--toast-icon-margin-start:-3px;--toast-icon-margin-end:4px;--toast-svg-margin-start:-1px;--toast-svg-margin-end:0px;--toast-button-margin-start:auto;--toast-button-margin-end:0;--toast-close-button-start:0;--toast-close-button-end:unset;--toast-close-button-transform:translate(-35%, -35%)}[data-sonner-toaster][dir=rtl],html[dir=rtl]{--toast-icon-margin-start:4px;--toast-icon-margin-end:-3px;--toast-svg-margin-start:0px;--toast-svg-margin-end:-1px;--toast-button-margin-start:0;--toast-button-margin-end:auto;--toast-close-button-start:unset;--toast-close-button-end:0;--toast-close-button-transform:translate(35%, -35%)}[data-sonner-toaster]{position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1:hsl(0, 0%, 99%);--gray2:hsl(0, 0%, 97.3%);--gray3:hsl(0, 0%, 95.1%);--gray4:hsl(0, 0%, 93%);--gray5:hsl(0, 0%, 90.9%);--gray6:hsl(0, 0%, 88.7%);--gray7:hsl(0, 0%, 85.8%);--gray8:hsl(0, 0%, 78%);--gray9:hsl(0, 0%, 56.1%);--gray10:hsl(0, 0%, 52.3%);--gray11:hsl(0, 0%, 43.5%);--gray12:hsl(0, 0%, 9%);--border-radius:8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:0;z-index:999999999;transition:transform .4s ease}@media (hover:none) and (pointer:coarse){[data-sonner-toaster][data-lifted=true]{transform:none}}[data-sonner-toaster][data-x-position=right]{right:var(--offset-right)}[data-sonner-toaster][data-x-position=left]{left:var(--offset-left)}[data-sonner-toaster][data-x-position=center]{left:50%;transform:translateX(-50%)}[data-sonner-toaster][data-y-position=top]{top:var(--offset-top)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--offset-bottom)}[data-sonner-toast]{--y:translateY(100%);--lift-amount:calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:0;overflow-wrap:anywhere}[data-sonner-toast][data-styled=true]{padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px rgba(0,0,0,.1);width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}[data-sonner-toast]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-y-position=top]{top:0;--y:translateY(-100%);--lift:1;--lift-amount:calc(1 * var(--gap))}[data-sonner-toast][data-y-position=bottom]{bottom:0;--y:translateY(100%);--lift:-1;--lift-amount:calc(var(--lift) * var(--gap))}[data-sonner-toast][data-styled=true] [data-description]{font-weight:400;line-height:1.4;color:#3f3f3f}[data-rich-colors=true][data-sonner-toast][data-styled=true] [data-description]{color:inherit}[data-sonner-toaster][data-sonner-theme=dark] [data-description]{color:#e8e8e8}[data-sonner-toast][data-styled=true] [data-title]{font-weight:500;line-height:1.5;color:inherit}[data-sonner-toast][data-styled=true] [data-icon]{display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}[data-sonner-toast][data-promise=true] [data-icon]>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}[data-sonner-toast][data-styled=true] [data-icon]>*{flex-shrink:0}[data-sonner-toast][data-styled=true] [data-icon] svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}[data-sonner-toast][data-styled=true] [data-content]{display:flex;flex-direction:column;gap:2px;flex:1;min-width:0}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;font-weight:500;cursor:pointer;outline:0;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}[data-sonner-toast][data-styled=true] [data-button]:focus-visible{box-shadow:0 0 0 2px rgba(0,0,0,.4)}[data-sonner-toast][data-styled=true] [data-button]:first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}[data-sonner-toast][data-styled=true] [data-cancel]{color:var(--normal-text);background:rgba(0,0,0,.08)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-styled=true] [data-cancel]{background:rgba(255,255,255,.3)}[data-sonner-toast][data-styled=true] [data-close-button]{position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--normal-text);background:var(--normal-bg);border:1px solid var(--normal-border);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast][data-styled=true] [data-close-button]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-styled=true] [data-disabled=true]{cursor:not-allowed}[data-sonner-toast][data-styled=true]:hover [data-close-button]:hover{background:var(--gray2);border-color:var(--gray5)}[data-sonner-toast][data-swiping=true]::before{content:'';position:absolute;left:-100%;right:-100%;height:100%;z-index:-1}[data-sonner-toast][data-y-position=top][data-swiping=true]::before{bottom:50%;transform:scaleY(3) translateY(50%)}[data-sonner-toast][data-y-position=bottom][data-swiping=true]::before{top:50%;transform:scaleY(3) translateY(-50%)}[data-sonner-toast][data-swiping=false][data-removed=true]::before{content:'';position:absolute;inset:0;transform:scaleY(2)}[data-sonner-toast][data-expanded=true]::after{content:'';position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}[data-sonner-toast][data-mounted=true]{--y:translateY(0);opacity:1}[data-sonner-toast][data-expanded=false][data-front=false]{--scale:var(--toasts-before) * 0.05 + 1;--y:translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}[data-sonner-toast]>*{transition:opacity .4s}[data-sonner-toast][data-x-position=right]{right:0}[data-sonner-toast][data-x-position=left]{left:0}[data-sonner-toast][data-expanded=false][data-front=false][data-styled=true]>*{opacity:0}[data-sonner-toast][data-visible=false]{opacity:0;pointer-events:none}[data-sonner-toast][data-mounted=true][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}[data-sonner-toast][data-removed=true][data-front=true][data-swipe-out=false]{--y:translateY(calc(var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=false]{--y:translateY(40%);opacity:0;transition:transform .5s,opacity .2s}[data-sonner-toast][data-removed=true][data-front=false]::before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y,0)) translateX(var(--swipe-amount-x,0));transition:none}[data-sonner-toast][data-swiped=true]{-webkit-user-select:none;user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width:600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-sonner-theme=light]{--normal-bg:#fff;--normal-border:var(--gray4);--normal-text:var(--gray12);--success-bg:hsl(143, 85%, 96%);--success-border:hsl(145, 92%, 87%);--success-text:hsl(140, 100%, 27%);--info-bg:hsl(208, 100%, 97%);--info-border:hsl(221, 91%, 93%);--info-text:hsl(210, 92%, 45%);--warning-bg:hsl(49, 100%, 97%);--warning-border:hsl(49, 91%, 84%);--warning-text:hsl(31, 92%, 45%);--error-bg:hsl(359, 100%, 97%);--error-border:hsl(359, 100%, 94%);--error-text:hsl(360, 100%, 45%)}[data-sonner-toaster][data-sonner-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg:#000;--normal-border:hsl(0, 0%, 20%);--normal-text:var(--gray1)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg:#fff;--normal-border:var(--gray3);--normal-text:var(--gray12)}[data-sonner-toaster][data-sonner-theme=dark]{--normal-bg:#000;--normal-bg-hover:hsl(0, 0%, 12%);--normal-border:hsl(0, 0%, 20%);--normal-border-hover:hsl(0, 0%, 25%);--normal-text:var(--gray1);--success-bg:hsl(150, 100%, 6%);--success-border:hsl(147, 100%, 12%);--success-text:hsl(150, 86%, 65%);--info-bg:hsl(215, 100%, 6%);--info-border:hsl(223, 43%, 17%);--info-text:hsl(216, 87%, 65%);--warning-bg:hsl(64, 100%, 6%);--warning-border:hsl(60, 100%, 9%);--warning-text:hsl(46, 87%, 65%);--error-bg:hsl(358, 76%, 10%);--error-border:hsl(357, 89%, 16%);--error-text:hsl(358, 100%, 81%)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size:16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:first-child{animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}100%{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}100%{opacity:.15}}@media (prefers-reduced-motion){.sonner-loading-bar,[data-sonner-toast],[data-sonner-toast]>*{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}`);function cI(e){return e.label!==void 0}var lI=3,uI=`24px`,dI=`16px`,fI=4e3,pI=356,mI=14,hI=45,gI=200;function _I(...e){return e.filter(Boolean).join(` `)}function vI(e){let[t,n]=e.split(`-`),r=[];return t&&r.push(t),n&&r.push(n),r}var yI=e=>{let{invert:t,toast:n,unstyled:r,interacting:i,setHeights:a,visibleToasts:o,heights:s,index:c,toasts:l,expanded:u,removeToast:d,defaultRichColors:f,closeButton:p,style:m,cancelButtonStyle:h,actionButtonStyle:g,className:_=``,descriptionClassName:v=``,duration:y,position:b,gap:x,expandByDefault:S,classNames:C,icons:w,closeButtonAriaLabel:T=`Close toast`}=e,[E,D]=G.useState(null),[O,k]=G.useState(null),[A,j]=G.useState(!1),[M,N]=G.useState(!1),[P,F]=G.useState(!1),[I,L]=G.useState(!1),[R,z]=G.useState(!1),[ee,te]=G.useState(0),[B,ne]=G.useState(0),re=G.useRef(n.duration||y||fI),V=G.useRef(null),H=G.useRef(null),ie=c===0,ae=c+1<=o,oe=n.type,se=oe??`default`,ce=n.dismissible!==!1,le=n.className||``,ue=n.descriptionClassName||``,de=G.useMemo(()=>s.findIndex(e=>e.toastId===n.id)||0,[s,n.id]),fe=G.useMemo(()=>n.closeButton??p,[n.closeButton,p]),pe=G.useMemo(()=>n.duration||y||fI,[n.duration,y]),me=G.useRef(0),he=G.useRef(0),ge=G.useRef(0),_e=G.useRef(null),[ve,ye]=b.split(`-`),be=G.useMemo(()=>s.reduce((e,t,n)=>n>=de?e:e+t.height,0),[s,de]),xe=eI(),Se=G.useMemo(()=>e.swipeDirections??vI(b),[e.swipeDirections,b]),Ce=n.invert||t,we=oe===`loading`;he.current=G.useMemo(()=>de*x+be,[de,be]),G.useEffect(()=>{re.current=pe},[pe]),G.useEffect(()=>{j(!0)},[]),G.useEffect(()=>{let e=H.current;if(e){let t=e.getBoundingClientRect().height;return ne(t),a(e=>[{toastId:n.id,height:t,position:n.position},...e]),()=>a(e=>e.filter(e=>e.toastId!==n.id))}},[a,n.id]),G.useLayoutEffect(()=>{if(!A)return;let e=H.current,t=e.style.height;e.style.height=`auto`;let r=e.getBoundingClientRect().height;e.style.height=t,ne(r),a(e=>e.find(e=>e.toastId===n.id)?e.map(e=>e.toastId===n.id?{...e,height:r}:e):[{toastId:n.id,height:r,position:n.position},...e])},[A,n.title,n.description,a,n.id,n.jsx,n.action,n.cancel]);let Te=G.useCallback(()=>{N(!0),te(he.current),a(e=>e.filter(e=>e.toastId!==n.id)),setTimeout(()=>{d(n)},gI)},[n,d,a,he]);G.useEffect(()=>{if(n.promise&&oe===`loading`||n.duration===1/0||n.type===`loading`)return;let e;return u||i||xe?(()=>{if(ge.current<me.current){let e=new Date().getTime()-me.current;re.current-=e}ge.current=new Date().getTime()})():re.current!==1/0&&(me.current=new Date().getTime(),e=setTimeout(()=>{n.onAutoClose==null||n.onAutoClose.call(n,n),Te()},re.current)),()=>clearTimeout(e)},[u,i,n,oe,xe,Te]),G.useEffect(()=>{n.delete&&(Te(),n.onDismiss==null||n.onDismiss.call(n,n))},[Te,n.delete]);function Ee(){return w?.loading?G.createElement(`div`,{className:_I(C?.loader,n?.classNames?.loader,`sonner-loader`),"data-visible":oe===`loading`},w.loading):G.createElement(JF,{className:_I(C?.loader,n?.classNames?.loader),visible:oe===`loading`})}let De=n.icon||w?.[oe]||KF(oe);return G.createElement(`li`,{tabIndex:0,ref:H,className:_I(_,le,C?.toast,n?.classNames?.toast,C?.[se],n?.classNames?.[se]),"data-sonner-toast":``,"data-rich-colors":n.richColors??f,"data-styled":!(n.jsx||n.unstyled||r),"data-mounted":A,"data-promise":!!n.promise,"data-swiped":R,"data-removed":M,"data-visible":ae,"data-y-position":ve,"data-x-position":ye,"data-index":c,"data-front":ie,"data-swiping":P,"data-dismissible":ce,"data-type":oe,"data-invert":Ce,"data-swipe-out":I,"data-swipe-direction":O,"data-expanded":!!(u||S&&A),"data-testid":n.testId,style:{"--index":c,"--toasts-before":c,"--z-index":l.length-c,"--offset":`${M?ee:he.current}px`,"--initial-height":S?`auto`:`${B}px`,...m,...n.style},onDragEnd:()=>{F(!1),D(null),_e.current=null},onPointerDown:e=>{e.button!==2&&(we||!ce||(V.current=new Date,te(he.current),e.target.setPointerCapture(e.pointerId),e.target.tagName!==`BUTTON`&&(F(!0),_e.current={x:e.clientX,y:e.clientY})))},onPointerUp:()=>{if(I||!ce)return;_e.current=null;let e=Number(H.current?.style.getPropertyValue(`--swipe-amount-x`).replace(`px`,``)||0),t=Number(H.current?.style.getPropertyValue(`--swipe-amount-y`).replace(`px`,``)||0),r=new Date().getTime()-V.current?.getTime(),i=E===`x`?e:t,a=Math.abs(i)/r;if((E===`x`?Se.includes(e>0?`right`:`left`):Se.includes(t>0?`bottom`:`top`))&&(Math.abs(i)>=hI||a>.11)){te(he.current),n.onDismiss==null||n.onDismiss.call(n,n),k(E===`x`?e>0?`right`:`left`:t>0?`down`:`up`),Te(),L(!0);return}var o,s;(o=H.current)==null||o.style.setProperty(`--swipe-amount-x`,`0px`),(s=H.current)==null||s.style.setProperty(`--swipe-amount-y`,`0px`),z(!1),F(!1),D(null)},onPointerMove:e=>{var t,n;if(!_e.current||!ce||window.getSelection()?.toString().length>0)return;let r=e.clientY-_e.current.y,i=e.clientX-_e.current.x;!E&&(Math.abs(i)>1||Math.abs(r)>1)&&D(Math.abs(i)>Math.abs(r)?`x`:`y`);let a={x:0,y:0},o=e=>1/(1.5+Math.abs(e)/20);if(E===`y`){if(Se.includes(`top`)||Se.includes(`bottom`)){if(Se.includes(`top`)&&r<0||Se.includes(`bottom`)&&r>0)a.y=r;else{let e=r*o(r);a.y=Math.abs(e)<Math.abs(r)?e:r}}}else if(E===`x`&&(Se.includes(`left`)||Se.includes(`right`))){if(Se.includes(`left`)&&i<0||Se.includes(`right`)&&i>0)a.x=i;else{let e=i*o(i);a.x=Math.abs(e)<Math.abs(i)?e:i}}(Math.abs(a.x)>0||Math.abs(a.y)>0)&&z(!0),(t=H.current)==null||t.style.setProperty(`--swipe-amount-x`,`${a.x}px`),(n=H.current)==null||n.style.setProperty(`--swipe-amount-y`,`${a.y}px`)}},fe&&!n.jsx&&oe!==`loading`?G.createElement(`button`,{"aria-label":T,"data-disabled":we,"data-close-button":!0,onClick:we||!ce?()=>{}:()=>{Te(),n.onDismiss==null||n.onDismiss.call(n,n)},className:_I(C?.closeButton,n?.classNames?.closeButton)},w?.close??$F):null,(oe||n.icon||n.promise)&&n.icon!==null&&(w?.[oe]!==null||n.icon)?G.createElement(`div`,{"data-icon":``,className:_I(C?.icon,n?.classNames?.icon)},oe===`loading`?n.icon||Ee():n.promise?Ee():null,oe===`loading`?null:De):null,G.createElement(`div`,{"data-content":``,className:_I(C?.content,n?.classNames?.content)},G.createElement(`div`,{"data-title":``,className:_I(C?.title,n?.classNames?.title)},n.jsx?n.jsx:typeof n.title==`function`?n.title():n.title),n.description?G.createElement(`div`,{"data-description":``,className:_I(v,ue,C?.description,n?.classNames?.description)},typeof n.description==`function`?n.description():n.description):null),G.isValidElement(n.cancel)?n.cancel:n.cancel&&cI(n.cancel)?G.createElement(`button`,{"data-button":!0,"data-cancel":!0,style:n.cancelButtonStyle||h,onClick:e=>{cI(n.cancel)&&ce&&(n.cancel.onClick==null||n.cancel.onClick.call(n.cancel,e),Te())},className:_I(C?.cancelButton,n?.classNames?.cancelButton)},n.cancel.label):null,G.isValidElement(n.action)?n.action:n.action&&cI(n.action)?G.createElement(`button`,{"data-button":!0,"data-action":!0,style:n.actionButtonStyle||g,onClick:e=>{cI(n.action)&&(n.action.onClick==null||n.action.onClick.call(n.action,e),!e.defaultPrevented&&Te())},className:_I(C?.actionButton,n?.classNames?.actionButton)},n.action.label):null)};function bI(){if(typeof window>`u`||typeof document>`u`)return`ltr`;let e=document.documentElement.getAttribute(`dir`);return e===`auto`||!e?window.getComputedStyle(document.documentElement).direction:e}function xI(e,t){let n={};return[e,t].forEach((e,t)=>{let r=t===1,i=r?`--mobile-offset`:`--offset`,a=r?dI:uI;function o(e){[`top`,`right`,`bottom`,`left`].forEach(t=>{n[`${i}-${t}`]=typeof e==`number`?`${e}px`:e})}typeof e==`number`||typeof e==`string`?o(e):typeof e==`object`?[`top`,`right`,`bottom`,`left`].forEach(t=>{e[t]===void 0?n[`${i}-${t}`]=a:n[`${i}-${t}`]=typeof e[t]==`number`?`${e[t]}px`:e[t]}):o(a)}),n}var SI=G.forwardRef(function(e,t){let{id:n,invert:r,position:i=`bottom-right`,hotkey:a=[`altKey`,`KeyT`],expand:o,closeButton:s,className:c,offset:l,mobileOffset:u,theme:d=`light`,richColors:f,duration:p,style:m,visibleToasts:h=lI,toastOptions:g,dir:_=bI(),gap:v=mI,icons:y,customAriaLabel:b,containerAriaLabel:x=`Notifications`}=e,[S,C]=G.useState([]),w=G.useMemo(()=>n?S.filter(e=>e.toasterId===n):S.filter(e=>!e.toasterId),[S,n]),T=G.useMemo(()=>Array.from(new Set([i].concat(w.filter(e=>e.position).map(e=>e.position)))),[w,i]),[E,D]=G.useState([]),[O,k]=G.useState(!1),[A,j]=G.useState(!1),[M,N]=G.useState(d===`system`?typeof window<`u`&&window.matchMedia&&window.matchMedia(`(prefers-color-scheme: dark)`).matches?`dark`:`light`:d),P=G.useRef(null),F=a.join(`+`).replace(/Key/g,``).replace(/Digit/g,``),I=G.useRef(null),L=G.useRef(!1),R=G.useCallback(e=>{C(t=>(t.find(t=>t.id===e.id)?.delete||iI.dismiss(e.id),t.filter(({id:t})=>t!==e.id)))},[]);return G.useEffect(()=>iI.subscribe(e=>{if(e.dismiss){requestAnimationFrame(()=>{C(t=>t.map(t=>t.id===e.id?{...t,delete:!0}:t))});return}setTimeout(()=>{WF.flushSync(()=>{C(t=>{let n=t.findIndex(t=>t.id===e.id);return n===-1?[e,...t]:[...t.slice(0,n),{...t[n],...e},...t.slice(n+1)]})})})}),[]),G.useEffect(()=>{if(d!==`system`){N(d);return}if(d===`system`&&(window.matchMedia&&window.matchMedia(`(prefers-color-scheme: dark)`).matches?N(`dark`):N(`light`)),typeof window>`u`)return;let e=window.matchMedia(`(prefers-color-scheme: dark)`);try{e.addEventListener(`change`,({matches:e})=>{N(e?`dark`:`light`)})}catch{e.addListener(({matches:e})=>{try{N(e?`dark`:`light`)}catch(e){console.error(e)}})}},[d]),G.useEffect(()=>{S.length<=1&&k(!1)},[S]),G.useEffect(()=>{let e=e=>{if(a.length>0&&a.every(t=>e[t]||e.code===t)){var t;k(!0),(t=P.current)==null||t.focus()}e.code===`Escape`&&(document.activeElement===P.current||P.current?.contains(document.activeElement))&&k(!1)};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[a]),G.useEffect(()=>{if(P.current)return()=>{I.current&&(I.current.focus({preventScroll:!0}),I.current=null,L.current=!1)}},[P.current]),G.createElement(`section`,{ref:t,"aria-label":b??`${x} ${F}`,tabIndex:-1,"aria-live":`polite`,"aria-relevant":`additions text`,"aria-atomic":`false`,suppressHydrationWarning:!0,"data-react-aria-top-layer":!0},T.map((t,n)=>{let[i,a]=t.split(`-`);return w.length?G.createElement(`ol`,{key:t,dir:_===`auto`?bI():_,tabIndex:-1,ref:P,className:c,"data-sonner-toaster":!0,"data-sonner-theme":M,"data-y-position":i,"data-x-position":a,style:{"--front-toast-height":`${E[0]?.height||0}px`,"--width":`${pI}px`,"--gap":`${v}px`,...m,...xI(l,u)},onBlur:e=>{L.current&&!e.currentTarget.contains(e.relatedTarget)&&(L.current=!1,I.current&&=(I.current.focus({preventScroll:!0}),null))},onFocus:e=>{e.target instanceof HTMLElement&&e.target.dataset.dismissible===`false`||L.current||(L.current=!0,I.current=e.relatedTarget)},onMouseEnter:()=>k(!0),onMouseMove:()=>k(!0),onMouseLeave:()=>{A||k(!1)},onDragEnd:()=>k(!1),onPointerDown:e=>{e.target instanceof HTMLElement&&e.target.dataset.dismissible===`false`||j(!0)},onPointerUp:()=>j(!1)},w.filter(e=>!e.position&&n===0||e.position===t).map((n,i)=>G.createElement(yI,{key:n.id,icons:y,index:i,toast:n,defaultRichColors:f,duration:g?.duration??p,className:g?.className,descriptionClassName:g?.descriptionClassName,invert:r,visibleToasts:h,closeButton:g?.closeButton??s,interacting:A,position:t,style:g?.style,unstyled:g?.unstyled,classNames:g?.classNames,cancelButtonStyle:g?.cancelButtonStyle,actionButtonStyle:g?.actionButtonStyle,closeButtonAriaLabel:g?.closeButtonAriaLabel,removeToast:R,toasts:w.filter(e=>e.position==n.position),heights:E.filter(e=>e.position==n.position),setHeights:D,expandByDefault:o,gap:v,expanded:O,swipeDirections:e.swipeDirections}))):null}))}),CI=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),wI=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),TI={xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`},EI=(0,G.forwardRef)(({color:e=`currentColor`,size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:i=``,children:a,iconNode:o,...s},c)=>(0,G.createElement)(`svg`,{ref:c,...TI,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:wI(`lucide`,i),...s},[...o.map(([e,t])=>(0,G.createElement)(e,t)),...Array.isArray(a)?a:[a]])),DI=(e,t)=>{let n=(0,G.forwardRef)(({className:n,...r},i)=>(0,G.createElement)(EI,{ref:i,iconNode:t,className:wI(`lucide-${CI(e)}`,n),...r}));return n.displayName=`${e}`,n},OI=DI(`ArrowUp`,[[`path`,{d:`m5 12 7-7 7 7`,key:`hav0vg`}],[`path`,{d:`M12 19V5`,key:`x0mq9r`}]]),kI=DI(`AudioLines`,[[`path`,{d:`M2 10v3`,key:`1fnikh`}],[`path`,{d:`M6 6v11`,key:`11sgs0`}],[`path`,{d:`M10 3v18`,key:`yhl04a`}],[`path`,{d:`M14 8v7`,key:`3a1oy3`}],[`path`,{d:`M18 5v13`,key:`123xd1`}],[`path`,{d:`M22 10v3`,key:`154ddg`}]]),AI=DI(`Check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),jI=DI(`ChevronDown`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]),MI=DI(`ChevronUp`,[[`path`,{d:`m18 15-6-6-6 6`,key:`153udz`}]]),NI=DI(`Clock`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`polyline`,{points:`12 6 12 12 16 14`,key:`68esgv`}]]),PI=DI(`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`}]]),FI=DI(`Ellipsis`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`19`,cy:`12`,r:`1`,key:`1wjl8i`}],[`circle`,{cx:`5`,cy:`12`,r:`1`,key:`1pcz8c`}]]),II=DI(`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`}]]),LI=DI(`FolderTree`,[[`path`,{d:`M20 10a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1h-2.5a1 1 0 0 1-.8-.4l-.9-1.2A1 1 0 0 0 15 3h-2a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z`,key:`hod4my`}],[`path`,{d:`M20 21a1 1 0 0 0 1-1v-3a1 1 0 0 0-1-1h-2.9a1 1 0 0 1-.88-.55l-.42-.85a1 1 0 0 0-.92-.6H13a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z`,key:`w4yl2u`}],[`path`,{d:`M3 5a2 2 0 0 0 2 2h3`,key:`f2jnh7`}],[`path`,{d:`M3 3v13a2 2 0 0 0 2 2h3`,key:`k8epm1`}]]),RI=DI(`Folder`,[[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}]]),zI=DI(`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`}]]),BI=DI(`ImagePlus`,[[`path`,{d:`M16 5h6`,key:`1vod17`}],[`path`,{d:`M19 2v6`,key:`4bpg5p`}],[`path`,{d:`M21 11.5V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h7.5`,key:`1ue2ih`}],[`path`,{d:`m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21`,key:`1xmnt7`}],[`circle`,{cx:`9`,cy:`9`,r:`2`,key:`af1f0g`}]]),VI=DI(`Image`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}],[`circle`,{cx:`9`,cy:`9`,r:`2`,key:`af1f0g`}],[`path`,{d:`m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21`,key:`1xmnt7`}]]),HI=DI(`Info`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 16v-4`,key:`1dtifu`}],[`path`,{d:`M12 8h.01`,key:`e9boi3`}]]),UI=DI(`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`}]]),WI=DI(`Mic`,[[`path`,{d:`M12 2a3 3 0 0 0-3 3v7a3 3 0 0 0 6 0V5a3 3 0 0 0-3-3Z`,key:`131961`}],[`path`,{d:`M19 10v2a7 7 0 0 1-14 0v-2`,key:`1vc78b`}],[`line`,{x1:`12`,x2:`12`,y1:`19`,y2:`22`,key:`x3vr5v`}]]),GI=DI(`Minus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}]]),KI=DI(`Pause`,[[`rect`,{x:`14`,y:`4`,width:`4`,height:`16`,rx:`1`,key:`zuxfzm`}],[`rect`,{x:`6`,y:`4`,width:`4`,height:`16`,rx:`1`,key:`1okwgv`}]]),qI=DI(`Play`,[[`polygon`,{points:`6 3 20 12 6 21 6 3`,key:`1oa8hb`}]]),JI=DI(`Plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]),YI=DI(`SlidersHorizontal`,[[`line`,{x1:`21`,x2:`14`,y1:`4`,y2:`4`,key:`obuewd`}],[`line`,{x1:`10`,x2:`3`,y1:`4`,y2:`4`,key:`1q6298`}],[`line`,{x1:`21`,x2:`12`,y1:`12`,y2:`12`,key:`1iu8h1`}],[`line`,{x1:`8`,x2:`3`,y1:`12`,y2:`12`,key:`ntss68`}],[`line`,{x1:`21`,x2:`16`,y1:`20`,y2:`20`,key:`14d8ph`}],[`line`,{x1:`12`,x2:`3`,y1:`20`,y2:`20`,key:`m0wm8r`}],[`line`,{x1:`14`,x2:`14`,y1:`2`,y2:`6`,key:`14e1ph`}],[`line`,{x1:`8`,x2:`8`,y1:`10`,y2:`14`,key:`1i6ji0`}],[`line`,{x1:`16`,x2:`16`,y1:`18`,y2:`22`,key:`1lctlv`}]]),XI=DI(`Square`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}]]),ZI=DI(`Upload`,[[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}],[`polyline`,{points:`17 8 12 3 7 8`,key:`t8dd8p`}],[`line`,{x1:`12`,x2:`12`,y1:`3`,y2:`15`,key:`widbto`}]]),QI=DI(`X`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]),$I=Object.freeze({alphaIntercept:-9,alphaSlope:19,blurStdDeviation:1.5}),eL=Object.freeze([`2xs`,`xs`,`sm`,`md`,`lg`,`xl`,`2xl`,`3xl`,`4xl`]);Object.freeze(`--stipe-font-synthesis.--stipe-surface-frame-width.--stipe-surface-frame-image.--stipe-surface-molding-contrast.--stipe-shadow-raised.--stipe-shadow-inset.--stipe-shadow-edge.--stipe-display-gasket-face.--stipe-display-texture-image.--stipe-display-text-shadow.--stipe-canvas.--stipe-surface.--stipe-surface-raised.--stipe-surface-selected.--stipe-fg-muted.--stipe-linework.--stipe-hairline.--stipe-hairline-quiet.--stipe-figure-ink.--stipe-density-compact.--stipe-density-comfortable.--stipe-motion-spring.--stipe-motion-squish.--stipe-motion-fast.--stipe-motion-normal.--stipe-motion-slow.--stipe-motion-ease.--stipe-motion-ease-exit.--stipe-motion-bounce.--stipe-motion-spring-duration.--stipe-motion-stretch.--stipe-motion-distance.--stipe-motion-stagger.--stipe-motion-blur.--stipe-motion-shake.--stipe-motion-steps.--stipe-motion-fuse.--stipe-press-depth.--stipe-press-scale.--stipe-layer-desktop.--stipe-layer-windows.--stipe-layer-chrome.--stipe-layer-popover.--stipe-layer-dialog.--stipe-layer-toast.--stipe-layer-tooltip.--stipe-overlay-shadow-outset.--stipe-icon-size-sm.--stipe-icon-size-md.--stipe-icon-size-lg.--stipe-icon-stroke.--stipe-card-rim.--stipe-card-rim-edge.--stipe-card-face.--stipe-card-panel.--stipe-card-ink.--stipe-card-ink-muted.--stipe-card-accent.--stipe-card-shadow.--stipe-card-foil-highlight.--stipe-card-foil-warm.--stipe-card-foil-cool.--stipe-avatar-shadow.--stipe-art-coral.--stipe-art-blue.--stipe-art-mint.--stipe-art-grape.--stipe-art-yellow.--stipe-art-cream.--stipe-art-ink.--stipe-art-inkcap.--stipe-art-graphite.--stipe-sketch-ink`.split(`.`));function tL(e){var t,n,r=``;if(typeof e==`string`||typeof e==`number`)r+=e;else if(typeof e==`object`){if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(n=tL(e[t]))&&(r&&(r+=` `),r+=n)}else for(n in e)e[n]&&(r&&(r+=` `),r+=n)}return r}function nL(){for(var e,t,n=0,r=``,i=arguments.length;n<i;n++)(e=arguments[n])&&(t=tL(e))&&(r&&(r+=` `),r+=t);return r}var rL=e=>typeof e==`boolean`?`${e}`:e===0?`0`:e,iL=nL,aL=(e,t)=>n=>{if(t?.variants==null)return iL(e,n?.class,n?.className);let{variants:r,defaultVariants:i}=t,a=Object.keys(r).map(e=>{let t=n?.[e],a=i?.[e];if(t===null)return null;let o=rL(t)||rL(a);return r[e][o]}),o=n&&Object.entries(n).reduce((e,t)=>{let[n,r]=t;return r===void 0||(e[n]=r),e},{});return iL(e,a,t?.compoundVariants?.reduce((e,t)=>{let{class:n,className:r,...a}=t;return Object.entries(a).every(e=>{let[t,n]=e;return Array.isArray(n)?n.includes({...i,...o}[t]):{...i,...o}[t]===n})?[...e,n,r]:e},[]),n?.class,n?.className)},oL=Object.defineProperty,sL=((e,t)=>{let n={};for(var r in e)oL(n,r,{get:e[r],enumerable:!0});return t||oL(n,Symbol.toStringTag,{value:`Module`}),n})({isAny:()=>xL,isAnyNonArbitrary:()=>EL,isArbitraryFamilyName:()=>UL,isArbitraryImage:()=>GL,isArbitraryLength:()=>BL,isArbitraryNumber:()=>VL,isArbitraryPosition:()=>WL,isArbitraryShadow:()=>KL,isArbitrarySize:()=>RL,isArbitraryValue:()=>zL,isArbitraryVariable:()=>qL,isArbitraryVariableFamilyName:()=>YL,isArbitraryVariableImage:()=>QL,isArbitraryVariableLength:()=>JL,isArbitraryVariablePosition:()=>XL,isArbitraryVariableShadow:()=>$L,isArbitraryVariableSize:()=>ZL,isArbitraryVariableWeight:()=>eR,isArbitraryWeight:()=>HL,isFraction:()=>gL,isInteger:()=>vL,isNamedContainerQuery:()=>DL,isNumber:()=>_L,isPercent:()=>yL,isTshirtSize:()=>bL}),cL=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,lL=/^\((?:(\w[\w-]*):)?(.+)\)$/i,uL=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,dL=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,fL=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,pL=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,mL=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,hL=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,gL=e=>uL.test(e),_L=e=>!!e&&!Number.isNaN(Number(e)),vL=e=>!!e&&Number.isInteger(Number(e)),yL=e=>e.endsWith(`%`)&&_L(e.slice(0,-1)),bL=e=>dL.test(e),xL=()=>!0,SL=e=>fL.test(e)&&!pL.test(e),CL=()=>!1,wL=e=>mL.test(e),TL=e=>hL.test(e),EL=e=>!zL(e)&&!qL(e),DL=e=>e.startsWith(`@container`)&&(e[10]===`/`&&e[11]!==void 0||e[11]===`s`&&e[16]!==void 0&&e.startsWith(`-size/`,10)||e[11]===`n`&&e[18]!==void 0&&e.startsWith(`-normal/`,10)),OL=(e,t,n)=>{let r=cL.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},kL=(e,t,n=!1)=>{let r=lL.exec(e);return r?r[1]?t(r[1]):n:!1},AL=e=>e===`position`||e===`percentage`,jL=e=>e===`image`||e===`url`,ML=e=>e===`length`||e===`size`||e===`bg-size`,NL=e=>e===`length`,PL=e=>e===`number`,FL=e=>e===`family-name`,IL=e=>e===`number`||e===`weight`,LL=e=>e===`shadow`,RL=e=>OL(e,ML,CL),zL=e=>cL.test(e),BL=e=>OL(e,NL,SL),VL=e=>OL(e,PL,_L),HL=e=>OL(e,IL,xL),UL=e=>OL(e,FL,CL),WL=e=>OL(e,AL,CL),GL=e=>OL(e,jL,TL),KL=e=>OL(e,LL,wL),qL=e=>lL.test(e),JL=e=>kL(e,NL),YL=e=>kL(e,FL),XL=e=>kL(e,AL),ZL=e=>kL(e,ML),QL=e=>kL(e,jL),$L=e=>kL(e,LL,!0),eR=e=>kL(e,IL,!0),tR=(e,t)=>{let n=Object.keys(e);return n.length===1&&n[0]===t&&typeof e[t]==`string`},nR=e=>typeof e==`function`&&e.isThemeGetter===!0,rR=e=>({...e,theme:{...e.theme},classGroups:{...e.classGroups},conflictingClassGroups:{...e.conflictingClassGroups},conflictingClassGroupModifiers:{...e.conflictingClassGroupModifiers},orderSensitiveModifiers:[...e.orderSensitiveModifiers],postfixLookupClassGroups:[...e.postfixLookupClassGroups??[]]}),iR=(e,t)=>{let n=rR(e);t.prefix!==void 0&&(n.prefix=t.prefix);let r=(e,t)=>{if(t)for(let n in t)t[n]!==void 0&&(e[n]=t[n])},i=t.override;i&&(i.orderSensitiveModifiers&&(n.orderSensitiveModifiers=[...i.orderSensitiveModifiers]),r(n.theme,i.theme),r(n.classGroups,i.classGroups),r(n.conflictingClassGroups,i.conflictingClassGroups),r(n.conflictingClassGroupModifiers,i.conflictingClassGroupModifiers));let a=(e,t)=>{if(t)for(let n in t){let r=t[n];r&&(e[n]=(e[n]??[]).concat(r))}},o=t.extend;return o&&(o.orderSensitiveModifiers&&(n.orderSensitiveModifiers=[...n.orderSensitiveModifiers,...o.orderSensitiveModifiers]),a(n.theme,o.theme),a(n.classGroups,o.classGroups),a(n.conflictingClassGroups,o.conflictingClassGroups),a(n.conflictingClassGroupModifiers,o.conflictingClassGroupModifiers)),n},aR={isAny:0,isAnyNonArbitrary:1,isArbitraryValue:2,isArbitraryVariable:3,isFraction:4,isNumber:5,isInteger:6,isPercent:7,isTshirtSize:8,isNamedContainerQuery:9,isArbitraryLength:10,isArbitraryNumber:11,isArbitraryWeight:12,isArbitraryFamilyName:13,isArbitraryPosition:14,isArbitrarySize:15,isArbitraryImage:16,isArbitraryShadow:17,isArbitraryVariableLength:18,isArbitraryVariableFamilyName:19,isArbitraryVariablePosition:20,isArbitraryVariableSize:21,isArbitraryVariableImage:22,isArbitraryVariableShadow:23,isArbitraryVariableWeight:24},oR=25,sR=()=>({names:[],idByName:new Map,impls:{},fnName:new Map,classifierFns:new Map}),cR=(e,t,n)=>{let r=e.idByName.get(t);return r===void 0&&(r=e.names.length,e.names.push(t),e.idByName.set(t,r),e.classifierFns.set(t,n)),r},lR=(e,t)=>{if(typeof t==`function`){let n=e.fnName.get(t);return n===void 0&&(n=`$c`+e.fnName.size,e.fnName.set(t,n),e.impls[n]=t),cR(e,n,t)}let n=t.$v,r=sL[n];if(aR[n]===void 0||!r)throw Error(`cn: unknown validator "${n}"`);return cR(e,n,r)},uR=()=>({nextPart:new Map,validators:null,classGroupId:-1,lit:[]}),dR=(e,t)=>e.theme[t]??[],fR=(e,t,n)=>{let r=uR(),i=(e,t)=>{for(let n of t.split(`-`)){let t=e.nextPart.get(n);t||(t=uR(),e.nextPart.set(n,t)),e=t}return e},a=(n,r,o)=>{if(typeof n==`string`){let e=n===``?r:i(r,n);e.classGroupId=o;return}if(typeof n==`function`){if(nR(n)){for(let t of n(e.theme))a(t,r,o);return}(r.validators??=[]).push({validatorId:lR(t,n),groupId:o});return}if(tR(n,`$t`)){for(let t of dR(e,n.$t))a(t,r,o);return}if(tR(n,`$v`)){(r.validators??=[]).push({validatorId:lR(t,n),groupId:o});return}for(let[e,t]of Object.entries(n)){let n=i(r,e);for(let e of t)a(e,n,o)}};for(let[t,i]of Object.entries(e.classGroups)){let e=n(t);for(let t of i)a(t,r,e)}return r},pR=e=>{let t=sR(),n=[],r=new Map,i=e=>{let t=r.get(e);return t===void 0&&(t=n.length,n.push(e),r.set(e,t)),t},a=fR(e,t,i),o=e=>{if(e.validators)return!1;for(let t of e.nextPart.values())if(!o(t))return!1;return!0},s=(e,t,n)=>{e.classGroupId>=0&&n.push({tail:t,gid:e.classGroupId});for(let[r,i]of e.nextPart)s(i,t+`-`+r,n)},c=e=>{for(let[t,n]of[...e.nextPart])o(n)?(s(n,t,e.lit),e.nextPart.delete(t)):c(n)};c(a);let l=[{edges:new Map,groupId:-1,vlist:-1}],u=()=>(l.push({edges:new Map,groupId:-1,vlist:-1}),l.length-1),d=[],f=new Map,p=e=>{let t=e.map(e=>e.validatorId+`:`+e.groupId).join(`,`),n=f.get(t);return n===void 0&&(n=d.length,d.push(e.map(e=>[e.validatorId,e.groupId])),f.set(t,n)),n},m=(e,t)=>{let n=e;for(let e=0;e<t.length;e++){let r=t.charCodeAt(e),i=l[n].edges.get(r);i===void 0&&(i=u(),l[n].edges.set(r,i)),n=i}return n},h=[],g=(e,t,n)=>{e.classGroupId>=0&&(l[t].groupId=e.classGroupId),e.validators&&(l[t].vlist=p(e.validators));for(let{tail:n,gid:r}of e.lit)h.push({anchor:t,tail:n,gid:r});for(let[r,i]of e.nextPart){let e=t;if(!n){let n=l[t].edges.get(45);n===void 0&&(n=u(),l[t].edges.set(45,n)),e=n}let a=m(e,r);g(i,a,!1)}};g(a,0,!0);let _=new Set(h.map(e=>e.anchor)),v=e=>l[e].groupId>=0||l[e].vlist>=0||_.has(e),y=new Map,b=[],x=e=>{let t=b.length;y.set(e,t);let n={edges:[],groupId:l[e].groupId,vlist:l[e].vlist};b.push(n);let r=[...l[e].edges.entries()].sort((e,t)=>e[0]-t[0]);for(let[e,t]of r){let r=String.fromCharCode(e),i=t;for(;l[i].edges.size===1&&!v(i);){let[[e,t]]=l[i].edges.entries();r+=String.fromCharCode(e),i=t}n.edges.push({label:r,oldTarget:i})}for(let e of n.edges)x(e.oldTarget);return t};x(0);let S=b.length,C=0;for(let e of b)C+=e.edges.length;let w=new Int32Array(S),T=new Int32Array(C),E=``,D=new Int32Array(S),O=new Int32Array(S),k=[];{let e=0;for(let t=0;t<S;t++){let n=b[t];w[t]=n.edges.length;for(let t of n.edges)T[e]=t.label.length,E+=t.label,k.push(y.get(t.oldTarget)),e++;D[t]=n.groupId,O[t]=n.vlist}}{let e=new Int32Array(S);for(let t=S-1;t>=0;t--){let n=1,r=t+1;for(let i=0;i<w[t];i++)n+=e[r],r+=e[r];e[t]=n}let t=0;for(let n=0;n<S;n++){let r=n+1;for(let i=0;i<w[n];i++){if(r!==k[t])throw Error(`cn compiler: edge target mismatch at ${t}`);r+=e[r],t++}}}for(let e of h)e.anchor=y.get(e.anchor);{let e=new Int32Array(d.length).fill(-1),t=[];for(let n=0;n<S;n++){let r=O[n];r>=0&&(e[r]===-1&&(e[r]=t.length,t.push(d[r])),O[n]=e[r])}d.length=0,d.push(...t)}let A=0;for(let e of d)A+=e.length;let j=new Int32Array(A),M=new Int32Array(A);{let e=0;for(let t of d)for(let[n,r]of t)j[e]=n,M[e]=r,e++}h.sort((e,t)=>e.anchor-t.anchor||e.gid-t.gid||(e.tail<t.tail?-1:1));let N=[];for(let e of h){let t=N[N.length-1];t&&t.anchor===e.anchor&&t.gid===e.gid?t.tails.push(e.tail):N.push({anchor:e.anchor,gid:e.gid,tails:[e.tail],set:-1})}let P=new Map,F=[];for(let e of N){let t=e.tails.join(` `),n=P.get(t);n===void 0&&(n=F.length,P.set(t,n),F.push(e.tails)),e.set=n}for(let e of F.flat())if(e.includes(`|`)||e.includes(` `))throw Error(`cn compiler: tail contains delimiter: `+e);let I=new Set(F.flat()).size;N.sort((e,t)=>e.anchor-t.anchor||e.set-t.set);for(let t of Object.values(e.conflictingClassGroups))for(let e of t)i(e);for(let t of Object.values(e.conflictingClassGroupModifiers))for(let e of t)i(e);for(let t of e.postfixLookupClassGroups??[])i(t);let L=n.length,R=new Int32Array(L).fill(-1),z=0,ee=e=>(R[e]===-1&&(R[e]=z++),R[e]);for(let e=0;e<M.length;e++)M[e]=ee(M[e]);for(let e of N)e.gid=ee(e.gid);for(let e=0;e<D.length;e++)D[e]>=0&&(D[e]=ee(D[e]));for(let e=0;e<L;e++)R[e]===-1&&(R[e]=z++);let te=Array(L);for(let e=0;e<L;e++)te[R[e]]=n[e];let B=[],ne=[],re=[],V=[],H=[];for(let t=0;t<L;t++){let n=te[t],i=(e.conflictingClassGroups[n]??[]).map(e=>R[r.get(e)]),a=(e.conflictingClassGroupModifiers[n]??[]).map(e=>R[r.get(e)]);i.length&&(B.push(t),ne.push(i.length),re.push(...i));for(let e of a)V.push(t),H.push(e)}let ie=(e.postfixLookupClassGroups??[]).map(e=>R[r.get(e)]),ae=[],oe=new Int32Array(j.length);for(let e=0;e<j.length;e++){let n=t.names[j[e]],r=aR[n];if(r!==void 0)oe[e]=r;else{let t=ae.indexOf(n);t===-1&&(t=ae.length,ae.push(n)),oe[e]=oR+t}}let se=new Map,ce=[],le=[],ue=[];{let e=0;for(let t of d){let n=[];for(let r=0;r<t.length;r++)n.push(oe[e++]);let r=n.join(`,`),i=se.get(r);i===void 0&&(i=ce.length,se.set(r,i),ce.push(n.length),le.push(...n)),ue.push(i)}}let de={};for(let e of ae)de[e]=t.classifierFns.get(e);return{G:L,customNames:ae,impls:de,edgeCounts:w,edgeLabelLen:T,labelText:E,edgeTargetActual:k,nodeGroup:D,nodeVlist:O,nodeCount:S,totalEdges:C,patCounts:ce,patOps:le,listPat:ue,vlistGroup:M,litEntries:h,sets:F,attachments:N,uniqueTailCount:I,adjGid:B,adjCnt:ne,adjTgt:re,patGid:V,patTgt:H,postfixLookup:ie,orderSensitiveModifiers:e.orderSensitiveModifiers.join(` `),prefix:e.prefix}},mR=e=>{let t=new Int32Array(e.length+1);for(let n=0;n<e.length;n++)t[n+1]=t[n]+e[n];return t},hR=e=>{let t=pR(e),n=t.litEntries.length,r=new Int32Array(n),i=new Int32Array(n),a=new Int32Array(n),o=``,s=new Int32Array(t.uniqueTailCount*2);{let e=new Map,n=0,c=0;for(let l of t.attachments)for(let u of t.sets[l.set]){let t=e.get(u);t===void 0&&(t=n++,e.set(u,t),s[t*2]=o.length,s[t*2+1]=u.length,o+=u),r[c]=l.anchor,i[c]=l.gid,a[c]=t,c++}}return{tables:{GROUP_COUNT:t.G,edgeStart:mR(t.edgeCounts),labelStart:mR(t.edgeLabelLen),labelText:t.labelText,edgeTarget:Int32Array.from(t.edgeTargetActual),nodeGroup:t.nodeGroup,nodeVlist:t.nodeVlist,vlistPat:mR(t.patCounts),vlistOps:Int32Array.from(t.patOps),vlistRef:Int32Array.from(t.listPat),vlistGroup:t.vlistGroup,litAnchor:r,litGroup:i,litPool:a,poolOffsets:s,poolText:o,adjGid:Int32Array.from(t.adjGid),adjStart:mR(t.adjCnt),adjTgt:Int32Array.from(t.adjTgt),patGid:Int32Array.from(t.patGid),patTgt:Int32Array.from(t.patTgt),postfixLookupGroups:Int32Array.from(t.postfixLookup),customValidatorNames:t.customNames,orderSensitiveModifiers:t.orderSensitiveModifiers},validatorImpls:t.impls,prefix:t.prefix}},gR=`line`in Error(),_R=-1,vR=-1,yR=(e,t,n)=>{let r=2166136261;for(let i=t;i<n;i++)r=Math.imul(r^e.charCodeAt(i),16777619);return r},bR=(e,t,n)=>{let r=n-t,i=Math.imul(r,2654435761)^e.charCodeAt(t);if(r>3){let a=r>>2,o=r>>1;i=Math.imul(i^e.charCodeAt(t+1)<<8^e.charCodeAt(t+2)<<16^e.charCodeAt(t+a),2246822507),i=Math.imul(i^e.charCodeAt(t+o)<<8^e.charCodeAt(t+o+a)<<16^e.charCodeAt(n-3),3266489909),i^=e.charCodeAt(n-2)<<8^e.charCodeAt(n-1)<<16;for(let r=t+3,a=n-4;r<t+8&&r<a;r++,a--)i=Math.imul(i^e.charCodeAt(r)^e.charCodeAt(a)<<8,16777619)}return i^i>>>15|0},xR=(e,t,n={})=>{let{GROUP_COUNT:r,edgeStart:i,labelStart:a,labelText:o,edgeTarget:s,nodeGroup:c,nodeVlist:l,vlistPat:u,vlistOps:d,vlistRef:f,vlistGroup:p,litAnchor:m,litGroup:h,litPool:g,poolOffsets:_,poolText:v,adjGid:y,adjStart:b,adjTgt:x,patGid:S,patTgt:C,postfixLookupGroups:w,customValidatorNames:T,orderSensitiveModifiers:E}=e,D=new Int32Array(r).fill(-1);for(let e=0;e<y.length;e++)D[y[e]]=e;let O=0;for(let e=0;e+1<b.length;e++){let t=b[e+1]-b[e];t>O&&(O=t)}let k=32;for(;k<2*(1+O+S.length);)k<<=1;let A=new Int32Array(f.length+1);for(let e=0;e<f.length;e++)A[e+1]=A[e]+u[f[e]+1]-u[f[e]];let j=new Uint8Array(r);for(let e=0;e<w.length;e++)j[w[e]]=1;let M=i.length-1,N=new Uint8Array(M),P=0,F=!0;for(let e=0;e<m.length;e++){N[m[e]]=1;let t=_[g[e]*2+1];t>P&&(P=t);let n=v.charCodeAt(_[g[e]*2]);(n===91||n===40)&&(F=!1)}let I=1;for(;I<m.length*2;)I<<=1;let L=new Int32Array(I).fill(-1);for(let e=0;e<m.length;e++){let t=_[g[e]*2],n=(yR(v,t,t+_[g[e]*2+1])^Math.imul(m[e],2654435761)|0)&I-1;for(;L[n]!==-1;)n=n+1&I-1;L[n]=e}let R=(e,t,n,r)=>{let i=(yR(t,n,r)^Math.imul(e,2654435761)|0)&I-1,a=r-n;for(;;){let r=L[i];if(r===-1)return-1;if(m[r]===e&&_[g[r]*2+1]===a){let e=_[g[r]*2],i=!0;for(let r=0;r<a;r++)if(v.charCodeAt(e+r)!==t.charCodeAt(n+r)){i=!1;break}if(i)return h[r]}i=i+1&I-1}},z=n.cacheSize??8192,ee=n.prefix??e.prefix??``,te=ee===``?``:ee+`:`,B=te.length,ne=(T??[]).map(e=>{let n=t&&t[e];if(!n)throw Error(`cn: missing validator `+e);return n}),re=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,V=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,H=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,ie=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,ae=0,oe=-1,se=-1,ce=-1,le=-1,ue=e=>e>=97&&e<=122||e>=65&&e<=90||e>=48&&e<=57||e===95,de=e=>/\s/.test(String.fromCharCode(e)),fe=(e,t,n)=>{if(ae=0,oe=-1,n-t<3)return;let r=e.charCodeAt(t),i=e.charCodeAt(n-1);if(r===91&&i===93)ae=1;else if(r===40&&i===41)ae=2;else return;ce=t+1,le=n-1;let a=t+1;if(ue(e.charCodeAt(a))){for(a++;a<n-1;){let t=e.charCodeAt(a);if(!ue(t)&&t!==45)break;a++}a<n-2&&e.charCodeAt(a)===58&&(oe=t+1,se=a,ce=a+1)}},pe=(e,t,n,r)=>{if(n-t!==r.length)return!1;for(let n=0;n<r.length;n++)if(e.charCodeAt(t+n)!==r.charCodeAt(n))return!1;return!0},me=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,he=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,ge=e=>!!e&&!Number.isNaN(Number(e)),_e=(e,t,n)=>{if(n-t<11||!pe(e,t,t+10,`@container`))return!1;if(e.charCodeAt(t+10)===47)return n-t>=12;let r=e.charCodeAt(t+11);return r===115&&n-t>=17&&pe(e,t+10,t+16,`-size/`)||r===110&&n-t>=19&&pe(e,t+10,t+18,`-normal/`)},ve=[1,1,1,1,1,1,1,1,2,2,2,2,2,2,2],ye=`length|number|number weight|family-name|position percentage|length size bg-size|image url|shadow|length|family-name|position percentage|length size bg-size|image url|shadow|number weight`.split(`|`).map(e=>e.split(` `)),be=[2,3,1,0,0,0,4,5,0,0,0,0,0,1,1],xe=(e,t,n,r)=>{if(e>=10){if(e>=25)return ne[e-25](t.slice(n,r));let i=e-10;if(ae!==ve[i])return!1;if(oe>=0){for(let e of ye[i])if(pe(t,oe,se,e))return!0;return!1}switch(be[i]){case 0:return!1;case 1:return!0;case 2:{let e=t.slice(ce,le);return re.test(e)&&!V.test(e)}case 3:return ge(t.slice(ce,le));case 4:return ie.test(t.slice(ce,le));default:return H.test(t.slice(ce,le))}}switch(e){case 0:return!0;case 1:return ae===0;case 2:return ae===1;case 3:return ae===2;case 4:return me.test(t.slice(n,r));case 5:return ge(t.slice(n,r));case 6:{let e=t.slice(n,r);return!!e&&Number.isInteger(Number(e))}case 7:return r>n&&t.charCodeAt(r-1)===37&&ge(t.slice(n,r-1));case 8:return he.test(t.slice(n,r));default:return _e(t,n,r)}},Se=new Set(typeof E==`string`?E.split(` `):E),Ce=(e,t,n,r,i,a)=>{let o=yR(t,n,r)^(i?2654435769:0)|0,s=e.get(o);if(s!==void 0)outer:for(let e=0;e<s.length;e++){let a=s[e];if(a.imp===i&&a.k.length===r-n){for(let e=0;e<a.k.length;e++)if(a.k.charCodeAt(e)!==t.charCodeAt(n+e))continue outer;return a.id}}else e.set(o,s=[]);let c=t.slice(n,r),l=a(c);return s.push({k:c,imp:i,id:l}),l},we=new Map,Te=new Map,Ee=2,De=4096,Oe=(e,t)=>{let n=[],r=0,i=0,a=0;for(let t=0;t<e.length;t++){let o=e.charCodeAt(t);r===0&&i===0&&o===58?(n.push(e.slice(a,t)),a=t+1):o===91?r++:o===93?r--:o===40?i++:o===41&&i--}n.push(e.slice(a));let o=n[0];if(n.length>1){let e=[],t=[];for(let r of n)r.charCodeAt(0)===91||Se.has(r)?(t.length&&(e.push(...t.sort()),t=[]),e.push(r)):t.push(r);t.length&&e.push(...t.sort()),o=e.join(`:`)}let s=t?o+` !`:o,c=Te.get(s);return c===void 0&&Te.set(s,c=Ee++),c},ke=new Map,Ae=r,je=r+4096,Me=()=>Ae++,Ne=2097152,Pe=8192,Fe=new Int32Array(Pe),Ie=Array(Pe).fill(null),Le=new Int32Array(Pe),Re=new Int32Array(Pe),ze=new Uint8Array(Pe),Be=0,Ve=(e,t,n,r,i,a,o,s)=>{let c=e;if(Ie[e]!==null){if(Ie[e|1]===null)c=e|1;else if(!(Be++&3))c=e|Be>>2&1;else return}Ie[c]=t.slice(n,r),Fe[c]=i,Le[c]=a,Re[c]=o,ze[c]=s},He=()=>Ie.fill(null),Ue=256,We=[new Int32Array(Ue),new Int32Array(Ue),new Int32Array(Ue),new Int32Array(Ue)],[Ge,Ke,qe,Je]=We,Ye=new Uint8Array(Ue),Xe=new Uint8Array(Ue),Ze=()=>{Ue*=2,We=We.map(e=>{let t=new Int32Array(Ue);return t.set(e),t}),[Ge,Ke,qe,Je]=We;let e=new Uint8Array(Ue);e.set(Ye),Ye=e,Xe=new Uint8Array(Ue)},Qe=64,$e=new Int32Array(Qe),et=new Int32Array(Qe),tt=new Int32Array(r),nt=2048,rt=21,it=new Float64Array(nt),at=new Int32Array(nt),ot=0,st=(e,t)=>{if(e===0&&t<r)return tt[t]===ot?1:(tt[t]=ot,0);let n=e*2097152+t+1,i=Math.imul(n,2654435761)>>>rt;for(;at[i]===ot;){if(it[i]===n)return 1;i=i+1&nt-1}return it[i]=n,at[i]=ot,0},ct=(e,t,n,r,i)=>{if(n-t>=2&&e.charCodeAt(t)===91&&e.charCodeAt(n-1)===93){let r=-1;for(let i=t+1;i<n-1;i++)if(e.charCodeAt(i)===58){r=i;break}return r===-1||r===t+1?_R:Ce(ke,e,t+1,r,0,Me)}if(r>=0&&c[r]>=0)return c[r];for(let t=i-1;t>=0;t--){let r=et[t];if(r>n)continue;let i=$e[t],a=n-r;if(N[i]===1&&a>0&&a<=P){let t=e.charCodeAt(r);if(F===!1||t!==91&&t!==40){let t=R(i,e,r,n);if(t>=0)return t}}let o=l[i];if(o<0)continue;let s=f[o],c=u[s],m=u[s+1];if(c===m)continue;fe(e,r,n);let h=A[o]-c;for(let t=c;t<m;t++)if(xe(d[t],e,r,n))return p[h+t]}return _R},lt=e=>{let t=e.length,n=0,c=0,u=!1;(Ee>De||we.size>De)&&(we=new Map,Te=new Map,Ee=2,He()),Ae>je&&(ke=new Map,Ae=r,He());let d=0;for(;d<t;){let f=e.charCodeAt(d);if(f===32||f>=9&&f<=13||f>=160&&de(f)){f!==32&&(u=!0),d++;continue}let p=d,m=0;for(;d<t;){if(f=e.charCodeAt(d),f<=32){if(f===32)break;if(f>=9&&f<=13){u=!0;break}}else if(f>=160&&de(f)){u=!0;break}m=Math.imul(m^f,16777619),d++}let h=d,g=h-p;n===Ue&&Ze();let _=n++;Ge[_]=p,Ke[_]=h,c+=g,m^=Math.imul(g,2654435761);let v=m^m>>>15|0,y=v&8190;{let t=-1;if(Fe[y]===v&&Ie[y]!==null&&Ie[y].length===g?t=y:Fe[y|1]===v&&Ie[y|1]!==null&&Ie[y|1].length===g&&(t=y|1),t>=0){let n=Ie[t],r=!0;for(let t=0;t<g;t++)if(n.charCodeAt(t)!==e.charCodeAt(p+t)){r=!1;break}if(r){qe[_]=Le[t],Je[_]=Re[t],Ye[_]=ze[t];continue}}}let b=p;if(B!==0){if(h-p<=B||!e.startsWith(te,p)){qe[_]=_R,Ve(y,e,p,h,v,_R,0,0);continue}b=p+B}let x=0,S=0,C=-1,w=-1;for(let t=b;t<h;t++){let n=e.charCodeAt(t);if(x===0&&S===0){if(n===58){C=t;continue}if(n===47){w=t;continue}}n===91?x++:n===93?x--:n===40?S++:n===41&&S--}let T=C>=b?C+1:b,E=T,D=h,O=!1,k=0;D>E&&e.charCodeAt(D-1)===33?(O=!0,D--):D>E&&e.charCodeAt(E)===33&&(O=!0,E++,k=1);let A=-1;w>T&&(A=w+k,A>=D&&(A=-1));let M=E;D-E>1&&e.charCodeAt(E)===45&&(M=E+1);let P=0,F=0,I=0,L=-1,R=0;(l[0]>=0||N[0]===1)&&($e[0]=0,et[0]=M,R=1);let z=vR,ee=0;for(let t=M;t<D;t++)if(t===A&&(z=F<I?vR:P,ee=R),P!==vR){let n=e.charCodeAt(t),r=-1;if(F<I)o.charCodeAt(F)===n?(F++,F===I&&(r=P=L)):P=vR;else{let e=i[P],t=i[P+1],c=vR;for(let i=e;i<t;i++){let e=a[i];if(o.charCodeAt(e)===n){a[i+1]-e===1?r=c=s[i]:(F=e+1,I=a[i+1],L=s[i],c=P);break}}P=c}if(r>=0&&(l[r]>=0||N[r]===1)&&t+1<D&&e.charCodeAt(t+1)===45){if(R===Qe){Qe*=2;let e=new Int32Array(Qe);e.set($e),$e=e;let t=new Int32Array(Qe);t.set(et),et=t}$e[R]=r,et[R]=t+2,R++}}A===D&&(z=F<I?vR:P,ee=R);let ne=F<I?vR:P,re,V=!1;if(A>=0){if(V=!0,re=ct(e,E,A,z,ee),re!==_R&&re<r&&j[re]){let t=ct(e,E,D,ne,R);t!==_R&&t!==re&&(re=t,V=!1)}else re===_R&&(re=ct(e,E,D,ne,R),V=!1)}else re=ct(e,E,D,ne,R);let H=0,ie=0;re===_R?qe[_]=_R:(ie=+!!V,H=b>=C?+!!O:Ce(we,e,b,C,+!!O,e=>Oe(e,O)),qe[_]=re,Ye[_]=ie,Je[_]=H),Ve(y,e,p,h,v,re,H,ie)}if(n===0)return``;if(n===1)return Ge[0]===0&&Ke[0]===t?e:e.slice(Ge[0],Ke[0]);if(n*k>nt){for(;n*k>nt;)nt<<=1,rt--;it=new Float64Array(nt),at=new Int32Array(nt)}if(Ee>=Ne||Ae>=Ne)throw Error(`cn: too many distinct classes in one merge`);ot=ot+1|0,ot===0&&(tt.fill(0),at.fill(0),ot=1);let f=!1;for(let e=n-1;e>=0;e--){let t=qe[e];if(t===_R){Xe[e]=1;continue}let n=Je[e];if(st(n,t)===1){Xe[e]=0,f=!0;continue}if(Xe[e]=1,t<r){let r=D[t];if(r>=0)for(let e=b[r];e<b[r+1];e++)st(n,x[e]);if(Ye[e]&1)for(let e=0;e<S.length;e++)S[e]===t&&st(n,C[e])}}if(!f&&!u&&t===c+n-1)return e;let p=``,m=0;for(;m<n;){if(!Xe[m]){m++;continue}let t=Ge[m],r=Ke[m],i=m+1;for(;i<n&&Xe[i]&&Ge[i]===r+1&&e.charCodeAt(r)===32;)r=Ke[i],i++;p.length>0&&(p+=` `),p+=e.slice(t,r),m=i}return p},ut=16384,dt=new Int32Array(ut*2),ft=0,pt=1,mt=Object.create(null),ht=Object.create(null),gt=new Map,_t=new Map,vt=0,yt=0,bt=()=>{ft^=ut,pt=pt+1|0,yt=0},xt=e=>{let t=mt[e];if(t!==void 0)return t;let n=bR(e,0,e.length),r=(n&16383)+ft,i=dt[r]===(n^pt)||dt[r^ut]===(n^pt-1);return i&&(t=ht[e],t!==void 0)?(mt[e]=t,t):(t=lt(e),i?(mt[e]=t,++vt>z&&(vt=0,ht=mt,mt=Object.create(null),bt())):(dt[r]=n^pt,++yt>ut&&bt()),t)},St=e=>{let t=gt.get(e);if(t!==void 0)return t;let n=bR(e,0,e.length),r=(n&16383)+ft,i=dt[r]===(n^pt)||dt[r^ut]===(n^pt-1);return i&&(t=_t.get(e),t!==void 0)?(gt.set(e,t),t):(t=lt(e),i?(gt.set(e,t),++vt>z&&(vt=0,_t=gt,gt=new Map,bt())):(dt[r]=n^pt,++yt>ut&&bt()),t)},Ct=e=>{let t=bR(e,0,e.length),n=(t&16383)+ft;return dt[n]===(t^pt)||dt[n^ut]===(t^pt-1)||(dt[n]=t^pt,++yt>ut&&bt(),!1)},wt=z===0?lt:gR?e=>{let t=gt.get(e);return t===void 0?St(e):t}:xt;return{merge:function(){return arguments.length===1&&typeof arguments[0]==`string`?wt(arguments[0]):wt(wR.apply(null,arguments))},mergeString:wt,seenBefore:z===0?()=>!1:Ct,mergeUncached:lt}},SR=(e,t)=>{if(!e)return``;if(typeof e==`string`)return e;let n=``;if(typeof e.length==`number`&&(!t||Array.isArray(e))){let r=e;for(let e=0;e<r.length;e++){let i=r[e];if(!i)continue;let a=typeof i==`string`?i:SR(i,t);a&&(n&&(n+=` `),n+=a)}return n}if(t){if(typeof e==`number`)return``+e;if(typeof e==`object`)for(let t in e)e[t]&&(n&&(n+=` `),n+=t)}return n},CR=(e,t)=>{let n=``;for(let r=0;r<e.length;r++){let i=e[r];if(!i)continue;let a=typeof i==`string`?i:SR(i,t);a&&(n&&(n+=` `),n+=a)}return n},wR=function(){return CR(arguments,!1)},TR=(e,t)=>{let n=t===void 0?()=>!0:t.seenBefore,r=t===void 0?e:t.mergeUncached,i=new Map,a=new Map,o=0,s=null,c=(e,t,n,r)=>{let i=0;if(t){if(t!==e.a0)return!1;i=1}if(n){if(n!==(i===0?e.a0:e.a1))return!1;i++}if(r){if(r!==(i===0?e.a0:i===1?e.a1:e.a2))return!1;i++}return i===e.t},l=(e,t)=>{let n=e.a,r=0;for(let e=0;e<t.length;e++){let i=t[e];if(i){if(i!==n[r])return!1;r++}}return r===e.t},u=(t,c)=>{let u=t.length,d=s===null?null:s.n;if(!c){if(d!==null&&l(d,t))return s=d,d.r;if(s!==null&&s!==d&&l(s,t))return s.r}let f=``,p=-1,m=0,h=!1;for(let e=0;e<u;e++){let n=t[e];if(n){if(typeof n!=`string`){if(n=t[e]=SR(n,!0),!n)continue;h=!0}p<0&&(f=n,p=e),m++}}if(m===0)return``;if(m===1)return e(f);if(h){if(d!==null&&l(d,t))return s=d,d.r;if(s!==null&&s!==d&&l(s,t))return s.r}let g=i.get(f);g===void 0&&(g=a.get(f),g!==void 0&&i.set(f,g));let _=null;if(g!==void 0)outer:for(let e=0;e<g.length;e++){let n=g[e];if(n.t!==m)continue;let r=n.a,i=1;for(let e=p+1;e<u;e++){let n=t[e];if(n&&n!==r[i++])continue outer}_=n;break}if(_===null){let s=f,c=[f];for(let e=p+1;e<u;e++){let n=t[e];n&&(s+=` `+n,c.push(n))}if(!n(s))return r(s);_={r:e(s),t:c.length,a0:c[0],a1:c[1],a2:c[2]??``,a:c,n:null},g===void 0&&i.set(f,g=[]),g.length>=256&&g.shift(),g.push(_),++o>1e3&&(o=0,a=i,i=new Map)}return s!==null&&s!==_&&(s.n=_),s=_,_.r},d=t=>Array.isArray(t)?u(t.slice(),!1):e(SR(t,!0));return function(t,n,r){let i=arguments.length;if((i|1)==3){let e=s;if(e!==null){let i=e.n;if(i!==null&&c(i,t,n,r))return s=i,i.r;if(e!==i&&c(e,t,n,r))return e.r}return u([t,n,r],!0)}if(i===1)return typeof t==`string`?e(t):d(t);let a=s;if(a!==null){let e=a.n;if(e!==null){let t=e.a,n=0,r=!0;for(let e=0;e<i;e++){let i=arguments[e];if(i){if(i!==t[n]){r=!1;break}n++}}if(r&&n===e.t)return s=e,e.r}if(a!==e){let e=a.a,t=0,n=!0;for(let r=0;r<i;r++){let i=arguments[r];if(i){if(i!==e[t]){n=!1;break}t++}}if(n&&t===a.t)return a.r}}let o=[];for(let e=0;e<i;e++)o.push(arguments[e]);return u(o,!0)}},ER=`{"theme":{"animate":[{"$v":"isAny"}],"aspect":["video"],"blur":[{"$v":"isTshirtSize"}],"breakpoint":[{"$v":"isTshirtSize"}],"color":[{"$v":"isAny"}],"container":[{"$v":"isTshirtSize"}],"drop-shadow":[{"$v":"isTshirtSize"}],"ease":["in","out","in-out"],"font":[{"$v":"isAnyNonArbitrary"}],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[{"$v":"isTshirtSize"}],"leading":["none","tight","snug","normal","relaxed","loose"],"perspective":["dramatic","near","normal","midrange","distant","none"],"radius":[{"$v":"isTshirtSize"}],"shadow":[{"$v":"isTshirtSize"}],"spacing":["px",{"$v":"isNumber"}],"text":[{"$v":"isTshirtSize"}],"text-shadow":[{"$v":"isTshirtSize"}],"tracking":["tighter","tight","normal","wide","wider","widest"]},"classGroups":{"aspect":[{"aspect":["auto","square",{"$v":"isFraction"},{"$v":"isArbitraryValue"},{"$v":"isArbitraryVariable"},{"$t":"aspect"}]}],"container":["container"],"container-type":[{"@container":["","normal","size",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"container-named":[{"$v":"isNamedContainerQuery"}],"columns":[{"columns":[{"$v":"isNumber"},{"$v":"isArbitraryValue"},{"$v":"isArbitraryVariable"},{"$t":"container"}]},"columns-auto"],"break-after":[{"break-after":["auto","avoid","all","avoid-page","page","left","right","column"]}],"break-before":[{"break-before":["auto","avoid","all","avoid-page","page","left","right","column"]}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],"box":[{"box":["border","content"]}],"display":["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],"sr":["sr-only","not-sr-only"],"float":[{"float":["right","left","none","start","end"]}],"clear":[{"clear":["left","right","both","none","start","end"]}],"isolation":["isolate","isolation-auto"],"object-fit":[{"object":["contain","cover","fill","none","scale-down"]}],"object-position":[{"object":["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"overflow":[{"overflow":["auto","hidden","clip","visible","scroll"]}],"overflow-x":[{"overflow-x":["auto","hidden","clip","visible","scroll"]}],"overflow-y":[{"overflow-y":["auto","hidden","clip","visible","scroll"]}],"overscroll":[{"overscroll":["auto","contain","none"]}],"overscroll-x":[{"overscroll-x":["auto","contain","none"]}],"overscroll-y":[{"overscroll-y":["auto","contain","none"]}],"position":["static","fixed","absolute","relative","sticky"],"inset":[{"inset":[{"$v":"isFraction"},"full","auto",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"inset-x":[{"inset-x":[{"$v":"isFraction"},"full","auto",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"inset-y":[{"inset-y":[{"$v":"isFraction"},"full","auto",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"start":[{"inset-s":[{"$v":"isFraction"},"full","auto",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}],"start":[{"$v":"isFraction"},"full","auto",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"end":[{"inset-e":[{"$v":"isFraction"},"full","auto",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}],"end":[{"$v":"isFraction"},"full","auto",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"inset-bs":[{"inset-bs":[{"$v":"isFraction"},"full","auto",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"inset-be":[{"inset-be":[{"$v":"isFraction"},"full","auto",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"top":[{"top":[{"$v":"isFraction"},"full","auto",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"right":[{"right":[{"$v":"isFraction"},"full","auto",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"bottom":[{"bottom":[{"$v":"isFraction"},"full","auto",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"left":[{"left":[{"$v":"isFraction"},"full","auto",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"visibility":["visible","invisible","collapse"],"z":[{"z":[{"$v":"isInteger"},"auto",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"basis":[{"basis":[{"$v":"isFraction"},"full","auto",{"$t":"container"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"flex-direction":[{"flex":["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{"flex":["nowrap","wrap","wrap-reverse"]}],"flex":[{"flex":[{"$v":"isNumber"},{"$v":"isFraction"},"auto","initial","none",{"$v":"isArbitraryValue"}]}],"grow":[{"grow":["",{"$v":"isNumber"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"shrink":[{"shrink":["",{"$v":"isNumber"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"order":[{"order":[{"$v":"isInteger"},"first","last","none",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"grid-cols":[{"grid-cols":[{"$v":"isInteger"},"none","subgrid",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"col-start-end":[{"col":["auto",{"span":["full",{"$v":"isInteger"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]},{"$v":"isInteger"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"col-start":[{"col-start":[{"$v":"isInteger"},"auto",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"col-end":[{"col-end":[{"$v":"isInteger"},"auto",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"grid-rows":[{"grid-rows":[{"$v":"isInteger"},"none","subgrid",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"row-start-end":[{"row":["auto",{"span":["full",{"$v":"isInteger"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]},{"$v":"isInteger"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"row-start":[{"row-start":[{"$v":"isInteger"},"auto",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"row-end":[{"row-end":[{"$v":"isInteger"},"auto",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]},{"auto-cols":[{"$t":"spacing"}]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]},{"auto-rows":[{"$t":"spacing"}]}],"gap":[{"gap":[{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"gap-x":[{"gap-x":[{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"gap-y":[{"gap-y":[{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"justify-content":[{"justify":["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe","normal"]}],"justify-items":[{"justify-items":["start","end","center","stretch","center-safe","end-safe","normal"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch","center-safe","end-safe"]}],"align-content":[{"content":["normal","start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"]}],"align-items":[{"items":["start","end","center","stretch","center-safe","end-safe",{"baseline":["","last"]}]}],"align-self":[{"self":["auto","start","end","center","stretch","center-safe","end-safe",{"baseline":["","last"]}]}],"place-content":[{"place-content":["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"]}],"place-items":[{"place-items":["start","end","center","stretch","center-safe","end-safe","baseline"]}],"place-self":[{"place-self":["auto","start","end","center","stretch","center-safe","end-safe"]}],"p":[{"p":[{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"px":[{"px":[{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"py":[{"py":[{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"ps":[{"ps":[{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"pe":[{"pe":[{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"pbs":[{"pbs":[{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"pbe":[{"pbe":[{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"pt":[{"pt":[{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"pr":[{"pr":[{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"pb":[{"pb":[{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"pl":[{"pl":[{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"m":[{"m":["auto",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"mx":[{"mx":["auto",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"my":[{"my":["auto",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"ms":[{"ms":["auto",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"me":[{"me":["auto",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"mbs":[{"mbs":["auto",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"mbe":[{"mbe":["auto",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"mt":[{"mt":["auto",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"mr":[{"mr":["auto",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"mb":[{"mb":["auto",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"ml":[{"ml":["auto",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"space-x":[{"space-x":[{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"space-y-reverse":["space-y-reverse"],"size":[{"size":[{"$v":"isFraction"},"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"inline-size":[{"inline":["auto",{"$v":"isFraction"},"screen","full","dvw","lvw","svw","min","max","fit",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]},{"inline":[{"$t":"container"}]}],"min-inline-size":[{"min-inline":["auto",{"$v":"isFraction"},"screen","full","dvw","lvw","svw","min","max","fit",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]},{"min-inline":[{"$t":"container"}]}],"max-inline-size":[{"max-inline":["none",{"$v":"isFraction"},"screen","full","dvw","lvw","svw","min","max","fit",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]},{"max-inline":[{"$t":"container"}]}],"block-size":[{"block":["auto",{"$v":"isFraction"},"screen","full","lh","dvh","lvh","svh","min","max","fit",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"min-block-size":[{"min-block":["auto",{"$v":"isFraction"},"screen","full","lh","dvh","lvh","svh","min","max","fit",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"max-block-size":[{"max-block":["none",{"$v":"isFraction"},"screen","full","lh","dvh","lvh","svh","min","max","fit",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"w":[{"w":[{"$t":"container"},"screen",{"$v":"isFraction"},"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"min-w":[{"min-w":[{"$t":"container"},"screen","none",{"$v":"isFraction"},"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"max-w":[{"max-w":[{"$t":"container"},"screen","none","prose",{"screen":[{"$t":"breakpoint"}]},{"$v":"isFraction"},"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"h":[{"h":["screen","lh",{"$v":"isFraction"},"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"min-h":[{"min-h":["screen","lh","none",{"$v":"isFraction"},"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"max-h":[{"max-h":["screen","lh",{"$v":"isFraction"},"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]},"max-h-none"],"font-size":[{"text":["base",{"$t":"text"},{"$v":"isArbitraryVariableLength"},{"$v":"isArbitraryLength"}]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{"font":[{"$t":"font-weight"},{"$v":"isArbitraryVariableWeight"},{"$v":"isArbitraryWeight"}]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",{"$v":"isPercent"},{"$v":"isArbitraryValue"}]}],"font-family":[{"font":[{"$v":"isArbitraryVariableFamilyName"},{"$v":"isArbitraryFamilyName"},{"$t":"font"}]}],"font-features":[{"font-features":[{"$v":"isArbitraryValue"}]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],"tracking":[{"tracking":[{"$t":"tracking"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"line-clamp":[{"line-clamp":[{"$v":"isNumber"},"none",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryNumber"}]}],"leading":[{"leading":[{"$t":"leading"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"list-image":[{"list-image":["none",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"list-style-position":[{"list":["inside","outside"]}],"list-style-type":[{"list":["disc","decimal","none",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"text-alignment":[{"text":["left","center","right","justify","start","end"]}],"placeholder-color":[{"placeholder":[{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"text-color":[{"text":[{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{"decoration":["solid","dashed","dotted","double","wavy"]}],"text-decoration-thickness":[{"decoration":[{"$v":"isNumber"},"from-font","auto",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryLength"}]}],"text-decoration-color":[{"decoration":[{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"underline-offset":[{"underline-offset":[{"$v":"isNumber"},"auto",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{"text":["wrap","nowrap","balance","pretty"]}],"indent":[{"indent":[{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"tab-size":[{"tab":[{"$v":"isInteger"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"vertical-align":[{"align":["baseline","top","middle","bottom","text-top","text-bottom","sub","super",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"whitespace":[{"whitespace":["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],"break":[{"break":["normal","words","all","keep"]}],"wrap":[{"wrap":["break-word","anywhere","normal"]}],"hyphens":[{"hyphens":["none","manual","auto"]}],"content":[{"content":["none",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"bg-attachment":[{"bg":["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{"bg":["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom",{"$v":"isArbitraryVariablePosition"},{"$v":"isArbitraryPosition"},{"position":[{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}]}],"bg-repeat":[{"bg":["no-repeat",{"repeat":["","x","y","space","round"]}]}],"bg-size":[{"bg":["auto","cover","contain",{"$v":"isArbitraryVariableSize"},{"$v":"isArbitrarySize"},{"size":[{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}]}],"bg-image":[{"bg":["none",{"linear":[{"to":["t","tr","r","br","b","bl","l","tl"]},{"$v":"isInteger"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}],"radial":["",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}],"conic":[{"$v":"isInteger"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]},{"$v":"isArbitraryVariableImage"},{"$v":"isArbitraryImage"}]},{"bg-gradient-to":["t","tr","r","br","b","bl","l","tl"]},"bg-conic"],"bg-color":[{"bg":[{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"gradient-from-pos":[{"from":[{"$v":"isPercent"},{"$v":"isArbitraryVariableLength"},{"$v":"isArbitraryLength"}]}],"gradient-via-pos":[{"via":[{"$v":"isPercent"},{"$v":"isArbitraryVariableLength"},{"$v":"isArbitraryLength"}]}],"gradient-to-pos":[{"to":[{"$v":"isPercent"},{"$v":"isArbitraryVariableLength"},{"$v":"isArbitraryLength"}]}],"gradient-from":[{"from":[{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"gradient-via":[{"via":[{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"gradient-to":[{"to":[{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"rounded":[{"rounded":["","none","full",{"$t":"radius"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"rounded-s":[{"rounded-s":["","none","full",{"$t":"radius"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"rounded-e":[{"rounded-e":["","none","full",{"$t":"radius"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"rounded-t":[{"rounded-t":["","none","full",{"$t":"radius"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"rounded-r":[{"rounded-r":["","none","full",{"$t":"radius"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"rounded-b":[{"rounded-b":["","none","full",{"$t":"radius"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"rounded-l":[{"rounded-l":["","none","full",{"$t":"radius"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"rounded-ss":[{"rounded-ss":["","none","full",{"$t":"radius"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"rounded-se":[{"rounded-se":["","none","full",{"$t":"radius"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"rounded-ee":[{"rounded-ee":["","none","full",{"$t":"radius"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"rounded-es":[{"rounded-es":["","none","full",{"$t":"radius"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"rounded-tl":[{"rounded-tl":["","none","full",{"$t":"radius"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"rounded-tr":[{"rounded-tr":["","none","full",{"$t":"radius"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"rounded-br":[{"rounded-br":["","none","full",{"$t":"radius"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"rounded-bl":[{"rounded-bl":["","none","full",{"$t":"radius"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"border-w":[{"border":["",{"$v":"isNumber"},{"$v":"isArbitraryVariableLength"},{"$v":"isArbitraryLength"}]}],"border-w-x":[{"border-x":["",{"$v":"isNumber"},{"$v":"isArbitraryVariableLength"},{"$v":"isArbitraryLength"}]}],"border-w-y":[{"border-y":["",{"$v":"isNumber"},{"$v":"isArbitraryVariableLength"},{"$v":"isArbitraryLength"}]}],"border-w-s":[{"border-s":["",{"$v":"isNumber"},{"$v":"isArbitraryVariableLength"},{"$v":"isArbitraryLength"}]}],"border-w-e":[{"border-e":["",{"$v":"isNumber"},{"$v":"isArbitraryVariableLength"},{"$v":"isArbitraryLength"}]}],"border-w-bs":[{"border-bs":["",{"$v":"isNumber"},{"$v":"isArbitraryVariableLength"},{"$v":"isArbitraryLength"}]}],"border-w-be":[{"border-be":["",{"$v":"isNumber"},{"$v":"isArbitraryVariableLength"},{"$v":"isArbitraryLength"}]}],"border-w-t":[{"border-t":["",{"$v":"isNumber"},{"$v":"isArbitraryVariableLength"},{"$v":"isArbitraryLength"}]}],"border-w-r":[{"border-r":["",{"$v":"isNumber"},{"$v":"isArbitraryVariableLength"},{"$v":"isArbitraryLength"}]}],"border-w-b":[{"border-b":["",{"$v":"isNumber"},{"$v":"isArbitraryVariableLength"},{"$v":"isArbitraryLength"}]}],"border-w-l":[{"border-l":["",{"$v":"isNumber"},{"$v":"isArbitraryVariableLength"},{"$v":"isArbitraryLength"}]}],"divide-x":[{"divide-x":["",{"$v":"isNumber"},{"$v":"isArbitraryVariableLength"},{"$v":"isArbitraryLength"}]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":["",{"$v":"isNumber"},{"$v":"isArbitraryVariableLength"},{"$v":"isArbitraryLength"}]}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{"border":["solid","dashed","dotted","double","hidden","none"]}],"divide-style":[{"divide":["solid","dashed","dotted","double","hidden","none"]}],"border-color":[{"border":[{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"border-color-x":[{"border-x":[{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"border-color-y":[{"border-y":[{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"border-color-s":[{"border-s":[{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"border-color-e":[{"border-e":[{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"border-color-bs":[{"border-bs":[{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"border-color-be":[{"border-be":[{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"border-color-t":[{"border-t":[{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"border-color-r":[{"border-r":[{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"border-color-b":[{"border-b":[{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"border-color-l":[{"border-l":[{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"divide-color":[{"divide":[{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"outline-style":[{"outline":["solid","dashed","dotted","double","none","hidden"]}],"outline-offset":[{"outline-offset":[{"$v":"isNumber"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"outline-w":[{"outline":["",{"$v":"isNumber"},{"$v":"isArbitraryVariableLength"},{"$v":"isArbitraryLength"}]}],"outline-color":[{"outline":[{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"shadow":[{"shadow":["","none",{"$t":"shadow"},{"$v":"isArbitraryVariableShadow"},{"$v":"isArbitraryShadow"}]},"shadow-inner"],"shadow-color":[{"shadow":[{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"inset-shadow":[{"inset-shadow":["none",{"$t":"inset-shadow"},{"$v":"isArbitraryVariableShadow"},{"$v":"isArbitraryShadow"}]}],"inset-shadow-color":[{"inset-shadow":[{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"ring-w":[{"ring":["",{"$v":"isNumber"},{"$v":"isArbitraryVariableLength"},{"$v":"isArbitraryLength"}]}],"ring-w-inset":["ring-inset"],"ring-color":[{"ring":[{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"ring-offset-w":[{"ring-offset":[{"$v":"isNumber"},{"$v":"isArbitraryLength"}]}],"ring-offset-color":[{"ring-offset":[{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"inset-ring-w":[{"inset-ring":["",{"$v":"isNumber"},{"$v":"isArbitraryVariableLength"},{"$v":"isArbitraryLength"}]}],"inset-ring-color":[{"inset-ring":[{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"text-shadow":[{"text-shadow":["none",{"$t":"text-shadow"},{"$v":"isArbitraryVariableShadow"},{"$v":"isArbitraryShadow"}]}],"text-shadow-color":[{"text-shadow":[{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"opacity":[{"opacity":[{"$v":"isNumber"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"mix-blend":[{"mix-blend":["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity","plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"]}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{"mask":["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[{"$v":"isNumber"}]}],"mask-image-linear-from-pos":[{"mask-linear-from":[{"$v":"isNumber"},{"$v":"isPercent"},{"$v":"isArbitraryVariablePosition"},{"$v":"isArbitraryPosition"}]}],"mask-image-linear-to-pos":[{"mask-linear-to":[{"$v":"isNumber"},{"$v":"isPercent"},{"$v":"isArbitraryVariablePosition"},{"$v":"isArbitraryPosition"}]}],"mask-image-linear-from-color":[{"mask-linear-from":[{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"mask-image-linear-to-color":[{"mask-linear-to":[{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"mask-image-t-from-pos":[{"mask-t-from":[{"$v":"isNumber"},{"$v":"isPercent"},{"$v":"isArbitraryVariablePosition"},{"$v":"isArbitraryPosition"}]}],"mask-image-t-to-pos":[{"mask-t-to":[{"$v":"isNumber"},{"$v":"isPercent"},{"$v":"isArbitraryVariablePosition"},{"$v":"isArbitraryPosition"}]}],"mask-image-t-from-color":[{"mask-t-from":[{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"mask-image-t-to-color":[{"mask-t-to":[{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"mask-image-r-from-pos":[{"mask-r-from":[{"$v":"isNumber"},{"$v":"isPercent"},{"$v":"isArbitraryVariablePosition"},{"$v":"isArbitraryPosition"}]}],"mask-image-r-to-pos":[{"mask-r-to":[{"$v":"isNumber"},{"$v":"isPercent"},{"$v":"isArbitraryVariablePosition"},{"$v":"isArbitraryPosition"}]}],"mask-image-r-from-color":[{"mask-r-from":[{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"mask-image-r-to-color":[{"mask-r-to":[{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"mask-image-b-from-pos":[{"mask-b-from":[{"$v":"isNumber"},{"$v":"isPercent"},{"$v":"isArbitraryVariablePosition"},{"$v":"isArbitraryPosition"}]}],"mask-image-b-to-pos":[{"mask-b-to":[{"$v":"isNumber"},{"$v":"isPercent"},{"$v":"isArbitraryVariablePosition"},{"$v":"isArbitraryPosition"}]}],"mask-image-b-from-color":[{"mask-b-from":[{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"mask-image-b-to-color":[{"mask-b-to":[{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"mask-image-l-from-pos":[{"mask-l-from":[{"$v":"isNumber"},{"$v":"isPercent"},{"$v":"isArbitraryVariablePosition"},{"$v":"isArbitraryPosition"}]}],"mask-image-l-to-pos":[{"mask-l-to":[{"$v":"isNumber"},{"$v":"isPercent"},{"$v":"isArbitraryVariablePosition"},{"$v":"isArbitraryPosition"}]}],"mask-image-l-from-color":[{"mask-l-from":[{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"mask-image-l-to-color":[{"mask-l-to":[{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"mask-image-x-from-pos":[{"mask-x-from":[{"$v":"isNumber"},{"$v":"isPercent"},{"$v":"isArbitraryVariablePosition"},{"$v":"isArbitraryPosition"}]}],"mask-image-x-to-pos":[{"mask-x-to":[{"$v":"isNumber"},{"$v":"isPercent"},{"$v":"isArbitraryVariablePosition"},{"$v":"isArbitraryPosition"}]}],"mask-image-x-from-color":[{"mask-x-from":[{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"mask-image-x-to-color":[{"mask-x-to":[{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"mask-image-y-from-pos":[{"mask-y-from":[{"$v":"isNumber"},{"$v":"isPercent"},{"$v":"isArbitraryVariablePosition"},{"$v":"isArbitraryPosition"}]}],"mask-image-y-to-pos":[{"mask-y-to":[{"$v":"isNumber"},{"$v":"isPercent"},{"$v":"isArbitraryVariablePosition"},{"$v":"isArbitraryPosition"}]}],"mask-image-y-from-color":[{"mask-y-from":[{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"mask-image-y-to-color":[{"mask-y-to":[{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"mask-image-radial":[{"mask-radial":[{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"mask-image-radial-from-pos":[{"mask-radial-from":[{"$v":"isNumber"},{"$v":"isPercent"},{"$v":"isArbitraryVariablePosition"},{"$v":"isArbitraryPosition"}]}],"mask-image-radial-to-pos":[{"mask-radial-to":[{"$v":"isNumber"},{"$v":"isPercent"},{"$v":"isArbitraryVariablePosition"},{"$v":"isArbitraryPosition"}]}],"mask-image-radial-from-color":[{"mask-radial-from":[{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"mask-image-radial-to-color":[{"mask-radial-to":[{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{"closest":["side","corner"],"farthest":["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"]}],"mask-image-conic-pos":[{"mask-conic":[{"$v":"isNumber"}]}],"mask-image-conic-from-pos":[{"mask-conic-from":[{"$v":"isNumber"},{"$v":"isPercent"},{"$v":"isArbitraryVariablePosition"},{"$v":"isArbitraryPosition"}]}],"mask-image-conic-to-pos":[{"mask-conic-to":[{"$v":"isNumber"},{"$v":"isPercent"},{"$v":"isArbitraryVariablePosition"},{"$v":"isArbitraryPosition"}]}],"mask-image-conic-from-color":[{"mask-conic-from":[{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"mask-image-conic-to-color":[{"mask-conic-to":[{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"mask-mode":[{"mask":["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{"mask":["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom",{"$v":"isArbitraryVariablePosition"},{"$v":"isArbitraryPosition"},{"position":[{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}]}],"mask-repeat":[{"mask":["no-repeat",{"repeat":["","x","y","space","round"]}]}],"mask-size":[{"mask":["auto","cover","contain",{"$v":"isArbitraryVariableSize"},{"$v":"isArbitrarySize"},{"size":[{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}]}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{"mask":["none",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"filter":[{"filter":["","none",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"blur":[{"blur":["","none",{"$t":"blur"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"brightness":[{"brightness":[{"$v":"isNumber"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"contrast":[{"contrast":[{"$v":"isNumber"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"drop-shadow":[{"drop-shadow":["","none",{"$t":"drop-shadow"},{"$v":"isArbitraryVariableShadow"},{"$v":"isArbitraryShadow"}]}],"drop-shadow-color":[{"drop-shadow":[{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"grayscale":[{"grayscale":["",{"$v":"isNumber"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"hue-rotate":[{"hue-rotate":[{"$v":"isNumber"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"invert":[{"invert":["",{"$v":"isNumber"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"saturate":[{"saturate":[{"$v":"isNumber"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"sepia":[{"sepia":["",{"$v":"isNumber"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"backdrop-filter":[{"backdrop-filter":["","none",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"backdrop-blur":[{"backdrop-blur":["","none",{"$t":"blur"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"backdrop-brightness":[{"backdrop-brightness":[{"$v":"isNumber"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"backdrop-contrast":[{"backdrop-contrast":[{"$v":"isNumber"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"backdrop-grayscale":[{"backdrop-grayscale":["",{"$v":"isNumber"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[{"$v":"isNumber"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"backdrop-invert":[{"backdrop-invert":["",{"$v":"isNumber"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"backdrop-opacity":[{"backdrop-opacity":[{"$v":"isNumber"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"backdrop-saturate":[{"backdrop-saturate":[{"$v":"isNumber"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"backdrop-sepia":[{"backdrop-sepia":["",{"$v":"isNumber"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"border-collapse":[{"border":["collapse","separate"]}],"border-spacing":[{"border-spacing":[{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"border-spacing-x":[{"border-spacing-x":[{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"border-spacing-y":[{"border-spacing-y":[{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"table-layout":[{"table":["auto","fixed"]}],"caption":[{"caption":["top","bottom"]}],"transition":[{"transition":["","all","colors","opacity","shadow","transform","none",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"transition-behavior":[{"transition":["normal","discrete"]}],"duration":[{"duration":[{"$v":"isNumber"},"initial",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"ease":[{"ease":["linear","initial",{"$t":"ease"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"delay":[{"delay":[{"$v":"isNumber"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"animate":[{"animate":["none",{"$t":"animate"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"backface":[{"backface":["hidden","visible"]}],"perspective":[{"perspective":[{"$t":"perspective"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"perspective-origin":[{"perspective-origin":["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"rotate":[{"rotate":["none",{"$v":"isNumber"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"rotate-x":[{"rotate-x":["none",{"$v":"isNumber"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"rotate-y":[{"rotate-y":["none",{"$v":"isNumber"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"rotate-z":[{"rotate-z":["none",{"$v":"isNumber"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"scale":[{"scale":["none",{"$v":"isNumber"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"scale-x":[{"scale-x":["none",{"$v":"isNumber"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"scale-y":[{"scale-y":["none",{"$v":"isNumber"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"scale-z":[{"scale-z":["none",{"$v":"isNumber"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"scale-3d":["scale-3d"],"skew":[{"skew":[{"$v":"isNumber"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"skew-x":[{"skew-x":[{"$v":"isNumber"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"skew-y":[{"skew-y":[{"$v":"isNumber"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"transform":[{"transform":[{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},"","none","gpu","cpu"]}],"transform-origin":[{"origin":["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"transform-style":[{"transform":["3d","flat"]}],"translate":[{"translate":[{"$v":"isFraction"},"full",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"translate-x":[{"translate-x":[{"$v":"isFraction"},"full",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"translate-y":[{"translate-y":[{"$v":"isFraction"},"full",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"translate-z":[{"translate-z":[{"$v":"isFraction"},"full",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"translate-none":["translate-none"],"zoom":[{"zoom":[{"$v":"isInteger"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"accent":[{"accent":[{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"appearance":[{"appearance":["none","auto"]}],"caret-color":[{"caret":[{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"color-scheme":[{"scheme":["normal","dark","light","light-dark","only-dark","only-light"]}],"cursor":[{"cursor":["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],"resize":[{"resize":["none","","y","x"]}],"scroll-behavior":[{"scroll":["auto","smooth"]}],"scrollbar-thumb-color":[{"scrollbar-thumb":[{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"scrollbar-track-color":[{"scrollbar-track":[{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"scrollbar-gutter":[{"scrollbar-gutter":["auto","stable","both"]}],"scrollbar-w":[{"scrollbar":["auto","thin","none"]}],"scroll-m":[{"scroll-m":[{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"scroll-mx":[{"scroll-mx":[{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"scroll-my":[{"scroll-my":[{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"scroll-ms":[{"scroll-ms":[{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"scroll-me":[{"scroll-me":[{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"scroll-mbs":[{"scroll-mbs":[{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"scroll-mbe":[{"scroll-mbe":[{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"scroll-mt":[{"scroll-mt":[{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"scroll-mr":[{"scroll-mr":[{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"scroll-mb":[{"scroll-mb":[{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"scroll-ml":[{"scroll-ml":[{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"scroll-p":[{"scroll-p":[{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"scroll-px":[{"scroll-px":[{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"scroll-py":[{"scroll-py":[{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"scroll-ps":[{"scroll-ps":[{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"scroll-pe":[{"scroll-pe":[{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"scroll-pbs":[{"scroll-pbs":[{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"scroll-pbe":[{"scroll-pbe":[{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"scroll-pt":[{"scroll-pt":[{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"scroll-pr":[{"scroll-pr":[{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"scroll-pb":[{"scroll-pb":[{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"scroll-pl":[{"scroll-pl":[{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"snap-align":[{"snap":["start","end","center","align-none"]}],"snap-stop":[{"snap":["normal","always"]}],"snap-type":[{"snap":["none","x","y","both"]}],"snap-strictness":[{"snap":["mandatory","proximity"]}],"touch":[{"touch":["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],"select":[{"select":["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"fill":[{"fill":["none",{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"stroke-w":[{"stroke":[{"$v":"isNumber"},{"$v":"isArbitraryVariableLength"},{"$v":"isArbitraryLength"},{"$v":"isArbitraryNumber"}]}],"stroke":[{"stroke":["none",{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}],"contain":[{"contain":["none","content","strict",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"contain-size":[{"contain":["size","inline-size"]}],"contain-layout":["contain-layout"],"contain-paint":["contain-paint"],"contain-style":["contain-style"]},"conflictingClassGroups":{"container-named":["container-type"],"overflow":["overflow-x","overflow-y"],"overscroll":["overscroll-x","overscroll-y"],"inset":["inset-x","inset-y","inset-bs","inset-be","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],"flex":["basis","grow","shrink"],"gap":["gap-x","gap-y"],"p":["px","py","ps","pe","pbs","pbe","pt","pr","pb","pl"],"px":["pr","pl"],"py":["pt","pb"],"m":["mx","my","ms","me","mbs","mbe","mt","mr","mb","ml"],"mx":["mr","ml"],"my":["mt","mb"],"size":["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],"rounded":["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-bs","border-w-be","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"translate":["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mbs","scroll-mbe","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pbs","scroll-pbe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],"touch":["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"],"contain":["contain-size","contain-layout","contain-paint","contain-style"],"contain-size":["contain"],"contain-layout":["contain"],"contain-paint":["contain"],"contain-style":["contain"]},"conflictingClassGroupModifiers":{"font-size":["leading"]},"orderSensitiveModifiers":["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"],"postfixLookupClassGroups":["container-type"]}`,DR=()=>JSON.parse(ER),OR=e=>`classGroups`in e&&`theme`in e&&`conflictingClassGroups`in e,kR=e=>e===void 0?{config:DR()}:typeof e==`function`?{config:e(DR())}:OR(e)?{config:e}:{config:iR(DR(),e),cacheSize:e.cacheSize},AR=e=>{let{config:t,cacheSize:n}=kR(e),{tables:r,validatorImpls:i,prefix:a}=hR(t);return xR(r,i,{cacheSize:n,prefix:a})},Q=(e=>{let t=null,n=()=>t??=AR(e);return TR(e=>n().mergeString(e),{seenBefore:e=>n().seenBefore(e),mergeUncached:e=>n().mergeUncached(e)})})({extend:{theme:{spacing:[...eL]}}});function jR(e,t){return typeof e==`function`?e(t):e}function MR(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}function NR(...e){return t=>{let n=!1,r=e.map(e=>{let r=MR(e,t);return!n&&typeof r==`function`&&(n=!0),r});if(n)return()=>{for(let t=0;t<r.length;t++){let n=r[t];typeof n==`function`?n():MR(e[t],null)}}}}function cee(...e){return G.useCallback(NR(...e),e)}function lee(e){let t=G.forwardRef((t,n)=>{let{children:r,...i}=t,a=null,o=!1,s=[];FR(r)&&typeof IR==`function`&&(r=IR(r._payload)),G.Children.forEach(r,e=>{if(mee(e)){o=!0;let t=e,n=`child`in t.props?t.props.child:t.props.children;FR(n)&&typeof IR==`function`&&(n=IR(n._payload)),a=dee(t,n),s.push(a?.props?.children)}else s.push(e)}),a?a=G.cloneElement(a,void 0,s):!o&&G.Children.count(r)===1&&G.isValidElement(r)&&(a=r);let c=a?pee(a):void 0,l=cee(n,c);if(!a){if(r||r===0)throw Error(o?vee(e):_ee(e));return r}let u=fee(i,a.props??{});return a.type!==G.Fragment&&(u.ref=n?l:c),G.cloneElement(a,u)});return t.displayName=`${e}.Slot`,t}var PR=lee(`Slot`),uee=Symbol.for(`radix.slottable`),dee=(e,t)=>{if(`child`in e.props){let t=e.props.child;return G.isValidElement(t)?G.cloneElement(t,void 0,e.props.children(t.props.children)):null}return G.isValidElement(t)?t:null};function fee(e,t){let n={...t};for(let r in t){let i=e[r],a=t[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(n[r]=i):r===`style`?n[r]={...i,...a}:r===`className`&&(n[r]=[i,a].filter(Boolean).join(` `))}return{...e,...n}}function pee(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function mee(e){return G.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===uee}var hee=Symbol.for(`react.lazy`);function FR(e){return typeof e==`object`&&!!e&&`$$typeof`in e&&e.$$typeof===hee&&`_payload`in e&&gee(e._payload)}function gee(e){return typeof e==`object`&&!!e&&`then`in e}var _ee=e=>`${e} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,vee=e=>`${e} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,IR=G.use,LR=(0,G.forwardRef)(function({asChild:e=!1,className:t,...n},r){let i=Q(`absolute h-px w-px overflow-hidden whitespace-nowrap border-0 p-0 [clip:rect(0,0,0,0)]`,t);return e?(0,Z.jsx)(PR,{...n,className:i,ref:r}):(0,Z.jsx)(`span`,{...n,className:i,ref:r})}),RR=Object.freeze({reduced:!1,squish:90,fast:120,normal:180,slow:280,springDuration:320,bounce:.3,stretch:.28,distance:4,stagger:24,blur:0,shake:3,steps:0,fuse:1,pressDepth:.5,pressScale:1,ease:`cubic-bezier(0.2, 0, 0, 1)`,easeExit:`cubic-bezier(0.4, 0, 1, 1)`}),zR=`(prefers-reduced-motion: reduce)`;function BR(e){let t=e.ownerDocument.defaultView;if(!t)return RR;let n=t.getComputedStyle(e),r=(e,t)=>{let r=n.getPropertyValue(e).trim(),i=Number.parseFloat(r);return Number.isFinite(i)?Math.max(0,i):t},i=(e,t)=>{let i=n.getPropertyValue(e).trim();return r(e,t)*(i.endsWith(`s`)&&!i.endsWith(`ms`)?1e3:1)},a=t.matchMedia?.(zR).matches??!1,o=(e,t)=>a?120:i(`--stipe-motion-${e}`,t),s=(e,t)=>a?0:r(`--stipe-motion-${e}`,t);return{reduced:a,squish:o(`squish`,RR.squish),fast:o(`fast`,RR.fast),normal:o(`normal`,RR.normal),slow:o(`slow`,RR.slow),springDuration:o(`spring-duration`,RR.springDuration),bounce:Math.min(1,s(`bounce`,RR.bounce)),stretch:s(`stretch`,RR.stretch),distance:s(`distance`,RR.distance),stagger:a?0:i(`--stipe-motion-stagger`,RR.stagger),blur:s(`blur`,RR.blur),shake:s(`shake`,RR.shake),steps:Math.floor(s(`steps`,RR.steps)),fuse:r(`--stipe-motion-fuse`,RR.fuse),pressDepth:a?0:r(`--stipe-press-depth`,RR.pressDepth),pressScale:a?1:r(`--stipe-press-scale`,RR.pressScale),ease:n.getPropertyValue(`--stipe-motion-ease`).trim()||RR.ease,easeExit:n.getPropertyValue(`--stipe-motion-ease-exit`).trim()||RR.easeExit}}function VR(e,t){let n=e.createElement(`div`);n.setAttribute(`style`,t??``);let r=new Map;for(let e of n.style)(e.startsWith(`--stipe-motion-`)||e.startsWith(`--stipe-press-`))&&r.set(e,n.style.getPropertyValue(e).trim());return r}function HR(e){let t=e.target;if(e.attributeName!==`style`||!(t instanceof Element))return!0;let n=t.ownerDocument,r=VR(n,e.oldValue),i=VR(n,t.getAttribute(`style`));return r.size!==i.size||[...i].some(([e,t])=>r.get(e)!==t)}function UR(e){let[t,n]=(0,G.useState)(()=>({...RR,reduced:!0}));return(0,G.useLayoutEffect)(()=>{let t=e.current,r=t?.ownerDocument.defaultView;if(!t||!r)return;let i=()=>{let e=BR(t);n(t=>JSON.stringify(t)===JSON.stringify(e)?t:e)};i();let a=new r.MutationObserver(e=>{e.some(HR)&&i()});for(let e=t;e;e=e.parentElement)a.observe(e,{attributes:!0,attributeFilter:[`data-theme`,`class`,`style`],attributeOldValue:!0});let o=r.matchMedia?.(zR);return o?.addEventListener(`change`,i),()=>{a.disconnect(),o?.removeEventListener(`change`,i)}},[e]),t}function WR(e,t){return e.reduced?0:Math.round(t*e.normal/RR.normal)}function GR(e,t){if(e.reduced)return 0;let n=t*e.bounce/RR.bounce;return Math.min(.9,Math.max(0,n))}function KR(e,t){return e.reduced?0:Math.round(t*e.springDuration/RR.springDuration)}function qR(e,t){return e.steps>0?`steps(${String(e.steps)}, end)`:t}function JR(e){return`animate`in e}var YR=globalThis;function XR(){return YR.matchMedia?.(zR).matches??!1}function ZR(e){let t=YR.matchMedia?.(zR);return t?.addEventListener(`change`,e),()=>{t?.removeEventListener(`change`,e)}}function QR(){return!0}function $R(){return(0,G.useSyncExternalStore)(ZR,XR,QR)}var ez=typeof window<`u`,tz=ez?window:null,nz=ez?document:null,rz={OBJECT:0,ATTRIBUTE:1,CSS:2,TRANSFORM:3,CSS_VAR:4},iz={NUMBER:0,UNIT:1,COLOR:2,COMPLEX:3},az={NONE:0,AUTO:1,FORCE:2},oz={replace:0,none:1,blend:2},sz=Symbol(),cz=Symbol(),lz=Symbol(),uz=Symbol(),dz=Symbol(),fz=1e-11,pz=0xe8d4a51000,mz=1e3,hz=[],gz=(()=>{let e=new Map;return e.set(`x`,`translateX`),e.set(`y`,`translateY`),e.set(`z`,`translateZ`),e})(),_z=[`perspective`,`translateX`,`translateY`,`translateZ`,`rotate`,`rotateX`,`rotateY`,`rotateZ`,`scale`,`scaleX`,`scaleY`,`scaleZ`,`skew`,`skewX`,`skewY`],vz=_z.reduce((e,t)=>({...e,[t]:t+`(`}),{}),yz=()=>{},bz=e=>e,xz=/\)\s*[-.\d]/,Sz=/(^#([\da-f]{3}){1,2}$)|(^#([\da-f]{4}){1,2}$)/i,Cz=/rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)/i,wz=/rgba\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*(-?\d+|-?\d*.\d+)\s*\)/i,Tz=/hsl\(\s*(-?\d+|-?\d*.\d+)\s*,\s*(-?\d+|-?\d*.\d+)%\s*,\s*(-?\d+|-?\d*.\d+)%\s*\)/i,Ez=/hsla\(\s*(-?\d+|-?\d*.\d+)\s*,\s*(-?\d+|-?\d*.\d+)%\s*,\s*(-?\d+|-?\d*.\d+)%\s*,\s*(-?\d+|-?\d*.\d+)\s*\)/i,Dz=/[-+]?\d*\.?\d+(?:e[-+]?\d)?/gi,Oz=/^([-+]?\d*\.?\d+(?:e[-+]?\d+)?)([a-z]+|%)$/i,kz=/([a-z])([A-Z])/g,Az=/var\(\s*(--[\w-]+)(?:\s*,\s*([^)]+))?\s*\)/,jz={id:null,keyframes:null,playbackEase:null,playbackRate:1,frameRate:240,loop:0,reversed:!1,alternate:!1,autoplay:!0,persist:!1,duration:mz,delay:0,loopDelay:0,ease:`out(2)`,composition:oz.replace,modifier:bz,onBegin:yz,onBeforeUpdate:yz,onUpdate:yz,onLoop:yz,onPause:yz,onComplete:yz,onRender:yz},Mz={current:null,root:nz},Nz={defaults:jz,precision:4,timeScale:1,tickThreshold:200,editor:null},Pz={version:`4.5.0`,engine:null};ez&&(tz.AnimeJS||=[],tz.AnimeJS.push(Pz));var Fz=e=>e.replace(kz,`$1-$2`).toLowerCase(),Iz=(e,t)=>e.indexOf(t)===0,Lz=Date.now,Rz=Array.isArray,zz=e=>e&&e.constructor===Object,Bz=e=>typeof e==`number`&&!isNaN(e),Vz=e=>typeof e==`string`,Hz=e=>typeof e==`function`,Uz=e=>e===void 0,Wz=e=>Uz(e)||e===null,Gz=e=>ez&&e instanceof SVGElement,Kz=e=>Sz.test(e),qz=e=>Iz(e,`rgb`),Jz=e=>Iz(e,`hsl`),Yz=e=>Kz(e)||(qz(e)||Jz(e))&&(e[e.length-1]===`)`||!xz.test(e)),Xz=e=>!Nz.defaults.hasOwnProperty(e),Zz=[`opacity`,`rotate`,`overflow`,`color`],Qz=(e,t)=>{if(Zz.includes(t))return!1;if(e.getAttribute(t)||t in e){if(t===`scale`){let t=e.parentNode;return t&&t.tagName===`filter`}return!0}},$z=Math.pow,eB=Math.sqrt,tB=Math.sin,nB=Math.cos,rB=Math.abs,iB=Math.exp,aB=Math.ceil,oB=Math.floor,sB=Math.asin,cB=Math.PI,lB=Math.round,uB=(e,t,n)=>e<t?t:e>n?n:e,dB=(e,t)=>{if(t<0)return e;if(!t)return lB(e);let n=10**t;return lB(e*n)/n},fB=(e,t,n)=>n===1?t:n===0?e:e+(t-e)*n,pB=e=>e===1/0?pz:e===-1/0?-pz:e,mB=e=>e<=1e-11?fz:pB(dB(e,11)),hB=e=>Rz(e)?[...e]:e,gB=(e,t)=>{let n={...e};for(let r in t){let i=e[r];n[r]=Uz(i)?t[r]:i}return n},_B=(e,t,n,r=`_prev`,i=`_next`)=>{let a=e._head,o=i;for(n&&(a=e._tail,o=r);a;){let e=a[o];t(a),a=e}},vB=(e,t,n=`_prev`,r=`_next`)=>{let i=t[n],a=t[r];i?i[r]=a:e._head=a,a?a[n]=i:e._tail=i,t[n]=null,t[r]=null},yB=(e,t,n,r=`_prev`,i=`_next`)=>{let a=e._tail;for(;a&&n&&n(a,t);)a=a[r];let o=a?a[i]:e._head;a?a[i]=t:e._head=t,o?o[r]=t:e._tail=t,t[r]=a,t[i]=o},bB=(e,t,n)=>{let r=e.style.transform;if(r){let i=e[uz],a=0,o=r.length,s;for(;a<o;){for(;a<o&&r.charCodeAt(a)===32;)a++;if(a>=o)break;let e=a;for(;a<o&&r.charCodeAt(a)!==40;)a++;if(a>=o)break;let t=r.substring(e,a),n=1,c=a+1,l=-1,u=-1;for(a++;a<o&&n>0;){let e=r.charCodeAt(a);e===40?n++:e===41?n--:e===44&&n===1&&(l===-1?l=a:u===-1&&(u=a)),a++}let d=a-1;t===`translate`||t===`translate3d`?(l===-1?i.translateX=r.substring(c,d).trim():(i.translateX=r.substring(c,l).trim(),u===-1?i.translateY=r.substring(l+1,d).trim():(i.translateY=r.substring(l+1,u).trim(),i.translateZ=r.substring(u+1,d).trim())),s=r.substring(c,d)):t===`scale`||t===`scale3d`?l===-1?i.scale=r.substring(c,d).trim():(i.scaleX=r.substring(c,l).trim(),u===-1?i.scaleY=r.substring(l+1,d).trim():(i.scaleY=r.substring(l+1,u).trim(),i.scaleZ=r.substring(u+1,d).trim())):i[t]=r.substring(c,d)}if(t===`translate3d`&&s)return n&&(n[t]=s),s;let c=i[t];if(!Uz(c))return n&&(n[t]=c),c}return t===`translate3d`?`0px, 0px, 0px`:t===`rotate3d`?`0, 0, 0, 0deg`:Iz(t,`scale`)?`1`:Iz(t,`rotate`)||Iz(t,`skew`)?`0deg`:`0px`},xB=e=>{let t=``;for(let n=0,r=_z.length;n<r;n++){let r=_z[n],i=e[r];if(i!==void 0){if(r===`translateX`){let r=e.translateY;if(r!==void 0){let a=e.translateZ;a===void 0?(t+=`translate(${i},${r}) `,n+=1):(t+=`translate3d(${i},${r},${a}) `,n+=2);continue}}if(r===`scaleX`&&e.scale===void 0){let r=e.scaleY;if(r!==void 0){let a=e.scaleZ;a===void 0?(t+=`scale(${i},${r}) `,n+=1):(t+=`scale3d(${i},${r},${a}) `,n+=2);continue}}t+=`${vz[r]}${i}) `}r===`rotateZ`&&e.rotate3d!==void 0&&(t+=`rotate3d(${e.rotate3d}) `)}return e.matrix!==void 0&&(t+=`matrix(${e.matrix}) `),e.matrix3d!==void 0&&(t+=`matrix3d(${e.matrix3d}) `),t},SB=[];function CB(e,t){if(!e)return null;let n=SB.length;outer:for(let r=0;r<n;r++){let n=SB[r];if(n.detect&&!n.detect(e))continue;let i=n.targetAdapters;for(let n=0,r=i.length;n<r;n++){let r=i[n];if(r.detect(e)){let n=r.props[t];if(n&&(!n.gate||n.gate(e)))return n;break outer}}}for(let r=0;r<n;r++){let n=SB[r];if(n.detect&&!n.detect(e))continue;let i=n.propertyResolvers;for(let n=0,r=i.length;n<r;n++){let r=i[n](e,t);if(r)return r}}return null}var wB=e=>{let t=Cz.exec(e)||wz.exec(e),n=Uz(t[4])?1:+t[4];return[+t[1],+t[2],+t[3],n]},TB=e=>{let t=e.length,n=t===4||t===5;return[+(`0x`+e[1]+e[n?1:2]),+(`0x`+e[n?2:3]+e[n?2:4]),+(`0x`+e[n?3:5]+e[n?3:6]),t===5||t===9?+((`0x`+e[n?4:7]+e[n?4:8])/255).toFixed(3):1]},EB=(e,t,n)=>(n<0&&(n+=1),n>1&&--n,n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e),DB=e=>{let t=Tz.exec(e)||Ez.exec(e),n=t[1]/360,r=t[2]/100,i=t[3]/100,a=Uz(t[4])?1:+t[4],o,s,c;if(r===0)o=s=c=i;else{let e=i<.5?i*(1+r):i+r-i*r,t=2*i-e;o=dB(EB(t,e,n+1/3)*255,0),s=dB(EB(t,e,n)*255,0),c=dB(EB(t,e,n-1/3)*255,0)}return[o,s,c,a]},OB=e=>qz(e)?wB(e):Kz(e)?TB(e):Jz(e)?DB(e):[0,0,0,1],kB=(e,t)=>Uz(e)?t:e,AB=(e,t)=>{let n=e.match(Az),r=t[cz]?t:document.documentElement,i=getComputedStyle(r)?.getPropertyValue(n[1]);return(!i||i.trim()===``)&&n[2]&&(i=n[2].trim()),i||0},jB=(e,t,n,r,i,a)=>{if(Hz(e)){if(!i){let i=e(t,n,r,a);return isNaN(+i)?i||0:+i}let o=()=>{let i=e(t,n,r,a);return isNaN(+i)?i||0:+i};return i.func=o,o()}if(Vz(e)&&Iz(e,`var(`)){if(!i)return AB(e,t);let n=()=>AB(e,t);return i.func=n,n()}return e},MB=(e,t)=>e[cz]?e[lz]&&Qz(e,t)?rz.ATTRIBUTE:_z.includes(t)||gz.get(t)?rz.TRANSFORM:Iz(t,`--`)?rz.CSS_VAR:t in e.style?rz.CSS:t in e?rz.OBJECT:rz.ATTRIBUTE:rz.OBJECT,NB=(e,t,n)=>{let r=e.style[t];r&&n&&(n[t]=r);let i=r||getComputedStyle(e[dz]||e).getPropertyValue(t);return i===`auto`?`0`:i},PB=(e,t,n,r)=>{let i=Uz(n)?MB(e,t):n,a=CB(e,t);if(a){let n=a.get(e);return n&&r&&(r[t]=n),n??0}if(i===rz.OBJECT){let n=e[t];return n&&r&&(r[t]=n),n||0}if(i===rz.ATTRIBUTE){let n=e.getAttribute(t);return n&&r&&(r[t]=n),n}return i===rz.TRANSFORM?bB(e,t,r):i===rz.CSS_VAR?NB(e,t,r).trimStart():NB(e,t,r)},FB=(e,t,n)=>n===`-`?e-t:n===`+`?e+t:e*t,IB=()=>({t:iz.NUMBER,n:0,u:null,o:null,d:null,s:null}),LB=(e,t)=>{if(t.t=iz.NUMBER,t.n=0,t.u=null,t.o=null,t.d=null,t.s=null,!e)return t;let n=+e;if(!isNaN(n))return t.n=n,t;let r=e;r[1]===`=`&&(t.o=r[0],r=r.slice(2));let i=!r.includes(` `)&&Oz.exec(r);if(i)return t.t=iz.UNIT,t.n=+i[1],t.u=i[2],t;if(t.o)return t.n=+r,t;if(Yz(r))return t.t=iz.COLOR,t.d=OB(r),t;{let e=r.match(Dz);return t.t=iz.COMPLEX,t.d=e?e.map(Number):[],t.s=r.split(Dz)||[],t}},RB=(e,t)=>(t.t=e._valueType,t.n=e._toNumber,t.u=e._unit,t.o=null,t.d=hB(e._toNumbers),t.s=hB(e._strings),t),zB=IB(),BB=(e,t,n)=>{let r=e._modifier,i=e._fromNumbers,a=e._toNumbers,o=e._strings,s=o[0];for(let c=0,l=a.length;c<l;c++){let l=r(dB(fB(i[c],a[c],t),n)),u=o[c+1];s+=`${u?l+u:l}`,e._numbers[c]=l}return s},VB=(e,t,n,r,i)=>{let a=e.parent,o=e.duration,s=e.completed,c=e.iterationDuration,l=e.iterationCount,u=e._currentIteration,d=e._loopDelay,f=e._reversed,p=e._alternate,m=e._hasChildren,h=e._delay,g=e._currentTime,_=h+c,v=t-h,y=uB(g,-h,o),b=uB(v,-h,o),x=v-g,S=b>0,C=b>=o,w=o<=fz,T=i===az.FORCE,E=0,D=v,O=0;if(l>1){let t=c+(C?0:d),n=~~(b/t);e._currentIteration=uB(n,0,l),C&&e._currentIteration--,E=e._currentIteration%2,D=b-n*t||0}let k=f^(p&&E),A=e._ease,j=C?k?0:o:k?c-D:D;A&&(j=c*A(j/c)||0);let M=(a?a.backwards:v<g)?!k:!!k;if(e._currentTime=v,e._iterationTime=j,e.backwards=M,S&&!e.began?(e.began=!0,!n&&!(a&&(M||!a.began))&&e.onBegin(e)):v<=0&&(e.began=!1),!n&&!m&&S&&e._currentIteration!==u&&e.onLoop(e),T||i===az.AUTO&&(t>=(a&&h>0?0:h)&&t<=_||t<=h&&y>h||t>=_&&y!==o)||j>=_&&y!==o||j<=h&&y>0&&!C||t<=y&&y===o&&s||C&&!s&&w){if(S&&(e.computeDeltaTime(y),n||e.onBeforeUpdate(e)),!m){let t=T||(M?x*-1:x)>=Nz.tickThreshold,i=dB(e._offset+(a?a._offset:0)+h+j,12),o=e._head,s,c,l,u,d=0;for(;o;){let e=o._composition,n=o._currentTime,a=o._changeDuration,f=o._absoluteStartTime+o._changeDuration,p=o._nextRep,m=o._prevRep,h=e!==oz.none,g=m?m._absoluteStartTime+m._changeDuration:0,_=m&&m.parent!==o.parent,v=!p||p._isOverridden?f:p.parent===o.parent?f+p._delay:p._absoluteStartTime<p._absoluteUpdateStartTime?p._absoluteStartTime:p._absoluteUpdateStartTime;if((t||(n!==a||i<=v||m&&!_&&(!p||p.parent!==o.parent))&&(n!==0||i>=o._absoluteStartTime||_&&!o._hasFromValue&&!m._isOverridden&&i>=g||p&&!p._isOverridden&&p.parent===o.parent&&p._currentTime!==0&&j<p._startTime))&&(!m||_||j>=o._startTime)&&(!h||!o._isOverridden&&(!o._isOverlapped||i<=f)&&(!p||p._isOverridden||i<=v)&&(!m||m._isOverridden||(_?i>=o._absoluteStartTime||!o._hasFromValue&&i>=g:i>=g+o._delay)))){let t=o._currentTime=uB(j-o._startTime,0,a),n=o._ease(t/o._updateDuration),i=o._modifier,f=o._valueType,p=o._tweenType,m=p===rz.OBJECT,g=f===iz.NUMBER,_=g&&m||n===0||n===1?-1:Nz.precision,v,y;if(g)v=y=i(dB(fB(o._fromNumber,o._toNumber,n),_));else if(f===iz.UNIT)y=i(dB(fB(o._fromNumber,o._toNumber,n),_)),v=`${y}${o._unit}`;else if(f===iz.COLOR){let e=o._numbers,t=o._fromNumbers,a=o._toNumbers,s=1-n,c=t[0],l=t[1],u=t[2],d=a[0],f=a[1],p=a[2];e[0]=i(Math.sqrt(c*c*s+d*d*n)),e[1]=i(Math.sqrt(l*l*s+f*f*n)),e[2]=i(Math.sqrt(u*u*s+p*p*n)),e[3]=i(fB(t[3],a[3],n)),(!o._setter||r)&&(v=`rgba(${dB(e[0],0)},${dB(e[1],0)},${dB(e[2],0)},${e[3]})`)}else f===iz.COMPLEX&&(v=BB(o,n,_));if(h&&(o._number=y),!r&&e!==oz.blend){let e=o.property;s=o.target,o._setter?o._setter(s,y,o):m?s[e]=v:p===rz.ATTRIBUTE?s.setAttribute(e,v):(c=s.style,p===rz.TRANSFORM?(s!==l&&(l=s,u=s[uz]),u[e]=v,d=1):p===rz.CSS?c[e]=v:p===rz.CSS_VAR&&c.setProperty(e,v)),S&&(O=1)}else o._value=v}else n&&m&&!_&&j<o._startTime&&(o._currentTime=0);d&&o._renderTransforms&&(c.transform=xB(u),d=0),o=o._next}!n&&O&&e.onRender(e)}!n&&S&&e.onUpdate(e)}return a&&w?!n&&(a.began&&!M&&v>0&&!s||M&&v<=1e-11&&s)&&(e.onComplete(e),e.completed=!M):S&&C?l===1/0?e._startTime+=e.duration:e._currentIteration>=l-1&&(e.paused=!0,!s&&!m&&(e.completed=!0,!n&&!(a&&(M||!a.began))&&(e.onComplete(e),e._resolve(e)))):e.completed=!1,O},HB=(e,t,n,r,i)=>{let a=e._currentIteration;if(VB(e,t,n,r,i),e._hasChildren){let o=e,s=o.backwards,c=r?t:o._iterationTime,l=Lz(),u=0,d=!0;if(!r&&o._currentIteration!==a){let e=o.iterationDuration;_B(o,t=>{if(!s)!t.completed&&!t.backwards&&t._currentTime<t.iterationDuration&&VB(t,e,n,1,az.FORCE),t.began=!1,t.completed=!1;else{let r=t.duration,i=t._offset+t._delay,a=i+r;!n&&r<=1e-11&&(!i||a===e)&&t.onComplete(t)}}),n||o.onLoop(o)}_B(o,e=>{let t=dB((c-e._offset)*e._speed,12);if(s&&t>e._delay+e.duration)return;let a=e._fps<o._fps?e.requestTick(l):i;u+=VB(e,t,n,r,a),!e.completed&&d&&(d=!1)},s),!n&&u&&o.onRender(o),(d||s)&&o._currentTime>=o.duration&&(o.paused=!0,o.completed||(o.completed=!0,n||(o.onComplete(o),o._resolve(o))))}},UB={},WB=(e,t,n)=>{if(n===rz.TRANSFORM)return gz.get(e)||e;if(n===rz.CSS||n===rz.ATTRIBUTE&&Gz(t)&&e in t.style){let t=UB[e];if(t)return t;{let t=e&&Fz(e);return UB[e]=t,t}}return e},GB=(e,t=!1)=>{if(e._hasChildren)_B(e,e=>GB(e,t),!0);else{let n=e;n.pause(),_B(n,e=>{let r=e.property,i=e.target,a=e._tweenType,o=e._inlineValue,s=Wz(o)||o===``;if(e._setter){if(!t&&!s){if(LB(o,zB),zB.d){let t=zB.d,n=e._numbers;for(let e=0,r=t.length;e<r;e++)n[e]=t[e]}else e._number=zB.n;e._setter(e.target,e._number,e)}}else if(a===rz.OBJECT)!t&&!s&&(i[r]=o);else if(i[cz]){if(a===rz.ATTRIBUTE)t||(s?i.removeAttribute(r):i.setAttribute(r,o));else{let t=i.style;if(a===rz.TRANSFORM){let n=i[uz];s?delete n[r]:n[r]=o,e._renderTransforms&&(Object.keys(n).length?t.transform=xB(n):t.removeProperty(`transform`))}else s?t.removeProperty(Fz(r)):t[r]=o}}i[cz]&&n._tail===e&&n.targets.forEach(e=>{e.getAttribute&&e.getAttribute(`style`)===``&&e.removeAttribute(`style`)})})}return e},KB=class{constructor(e=0){this.deltaTime=0,this._currentTime=e,this._lastTickTime=e,this._startTime=e,this._lastTime=e,this._frameDuration=mz/240,this._fps=240,this._speed=1,this._hasChildren=!1,this._head=null,this._tail=null}get fps(){return this._fps}set fps(e){let t=+e,n=t<1e-11?fz:t,r=mz/n;n>jz.frameRate&&(jz.frameRate=n),this._fps=n,this._frameDuration=r}get speed(){return this._speed}set speed(e){let t=+e;this._speed=t<1e-11?fz:t}requestTick(e){let t=this._frameDuration,n=e-this._lastTickTime,r=t*.25;return n+(r<4?r:4)<t?az.NONE:(this._lastTickTime=n>=t?e-n%t:e,az.AUTO)}computeDeltaTime(e){let t=e-this._lastTime;return this.deltaTime=t,this._lastTime=e,t}},qB={animation:null,update:yz},JB=e=>{let t=qB.animation;return t||(t={duration:fz,computeDeltaTime:yz,_offset:0,_delay:0,_head:null,_tail:null},qB.animation=t,qB.update=()=>{e.forEach(e=>{for(let t in e){let n=e[t],r=n._head;if(r){let e=r._valueType,t=e===iz.COMPLEX||e===iz.COLOR?hB(r._fromNumbers):null,i=r._fromNumber,a=n._tail;for(;a&&a!==r;){if(t)for(let e=0,n=a._numbers.length;e<n;e++)t[e]+=a._numbers[e];else i+=a._number;a=a._prevAdd}r._toNumber=i,r._toNumbers=t}}}),VB(t,1,1,0,az.FORCE)}),t},YB=ez?requestAnimationFrame:setImmediate,XB=ez?cancelAnimationFrame:clearImmediate,ZB=class extends KB{constructor(e){super(e),this.useDefaultMainLoop=!0,this.pauseOnDocumentHidden=!0,this.defaults=jz,this.paused=!0,this.reqId=0}update(){let e=this._currentTime=Lz();if(this.requestTick(e)){this.computeDeltaTime(e);let t=this._speed,n=this._fps,r=this._head;for(;r;){let i=r._next;r.paused?(vB(this,r),this._hasChildren=!!this._tail,r._running=!1,r.completed&&!r._cancelled&&r.cancel()):HB(r,(e-r._startTime)*r._speed*t,0,0,r._fps<n?r.requestTick(e):az.AUTO),r=i}qB.update()}}wake(){return this.useDefaultMainLoop&&!this.reqId&&(this.requestTick(Lz()),this.reqId=YB($B)),this}pause(){if(this.reqId)return this.paused=!0,eV()}resume(){if(this.paused)return this.paused=!1,_B(this,e=>e.resetTime()),this.wake()}get speed(){return this._speed*(Nz.timeScale===1?1:mz)}set speed(e){let t=e*Nz.timeScale;this._speed!==t&&(this._speed=t,_B(this,e=>e.speed=e._speed))}get timeUnit(){return Nz.timeScale===1?`ms`:`s`}set timeUnit(e){let t=.001,n=e===`s`,r=n?t:1;if(Nz.timeScale!==r){Nz.timeScale=r,Nz.tickThreshold=200*r;let e=n?t:mz;this.defaults.duration*=e,this._speed*=e}}get precision(){return Nz.precision}set precision(e){Nz.precision=e}},QB=(()=>{let e=new ZB(Lz());return ez&&(Pz.engine=e,nz.addEventListener(`visibilitychange`,()=>{e.pauseOnDocumentHidden&&(nz.hidden?e.pause():e.resume())})),e})(),$B=()=>{QB._head?(QB.reqId=YB($B),QB.update()):QB.reqId=0},eV=()=>(XB(QB.reqId),QB.reqId=0,QB),tV={_rep:new WeakMap,_add:new Map},nV=(e,t,n=`_rep`)=>{let r=tV[n],i=r.get(e);return i||(i={},r.set(e,i)),i[t]?i[t]:i[t]={_head:null,_tail:null}},rV=(e,t)=>e._isOverridden||e._absoluteStartTime>t._absoluteStartTime,iV=e=>{e._isOverlapped=1,e._isOverridden=1,e._changeDuration=fz,e._currentTime=fz},aV=(e,t)=>{let n=e._composition;if(n===oz.replace){let n=e._absoluteStartTime;yB(t,e,rV,`_prevRep`,`_nextRep`);let r=e._prevRep;if(r){let t=r.parent,i=r._absoluteEndTime;if(e.parent.id!==t.id&&t.iterationCount>1&&i+(t.duration-t.iterationDuration)>n){iV(r);let e=r._prevRep;for(;e&&e.parent.id===t.id;)iV(e),e=e._prevRep}let a=e._absoluteUpdateStartTime;if(i>a){let e=r._startTime,t=dB(a-(i-(e+r._updateDuration))-e,12);r._changeDuration=t,r._currentTime=t,r._isOverlapped=1,t<1e-11&&iV(r)}let o=e.parent.parent;if(!o||o!==t.parent){let e=!0;if(_B(t,t=>{t._isOverlapped||(e=!1)}),e){let e=t.parent;if(e){let n=!0;_B(e,e=>{e!==t&&_B(e,e=>{e._isOverlapped||(n=!1)})}),n&&e.cancel()}else t.cancel()}}}}else if(n===oz.blend){let t=nV(e.target,e.property,`_add`),n=JB(tV._add),r=t._head;r||(r={...e},r._composition=oz.replace,r._updateDuration=fz,r._startTime=0,r._numbers=hB(e._fromNumbers),r._number=0,r._next=null,r._prev=null,yB(t,r),yB(n,r));let i=e._toNumber;if(e._fromNumber=r._fromNumber-i,e._toNumber=0,e._numbers=hB(e._fromNumbers),e._number=0,r._fromNumber=i,e._toNumbers.length){let t=hB(e._toNumbers);t.forEach((t,n)=>{e._fromNumbers[n]=r._fromNumbers[n]-t,e._toNumbers[n]=0}),r._fromNumbers=t}yB(t,e,null,`_prevAdd`,`_nextAdd`)}return e},oV=e=>{let t=e._composition;if(t!==oz.none){let n=e.target,r=e.property,i=tV._rep.get(n)[r];if(vB(i,e,`_prevRep`,`_nextRep`),t===oz.blend){let t=tV._add,i=t.get(n);if(!i)return;let a=i[r],o=qB.animation;vB(a,e,`_prevAdd`,`_nextAdd`);let s=a._head;if(s&&s===a._tail){vB(a,s,`_prevAdd`,`_nextAdd`),vB(o,s);let e=!0;for(let t in i)if(i[t]._head){e=!1;break}e&&t.delete(n)}}}return e},sV=e=>(e.paused=!0,e.began=!1,e.completed=!1,e),cV=e=>e._cancelled?(e._hasChildren?_B(e,cV):_B(e,e=>{e._composition!==oz.none&&aV(e,nV(e.target,e.property))}),e._cancelled=0,e):e,lV=0,uV=(e,t)=>e._priority>t._priority,dV=class extends KB{constructor(e={},t=null,n=0){super(0),++lV;let{id:r,delay:i,duration:a,reversed:o,alternate:s,loop:c,loopDelay:l,autoplay:u,frameRate:d,playbackRate:f,priority:p,onComplete:m,onLoop:h,onPause:g,onBegin:_,onBeforeUpdate:v,onUpdate:y}=e;Mz.current&&Mz.current.register(this);let b=t?0:QB._lastTickTime,x=t?t.defaults:Nz.defaults,S=Hz(i)||Uz(i)?x.delay:+i,C=Hz(a)||Uz(a)?1/0:+a,w=kB(c,x.loop),T=kB(l,x.loopDelay),E=w===!0||w===1/0||w<0?1/0:w+1,D=0;t?D=n:(QB.reqId||QB.requestTick(Lz()),D=(QB._lastTickTime-QB._startTime)*Nz.timeScale),this.id=Uz(r)?lV:r,this.parent=t,this.duration=pB((C+T)*E-T)||1e-11,this.backwards=!1,this.paused=!0,this.began=!1,this.completed=!1,this.onBegin=_||x.onBegin,this.onBeforeUpdate=v||x.onBeforeUpdate,this.onUpdate=y||x.onUpdate,this.onLoop=h||x.onLoop,this.onPause=g||x.onPause,this.onComplete=m||x.onComplete,this.iterationDuration=C,this.iterationCount=E,this._autoplay=!t&&kB(u,x.autoplay),this._offset=D,this._delay=S,this._loopDelay=T,this._iterationTime=0,this._currentIteration=0,this._resolve=yz,this._running=!1,this._reversed=+kB(o,x.reversed),this._reverse=this._reversed,this._cancelled=0,this._alternate=kB(s,x.alternate),this._prev=null,this._next=null,this._lastTickTime=b,this._startTime=b,this._lastTime=b,this._fps=kB(d,x.frameRate),this._speed=kB(f,x.playbackRate),this._priority=+kB(p,1)}get cancelled(){return!!this._cancelled}set cancelled(e){e?this.cancel():this.reset(!0).play()}get currentTime(){return uB(dB(this._currentTime,Nz.precision),-this._delay,this.duration)}set currentTime(e){let t=this.paused;this.pause().seek(+e),t||this.resume()}get iterationCurrentTime(){return uB(dB(this._iterationTime,Nz.precision),0,this.iterationDuration)}set iterationCurrentTime(e){this.currentTime=this.iterationDuration*this._currentIteration+e}get progress(){return uB(dB(this._currentTime/this.duration,10),0,1)}set progress(e){this.currentTime=this.duration*e}get iterationProgress(){return uB(dB(this._iterationTime/this.iterationDuration,10),0,1)}set iterationProgress(e){let t=this.iterationDuration;this.currentTime=t*this._currentIteration+t*e}get currentIteration(){return this._currentIteration}set currentIteration(e){this.currentTime=this.iterationDuration*uB(+e,0,this.iterationCount-1)}get reversed(){return!!this._reversed}set reversed(e){e?this.reverse():this.play()}get speed(){return super.speed}set speed(e){super.speed=e,this.resetTime()}reset(e=!1){return cV(this),this._reversed&&!this._reverse&&(this.reversed=!1),this._iterationTime=this.iterationDuration,HB(this,0,1,~~e,az.FORCE),sV(this),this._hasChildren&&_B(this,sV),this}init(e=!1){this.fps=this._fps,this.speed=this._speed,!e&&this._hasChildren&&HB(this,this.duration,1,~~e,az.FORCE),this.reset(e);let t=this._autoplay;return t===!0?this.resume():t&&!Uz(t.linked)&&t.link(this),this}resetTime(){let e=1/(this._speed*QB._speed);return this._startTime=Lz()-(this._currentTime+this._delay)*e,this}pause(){return this.paused?this:(this.paused=!0,this.onPause(this),this)}resume(){return this.paused?(this.paused=!1,this.duration<=1e-11&&!this._hasChildren?HB(this,fz,0,0,az.FORCE):(this._running||=(yB(QB,this,uV),QB._hasChildren=!0,!0),this.resetTime(),this._startTime-=12,QB.wake()),this):this}restart(){return this.reset().resume()}seek(e,t=0,n=0){cV(this),this.completed=!1;let r=this.paused;return this.paused=!0,HB(this,e+this._delay,~~t,~~n,az.AUTO),r?this:this.resume()}alternate(){let e=this._reversed,t=this.iterationCount,n=this.iterationDuration,r=t===1/0?oB(pz/n):t;return this._reversed=+(this._alternate&&!(r%2)?e:!e),t===1/0?this.iterationProgress=this._reversed?1-this.iterationProgress:this.iterationProgress:this.seek(n*r-this._currentTime),this.resetTime(),this}play(){return this._reversed&&this.alternate(),this.resume()}reverse(){return this._reversed||this.alternate(),this.resume()}cancel(){return this._hasChildren?_B(this,e=>e.cancel(),!0):_B(this,oV),this._cancelled=1,this.pause()}stretch(e){let t=this.duration,n=mB(e);if(t===n)return this;let r=e/t,i=e<=fz;return this.duration=i?fz:n,this.iterationDuration=i?fz:mB(this.iterationDuration*r),this._offset*=r,this._delay*=r,this._loopDelay*=r,this}revert(){HB(this,0,1,0,az.AUTO);let e=this._autoplay;return e&&e.linked&&e.linked===this&&e.revert(),this.cancel()}complete(e=0){return this.seek(this.duration,e).cancel()}then(e=yz){let t=this.then,n=()=>{this.then=null,e(this),this.then=t,this._resolve=yz};return new Promise(e=>(this._resolve=()=>e(n()),this.completed&&this._resolve(),this))}};function fV(e){let t=Vz(e)?Mz.root.querySelectorAll(e):e;if(t instanceof NodeList||t instanceof HTMLCollection)return t}function pV(e){if(Wz(e))return[];if(!ez)return Rz(e)&&e.flat(1/0)||[e];if(Rz(e)){let t=e.flat(1/0),n=[];for(let e=0,r=t.length;e<r;e++){let r=t[e];if(!Wz(r)){let e=fV(r);if(e)for(let t=0,r=e.length;t<r;t++){let r=e[t];if(!Wz(r)){let e=!1;for(let t=0,i=n.length;t<i;t++)if(n[t]===r){e=!0;break}e||n.push(r)}}else{let e=!1;for(let t=0,i=n.length;t<i;t++)if(n[t]===r){e=!0;break}e||n.push(r)}}}return n}let t=fV(e);return t?Array.from(t):[e]}function mV(e){let t=pV(e),n=t.length;for(let e=0;e<n;e++){let n=t[e];if(!n[sz]){n[sz]=!0;let e=Gz(n);(n.nodeType||e)&&(n[cz]=!0,n[lz]=e,n[uz]={})}}return t}var hV={deg:1,rad:180/cB,turn:360},gV={},_V=(e,t,n,r=!1)=>{let i=t.u,a=t.n;if(t.t===iz.UNIT&&i===n)return t;let o=a+i+n,s=gV[o];if(!Uz(s)&&!r)t.n=s;else{let r;if(i in hV)r=a*hV[i]/hV[n];else{let t=e.cloneNode(),o=e.parentNode,s=o&&o!==nz?o:nz.body;s.appendChild(t);let c=t.style;c.width=100+i;let l=t.offsetWidth||100;c.width=100+n;let u=l/(t.offsetWidth||100);s.removeChild(t),r=u*a}t.n=r,gV[o]=r}return t.t,iz.UNIT,t.u=n,t},vV=e=>e,yV=(e=1.68)=>t=>$z(t,+e),bV={in:e=>t=>e(t),out:e=>t=>1-e(1-t),inOut:e=>t=>t<.5?e(t*2)/2:1-e(t*-2+2)/2,outIn:e=>t=>t<.5?(1-e(1-t*2))/2:(e(t*2-1)+1)/2},xV=cB/2,SV=cB*2,CV={"":yV,Quad:yV(2),Cubic:yV(3),Quart:yV(4),Quint:yV(5),Sine:e=>1-nB(e*xV),Circ:e=>1-eB(1-e*e),Expo:e=>e?$z(2,10*e-10):0,Bounce:e=>{let t,n=4;for(;e<((t=$z(2,--n))-1)/11;);return 1/$z(4,3-n)-7.5625*$z((t*3-2)/22-e,2)},Back:(e=1.7)=>t=>(+e+1)*t*t*t-+e*t*t,Elastic:(e=1,t=.3)=>{let n=uB(+e,1,10),r=uB(+t,fz,2),i=r/SV*sB(1/n),a=SV/r;return e=>e===0||e===1?e:-n*$z(2,-10*(1-e))*tB((1-e-i)*a)}},wV=(()=>{let e={linear:vV,none:vV};for(let t in bV)for(let n in CV){let r=CV[n],i=bV[t];e[t+n]=n===``||n===`Back`||n===`Elastic`?(e,t)=>i(r(e,t)):i(r)}return e})(),TV={linear:vV,none:vV},EV=e=>{if(TV[e])return TV[e];if(e.indexOf(`(`)<=-1){let t=bV[e]||e.includes(`Back`)||e.includes(`Elastic`)?wV[e]():wV[e];return t?TV[e]=t:vV}{let t=e.slice(0,-1).split(`(`),n=wV[t[0]];return n?TV[e]=n(...t[1].split(`,`)):vV}},DV=[`steps(`,`irregular(`,`linear(`,`cubicBezier(`],OV=e=>{if(Vz(e)){for(let t=0,n=DV.length;t<n;t++)if(Iz(e,DV[t]))return console.warn(`String syntax for \`ease: "${e}"\` has been removed from the core and replaced by importing and passing the easing function directly: \`ease: ${e}\``),vV}return Hz(e)?e:Vz(e)?EV(e):vV},kV=IB(),AV=IB(),jV={},MV={func:null},NV={func:null},PV=[null],FV=[null,null],IV={to:null},LV=0,RV=0,zV,BV,VV=(e,t)=>{let n={};if(Rz(e)){let t=[].concat(...e.map(e=>Object.keys(e))).filter(Xz);for(let r=0,i=t.length;r<i;r++){let i=t[r];n[i]=e.map(e=>{let t={};for(let n in e){let r=e[n];Xz(n)?n===i&&(t.to=r):t[n]=r}return t})}}else{let r=kB(t.duration,Nz.defaults.duration);Object.keys(e).map(t=>({o:parseFloat(t)/100,p:e[t]})).sort((e,t)=>e.o-t.o).forEach(e=>{let t=e.o,i=e.p;for(let e in i)if(Xz(e)){let a=n[e];a||=n[e]=[];let o=t*r,s=a.length,c=a[s-1],l={to:i[e]},u=0;for(let e=0;e<s;e++)u+=a[e].duration;s===1&&(l.from=c.to),i.ease&&(l.ease=i.ease),l.duration=o-(s?u:0),a.push(l)}return e});for(let e in n){let t=n[e],r;for(let e=0,n=t.length;e<n;e++){let n=t[e],i=n.ease;n.ease=r||void 0,r=i}t[0].duration||t.shift()}}return n},HV=class extends dV{constructor(e,t,n,r,i=!1,a=0,o){super(t,n,r),this._head,this._tail,++RV;let s=mV(e),c=s.length,l=t.keyframes,u=l?gB(VV(l,t),t):t,{id:d,delay:f,duration:p,ease:m,playbackEase:h,modifier:g,composition:_,onRender:v}=u,y=n?n.defaults:Nz.defaults,b=kB(m,y.ease),x=kB(h,y.playbackEase),S=x?OV(x):null,C=!Uz(b.ease),w=C?b.ease:kB(m,S?`linear`:y.ease),T=C?b.settlingDuration:kB(p,y.duration),E=kB(f,y.delay),D=g||y.modifier,O=Uz(_)&&c>=1e3?oz.none:Uz(_)?y.composition:_,k=this._offset+(n?n._offset:0);C&&(b.parent=this);let A=NaN,j=NaN,M=0,N=0;for(let e=0;e<c;e++){let t=s[e],r=a||e,c=o||s,l=NaN,d=NaN;for(let e in u)if(Xz(e)){let a=MB(t,e),o=CB(t,e),s=WB(e,t,a),f=u[e],p=Rz(f);if(i&&!p&&(FV[0]=f,FV[1]=f,f=FV),p){let e=f.length,t=!zz(f[0]);e===2&&t?(IV.to=f,PV[0]=IV,zV=PV):e>2&&t?(zV=[],f.forEach((e,t)=>{t?t===1?(FV[1]=e,zV.push(FV)):zV.push(e):FV[0]=e})):zV=f}else PV[0]=f,zV=PV;let m=null,h=null,g=NaN,_=0,v=0;for(let e=zV.length;v<e;v++){let i=zV[v];zz(i)?BV=i:(IV.to=i,BV=IV),MV.func=null,NV.func=null;let l=jB(kB(BV.composition,O),t,r,c,null,null),u=Bz(l)?l:oz[l];!m&&u!==oz.none&&(m=nV(t,s));let d=m?m._tail:null,f=n&&d&&d.parent.parent===n?d:h,p=jB(BV.to,t,r,c,MV,f),y;zz(p)&&!Uz(p.to)?(BV=p,y=p.to):y=p;let b=jB(BV.from,t,r,c,NV,f),x=BV.ease||w,S=jB(x,t,r,c,null,f),C=Hz(S)||Vz(S)?S:x,A=!Uz(C)&&!Uz(C.ease),j=A?C.ease:C,P=A?C.settlingDuration:jB(kB(BV.duration,e>1?jB(T,t,r,c,null,f)/e:T),t,r,c,null,f),F=jB(kB(BV.delay,v?0:E),t,r,c,null,f),I=BV.modifier||D,L=!Uz(b),R=!Uz(y),z=Rz(y),ee=z||L&&R,te=h?_:0,B=h?_+F:F,ne=dB(k+B,12),re=dB(k+te,12);!N&&(L||z)&&(N=1);let V=h;if(u!==oz.none){let e=m._head;for(;e&&e._absoluteStartTime<=ne;)if(e._isOverridden||(V=e),e=e._nextRep,e&&e._absoluteStartTime>=ne)for(;e;)iV(e),e=e._nextRep}if(ee){LB(z?jB(y[0],t,r,c,NV,f):b,kV),LB(z?jB(y[1],t,r,c,MV,f):y,AV);let e=PB(t,s,a,jV);kV.t===iz.NUMBER&&(V?V._valueType===iz.UNIT&&(kV.t=iz.UNIT,kV.u=V._unit):(LB(e,zB),zB.t===iz.UNIT&&(kV.t=iz.UNIT,kV.u=zB.u)))}else R?LB(y,AV):h?RB(h,AV):LB(n&&V&&V.parent.parent===n?V._value:PB(t,s,a,jV),AV),L?LB(b,kV):h?RB(h,kV):LB(n&&V&&V.parent.parent===n?V._value:PB(t,s,a,jV),kV);if(kV.o&&(kV.n=FB(V?V._toNumber:LB(PB(t,s,a,jV),zB).n,kV.n,kV.o)),AV.o&&(AV.n=FB(kV.n,AV.n,AV.o)),kV.t!==AV.t){if(kV.t===iz.COMPLEX||AV.t===iz.COMPLEX){let e=kV.t===iz.COMPLEX?kV:AV,t=kV.t===iz.COMPLEX?AV:kV;t.t=iz.COMPLEX,t.s=hB(e.s),t.d=e.d.map(()=>t.n)}else if(kV.t===iz.UNIT||AV.t===iz.UNIT){let e=kV.t===iz.UNIT?kV:AV,t=kV.t===iz.UNIT?AV:kV;t.t=iz.UNIT,t.u=e.u}else if(kV.t===iz.COLOR||AV.t===iz.COLOR){let e=kV.t===iz.COLOR?kV:AV,t=kV.t===iz.COLOR?AV:kV;t.t=iz.COLOR,t.d=e.d.map(()=>0)}}if(kV.u!==AV.u){let e=AV.u?kV:AV;e=_V(t,e,AV.u?AV.u:kV.u,!1)}if(AV.d&&kV.d&&AV.d.length!==kV.d.length){let e=kV.d.length>AV.d.length?kV:AV,t=e===kV?AV:kV;t.d=e.d.map((e,n)=>Uz(t.d[n])?0:t.d[n]),t.s=hB(e.s)}let H=dB(+P||1e-11,12),ie=jV[s];Wz(ie)||(jV[s]=null);let ae=o?o.set:null;_=dB(B+H,12);let oe=kV.d,se=AV.d,ce=AV.s,le={parent:this,id:LV++,property:s,target:t,_value:null,_toFunc:MV.func,_fromFunc:NV.func,_ease:OV(j),_fromNumbers:oe?hB(oe):hz,_toNumbers:se?hB(se):hz,_strings:ce?hB(ce):hz,_fromNumber:kV.n,_toNumber:AV.n,_numbers:oe?hB(oe):hz,_number:kV.n,_unit:AV.u,_modifier:I,_currentTime:0,_startTime:B,_delay:+F,_updateDuration:H,_changeDuration:H,_absoluteStartTime:ne,_absoluteUpdateStartTime:re,_absoluteEndTime:dB(k+_,12),_hasFromValue:L||z?1:0,_tweenType:a,_setter:ae,_valueType:AV.t,_composition:u,_isOverlapped:0,_isOverridden:0,_renderTransforms:0,_inlineValue:ie,_prevRep:null,_nextRep:null,_prevAdd:null,_nextAdd:null,_prev:null,_next:null};u!==oz.none&&aV(le,m);let ue=le._valueType;if(ue===iz.COMPLEX)le._value=BB(le,1,-1);else if(ue===iz.UNIT)le._value=`${I(le._toNumber)}${le._unit}`;else if(ue===iz.COLOR){let e=AV.d;le._value=`rgba(${dB(e[0],0)},${dB(e[1],0)},${dB(e[2],0)},${e[3]})`}else le._value=I(le._toNumber);isNaN(g)&&(g=le._startTime),h=le,M++,yB(this,le)}(isNaN(j)||g<j)&&(j=g),(isNaN(A)||_>A)&&(A=_),a===rz.TRANSFORM&&(l=M-v,d=M)}if(!isNaN(l)){let e=0;_B(this,t=>{e>=l&&e<d&&(t._renderTransforms=1,t._composition===oz.blend&&_B(qB.animation,e=>{e.id===t.id&&(e._renderTransforms=1)})),e++})}}c||console.warn(`No target found. Make sure the element you're trying to animate is accessible before creating your animation.`),j?(_B(this,e=>{e._startTime-e._delay||(e._delay-=j),e._startTime-=j}),A-=j):j=0,A||(A=fz,this.iterationCount=0),this.targets=s,this.id=Uz(d)?RV:d,this.duration=A===1e-11?fz:pB((A+this._loopDelay)*this.iterationCount-this._loopDelay)||1e-11,this.onRender=v||y.onRender,this._ease=S,this._delay=j,this.iterationDuration=A,!this._autoplay&&N&&this.onRender(this)}stretch(e){let t=this.duration;if(t===mB(e))return this;let n=e/t;return _B(this,e=>{e._updateDuration=mB(e._updateDuration*n),e._changeDuration=mB(e._changeDuration*n),e._currentTime*=n,e._delay*=n,e._startTime*=n,e._absoluteStartTime*=n,e._absoluteUpdateStartTime*=n,e._absoluteEndTime*=n}),super.stretch(e)}refresh(){return _B(this,e=>{let t=e._toFunc,n=e._fromFunc;(t||n)&&(n?(LB(n(),kV),kV.u!==e._unit&&e.target[cz]&&_V(e.target,kV,e._unit,!0),e._fromNumbers=hB(kV.d),e._fromNumber=kV.n):t&&(LB(PB(e.target,e.property,e._tweenType),zB),e._fromNumbers=hB(zB.d),e._fromNumber=zB.n),t&&(LB(t(),AV),e._toNumbers=hB(AV.d),e._strings=hB(AV.s),e._toNumber=AV.o?FB(e._fromNumber,AV.n,AV.o):AV.n))}),this.duration===1e-11&&this.restart(),this}revert(){return super.revert(),GB(this)}then(e){return super.then(e)}},UV=(e,t)=>Nz.editor?Nz.editor.addAnimation(e,t):new HV(e,t,null,0,!1).init(),WV=mz*10,GV=class{constructor(e={}){let t=!Uz(e.bounce)||!Uz(e.duration);this.timeStep=.02,this.restThreshold=5e-4,this.restDuration=200,this.maxDuration=6e4,this.maxRestSteps=this.restDuration/this.timeStep/mz,this.maxIterations=this.maxDuration/this.timeStep/mz,this.bn=uB(kB(e.bounce,.5),-1,1),this.pd=uB(kB(e.duration,628),10*Nz.timeScale,WV*Nz.timeScale),this.m=uB(kB(e.mass,1),1,WV),this.s=uB(kB(e.stiffness,100),fz,WV),this.d=uB(kB(e.damping,10),fz,WV),this.v=uB(kB(e.velocity,0),-WV,WV),this.w0=0,this.zeta=0,this.wd=0,this.b=0,this.completed=!1,this.solverDuration=0,this.settlingDuration=0,this.parent=null,this.onComplete=e.onComplete||yz,t&&this.calculateSDFromBD(),this.compute(),this.ease=e=>{let t=e*this.settlingDuration,n=this.completed,r=this.pd;return t>=r&&!n&&(this.completed=!0,this.onComplete(this.parent)),t<r&&n&&(this.completed=!1),e===0||e===1?e:this.solve(e*this.solverDuration)}}solve(e){let{zeta:t,w0:n,wd:r,b:i}=this,a=e;return a=t<1?iB(-a*t*n)*(1*nB(r*a)+i*tB(r*a)):t===1?(1+i*a)*iB(-a*n):((1+i)*iB((-t*n+r)*a)+(1-i)*iB((-t*n-r)*a))/2,1-a}calculateSDFromBD(){let e=Nz.timeScale===1?this.pd/mz:this.pd;this.m=1,this.v=0,this.s=$z(2*cB/e,2),this.d=this.bn>=0?(1-this.bn)*4*cB/e:4*cB/(e*(1+this.bn)),this.s=dB(uB(this.s,fz,WV),3),this.d=dB(uB(this.d,fz,300),3)}calculateBDFromSD(){let e=2*cB/eB(this.s);this.pd=e*(Nz.timeScale===1?mz:1),this.bn=this.d/(2*eB(this.s))<=1?1-this.d*e/(4*cB):4*cB/(this.d*e)-1,this.bn=dB(uB(this.bn,-1,1),3),this.pd=dB(uB(this.pd,10*Nz.timeScale,WV*Nz.timeScale),3)}compute(){let{maxRestSteps:e,maxIterations:t,restThreshold:n,timeStep:r,m:i,d:a,s:o,v:s}=this,c=this.w0=uB(eB(o/i),fz,mz),l=this.zeta=a/(2*eB(o*i));l<1?(this.wd=c*eB(1-l*l),this.b=(l*c+-s)/this.wd):l===1?(this.wd=0,this.b=-s+c):(this.wd=c*eB(l*l-1),this.b=(l*c+-s)/this.wd);let u=0,d=0,f=0;for(;d<=e&&f<=t;)rB(1-this.solve(u))<n?d++:d=0,this.solverDuration=u,u+=r,f++;this.settlingDuration=dB(this.solverDuration*mz,0)*Nz.timeScale}get bounce(){return this.bn}set bounce(e){this.bn=uB(kB(e,1),-1,1),this.calculateSDFromBD(),this.compute()}get duration(){return this.pd}set duration(e){this.pd=uB(kB(e,1),10*Nz.timeScale,WV*Nz.timeScale),this.calculateSDFromBD(),this.compute()}get stiffness(){return this.s}set stiffness(e){this.s=uB(kB(e,100),fz,WV),this.calculateBDFromSD(),this.compute()}get damping(){return this.d}set damping(e){this.d=uB(kB(e,10),fz,WV),this.calculateBDFromSD(),this.compute()}get mass(){return this.m}set mass(e){this.m=uB(kB(e,1),1,WV),this.compute()}get velocity(){return this.v}set velocity(e){this.v=uB(kB(e,0),-WV,WV),this.compute()}},KV=e=>new GV(e),qV=(e=10,t)=>{let n=t?aB:oB;return t=>n(uB(t,0,1)*e)*(1/e)},JV=s({animate:()=>UV,spring:()=>KV}),YV=(0,G.forwardRef)(function({id:e,transform:t},n){return(0,Z.jsxs)(`radialGradient`,{ref:n,id:e,gradientUnits:`userSpaceOnUse`,cx:`-1.2`,cy:`-1.6`,r:`5.6`,gradientTransform:t,children:[(0,Z.jsx)(`stop`,{offset:`0`,stopColor:`color-mix(in oklab, var(--color-white) calc(var(--depth) * 50%), currentColor)`}),(0,Z.jsx)(`stop`,{offset:`1`,stopColor:`currentColor`})]})});function XV({id:e}){return(0,Z.jsx)(`filter`,{id:e,x:`-50%`,y:`-50%`,width:`200%`,height:`200%`,children:(0,Z.jsx)(`feDropShadow`,{dx:`0`,dy:`1.5`,stdDeviation:`1`,floodColor:`currentColor`,style:{floodOpacity:`calc(var(--depth) * 0.6)`}})})}function ZV({id:e}){return(0,Z.jsxs)(`filter`,{id:e,x:`-10%`,y:`-10%`,width:`120%`,height:`120%`,colorInterpolationFilters:`sRGB`,children:[(0,Z.jsx)(`feGaussianBlur`,{in:`SourceAlpha`,stdDeviation:`0.3`,result:`soft-edge`}),(0,Z.jsx)(`feOffset`,{in:`soft-edge`,dx:`0.25`,dy:`0.45`,result:`lower-edge`}),(0,Z.jsx)(`feComposite`,{in:`SourceAlpha`,in2:`lower-edge`,operator:`out`,result:`inner-shadow`}),(0,Z.jsx)(`feFlood`,{floodColor:`var(--color-black)`,floodOpacity:`calc(var(--depth) * 0.28)`}),(0,Z.jsx)(`feComposite`,{in2:`inner-shadow`,operator:`in`,result:`shade`}),(0,Z.jsx)(`feOffset`,{in:`soft-edge`,dx:`-0.2`,dy:`-0.35`,result:`upper-edge`}),(0,Z.jsx)(`feComposite`,{in:`SourceAlpha`,in2:`upper-edge`,operator:`out`,result:`inner-highlight`}),(0,Z.jsx)(`feFlood`,{floodColor:`var(--color-white)`,floodOpacity:`calc(var(--depth) * 0.7)`}),(0,Z.jsx)(`feComposite`,{in2:`inner-highlight`,operator:`in`,result:`highlight`}),(0,Z.jsxs)(`feMerge`,{children:[(0,Z.jsx)(`feMergeNode`,{in:`SourceGraphic`}),(0,Z.jsx)(`feMergeNode`,{in:`shade`}),(0,Z.jsx)(`feMergeNode`,{in:`highlight`})]})]})}var QV=Object.freeze({alphaIntercept:-8,alphaSlope:18,blurStdDeviation:2});function $V({id:e,values:t=$I}){return(0,Z.jsxs)(`filter`,{id:e,x:`-50%`,y:`-50%`,width:`200%`,height:`200%`,children:[(0,Z.jsx)(`feGaussianBlur`,{in:`SourceGraphic`,stdDeviation:t.blurStdDeviation,result:`blur`}),(0,Z.jsx)(`feColorMatrix`,{in:`blur`,values:`1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 ${String(t.alphaSlope)} ${String(t.alphaIntercept)}`,result:`gooey`}),(0,Z.jsx)(`feComposite`,{in:`SourceGraphic`,in2:`gooey`,operator:`atop`})]})}function eH(e,t){let n=e.ownerDocument,r=!0,i=()=>{t(r&&!n.hidden)},a=globalThis,o=`IntersectionObserver`in globalThis&&a.IntersectionObserver?new a.IntersectionObserver(t=>{let n=t.find(t=>t.target===e);n&&(r=n.isIntersecting,i())}):void 0;return o?.observe(e),n.addEventListener(`visibilitychange`,i),i(),()=>{o?.disconnect(),n.removeEventListener(`visibilitychange`,i)}}function tH(e){let t=Math.max(0,Math.min(1,e));return t*t*(3-2*t)}function nH(e,t){let n=Math.max(0,Math.min(1,(t-(e-1)*.085)/.68));return Math.sin(n*Math.PI)**2}function rH(e,t,n){let r=n*Math.PI*2,i=t*2.1,a=Math.sin(r*2+i)*.15,o={rx:4*(1+a),ry:4/(1+a)};if(e===`line`){let e=7.5+4*Math.cos(r+(t===2?-.45:0));return{cx:(t-1)*e,cy:Math.sin(r+i)*.7,...o}}if(e===`square`){let e=4.7+2.7*Math.cos(r);return{cx:(t%2?1:-1)*e,cy:(t<2?-1:1)*e,...o}}if(e===`donut`){let e=tH(n/.66)*Math.PI*2,o=Math.min(e,t*Math.PI/8)-Math.PI/2,s=tH((n-.79)/.21),c=8+Math.sin(r*2+i)*.35*Math.sin(n*Math.PI);return{cx:Math.cos(o)*c*(1-s),cy:Math.sin(o)*c*(1-s)-8*s,rx:3.6*(1+a*Math.sin(n*Math.PI)),ry:3.6/(1+a*Math.sin(n*Math.PI))}}if(e===`bloom`){if(t===0){let e=[1,2,3,4].reduce((e,t)=>e+nH(t,n),0),t=Math.sqrt(49-e*4);return{cx:Math.sin(r)*.4,cy:Math.sin(r*2)*.4,rx:t*(1+a),ry:t/(1+a)}}let e=nH(t,n),i=(t-1)*Math.PI/2-Math.PI/4+Math.sin(r)*.22;return{cx:Math.cos(i)*14*e,cy:Math.sin(i)*14*e,rx:3.2*(1+a),ry:3.2/(1+a)}}return{cx:Math.sin(r+i)*6+Math.sin(r*3+i)*2.5,cy:Math.cos(r*2+i)*6,...o}}var iH={line:1700,square:1900,donut:3e3,wander:4600,bloom:2800},aH=2;function oH({variant:e,pace:t=`working`}){let n=`caps-loader-${(0,G.useId)().replaceAll(`:`,``)}`,r=(0,G.useRef)(null),i=(0,G.useRef)(null),a=UR(i),{reduced:o}=a,s=e===`donut`?16:e===`bloom`?5:e===`square`?4:3;return(0,G.useLayoutEffect)(()=>{if(!r.current||!i.current||o&&t===`idle`)return;let n=o?[UV(r.current,{opacity:[.55,1],duration:a.slow*10,ease:`inOutSine`,alternate:!0,loop:!0})]:[...r.current.querySelectorAll(`ellipse`)].map((n,r)=>UV(n,{keyframes:Array.from({length:48},(n,i)=>({...rH(e,r,(i+1)/48),duration:WR(a,iH[e]*(t===`idle`?aH:1))/48})),ease:`linear`,loop:!0})),s=eH(i.current,e=>{for(let t of n)e?t.resume():t.pause()});return()=>{s();for(let e of n)e.revert()}},[e,t,o,a]),(0,Z.jsxs)(`svg`,{ref:i,"aria-hidden":`true`,focusable:`false`,viewBox:e===`line`?`-20 -10 40 20`:`-20 -20 40 40`,children:[(0,Z.jsxs)(`defs`,{children:[(0,Z.jsx)($V,{id:n,values:QV}),(0,Z.jsx)(YV,{id:`${n}-surface`,transform:e===`line`?`matrix(3.4 0 0 1.4 0 0)`:`matrix(3 0 0 3 0 0)`}),(0,Z.jsx)(XV,{id:`${n}-shadow`}),(0,Z.jsx)(`mask`,{id:`${n}-mask`,maskUnits:`userSpaceOnUse`,x:`-20`,y:`-20`,width:`40`,height:`40`,style:{maskType:`alpha`},children:(0,Z.jsx)(`g`,{ref:r,fill:`currentColor`,filter:`url(#${n})`,children:Array.from({length:s},(t,n)=>(0,Z.jsx)(`ellipse`,{...rH(e,n,0)},n))})})]}),(0,Z.jsx)(`g`,{filter:`url(#${n}-shadow)`,children:(0,Z.jsx)(`rect`,{x:`-20`,y:`-20`,width:`40`,height:`40`,fill:`url(#${n}-surface)`,mask:`url(#${n}-mask)`})})]})}var sH={sm:`caps-loader-sm`,md:`caps-loader-md`,lg:`caps-loader-lg`,fill:`caps-loader-fill`},cH={neutral:`text-base-content`,accent:`text-accent`,primary:`text-primary`,success:`text-success`,current:`text-current`},lH=(0,G.forwardRef)(function({"aria-label":e,"aria-labelledby":t,className:n,decorative:r=!1,label:i=`Loading`,size:a=`md`,variant:o=`line`,pace:s=`working`,tone:c=`neutral`,...l},u){let d=`${(0,G.useId)()}-label`,f=!r&&e===void 0&&t===void 0;return(0,Z.jsxs)(`span`,{...l,"aria-label":r?void 0:e,"aria-hidden":r||void 0,"aria-labelledby":r?void 0:t??(e===void 0?d:void 0),className:Q(`caps-loader`,sH[a],cH[c],n),"data-variant":o,"data-pace":s,role:r?void 0:`status`,ref:u,children:[(0,Z.jsx)(oH,{variant:o,pace:s}),f?(0,Z.jsx)(LR,{id:d,children:i}):null]})}),uH=Object.freeze({ease:`linear`,duration:0});function dH(e,t){let n=KR(e,t.duration);return n<=0?uH:e.steps>0?{ease:qV(e.steps),duration:n}:{ease:KV({bounce:GR(e,t.bounce),duration:n}),duration:n}}function fH(e,t){let n=WR(e,t.duration);return{ease:e.steps>0?qV(e.steps):t.ease,duration:n}}var pH={dot:{y:-4,height:8,cy:0},pill:{y:-16,height:32,cy:0},bang:{y:-16,height:20,cy:12}};function mH({className:e,glyph:t,motion:n}){let r=`caps-status-${(0,G.useId)().replaceAll(`:`,``)}`,i=(0,G.useRef)(null),a=(0,G.useRef)(null),o=(0,G.useRef)(null),s=(0,G.useRef)(null),c=(0,G.useRef)(null),l=(0,G.useRef)(null),u=(0,G.useRef)(pH[t]).current,d=(0,G.useRef)(t===`dot`?1:4).current,f=(0,G.useRef)(+(t===`bang`)).current,p=(0,G.useRef)(t),m=UR(s),{reduced:h}=m;return(0,G.useLayoutEffect)(()=>{if(!i.current||!a.current||!c.current||!l.current)return;let e=pH[t],n=h||p.current===t;p.current=t;let r=BR(i.current),o=n?{duration:0}:dH(r,{bounce:.3,duration:360}),s=UV(i.current,{y:e.y,height:e.height,...o}),u=UV(a.current,{cy:e.cy,...n?{duration:0}:{delay:WR(r,35),...dH(r,{bounce:.3,duration:420})}}),d=UV(c.current,{gradientTransform:`matrix(1 0 0 ${t===`dot`?`1`:`4`} 0 0)`,...o}),f=UV(l.current,{opacity:+(t===`bang`),...n?uH:fH(r,{ease:`inOutSine`,duration:220})});return()=>{s.cancel(),u.cancel(),d.cancel(),f.cancel()}},[t,h]),(0,G.useLayoutEffect)(()=>{if(!o.current||!s.current||h||n===`none`)return;let e=n===`pulse`?UV(o.current,{opacity:[1,.45],...fH(m,{ease:`inOutSine`,duration:750}),alternate:!0,loop:!0}):UV(o.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}},...fH(m,{ease:`inOutSine`,duration:1e3}),loop:!0}),t=eH(s.current,t=>{t?e.resume():e.pause()});return()=>{t(),e.revert()}},[n,h,m]),(0,Z.jsxs)(`svg`,{ref:s,"aria-hidden":`true`,className:`caps-status-bead ${e??``}`,width:`8`,height:`8`,viewBox:`-4 -4 8 8`,focusable:`false`,children:[(0,Z.jsxs)(`defs`,{children:[(0,Z.jsx)($V,{id:r,values:QV}),(0,Z.jsx)(YV,{ref:c,id:`${r}-surface`,transform:`matrix(1 0 0 ${String(d)} 0 0)`}),(0,Z.jsxs)(`radialGradient`,{id:`${r}-drop-light`,gradientUnits:`userSpaceOnUse`,cx:`-1.2`,cy:`10.4`,r:`5.6`,children:[(0,Z.jsx)(`stop`,{offset:`0`,stopColor:`var(--color-white)`,style:{stopOpacity:`calc(var(--depth) * 0.5)`}}),(0,Z.jsx)(`stop`,{offset:`1`,stopColor:`var(--color-white)`,stopOpacity:`0`})]}),(0,Z.jsx)(XV,{id:`${r}-shadow`}),(0,Z.jsx)(`mask`,{id:`${r}-silhouette`,maskUnits:`userSpaceOnUse`,x:`-12`,y:`-24`,width:`24`,height:`48`,style:{maskType:`alpha`},children:(0,Z.jsxs)(`g`,{fill:`var(--color-white)`,filter:`url(#${r})`,children:[(0,Z.jsx)(`rect`,{ref:i,x:`-4`,y:u.y,width:`8`,height:u.height,rx:`4`}),(0,Z.jsx)(`circle`,{ref:a,cx:`0`,cy:u.cy,r:`4`})]})})]}),(0,Z.jsx)(`g`,{ref:o,filter:`url(#${r}-shadow)`,children:(0,Z.jsxs)(`g`,{mask:`url(#${r}-silhouette)`,children:[(0,Z.jsx)(`rect`,{x:`-12`,y:`-24`,width:`24`,height:`48`,fill:`url(#${r}-surface)`}),(0,Z.jsx)(`rect`,{ref:l,x:`-12`,y:`-24`,width:`24`,height:`48`,fill:`url(#${r}-drop-light)`,opacity:f})]})})]})}var hH=.28;function gH(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?hH: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 _H=7.25;function vH({className:e,glyph:t,progress:n}){let r=`caps-status-mark-${(0,G.useId)().replaceAll(`:`,``)}`,i=(0,G.useRef)(null),a=(0,G.useRef)(null),o=(0,G.useRef)(null),s=(0,G.useRef)(null),c=(0,G.useRef)(null),l=(0,G.useRef)(null),u=(0,G.useRef)(null),d=(0,G.useRef)(null),f=(0,G.useRef)(gH(t,n)).current,p=(0,G.useRef)(t),m=$R();(0,G.useLayoutEffect)(()=>{let e=i.current,r=a.current,c=o.current,f=s.current,h=l.current,g=u.current,_=d.current;if(!e||!r||!c||!f||!h||!g||!_)return;let v=gH(t,n),y=p.current;p.current=t;let b=BR(e),x=m||y===t&&t!==`arc`,S=x?m?{ease:b.ease,duration:b.fast}:uH:fH(b,{ease:`outQuad`,duration:160}),C=(t===`check`||t===`cross`)&&!x,w=fH(b,{ease:`inOutSine`,duration:220}),T=[UV(r,{opacity:v.dashes,...S}),UV(c,{opacity:v.track*.28,...S}),UV(f,{opacity:v.arc,"stroke-dasharray":`${String(v.sweep)} 1`,...x?m?uH:S:w}),UV(h,{r:v.disc*_H,...C?{delay:w.duration*.7,...dH(b,{bounce:.35,duration:360})}:m?uH:fH(b,{ease:`inCubic`,duration:140})}),UV(g,{"stroke-dashoffset":1-v.tick,...C&&v.tick>0?{delay:w.duration*.7+b.fast,...fH(b,{ease:`outCubic`,duration:240})}:uH}),UV(_,{"stroke-dashoffset":1-v.cross,...C&&v.cross>0?{delay:w.duration*.7+b.fast,...fH(b,{ease:`outCubic`,duration:240})}:uH})];return t===`cross`&&C&&b.shake>0&&T.push(UV(e,{translateX:[0,-b.shake,b.shake,-b.shake/2,0],delay:w.duration+b.fast,...fH(b,{ease:`linear`,duration:300})})),()=>{for(let e of T)e.cancel()}},[t,n,m]);let h=t===`arc`&&n===void 0&&!m;return(0,G.useLayoutEffect)(()=>{if(!h||!c.current||!i.current)return;let e=BR(i.current),t=UV(c.current,{rotate:[0,360],...fH(e,{ease:`linear`,duration:900}),loop:!0}),n=eH(i.current,e=>{e?t.resume():t.pause()});return()=>{n(),t.revert()}},[h]),(0,Z.jsxs)(`svg`,{ref:i,"aria-hidden":`true`,className:`caps-status-mark ${e??``}`,viewBox:`0 0 16 16`,focusable:`false`,children:[(0,Z.jsxs)(`defs`,{children:[(0,Z.jsx)(YV,{id:`${r}-surface`,transform:`matrix(1.6 0 0 1.6 8 8)`}),(0,Z.jsxs)(`mask`,{id:`${r}-knock`,maskUnits:`userSpaceOnUse`,x:`0`,y:`0`,width:`16`,height:`16`,children:[(0,Z.jsx)(`rect`,{width:`16`,height:`16`,fill:`var(--color-white)`}),(0,Z.jsx)(`path`,{ref:u,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-f.tick}),(0,Z.jsx)(`path`,{ref:d,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-f.cross})]})]}),(0,Z.jsx)(`circle`,{ref:a,cx:`8`,cy:`8`,r:`6.25`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeDasharray:`1.7 2.2`,opacity:f.dashes}),(0,Z.jsx)(`circle`,{ref:o,cx:`8`,cy:`8`,r:`6.25`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,opacity:f.track*.28}),(0,Z.jsx)(`g`,{ref:c,className:`caps-status-mark-spin`,children:(0,Z.jsx)(`circle`,{ref:s,cx:`8`,cy:`8`,r:`6.25`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,pathLength:1,strokeDasharray:`${String(f.sweep)} 1`,transform:`rotate(-90 8 8)`,opacity:f.arc})}),(0,Z.jsx)(`circle`,{ref:l,cx:`8`,cy:`8`,r:f.disc*_H,fill:`url(#${r}-surface)`,mask:`url(#${r}-knock)`})]})}var yH=new Set([`ring`,`arc`,`check`,`cross`]);function bH(e){return yH.has(e)}var xH={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`},SH=(0,G.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,Z.jsxs)(`span`,{...c,className:Q(`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:[bH(n)?(0,Z.jsx)(vH,{className:xH[i],glyph:n,progress:s}):(0,Z.jsx)(mH,{className:xH[i],glyph:n,motion:r}),t===void 0?null:(0,Z.jsx)(`span`,{children:t})]})}),CH=(0,G.createContext)(void 0),wH=(0,G.createContext)(null);function TH({container:e,children:t}){let n=(0,G.useContext)(wH),r=(0,G.useMemo)(()=>n===null?null:{...n,popover:e},[n,e]);return r===null?t:(0,Z.jsx)(wH.Provider,{value:r,children:t})}function EH(e){let t=(0,G.useContext)(wH);return t===null?Object.hasOwn(globalThis,`document`)?document.body:null:t[e]}function DH(e){let t=(0,G.useContext)(CH),n=(0,G.useRef)(e);n.current=e,(0,G.useEffect)(()=>t?.(()=>{n.current()}),[t])}var OH=`(max-width: 600px)`,kH=globalThis;function AH(e){let t=kH.matchMedia?.(OH);return t?.addEventListener(`change`,e),()=>{t?.removeEventListener(`change`,e)}}function jH(){return(0,G.useSyncExternalStore)(AH,()=>kH.matchMedia?.(OH).matches??!1,()=>!1)}function MH({className:e,...t}){let n=EH(`toast`),r=jH();return n?(0,WF.createPortal)((0,Z.jsx)(SI,{position:r?`bottom-center`:`top-right`,swipeDirections:r?[`bottom`]:[`right`,`top`],mobileOffset:{top:16,bottom:`max(16px, env(safe-area-inset-bottom))`,left:16,right:16},offset:16,gap:8,icons:{close:(0,Z.jsx)(QI,{"aria-hidden":`true`,size:12}),success:(0,Z.jsx)(SH,{glyph:`dot`,tone:`success`}),error:(0,Z.jsx)(SH,{glyph:`dot`,tone:`error`}),warning:(0,Z.jsx)(SH,{glyph:`dot`,tone:`warning`}),info:(0,Z.jsx)(SH,{glyph:`dot`,tone:`info`}),loading:(0,Z.jsx)(lH,{decorative:!0,size:`sm`,tone:`current`,variant:`wander`})},className:Q(`caps-toaster`,e),...t}),n):null}function NH(e){return/\.mp3$/iu.test(e)}var PH=Object.freeze({width:4,height:3}),FH=`prints-generation-notices`;function IH(e){sI.error(e,{id:`prints-playback-error`,toasterId:FH})}function LH(e){return/\.mp4$/iu.test(e)}async function RH(e,t){if(LH(e.name)){let n=document.createElement(`video`);return n.preload=`metadata`,n.muted=!0,await new Promise((e,r)=>{n.addEventListener(`loadedmetadata`,()=>{e()},{once:!0}),n.addEventListener(`error`,()=>{r(Error(`MP4 metadata could not be read`))},{once:!0}),n.src=t}),{file:e,url:t,width:n.videoWidth,height:n.videoHeight}}if(NH(e.name)){let n=new Audio;return n.preload=`metadata`,await new Promise((e,r)=>{n.addEventListener(`loadedmetadata`,()=>{e()},{once:!0}),n.addEventListener(`error`,()=>{r(Error(`MP3 metadata could not be read`))},{once:!0}),n.src=t}),{file:e,url:t,...PH}}let n=new Image;return n.src=t,await n.decode(),{file:e,url:t,width:n.naturalWidth,height:n.naturalHeight}}var zH=4096,BH=255,VH=new TextEncoder,HH=Ux(eS.pipe(Y(MS(1)),Y(FS(zH)),Y(hS(e=>!e.includes(`\0`)&&e.split(`/`).every(e=>e!==``&&e!==`.`&&e!==`..`&&VH.encode(e).byteLength<=BH),{description:`a relative folder inside the library`}))));function UH(e,t){return t===void 0?e:`${e}/${t}`}function WH(e,t){let n=`${e}/`;if(!t.startsWith(n))return;let r=t.slice(n.length).split(`/`).slice(0,-1).join(`/`);return HH(r)?r:void 0}function GH(e){if(e===void 0)return[];let t=e.split(`/`);return t.map((e,n)=>({name:e,folder:t.slice(0,n+1).join(`/`)}))}J({queue:aS(eS.pipe(Y(FS(zH)))).pipe(Y(MS(1))),offset:tS.pipe(Y(AS()),Y(DS(0)))});function KH(e){return!e.selectable&&e.atFolderRoot&&!e.loading&&!e.failed}var qH=eo({error:U()}),JH=U().min(1).max(4096),YH=mo([`not_granted`,`not_found`,`conflict`,`invalid`,`unavailable`]),XH=eo({moved:Qa(eo({from:JH,to:JH})),failed:Qa(eo({path:JH,error:YH}))}),ZH=eo({files:Qa(eo({path:JH,kind:mo([`image`,`video`,`audio`]).nullable(),model:U().nullable(),modelLabel:U().nullable(),durationSeconds:Ra().nullable(),favorite:Ha()}))}),QH=eo({paths:Qa(JH),next:JH.nullable()});async function $H(e,t,n,r){let i=await e.capabilities.require(iP).call(t,JSON.stringify(n)),a=r.safeParse(i);if(a.success)return a.data;let o=qH.safeParse(i);throw new X(o.success?`Prints refused ${t}: ${o.data.error}`:`Prints answered ${t} in an unexpected shape`,{code:`PROTOCOL`,retryable:!1})}function eU(e,t){return $H(e,`moveFiles`,{paths:[...t.paths],folder:t.folder,createFolder:t.createFolder??!1,name:t.name},XH)}async function tU(e,t){return(await $H(e,`describeFiles`,{paths:[...t]},ZH)).files}async function nU(e,t,n){await $H(e,`setFavorite`,{paths:[...t],favorite:n},eo({favorite:Ha(),count:Ra()}))}function rU(e,t,n){return $H(e,`listFavorites`,{after:t,limit:n},QH)}var iU=24,aU=256,oU=e=>e===null?null:e.kind===`folder`?e.path:`${e.kind}:${e.path}`,sU={all:e=>$N.of(e,`prints`,`gallery`),listings:e=>[...sU.all(e),`listing`],listing:(e,t)=>[...sU.listings(e),t],file:(e,t)=>[...sU.all(e),`file`,t],describedAll:e=>[...sU.all(e),`described`],described:(e,t)=>[...sU.describedAll(e),...t]};function cU(e,t){return t.modifiedAt-e.modifiedAt||(e.path<t.path?-1:+(e.path>t.path))}function lU(e){let t=new Map;for(let n of e)for(let e of n.entries)t.set(e.path,e);return[...t.values()].sort(cU)}var uU=/\.(avif|gif|jpe?g|png|svg|webp|mp4|mp3)$/i;function dU(e,t){let n=e?.context.get().computerId,r=t?.path??null,i={queue:r===null?[]:[r],offset:0,after:null};return Gw({queryKey:sU.listing(e,oU(t)),initialPageParam:i,enabled:!!(n&&r&&e.capabilities.has(TF)&&e.capabilities.has(LF)),queryFn:async({pageParam:r,signal:i})=>{if(!e||!n||!t)throw new X(`No Computer folder selected`,{code:`SELECTION_CHANGED`,retryable:!1});let a=()=>{if(i.throwIfAborted(),e.context.get().computerId!==n)throw new X(`Computer selection changed`,{code:`SELECTION_CHANGED`,retryable:!1})};if(t.kind===`favorites`){let n=[];a();let i=await rU(e,r.after,aU);return a(),{entries:i.paths.filter(e=>uU.test(e)).map(e=>({path:e,name:e.slice(e.lastIndexOf(`/`)+1),modifiedAt:0,size:0,...fU(t.path,e)})),folders:n,next:i.next===null?null:{queue:[],offset:0,after:i.next}}}let o=[],s=[],c=[...r.queue],l=r.offset;for(;o.length<aU&&c.length>0;){a();let n=c[0],r=await zF(e.capabilities,{path:n,limit:aU-o.length,offset:l});if(a(),r.nextOffset!==null&&r.nextOffset<=l)throw new X(`Directory pagination did not advance`,{code:`PROTOCOL`,retryable:!1});let i=r.path.replace(/\/$/,``);for(let e of r.entries)e.name.startsWith(`.`)||(e.type===`directory`?t.kind===`all`?c.push(`${i}/${e.name}`):s.push(e.name):e.type===`file`&&uU.test(e.name)&&o.push({...e,path:`${i}/${e.name}`,...fU(t.path,`${i}/${e.name}`)}));r.nextOffset===null?(c=c.slice(1),l=0):l=r.nextOffset}return{entries:o,folders:s,next:c.length===0?null:{queue:c,offset:l,after:null}}},getNextPageParam:e=>e.next})}function fU(e,t){let n=WH(e,t);return n===void 0?{}:{folder:n}}function pU(e,t,n){return{...nP(e,LF,[...sU.file(e,t.path),t.modifiedAt,t.size],async(n,r)=>{if(!e)throw new X(`Prints disconnected`,{code:`DISCONNECTED`,retryable:!0});let i=await RF(e.capabilities,{path:t.path},{signal:r});return new File([i],i.name,{type:i.type,lastModified:t.modifiedAt})}),enabled:!!(n&&e?.context.get().computerId&&e.capabilities.has(LF)),structuralSharing:!1}}function mU(e,t){let n=e?.app??null,r=ON(n),i=vC(),[a,o]=(0,G.useState)(()=>new Set),s=(0,G.useCallback)(e=>{if(!r)return;let t=`${r}:${e}`;o(e=>e.has(t)?e:new Set([...e,t]))},[r]),c=(0,G.useCallback)(e=>{s(e),i.resetQueries({queryKey:sU.file(n,e)})},[n,i,s]),l=dU(n,t),u=Xw(l),d=u.fetchNextPage;(0,G.useEffect)(()=>{l.enabled&&u.hasNextPage&&!u.isFetching&&!u.error&&d({cancelRefetch:!1})},[l.enabled,u.hasNextPage,u.isFetching,u.error,d]);let f=!u.hasNextPage||u.error!==null,p=(0,G.useMemo)(()=>l.enabled&&u.data&&f?lU(u.data.pages):[],[u.data,l.enabled,f]),m=`${r??``}|${oU(t)??``}`,[h,g]=(0,G.useState)({key:m,count:iU}),_=h.key===m?h.count:iU,v=(0,G.useMemo)(()=>p.slice(0,_),[p,_]),y=p.length>_,b=(0,G.useCallback)(e=>({files:e.flatMap((e,t)=>e.data?[{path:v[t].path,file:e.data}]:[]),failures:e.flatMap((e,t)=>e.isError?[v[t].name]:[]),loading:e.some(e=>e.isLoading)}),[v]),x=Vw({queries:v.map(e=>pU(n,e,!!(r&&a.has(`${r}:${e.path}`)))),combine:b});return(0,G.useEffect)(()=>{if(!n)return;let e=sU.all(n),t=sU.listings(n),a=!0;i.invalidateQueries({queryKey:e});let o=()=>{i.cancelQueries({queryKey:e})},s=n.context.subscribe(e=>{e.computerId!==r&&o()}),c=n.lifecycle.subscribe(e=>{(e===`disconnected`||e===`disposing`||e===`disposed`)&&o()}),l=n.capabilities.subscribe(()=>{queueMicrotask(()=>{!a||n.context.get().computerId!==r||i.resetQueries({queryKey:t})})});return()=>{a=!1,s(),c(),l(),o()}},[n,r,e,i]),{entries:v,folders:(0,G.useMemo)(()=>[...new Set(u.data?.pages.flatMap(e=>e.folders)??[])],[u.data]),loadFile:s,retryFile:c,files:x.files,failures:x.failures,error:u.error,loading:u.isFetching||!f||x.loading,hasNextPage:y,nextPageReady:y,refresh:()=>{u.refetch({cancelRefetch:!1})},loadMore:()=>{y&&g({key:m,count:_+iU})}}}function hU(e){return e.replace(/\s/gu,` `).replace(/ +/g,` `).trim()}function gU(e,t,n){let r=e.replace(/\/$/,``),i=t.lastIndexOf(`.`),a=i>0?t.slice(0,i):t,o=i>0?t.slice(i):``,s=`${r}/${t}`;for(let e=2;n(s);e+=1)s=`${r}/${a} ${String(e)}${o}`;return s}async function _U(e,t){let n=e.replace(/\/$/,``),r=new Set,i=0;for(;i!==null;){let e=await t(i);if(e.nextOffset!==null&&e.nextOffset<=i)throw Error(`Directory pagination did not advance`);for(let t of e.entries)r.add(`${n}/${t.name}`);i=e.nextOffset}return r}J({computerId:LS});var vU=eS.pipe(Y(FS(4096)),Y(hS(e=>e.startsWith(`/`)&&e!==`/`&&!e.includes(`\0`)&&!e.endsWith(`/`)&&!e.split(`/`).some(e=>e===`.`||e===`..`))));J({path:lS(vU)});var yU=function(e,t,n){if(t!=null){if(typeof t!=`object`&&typeof t!=`function`)throw TypeError(`Object expected.`);var r,i;if(n){if(!Symbol.asyncDispose)throw TypeError(`Symbol.asyncDispose is not defined.`);r=t[Symbol.asyncDispose]}if(r===void 0){if(!Symbol.dispose)throw TypeError(`Symbol.dispose is not defined.`);r=t[Symbol.dispose],n&&(i=r)}if(typeof r!=`function`)throw TypeError(`Object not disposable.`);i&&(r=function(){try{i.call(this)}catch(e){return Promise.reject(e)}}),e.stack.push({value:t,dispose:r,async:n})}else n&&e.stack.push({async:!0});return t},bU=(function(e){return function(t){function n(n){t.error=t.hasError?new e(n,t.error,`An error was suppressed during disposal.`):n,t.hasError=!0}var r,i=0;function a(){for(;r=t.stack.pop();)try{if(!r.async&&i===1)return i=0,t.stack.push(r),Promise.resolve().then(a);if(r.dispose){var e=r.dispose.call(r.value);if(r.async)return i|=2,Promise.resolve(e).then(a,function(e){return n(e),a()})}else i|=1}catch(e){n(e)}if(i===1)return t.hasError?Promise.reject(t.error):Promise.resolve();if(t.hasError)throw t.error}return a()}})(typeof SuppressedError==`function`?SuppressedError:function(e,t,n){var r=Error(n);return r.name=`SuppressedError`,r.error=e,r.suppressed=t,r}),xU=class extends X{stage;provider;constructor(e){super(e.message,{code:e.code,retryable:e.retryable,...e.need!==void 0&&{need:e.need}}),this.stage=e.stage??null,this.provider=e.provider}},SU=e=>eS.pipe(Y(MS(1)),Y(FS(e))),CU=J({requestId:SU(256),computerId:SU(256)}),wU=tS.pipe(Y(AS()),Y(hS(Number.isSafeInteger,{message:`Expected a safe integer`}))),TU=wU.pipe(Y(ES(0))),EU=wU.pipe(Y(DS(0))),DU=tS.pipe(Y(bS()),Y(DS(0))),OU=tS.pipe(Y(bS()),Y(ES(0))),kU=cS([`first-frame`,`last-frame`,`reference`]),AU=cS([`480p`,`720p`,`768p`,`1080p`,`4k`]),jU=cS([`16:9`,`4:3`,`1:1`,`3:4`,`9:16`,`21:9`,`9:21`]),MU=J({computerId:q(SU(256)),path:SU(4096),role:q(kU)}),NU=J({path:SU(4096),role:kU}),PU=J({computerId:SU(256),path:SU(4096)}),FU=J({defaultHeight:TU,defaultSteps:lS(EU),defaultWidth:TU,dimensions:cS([`none`,`own`]),guidance:lS(J({default:DU,max:OU,min:DU})).pipe(Yx),maxDimension:lS(TU),maxDimensionDocumented:nS,maxReferences:EU,maxSteps:lS(TU),referenceDimension:lS(TU),referenceField:lS(SU(256)),referenceFormat:cS([`png`,`webp`]),steps:cS([`steps`,`num_steps`,`fixed`]),transport:cS([`json`,`multipart`])}),IU=J({minSeconds:TU,maxSeconds:TU,defaultSeconds:TU,durations:aS(TU),provider:cS([`seedance`,`veo`,`minimax`]),formats:aS(J({resolution:AU,aspectRatio:jU,width:TU,height:TU})),defaultResolution:AU,defaultAspectRatio:jU,supportsAudio:nS,defaultGenerateAudio:lS(nS),referenceRoles:aS(kU),maxReferenceImages:EU,audioReferences:lS(J({max:TU,totalSeconds:TU})),referenceResolutions:aS(AU),prices:aS(J({resolution:AU,silentMilliunitsPerSecond:TU,audioMilliunitsPerSecond:TU}))}),LU=J({provider:Xx(`elevenlabs`),mode:cS([`speech`,`music`]),voices:aS(J({id:SU(64),label:SU(128)})),defaultVoiceId:lS(SU(64)),seconds:lS(J({min:TU,max:TU,default:TU})),milliunitsPerUnit:TU}),RU=J({operation:cS([`remove_background`,`upscale`]),source:J({formats:aS(cS([`png`,`jpeg`,`webp`])),maxBytes:TU,maxPixels:TU}),defaultMegapixels:lS(TU),milliunits:lS(TU),sizes:aS(J({megapixels:TU,milliunits:TU}))}),zU=aS(J({id:SU(256),input:FU,kind:cS([`image`,`video`,`audio`]),label:SU(512),maxPromptLength:TU,tier:cS([`draft`,`balanced`,`premium`,`max`]),outputFormats:aS(cS([`png`,`jpeg`,`webp`])).pipe(Y(FS(3))),sizes:lS(aS(eS.pipe(Y(vS(/^\d+x\d+$/u))))),video:lS(IU),audio:lS(LU),transform:lS(RU),billingUnit:cS([`image`,`video_second`,`audio_second`,`audio_character_block`])})),BU=J({[Symbol.dispose]:q(Zx),computerId:SU(256),models:zU,canGenerate:nS}),VU=J({model:SU(256),prompt:SU(32e3),width:q(TU.pipe(Y(OS(5040)))),height:q(TU.pipe(Y(OS(5040)))),voiceId:q(SU(64)),steps:q(TU),durationSeconds:q(TU),targetMegapixels:q(TU),resolution:q(AU),aspectRatio:q(jU),generateAudio:q(nS),references:q(aS(MU).pipe(Y(FS(16))))});J({model:SU(256),prompt:SU(2048),resolution:q(AU),aspectRatio:q(jU),durationSeconds:q(TU.pipe(Y(DS(4)),Y(OS(15)))),generateAudio:q(nS),references:q(aS(NU).pipe(Y(FS(4))))});var HU=[`admission`,`generation-authorization`,`settings`,`estimate`,`billing`,`operation`,`provider`,`normalization`,`artifact`,`destination-authorization`,`destination-write`],UU=J({destination:J({path:SU(4096)}),settings:Zx}),WU=J({[Symbol.dispose]:q(Zx),bytes:TU,costMilliunits:EU,destination:PU,format:cS([`png`,`jpeg`,`gif`,`webp`,`mp4`,`mp3`]),height:q(TU),model:SU(256),width:q(TU)});J({...WU.fields,format:Xx(`mp4`)});var GU=J({message:SU(512),stage:q(cS(HU)),provider:q($S),code:cS([`CANCELLED`,`CAPABILITY_DENIED`,`CAPABILITY_REVOKED`,`DAILY_LIMIT_REACHED`,`DISCONNECTED`,`HOST_FAILURE`,`IDENTITY`,`INSUFFICIENT_CREDIT`,`INVALID_ARGUMENT`,`MEDIA_PROVIDER_FAILURE`,`MEDIA_PROVIDER_FAILURE_UNCHARGED`,`PROTOCOL`,`SAFETY_FILTER_REFUSED`,`SETUP_REQUIRED`,`TIMEOUT`]),retryable:nS,need:q(GS)}),KU=sS([J({[Symbol.dispose]:q(Zx),kind:Xx(`succeeded`),result:WU}),J({[Symbol.dispose]:q(Zx),kind:Xx(`failed`),failure:GU})]),qU=FN({reference:LN(IN(Ka().transform(e=>qx(CU)(e)))),generate:LN(IN(Ka().transform(e=>{let t=qx(KU,{onExcessProperty:`error`})(e);return t.kind===`succeeded`?{kind:t.kind,result:{bytes:t.result.bytes,costMilliunits:t.result.costMilliunits,destination:t.result.destination,format:t.result.format,...t.result.height!==void 0&&{height:t.result.height},model:t.result.model,...t.result.width!==void 0&&{width:t.result.width}}}:{kind:t.kind,failure:t.failure}})))}),JU=PN(`media.generation`,5,Ro(()=>FN({describe:LN(IN(Ka().transform(e=>{let{computerId:t,canGenerate:n,models:r}=qx(BU,{onExcessProperty:`error`})(e);return{computerId:t,canGenerate:n,models:r}}))),quote:LN(IN(W({costMilliunits:Ra().int().nonnegative().max(2**53-1)}))).optional(),createAttempt:LN(qU),restoreAttempt:LN(qU),cancelAttempt:RN}))),YU=ro([W({shared:go(!1)}),W({shared:go(!0),url:xa(),showPrompt:Ha()})]);W({requestId:U().min(1).max(256),showPrompt:Ha()});var XU=PN(`media.share`,1,Ro(()=>FN({status:LN(IN(YU)),share:LN(IN(YU)),stop:LN(IN(YU))})));function ZU(e,t){try{return qx(e,{onExcessProperty:`error`})(t)}catch(e){throw new X(`The Media capability returned malformed data`,{cause:e,code:`PROTOCOL`,retryable:!1})}}function QU(e){return e instanceof X?e:new X(`The Media capability failed`,{cause:e,code:`HOST_FAILURE`,retryable:!0})}function $U(e){if(e?.aborted)throw new X(`Media generation was cancelled`,{code:`CANCELLED`,retryable:!1})}function eW(e){let t;try{t=qx(UU,{onExcessProperty:`error`})(e)}catch(e){throw new X(`Media generation input is invalid`,{cause:e,code:`INVALID_ARGUMENT`,retryable:!1})}let n;try{n=nW(qx(VU,{onExcessProperty:`error`})(t.settings))}catch(e){throw new X(`Media generation settings are invalid`,{cause:e,code:`INVALID_ARGUMENT`,retryable:!1})}let r={path:t.destination.path.trim()};if(r.path.length===0)throw new X(`Media generation destination is invalid`,{code:`INVALID_ARGUMENT`,retryable:!1});return Object.freeze({destination:Object.freeze(r),settings:n})}function tW(e){try{return nW(qx(VU,{onExcessProperty:`error`})(e))}catch(e){throw new X(`Media generation settings are invalid`,{cause:e,code:`INVALID_ARGUMENT`,retryable:!1})}}function nW(e){let t=(e,t)=>{let n=e.trim();if(n.length===0)throw Error(`${t} must not be blank`);return n},n={model:t(e.model,`model`),prompt:t(e.prompt,`prompt`)};return e.width!==void 0&&(n.width=e.width),e.height!==void 0&&(n.height=e.height),e.voiceId!==void 0&&(n.voiceId=t(e.voiceId,`voiceId`)),e.steps!==void 0&&(n.steps=e.steps),e.durationSeconds!==void 0&&(n.durationSeconds=e.durationSeconds),e.targetMegapixels!==void 0&&(n.targetMegapixels=e.targetMegapixels),e.resolution!==void 0&&(n.resolution=e.resolution),e.aspectRatio!==void 0&&(n.aspectRatio=e.aspectRatio),e.generateAudio!==void 0&&(n.generateAudio=e.generateAudio),e.references!==void 0&&(n.references=Object.freeze(e.references.map(e=>Object.freeze({...e,path:t(e.path,`reference`)})))),Object.freeze(n)}function rW(e){let t=ZU(zU,e),n=new Set;for(let e of t){if(n.has(e.id))throw new X(`The Media capability repeated a model`,{code:`PROTOCOL`,retryable:!1});n.add(e.id)}return Object.freeze(t.map(e=>Object.freeze(e)))}function iW(e,t,n,r){let i=ZU(WU,e);if(i.model!==t.settings.model||i.destination.computerId!==n||i.destination.path!==t.destination.path||i.width!==t.settings.width||i.height!==t.settings.height||!r&&t.settings.width===void 0!=(i.format===`mp3`))throw new X(`The Media capability returned an unrelated result`,{code:`PROTOCOL`,retryable:!1});return Object.freeze({bytes:i.bytes,costMilliunits:i.costMilliunits,destination:Object.freeze({...i.destination}),format:i.format,...i.height!==void 0&&{height:i.height},model:i.model,...i.width!==void 0&&{width:i.width}})}async function aW(e){try{let t=e.require(JU);{let e={stack:[],error:void 0,hasError:!1};try{let n=ZU(BU,yU(e,SM(await t.describe()),!1).value),r=n.computerId.trim();if(r.length===0)throw new X(`The Media capability returned no Computer`,{code:`PROTOCOL`,retryable:!1});let i=rW(n.models),a=t.quote?.bind(t),o=async e=>{let n=SM(e),a;try{{let t={stack:[],error:void 0,hasError:!1};try{let n=yU(t,SM(await e.reference()),!1),i=ZU(J({...CU.fields,[Symbol.dispose]:q(Zx)}),n.value);if(a={requestId:i.requestId,computerId:i.computerId},a.computerId!==r)throw new X(`Media attempt belongs to another Computer`,{code:`IDENTITY`,retryable:!1})}catch(e){t.error=e,t.hasError=!0}finally{bU(t)}}}catch(e){throw n[Symbol.dispose](),QU(e)}let o=!1;return{reference:Object.freeze(a),async generate(n,s={}){if(o)throw new X(`Media generation attempt is closed`,{code:`CAPABILITY_DENIED`,retryable:!1});$U(s.signal);let c=eW(n),l=s.signal,u,d,f=()=>(d??=t.cancelAttempt(a),d);try{let t=e.generate(c),n=l===void 0?await t:await Promise.race([t,new Promise((e,t)=>{u=()=>{f().then(()=>{t(new X(`Media generation was cancelled`,{code:`CANCELLED`,retryable:!1}))},t)},l.addEventListener(`abort`,u,{once:!0}),l.aborted&&u()})]);l?.aborted&&(await f(),$U(l)),$U(l);{let e={stack:[],error:void 0,hasError:!1};try{let t=ZU(KU,yU(e,SM(n),!1).value);if(t.kind===`failed`)throw new xU(t.failure);return iW(t.result,c,r,i.find(e=>e.id===c.settings.model)?.transform!=null)}catch(t){e.error=t,e.hasError=!0}finally{bU(e)}}}catch(e){throw l?.aborted&&(await f(),$U(l)),QU(e)}finally{u!==void 0&&l?.removeEventListener(`abort`,u)}},[Symbol.dispose](){o||(o=!0,n[Symbol.dispose]())}}};return Object.freeze({computerId:r,canGenerate:n.canGenerate,models:i,async quote(e){let t={stack:[],error:void 0,hasError:!1};try{let n=tW(e);if(a===void 0)return null;let r=yU(t,SM(await a(n)),!1);return Object.freeze({costMilliunits:r.value.costMilliunits})}catch(e){t.error=e,t.hasError=!0}finally{bU(t)}},async createAttempt(){return o(await t.createAttempt())},async restoreAttempt(e){let n=ZU(CU,e);if(n.computerId!==r)throw new X(`Select the original Computer to retry this generation`,{code:`IDENTITY`,retryable:!1});let i=await o(await t.restoreAttempt(n));if(i.reference.requestId!==n.requestId)throw i[Symbol.dispose](),new X(`Media restore changed the request identity`,{code:`PROTOCOL`,retryable:!1});return i}})}catch(t){e.error=t,e.hasError=!0}finally{bU(e)}}}catch(e){throw QU(e)}}function oW(e,t,n={}){console.error(`Prints operation failed`,JSON.stringify({operation:e,...n.requestId!==void 0&&{requestId:n.requestId},errorKind:t instanceof Error?`error`:`non-error`,errorName:t instanceof Error?t.name:null,stage:t instanceof xU?t.stage:null,provider:t instanceof xU?t.provider:void 0}),cg(t))}function sW(e,t){let[n,r]=(0,G.useState)([]),i=(0,G.useRef)(new Map),a=(0,G.useRef)(Promise.resolve()),[o,s]=(0,G.useState)(null),c=(0,G.useRef)(new Map),l=(0,G.useRef)(e);l.current=e;let u=(0,G.useRef)(t);u.current=t;let d=(e,t,n)=>{let a=i.current.get(e);a&&i.current.set(e,{...a,status:t,message:n}),r([...i.current.values()])},f=(0,G.useCallback)(async(e,t)=>{let n=()=>t.signal.aborted;if(n()){d(e.id,`cancelled`,`Cancelled before sending`),c.current.delete(e.id);return}let r=e.dimensions;if(!r)try{let t=await RH(e.file,e.previewUrl);r={width:t.width,height:t.height},e.dimensions=r;let n=i.current.get(e.id);n&&i.current.set(e.id,{...n,dimensions:r})}catch(t){oW(`decode-upload-image`,t),d(e.id,`error`,`Could not decode this image. No upload was sent.`),c.current.delete(e.id);return}try{if(n()){d(e.id,`cancelled`,`Cancelled before sending`);return}if(e.app.context.get().computerId!==e.computerId){d(e.id,`error`,`Computer changed. Select the original Computer and retry. No upload was sent.`);return}u.current({id:e.id,path:e.path,computerId:e.computerId,app:e.app,width:r.width,height:r.height}),d(e.id,`sending`,`Sending; awaiting Computer completion`),await UF(e.app.capabilities,{path:e.path,content:e.file.slice()},{signal:t.signal}),d(e.id,`complete`,`Written to Computer`);try{await l.current(e.path,e.app,e.computerId)}catch(t){oW(`refresh-upload-preview`,t),d(e.id,`complete`,`Written; fresh preview unavailable`)}}catch(t){n()||oW(`write-computer-upload`,t),d(e.id,n()?`cancelled`:`error`,n()?`Cancelled request; check Computer before retrying`:`Completion not confirmed; check Computer or retry`)}finally{c.current.delete(e.id)}},[]),p=e=>{let t=new AbortController;c.current.set(e.id,t),d(e.id,`queued`,`Queued`),a.current=a.current.then(()=>f(e,t))},m=(0,G.useCallback)(()=>{for(let e of c.current.values())e.abort()},[]);return(0,G.useEffect)(()=>()=>{m();for(let e of i.current.values())URL.revokeObjectURL(e.previewUrl)},[m]),{items:n,error:o,cancelAll:m,add(e,t,n,r=new Set){s(null);let a=[...i.current.values()].reduce((e,t)=>e+t.file.size,0);for(let o of e){if(!o.type.startsWith(`image/`)){s(`Only image files can be uploaded here`);continue}if(i.current.size>=8||a+o.size>67108864){s(`Upload queue limit: eight files and 64 MiB. Remove finished rows before adding more.`);break}let e=n.context.get().computerId;if(!e){s(`Select a Computer before uploading images.`);continue}let c=gU(t,hU(o.name),e=>r.has(e)||i.current.has(e)),l={computerId:e,id:c,file:o,previewUrl:URL.createObjectURL(o),app:n,path:c,status:`queued`,message:`Queued`};i.current.set(l.id,l),a+=o.size,p(l)}},cancel(e){c.current.get(e)?.abort()},retry(e){let t=n.find(t=>t.id===e);t&&!c.current.has(e)&&p(t)},remove(e){if(!c.current.has(e)){let t=i.current.get(e);t&&URL.revokeObjectURL(t.previewUrl),i.current.delete(e),r([...i.current.values()])}}}}function cW(e){return e.source.kind===`computer`?`${e.source.computerId}:${e.source.path}`:e.file.name}function lW(e){return e.connection.app.ui.openNavigation({computerId:e.computerId,path:e.path})}function uW(e){let[t,n]=(0,G.useState)(!1);return(0,G.useEffect)(()=>{if(n(!1),!e?.capabilities.has(rF))return;let t=!0;return e.capabilities.require(rF).role(oF).then(e=>{t&&n(e!==null)},e=>{oW(`files-editor-role`,e)}),()=>{t=!1}},[e]),t}function dW(e,t){let n=t.landingPath,r=ON(e?.app),i=(0,G.useRef)(new Set),a=(0,G.useRef)(0),o=(0,G.useRef)(e);o.current=e;let s=e?.app.capabilities.has(TF)===!0,c=e?.app.capabilities.has(LF)===!0,l=e?.app.capabilities.has(BF)===!0,u=mU(e,t.source),[d,f]=(0,G.useState)([]),[p,m]=(0,G.useState)([]),[h,g]=(0,G.useState)([]),[_,v]=(0,G.useState)([]);(0,G.useEffect)(()=>{v([])},[e]);let y=e=>{v(t=>t.some(t=>t.key===e.key)?t.map(t=>t.key===e.key?e:t):[...t,e])},[b,x]=(0,G.useState)(!1),S=(0,G.useMemo)(()=>[...u.error?[`Could not refresh the Media gallery`]:[],...u.failures],[u.error,u.failures]),C=(0,G.useRef)(new WeakMap),w=(0,G.useMemo)(()=>{if(!c||!s)return d.filter(e=>e.kind===`local`);let t=r?u.files.map(({file:t,path:n})=>({kind:`computer`,computerId:r,connection:e,file:t,path:n})):[],i=d.filter(t=>t.kind===`local`||t.computerId===r&&t.connection===e&&t.path.slice(0,t.path.lastIndexOf(`/`))===n?.replace(/\/$/,``));return[...t.filter(e=>!i.some(t=>t.kind===`computer`&&e.kind===`computer`&&t.path===e.path)),...i]},[e,r,n,u.files,d,c,s]),T=(0,G.useCallback)(()=>{a.current+=1;for(let e of i.current)e.abort();i.current.clear()},[]);(0,G.useEffect)(()=>{if(!e)return()=>{T()};let t=e.app.lifecycle.subscribe(e=>{(e===`disconnected`||e===`disposing`||e===`disposed`)&&T()});return()=>{t(),T()}},[e,T]),(0,G.useEffect)(()=>{if(e)return e.app.context.subscribe(e=>{e.computerId!==r&&T()})},[e,r,T]),(0,G.useEffect)(()=>{v([]),f(e=>e.filter(e=>e.kind===`local`))},[r]);let E=(0,G.useCallback)(async(e,t,n)=>{let r=n??t.app.context.get().computerId;if(!r){g([`The selected Computer is unavailable`]);return}if(o.current!==t){g([`Computer selection changed`]);return}if(t.app.context.get().computerId!==r){g([`Computer selection changed before the preview was loaded`]);return}let s=a.current,c=new AbortController;i.current.add(c);try{let n=await RF(t.app.capabilities,{path:e},{signal:c.signal});if(c.signal.aborted||s!==a.current)return;v(t=>t.map(t=>t.key===`${r}:${e}`?{...t,previewFile:n}:t)),f(i=>[...i.filter(t=>t.kind!==`computer`||t.path!==e||t.computerId!==r),{kind:`computer`,computerId:r,file:n,path:e,connection:t}])}catch(t){c.signal.aborted||(oW(`read-computer-file`,t),g([`Could not read ${e}`]),v(t=>t.map(t=>t.key===`${r}:${e}`?{...t,error:`Saved; preview unavailable. Retry loading it.`}:t)))}finally{i.current.delete(c)}},[]),D=(0,G.useCallback)(t=>{let n=d.find(n=>n.kind===`computer`&&n.connection===e&&n.computerId===r&&n.path===t);n?.kind===`computer`?E(t,n.connection,n.computerId):u.retryFile(t)},[d,e,r,E,u.retryFile]),O=(0,G.useRef)(new Set),k=(0,G.useRef)(new Set),A=(0,G.useRef)(new Map),j=(0,G.useRef)(new Map),M=(0,G.useCallback)(e=>{URL.revokeObjectURL(e),O.current.delete(e);let t=j.current.get(e);t&&A.current.delete(t),j.current.delete(e)},[]);(0,G.useEffect)(()=>{let e=!0,t=new Set,n=new Map,r=new Set,i=[...w].sort((e,t)=>cU({modifiedAt:e.file.lastModified,path:e.kind===`computer`?e.path:e.file.name},{modifiedAt:t.file.lastModified,path:t.kind===`computer`?t.path:t.file.name})).map(e=>{let t=A.current.get(e.file)??URL.createObjectURL(e.file);return A.current.set(e.file,t),j.current.set(t,e.file),O.current.add(t),{source:e,file:e.file,url:t}}),a=i.length;return g(S),x(a>0),a===0&&m([]),i.forEach(({file:o,url:s,source:c},l)=>{let u=C.current.get(o);u||(u=(async()=>{let e=URL.createObjectURL(o);try{let{width:t,height:n}=await RH(o,e);return{width:t,height:n}}finally{URL.revokeObjectURL(e)}})(),C.current.set(o,u)),u.then(r=>{e&&(n.set(l,{...r,file:o,url:s,source:c}),t.add(s),m(i.flatMap((e,t)=>{let r=n.get(t);return r?[r]:[]})),v(e=>e.map(e=>e.previewFile===o?{...e,resolved:!0,previewFile:void 0,error:void 0}:e)))}).catch(t=>{e&&(oW(`decode-gallery-image`,t),M(s),r.add(o.name),g([...S,...r]),c.kind===`computer`&&v(e=>e.map(e=>e.key===`${c.computerId}:${c.path}`?{...e,error:`Could not decode the saved image.`}:e)))}).finally(()=>{--a,e&&a===0&&(x(!1),m(i.flatMap((e,t)=>{let r=n.get(t);return r?[r]:[]})))})}),()=>{e=!1;for(let{url:e}of i)!t.has(e)&&!k.current.has(e)&&M(e)}},[w,S,M]),(0,G.useEffect)(()=>{let e=new Set(p.map(e=>e.url));for(let t of k.current)e.has(t)||M(t);k.current=e},[p,M]),(0,G.useEffect)(()=>{let e=O.current;return()=>{for(let t of e)URL.revokeObjectURL(t);e.clear()}},[]);let N=sW(async(e,t,n)=>{let r=o.current,i=r?.app===t&&t.context.get().computerId===n?r:null;i&&await E(e,i,n)},e=>{o.current?.app===e.app&&e.app.context.get().computerId===e.computerId&&y({key:`${e.computerId}:${e.path}`,path:e.path,computerId:e.computerId,width:e.width,height:e.height,uploadId:e.id})});return(0,G.useEffect)(()=>{let t=N.cancelAll,n=e?.app.lifecycle.subscribe(e=>{(e===`disposing`||e===`disconnected`||e===`disposed`)&&t()});return()=>{n?.(),t()}},[e,N.cancelAll]),{images:p,failed:h,loading:b,gallery:u,gallerySlots:_,canBrowse:s,canRead:c,canWrite:l,reserveSlot:y,addComputerFile:E,retryFile:D,uploads:N,uploadFiles:async i=>{if(!e||!l||n===null)return;let a=e,s=r,c=await t.ensureCreated();if(c){g([c]);return}if(o.current!==a||a.app.context.get().computerId!==s)return;let u;try{u=await _U(n,e=>zF(a.app.capabilities,{path:n,limit:500,offset:e}))}catch(e){oW(`list-upload-destination`,e),g([`Could not check the Computer folder. No upload was sent.`]);return}o.current===a&&a.app.context.get().computerId===s&&N.add(i,n,a.app,u)},failSlot:(e,t)=>{v(n=>n.map(n=>n.key===e?{...n,error:t}:n))},clearSlotError:e=>{v(t=>t.map(t=>t.key===e?{...t,error:void 0}:t))},removeSlot:e=>{v(t=>t.filter(t=>t.key!==e))}}}var fW=aP+18e4,pW=`4 generations are running. Wait for one to finish.`,mW=J({error:Xx(`generation_limit`),limit:jS,message:eS}),hW=class extends X{constructor(e){super(e,{code:`CONFLICT`,retryable:!0})}};function gW(e,t){return e.computerId===void 0||e.computerId===t}var _W=`@cf/black-forest-labs/flux-2-klein-4b`,vW=`Image creation is unavailable for this Computer right now.`,yW=`Didn’t finish`,bW={landscape:{height:768,width:1024},portrait:{height:1024,width:768},square:{height:1024,width:1024}},xW=[`landscape`,`portrait`,`square`];function SW(e){return e instanceof xU&&e.stage===`provider`&&e.provider!==void 0&&`reason`in e.provider&&e.provider.reason===`credits_exhausted`}function CW(e){return e.requestId===void 0?``:` Ref ${e.requestId.slice(-8)}.`}var wW={invalid_request:`the media service rejected the request (invalid_request)`,unauthorized:`the media service refused Fungi’s credentials (unauthorized)`,unavailable:`the media service is unavailable (unavailable)`,rate_limited:`the media service is busy (rate_limited)`,too_large:`the request was too large for the media service (too_large)`,unreachable:`Fungi couldn’t reach the media service (unreachable)`,invalid_response:`the media service sent an answer Fungi couldn’t read (invalid_response)`};function TW(e){if(e===void 0)return{cause:`the media service didn’t report why (internal error)`,next:`Retry, or pick another model.`,retryable:!1,unexplained:!0};if(e.category===`media_service`)return{cause:wW[e.failure],next:e.failure===`rate_limited`?`Retry in a minute.`:`Retry, or pick another model.`,retryable:e.failure===`rate_limited`,unexplained:!0};if(e.category===`result_download`)return{cause:`the finished file couldn’t be downloaded (HTTP ${String(e.status)})`,next:`Retry, or pick another model.`,retryable:!1};switch(e.reason){case`content_refused`:return{title:`Generation refused`,cause:`the provider refused the prompt (content policy)`,next:`Reword the prompt, then retry.`,retryable:!1};case`invalid_input`:return{cause:e.detail===void 0?`the provider rejected the input`:`the provider rejected the input (${e.detail})`,next:`Check the prompt and the reference image’s size and format.`,retryable:!1};case`rate_limited`:return{cause:`the provider is overloaded`,next:`Retry in a minute.`,retryable:!0};case`provider_unavailable`:return{cause:`the provider is down right now`,next:`Retry in a minute.`,retryable:!0};case`timeout`:return{title:`Still waiting`,cause:`the provider timed out`,next:`Retry to ask again.`,retryable:!0};case`spending_limit`:return{cause:`the provider’s daily allowance is used up`,next:`Try another model, or retry tomorrow.`,retryable:!1};case`credits_exhausted`:return{cause:`Cloudflare AI Gateway credits are used up`,next:`Choose a Workers AI model such as Flux.`,retryable:!1};case void 0:}return e.detail===void 0?e.category===`TimeoutError`||e.category===`AbortError`?{title:`Still waiting`,cause:`the provider timed out`,next:`Retry to ask again.`,retryable:!0}:{cause:e.code===null?`the provider failed without a reason (${e.category})`:`the provider failed with error ${String(e.code)} and gave no reason`,next:`Retry, or pick another model.`,retryable:!1,unexplained:!0}:{cause:`the provider said “${e.detail}”`,next:`Retry, or pick another model.`,retryable:!1}}function EW(e){if(!(e instanceof xU)||e.stage!==`provider`)return!1;if(e.code===`MEDIA_PROVIDER_FAILURE`||e.code===`MEDIA_PROVIDER_FAILURE_UNCHARGED`||e.code===`SAFETY_FILTER_REFUSED`)return!0;let t=e.provider;return t!==void 0&&(t.category===`result_download`||t.category===`media_service`||t.reason!==void 0||t.detail!==void 0)}function DW(e,t){let n=TW(e.code===`SAFETY_FILTER_REFUSED`?{category:`Error`,code:null,reason:`content_refused`}:e.provider),r=e.code===`MEDIA_PROVIDER_FAILURE_UNCHARGED`?` You weren’t charged.`:``;return{title:n.title??`Generation failed`,message:`${t.model??`The model`} stopped: ${n.cause}.${r} ${n.next}${n.unexplained===!0?CW(t):``}`,retryable:n.retryable}}var OW=Gx(J({code:cS(eC)}));function kW(e,t={}){if(e instanceof hW)return{title:`Too many generations`,message:e.message,retryable:!0};if(SW(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};if(EW(e))return DW(e,t);if(e instanceof xU&&e.stage!==`provider`)return{...lC(e),message:e.message};let n=t.model??`The model`;if(Ed(OW(e)))return{title:`Generation failed`,message:`${n} stopped: Prints hit an unexpected error (${e instanceof Error?e.name:`no error details`}). Retry, or pick another model.${CW(t)}`,retryable:!0};let r=`${n} stopped: the cause wasn’t reported (internal error).`;return lC(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:`${r} Retry, or pick another model.${CW(t)}`},MEDIA_PROVIDER_FAILURE_UNCHARGED:{title:`Generation failed`,message:`${r} You weren’t charged. Retry, or pick another model.${CW(t)}`},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:`Prints couldn’t reach the media service, and it didn’t say why. Try again.${CW(t)}`}})}function AW(e,t={}){let n=OW(e);return{reason:n._tag===`Some`?n.value.code:SW(e)?`INSUFFICIENT_CREDIT`:`UNKNOWN`,message:kW(e,t).message}}function jW(){return{destination:void 0,height:768,model:_W,prompt:``,references:[],steps:void 0,width:1024}}function MW(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 NW(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 MW(OM({count:4}),t,a)}function PW(e){return e?.kind===`audio`?e.audio?.mode===`music`?`Generate music`:`Generate speech`:e?.kind===`video`?`Generate video`:`Generate image`}function FW(e){return e.filter(e=>e.kind!==`audio`&&e.transform===null)}function IW(e){return e.filter(e=>e.kind===`audio`)}function LW(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 RW(e,t){return e?.kind===`audio`?PH:{width:t.width,height:t.height}}function zW(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 BW=(e,t)=>t===0?e:BW(t,e%t),VW=(e,t,n)=>n===void 0?`${String(e)} × ${String(t)} · ${YW(e,t)}`:`${String(e)} × ${String(t)} · ${String(n[0])}:${String(n[1])}`,HW=[[1,1],[4,3],[3,4],[3,2],[2,3],[16,9],[9,16],[21,9]],UW=16,WW=256,GW=4e6,KW=1048576;function qW(e,t,n,r){let i=Math.floor((e.input.maxDimension??4096)/UW)*UW,a=e=>Math.round(e/UW)*UW,o=e=>Math.min(i,Math.max(WW,e)),s=BW(t,n),c=t/s*UW,l=n/s*UW,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(KW/(c*l))));d=c*e,f=l*e}else{let e=t/n;d=u?e>=1?i:a(i*e):a(Math.sqrt(KW*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 JW(e){if(e.kind!==`image`||e.input.dimensions!==`own`)return[];let t=new Set,n=new Set;for(let e of xW){let{width:r,height:i}=bW[e],a=BW(r,i);n.add(`${String(r/a)}:${String(i/a)}`),t.add(`${String(r)}x${String(i)}`)}let r=[];for(let[i,a]of HW){let o=n.has(`${String(i)}:${String(a)}`)?[]:[{size:qW(e,i,a,!1),group:`Standard`}];e.input.maxDimensionDocumented&&o.push({size:qW(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:VW(e,n,[i,a]),width:e,height:n,group:s}))}}return r}function YW(e,t){let n=e/t,r=HW.find(([e,t])=>Math.abs(n/(e/t)-1)<=.02);if(r!==void 0)return`${String(r[0])}:${String(r[1])}`;let i=BW(e,t),a=e/i,o=t/i;return a<=21&&o<=21?`${String(a)}:${String(o)}`:`${n.toFixed(2)}:1`}function XW(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=HW.find(([e,r])=>Math.abs(t/n/(e/r)-1)<=.02);return i===void 0?qW(e,t,n,!1):qW(e,i[0],i[1],!1)}function ZW(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=BW(t,n),a=t/i,o=n/i;return a<=21&&o<=21?`${String(a)}:${String(o)}`:`${String(t)} × ${String(n)}`}function QW(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:VW(n,r),width:n,height:r,group:n*r>=GW?`Largest`:`Standard`}]}):[...xW.map(e=>({value:e,label:VW(bW[e].width,bW[e].height),...bW[e],group:`Standard`})),...e===void 0?[]:JW(e)]}function $W(e,t,n){return n?.kind===`video`&&t.kind===`video`||t.input.dimensions!==`none`&&Ld(Kx(lG(()=>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 eG(e){return e.label.split(` — `)[0]??e.label}function tG(e,t){return e.find(e=>e.id===t)}function nG(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 rG={"first-frame":`First frame`,"last-frame":`Last frame`,reference:`Reference`};function iG(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 aG(e){return e?.video?.referenceRoles??[]}function oG(e,t,n=!1){let r=aG(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 sG(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 cG(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=oG(e.references,t)),t.video?.supportsAudio===!0&&e.generateAudio!==void 0&&(r.generateAudio=e.generateAudio),{destination:{path:e.destination?.trim()??``},settings:r}}function lG(e){return J({model:eS,width:tS,height:tS,durationSeconds:Yx(uS(tS)),steps:Yx(uS(tS))}).check(hS(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 uG(e,t){let n=e.trim().length;return n>t.maxPromptLength?{length:n,excess:n-t.maxPromptLength}:null}function dG(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=uG(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=Kx(lG(()=>t))(e);if(Id(r))return Jg()(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 sG(oG(e.references,t),t,n?.resolution)}}var fG={remove_background:`Remove background`,upscale:`Upscale`};function pG(e,t){return e.find(e=>e.transform?.operation===t)}function mG(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 hG(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 gG(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:`${fG.upscale} to ${String(t)} MP`,references:[i],targetMegapixels:t}}return{model:e.id,prompt:fG[r.operation],references:[i]}}var _G=e=>{let t=e.lastIndexOf(`/`);return t<=0?`/`:e.slice(0,t)};function vG(e,t,n){let r=gG(e,t,n),i={model:e.id,prompt:r.prompt,references:r.references??[],width:t.width,height:t.height},a=NW(i,_G(t.path),e);return{input:{destination:{path:a},settings:r},draft:{...i,destination:a}}}var yG={readNotices:`member.readNotices`,dismissNotices:`member.dismissNotices`,listStyles:`member.listStyles`,saveStyle:`member.saveStyle`,deleteStyle:`member.deleteStyle`,readPrintStyle:`member.readPrintStyle`,listCharacters:`member.listCharacters`,saveCharacter:`member.saveCharacter`,deleteCharacter:`member.deleteCharacter`,readFolder:`member.readFolder`,selectFolder:`member.selectFolder`,rememberGeneration:`member.rememberGeneration`,failGeneration:`member.failGeneration`,forgetGeneration:`member.forgetGeneration`,completeGeneration:`member.completeGeneration`,listGenerations:`member.listGenerations`};function bG(e,t,n){return e.require(iP).call(t,n)}var xG=LS,SG=aS(LS.pipe(Y(FS(1024)))).pipe(Y(FS(200)));J({computerId:xG}),J({computerId:xG,keys:SG});var CG=qx(J({keys:SG}));async function wG(e,t){return CG(await bG(e,yG.readNotices,JSON.stringify({computerId:t})))}async function TG(e,t,n){return CG(await bG(e,yG.dismissNotices,JSON.stringify({computerId:t,keys:n})))}J({computerId:xG,path:vU});var EG=qx(J({path:vU,configured:nS}));async function DG(e,t){return EG(await bG(e,yG.readFolder,JSON.stringify({computerId:t})))}async function OG(e,t,n){return EG(await bG(e,yG.selectFolder,JSON.stringify({computerId:t,path:n})))}var kG=2048,AG=8e3,jG=[{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})),MG=eS.pipe(Y(MS(1)),Y(FS(64))),NG=eS.pipe(Y(MS(1)),Y(FS(AG))),PG=LS,FG=J({id:jS,name:MG,text:NG,builtIn:nS});J({computerId:PG,id:q(jS),name:MG,text:NG}),J({computerId:PG,id:jS}),J({computerId:PG,path:LS});var IG=J({styles:aS(FG).pipe(Y(FS(50+jG.length)))}),LG=J({style:lS(MG)});function RG(e,t){let n=t.trim();return e===void 0?n:`${e.trim()}\n\n${n}`}function zG(e){return e?.maxPromptLength??kG}function BG(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 VG=qx(IG);async function HG(e,t){return VG(await bG(e,yG.listStyles,JSON.stringify({computerId:t})))}async function UG(e,t,n){return VG(await bG(e,yG.saveStyle,JSON.stringify({computerId:t,id:n.id,name:n.name,text:n.text})))}async function WG(e,t,n){return VG(await bG(e,yG.deleteStyle,JSON.stringify({computerId:t,id:n})))}async function GG(e,t,n){return qx(LG)(await bG(e,yG.readPrintStyle,JSON.stringify({computerId:t,path:n})))}var KG=/(?<![\p{L}\p{N}_@-])@image(\d+)(?![\p{L}\p{N}_-])/giu,qG=e=>`image${String(e)}`;function JG(e){let t=[];for(let n of e.matchAll(KG)){let e=Number(n.at(1));t.includes(e)||t.push(e)}return t}var YG=(e,t)=>JSON.stringify([e.computerId??t,e.path]),XG={labels:new Map,next:1};function ZG(e,t,n){let r=JG(n).length>0;if(t.length===0)return e.labels.size===0&&(e.next===1||r)?e:r?{labels:new Map,next:e.next}:XG;let i=e.labels.size>0&&t.every(t=>!e.labels.has(t))?XG: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 QG(e,t){return t.map(t=>e.labels.get(t)??0)}function $G(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 eK(e,t,n){let r=[],i=e.replace(KG,(e,i)=>{let a=t.indexOf(Number(i)),o=a<0?void 0:n.at(a);if(o===void 0){let t=qG(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 tK(e,t){return e.replace(KG,(e,n)=>{let r=t(Number(n));return r===void 0||r<1?e:`@${qG(r)}`})}var nK=8,rK=eS.pipe(Y(MS(1)),Y(FS(32)),Y(vS(/^[\p{L}\p{N}_-]+$/u)),Y(vS(/^(?!image\d+$)/iu))),iK=eS.pipe(Y(FS(500))),aK=aS(J({path:LS.pipe(Y(FS(4096)))})).pipe(Y(FS(8))),oK=LS,sK=J({id:jS,name:rK,description:iK,references:aK});J({computerId:oK,id:q(jS),name:rK,description:iK,references:aK}),J({computerId:oK,id:jS});var cK=J({characters:aS(sK).pipe(Y(FS(50)))}),lK=(e,t)=>e.toLowerCase()===t.toLowerCase(),uK=/(?<![\p{L}\p{N}_@-])@([\p{L}\p{N}_-]+)/gu;function dK(e){let t=[];for(let n of e.matchAll(uK)){let e=n.at(1);e!==void 0&&!t.some(t=>lK(t,e))&&t.push(e)}return t}function fK(e,t){let n=[];return{prompt:e.replace(uK,(e,r)=>{let i=t.find(e=>lK(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 pK(e,t,n){let r=e.trim();return RG(t,fK(r,n).prompt).length-r.length}function mK(e,t){let n=dK(e),r=t.filter(e=>!n.some(t=>lK(t,e)));return r.length===0?e:`${r.map(e=>`@${e}`).join(` `)} ${e}`}function hK(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 gK(e){return{kind:`ready`,prompt:e,references:[],characters:[]}}function _K(e){let t=mK(e.prompt,e.names??[]),n=fK(t,e.saved),r=hK(e.references,n.characters,e.computerId),i=(e.wording??(e=>$G(e,void 0)))(r),a=eK(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:fK(a.prompt,e.saved).prompt,references:r,characters:n.characters}}function vK(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 yK(e,t,n){let r=n.toLowerCase(),i=e=>qG(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})),...bK(e,n).map(e=>({kind:`character`,character:e}))]}function bK(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,nK)}var xK=qx(cK);async function SK(e,t){return xK(await bG(e,yG.listCharacters,JSON.stringify({computerId:t})))}async function CK(e,t,n){return xK(await bG(e,yG.saveCharacter,JSON.stringify({computerId:t,id:n.id,name:n.name,description:n.description,references:n.references})))}async function wK(e,t,n){return xK(await bG(e,yG.deleteCharacter,JSON.stringify({computerId:t,id:n})))}var TK={models:e=>$N.of(e,`prints`,`models`),folder:e=>$N.of(e,`prints`,`folder`),dismissals:e=>$N.of(e,`prints`,`dismissals`),styles:e=>$N.of(e,`prints`,`styles`),printStyle:(e,t)=>$N.of(e,`prints`,`print-style`,t),characters:e=>$N.of(e,`prints`,`characters`)};function EK(e){return{...nP(e,JU,TK.models(e),async(t,n)=>{if(!e)throw Error(`Prints is disconnected`);let r=await aW(e.capabilities);return n.throwIfAborted(),r}),enabled:!!(e?.context.get().computerId&&e.capabilities.has(JU)),structuralSharing:!1}}function DK(e){let t=e?.context.get().computerId;return{...nP(e,iP,TK.folder(e),async(n,r)=>{if(!e||!t)throw Error(`No Computer selected`);let i=await DG(e.capabilities,t);if(r.throwIfAborted(),e.context.get().computerId!==t)throw new X(`Computer selection changed`,{code:`SELECTION_CHANGED`,retryable:!1});return i}),enabled:!!(t&&e.capabilities.has(iP))}}function OK(e){let t=e?.context.get().computerId;return{...nP(e,iP,TK.dismissals(e),async(n,r)=>{if(!e||!t)throw Error(`No Computer selected`);let i=await wG(e.capabilities,t);return r.throwIfAborted(),i}),enabled:!!(t&&e.capabilities.has(iP))}}function kK(e){let t=e?.context.get().computerId;return{...nP(e,iP,TK.styles(e),async(n,r)=>{if(!e||!t)throw Error(`No Computer selected`);let i=await HG(e.capabilities,t);return r.throwIfAborted(),i}),enabled:!!(t&&e.capabilities.has(iP))}}function AK(e,t){let n=e?.context.get().computerId;return{...nP(e,iP,TK.printStyle(e,t??``),async(r,i)=>{if(!e||!n||t===null)throw Error(`No print selected`);let a=await GG(e.capabilities,n,t);return i.throwIfAborted(),a}),enabled:!!(n&&t!==null&&e.capabilities.has(iP))}}function jK(e){let t=e?.context.get().computerId;return{...nP(e,iP,TK.characters(e),async(n,r)=>{if(!e||!t)throw Error(`No Computer selected`);let i=await SK(e.capabilities,t);return r.throwIfAborted(),i}),enabled:!!(t&&e.capabilities.has(iP))}}var MK=e=>eS.pipe(Y(MS(1)),Y(FS(e))),NK=tS.pipe(Y(AS()),Y(hS(Number.isSafeInteger,{message:`Expected a safe integer`}))),PK=NK.pipe(Y(ES(0))),FK=J({reference:CU,result:J({bytes:PK,costMilliunits:NK.pipe(Y(DS(0))),destination:J({computerId:MK(256),path:MK(4096)}),format:cS([`png`,`jpeg`,`gif`,`webp`,`mp4`,`mp3`]),height:q(PK),model:MK(256),width:q(PK)}),derivedFrom:q(MK(256)),references:q(aS(lS(MK(256))))}),IK=J({prompt:LS,references:jS.pipe(Y(DS(0)))}),LK=J({reason:cS([...eC,`UNKNOWN`]),message:LS.pipe(Y(FS(512)))}),RK=J({reference:CU,input:UU,typed:IK,style:q(MG),characters:q(aS(rK)),failure:q(LK)});J({record:RK}),J({reference:CU,failure:LK}),J({reference:CU}),J({after:lS(eS)});function zK(e){return{reference:e.reference,input:eW(e.input),typed:e.typed,style:e.style,characters:e.characters,failure:e.failure}}async function BK(e,t){let n=zK(qx(RK,{onExcessProperty:`error`})(t)),r=qx(sS([RK,mW]),{onExcessProperty:`error`})(await bG(e,yG.rememberGeneration,JSON.stringify({record:n})));if(`error`in r)throw new hW(r.message);let i=zK(r);if(JSON.stringify(i)!==JSON.stringify(n))throw new X(`Prints did not confirm the original generation command`,{code:`PROTOCOL`,retryable:!1});return i}async function VK(e,t,n){qx(RK,{onExcessProperty:`error`})(await bG(e,yG.failGeneration,JSON.stringify({reference:t,failure:n})))}async function HK(e,t){qx(J({removed:nS}))(await bG(e,yG.forgetGeneration,JSON.stringify({reference:t})))}async function UK(e,t=null){let n=qx(J({records:aS(RK),next:lS(eS)}),{onExcessProperty:`error`})(await bG(e,yG.listGenerations,JSON.stringify({after:t})));return{records:n.records.map(zK),next:n.next}}async function WK(e,t,n){let r=qx(FK,{onExcessProperty:`error`})({reference:t,result:n}),i=qx(J({printId:eS,computerId:eS}))(await bG(e,yG.completeGeneration,JSON.stringify(r)));if(i.printId!==t.requestId||i.computerId!==t.computerId)throw new X(`Prints did not confirm the saved generation`,{code:`PROTOCOL`,retryable:!1})}var GK=Gx(J({reference:CU}));function KK({connection:e,folder:t,effects:n,styles:r,characters:i}){let a=e?.app??null,o=ON(a),s=(0,G.useRef)(e);s.current=e;let c=(0,G.useRef)(n);c.current=n;let l=vC(),u=$N.of(a,`prints`,`generation`),d=[...u,`recovery`],f=Uw(EK(a)),p=f.isError?void 0:f.data,m=p?.models??[],h=a?.capabilities.has(JU)===!0,g=p?.canGenerate??!1,_=f.error?lC(f.error).message:p?.models.length===0?`The granted Media model registry is empty.`:null,v=Xw({queryKey:d,enabled:a!==null&&o!==null,initialPageParam:null,queryFn:async({pageParam:e,signal:t})=>{if(!a)throw new X(`Prints disconnected`,{code:`DISCONNECTED`,retryable:!0});if(a.context.get().computerId!==o)throw new X(`Computer selection changed`,{code:`SELECTION_CHANGED`,retryable:!1});let n=await UK(a.capabilities,e);return t.throwIfAborted(),n},getNextPageParam:e=>e.next}),y=(0,G.useMemo)(()=>Array.from(new Map(v.data?.pages.flatMap(e=>e.records).map(e=>[e.reference.requestId,e])??[]).values()),[v.data]),b=(0,G.useRef)(new Map),x=(0,G.useRef)(new Set),S=(0,G.useRef)(0),C=(0,G.useRef)(new Map),w=(0,G.useRef)(new Set),T=(0,G.useRef)(new Map),E=(0,G.useRef)(new Set),[,D]=(0,G.useState)(0),[O,k]=(0,G.useState)([]),[A,j]=(0,G.useState)(null),[M,N]=(0,G.useState)(null),P=e=>{j(e),c.current.notifyFailure(e.message)},F=e=>{N(e),c.current.notifyFailure(e)},I=(0,G.useRef)(null);(0,G.useEffect)(()=>{I.current!==v.error&&(I.current=v.error,v.error&&c.current.notifyFailure(lC(v.error).message))},[v.error]);let L=e=>s.current===e.connection&&e.connection.app.context.get().computerId===e.reference.computerId,R=(e,t,n)=>{l.setQueryData(e,e=>e&&{...e,pages:e.pages.map(e=>({...e,records:e.records.map(e=>e.reference.requestId===t?{...e,failure:n}:e)}))})},z=(e,t)=>{l.setQueryData(e,e=>e&&{...e,pages:e.pages.map(e=>({...e,records:e.records.filter(e=>e.reference.requestId!==t)}))})},ee=(e,t)=>{l.setQueryData(e,e=>!e||e.pages.some(e=>e.records.some(e=>e.reference.requestId===t.reference.requestId))?e:{...e,pages:e.pages.map((e,n)=>n===0?{...e,records:[t,...e.records]}:e)})},te=Jw({mutationKey:[...u,`run`],mutationFn:async e=>{e.controller.signal.throwIfAborted();let t=zK({reference:e.reference,input:e.input,typed:e.typed,style:e.style,characters:e.characters});await BK(e.connection.app.capabilities,t),R(e.recoveryKey,e.reference.requestId,void 0),e.controller.signal.throwIfAborted();let n=await e.session.restoreAttempt(e.reference),r;try{r=await n.generate(t.input,{signal:e.controller.signal})}finally{n[Symbol.dispose]()}return await WK(e.connection.app.capabilities,t.reference,r),{input:e.input,result:r}},onMutate:e=>{if(!L(e)||e.controller.signal.aborted)return;let t=tG(e.session.models,e.input.settings.model),n={key:`${e.reference.computerId}:${e.input.destination.path}`,computerId:e.reference.computerId,path:e.input.destination.path,...RW(t,e.draft),pendingLabel:zW(t)};t?.kind===`video`&&(n.startedAt=Date.now(),n.resumed=e.resumed===!0),c.current.reserve(n)},onSuccess:(e,t)=>{z(t.recoveryKey,t.reference.requestId),C.current.delete(t.reference.requestId),!(!L(t)||t.controller.signal.aborted)&&c.current.saved(e,t.connection)},onError:(e,n)=>{if(oW(`generate-media`,e,{requestId:n.reference.requestId}),n.controller.signal.aborted){if(w.current.delete(n.reference.requestId)){let e={reason:`CANCELLED`,message:`Stopped. Retry to run it again.`};VK(n.connection.app.capabilities,n.reference,e).catch(e=>{oW(`fail-generation`,e)}),ee(n.recoveryKey,zK({reference:n.reference,input:n.input,typed:n.typed,style:n.style,characters:n.characters,failure:e})),R(n.recoveryKey,n.reference.requestId,e)}c.current.release(`${n.reference.computerId}:${n.input.destination.path}`);return}if(e instanceof hW){C.current.delete(n.reference.requestId),c.current.release(`${n.reference.computerId}:${n.input.destination.path}`),L(n)&&c.current.notifyFailure(e.message);return}let r=tG(n.session.models,n.input.settings.model),i={model:r===void 0?void 0:eG(r),requestId:n.reference.requestId},a=AW(e,i);if(VK(n.connection.app.capabilities,n.reference,a).catch(e=>{oW(`fail-generation`,e)}),!L(n))return;R(n.recoveryKey,n.reference.requestId,a);let o=kW(e,i),s={requestId:n.reference.requestId,path:n.input.destination.path,mediaKind:r?.kind??null,message:o.message,action:o.action,prompt:n.typed.prompt};k(e=>[...e.filter(e=>e.requestId!==s.requestId),s]),t.recheck(),c.current.notifyFailure(o.message),c.current.failed(`${n.reference.computerId}:${n.input.destination.path}`,yW)},onSettled:(e,t,n)=>{b.current.get(n.reference.requestId)===n.controller&&b.current.delete(n.reference.requestId)}}),B=Jw({mutationKey:[...u,`discard`],mutationFn:async e=>{await HK(e.connection.app.capabilities,e.reference)},onSuccess:(e,t)=>{z(t.recoveryKey,t.reference.requestId),C.current.delete(t.reference.requestId),k(e=>e.filter(e=>e.requestId!==t.reference.requestId))},onError:(e,t)=>{L(t)&&F(lC(e).message)},onSettled:(e,t,n)=>{b.current.get(n.reference.requestId)===n.controller&&b.current.delete(n.reference.requestId)}}),ne=qw({filters:{mutationKey:u,status:`pending`},select:e=>jd(GK(e.state.variables))?.reference.requestId}),re=new Set(ne.filter(e=>e!==void 0)),V=Date.now(),H=new Set([...re,...[...T.current].filter(([,e])=>V-e<fW).map(([e])=>e)]),ie=H.size>=4;(0,G.useEffect)(()=>{x.current.clear(),j(null),N(null),C.current.clear(),w.current.clear(),T.current.clear();for(let e of E.current)clearTimeout(e);E.current.clear(),k([]);let e=$N.of(a,`prints`,`generation`,`recovery`),t=a?.capabilities.subscribe(()=>{queueMicrotask(()=>{l.resetQueries({queryKey:e,exact:!0})})}),n=()=>{S.current+=1;for(let e of b.current.values())e.abort();b.current.clear(),l.cancelQueries({queryKey:e})},r=a?.context.subscribe(e=>{e.computerId!==o&&n()}),i=a?.lifecycle.subscribe(e=>{(e===`disposing`||e===`disposed`||e===`disconnected`)&&n()});return()=>{r?.(),i?.(),t?.(),n();for(let e of E.current)clearTimeout(e);E.current.clear()}},[a,o,e,l]);let ae=e=>{k(t=>t.filter(t=>t.requestId!==e));let t=C.current.get(e);if(!t||b.current.has(e))return;C.current.delete(e);let n=new AbortController;b.current.set(e,n),B.mutate({...t,controller:n,recoveryKey:d})},oe=e=>{let t=e.reference.requestId;if(b.current.has(t))return!1;if(!L(e))return F(`Select the original Computer to retry this generation.`),!1;if(p?.computerId!==e.reference.computerId)return F(`Media access is unavailable for the original Computer.`),!1;if(!H.has(t)&&ie)return F(pW),!1;let n=new AbortController;return b.current.set(t,n),C.current.set(t,e),T.current.delete(t),k(e=>e.filter(e=>e.requestId!==t)),j(null),N(null),S.current+=1,te.mutate({...e,session:p,controller:n,ticket:S.current,recoveryKey:d}),!0};(0,G.useEffect)(()=>{if(!(!e||!p||!v.isSuccess))for(let t of y){let n=t.reference.requestId;x.current.has(n)||t.reference.computerId!==o||tG(p.models,t.input.settings.model)?.kind!==`video`||oe({connection:e,...t,resumed:!0,draft:LW(t.input)})&&x.current.add(n)}},[e,o,p,v.isSuccess,y]);let se=async(n,a=n.references.map((e,t)=>t+1))=>{if(!e?.app.capabilities.has(BF)||!g)return!1;if(t.path===null)return t.setEditing(!0),!1;if(ie)return c.current.notifyFailure(pW),!1;let l=tG(m,n.model);if(l===void 0)return P({kind:`error`,mediaKind:null,message:`Choose a model from the granted registry.`}),!1;let u=JG(n.prompt).length>0,d=l.kind===`audio`?gK(n.prompt):_K({prompt:n.prompt,saved:i,references:n.references,labels:a,wording:e=>$G(oG(e,l,u),l),computerId:o,model:{label:l.label,maxReferences:l.input.maxReferences}});if(d.kind===`refused`)return P({kind:`error`,mediaKind:l.kind,message:d.message}),!1;let f=dG({...n,references:oG(d.references,l,u)},l);if(f)return P({kind:`error`,mediaKind:l.kind,message:f}),!1;let _=l.kind===`audio`?void 0:n.style,v=_===void 0?void 0:r.find(e=>e.name===_);if(_!==void 0&&v===void 0)return P({kind:`error`,mediaKind:l.kind,message:`The "${_}" style no longer exists. Pick another or none.`}),!1;let y=d.characters.map(e=>e.name),b=RG(v?.text,d.prompt),x=BG(b,zG(l),v?.name,y);if(x!==void 0)return P({kind:`error`,mediaKind:l.kind,message:x}),!1;if(!h||!p)return j(null),!1;let C=e,w=C.app.context.get().computerId,T=S.current,E={...n,prompt:b,references:oG(d.references,l,u),destination:NW(n,t.landingPath??t.path,l)},D=cG(E,l),O;try{let e=await t.ensureCreated();if(e)return P({kind:`error`,mediaKind:l.kind,message:e}),!1;if(S.current!==T||s.current!==C||C.app.context.get().computerId!==w)return!1;let n=await p.createAttempt();O=n.reference,n[Symbol.dispose]()}catch(e){return S.current===T&&s.current===C&&C.app.context.get().computerId===w&&P({kind:`error`,mediaKind:l.kind,...kW(e)}),!1}return S.current!==T||s.current!==C||C.app.context.get().computerId!==w?!1:oe({connection:C,reference:O,input:D,draft:E,typed:{prompt:tK(n.prompt.trim(),e=>{let t=a.indexOf(e);return t<0?void 0:t+1}),references:n.references.length},style:v?.name,characters:y})},ce=async(t,n,r)=>{if(!e?.app.capabilities.has(BF)||!g||!p)return vW;if(ie)return pW;let i=pG(m,n);if(i===void 0)return`${fG[n]} is not available on this Computer.`;let a=hG(i,t);if(a!==void 0)return a;let o=e,c=o.app.context.get().computerId;if(t.computerId!==c)return`Select this print's Computer to edit it.`;let l=S.current,{input:u,draft:d}=vG(i,t,r),f;try{let e=await p.createAttempt();f=e.reference,e[Symbol.dispose]()}catch(e){return kW(e).message}return S.current!==l||s.current!==o||o.app.context.get().computerId!==c?`The selected Computer changed. Try again.`:(oe({connection:o,reference:f,input:u,draft:d,typed:{prompt:u.settings.prompt,references:1},characters:[]}),null)},le=te.variables;return{state:A??(re.size>0&&le?{kind:`pending`,draft:le.draft}:null)??(!e||!h||o===null?{kind:`unavailable`,reason:`Image creation is unavailable for this Computer right now.`}:_?{kind:`unavailable`,reason:_}:p?{kind:`ready`}:{kind:`loading`}),models:m,session:p,modelsLoading:f.isFetching,modelsError:_,canGenerate:g,mediaCapability:h,retryModels:()=>{f.refetch()},submit:se,operate:ce,atLimit:ie,stopPath:e=>{for(let[t,n]of C.current){let r=b.current.get(t);if(n.input.destination.path!==e||!r||!re.has(t))continue;w.current.add(t),T.current.set(t,Date.now());let i=setTimeout(()=>{E.current.delete(i),D(e=>e+1)},fW+1e3);E.current.add(i),r.abort()}},activeGenerations:re,pendingGenerations:y,recoveryError:M??(v.error?lC(v.error).message:null),reportRecoveryError:e=>{F(lC(e).message)},hasMore:v.hasNextPage,loadMore:()=>{v.isFetching||v.fetchNextPage()},resume:t=>{if(!e||p?.computerId!==t.reference.computerId){F(`Select the original Computer to retry this generation.`);return}oe({connection:e,...t,draft:LW(t.input)})},discard:t=>{if(!e||b.current.has(t.reference.requestId))return;C.current.delete(t.reference.requestId),k(e=>e.filter(e=>e.requestId!==t.reference.requestId));let n=new AbortController;b.current.set(t.reference.requestId,n),B.mutate({...t,connection:e,controller:n,draft:LW(t.input),recoveryKey:d})},failures:O.map(e=>({...e,key:`generation:${e.requestId}`,retry:C.current.has(e.requestId)?()=>{let t=C.current.get(e.requestId);t&&L(t)&&oe(t)}:void 0,dismiss:()=>{ae(e.requestId)}})),retryPath:e=>{for(let t of C.current.values())if(!(t.input.destination.path!==e||!L(t)))return oe(t);return!1},promptAt:e=>{for(let t of C.current.values())if(t.input.destination.path===e)return t.typed.prompt},dismissPath:e=>{for(let[t,n]of C.current)n.input.destination.path===e&&ae(t)}}}function qK({update:e,notify:t,unwatched:n}){return{link:r,unlink:i,propagate:a,checkDirty:o,shallowPropagate:s};function r(e,t,n){let r=t.depsTail;if(r!==void 0&&r.dep===e)return;let i=r===void 0?t.deps:r.nextDep;if(i!==void 0&&i.dep===e){i.version=n,t.depsTail=i;return}let a=e.subsTail;if(a!==void 0&&a.version===n&&a.sub===t)return;let o=t.depsTail=e.subsTail={version:n,dep:e,sub:t,prevDep:r,nextDep:i,prevSub:a,nextSub:void 0};i!==void 0&&(i.prevDep=o),r===void 0?t.deps=o:r.nextDep=o,a===void 0?e.subs=o:a.nextSub=o}function i(e,t=e.sub){let r=e.dep,i=e.prevDep,a=e.nextDep,o=e.nextSub,s=e.prevSub;return a===void 0?t.depsTail=i:a.prevDep=i,i===void 0?t.deps=a:i.nextDep=a,o===void 0?r.subsTail=s:o.prevSub=s,s===void 0?(r.subs=o)===void 0&&n(r):s.nextSub=o,a}function a(e){let n=e.nextSub,r;top:do{let i=e.sub,a=i.flags;if(a&60?a&12?a&4?!(a&48)&&c(e,i)?(i.flags=a|40,a&=1):a=0:i.flags=a&-9|32:a=0:i.flags=a|32,a&2&&t(i),a&1){let t=i.subs;if(t!==void 0){let i=(e=t).nextSub;i!==void 0&&(r={value:n,prev:r},n=i);continue}}if((e=n)!==void 0){n=e.nextSub;continue}for(;r!==void 0;)if(e=r.value,r=r.prev,e!==void 0){n=e.nextSub;continue top}break}while(!0)}function o(t,n){let r,i=0,a=!1;top:do{let o=t.dep,c=o.flags;if(n.flags&16)a=!0;else if((c&17)==17){if(e(o)){let e=o.subs;e.nextSub!==void 0&&s(e),a=!0}}else if((c&33)==33){(t.nextSub!==void 0||t.prevSub!==void 0)&&(r={value:t,prev:r}),t=o.deps,n=o,++i;continue}if(!a){let e=t.nextDep;if(e!==void 0){t=e;continue}}for(;i--;){let i=n.subs,o=i.nextSub!==void 0;if(o?(t=r.value,r=r.prev):t=i,a){if(e(n)){o&&s(i),n=t.sub;continue}a=!1}else n.flags&=-33;n=t.sub;let c=t.nextDep;if(c!==void 0){t=c;continue top}}return a}while(!0)}function s(e){do{let n=e.sub,r=n.flags;(r&48)==32&&(n.flags=r|16,(r&6)==2&&t(n))}while((e=e.nextSub)!==void 0)}function c(e,t){let n=t.depsTail;for(;n!==void 0;){if(n===e)return!0;n=n.prevDep}return!1}}function JK(e,t,n){let r=typeof e==`object`,i=r?e:void 0;return{next:(r?e.next:e)?.bind(i),error:(r?e.error:t)?.bind(i),complete:(r?e.complete:n)?.bind(i)}}var YK=[],XK=0,{link:ZK,unlink:QK,propagate:$K,checkDirty:eq,shallowPropagate:tq}=qK({update(e){return e._update()},notify(e){YK[rq++]=e,e.flags&=-3},unwatched(e){e.depsTail!==void 0&&(e.depsTail=void 0,e.flags=17,sq(e))}}),nq=0,rq=0,iq,aq=0;function oq(e){try{++aq,e()}finally{--aq||cq()}}function sq(e){let t=e.depsTail,n=t===void 0?e.deps:t.nextDep;for(;n!==void 0;)n=QK(n,e)}function cq(){if(!(aq>0)){for(;nq<rq;){let e=YK[nq];YK[nq++]=void 0,e.notify()}nq=0,rq=0}}function lq(e,t){let n=typeof e==`function`,r=e,i={_snapshot:n?void 0:e,subs:void 0,subsTail:void 0,deps:void 0,depsTail:void 0,flags:+!n,get(){return iq!==void 0&&ZK(i,iq,XK),i._snapshot},subscribe(e){let t=JK(e),n={current:!1},r=uq(()=>{i.get(),n.current?t.next?.(i._snapshot):n.current=!0});return{unsubscribe:()=>{r.stop()}}},_update(e){let a=iq,o=t?.compare??Object.is;if(n)iq=i,++XK,i.depsTail=void 0;else if(e===void 0)return!1;n&&(i.flags=5);try{let t=i._snapshot,a=typeof e==`function`?e(t):e===void 0&&n?r(t):e;return t===void 0||!o(t,a)?(i._snapshot=a,!0):!1}finally{iq=a,n&&(i.flags&=-5),sq(i)}}};return n?(i.flags=17,i.get=function(){let e=i.flags;if(e&16||e&32&&eq(i.deps,i)){if(i._update()){let e=i.subs;e!==void 0&&tq(e)}}else e&32&&(i.flags=e&-33);return iq!==void 0&&ZK(i,iq,XK),i._snapshot}):i.set=function(e){if(i._update(e)){let e=i.subs;e!==void 0&&($K(e),tq(e),cq())}},i}function uq(e){let t=()=>{let t=iq;iq=n,++XK,n.depsTail=void 0,n.flags=6;try{return e()}finally{iq=t,n.flags&=-5,sq(n)}},n={deps:void 0,depsTail:void 0,subs:void 0,subsTail:void 0,flags:6,notify(){let e=this.flags;e&16||e&32&&eq(this.deps,this)?t():this.flags=2},stop(){this.flags=0,this.depsTail=void 0,sq(this)}};return t(),n}var dq=class{constructor(e,t){this.atom=lq(e),this.get=this.get.bind(this),this.setState=this.setState.bind(this),this.subscribe=this.subscribe.bind(this),t&&(this.actions=t(this))}setState(e){this.atom.set(e)}get state(){return this.atom.get()}get(){return this.state}subscribe(e){return this.atom.subscribe(JK(e))}},fq=class{constructor(e){this.atom=lq(e)}get state(){return this.atom.get()}get(){return this.state}subscribe(e){return this.atom.subscribe(JK(e))}};function pq(e,t){return typeof e==`function`?new fq(e):t?new dq(e,t):new dq(e)}var mq=class{constructor(e,t){this.fn=e,this.options=t,this.lastExecutionTime=0,this.isPending=!1,this.maybeExecute=(...e)=>{let t=Date.now()-this.lastExecutionTime;if(this.options.leading&&t>=this.options.wait)this.execute(...e);else if(this.lastArgs=e,!this.timeoutId&&this.options.trailing){let e=this.options.wait-t;this.isPending=!0,this.timeoutId=setTimeout(()=>{this.lastArgs!==void 0&&this.execute(...this.lastArgs)},e)}},this.execute=(...e)=>{this.fn(...e),this.options.onExecute?.(e,this),this.lastExecutionTime=Date.now(),this.clearTimeout(),this.lastArgs=void 0,this.isPending=!1},this.flush=()=>{this.isPending&&this.lastArgs&&this.execute(...this.lastArgs)},this.cancel=()=>{this.clearTimeout(),this.lastArgs=void 0,this.isPending=!1},this.clearTimeout=()=>{this.timeoutId&&=(clearTimeout(this.timeoutId),void 0)},this.options.leading===void 0&&this.options.trailing===void 0&&(this.options.leading=!0,this.options.trailing=!0)}};function hq(e,t){return new mq(e,t).maybeExecute}var gq=class{#e=!0;#t;#n;#r;#i;#a;#o;#s;#c=0;#l=5;#u=!1;#d=!1;#f=null;#p=()=>{this.debugLog(`Connected to event bus`),this.#a=!0,this.#u=!1,this.debugLog(`Emitting queued events`,this.#i),this.#i.forEach(e=>this.emitEventToBus(e)),this.#i=[],this.stopConnectLoop(),this.#n().removeEventListener(`tanstack-connect-success`,this.#p)};#m=()=>{if(this.#c<this.#l){this.#c++,this.dispatchCustomEvent(`tanstack-connect`,{});return}this.#n().removeEventListener(`tanstack-connect`,this.#m),this.#d=!0,this.debugLog(`Max retries reached, giving up on connection`),this.stopConnectLoop()};#h=()=>{this.#u||(this.#u=!0,this.#n().addEventListener(`tanstack-connect-success`,this.#p),this.#m())};constructor({pluginId:e,debug:t=!1,enabled:n=!0,reconnectEveryMs:r=300}){this.#t=e,this.#e=n,this.#n=this.getGlobalTarget,this.#r=t,this.debugLog(` Initializing event subscription for plugin`,this.#t),this.#i=[],this.#a=!1,this.#d=!1,this.#o=null,this.#s=r}startConnectLoop(){this.#o!==null||this.#a||(this.debugLog(`Starting connect loop (every ${this.#s}ms)`),this.#o=setInterval(this.#m,this.#s))}stopConnectLoop(){this.#u=!1,this.#o!==null&&(clearInterval(this.#o),this.#o=null,this.#i=[],this.debugLog(`Stopped connect loop`))}debugLog(...e){this.#r&&console.log(`🌴 [tanstack-devtools:${this.#t}-plugin]`,...e)}getGlobalTarget(){if(typeof globalThis<`u`&&globalThis.__TANSTACK_EVENT_TARGET__)return this.debugLog(`Using global event target`),globalThis.__TANSTACK_EVENT_TARGET__;if(typeof window<`u`&&window.addEventListener!==void 0)return this.debugLog(`Using window as event target`),window;let e=typeof EventTarget<`u`?new EventTarget:void 0;return e===void 0||e.addEventListener===void 0?(this.debugLog(`No event mechanism available, running in non-web environment`),{addEventListener:()=>{},removeEventListener:()=>{},dispatchEvent:()=>!1}):(this.debugLog(`Using new EventTarget as fallback`),e)}getPluginId(){return this.#t}dispatchCustomEventShim(e,t){try{let n=new Event(e,{detail:t});this.#n().dispatchEvent(n)}catch{this.debugLog(`Failed to dispatch shim event`)}}dispatchCustomEvent(e,t){try{this.#n().dispatchEvent(new CustomEvent(e,{detail:t}))}catch{this.dispatchCustomEventShim(e,t)}}emitEventToBus(e){this.debugLog(`Emitting event to client bus`,e),this.dispatchCustomEvent(`tanstack-dispatch-event`,e)}createEventPayload(e,t){return{type:`${this.#t}:${e}`,payload:t,pluginId:this.#t}}emit(e,t){if(!this.#e){this.debugLog(`Event bus client is disabled, not emitting event`,e,t);return}if(this.#f&&(this.debugLog(`Emitting event to internal event target`,e,t),this.#f.dispatchEvent(new CustomEvent(`${this.#t}:${e}`,{detail:this.createEventPayload(e,t)}))),this.#d){this.debugLog(`Previously failed to connect, not emitting to bus`);return}if(!this.#a){this.debugLog(`Bus not available, will be pushed as soon as connected`),this.#i.push(this.createEventPayload(e,t)),typeof CustomEvent<`u`&&!this.#u&&(this.#h(),this.startConnectLoop());return}return this.emitEventToBus(this.createEventPayload(e,t))}on(e,t,n){let r=n?.withEventTarget??!1,i=`${this.#t}:${e}`;if(r&&(this.#f||=new EventTarget,this.#f.addEventListener(i,e=>{t(e.detail)})),!this.#e)return this.debugLog(`Event bus client is disabled, not registering event`,i),()=>{};let a=e=>{this.debugLog(`Received event from bus`,e.detail),t(e.detail)};return this.#n().addEventListener(i,a),this.debugLog(`Registered event to bus`,i),()=>{r&&this.#f?.removeEventListener(i,a),this.#n().removeEventListener(i,a)}}onAll(e){if(!this.#e)return this.debugLog(`Event bus client is disabled, not registering event`),()=>{};let t=t=>{let n=t.detail;e(n)};return this.#n().addEventListener(`tanstack-devtools-global`,t),()=>this.#n().removeEventListener(`tanstack-devtools-global`,t)}onAllPluginEvents(e){if(!this.#e)return this.debugLog(`Event bus client is disabled, not registering event`),()=>{};let t=t=>{let n=t.detail;this.#t&&n.pluginId!==this.#t||e(n)};return this.#n().addEventListener(`tanstack-devtools-global`,t),()=>this.#n().removeEventListener(`tanstack-devtools-global`,t)}},_q=new class extends gq{constructor(){super({pluginId:`form-devtools`,reconnectEveryMs:1e3})}};function vq(e,t){return typeof e==`function`?e(t):e}function yq(e,t){return Dq(t).reduce((e,t)=>{if(e===null)return null;if(e!==void 0)return e[t]},e)}function bq(e,t,n){let r=Dq(t);function i(e){if(!r.length)return vq(n,e);let t=r.shift();if(typeof t==`string`||typeof t==`number`&&!Array.isArray(e))return typeof e==`object`?(e===null&&(e={}),{...e,[t]:i(e[t])}):{[t]:i()};if(Array.isArray(e)&&typeof t==`number`){let n=e.slice(0,t);return[...n.length?n:Array(t),i(e[t]),...e.slice(t+1)]}return[...Array(t),i()]}return i(e)}function xq(e,t){let n=Dq(t);function r(e){if(!e)return;if(n.length===1){let t=n[0];if(Array.isArray(e)&&typeof t==`number`)return e.filter((e,n)=>n!==t);let{[t]:r,...i}=e;return i}let t=n.shift();if((typeof t==`string`||typeof t==`number`&&!Array.isArray(e))&&typeof e==`object`)return{...e,[t]:r(e[t])};if(typeof t==`number`&&Array.isArray(e)){if(t>=e.length)return e;let n=e.slice(0,t);return[...n.length?n:Array(t),r(e[t]),...e.slice(t+1)]}throw Error(`It seems we have created an infinite loop in deleteBy. `)}return r(e)}var Sq=46,Cq=91,wq=93,Tq=48,Eq=57;function Dq(e){if(Array.isArray(e))return[...e];if(typeof e!=`string`)throw Error(`Path must be a string.`);let t=e.length,n=[],r=+(t>0&&e.charCodeAt(0)===Cq),i=!0,a=-1;for(let o=r;o<=t;o++){let s=o<t?e.charCodeAt(o):-1;if(o===t||s===Sq||s===Cq||s===wq){let t=o-r;if(t>0){let a=i&&(t===1||e.charCodeAt(r)!==Tq),s=e.slice(r,o);if(a){let e=parseInt(s,10);t<=15||String(e)===s?n.push(e):n.push(s)}else n.push(s)}else a!==wq&&(a!==-1||s!==wq)&&(a!==s||s!==Sq&&s!==Cq)&&n.push(``);r=o+1,i=!0}else(s<Tq||s>Eq)&&(i=!1);a=s}return n.length||n.push(``),n}function Oq(e){return!(Array.isArray(e)&&e.length===0)}function kq(e,t){return t.validationLogic({form:t.form,group:t.group,validators:t.validators,event:{type:e,fieldName:t.fieldName,async:!1},runValidation:e=>e.validators.filter(Boolean).map(e=>({cause:e.cause,validate:e.fn}))})}function Aq(e,t){let{asyncDebounceMs:n}=t,{onBlurAsyncDebounceMs:r,onChangeAsyncDebounceMs:i,onDynamicAsyncDebounceMs:a}=t.validators||{},o=n??0;return t.validationLogic({form:t.form,group:t.group,validators:t.validators,event:{type:e,fieldName:t.fieldName,async:!0},runValidation:t=>t.validators.filter(Boolean).map(t=>{let n=t?.cause||e,s=o;switch(n){case`change`:s=i??o;break;case`blur`:s=r??o;break;case`dynamic`:s=a??o;break;case`submit`:s=0}return e===`submit`&&(s=0),{cause:n,validate:t.fn,debounceMs:s}})})}var jq=e=>!!e&&typeof e==`object`&&`fields`in e;function Mq(e,t){if(Object.is(e,t))return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!t)return!1;if(e instanceof Date&&t instanceof Date)return e.getTime()===t.getTime();if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(let[n,r]of e)if(!t.has(n)||!Object.is(r,t.get(n)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length||n.length===0&&!Array.isArray(e)&&!Array.isArray(t)&&(Object.getPrototypeOf(e)!==Object.prototype||Object.getPrototypeOf(t)!==Object.prototype))return!1;for(let i of n)if(!r.includes(i)||!Mq(e[i],t[i]))return!1;return!0}var Nq=({newFormValidatorError:e,isPreviousErrorFromFormValidator:t,previousErrorValue:n})=>e?{newErrorValue:e,newSource:`form`}:t?{newErrorValue:void 0,newSource:void 0}:n?{newErrorValue:n,newSource:`field`}:{newErrorValue:void 0,newSource:void 0},Pq=({formLevelError:e,fieldLevelError:t})=>t?{newErrorValue:t,newSource:`field`}:e?{newErrorValue:e,newSource:`form`}:{newErrorValue:void 0,newSource:void 0};function Fq(e,t){return e==null?t:{...e,...t}}for(var Iq=256,Lq=[],Rq;Iq--;)Lq[Iq]=(Iq+256).toString(16).substring(1);function zq(){let e=0,t,n=``;if(!Rq||Iq+16>256){for(Rq=Array(256),e=256;e--;)Rq[e]=256*Math.random()|0;e=0,Iq=0}for(;e<16;e++)t=Rq[Iq+e],n+=e===6?Lq[t&15|64]:e===8?Lq[t&63|128]:Lq[t],e&1&&e>1&&e<11&&(n+=`-`);return Iq++,n}var Bq=hq(e=>_q.emit(`form-state`,{id:e.formId,state:e.store.state}),{wait:300});function Vq(e){if(typeof e!=`object`||!e)return e;if(e instanceof Date)return new Date(e.getTime());if(Array.isArray(e)){let t=[];for(let n=0;n<e.length;n++)t[n]=Vq(e[n]);return t}if(e instanceof Map){let t=new Map;return e.forEach((e,n)=>{t.set(n,Vq(e))}),t}if(e instanceof Set){let t=new Set;return e.forEach(e=>{t.add(Vq(e))}),t}let t={};for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=Vq(e[n]));return t}function Hq(e,t){return t===e||t.startsWith(`${e}.`)||t.startsWith(`${e}[`)}var Uq=e=>{if(!e.validators)return e.runValidation({validators:[],form:e.form});let t=e.event.async,n=t?void 0:{fn:e.validators.onMount,cause:`mount`},r={fn:t?e.validators.onChangeAsync:e.validators.onChange,cause:`change`},i={fn:t?e.validators.onBlurAsync:e.validators.onBlur,cause:`blur`},a={fn:t?e.validators.onSubmitAsync:e.validators.onSubmit,cause:`submit`},o=t?void 0:{fn:()=>void 0,cause:`server`};switch(e.event.type){case`mount`:return e.runValidation({validators:[n],form:e.form});case`submit`:return e.runValidation({validators:[r,i,a,o],form:e.form});case`server`:return e.runValidation({validators:[],form:e.form});case`blur`:return e.runValidation({validators:[i,o],form:e.form});case`change`:return e.runValidation({validators:[r,o],form:e.form});default:throw Error(`Unknown validation event type: ${e.event.type}`)}};function Wq(e,t){let n=new Map;for(let r of e){let e=r.path??[],i=t,a=``;for(let t=0;t<e.length;t++){let n=e[t];if(n===void 0)continue;let r=typeof n==`object`?n.key:n,o=Number(r);a+=Array.isArray(i)&&!Number.isNaN(o)?`[${o}]`:(t>0?`.`:``)+String(r),i=typeof i==`object`&&i?i[r]:void 0}n.set(a,(n.get(a)??[]).concat(r))}return Object.fromEntries(n)}var Gq=(e,t)=>{let n=Wq(e,t);return{form:n,fields:n}},Kq={validate({value:e,validationSource:t},n){let r=n[`~standard`].validate(e);if(r instanceof Promise)throw Error(`async function passed to sync validator`);if(r.issues)return t===`field`?r.issues:Gq(r.issues,e)},async validateAsync({value:e,validationSource:t},n){let r=await n[`~standard`].validate(e);if(r.issues)return t===`field`?r.issues:Gq(r.issues,e)}},qq=e=>!!e&&`~standard`in e,Jq={isValidating:!1,isTouched:!1,isBlurred:!1,isDirty:!1,isPristine:!0,isValid:!0,isDefaultValue:!0,errors:[],errorMap:{},errorSourceMap:{},_arrayVersion:0,_pendingValidationsCount:0};function Yq(e){function t(t){let n=e.getFieldMeta(t)??Jq;e.setFieldMeta(t,{...n,_arrayVersion:(n._arrayVersion||0)+1})}function n(n,r,i){t(n);let a=s(n,r,`move`,i),c=Math.min(r,i),u=Math.max(r,i);for(let e=c;e<=u;e++)a.push(o(n,e));let d=Object.keys(e.fieldInfo).reduce((t,i)=>(i.startsWith(o(n,r))&&t.set(i,e.getFieldMeta(i)),t),new Map);l(a,r<i?`up`:`down`),Object.keys(e.fieldInfo).filter(e=>e.startsWith(o(n,i))).forEach(t=>{let a=t.replace(o(n,i),o(n,r)),s=d.get(a);s&&e.setFieldMeta(t,s)})}function r(e,n){t(e),l(s(e,n,`remove`),`up`)}function i(n,r,i){t(n),s(n,r,`swap`,i).forEach(t=>{if(!t.toString().startsWith(o(n,r)))return;let a=t.toString().replace(o(n,r),o(n,i)),[s,c]=[e.getFieldMeta(t),e.getFieldMeta(a)];s&&e.setFieldMeta(a,s),c&&e.setFieldMeta(t,c)})}function a(n,r){t(n);let i=s(n,r,`insert`);l(i,`down`),i.forEach(t=>{t.toString().startsWith(o(n,r))&&e.setFieldMeta(t,u())})}function o(e,t){return`${e}[${t}]`}function s(t,n,r,i){let a=[o(t,n)];switch(r){case`swap`:a.push(o(t,i));break;case`move`:{let[e,r]=[Math.min(n,i),Math.max(n,i)];for(let n=e;n<=r;n++)a.push(o(t,n));break}default:{let r=e.getFieldValue(t),i=Array.isArray(r)?r.length:0;for(let e=n+1;e<i;e++)a.push(o(t,e));break}}return Object.keys(e.fieldInfo).filter(e=>a.some(t=>e.startsWith(t)))}function c(e,t){return e.replace(/\[(\d+)\]/,(e,n)=>{let r=parseInt(n,10);return`[${t===`up`?r+1:Math.max(0,r-1)}]`})}function l(t,n){(n===`up`?t:[...t].reverse()).forEach(t=>{let r=c(t.toString(),n),i=e.getFieldMeta(r);i?e.setFieldMeta(t,i):e.setFieldMeta(t,u())})}let u=()=>Jq;return{bumpArrayVersion:t,handleArrayMove:n,handleArrayRemove:r,handleArraySwap:i,handleArrayInsert:a}}function Xq(e){return{values:e.values??{},errorMap:e.errorMap??{},fieldMetaBase:e.fieldMetaBase??{},formGroupStateBase:e.formGroupStateBase??{},isSubmitted:e.isSubmitted??!1,isSubmitting:e.isSubmitting??!1,isValidating:e.isValidating??!1,submissionAttempts:e.submissionAttempts??0,isSubmitSuccessful:e.isSubmitSuccessful??!1,validationMetaMap:e.validationMetaMap??{onChange:void 0,onBlur:void 0,onSubmit:void 0,onMount:void 0,onServer:void 0,onDynamic:void 0}}}var Zq=class{constructor(e){this.options={},this.fieldInfo={},this.formGroupApis=new Set,this.mount=()=>{let e=this.store.subscribe(()=>{Bq(this)}),t=_q.on(`request-form-state`,e=>{e.payload.id===this._formId&&_q.emit(`form-api`,{id:this._formId,state:this.store.state,options:this.options})}),n=_q.on(`request-form-reset`,e=>{e.payload.id===this._formId&&this.reset()}),r=_q.on(`request-form-force-submit`,e=>{e.payload.id===this._formId&&(this._devtoolsSubmissionOverride=!0,this.handleSubmit(),this._devtoolsSubmissionOverride=!1)}),i=()=>{r(),n(),t(),e.unsubscribe(),_q.emit(`form-unmounted`,{id:this._formId})};this.options.listeners?.onMount?.({formApi:this});let{onMount:a}=this.options.validators||{};return _q.emit(`form-api`,{id:this._formId,state:this.store.state,options:this.options}),a&&this.validateSync(`mount`),i},this.update=e=>{if(!e)return;let t=this.options;this.options=e;let n=e.defaultValues&&!Mq(e.defaultValues,t.defaultValues)&&!this.state.isTouched,r=!Mq(e.defaultState,t.defaultState)&&!this.state.isTouched;if(!(!n&&!r)){if(oq(()=>{this.baseStore.setState(()=>Xq(Object.assign({},this.state,r?e.defaultState:{},n?{values:e.defaultValues}:{})))}),n){let e=Yq(this);for(let t of Object.keys(this.fieldInfo))Array.isArray(this.getFieldValue(t))&&e.bumpArrayVersion(t)}_q.emit(`form-api`,{id:this._formId,state:this.store.state,options:this.options})}},this.reset=(e,t)=>{let{fieldMeta:n}=this.state,r=this.resetFieldMeta(n);e&&!t?.keepDefaultValues&&(this.options={...this.options,defaultValues:e}),this.baseStore.setState(()=>{let t=e??this.options.defaultValues??this.options.defaultState?.values;return e||Object.values(this.fieldInfo).forEach(e=>{e.instance&&e.instance.options.defaultValue!==void 0&&(t=bq(t,e.instance.name,e.instance.options.defaultValue))}),Xq({...this.options.defaultState,values:t,fieldMetaBase:r})})},this.validateAllFields=async e=>{let t=[];return oq(()=>{Object.values(this.fieldInfo).forEach(n=>{if(!n.instance)return;let r=n.instance;t.push(Promise.resolve().then(()=>r.validate(e,{skipFormValidation:!0,skipGroupValidation:!0}))),n.instance.store.state.meta.isTouched||n.instance.setMeta(e=>({...e,isTouched:!0}))})}),(await Promise.all(t)).flat()},this.validateArrayFieldsStartingFrom=async(e,t,n)=>{let r=this.getFieldValue(e),i=Array.isArray(r)?Math.max(r.length-1,0):null,a=[`${e}[${t}]`];for(let n=t+1;n<=(i??0);n++)a.push(`${e}[${n}]`);let o=Object.keys(this.fieldInfo).filter(e=>a.some(t=>e.startsWith(t))),s=[];return oq(()=>{o.forEach(e=>{s.push(Promise.resolve().then(()=>this.validateField(e,n)))})}),(await Promise.all(s)).flat()},this.validateField=(e,t)=>{let n=this.fieldInfo[e]?.instance;if(!n){let{hasErrored:n}=this.validateSync(t);return n&&!this.options.asyncAlways?this.getFieldMeta(e)?.errors??[]:this.validateAsync(t).then(()=>this.getFieldMeta(e)?.errors??[])}return n.store.state.meta.isTouched||n.setMeta(e=>({...e,isTouched:!0})),n.validate(t)},this.validateSync=(e,t)=>{let n=kq(e,{...this.options,form:this,group:t?.group,validationLogic:this.options.validationLogic||Uq}),r=!1,i={};return oq(()=>{for(let e of n){if(!e.validate)continue;let{formError:n,fieldErrors:a}=Qq(this.runValidator({validate:e.validate,value:{value:this.state.values,formApi:this,validationSource:`form`},type:`validate`})),o=$q(e.cause),s=new Set([...Object.keys(this.state.fieldMeta),...Object.keys(a||{})]);t?.filterFieldNames&&(s=new Set([...s].filter(t.filterFieldNames)));for(let e of s){if(this.baseStore.state.fieldMetaBase[e]===void 0&&!a?.[e])continue;let{errorMap:t,errorSourceMap:n}=this.getFieldMeta(e)??Jq,r=a?.[e],{newErrorValue:s,newSource:c}=Nq({newFormValidatorError:r,isPreviousErrorFromFormValidator:n?.[o]===`form`,previousErrorValue:t?.[o]});c===`form`&&(i[e]={...i[e],[o]:r}),t?.[o]!==s&&this.setFieldMeta(e,(e=Jq)=>({...e,errorMap:{...e.errorMap,[o]:s},errorSourceMap:{...e.errorSourceMap,[o]:c}}))}t?.dontUpdateFormErrorMap||this.state.errorMap?.[o]!==n&&this.baseStore.setState(e=>({...e,errorMap:{...e.errorMap,[o]:n}})),(n||a)&&(r=!0)}if(t?.dontUpdateFormErrorMap)return;let a=$q(`submit`);this.state.errorMap?.[a]&&e!==`submit`&&!r&&this.baseStore.setState(e=>({...e,errorMap:{...e.errorMap,[a]:void 0}}));let o=$q(`server`);this.state.errorMap?.[o]&&e!==`server`&&!r&&this.baseStore.setState(e=>({...e,errorMap:{...e.errorMap,[o]:void 0}}))}),{hasErrored:r,fieldsErrorMap:i}},this.validateAsync=async(e,t)=>{let n=Aq(e,{...this.options,form:this,group:t?.group,validationLogic:this.options.validationLogic||Uq});this.state.isFormValidating||this.baseStore.setState(e=>({...e,isFormValidating:!0}));let r=[],i;for(let e of n){if(!e.validate)continue;let n=$q(e.cause);this.state.validationMetaMap[n]?.lastAbortController.abort();let a=new AbortController;this.state.validationMetaMap[n]={lastAbortController:a},r.push(new Promise(async n=>{let r;try{r=await new Promise((t,n)=>{setTimeout(async()=>{if(a.signal.aborted)return t(void 0);try{t(await this.runValidator({validate:e.validate,value:{value:this.state.values,formApi:this,validationSource:`form`,signal:a.signal},type:`validateAsync`}))}catch(e){n(e)}},e.debounceMs)})}catch(e){r=e}let{formError:o,fieldErrors:s}=Qq(r);s&&(i=i?{...i,...s}:s);let c=$q(e.cause),l=new Set([...Object.keys(this.state.fieldMeta),...Object.keys(i||{})]),u=Array.from(l);t?.filterFieldNames&&(u=u.filter(t.filterFieldNames));for(let e of u){if(this.baseStore.state.fieldMetaBase[e]===void 0&&!i?.[e])continue;let{errorMap:t,errorSourceMap:n}=this.getFieldMeta(e)??Jq,r=i?.[e],{newErrorValue:a,newSource:o}=Nq({newFormValidatorError:r,isPreviousErrorFromFormValidator:n?.[c]===`form`,previousErrorValue:t?.[c]});t?.[c]!==a&&this.setFieldMeta(e,(e=Jq)=>({...e,errorMap:{...e.errorMap,[c]:a},errorSourceMap:{...e.errorSourceMap,[c]:o}}))}t?.dontUpdateFormErrorMap||this.baseStore.setState(e=>({...e,errorMap:{...e.errorMap,[c]:o}})),n(i?{fieldErrors:i,errorMapKey:c}:void 0)}))}let a=[],o={};if(r.length){a=await Promise.all(r);for(let e of a)if(e?.fieldErrors){let{errorMapKey:t}=e;for(let[n,r]of Object.entries(e.fieldErrors))o[n]={...o[n]||{},[t]:r}}}return this.baseStore.setState(e=>({...e,isFormValidating:!1})),o},this.validate=(e,t)=>{let{hasErrored:n,fieldsErrorMap:r}=this.validateSync(e,t);return n&&!this.options.asyncAlways?r:this.validateAsync(e,t)},this._handleSubmit=async e=>{this.baseStore.setState(e=>({...e,isSubmitted:!1,submissionAttempts:e.submissionAttempts+1,isSubmitSuccessful:!1})),oq(()=>{Object.values(this.fieldInfo).forEach(e=>{e.instance&&(e.instance.store.state.meta.isTouched||e.instance.setMeta(e=>({...e,isTouched:!0})))})});let t=e??this.options.onSubmitMeta;if(!this.state.canSubmit&&!this._devtoolsSubmissionOverride&&this.baseStore.state.submissionAttempts<=1){this.options.onSubmitInvalid?.({value:this.state.values,formApi:this,meta:t});return}this.baseStore.setState(e=>({...e,isSubmitting:!0}));let n=()=>{this.baseStore.setState(e=>({...e,isSubmitting:!1}))};if(await this.validateAllFields(`submit`),!this.state.isFieldsValid){n(),this.options.onSubmitInvalid?.({value:this.state.values,formApi:this,meta:t}),_q.emit(`form-submission`,{id:this._formId,submissionAttempt:this.state.submissionAttempts,successful:!1,stage:`validateAllFields`,errors:Object.values(this.state.fieldMeta).map(e=>e.errors).flat()});return}if(await this.validate(`submit`),!this.state.isValid){n(),this.options.onSubmitInvalid?.({value:this.state.values,formApi:this,meta:t}),_q.emit(`form-submission`,{id:this._formId,submissionAttempt:this.state.submissionAttempts,successful:!1,stage:`validate`,errors:this.state.errors});return}oq(()=>{Object.values(this.fieldInfo).forEach(e=>{e.instance?.triggerOnSubmitListener()})}),this.options.listeners?.onSubmit?.({formApi:this,meta:t});try{await this.options.onSubmit?.({value:this.state.values,formApi:this,meta:t}),oq(()=>{this.baseStore.setState(e=>({...e,isSubmitted:!0,isSubmitSuccessful:!0})),_q.emit(`form-submission`,{id:this._formId,submissionAttempt:this.state.submissionAttempts,successful:!0}),n()})}catch(e){throw this.baseStore.setState(e=>({...e,isSubmitSuccessful:!1})),_q.emit(`form-submission`,{id:this._formId,submissionAttempt:this.state.submissionAttempts,successful:!1,stage:`inflight`,onError:e}),n(),e}},this.getFieldValue=e=>yq(this.state.values,e),this.getFieldMeta=e=>this.state.fieldMeta[e],this.getFormGroupMeta=e=>this.formGroupMetaDerived.state[e],this.getFieldInfo=e=>this.fieldInfo[e]||={instance:null,validationMetaMap:{onChange:void 0,onBlur:void 0,onSubmit:void 0,onMount:void 0,onServer:void 0,onDynamic:void 0}},this.setFieldMeta=(e,t)=>{this.baseStore.setState(n=>({...n,fieldMetaBase:{...n.fieldMetaBase,[e]:vq(t,n.fieldMetaBase[e])}}))},this.resetFieldMeta=e=>Object.keys(e).reduce((e,t)=>{let n=t;return e[n]=Jq,e},{}),this.setFieldValue=(e,t,n)=>{let r=n?.dontUpdateMeta??!1,i=n?.dontRunListeners??!1,a=n?.dontValidate??!1;oq(()=>{r||this.setFieldMeta(e,e=>({...e,isTouched:!0,isDirty:!0,errorMap:{...e?.errorMap,onMount:void 0}})),this.baseStore.setState(n=>({...n,values:bq(n.values,e,t)}))}),i||this.getFieldInfo(e).instance?.triggerOnChangeListener(),a||this.validateField(e,`change`)},this.deleteField=e=>{let t=[...Object.keys(this.fieldInfo).filter(t=>{let n=e.toString();return t!==n&&t.startsWith(n)}),e];this.baseStore.setState(e=>{let n={...e};return t.forEach(e=>{n.values=xq(n.values,e),delete this.fieldInfo[e],delete n.fieldMetaBase[e]}),n})},this.pushFieldValue=(e,t,n)=>{this.setFieldValue(e,e=>[...Array.isArray(e)?e:[],t],n),Yq(this).bumpArrayVersion(e)},this.insertFieldValue=async(e,t,n,r)=>{this.setFieldValue(e,e=>[...e.slice(0,t),n,...e.slice(t)],Fq(r,{dontValidate:!0}));let i=r?.dontValidate??!1;i||await this.validateField(e,`change`),Yq(this).handleArrayInsert(e,t),i||await this.validateArrayFieldsStartingFrom(e,t,`change`)},this.replaceFieldValue=async(e,t,n,r)=>{this.setFieldValue(e,e=>e.map((e,r)=>r===t?n:e),Fq(r,{dontValidate:!0})),Yq(this).bumpArrayVersion(e),(r?.dontValidate??!1)||(await this.validateField(e,`change`),await this.validateArrayFieldsStartingFrom(e,t,`change`))},this.removeFieldValue=async(e,t,n)=>{let r=this.getFieldValue(e),i=Array.isArray(r)?Math.max(r.length-1,0):null;if(this.setFieldValue(e,e=>e.filter((e,n)=>n!==t),Fq(n,{dontValidate:!0})),Yq(this).handleArrayRemove(e,t),i!==null){let t=`${e}[${i}]`;this.deleteField(t)}(n?.dontValidate??!1)||(await this.validateField(e,`change`),await this.validateArrayFieldsStartingFrom(e,t,`change`))},this.swapFieldValues=(e,t,n,r)=>{this.setFieldValue(e,e=>{let r=e[t],i=e[n];return bq(bq(e,`${t}`,i),`${n}`,r)},Fq(r,{dontValidate:!0})),Yq(this).handleArraySwap(e,t,n),(r?.dontValidate??!1)||(this.validateField(e,`change`),this.validateField(`${e}[${t}]`,`change`),this.validateField(`${e}[${n}]`,`change`))},this.moveFieldValues=(e,t,n,r)=>{this.setFieldValue(e,e=>{let r=[...e];return r.splice(n,0,r.splice(t,1)[0]),r},Fq(r,{dontValidate:!0})),Yq(this).handleArrayMove(e,t,n),(r?.dontValidate??!1)||(this.validateField(e,`change`),this.validateField(`${e}[${t}]`,`change`),this.validateField(`${e}[${n}]`,`change`))},this.clearFieldValues=(e,t)=>{let n=this.getFieldValue(e),r=Array.isArray(n)?Math.max(n.length-1,0):null;if(this.setFieldValue(e,[],Fq(t,{dontValidate:!0})),Yq(this).bumpArrayVersion(e),r!==null)for(let t=0;t<=r;t++){let n=`${e}[${t}]`;this.deleteField(n)}(t?.dontValidate??!1)||this.validateField(e,`change`)},this.resetField=e=>{this.baseStore.setState(t=>{let n=this.getFieldInfo(e).instance?.options.defaultValue,r=yq(this.options.defaultValues,e),i=n??r;return{...t,fieldMetaBase:{...t.fieldMetaBase,[e]:Jq},values:i===void 0?t.values:bq(t.values,e,i)}})},this.setErrorMap=e=>{oq(()=>{Object.entries(e).forEach(([e,t])=>{let n=e;if(jq(t)){let{formError:e,fieldErrors:r}=Qq(t);for(let e of Object.keys(this.fieldInfo))this.getFieldMeta(e)&&this.setFieldMeta(e,t=>({...t,errorMap:{...t.errorMap,[n]:r?.[e]},errorSourceMap:{...t.errorSourceMap,[n]:`form`}}));this.baseStore.setState(t=>({...t,errorMap:{...t.errorMap,[n]:e}}))}else this.baseStore.setState(e=>({...e,errorMap:{...e.errorMap,[n]:t}}))})})},this.getAllErrors=()=>({form:{errors:this.state.errors,errorMap:this.state.errorMap},fields:Object.entries(this.state.fieldMeta).reduce((e,[t,n])=>(Object.keys(n).length&&n.errors.length&&(e[t]={errors:n.errors,errorMap:n.errorMap}),e),{})}),this.parseValuesWithSchema=e=>Kq.validate({value:this.state.values,validationSource:`form`},e),this.parseValuesWithSchemaAsync=e=>Kq.validateAsync({value:this.state.values,validationSource:`form`},e),this.timeoutIds={validations:{},listeners:{},formListeners:{}},this._formId=e?.formId??zq(),this._devtoolsSubmissionOverride=!1;let t=Xq({...e?.defaultState,values:e?.defaultValues??e?.defaultState?.values});if(e?.transform){t=e.transform({state:t}).state;for(let e of Object.keys(t.errorMap)){let n=t.errorMap[e];if(!(n===void 0||!jq(n)))for(let r of Object.keys(n.fields)){let i=n.fields[r];if(i===void 0)continue;let a=t.fieldMetaBase[r];t.fieldMetaBase[r]={isTouched:!1,isValidating:!1,isBlurred:!1,isDirty:!1,_arrayVersion:0,_pendingValidationsCount:0,...a??{},errorSourceMap:{...a?.errorSourceMap??{},onChange:`form`},errorMap:{...a?.errorMap??{},[e]:i}}}}}this.baseStore=pq(t);let n;this.fieldMetaDerived=pq(e=>{let t=this.baseStore.get(),r=0,i={};for(let a of Object.keys(t.fieldMetaBase)){let o=t.fieldMetaBase[a],s=n?.fieldMetaBase[a],c=e?.[a],l=yq(t.values,a),u=c?.errors;if(!s||o.errorMap!==s.errorMap){u=Object.values(o.errorMap??{}).filter(e=>e!==void 0);let e=this.getFieldInfo(a)?.instance;(!e||!e.options.disableErrorFlat)&&(u=u.flat(1))}let d=!Oq(u),f=!o.isDirty,p=Mq(l,this.getFieldInfo(a)?.instance?.options.defaultValue??yq(this.options.defaultValues,a));if(c&&c.isPristine===f&&c.isValid===d&&c.isDefaultValue===p&&c.errors===u&&o===s){i[a]=c,r++;continue}i[a]={...o,errors:u??[],isPristine:f,isValid:d,isDefaultValue:p}}return Object.keys(t.fieldMetaBase).length?e&&r===Object.keys(t.fieldMetaBase).length?e:(n=this.baseStore.get(),i):i}),this.formGroupMetaDerived=pq(e=>{let t=this.baseStore.get(),n=this.fieldMetaDerived.get(),r={};for(let i of this.formGroupApis){let a=i.name,o=t.formGroupStateBase[a]??{isSubmitted:!1,isSubmitting:!1,isValidating:!1,submissionAttempts:0,isSubmitSuccessful:!1},s=n[a],c=!1,l=!0,u=!1,d=!1,f=!0,p=!1;for(let e in n){if(e===a||!Hq(a,e))continue;let t=n[e];t&&(t.isValidating&&(c=!0),t.isValid||(l=!1),t.isTouched&&(u=!0),t.isBlurred&&(d=!0),t.isDefaultValue||(f=!1),t.isDirty&&(p=!0))}let m=!p,h=!!c||o.isValidating,g=s?.errorMap??{},_=s?.errorSourceMap??{},v=!!(g.onMount||Object.entries(n).some(([e,t])=>t&&e!==a&&Hq(a,e)&&t.errorMap.onMount)),y=e?.[a],b=y?.errors??[];(!y||y.__srcErrorMap!==g)&&(b=Object.values(g).reduce((e,t)=>{if(t===void 0)return e;if(t&&typeof t==`object`&&`fields`in t){let n=t.group;return n!==void 0&&e.push(n),e}return e.push(t),e},[]));let x=b.length===0,S=l&&x,C=i.options.canSubmitWhenInvalid??!1,w=o.submissionAttempts===0&&!u&&!v||!h&&!o.isSubmitting&&S||C;if(y&&y.errorMap===g&&y.errorSourceMap===_&&y.errors===b&&y.isFieldsValidating===c&&y.isFieldsValid===l&&y.isGroupValid===x&&y.isValid===S&&y.canSubmit===w&&y.isTouched===u&&y.isBlurred===d&&y.isPristine===m&&y.isDefaultValue===f&&y.isDirty===p&&y.isValidating===h&&y.isSubmitting===o.isSubmitting&&y.isSubmitted===o.isSubmitted&&y.submissionAttempts===o.submissionAttempts&&y.isSubmitSuccessful===o.isSubmitSuccessful){r[a]=y;continue}let T={...o,errorMap:g,errorSourceMap:_,_arrayVersion:s?._arrayVersion??0,isTouched:u,isBlurred:d,isDirty:p,isPristine:m,isDefaultValue:f,isValid:S,errors:b,isValidating:h,isFieldsValidating:c,isFieldsValid:l,isGroupValid:x,canSubmit:w};Object.defineProperty(T,"__srcErrorMap",{value:g,enumerable:!1,configurable:!0}),r[a]=T}return r});let r;this.store=pq(e=>{let t=this.baseStore.get(),n=this.fieldMetaDerived.get(),i=Object.values(n).filter(Boolean),a=i.some(e=>e.isValidating),o=i.every(e=>e.isValid),s=i.some(e=>e.isTouched),c=i.some(e=>e.isBlurred),l=i.every(e=>e.isDefaultValue),u=s&&t.errorMap?.onMount,d=i.some(e=>e.isDirty),f=!d,p=!!(t.errorMap?.onMount||i.some(e=>e?.errorMap?.onMount)),m=!!a,h=e?.errors??[];(!r||t.errorMap!==r.errorMap)&&(h=Object.values(t.errorMap).reduce((e,t)=>t===void 0?e:t&&jq(t)?(e.push(t.form),e):(e.push(t),e),[]));let g=h.length===0,_=o&&g,v=this.options.canSubmitWhenInvalid??!1,y=t.submissionAttempts===0&&!s&&!p||!m&&!t.isSubmitting&&_||v,b=t.errorMap;if(u&&(h=h.filter(e=>e!==t.errorMap.onMount),b=Object.assign(b,{onMount:void 0})),e&&r&&e.errorMap===b&&e.fieldMeta===this.fieldMetaDerived.state&&e.errors===h&&e.isFieldsValidating===a&&e.isFieldsValid===o&&e.isFormValid===g&&e.isValid===_&&e.canSubmit===y&&e.isTouched===s&&e.isBlurred===c&&e.isPristine===f&&e.isDefaultValue===l&&e.isDirty===d&&Mq(r,t))return e;let x={...t,errorMap:b,fieldMeta:this.fieldMetaDerived.state,errors:h,isFieldsValidating:a,isFieldsValid:o,isFormValid:g,isValid:_,canSubmit:y,isTouched:s,isBlurred:c,isPristine:f,isDefaultValue:l,isDirty:d};return r=this.baseStore.get(),x}),this.handleSubmit=this.handleSubmit.bind(this),this.update(e||{})}get state(){return this.store.state}get formId(){return this._formId}runValidator(e){return qq(e.validate)?Kq[e.type](e.value,e.validate):e.validate(e.value)}handleSubmit(e){return this._handleSubmit(e)}};function Qq(e){return e?jq(e)?{formError:Qq(e.form).formError,fieldErrors:e.fields}:{formError:e}:{formError:void 0}}function $q(e){switch(e){case`submit`:return`onSubmit`;case`blur`:return`onBlur`;case`mount`:return`onMount`;case`server`:return`onServer`;case`dynamic`:return`onDynamic`;default:return`onChange`}}var eJ=class e{constructor(t){this.options={},this.mount=()=>{this.options.defaultValue!==void 0&&!this.getMeta().isTouched&&this.form.setFieldValue(this.name,this.options.defaultValue,{dontUpdateMeta:!0});let e=this.getInfo();e.instance=this,this.update(this.options);let{onMount:t}=this.options.validators||{};if(t){let e=this.runValidator({validate:t,value:{value:this.state.value,fieldApi:this,validationSource:`field`},type:`validate`});e&&this.setMeta(t=>({...t,errorMap:{...t?.errorMap,onMount:e},errorSourceMap:{...t?.errorSourceMap,onMount:`field`}}))}return this.options.listeners?.onMount?.({value:this.state.value,fieldApi:this}),()=>{for(let[e,t]of Object.entries(this.timeoutIds.validations))t&&(clearTimeout(t),this.timeoutIds.validations[e]=null);for(let[e,t]of Object.entries(this.timeoutIds.listeners))t&&(clearTimeout(t),this.timeoutIds.listeners[e]=null);for(let[e,t]of Object.entries(this.timeoutIds.formListeners))t&&(clearTimeout(t),this.timeoutIds.formListeners[e]=null);let e=this.form.fieldInfo[this.name];if(e&&e.instance===this){for(let[t,n]of Object.entries(e.validationMetaMap))n?.lastAbortController.abort(),e.validationMetaMap[t]=void 0;this.form.baseStore.setState(e=>({...e,fieldMetaBase:{...e.fieldMetaBase,[this.name]:{...Jq,isTouched:e.fieldMetaBase[this.name]?.isTouched??Jq.isTouched,isBlurred:e.fieldMetaBase[this.name]?.isBlurred??Jq.isBlurred,isDirty:e.fieldMetaBase[this.name]?.isDirty??Jq.isDirty}}})),e.instance=null,this.options.listeners?.onUnmount?.({value:this.state.value,fieldApi:this}),this.form.options.listeners?.onFieldUnmount?.({formApi:this.form,fieldApi:this})}}},this.update=e=>{this.options=e,this.name=e.name,!this.state.meta.isTouched&&this.options.defaultValue!==void 0&&(Mq(this.form.getFieldValue(this.name),e.defaultValue)||this.form.setFieldValue(this.name,e.defaultValue,{dontUpdateMeta:!0,dontValidate:!0,dontRunListeners:!0})),this.form.getFieldMeta(this.name)||this.form.setFieldMeta(this.name,this.state.meta)},this.getValue=()=>this.form.getFieldValue(this.name),this.setValue=(e,t)=>{this.form.setFieldValue(this.name,e,Fq(t,{dontRunListeners:!0,dontValidate:!0})),t?.dontRunListeners||this.triggerOnChangeListener(),t?.dontValidate||this.validate(`change`)},this.getMeta=()=>this.store.state.meta,this.setMeta=e=>this.form.setFieldMeta(this.name,e),this.getInfo=()=>this.form.getFieldInfo(this.name),this.pushValue=(e,t)=>{this.form.pushFieldValue(this.name,e,Fq(t,{dontRunListeners:!0})),t?.dontRunListeners||this.triggerOnChangeListener()},this.insertValue=(e,t,n)=>{this.form.insertFieldValue(this.name,e,t,Fq(n,{dontRunListeners:!0})),n?.dontRunListeners||this.triggerOnChangeListener()},this.replaceValue=(e,t,n)=>{this.form.replaceFieldValue(this.name,e,t,Fq(n,{dontRunListeners:!0})),n?.dontRunListeners||this.triggerOnChangeListener()},this.removeValue=(e,t)=>{this.form.removeFieldValue(this.name,e,Fq(t,{dontRunListeners:!0})),t?.dontRunListeners||this.triggerOnChangeListener()},this.swapValues=(e,t,n)=>{this.form.swapFieldValues(this.name,e,t,Fq(n,{dontRunListeners:!0})),n?.dontRunListeners||this.triggerOnChangeListener()},this.moveValue=(e,t,n)=>{this.form.moveFieldValues(this.name,e,t,Fq(n,{dontRunListeners:!0})),n?.dontRunListeners||this.triggerOnChangeListener()},this.clearValues=e=>{this.form.clearFieldValues(this.name,Fq(e,{dontRunListeners:!0})),e?.dontRunListeners||this.triggerOnChangeListener()},this.getLinkedFields=t=>{let n=Object.values(this.form.fieldInfo),r=[];for(let i of n){if(!i.instance||!(i.instance instanceof e))continue;let{onChangeListenTo:n,onBlurListenTo:a}=i.instance.options.validators||{};t===`change`&&n?.includes(this.name)&&r.push(i.instance),t===`blur`&&a?.includes(this.name)&&r.push(i.instance)}return r},this.validateSync=(e,t)=>{let n=kq(e,{...this.options,form:this.form,fieldName:this.name,validationLogic:this.form.options.validationLogic||Uq}),r=this.getLinkedFields(e).reduce((t,n)=>{let r=kq(e,{...n.options,form:n.form,fieldName:n.name,validationLogic:n.form.options.validationLogic||Uq});return r.forEach(e=>{e.field=n}),t.concat(r)},[]),i=!1;oq(()=>{let e=(e,n)=>{let r=nJ(n.cause),a=n.validate?tJ(e.runValidator({validate:n.validate,value:{value:e.store.state.value,validationSource:`field`,fieldApi:e},type:`validate`})):void 0,o=t[r],{newErrorValue:s,newSource:c}=Pq({formLevelError:o,fieldLevelError:a});e.state.meta.errorMap?.[r]!==s&&e.setMeta(e=>({...e,errorMap:{...e.errorMap,[r]:s},errorSourceMap:{...e.errorSourceMap,[r]:c}})),s&&(i=!0)};for(let t of n)e(this,t);for(let t of r)t.validate&&e(t.field,t)});let a=nJ(`submit`);return this.state.meta.errorMap?.[a]&&e!==`submit`&&!i&&this.setMeta(e=>({...e,errorMap:{...e.errorMap,[a]:void 0},errorSourceMap:{...e.errorSourceMap,[a]:void 0}})),{hasErrored:i}},this.validateAsync=async(e,t)=>{let n=Aq(e,{...this.options,form:this.form,fieldName:this.name,validationLogic:this.form.options.validationLogic||Uq}),r=await t,i=this.getLinkedFields(e).reduce((t,n)=>{let r=Aq(e,{...n.options,form:n.form,fieldName:n.name,validationLogic:n.form.options.validationLogic||Uq});return r.forEach(e=>{e.field=n}),t.concat(r)},[]),a=[],o=[],s=n.some(e=>e.validate),c=Array.from(new Set(i.filter(e=>e.validate).map(e=>e.field)));oq(()=>{s&&this.startValidation();for(let e of c)e.startValidation()});let l=(e,t,n)=>{let i=nJ(t.cause),a=e.getInfo();a.validationMetaMap[i]?.lastAbortController.abort();let o=new AbortController;a.validationMetaMap[i]={lastAbortController:o},n.push(new Promise(async n=>{let a;try{a=await new Promise((n,r)=>{e.timeoutIds.validations[t.cause]&&(clearTimeout(e.timeoutIds.validations[t.cause]),e.endValidation()),e.timeoutIds.validations[t.cause]=setTimeout(async()=>{if(o.signal.aborted)return n(void 0);try{n(await this.runValidator({validate:t.validate,value:{value:e.store.state.value,fieldApi:e,signal:o.signal,validationSource:`field`},type:`validateAsync`}))}catch(e){r(e)}},t.debounceMs)})}catch(e){a=e}if(o.signal.aborted)return n(void 0);let s=tJ(a),c=r[e.name]?.[i],{newErrorValue:l,newSource:u}=Pq({formLevelError:c,fieldLevelError:s});if(e.getInfo().instance!==e)return n(void 0);e.setMeta(e=>({...e,errorMap:{...e?.errorMap,[i]:l},errorSourceMap:{...e.errorSourceMap,[i]:u}})),n(l)}))};for(let e of n)e.validate&&l(this,e,a);for(let e of i)e.validate&&l(e.field,e,o);let u=[];return(a.length||o.length)&&(u=await Promise.all(a),await Promise.all(o)),oq(()=>{s&&this.endValidation();for(let e of c)e.endValidation()}),u.filter(Boolean)},this.validate=(e,t)=>{if(!this.state.meta.isTouched)return[];let n=t?.skipGroupValidation?[]:Array.from(this.form.formGroupApis).filter(e=>this.name.startsWith(e.name)),r=(t?.skipFormValidation?{fieldsErrorMap:{}}:this.form.validateSync(e)).fieldsErrorMap[this.name]??{};if(!t?.skipFormValidation)for(let t of n){if(t.state.meta.submissionAttempts===0)continue;let{fieldsErrorMap:n}=this.form.validateSync(e,{group:t,dontUpdateFormErrorMap:!0,filterFieldNames:e=>Hq(t.name,e)});r={...r,...n[this.name]??{}}}let{hasErrored:i}=this.validateSync(e,r),a=new WeakMap;for(let t of n){let{hasErrored:n}=t.validateSync(e,{},{skipRelatedFieldValidation:!0});a.set(t,n)}if(i&&!this.options.asyncAlways){this.getInfo().validationMetaMap[nJ(e)]?.lastAbortController.abort();let t=[];for(let r of n)r.getInfo().validationMetaMap[nJ(e)]?.lastAbortController.abort(),t.push(r.state.meta.errors);return[...this.state.meta.errors,...t.flat()]}let o=t?.skipFormValidation?Promise.resolve({}):this.form.validateAsync(e),s=this.validateAsync(e,o),c=[];for(let t of n)a.get(t)&&!t.options.asyncAlways||c.push(t.validateAsync(e,o,{skipRelatedFieldValidation:!0}));return c.length===0?s:Promise.all([s,...c]).then(e=>e.flat())},this.handleChange=e=>{this.setValue(e)},this.handleBlur=()=>{this.state.meta.isTouched||this.setMeta(e=>({...e,isTouched:!0})),this.state.meta.isBlurred||this.setMeta(e=>({...e,isBlurred:!0})),this.validate(`blur`),this.triggerOnBlurListener()},this.setErrorMap=e=>{this.setMeta(t=>({...t,errorMap:{...t.errorMap,...e}}))},this.parseValueWithSchema=e=>Kq.validate({value:this.state.value,validationSource:`field`},e),this.parseValueWithSchemaAsync=e=>Kq.validateAsync({value:this.state.value,validationSource:`field`},e),this.triggerOnBlurListener=()=>{let e=this.form.options.listeners?.onBlurDebounceMs;e&&e>0?(this.timeoutIds.formListeners.blur&&clearTimeout(this.timeoutIds.formListeners.blur),this.timeoutIds.formListeners.blur=setTimeout(()=>{this.form.options.listeners?.onBlur?.({formApi:this.form,fieldApi:this})},e)):this.form.options.listeners?.onBlur?.({formApi:this.form,fieldApi:this});let t=this.options.listeners?.onBlurDebounceMs;t&&t>0?(this.timeoutIds.listeners.blur&&clearTimeout(this.timeoutIds.listeners.blur),this.timeoutIds.listeners.blur=setTimeout(()=>{this.options.listeners?.onBlur?.({value:this.state.value,fieldApi:this})},t)):this.options.listeners?.onBlur?.({value:this.state.value,fieldApi:this})},this.triggerOnChangeListener=()=>{let e=this.form.options.listeners?.onChangeDebounceMs;e&&e>0?(this.timeoutIds.formListeners.change&&clearTimeout(this.timeoutIds.formListeners.change),this.timeoutIds.formListeners.change=setTimeout(()=>{this.form.options.listeners?.onChange?.({formApi:this.form,fieldApi:this})},e)):this.form.options.listeners?.onChange?.({formApi:this.form,fieldApi:this});let t=this.options.listeners?.onChangeDebounceMs;t&&t>0?(this.timeoutIds.listeners.change&&clearTimeout(this.timeoutIds.listeners.change),this.timeoutIds.listeners.change=setTimeout(()=>{this.options.listeners?.onChange?.({value:this.state.value,fieldApi:this})},t)):this.options.listeners?.onChange?.({value:this.state.value,fieldApi:this});for(let e of this.form.formGroupApis)Hq(e.name,this.name)&&e.triggerOnChangeListener()},this.triggerOnSubmitListener=()=>{this.options.listeners?.onSubmit?.({value:this.state.value,fieldApi:this})},this.form=t.form,this.name=t.name,this.options=t,this.timeoutIds={validations:{},listeners:{},formListeners:{}},this.store=pq(e=>{this.form.store.get();let n=this.form.getFieldMeta(this.name)??{...Jq,...t.defaultMeta},r=this.form.getFieldValue(this.name);return!n.isTouched&&r===void 0&&this.options.defaultValue!==void 0&&!Mq(r,this.options.defaultValue)&&(r=this.options.defaultValue),e&&e.value===r&&e.meta===n?e:{value:r,meta:n}})}get state(){return this.store.state}runValidator(e){return qq(e.validate)?Kq[e.type](e.value,e.validate):e.validate(e.value)}startValidation(){this.setMeta(e=>{let t=e._pendingValidationsCount+1;return{...e,_pendingValidationsCount:t,isValidating:t>0&&!e.isValidating||e.isValidating}})}endValidation(){this.setMeta(e=>{let t=Math.max(0,e._pendingValidationsCount-1);return{...e,_pendingValidationsCount:t,isValidating:t===0&&e.isValidating?!1:e.isValidating}})}};function tJ(e){if(e)return e}function nJ(e){switch(e){case`submit`:return`onSubmit`;case`blur`:return`onBlur`;case`mount`:return`onMount`;case`server`:return`onServer`;case`dynamic`:return`onDynamic`;default:return`onChange`}}function rJ(e){return{isSubmitted:e.isSubmitted??!1,isSubmitting:e.isSubmitting??!1,isValidating:e.isValidating??!1,submissionAttempts:e.submissionAttempts??0,isSubmitSuccessful:e.isSubmitSuccessful??!1}}function iJ(e){return{...Jq,...e,errors:[],isPristine:!0,isValid:!0,isDefaultValue:!0,isFieldsValidating:!1,isFieldsValid:!0,isGroupValid:!0,canSubmit:!0,isSubmitting:!1,isSubmitted:!1,isValidating:!1,submissionAttempts:0,isSubmitSuccessful:!1}}var aJ=class e{constructor(t){this.options={},this.setFormGroupState=e=>{this.form.baseStore.setState(t=>{let n=t.formGroupStateBase[this.name]??rJ({});return{...t,formGroupStateBase:{...t.formGroupStateBase,[this.name]:e(n)}}})},this._lastDistributedFieldNames={},this.update=e=>{this.options=e,this.name=e.name,!this.state.meta.isTouched&&this.options.defaultValue!==void 0&&(Mq(this.form.getFieldValue(this.name),e.defaultValue)||this.form.setFieldValue(this.name,e.defaultValue,{dontUpdateMeta:!0,dontValidate:!0,dontRunListeners:!0})),this.form.getFieldMeta(this.name)||this.form.setFieldMeta(this.name,{...Jq,...this.options.defaultMeta})},this.mount=()=>{this.update(this.options),this.form.formGroupApis.add(this),this.fieldInfo.instance=this,this.form.baseStore.setState(e=>({...e,formGroupStateBase:{...e.formGroupStateBase,[this.name]:e.formGroupStateBase[this.name]??rJ({...this.options.defaultState})}}));let{onMount:e}=this.options.validators||{};if(e){let t=this.runValidator({validate:e,value:{value:this.state.value,groupApi:this,validationSource:`form`},type:`validate`}),n=t,r;sJ(t)&&(n=t.group,r=t.fields);let i=oJ(n);i&&this.setMeta(e=>({...e,errorMap:{...e.errorMap,onMount:i},errorSourceMap:{...e.errorSourceMap,onMount:`field`}})),this.distributeFieldErrors(`onMount`,r)}return this.options.listeners?.onMount?.({value:this.state.value,groupApi:this}),()=>{for(let[e,t]of Object.entries(this.timeoutIds.validations))t&&(clearTimeout(t),this.timeoutIds.validations[e]=null);for(let[e,t]of Object.entries(this.timeoutIds.listeners))t&&(clearTimeout(t),this.timeoutIds.listeners[e]=null);for(let[e,t]of Object.entries(this.timeoutIds.formListeners))t&&(clearTimeout(t),this.timeoutIds.formListeners[e]=null);if(this.fieldInfo.instance===this){for(let[e,t]of Object.entries(this.fieldInfo.validationMetaMap))t?.lastAbortController.abort(),this.fieldInfo.validationMetaMap[e]=void 0;this.form.formGroupApis.delete(this),this.form.baseStore.setState(e=>({...e,formGroupStateBase:{...e.formGroupStateBase,[this.name]:rJ({})}})),this.fieldInfo.instance=null,this.options.listeners?.onUnmount?.({value:this.state.value,groupApi:this})}}},this.setValue=(e,t)=>{this.form.setFieldValue(this.name,e,Fq(t,{dontRunListeners:!0,dontValidate:!0})),t?.dontRunListeners||this.triggerOnChangeListener(),t?.dontValidate||this.validate(`change`)},this.getMeta=()=>this.store.state.meta,this.setMeta=e=>this.form.setFieldMeta(this.name,e),this.getInfo=()=>this.fieldInfo,this.getRelatedFields=()=>{let e=Object.values(this.form.fieldInfo),t=[];for(let n of e)n.instance&&n.instance instanceof eJ&&n.instance.name.startsWith(this.name)&&t.push(n.instance);return t},this.getRelatedFieldMetasDerived=()=>{let e=Object.entries(this.form.fieldMetaDerived.state),t=[];for(let[n,r]of e)n!==this.name&&Hq(this.name,n)&&t.push({...r,name:n});return t},this.buildChildFieldName=e=>e===``?this.name:e.startsWith(`[`)?`${this.name}${e}`:`${this.name}.${e}`,this.distributeFieldErrors=(e,t)=>{let n=this._lastDistributedFieldNames[e]??new Set,r=new Set;if(t)for(let[e,n]of Object.entries(t))n!=null&&n!==!1&&r.add(this.buildChildFieldName(e));let i=new Set([...n,...r]),a=!1;for(let n of i){let r=n.startsWith(this.name+`[`)?n.slice(this.name.length):n.slice(this.name.length+1),i=t?.[r],o=this.form.getFieldMeta(n);if(!o&&!i)continue;let s=o?.errorMap[e],{newErrorValue:c,newSource:l}=Nq({newFormValidatorError:i,isPreviousErrorFromFormValidator:o?.errorSourceMap[e]===`form`,previousErrorValue:s});c&&(a=!0),(s!==c||o?.errorSourceMap[e]!==l)&&this.form.setFieldMeta(n,(t=Jq)=>({...t,errorMap:{...t.errorMap,[e]:c},errorSourceMap:{...t.errorSourceMap,[e]:l}}))}return this._lastDistributedFieldNames[e]=r,a},this.validateSync=(t,n,r={})=>{let i=kq(t,{...this.options,form:this.form,group:this,validationLogic:this.options.validationLogic||this.form.options.validationLogic||Uq}),a=(r.skipRelatedFieldValidation?[]:this.getRelatedFields()).reduce((e,n)=>{let r=kq(t,{...n.options,form:n.form,validationLogic:n.form.options.validationLogic||Uq});return r.forEach(e=>{e.field=n}),e.concat(r)},[]),o=!1;oq(()=>{let t=(t,r)=>{let i=lJ(r.cause),a=t===this,s;r.validate&&(s=t.runValidator({validate:r.validate,value:{value:t.store.state.value,validationSource:a?`form`:`field`,...t instanceof e?{groupApi:t}:{fieldApi:t}},type:`validate`}));let c=s,l;a&&sJ(s)&&(c=s.group,l=s.fields);let u=oJ(c),d=n[i],{newErrorValue:f,newSource:p}=Pq({formLevelError:d,fieldLevelError:u});t.state.meta.errorMap?.[i]!==f&&t.setMeta(e=>({...e,errorMap:{...e.errorMap,[i]:f},errorSourceMap:{...e.errorSourceMap,[i]:p}})),f&&(o=!0),a&&this.distributeFieldErrors(i,l)&&(o=!0)};for(let e of i)t(this,e);for(let e of a)e.validate&&t(e.field,e)});let s=lJ(`submit`);return this.state.meta.errorMap?.[s]&&t!==`submit`&&!o&&this.setMeta(e=>({...e,errorMap:{...e.errorMap,[s]:void 0},errorSourceMap:{...e.errorSourceMap,[s]:void 0}})),{hasErrored:o}},this.validateAsync=async(t,n,r={})=>{let i=Aq(t,{...this.options,form:this.form,group:this,validationLogic:this.options.validationLogic||this.form.options.validationLogic||Uq}),a=await n,o=r.skipRelatedFieldValidation?[]:this.getRelatedFields(),s=o.reduce((e,n)=>{let r=Aq(t,{...n.options,form:n.form,validationLogic:n.form.options.validationLogic||Uq});return r.forEach(e=>{e.field=n}),e.concat(r)},[]),c=[],l=[],u=i.some(e=>e.validate)||s.some(e=>e.validate);if(u){this.state.meta.isValidating||this.setMeta(e=>({...e,isValidating:!0}));for(let e of o)e.setMeta(e=>({...e,isValidating:!0}))}let d=(t,n,r)=>{let i=lJ(n.cause),o=t.getInfo();o.validationMetaMap[i]?.lastAbortController.abort();let s=new AbortController;o.validationMetaMap[i]={lastAbortController:s};let c=t===this;r.push(new Promise(async r=>{let o;try{o=await new Promise((r,i)=>{t.timeoutIds.validations[n.cause]&&clearTimeout(t.timeoutIds.validations[n.cause]),t.timeoutIds.validations[n.cause]=setTimeout(async()=>{if(s.signal.aborted)return r(void 0);try{r(await this.runValidator({validate:n.validate,value:{value:t.store.state.value,signal:s.signal,validationSource:c?`form`:`field`,...t instanceof e?{groupApi:t}:{fieldApi:t}},type:`validateAsync`}))}catch(e){i(e)}},n.debounceMs)})}catch(e){o=e}if(s.signal.aborted)return r(void 0);let l=o,u;c&&sJ(o)&&(l=o.group,u=o.fields);let d=oJ(l),f=a[t.name]?.[i],{newErrorValue:p,newSource:m}=Pq({formLevelError:f,fieldLevelError:d});if(t.getInfo().instance!==t)return r(void 0);t.setMeta(e=>({...e,errorMap:{...e?.errorMap,[i]:p},errorSourceMap:{...e.errorSourceMap,[i]:m}})),c&&this.distributeFieldErrors(i,u),r(p)}))};for(let e of i)e.validate&&d(this,e,c);for(let e of s)e.validate&&d(e.field,e,l);let f=[];if((c.length||l.length)&&(f=await Promise.all(c),await Promise.all(l)),u){this.setMeta(e=>({...e,isValidating:!1}));for(let e of o)e.setMeta(e=>({...e,isValidating:!1}))}return f.filter(Boolean)},this.validateAllFields=async e=>{let t=[];return oq(()=>{Object.values(this.getRelatedFields()).forEach(n=>{t.push(Promise.resolve().then(()=>n.validate(e,{skipFormValidation:!0,skipGroupValidation:!0}))),n.store.state.meta.isTouched||n.setMeta(e=>({...e,isTouched:!0}))})}),(await Promise.all(t)).flat()},this.validateArrayFieldsStartingFrom=(e,t,n)=>this.form.validateArrayFieldsStartingFrom(e,t,n),this.validateField=(e,t)=>this.form.validateField(e,t),this.getFieldValue=e=>this.form.getFieldValue(e),this.getFieldMeta=e=>this.form.getFieldMeta(e),this.setFieldMeta=(e,t)=>this.form.setFieldMeta(e,t),this.setFieldValue=(e,t)=>this.form.setFieldValue(e,t),this.deleteField=e=>this.form.deleteField(e),this.pushFieldValue=(e,t)=>this.form.pushFieldValue(e,t),this.insertFieldValue=(e,t,n)=>this.form.insertFieldValue(e,t,n),this.replaceFieldValue=(e,t,n)=>this.form.replaceFieldValue(e,t,n),this.swapFieldValues=(e,t,n)=>this.form.swapFieldValues(e,t,n),this.moveFieldValues=(e,t,n)=>this.form.moveFieldValues(e,t,n),this.clearFieldValues=e=>this.form.clearFieldValues(e),this.resetField=e=>this.form.resetField(e),this.removeFieldValue=(e,t)=>this.form.removeFieldValue(e,t),this.areRelatedFieldsValid=()=>Object.values(this.getRelatedFields()).every(e=>e.state.meta.isValid),this.validate=(e,t)=>{let{fieldsErrorMap:n}=t?.skipFormValidation?{fieldsErrorMap:{}}:this.form.validateSync(e,{dontUpdateFormErrorMap:!0,filterFieldNames:e=>Hq(this.name,e)}),{hasErrored:r}=this.validateSync(e,n[this.name]??{},{skipRelatedFieldValidation:t?.skipRelatedFieldValidation});if(r&&!this.options.asyncAlways)return this.getInfo().validationMetaMap[lJ(e)]?.lastAbortController.abort(),this.state.meta.errors;let i=t?.skipFormValidation?Promise.resolve({}):this.form.validateAsync(e,{dontUpdateFormErrorMap:!0,filterFieldNames:e=>Hq(this.name,e)});return this.validateAsync(e,i,{skipRelatedFieldValidation:t?.skipRelatedFieldValidation})},this.triggerOnChangeListener=()=>{let e=this.form.options.listeners?.onChangeGroupDebounceMs;e&&e>0?(this.timeoutIds.formListeners.change&&clearTimeout(this.timeoutIds.formListeners.change),this.timeoutIds.formListeners.change=setTimeout(()=>{this.form.options.listeners?.onChangeGroup?.({formApi:this.form,groupApi:this})},e)):this.form.options.listeners?.onChangeGroup?.({formApi:this.form,groupApi:this});let t=this.options.listeners?.onChangeDebounceMs;t&&t>0?(this.timeoutIds.listeners.change&&clearTimeout(this.timeoutIds.listeners.change),this.timeoutIds.listeners.change=setTimeout(()=>{this.options.listeners?.onChange?.({value:this.state.value,groupApi:this})},t)):this.options.listeners?.onChange?.({value:this.state.value,groupApi:this})},this.triggerOnSubmitListener=()=>{this.options.listeners?.onSubmit?.({value:this.state.value,groupApi:this})},this._handleSubmit=async e=>{this.setFormGroupState(e=>({...e,isSubmitted:!1,submissionAttempts:e.submissionAttempts+1,isSubmitSuccessful:!1})),oq(()=>{Object.values(this.getRelatedFields()).forEach(e=>{e.state.meta.isTouched||e.setMeta(e=>({...e,isTouched:!0}))})});let t=e??this.options.onSubmitMeta;this.setFormGroupState(e=>({...e,isSubmitting:!0}));let n=()=>{this.setFormGroupState(e=>({...e,isSubmitting:!1}))};if(await this.validateAllFields(`submit`),!this.areRelatedFieldsValid()){n(),this.options.onGroupSubmitInvalid?.({value:this.state.value,groupApi:this,meta:t});return}if(await this.validate(`submit`,{skipRelatedFieldValidation:!0}),!this.areRelatedFieldsValid()||!this.state.meta.isValid){n(),this.options.onGroupSubmitInvalid?.({value:this.state.value,groupApi:this,meta:t});return}oq(()=>{Object.values(this.getRelatedFields()).forEach(e=>{e.options.listeners?.onGroupSubmit?.({value:e.state.value,fieldApi:e})})}),this.options.listeners?.onSubmit?.({groupApi:this,value:this.state.value});try{await this.options.onGroupSubmit?.({value:this.state.value,groupApi:this,meta:t}),oq(()=>{this.setFormGroupState(e=>({...e,isSubmitted:!0,isSubmitSuccessful:!0})),n()})}catch(e){throw this.setFormGroupState(e=>({...e,isSubmitSuccessful:!1})),n(),e}},this.form=t.form,this.name=t.name,this.options=t,this.timeoutIds={validations:{},listeners:{},formListeners:{}},this.fieldInfo={instance:null,validationMetaMap:{onChange:void 0,onBlur:void 0,onSubmit:void 0,onMount:void 0,onServer:void 0,onDynamic:void 0}},this.store=pq(e=>{this.form.formGroupMetaDerived.get(),this.form.baseStore.get();let n=this.form.getFormGroupMeta(this.name)??iJ(t.defaultMeta),r=this.form.getFieldValue(this.name);return!n.isTouched&&r===void 0&&this.options.defaultValue!==void 0&&!Mq(r,this.options.defaultValue)&&(r=this.options.defaultValue),e&&e.value===r&&e.meta===n?e:{value:r,meta:n}}),this.handleSubmit=this.handleSubmit.bind(this)}get state(){return this.store.state}runValidator(e){if(qq(e.validate)){let t=Kq[e.type](e.value,e.validate);return e.type===`validate`?cJ(t):t.then(cJ)}return e.validate(e.value)}handleSubmit(e){return this._handleSubmit(e)}};function oJ(e){if(e)return e}function sJ(e){return!!e&&typeof e==`object`&&`fields`in e}function cJ(e){if(!e||typeof e!=`object`||!(`form`in e)&&!(`fields`in e))return e;let{form:t,fields:n,...r}=e;return{...r,group:t,fields:n}}function lJ(e){switch(e){case`submit`:return`onSubmit`;case`blur`:return`onBlur`;case`mount`:return`onMount`;case`server`:return`onServer`;case`dynamic`:return`onDynamic`;default:return`onChange`}}function uJ(e,t){if(!t)return;let n=Object.assign({},e,{state:Vq(e.state)});t(n),n.fieldInfo!==e.fieldInfo&&(e.fieldInfo=n.fieldInfo),n.options!==e.options&&(e.options=n.options);let r=Object.keys({values:null,validationMetaMap:null,fieldMetaBase:null,formGroupStateBase:null,isSubmitting:null,isSubmitted:null,isValidating:null,submissionAttempts:null,isSubmitSuccessful:null,_force_re_eval:null}).reduce((t,r)=>(e.state[r]!==n.state[r]&&(t[r]=n.state[r]),t),{});return oq(()=>{Object.keys(r).length&&e.baseStore.setState(e=>({...e,...r})),n.state.errorMap!==e.state.errorMap&&e.setErrorMap(n.state.errorMap)}),n}var dJ=o((e=>{var t=d();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,i=t.useState,a=t.useEffect,o=t.useLayoutEffect,s=t.useDebugValue;function c(e,t){var n=t(),r=i({inst:{value:n,getSnapshot:t}}),c=r[0].inst,u=r[1];return o(function(){c.value=n,c.getSnapshot=t,l(c)&&u({inst:c})},[e,n,t]),a(function(){return l(c)&&u({inst:c}),e(function(){l(c)&&u({inst:c})})},[e]),s(n),n}function l(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!r(e,n)}catch{return!0}}function u(e,t){return t()}var f=typeof window>`u`||window.document===void 0||window.document.createElement===void 0?u:c;e.useSyncExternalStore=t.useSyncExternalStore===void 0?f:t.useSyncExternalStore})),fJ=o(((e,t)=>{t.exports=dJ()})),pJ=o((e=>{var t=d(),n=fJ();function r(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var i=typeof Object.is==`function`?Object.is:r,a=n.useSyncExternalStore,o=t.useRef,s=t.useEffect,c=t.useMemo,l=t.useDebugValue;e.useSyncExternalStoreWithSelector=function(e,t,n,r,u){var d=o(null);if(d.current===null){var f={hasValue:!1,value:null};d.current=f}else f=d.current;d=c(function(){function e(e){if(!a){if(a=!0,o=e,e=r(e),u!==void 0&&f.hasValue){var t=f.value;if(u(t,e))return s=t}return s=e}if(t=s,i(o,e))return t;var n=r(e);return u!==void 0&&u(t,n)?(o=e,t):(o=e,s=n)}var a=!1,o,s,c=n===void 0?null:n;return[function(){return e(t())},c===null?void 0:function(){return e(c())}]},[t,n,r,u]);var p=a(e,d[0],d[1]);return s(function(){f.hasValue=!0,f.value=p},[p]),l(p),p}})),mJ=o(((e,t)=>{t.exports=pJ()}))();function hJ(e,t){return e===t}function gJ(e,t=e=>e,n){let r=n?.compare??hJ,i=(0,G.useCallback)(t=>{let{unsubscribe:n}=e.subscribe(t);return n},[e]),a=(0,G.useCallback)(()=>e.get(),[e]);return(0,mJ.useSyncExternalStoreWithSelector)(i,a,a,t,r)}var _J=typeof window<`u`?G.useLayoutEffect:G.useEffect;function vJ(e){let[t,n]=(0,G.useState)(()=>({form:e.form,name:e.name})),[r,i]=(0,G.useState)(()=>new eJ({...e})),a=r;(t.form!==e.form||t.name!==e.name)&&(a=new eJ({...e}),i(a),n({form:e.form,name:e.name}));let o=gJ(a.store,e.mode===`array`?e=>e.meta._arrayVersion||0:e=>e.value),s=gJ(a.store,e=>e.meta.isTouched),c=gJ(a.store,e=>e.meta.isBlurred),l=gJ(a.store,e=>e.meta.isDirty),u=gJ(a.store,e=>e.meta.errorMap),d=gJ(a.store,e=>e.meta.errorSourceMap),f=gJ(a.store,e=>e.meta.isValidating),p=(0,G.useMemo)(()=>({...a,get state(){return{value:e.mode===`array`?a.state.value:o,get meta(){return{...a.state.meta,isTouched:s,isBlurred:c,isDirty:l,errorMap:u,errorSourceMap:d,isValidating:f}}}}}),[a,e.mode,o,s,c,l,u,d,f]);return _J(a.mount,[a]),_J(()=>{a.update(e)}),p}var yJ=(({children:e,...t})=>{let n=vJ(t),r=(0,G.useMemo)(()=>vq(e,n),[e,n]);return(0,Z.jsx)(Z.Fragment,{children:r})});function bJ(){return(0,G.useState)(()=>zq())[0]}var xJ=G,SJ=`18.3.1`.split(`.`)[0]===`17`?bJ:xJ.useId;function CJ(e){let[t,n]=(0,G.useState)(()=>({form:e.form,name:e.name})),[r,i]=(0,G.useState)(()=>new aJ({...e}));(t.form!==e.form||t.name!==e.name)&&(i(new aJ({...e})),n({form:e.form,name:e.name}));let a=gJ(r.store,e=>e.value),o=gJ(r.store,e=>e.meta.isTouched),s=gJ(r.store,e=>e.meta.isBlurred),c=gJ(r.store,e=>e.meta.isDirty),l=gJ(r.store,e=>e.meta.errorMap),u=gJ(r.store,e=>e.meta.errorSourceMap),d=gJ(r.store,e=>e.meta.isValidating),f=gJ(r.store,e=>e.meta.isSubmitting),p=gJ(r.store,e=>e.meta.isSubmitted),m=gJ(r.store,e=>e.meta.submissionAttempts),h=gJ(r.store,e=>e.meta.isSubmitSuccessful),g=gJ(r.store,e=>e.meta.canSubmit),_=gJ(r.store,e=>e.meta.isValid),v=gJ(r.store,e=>e.meta.isFieldsValid),y=gJ(r.store,e=>e.meta.isFieldsValidating),b=gJ(r.store,e=>e.meta.isGroupValid),x=(0,G.useMemo)(()=>({...r,handleSubmit:((...e)=>r._handleSubmit(...e)),get state(){return{...r.state,value:a,get meta(){return{...r.state.meta,isTouched:o,isBlurred:s,isDirty:c,errorMap:l,errorSourceMap:u,isValidating:d,isSubmitting:f,isSubmitted:p,submissionAttempts:m,isSubmitSuccessful:h,canSubmit:g,isValid:_,isFieldsValid:v,isFieldsValidating:y,isGroupValid:b}}}}}),[r,a,o,s,c,l,u,d,f,p,m,h,g,_,v,y,b]);return _J(r.mount,[r]),_J(()=>{r.update(e)}),x}var wJ=(({children:e,...t})=>{let n=CJ(t),r=(0,G.useMemo)(()=>vq(e,n),[e,n]);return(0,Z.jsx)(Z.Fragment,{children:r})});function TJ({form:e,selector:t=e=>e,children:n}){let r=gJ(e.store,t);return(0,Z.jsx)(Z.Fragment,{children:vq(n,r)})}function EJ(e){let t=SJ(),[n,r]=(0,G.useState)(e?.formId),[i,a]=(0,G.useState)(()=>new Zq({...e,formId:e?.formId??t}));if(n!==e?.formId){let n=e?.formId??t;a(new Zq({...e,formId:n})),r(n)}let o=(0,G.useMemo)(()=>{let e={...i,handleSubmit:((...e)=>i._handleSubmit(...e)),get formId(){return i._formId},get state(){return i.store.state}};return e.Field=function(e){return(0,Z.jsx)(yJ,{...e,form:i})},e.FormGroup=function(e){return(0,Z.jsx)(wJ,{...e,form:i})},e.Subscribe=function(e){return(0,Z.jsx)(TJ,{form:i,selector:e.selector,children:e.children})},e},[i]);_J(i.mount,[]),_J(()=>{i.update(e)});let s=(0,G.useRef)(!1);return _J(()=>{s.current&&e?.transform&&uJ(i,e.transform)},[i,e?.transform]),_J(()=>{s.current=!0}),o}var DJ=`disabled:bg-base-200 disabled:text-base-content disabled:outline-1 disabled:outline-solid disabled:outline-base-content/25 aria-disabled:bg-base-200 aria-disabled:text-base-content aria-disabled:outline-1 aria-disabled:outline-solid aria-disabled:outline-base-content/25`,OJ=aL(`btn caps-button disabled:pointer-events-none`,{variants:{variant:{primary:`btn-primary caps-button-filled`,secondary:`btn-secondary caps-button-filled`,accent:`btn-accent caps-button-filled`,destructive:`btn-error caps-button-filled`,outline:`btn-outline ${DJ}`,ghost:`btn-ghost`,"ghost-destructive":`btn-ghost caps-button-ghost-destructive`,link:`btn-link ${DJ}`},size:{xs:`btn-xs`,sm:`btn-sm`,default:`btn-md`,lg:`btn-lg`,icon:`btn-square btn-md`,menubar:`caps-button-menubar`}},defaultVariants:{variant:`primary`,size:`default`}}),kJ=(0,G.forwardRef)(function({asChild:e=!1,children:t,className:n,disabled:r,loading:i=!1,result:a,resultLabel:o,onResultEnd:s,size:c=`default`,variant:l=`primary`,...u},d){let f=Q(OJ({size:c,variant:l}),n),p=(0,G.useRef)(a).current,m=(0,G.useRef)(null);return(0,G.useImperativeHandle)(d,()=>m.current),AJ(m,i,a),e?(0,Z.jsx)(PR,{...u,"aria-busy":i?!0:u[`aria-busy`],"aria-disabled":r===!0||i?!0:void 0,className:f,ref:m,children:t}):(0,Z.jsx)(`button`,{...u,"aria-busy":i?!0:u[`aria-busy`],className:f,disabled:r===!0||i,ref:m,type:u.type??`button`,children:a===void 0&&o===void 0?(0,Z.jsxs)(Z.Fragment,{children:[i?(0,Z.jsx)(lH,{decorative:!0,size:`sm`,tone:`current`,variant:`wander`}):null,t]}):(0,Z.jsx)(FJ,{label:o,loading:i,onResultEnd:s,result:a,settled:p,children:t})})});function AJ(e,t,n){let r=(0,G.useRef)(null),i=(0,G.useRef)(null),a=(0,G.useRef)(null);(0,G.useLayoutEffect)(()=>{let o=e.current;if(!o)return;let s=JSON.stringify([t,n??null,o.textContent]),c=s!==i.current;i.current=s;let l=a.current;if(!c&&l)return;let u=l?o.offsetWidth:r.current;l&&(a.current=null,l.cancel(),o.style.removeProperty(`overflow`),o.style.removeProperty(`white-space`));let d=o.offsetWidth;if(r.current=d>0?d:null,!c||u===null||d===0||Math.abs(u-d)<1||!JR(o))return;let f=BR(o);if(f.reduced)return;let p=o.animate([{width:`${String(u)}px`},{width:`${String(d)}px`}],{duration:f.normal,easing:qR(f,f.ease)});a.current=p,o.style.overflow=`clip`,o.style.whiteSpace=`nowrap`;let m=()=>{a.current===p&&(a.current=null,o.style.removeProperty(`overflow`),o.style.removeProperty(`white-space`))};p.onfinish=m,p.oncancel=m})}var jJ=1100;function MJ(e,t){let n=t.bounce/.3,r=1+.05*Math.min(1.4,.4+n),i=1-.02*Math.min(1.4,n);return e.animate([{transform:`scale(1)`},{transform:`scale(${String(r)})`,offset:.35},{transform:`scale(${String(i)})`,offset:.7},{transform:`scale(1)`}],{duration:t.springDuration,easing:qR(t,`ease-out`)})}function NJ(e,t){let n=t.shake;return e.animate([{transform:`none`},{transform:`translateX(${String(-n)}px)`},{transform:`translateX(${String(n)}px)`},{transform:`translateX(${String(-n*.6)}px)`},{transform:`translateX(${String(n*.3)}px)`},{transform:`none`}],{duration:t.slow*1.3,easing:qR(t,`linear`)})}function PJ(e,t,n){let r=n.distance+2,i=`blur(${String(n.blur)}px)`;return[e.animate([{opacity:1,transform:`none`,filter:`blur(0px)`},{opacity:0,transform:`translateY(${String(-r)}px)`,filter:i}],{duration:n.fast,easing:qR(n,n.ease)}),t.animate([{opacity:0,transform:`translateY(${String(r)}px)`,filter:i},{opacity:1,transform:`none`,filter:`blur(0px)`}],{duration:n.normal,easing:qR(n,n.ease),fill:`backwards`})]}function FJ({children:e,label:t,loading:n,onResultEnd:r,result:i,settled:a}){let o=(0,G.useRef)(null),s=$R(),[c,l]=(0,G.useState)(!1),[u,d]=(0,G.useState)(!1);c&&!u&&d(!0);let f=(0,G.useRef)(a),p=(0,G.useRef)(r);(0,G.useEffect)(()=>{p.current=r},[r]),(0,G.useLayoutEffect)(()=>{let e=f.current;if(f.current=i,i===e)return;if(i===`done`){l(!0);let e=setTimeout(()=>{p.current?p.current():l(!1)},jJ);return()=>{clearTimeout(e)}}l(!1);let t=o.current;if(i!==`failed`||!t||!JR(t))return;let n=BR(t);if(n.shake<=0)return;let r=NJ(t,n);return()=>{r.cancel()}},[i,s]);let m=(0,G.useRef)(c);return(0,G.useLayoutEffect)(()=>{let e=o.current;if(!e||m.current===c)return;m.current=c;let t=e.querySelector(`[data-face="label"]`),n=e.querySelector(`[data-face="result"]`);if(!t||!n||!JR(e)){c||d(!1);return}let r=BR(e),i=c?PJ(t,n,r):PJ(n,t,r);if(c||i[0]?.addEventListener(`finish`,()=>{d(!1)}),c&&!r.reduced){i.push(MJ(e.closest(`button`)??e,r));let t=n.querySelector(`path`);t&&i.push(t.animate([{strokeDashoffset:1},{strokeDashoffset:0}],{duration:r.normal*1.4,delay:r.fast/2,easing:qR(r,r.ease),fill:`backwards`}))}return()=>{for(let e of i)e.cancel()}},[c,s]),(0,Z.jsxs)(`span`,{ref:o,className:`caps-button-faces`,"data-showing":c?`result`:`label`,children:[(0,Z.jsxs)(`span`,{className:`caps-button-face`,"data-face":`label`,"aria-hidden":c?!0:void 0,children:[n||c?(0,Z.jsx)(lH,{decorative:!0,size:`sm`,tone:`current`,variant:`wander`}):null,e]}),u?(0,Z.jsxs)(`span`,{className:`caps-button-face`,"data-face":`result`,"aria-hidden":!c||void 0,children:[(0,Z.jsx)(`svg`,{className:`caps-button-check`,viewBox:`0 0 24 24`,"aria-hidden":`true`,focusable:`false`,children:(0,Z.jsx)(`path`,{d:`M4.5 12.5 9.5 17.5 19.5 6.5`,pathLength:1})}),t===void 0?e:t]}):null]})}var IJ={xs:`size-3`,sm:`size-[var(--stipe-icon-size-sm)]`,md:`size-[var(--stipe-icon-size-md)]`,lg:`size-[var(--stipe-icon-size-lg)]`},LJ=(0,G.forwardRef)(function({active:e=!1,icon:t,iconSize:n=`xs`,className:r,reveal:i=!1,size:a=`xs`,tone:o=`default`,variant:s=`ghost`,...c},l){let u=a===`responsive`;return(0,Z.jsx)(kJ,{...c,resultLabel:c.result===void 0?void 0:null,ref:l,size:u?`sm`:a,variant:s,className:Q(`caps-icon-button btn-circle`,u&&`caps-icon-button-responsive md:btn-xs`,e&&`text-accent`,i&&`scale-0 transition-transform group-hover:scale-100 focus-visible:scale-100`,o===`destructive`&&`hover:text-error`,r),children:(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:Q(`inline-flex shrink-0 [&>svg]:size-full [&>svg]:[stroke-width:var(--stipe-icon-stroke)]`,IJ[n]),children:t})})}),RJ=(0,G.forwardRef)(function({tone:e=`neutral`,size:t=`md`,pressed:n=!1,touch:r,className:i,...a},o){return(0,Z.jsx)(`kbd`,{...a,ref:o,className:Q(`caps-keycap`,i),"data-tone":e,"data-size":t,"data-pressed":n,"data-touch":r})}),zJ=(0,G.forwardRef)(function({label:e,shortcut:t,icon:n,readout:r,tone:i=`neutral`,density:a=`regular`,pressed:o,expanded:s,className:c,type:l=`button`,...u},d){let f=o??s;return(0,Z.jsxs)(`button`,{...u,ref:d,type:l,className:Q(`caps-keycap-button`,c),"data-tone":i,"data-density":a===`compact`?a:void 0,"aria-pressed":o,"aria-expanded":s,"aria-keyshortcuts":u[`aria-keyshortcuts`]??t,children:[f===void 0?null:(0,Z.jsx)(`span`,{className:`caps-keycap-led`,"data-lit":f,"aria-hidden":`true`}),n?(0,Z.jsx)(`span`,{className:`caps-keycap-button-icon`,"aria-hidden":`true`,children:n}):null,e===null?null:(0,Z.jsx)(`span`,{className:`caps-keycap-button-label`,children:e}),r,t?(0,Z.jsx)(RJ,{size:`sm`,tone:`neutral`,touch:`hide`,"aria-hidden":`true`,children:t}):null]})}),BJ={...G},VJ={};function HJ(e,t){let n=G.useRef(VJ);return n.current===VJ&&(n.current=e(t)),n}var UJ=BJ.useInsertionEffect,WJ=UJ&&UJ!==BJ.useLayoutEffect?UJ:e=>e();function GJ(e){let t=HJ(KJ).current;return t.next=e,WJ(t.effect),t.trampoline}function KJ(){let e={next:void 0,callback:qJ,trampoline:(...t)=>e.callback?.(...t),effect:()=>{e.callback=e.next}};return e}function qJ(){}function JJ(){}var YJ=Object.freeze([]),XJ=Object.freeze({});function ZJ(e){G.useEffect(e,YJ)}var QJ=0,$J=class e{static create(){return new e}currentId=QJ;start(e,t){this.clear(),this.currentId=setTimeout(()=>{this.currentId=QJ,t()},e)}isStarted(){return this.currentId!==QJ}clear=()=>{this.currentId!==QJ&&(clearTimeout(this.currentId),this.currentId=QJ)};disposeEffect=()=>this.clear};function eY(){let e=HJ($J.create).current;return ZJ(e.disposeEffect),e}function tY(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 nY=tY(`https://base-ui.com/production-error`,`Base UI`),rY=G.createContext(void 0);function iY(){let e=G.useContext(rY);if(e===void 0)throw Error(nY(53));return e}function aY(e,t,n,r){let i=HJ(sY).current;return cY(i,e,t,n,r)&&uY(i,[e,t,n,r]),i.callback}function oY(e){let t=HJ(sY).current;return lY(t,e)&&uY(t,e),t.callback}function sY(){return{callback:null,cleanup:null,refs:[]}}function cY(e,t,n,r,i){return e.refs[0]!==t||e.refs[1]!==n||e.refs[2]!==r||e.refs[3]!==i}function lY(e,t){return e.refs.length!==t.length||e.refs.some((e,n)=>e!==t[n])}function uY(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 dY=18;function fY(e){return dY>=e}function pY(e){if(!G.isValidElement(e))return null;let t=e,n=t.props;return(fY(19)?n?.ref:t.ref)??null}function mY(e,t){if(e&&!t)return e;if(!e&&t)return t;if(e||t)return{...e,...t}}function hY(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 gY(e,t){return typeof e==`function`?e(t):e}function _Y(e,t){return typeof e==`function`?e(t):e}var vY={};function yY(e,t,n,r,i){if(!n&&!r&&!i&&!e)return xY(t);let a=xY(e);return t&&(a=SY(a,t)),n&&(a=SY(a,n)),r&&(a=SY(a,r)),i&&(a=SY(a,i)),a}function bY(e){if(e.length===0)return vY;if(e.length===1)return xY(e[0]);let t=xY(e[0]);for(let n=1;n<e.length;n+=1)t=SY(t,e[n]);return t}function xY(e){return EY(e)?{...e(vY)}:CY(e)}function SY(e,t){return EY(t)?t(e):wY(e,t)}function CY(e){let t={...e};for(let e in t){let n=t[e];TY(e,n)&&(t[e]=OY(n))}return t}function wY(e,t){if(!t)return e;for(let n in t){let r=t[n];switch(n){case`style`:e[n]=mY(e.style,r);break;case`className`:e[n]=AY(e.className,r);break;default:e[n]=TY(n,r)?DY(e[n],r):r}}return e}function TY(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 EY(e){return typeof e==`function`}function DY(e,t){return t?e?(...n)=>{let r=n[0];if(jY(r)){let i=r;kY(i);let a=t(...n);return i.baseUIHandlerPrevented||e?.(...n),a}let i=t(...n);return e?.(...n),i}:OY(t):e}function OY(e){return e&&((...t)=>{let n=t[0];return jY(n)&&kY(n),e(...t)})}function kY(e){return e.preventBaseUIHandler=()=>{e.baseUIHandlerPrevented=!0},e}function AY(e,t){return t?e?t+` `+e:t:e}function jY(e){return typeof e==`object`&&!!e&&`nativeEvent`in e}function MY(e,t,n={}){let r=t.render;n.enabled!==!1&&(r=IY(r));let i=NY(t,n,r);if(n.enabled===!1)return null;let a=n.state??XJ;return LY(e,r,i,a)}function NY(e,t,n){let{className:r,style:i}=e,{state:a=XJ,ref:o,props:s,stateAttributesMapping:c,enabled:l=!0}=t,u=l?gY(r,a):void 0,d=l?_Y(i,a):void 0,f=l?hY(a,c):XJ,p=l&&s?PY(s):void 0,m=l?mY(f,p)??{}:XJ;return typeof document<`u`&&(l?m.ref=Array.isArray(o)?oY([m.ref,pY(n),...o]):aY(m.ref,pY(n),o):aY(null,null)),l?(u!==void 0&&(m.className=AY(m.className,u)),d!==void 0&&(m.style=mY(m.style,d)),m):XJ}function PY(e){return Array.isArray(e)?bY(e):yY(void 0,e)}var FY=Symbol.for(`react.lazy`);function IY(e){if(e?.$$typeof!==FY)return e;let t=G.Children.toArray(e)[0];return G.isValidElement(t)?t:e}function LY(e,t,n,r){if(t){if(typeof t==`function`)return t(n,r);let e=yY(n,t.props);return e.ref=n.ref,G.cloneElement(t,e)}return RY(e,n)}function RY(e,t){return e===`button`?(0,G.createElement)(`button`,{type:`button`,...t,key:t.key}):e===`img`?(0,G.createElement)(`img`,{alt:``,...t,key:t.key}):G.createElement(e,t)}function zY(e,t,n){if(!e)return 0;let r=getComputedStyle(e),i=`${t}${n===`x`?`Inline`:`Block`}`,a=parseFloat(r[`${i}Start`]);return n===`x`&&t===`margin`?a*2:a+parseFloat(r[`${i}End`])}var BY=`base-ui-disable-scrollbar`,VY={className:BY,getElement(e){return(0,Z.jsx)(`style`,{nonce:e,href:BY,precedence:`base-ui:low`,children:`.${BY}{scrollbar-width:none}.${BY}::-webkit-scrollbar{display:none}`})}};function HY(){let[,e]=G.useState({});return G.useCallback(()=>{e({})},[])}var UY=0;function WY(e,t=`mui`){let n=G.useRef(void 0),r=HY(),i=e??n.current;return G.useEffect(()=>{n.current??(UY+=1,n.current=`${t}-${UY}`,e??r())},[e,t,r]),i}var GY=BJ.useId;function KY(e,t){if(GY!==void 0){let n=GY();return e??(t?`${t}-${n}`:n)}return WY(e,t)}function qY(e){return KY(e,`base-ui`)}var JY=`data-has-overflow-x`,YY=`data-has-overflow-y`,XY=`data-overflow-x-start`,ZY=`data-overflow-x-end`,QY=`data-overflow-y-start`,$Y=`data-overflow-y-end`,eX=e=>t=>t?{[e]:``}:null,tX={hasOverflowX:eX(JY),hasOverflowY:eX(YY),overflowXStart:eX(XY),overflowXEnd:eX(ZY),overflowYStart:eX(QY),overflowYEnd:eX($Y),cornerHidden:()=>null};function nX(){return typeof window<`u`}function rX(e){return oX(e)?(e.nodeName||``).toLowerCase():`#document`}function iX(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function aX(e){return((oX(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function oX(e){return nX()?e instanceof Node||e instanceof iX(e).Node:!1}function sX(e){return nX()?e instanceof Element||e instanceof iX(e).Element:!1}function cX(e){return nX()?e instanceof HTMLElement||e instanceof iX(e).HTMLElement:!1}function lX(e){return!nX()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof iX(e).ShadowRoot}function uX(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=xX(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function dX(e){return/^(table|td|th)$/.test(rX(e))}function fX(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var pX=/transform|translate|scale|rotate|perspective|filter/,mX=/paint|layout|strict|content/,hX=e=>!!e&&e!==`none`,gX;function _X(e){let t=sX(e)?xX(e):e;return hX(t.transform)||hX(t.translate)||hX(t.scale)||hX(t.rotate)||hX(t.perspective)||!yX()&&(hX(t.backdropFilter)||hX(t.filter))||pX.test(t.willChange||``)||mX.test(t.contain||``)}function vX(e){let t=CX(e);for(;cX(t)&&!bX(t);){if(_X(t))return t;if(fX(t))return null;t=CX(t)}return null}function yX(){return gX??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),gX}function bX(e){return/^(html|body|#document)$/.test(rX(e))}function xX(e){return iX(e).getComputedStyle(e)}function SX(e){return sX(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function CX(e){if(rX(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||lX(e)&&e.host||aX(e);return lX(t)?t.host:t}function wX(e){let t=CX(e);return bX(t)?(e.ownerDocument||e).body:cX(t)&&uX(t)?t:wX(t)}function TX(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=wX(e),i=r===e.ownerDocument?.body,a=iX(r);if(i){let e=EX(a);return t.concat(a,a.visualViewport||[],uX(r)?r:[],e&&n?TX(e):[])}return t.concat(r,TX(r,[],n))}function EX(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function DX(){return typeof navigator>`u`?{userAgent:``,platform:``,maxTouchPoints:0}:{userAgent:navigator.userAgent,platform:navigator.platform??``,maxTouchPoints:navigator.maxTouchPoints??0}}var{userAgent:OX,platform:kX,maxTouchPoints:AX}=DX(),jX=OX.toLowerCase(),MX=kX.toLowerCase(),NX=/^i(os$|p)/.test(MX)||MX===`macintel`&&AX>1,PX=`android`,FX=MX===PX||jX.includes(PX),IX=!NX&&MX.startsWith(`mac`);MX.startsWith(`win`),!FX&&/^(linux|chrome os)/.test(MX);var LX=IX||NX,RX=typeof CSS<`u`&&!!CSS.supports?.(`-webkit-backdrop-filter:none`);!RX&&jX.includes(`firefox`),!RX&&jX.includes(`chrom`);var zX=LX,BX=/jsdom|happydom/.test(jX);function VX(e){let t=e.activeElement;for(;t?.shadowRoot?.activeElement!=null;)t=t.shadowRoot.activeElement;return t}function HX(e,t){if(!e||!t)return!1;let n=t.getRootNode?.();if(e.contains(t))return!0;if(n&&lX(n)){let n=t;for(;n;){if(e===n)return!0;n=n.parentNode||n.host}}return!1}function UX(e,t){let n=e;for(;n;){if(sX(n)&&n.matches(t))return n;n=n.assignedSlot??n.parentNode??(lX(n)?n.host:null)}return null}function WX(e){return`composedPath`in e?e.composedPath()[0]??e.target:e.target}var GX=`data-base-ui-focusable`,KX=`input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])`,qX=`ArrowLeft`,JX=`ArrowRight`,YX=`ArrowUp`,XX=`ArrowDown`,ZX=`data-starting-style`,QX=`data-ending-style`,$X={[ZX]:``},eZ={[QX]:``},tZ={transitionStatus(e){return e===`starting`?$X:e===`ending`?eZ:null}},nZ=`data-open`,rZ=`data-closed`,iZ=ZX,aZ=QX,oZ=`data-anchor-hidden`,sZ=`data-popup-open`,cZ=`data-pressed`,lZ={[sZ]:``},uZ={[sZ]:``,[cZ]:``},dZ={[nZ]:``},fZ={[rZ]:``},pZ={[oZ]:``},mZ={open(e){return e?lZ:null}},hZ={open(e){return e?uZ:null}},gZ={open(e){return e?dZ:fZ},anchorHidden(e){return e?pZ:null}},_Z={...gZ,...tZ},vZ=`data-trigger-disabled`;function yZ(e,t){if(!sX(e))return!1;let n=e;if(t.hasElement(n))return!n.hasAttribute(vZ);for(let[,e]of t.entries())if(HX(e,n))return!e.hasAttribute(vZ);return!1}function bZ(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 xZ(e){return e.matches(`html,body`)}function SZ(e){return cX(e)&&e.matches(`input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])`)}function CZ(e){return UX(e,`button,a[href],[role="button"],select,[tabindex]:not([tabindex="-1"]),${KX}`)!=null}function wZ(e){return e?e.getAttribute(`role`)===`combobox`&&SZ(e):!1}function TZ(e){if(!e||BX)return!0;try{return e.matches(`:focus-visible`)}catch{return!0}}function EZ(e){return e?e.hasAttribute(`data-base-ui-focusable`)?e:e.querySelector(`[data-base-ui-focusable]`)||e:null}function DZ(e,t,n=!0){return e.filter(e=>e.parentId===t).flatMap(t=>[...!n||t.context?.open?[t]:[],...DZ(e,t.id,n)])}function OZ(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 kZ(e){e.preventDefault(),e.stopPropagation()}function AZ(e){return`nativeEvent`in e}function jZ(e){return e.pointerType===``&&e.isTrusted?!0:FX&&e.pointerType?e.type===`click`&&e.buttons===1:e.detail===0&&!e.pointerType}function MZ(e){return BX?!1:!FX&&e.width===0&&e.height===0||e.type===`pointerdown`&&e.width===1&&e.height===1&&e.pressure===0&&e.detail===0&&e.pointerType===`mouse`&&(FX||e.buttons===0)||e.width<1&&e.height<1&&e.pressure===0&&e.detail===0&&e.pointerType===`touch`}function NZ(e,t){let n=[`mouse`,`pen`];return t||n.push(``,void 0),n.includes(e)}function PZ(e){let t=e.type;return t===`click`||t===`mousedown`||t===`keydown`||t===`keyup`}var FZ=Math.min,IZ=Math.max,LZ=Math.round,RZ=Math.floor,zZ=e=>({x:e,y:e}),BZ={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function VZ(e,t,n){return IZ(e,FZ(t,n))}function HZ(e,t){return typeof e==`function`?e(t):e}function UZ(e){return e.split(`-`)[0]}function WZ(e){return e.split(`-`)[1]}function GZ(e){return e===`x`?`y`:`x`}function KZ(e){return e===`y`?`height`:`width`}function qZ(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function JZ(e){return GZ(qZ(e))}function YZ(e,t,n){n===void 0&&(n=!1);let r=WZ(e),i=JZ(e),a=KZ(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=iQ(o)),[o,iQ(o)]}function XZ(e){let t=iQ(e);return[ZZ(e),t,ZZ(t)]}function ZZ(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var QZ=[`left`,`right`],$Z=[`right`,`left`],eQ=[`top`,`bottom`],tQ=[`bottom`,`top`];function nQ(e,t,n){switch(e){case`top`:case`bottom`:return n?t?$Z:QZ:t?QZ:$Z;case`left`:case`right`:return t?eQ:tQ;default:return[]}}function rQ(e,t,n,r){let i=WZ(e),a=nQ(UZ(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(ZZ)))),a}function iQ(e){let t=UZ(e);return BZ[t]+e.slice(t.length)}function aQ(e){return{top:e.top??0,right:e.right??0,bottom:e.bottom??0,left:e.left??0}}function oQ(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:aQ(e)}function sQ(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 cQ(e,t){return t<0||t>=e.length}function lQ(e,t){return fQ(e.current,{disabledIndices:t})}function uQ(e,t){return fQ(e.current,{decrement:!0,startingIndex:e.current.length,disabledIndices:t})}function dQ(e,t,n){let{decrement:r,loopFocus:i,allowEscape:a,disabledIndices:o,minIndex:s,maxIndex:c}=n,l=()=>fQ(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:cQ(e,u)?-1:u,wrapped:d}}function fQ(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&&pQ(e,a,r));return a}function pQ(e,t,n){if(typeof n==`function`?n(t):n?.includes(t)??!1)return!0;let r=e[t];return r?!hQ(r)||r.matches(`:disabled`)?!0:!n&&(r.hasAttribute(`disabled`)||r.getAttribute(`aria-disabled`)===`true`):!1}function mQ(e){return e.visibility===`hidden`||e.visibility===`collapse`}function hQ(e,t=e?xX(e):null){return!e||!e.isConnected||!t||mQ(t)?!1:typeof e.checkVisibility==`function`?e.checkVisibility():t.display!==`none`&&t.display!==`contents`}function gQ(e){return e?.ownerDocument||document}var _Q=`a[href],button,input,select,textarea,summary,details,iframe,object,embed,[tabindex],[contenteditable]:not([contenteditable="false"]),audio[controls],video[controls]`;function vQ(e){let t=e.assignedSlot;if(t)return t;if(e.parentElement)return e.parentElement;let n=e.getRootNode();return lX(n)?n.host:null}function yQ(e){for(let t of Array.from(e.children))if(rX(t)===`summary`)return t;return null}function bQ(e,t){let n=yQ(t);return!!n&&(e===n||HX(n,e))}function xQ(e){let t=e?rX(e):``;return e!=null&&e.matches(_Q)&&(t!==`summary`||e.parentElement!=null&&rX(e.parentElement)===`details`&&yQ(e.parentElement)===e)&&(t!==`details`||yQ(e)==null)&&(t!==`input`||e.type!==`hidden`)}function SQ(e){if(!xQ(e)||!e.isConnected||e.matches(`:disabled`))return!1;for(let t=e;t;t=vQ(t)){let n=t!==e,r=rX(t)===`slot`;if(t.hasAttribute(`inert`)||n&&rX(t)===`details`&&!t.open&&!bQ(e,t)||t.hasAttribute(`hidden`)||!r&&!CQ(t,n))return!1}return!0}function CQ(e,t){let n=xX(e);return t?n.display!==`none`:hQ(e,n)}function wQ(e){let t=e.tabIndex;if(t<0){let t=rX(e);if(t===`details`||t===`audio`||t===`video`||cX(e)&&e.isContentEditable)return 0}return t}function TQ(e){if(rX(e)!==`input`)return null;let t=e;return t.type===`radio`&&t.name!==``?t:null}function EQ(e,t){let n=TQ(e);if(!n)return!0;let r=t.find(e=>{let t=TQ(e);return t?.name===n.name&&t.form===n.form&&t.checked});return r?r===n:t.find(e=>{let t=TQ(e);return t?.name===n.name&&t.form===n.form})===n}function DQ(e){if(cX(e)&&rX(e)===`slot`){let t=e.assignedElements({flatten:!0});if(t.length>0)return t}return cX(e)&&e.shadowRoot?Array.from(e.shadowRoot.children):Array.from(e.children)}function OQ(e,t){DQ(e).forEach(e=>{xQ(e)&&t.push(e),OQ(e,t)})}function kQ(e,t,n){DQ(e).forEach(e=>{cX(e)&&e.matches(t)&&n.push(e),kQ(e,t,n)})}function AQ(e){return SQ(e)&&wQ(e)>=0}function jQ(e){let t=[];return OQ(e,t),t.filter(SQ)}function MQ(e){let t=jQ(e);return t.filter(e=>wQ(e)>=0&&EQ(e,t))}function NQ(e,t){let n=MQ(e),r=n.length;if(r===0)return;let i=VX(gQ(e)),a=n.indexOf(i);return n[a===-1?t===1?0:r-1:a+t]}function PQ(e){return NQ(gQ(e).body,1)||e}function FQ(e){return NQ(gQ(e).body,-1)||e}function IQ(e,t,n){if(!e)return null;let r=[];OQ(gQ(e).body,r);let i=r.indexOf(e);if(i===-1)return null;let a=r.filter(SQ);for(let e=1;e<r.length;e+=1){let o=r[(i+t*e+r.length)%r.length];if(!HX(n,o)&&AQ(o)&&EQ(o,a))return o}return r[i]}function LQ(e,t){let n=t||e.currentTarget,r=e.relatedTarget;return!r||!HX(n,r)}function RQ(e){MQ(e).forEach(e=>{e.dataset.tabindex=e.getAttribute(`tabindex`)||``,e.setAttribute(`tabindex`,`-1`)})}function zQ(e){let t=[];kQ(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 BQ=G.createContext(void 0),VQ={disableStyleElements:!1};function HQ(){return G.useContext(BQ)??VQ}var UQ=`--scroll-area-corner-height`,WQ=`--scroll-area-corner-width`,GQ=`data-orientation`,KQ={x:0,y:0},qQ={width:0,height:0},JQ={xStart:!1,xEnd:!1,yStart:!1,yEnd:!1},YQ={x:!0,y:!0,corner:!0},XQ=G.forwardRef(function(e,t){let{render:n,className:r,overflowEdgeThreshold:i,style:a,...o}=e,{xStart:s,xEnd:c,yStart:l,yEnd:u}=ZQ(i),d=qY(),f=eY(),p=eY(),{nonce:m,disableStyleElements:h}=HQ(),[g,_]=G.useState(!1),[v,y]=G.useState(!1),[b,x]=G.useState(!1),[S,C]=G.useState(!1),[w,T]=G.useState(!1),[E,D]=G.useState(qQ),[O,k]=G.useState(qQ),[A,j]=G.useState(JQ),[M,N]=G.useState(YQ),P=G.useRef(null),F=G.useRef(null),I=G.useRef(null),L=G.useRef(null),R=G.useRef(null),z=G.useRef(null),ee=G.useRef(null),te=G.useRef(null),B=G.useRef(0),ne=G.useRef(0),re=G.useRef(0),V=G.useRef(0),H=G.useRef(`vertical`),ie=G.useRef(KQ),ae=G.useRef(null);function oe(e){let t=e?x:y,n=e?f:p;t(!0),n.start(500,()=>{t(!1)})}let se=GJ(e=>{let t=e.x-ie.current.x,n=e.y-ie.current.y;ie.current=e,n!==0&&oe(!0),t!==0&&oe(!1)}),ce=GJ(()=>{let e=F.current;e&&ae.current===null&&(ae.current=e.style.scrollSnapType,e.style.scrollSnapType=`none`)}),le=GJ(e=>{if(e.button!==0||te.current!==null&&(H.current===`vertical`?R.current:z.current)?.hasPointerCapture(te.current))return;te.current=e.pointerId,B.current=e.clientY,ne.current=e.clientX,H.current=e.currentTarget.getAttribute(GQ);let t=F.current;t&&(re.current=t.scrollTop,V.current=t.scrollLeft,ce()),(H.current===`vertical`?R.current:z.current)?.setPointerCapture(e.pointerId)}),ue=GJ(e=>{if(e.pointerId!==te.current)return;te.current=null,(H.current===`vertical`?x:y)(!1),ae.current!==null&&(F.current&&(F.current.style.scrollSnapType=ae.current),ae.current=null);let t=H.current===`vertical`?R.current:z.current;t?.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId)}),de=GJ(e=>{if(e.pointerId!==te.current)return;if(e.buttons%2==0){ue(e);return}let t=F.current;if(!t)return;let n=H.current===`vertical`,r=n?R.current:z.current,i=n?I.current:L.current;if(!r||!i)return;let a=n?`y`:`x`,o=zY(i,`padding`,a),s=zY(r,`margin`,a),c=n?r.offsetHeight:r.offsetWidth,l=(n?i.offsetHeight:i.offsetWidth)-c-o-s,u=n?e.clientY-B.current:e.clientX-ne.current,d=l<=0?0:u/l,f=n?t.scrollHeight:t.scrollWidth,p=n?t.clientHeight:t.clientWidth,m=(n?re.current:V.current)+d*(f-p);n?t.scrollTop=m:t.scrollLeft=m,e.preventDefault(),oe(n)});function fe(e){C(e.pointerType===`touch`)}function pe(e){if(fe(e),e.pointerType!==`touch`){let t=HX(P.current,e.target);_(t)}}let me=G.useMemo(()=>({scrolling:v||b,hasOverflowX:!M.x,hasOverflowY:!M.y,overflowXStart:A.xStart,overflowXEnd:A.xEnd,overflowYStart:A.yStart,overflowYEnd:A.yEnd,cornerHidden:M.corner}),[v,b,M.x,M.y,M.corner,A]),he={role:`presentation`,onPointerEnter:pe,onPointerMove:pe,onPointerDown:fe,onPointerLeave(){_(!1)},style:{position:`relative`,[UQ]:`${E.height}px`,[WQ]:`${E.width}px`}},ge=MY(`div`,e,{state:me,ref:[t,P],props:[he,o],stateAttributesMapping:tX}),_e=G.useMemo(()=>({handlePointerDown:le,handlePointerMove:de,handlePointerUp:ue,handleScroll:se,disableViewportSnap:ce,cornerSize:E,setCornerSize:D,thumbSize:O,setThumbSize:k,hasMeasuredScrollbar:w,setHasMeasuredScrollbar:T,touchModality:S,cornerRef:ee,scrollingX:v,scrollingY:b,hovering:g,setHovering:_,viewportRef:F,scrollbarYRef:I,scrollbarXRef:L,thumbYRef:R,thumbXRef:z,rootId:d,hiddenState:M,setHiddenState:N,overflowEdges:A,setOverflowEdges:j,viewportState:me,overflowEdgeThreshold:{xStart:s,xEnd:c,yStart:l,yEnd:u}}),[le,de,ue,se,ce,E,O,w,S,v,b,g,d,M,A,me,s,c,l,u]);return(0,Z.jsxs)(rY.Provider,{value:_e,children:[!h&&VY.getElement(m),ge]})});function ZQ(e){let t=typeof e==`number`?{xStart:e,xEnd:e,yStart:e,yEnd:e}:e;return{xStart:Math.max(0,t?.xStart||0),xEnd:Math.max(0,t?.xEnd||0),yStart:Math.max(0,t?.yStart||0),yEnd:Math.max(0,t?.yEnd||0)}}var $=typeof document<`u`?G.useLayoutEffect:()=>{};function QQ(e,t=-(2**53-1),n=2**53-1){return Math.max(t,Math.min(e,n))}var $Q=G.createContext(void 0);function e$(){let e=G.useContext($Q);if(e===void 0)throw Error(nY(55));return e}var t$=G.createContext(void 0);function n$(){return G.useContext(t$)?.direction??`ltr`}function r$(e,t){if(t<=0)return 0;let n=QQ(e,0,t),r=n,i=t-n,a=r<=1,o=i<=1;return a&&o?r<=i?0:t:a?0:o?t:n}function i$(e,t){return e.getAnimations(t).filter(e=>{let t=e.effect?.getTiming();return t?.duration!==1/0&&t?.iterations!==1/0})}var a$=`--scroll-area-overflow-x-start`,o$=`--scroll-area-overflow-x-end`,s$=`--scroll-area-overflow-y-start`,c$=`--scroll-area-overflow-y-end`,l$=`--scroll-area-thumb-height`,u$=`--scroll-area-thumb-width`,d$=[a$,o$,s$,c$],f$=!1;function p$(){f$||RX||(typeof CSS<`u`&&`registerProperty`in CSS&&d$.forEach(e=>{try{CSS.registerProperty({name:e,syntax:`<length>`,inherits:!1,initialValue:`0px`})}catch{}}),f$=!0)}var m$=G.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,{viewportRef:o,scrollbarYRef:s,scrollbarXRef:c,thumbYRef:l,thumbXRef:u,cornerRef:d,cornerSize:f,setCornerSize:p,setThumbSize:m,rootId:h,setHiddenState:g,hiddenState:_,setHasMeasuredScrollbar:v,handleScroll:y,touchModality:b,setHovering:x,setOverflowEdges:S,overflowEdgeThreshold:C,viewportState:w}=iY(),T=n$(),E=G.useRef(!0),D=G.useRef([NaN,NaN,NaN,NaN]),O=eY(),k=eY(),A=GJ(()=>{let e=o.current,t=s.current,n=c.current,r=l.current,i=u.current,a=d.current;if(!e)return;let h=e.scrollHeight,_=e.scrollWidth,y=e.clientHeight,b=e.clientWidth,x=e.scrollTop,w=e.scrollLeft,E=D.current,O=Number.isNaN(E[0]);if(E[0]=y,E[1]=h,E[2]=b,E[3]=_,O&&v(!0),h===0||_===0)return;let k=h$(e),A=k.y,j=k.x,M=b/_,N=y/h,P=Math.max(0,_-b),F=Math.max(0,h-y),I=0,L=0;j||(I=r$(T===`rtl`?-w:w,P),L=P-I);let R=A?0:r$(x,F),z=A?0:F-R,ee=j?0:b,te=A?0:y,B=0,ne=0;!j&&!A&&(B=t?.offsetWidth||0,ne=n?.offsetHeight||0);let re=f.width===0&&f.height===0,V=re?B:0,H=re?ne:0,ie=zY(n,`padding`,`x`),ae=zY(t,`padding`,`y`),oe=zY(i,`margin`,`x`),se=zY(r,`margin`,`y`),ce=ee-ie-oe,le=te-ae-se,ue=n?Math.min(n.offsetWidth-V,ce):ce,de=t?Math.min(t.offsetHeight-H,le):le,fe=Math.max(16,ue*M),pe=Math.max(16,de*N);if(m(e=>g$(e,{width:fe,height:pe})),t&&r){let e=_$(r,l$,x,F,h,pe,t.offsetHeight-pe-ae-se);r.style.transform=`translate3d(0,${e}px,0)`}if(n&&i){let e=n.offsetWidth-fe-ie-oe,t=_$(i,u$,T===`rtl`?-w:w,P,_,fe,e);i.style.transform=`translate3d(${T===`rtl`?-t:t}px,0,0)`}let me=[I,L,R,z];d$.forEach((t,n)=>{e.style.setProperty(t,`${me[n]}px`)}),a&&p(e=>g$(e,{width:B,height:ne})),g(e=>g$(e,k));let he={xStart:!j&&I>C.xStart,xEnd:!j&&L>C.xEnd,yStart:!A&&R>C.yStart,yEnd:!A&&z>C.yEnd};S(e=>g$(e,he))});$(()=>{p$()},[]),$(()=>{queueMicrotask(A)},[A,_,T,C.xStart,C.xEnd,C.yStart,C.yEnd]),$(()=>{o.current?.matches(`:hover`)&&x(!0)},[o,x]),$(()=>{let e=o.current;if(typeof ResizeObserver>`u`||!e)return;let t=!1,n=new ResizeObserver(()=>{if(!t){t=!0;let n=D.current;if(n[0]===e.clientHeight&&n[1]===e.scrollHeight&&n[2]===e.clientWidth&&n[3]===e.scrollWidth)return}A()});return n.observe(e),k.start(0,()=>{let t=i$(e,{subtree:!0});t.length!==0&&Promise.allSettled(t.map(e=>e.finished.then(JJ))).then(A).catch(()=>{})}),()=>{n.disconnect(),k.clear()}},[A,o,k]);function j(){E.current=!1}let M={...h&&{"data-id":`${h}-viewport`},tabIndex:_.x&&_.y?-1:0,className:VY.className,style:{overflow:`scroll`},onScroll(){o.current&&(A(),(b||!E.current)&&y({x:o.current.scrollLeft,y:o.current.scrollTop}),O.start(100,()=>{E.current=!0}))},onWheel:j,onPointerMove:j,onPointerEnter:j,onKeyDown:j},N=MY(`div`,e,{ref:[t,o],state:w,props:[M,a],stateAttributesMapping:tX}),P=G.useMemo(()=>({computeThumbPosition:A}),[A]);return(0,Z.jsx)($Q.Provider,{value:P,children:N})});function h$(e){let t=e.clientHeight>=e.scrollHeight,n=e.clientWidth>=e.scrollWidth;return{y:t,x:n,corner:t||n}}function g$(e,t){for(let n in t)if(e[n]!==t[n])return t;return e}function _$(e,t,n,r,i,a,o){let s=QQ(n,0,r),c=n-s,l=Math.max(16,a*i/(i+Math.abs(c)));return e.style.setProperty(t,c?`${l}px`:``),(r?s/r*o:0)+(c>0?a-l:0)}function v$(e,t,n,r){return e.addEventListener(t,n,r),()=>{e.removeEventListener(t,n,r)}}var y$=G.createContext(void 0);function b$(){let e=G.useContext(y$);if(e===void 0)throw Error(nY(54));return e}var x$=G.forwardRef(function(e,t){let{render:n,className:r,orientation:i=`vertical`,keepMounted:a=!1,style:o,...s}=e,{hovering:c,scrollingX:l,scrollingY:u,hiddenState:d,scrollbarYRef:f,scrollbarXRef:p,viewportRef:m,thumbYRef:h,thumbXRef:g,handlePointerDown:_,handlePointerUp:v,handleScroll:y,disableViewportSnap:b,rootId:x,thumbSize:S,hasMeasuredScrollbar:C,viewportState:w}=iY(),T=i===`vertical`,E={...w,hovering:c,scrolling:T?u:l,orientation:i},D=n$(),O=!C&&!a,k=T?d.y:d.x,A=a||!k;G.useEffect(()=>{if(!A)return;let e=m.current,t=T?f.current:p.current;if(!t)return;function n(t){if(!e||t.ctrlKey)return;let n=!T,r=n?`scrollLeft`:`scrollTop`,i=n?t.deltaX:t.deltaY;if(i===0)return;let a=n?e.scrollWidth-e.clientWidth:e.scrollHeight-e.clientHeight,o=n&&D===`rtl`?-a:0,s=n&&D===`rtl`?0:a,c=e[r];c<=o&&i<0||c>=s&&i>0||(t.preventDefault(),e[r]=Math.min(s,Math.max(o,c+i)),y({x:e.scrollLeft,y:e.scrollTop}))}return v$(t,`wheel`,n,{passive:!1})},[D,y,T,p,f,A,m]);let j={...x&&{"data-id":`${x}-scrollbar`},"aria-hidden":!0,onPointerDown(e){if(e.button!==0)return;let t=WX(e.nativeEvent),n=T?h.current:g.current;if(n&&HX(n,t))return;let r=m.current;if(!r)return;let i=T?f.current:p.current;if(!n||!i)return;let a=T?`y`:`x`,o=zY(n,`margin`,a),s=zY(i,`padding`,a),c=T?n.offsetHeight:n.offsetWidth,l=i.getBoundingClientRect(),u=T?e.clientY-l.top-c/2-s+o/2:e.clientX-l.left-c/2-s+o/2,d=T?r.scrollHeight:r.scrollWidth,v=T?r.clientHeight:r.clientWidth,x=(T?i.offsetHeight:i.offsetWidth)-c-s-o;if(x<=0)return;let S=u/x,C=d-v;b(),T?r.scrollTop=S*C:r.scrollLeft=D===`rtl`?-(1-S)*C:S*C,y({x:r.scrollLeft,y:r.scrollTop}),_(e)},onMouseDown(e){e.preventDefault()},onPointerUp:v,onPointerCancel:v,style:{position:`absolute`,touchAction:`none`,WebkitUserSelect:`none`,userSelect:`none`,visibility:O?`hidden`:void 0,...T?{top:0,bottom:`var(${UQ})`,insetInlineEnd:0,[l$]:`${S.height}px`}:{insetInlineStart:0,insetInlineEnd:`var(${WQ})`,bottom:0,[u$]:`${S.width}px`}}},M=MY(`div`,e,{ref:[t,T?f:p],state:E,props:[j,s],stateAttributesMapping:tX});return A?(0,Z.jsx)(y$.Provider,{value:i,children:M}):null}),S$=G.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,{computeThumbPosition:o}=e$(),{hasMeasuredScrollbar:s,viewportState:c}=iY(),l=G.useRef(null),u=G.useRef(s);return $(()=>{if(typeof ResizeObserver>`u`)return;let e=!1,t=new ResizeObserver(()=>{!e&&(e=!0,!u.current)||o()});return l.current&&t.observe(l.current),()=>{t.disconnect()}},[o]),MY(`div`,e,{ref:[t,l],state:c,stateAttributesMapping:tX,props:[{role:`presentation`,style:{minWidth:`fit-content`}},a]})}),C$=G.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,{thumbYRef:o,thumbXRef:s,handlePointerDown:c,handlePointerMove:l,handlePointerUp:u,scrollingX:d,scrollingY:f,hasMeasuredScrollbar:p}=iY(),m=b$(),h=m===`vertical`;return MY(`div`,e,{ref:[t,h?o:s],state:{scrolling:h?f:d,orientation:m},props:[{onPointerDown:c,onPointerMove:l,onPointerUp:u,onPointerCancel:u,style:{visibility:p?void 0:`hidden`,...h?{height:`var(--scroll-area-thumb-height)`}:{width:`var(--scroll-area-thumb-width)`}}},a]})});function w$(e,t,n){let r=(Math.abs(t)-Math.abs(e))/Math.max(16,n);if(Math.abs(r)<.035)return null;let i=Math.min(.04,Math.abs(r)*.3),a=r>0,o=Math.sign(t||e);return{scaleY:1+(a?i:-i),scaleX:1+(a?-i/2:i/2),origin:(a?o>0:o<0)?`center top`:`center bottom`}}function T$(e,t,n){if(t<=0||Math.abs(n)<4)return null;let r=e<=0&&n<0,i=e>=t-1&&n>0;if(!r&&!i)return null;let a=Math.min(.06,Math.abs(n)/120*.06);return{scaleY:1-a,scaleX:1+a/2,origin:r?`center top`:`center bottom`}}var E$=(0,G.forwardRef)(function({className:e,size:t=`md`,depth:n=`shallow`,placement:r=`standalone`,...i},a){return(0,Z.jsx)(`div`,{...i,ref:a,"data-surface-size":t,"data-surface-depth":n,"data-surface-placement":r,className:Q(`caps-surface`,e)})}),D$=(0,G.forwardRef)(function({className:e,...t},n){return(0,Z.jsx)(`div`,{...t,ref:n,className:Q(`caps-screen`,e)})});(0,G.forwardRef)(function({children:e,className:t,depth:n=`deep`,fit:r=`content`,density:i=`normal`,...a},o){let s=r===`fill`;return(0,Z.jsx)(E$,{...a,className:Q(t,s&&`flex min-h-0 flex-1`),depth:n,ref:o,children:(0,Z.jsx)(`div`,{className:Q(`caps-display-gasket`,s&&`flex min-h-0 min-w-0 flex-1`),"data-display-density":i,children:(0,Z.jsx)(D$,{className:Q(s&&`flex min-h-0 min-w-0 flex-1 overflow-hidden`),children:e})})})}),(0,G.forwardRef)(function({className:e,icon:t,status:n,title:r,...i},a){return(0,Z.jsxs)(`header`,{...i,className:Q(`caps-screen-header`,e),ref:a,children:[t?(0,Z.jsx)(`span`,{className:`caps-screen-header-icon`,"aria-hidden":`true`,children:t}):null,(0,Z.jsx)(`span`,{className:`caps-screen-header-title`,children:r}),n?(0,Z.jsx)(`span`,{className:`caps-screen-header-status`,children:n}):null]})}),(0,G.forwardRef)(function({appearance:e,className:t,...n},r){return(0,Z.jsx)(`div`,{...n,className:Q(`caps-screen-cells`,t),"data-appearance":e===`compact`?e:void 0,ref:r})}),(0,G.forwardRef)(function({children:e,className:t,legend:n,readout:r,icon:i,appearance:a,wide:o=!1,...s},c){return(0,Z.jsxs)(`div`,{...s,className:Q(`caps-screen-cell`,t),"data-wide":o||void 0,"data-appearance":a===`compact`?a:void 0,ref:c,children:[i?(0,Z.jsx)(`span`,{className:`caps-screen-cell-icon`,children:i}):null,n?(0,Z.jsx)(`span`,{className:`caps-screen-cell-legend`,children:n}):null,r?(0,Z.jsx)(`span`,{className:`caps-screen-cell-readout`,children:r}):null,a===`compact`?(0,Z.jsx)(`div`,{className:`caps-screen-cell-controls`,children:e}):e]})});var O$=(0,G.forwardRef)(function({children:e,className:t,surface:n=!1,surfaceSize:r,surfaceDepth:i,screen:a=!1,...o},s){let c=(0,G.useRef)(null),l=(0,G.useRef)(null),u=$R();(0,G.useEffect)(()=>{let e=c.current,t=e?.querySelector(`.caps-scroll-viewport`);if(!t||!e)return;let n=null,r,i=t.scrollTop,a=performance.now(),o=0,s=e=>{let t=l.current;if(!e||u||!t)return;n?.cancel(),t.style.transformOrigin=e.origin;let r=BR(t),i=fH(r,{ease:`outQuad`,duration:45}),a=dH(r,{bounce:.18,duration:180});n=UV(t,{scaleY:[{to:e.scaleY,...i},{to:1,...a}],scaleX:[{to:e.scaleX,...i},{to:1,...a}]})},d=(e,t)=>{let n=w$(o,e,t);o=e,s(n)},f=e=>{if(e.ctrlKey||Math.abs(e.deltaX)>Math.abs(e.deltaY))return;let n=e.deltaMode===1?16:e.deltaMode===2?t.clientHeight:1,i=T$(t.scrollTop,t.scrollHeight-t.clientHeight,e.deltaY*n);i&&(clearTimeout(r),o=0,s(i))},p=()=>{let e=performance.now(),n=e-a,s=n>100?16:Math.max(16,n),c=t.scrollTop-i;n>100&&(o=0),d(c/s,s),i=t.scrollTop,a=e,clearTimeout(r),r=setTimeout(()=>{d(0,32)},64)};return t.addEventListener(`scroll`,p,{passive:!0}),e.addEventListener(`wheel`,f,{passive:!0}),()=>{clearTimeout(r),n?.cancel(),l.current&&(l.current.style.transform=`none`),t.removeEventListener(`scroll`,p),e.removeEventListener(`wheel`,f)}},[a,n,u]);let d=(0,Z.jsx)(m$,{render:a?(0,Z.jsx)(D$,{}):(0,Z.jsx)(`div`,{}),...o,ref:s,className:`caps-scroll-viewport`,children:(0,Z.jsx)(S$,{style:{minWidth:0},children:e})});return(0,Z.jsxs)(XQ,{render:n?(0,Z.jsx)(E$,{size:r??`md`,depth:i??`shallow`}):(0,Z.jsx)(`div`,{}),ref:c,className:Q(`caps-scroll-area`,t),children:[a?(0,Z.jsx)(`div`,{className:`caps-display-gasket caps-scroll-display`,children:d}):d,(0,Z.jsx)(E$,{size:`sm`,depth:`deep`,placement:`embedded`,className:`caps-scroll-track-surface`,children:(0,Z.jsx)(x$,{className:`caps-scroll-track`,children:(0,Z.jsx)(C$,{className:`caps-scroll-thumb`,children:(0,Z.jsx)(`span`,{className:`caps-scroll-thumb-surface`,ref:l})})})})]})}),k$=(0,G.forwardRef)(function({className:e,invalid:t,...n},r){return(0,Z.jsx)(`input`,{...n,"aria-invalid":t?!0:n[`aria-invalid`]===!1?void 0:n[`aria-invalid`],className:Q(`input caps-input w-full`,e),ref:r})});(0,G.forwardRef)(function({leading:e,className:t,...n},r){return(0,Z.jsxs)(`span`,{className:`caps-search-input`,"data-leading":e?`true`:void 0,children:[e?(0,Z.jsx)(`span`,{className:`caps-search-leading`,"aria-hidden":`true`,children:e}):null,(0,Z.jsx)(k$,{...n,type:`search`,className:t,ref:r})]})});function A$(e,t){sI.error(e,{id:t,toasterId:`prints-generation-notices`})}var j$=(0,G.forwardRef)(function({children:e,className:t,optional:n,required:r,...i},a){return(0,Z.jsxs)(`label`,{...i,className:Q(`label caps-label cursor-pointer justify-start gap-sm text-sm font-semibold text-base-content`,t),ref:a,children:[e,r?(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`text-error`,children:`*`}):null,n&&!r?(0,Z.jsx)(`span`,{className:`caps-label-optional`,children:`Optional`}):null]})}),M$=(0,G.forwardRef)(function({children:e,className:t,...n},r){return(0,Z.jsx)(`div`,{...n,className:Q(`caps-input-group join flex w-full items-stretch [&>*]:join-item [&>*:first-child]:rounded-e-none [&>*:last-child]:rounded-s-none [&>*:not(:first-child):not(:last-child)]:rounded-none [&>.btn]:shrink-0 [&>.input]:min-w-0 [&>.input]:flex-1 [&>.select]:min-w-0 [&>.select]:flex-1`,t),ref:r,children:G.Children.map(e,e=>(0,G.isValidElement)(e)?(0,G.cloneElement)(e,{className:Q(`join-item caps-input-group-control`,e.props.className)}):e)})}),N$=(0,G.forwardRef)(function({className:e,...t},n){return(0,Z.jsx)(`div`,{...t,className:Q(`join-item flex items-center border border-base-300 bg-base-200 px-md text-sm text-base-content`,e),ref:n})});function P$(e){let t=e.parentElement;if(!t||e.previousElementSibling===null)return 0;let n=getComputedStyle(t);if(!(n.display.includes(`grid`)||n.display.includes(`flex`)&&n.flexDirection.startsWith(`column`)))return 0;let r=Number.parseFloat(n.rowGap);return Number.isFinite(r)?r:0}(0,G.forwardRef)(function({show:e,appear:t=!1,children:n,className:r,...i},a){let o=(0,G.useRef)(null);(0,G.useImperativeHandle)(a,()=>o.current);let s=$R(),[c,l]=(0,G.useState)(e),u=(0,G.useRef)(!0);return e&&!c&&l(!0),(0,G.useLayoutEffect)(()=>{let n=o.current,r=u.current;if(u.current=!1,!n||r&&!t)return;if(!JR(n)){e||l(!1);return}let i=BR(n),a=`translateY(${String(i.distance)}px)`,c=qR(i,i.ease),d=n.getBoundingClientRect().height,f=P$(n),p=(e,t)=>{n.style.overflow=`clip`;let r=e=>({height:`${String(e)}px`,marginBlockStart:`${String(e===0?-f:0)}px`}),a=n.animate([r(e),r(t)],{duration:i.normal,easing:c}),o=()=>{n.style.removeProperty(`overflow`)};return a.addEventListener(`finish`,o),a.addEventListener(`cancel`,o),a};if(e){let e=[n.animate([{opacity:0,transform:a},{opacity:1,transform:`none`}],{duration:i.normal,easing:c})];return!s&&d>0&&e.push(p(0,d)),()=>{for(let t of e)t.cancel()}}let m=n.animate([{opacity:1,transform:`none`},{opacity:0,transform:a}],{duration:i.fast,easing:qR(i,i.easeExit),fill:`forwards`}),h=!s&&d>0?p(d,0):m;return h!==m&&h.effect?.updateTiming({fill:`forwards`}),h.addEventListener(`finish`,()=>{l(!1)}),()=>{m.cancel(),h.cancel()}},[e,t,s]),c?(0,Z.jsx)(`div`,{...i,ref:o,className:Q(`caps-presence`,r),"data-present":e,"aria-hidden":!e||void 0,children:n}):null});var yee=(0,G.forwardRef)(function({open:e,children:t,className:n,...r},i){return(0,Z.jsx)(`div`,{...r,ref:i,className:Q(`caps-collapse`,n),"data-open":e,"aria-hidden":!e||void 0,children:(0,Z.jsx)(`div`,{className:`caps-collapse-clip`,children:t})})});(0,G.forwardRef)(function({swapKey:e,anchor:t=`start`,children:n,className:r,...i},a){let o=(0,G.useRef)(null);(0,G.useImperativeHandle)(a,()=>o.current);let s=$R(),[c,l]=(0,G.useState)({key:e,content:n}),[u,d]=(0,G.useState)([]);c.key===e?c.content!==n&&l({key:e,content:n}):(d([...u.filter(t=>t.key!==e&&t.key!==c.key),c]),l({key:e,content:n}));let f=(0,G.useRef)(null);return(0,G.useLayoutEffect)(()=>{let e=o.current;if(!e||!(`ResizeObserver`in globalThis))return;f.current=e.getBoundingClientRect();let t=new ResizeObserver(()=>{e.getAnimations().length===0&&(f.current=e.getBoundingClientRect())});return t.observe(e),()=>{t.disconnect()}},[]),(0,G.useLayoutEffect)(()=>{let e=o.current;if(!e)return;let t=[...e.querySelectorAll(`:scope > [data-swap-leaving]`)],n=e.querySelector(`:scope > [data-swap-current]`);if(n===null||t.length===0)return;if(!JR(e)){d([]);return}let r=f.current,i=e.getBoundingClientRect(),a=BR(e),c=[n.animate([{opacity:0,filter:`blur(${String(a.blur)}px)`,transform:`translateY(${String(a.distance/2)}px)`},{opacity:1,filter:`blur(0px)`,transform:`none`}],{duration:a.normal,easing:qR(a,a.ease)})];for(let e of t){let t=e.animate([{opacity:1,filter:`blur(0px)`,transform:`none`},{opacity:0,filter:`blur(${String(a.blur)}px)`,transform:`translateY(${String(-a.distance/2)}px)`}],{duration:a.fast,easing:qR(a,a.easeExit),fill:`forwards`}),n=e.dataset.swapLeaving;t.onfinish=()=>{d(e=>e.filter(e=>e.key!==n))},c.push(t)}let l=r!==null&&(Math.abs(r.height-i.height)>.5||Math.abs(r.width-i.width)>.5);return!s&&l&&c.push(e.animate([{width:`${String(r.width)}px`,height:`${String(r.height)}px`},{width:`${String(i.width)}px`,height:`${String(i.height)}px`}],{duration:a.normal,easing:qR(a,a.ease)})),()=>{for(let e of c)e.cancel()}},[e,s]),(0,Z.jsx)(`div`,{...i,ref:o,className:Q(`caps-swap`,r),"data-anchor":t,children:[...u.map(e=>(0,Z.jsx)(`div`,{className:`caps-swap-layer`,"data-swap-leaving":e.key,"aria-hidden":`true`,children:e.content},e.key)),(0,Z.jsx)(`div`,{className:`caps-swap-layer`,"data-swap-current":``,children:n},e)]})});function F$({children:e,...t}){let[n,r]=(0,G.useState)(e);return e&&e!==n&&r(e),(0,Z.jsx)(yee,{...t,className:Q(`caps-field-error-reveal`,t.className),open:!!e,children:(0,Z.jsx)(`div`,{className:`caps-field-error`,role:`alert`,"aria-hidden":!e,children:n})})}function I$({children:e,divider:t=!0,error:n,layout:r=`end`,status:i,...a}){return(0,Z.jsxs)(`footer`,{...a,className:Q(`caps-form-footer`,a.className),"data-divider":t,"data-layout":r,children:[(0,Z.jsx)(F$,{children:n}),(0,Z.jsxs)(`div`,{className:`caps-form-footer-row`,children:[i?(0,Z.jsx)(`div`,{className:`caps-form-footer-status`,role:`status`,children:i}):null,(0,Z.jsx)(`div`,{className:`caps-form-footer-actions`,children:e})]})]})}var L$=(0,G.forwardRef)(function({busy:e=!1,children:t,className:n,layout:r,...i},a){return(0,Z.jsx)(`form`,{...i,"aria-busy":e||void 0,className:Q(`caps-form`,n),"data-layout":r,ref:a,children:(0,Z.jsx)(`fieldset`,{className:`caps-form-body`,disabled:e,children:t})})}),R$={2:`h2`,3:`h3`,4:`h4`},z$=(0,G.forwardRef)(function({children:e,className:t,description:n,layout:r,level:i=3,title:a,...o},s){let c=(0,G.useId)(),l=R$[i];return(0,Z.jsxs)(`section`,{...o,"aria-labelledby":`${c}-title`,className:Q(`caps-form-section`,t),"data-layout":r,ref:s,children:[(0,Z.jsxs)(`header`,{className:`caps-form-section-copy`,children:[(0,Z.jsx)(l,{className:`caps-form-section-title`,id:`${c}-title`,children:a}),n?(0,Z.jsx)(`p`,{className:`caps-form-section-description`,children:n}):null]}),(0,Z.jsx)(`div`,{className:`caps-form-section-fields`,children:e})]})}),B$=(0,G.forwardRef)(function({children:e,className:t,description:n,error:r,icon:i,layout:a,legend:o,legendTitle:s,...c},l){let u=(0,G.useId)(),d=[n?`${u}-description`:c[`aria-describedby`],r?`${u}-error`:null].filter(Boolean).join(` `)||void 0;return(0,Z.jsxs)(`fieldset`,{...c,"aria-describedby":d,"aria-invalid":r?!0:c[`aria-invalid`],className:Q(`caps-fieldset`,t),"data-layout":a,ref:l,children:[(0,Z.jsxs)(`legend`,{className:`caps-fieldset-legend`,title:s,children:[i?(0,Z.jsx)(`span`,{className:`caps-field-icon`,"aria-hidden":`true`,children:i}):null,o]}),n?(0,Z.jsx)(`p`,{className:`caps-fieldset-description`,id:`${u}-description`,children:n}):null,(0,Z.jsx)(`div`,{className:`caps-fieldset-fields`,children:e}),r===void 0?null:(0,Z.jsx)(F$,{id:`${u}-error`,children:r})]})});function V$(e){let t=[];return G.Children.forEach(e.props.children,e=>{(0,G.isValidElement)(e)&&e.type!==N$&&t.push(e)}),t[0]??null}var H$=(0,G.forwardRef)(function({children:e,className:t,description:n,error:r,icon:i,label:a,labelTitle:o,optional:s,orientation:c=`vertical`,readout:l=!1,required:u,...d},f){let p=(0,G.useId)(),m=(0,G.isValidElement)(e)?e:null,h=m?.type===M$,g=h?V$(m):m,_=g?.props.id??p,v=`${_}-description`,y=`${_}-error`,b=[g?.props[`aria-describedby`],n?v:null,r?y:null].filter(Boolean).join(` `)||void 0,x=u===!0||g?.props.required,S=r?!0:g?.props[`aria-invalid`],C=u===!0||g?.props[`aria-required`],w={id:_};x!==void 0&&(w.required=x),b!==void 0&&(w[`aria-describedby`]=b),S!==void 0&&(w[`aria-invalid`]=S),C!==void 0&&(w[`aria-required`]=C);let T=m&&g&&!l?h?(0,G.cloneElement)(m,void 0,G.Children.map(m.props.children,e=>e===g?(0,G.cloneElement)(g,w):e)):(0,G.cloneElement)(m,w):e,E=a?(0,Z.jsx)(j$,{htmlFor:l?void 0:_,title:o,className:c===`inline`?`font-normal`:void 0,...u===void 0?{}:{required:u},...s===void 0?{}:{optional:s},children:a}):null,D=a||n?(0,Z.jsxs)(`div`,{className:`caps-field-copy`,children:[E,n?(0,Z.jsx)(`p`,{className:`caps-field-description`,id:v,children:n}):null]}):null,O=i?(0,Z.jsxs)(`div`,{className:`caps-field-lead`,children:[(0,Z.jsx)(`span`,{className:`caps-field-icon`,"aria-hidden":`true`,children:i}),D]}):D;return(0,Z.jsxs)(`div`,{...d,className:Q(`caps-field`,t),"data-orientation":c,ref:f,children:[c===`horizontal`?(0,Z.jsxs)(`div`,{className:`caps-field-row`,children:[O,T]}):c===`inline`?(0,Z.jsxs)(`div`,{className:`caps-field-row`,children:[T,O]}):(0,Z.jsxs)(Z.Fragment,{children:[O,T]}),(0,Z.jsx)(F$,{id:y,children:r})]})});function U$(e){let t=String(e),n=t.indexOf(`.`);return n===-1?0:t.length-n-1}var W$=`M 9.86 38.14 A 20 20 0 1 1 38.14 38.14`,G$=6,K$=new Map([[`ArrowUp`,1],[`ArrowDown`,-1],[`PageUp`,10],[`PageDown`,-10]]),q$=(0,G.forwardRef)(function({className:e,decrementLabel:t=`Decrease`,defaultValue:n=null,disabled:r,incrementLabel:i=`Increase`,invalid:a,max:o,min:s,onBlur:c,onKeyDown:l,onValueChange:u,step:d=1,unit:f,value:p,wrap:m=!1,...h},g){let[_,v]=(0,G.useState)(n),[y,b]=(0,G.useState)(null),x=p===void 0?_:p,S=U$(d),C=e=>{let t=Number(e.toFixed(S));return s!==void 0&&t<s?s:o!==void 0&&t>o?o:t},w=e=>{let t=e===null?null:C(e);v(t),b(null),t!==x&&u?.(t)},T=()=>{if(y===null)return;let e=Number(y);w(y.trim()===``||!Number.isFinite(e)?null:e)},E=e=>{let t=(x??s??0)+e*d;if(m&&s!==void 0&&o!==void 0){if(t>o){w(s);return}if(t<s){w(o);return}}w(t)},D=s!==void 0&&x!==null&&x<=s,O=o!==void 0&&x!==null&&x>=o,k=r===!0,A=(0,G.useRef)(null),j=s!==void 0&&o!==void 0&&o>s?((x??s)-s)/(o-s):null,M=e=>{k||(e.currentTarget.setPointerCapture(e.pointerId),A.current={y:e.clientY,value:x??s??0})},N=e=>{if(!A.current)return;let t=Math.trunc((A.current.y-e.clientY)/G$),n=C(A.current.value+t*d);n!==x&&w(n)},P=()=>{A.current=null};return(0,Z.jsxs)(`span`,{className:Q(`caps-number-field`,e),"data-at-max":O||void 0,"data-at-min":D||void 0,"data-disabled":k||void 0,"data-wrap":m||void 0,children:[j===null?null:(0,Z.jsxs)(`svg`,{className:`caps-number-field-dial`,viewBox:`0 0 48 48`,"aria-hidden":`true`,focusable:`false`,onPointerDown:M,onPointerMove:N,onPointerUp:P,onPointerCancel:P,children:[(0,Z.jsx)(`path`,{className:`caps-number-field-dial-track`,d:W$,pathLength:100}),(0,Z.jsx)(`path`,{className:`caps-number-field-dial-level`,d:W$,pathLength:100,strokeDasharray:`${String(Math.max(.5,j*100))} 100`})]}),(0,Z.jsx)(kJ,{type:`button`,variant:`outline`,size:`icon`,className:`caps-number-field-decrement`,"aria-label":t,"aria-controls":h.id,tabIndex:-1,disabled:k||D&&!m,onClick:()=>{E(-1)},children:(0,Z.jsx)(GI,{"aria-hidden":`true`})}),(0,Z.jsxs)(`span`,{className:`caps-number-field-readout`,children:[(0,Z.jsx)(`input`,{...h,"aria-invalid":a?!0:h[`aria-invalid`]===!1?void 0:h[`aria-invalid`],className:`input caps-input caps-number-field-input`,disabled:r,inputMode:h.inputMode??(S>0?`decimal`:`numeric`),max:o,min:s,onBlur:e=>{T(),c?.(e)},onChange:e=>{b(e.target.value)},onKeyDown:e=>{if(l?.(e),e.defaultPrevented)return;let t=K$.get(e.key);t===void 0?e.key===`Home`&&s!==void 0?(e.preventDefault(),w(s)):e.key===`End`&&o!==void 0?(e.preventDefault(),w(o)):e.key===`Enter`&&T():(e.preventDefault(),E(t))},ref:g,step:d,type:`number`,value:y??(x===null?``:String(x))}),f?(0,Z.jsx)(`span`,{className:`caps-number-field-unit`,"aria-hidden":`true`,children:f}):null]}),(0,Z.jsx)(kJ,{type:`button`,variant:`outline`,size:`icon`,className:`caps-number-field-increment`,"aria-label":i,"aria-controls":h.id,tabIndex:-1,disabled:k||O&&!m,onClick:()=>{E(1)},children:(0,Z.jsx)(JI,{"aria-hidden":`true`})})]})}),J$=(0,G.forwardRef)(function({className:e,invalid:t,...n},r){return(0,Z.jsxs)(`span`,{className:`caps-select-shell`,children:[(0,Z.jsx)(`select`,{...n,"aria-invalid":t?!0:n[`aria-invalid`]===!1?void 0:n[`aria-invalid`],className:Q(`select select-bordered caps-select w-full`,t&&`select-error`,e),ref:r}),!n.multiple&&(!n.size||n.size<=1)?(0,Z.jsx)(jI,{className:`caps-select-chevron`,"aria-hidden":`true`}):null]})});function Y$({checked:e}){let t=`caps-switch-${(0,G.useId)().replaceAll(`:`,``)}`,n=(0,G.useRef)(null),r=(0,G.useRef)(null),i=(0,G.useRef)(e).current,a=(0,G.useRef)(e),o=$R();return(0,G.useLayoutEffect)(()=>{if(!n.current||!r.current)return;let t=o||a.current===e;a.current=e;let i=e?16:8,s=BR(n.current),c=dH(s,{bounce:.25,duration:440}),l=fH(s,{ease:`inOutSine`,duration:100}),u=UV(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=UV(r.current,{gradientTransform:e?`matrix(2 0 0 1 10 6)`:`matrix(1 0 0 1 6 6)`,...t?{duration:0}:{delay:l.duration,...c}});return()=>{u.cancel(),d.cancel()}},[e,o]),(0,Z.jsxs)(`svg`,{className:`caps-switch-visual`,width:`40`,height:`24`,viewBox:`0 0 20 12`,"aria-hidden":`true`,focusable:`false`,children:[(0,Z.jsxs)(`defs`,{children:[(0,Z.jsx)(YV,{ref:r,id:`${t}-surface`,transform:i?`matrix(2 0 0 1 10 6)`:`matrix(1 0 0 1 6 6)`}),(0,Z.jsx)(XV,{id:`${t}-shadow`}),(0,Z.jsx)(ZV,{id:`${t}-inset`}),(0,Z.jsx)(`clipPath`,{id:`${t}-track`,children:(0,Z.jsx)(`rect`,{x:`1`,y:`1`,width:`18`,height:`10`,rx:`5`})})]}),(0,Z.jsx)(`rect`,{className:`caps-switch-track`,filter:`url(#${t}-inset)`,x:`0.5`,y:`0.5`,width:`19`,height:`11`,rx:`5.5`}),(0,Z.jsx)(`g`,{clipPath:`url(#${t}-track)`,children:(0,Z.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 X$=(0,G.forwardRef)(function({className:e,checked:t,defaultChecked:n=!1,onChange:r,onCheckedChange:i,...a},o){let s=(0,G.useRef)(null),[c,l]=(0,G.useState)(n),u=t??c;return(0,G.useImperativeHandle)(o,()=>{if(!s.current)throw Error(`Switch input is not mounted`);return s.current},[]),(0,G.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,Z.jsxs)(`span`,{className:`caps-switch`,"data-checked":u,children:[(0,Z.jsx)(`input`,{...a,checked:u,className:Q(`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,Z.jsx)(Y$,{checked:u})]})}),Z$={2:`h2`,3:`h3`,4:`h4`};function Q$(e,t){let{reduced:n}=t,r=e&&!n,i=WR(t,600),[a,o]=(0,G.useState)(r);return(0,G.useEffect)(()=>{if(o(r),!r)return;let e=globalThis.setTimeout(()=>{o(!1)},i);return()=>{globalThis.clearTimeout(e)}},[r,i]),a}var $$=(0,Z.jsx)(lH,{decorative:!0,pace:`idle`,size:`md`,tone:`primary`,variant:`wander`}),e1=(0,G.forwardRef)(function({actions:e,secondaryAction:t,className:n,description:r,headingLevel:i=2,primaryAction:a,suggestions:o,thinking:s=!1,title:c,visual:l,renderVisual:u,variant:d=`plain`,...f},p){let m=(0,G.useId)(),h=(0,G.useRef)(null),g=UR(h),_=Q$(d===`speech`,g)&&!s,v=Z$[i],y=l??(d===`panel`?`blobs`:void 0),b=u?u({speaking:_,thinking:s}):y===`blobs`?$$:y,x=`${m}-reason`,S=(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(v,{ref:h,className:`empty-state-title`,id:f[`aria-labelledby`]?void 0:m,children:c}),(0,Z.jsx)(`p`,{children:r}),a?(0,Z.jsxs)(`div`,{className:`empty-state-primary`,children:[(0,Z.jsxs)(`div`,{className:`empty-state-action-row`,children:[(0,Z.jsx)(kJ,{"aria-describedby":a.disabled&&a.disabledReason?x:void 0,disabled:a.disabled,loading:a.pending===!0,onClick:a.onSelect,variant:`primary`,children:a.label}),t]}),a.disabled&&a.disabledReason?(0,Z.jsx)(`span`,{className:`empty-state-reason`,id:x,children:a.disabledReason}):null]}):null,o&&o.length>0?(0,Z.jsx)(`ul`,{"aria-label":`Try one of these`,className:`empty-state-suggestions`,children:o.map((e,t)=>(0,Z.jsx)(`li`,{children:(0,Z.jsx)(kJ,{disabled:e.disabled,loading:e.pending===!0,size:`sm`,variant:`outline`,onClick:e.onSelect,children:e.label})},`${String(t)}:${e.label}`))}):null,e?(0,Z.jsx)(`div`,{className:`empty-state-actions`,children:e}):null]});return(0,Z.jsxs)(`section`,{...f,"aria-labelledby":f[`aria-labelledby`]??m,className:Q(`empty-state`,d!==`plain`&&`empty-state-${d}`,n),ref:p,children:[b?(0,Z.jsx)(`div`,{"aria-hidden":`true`,className:`empty-state-visual`,children:b}):null,d===`speech`?(0,Z.jsx)(`div`,{className:`empty-state-bubble`,children:S}):S]})}),t1=8e3,n1=(0,G.forwardRef)(function({className:e,detail:t,framed:n=!0,icon:r,message:i,onRetry:a,size:o=`md`,slowAfterMs:s=t1,variant:c=`line`,...l},u){let[d,f]=(0,G.useState)(!1);return(0,G.useEffect)(()=>{if(f(!1),!Number.isFinite(s))return;let e=globalThis.setTimeout(()=>{f(!0)},s);return()=>{globalThis.clearTimeout(e)}},[s,i]),(0,Z.jsxs)(`div`,{...l,className:Q(`caps-loading-state`,e),"data-framed":n?void 0:`false`,"data-icon":r?``:void 0,"data-size":o,"data-slow":d||void 0,ref:u,role:`status`,children:[r?(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`caps-loading-state-icon`,children:r}):null,(0,Z.jsx)(lH,{decorative:!0,size:o,variant:c}),(0,Z.jsxs)(`span`,{className:`caps-loading-state-copy`,children:[(0,Z.jsx)(`span`,{children:i}),t?(0,Z.jsx)(`span`,{className:`caps-loading-state-detail`,children:t}):null,d?(0,Z.jsx)(`span`,{className:`caps-loading-state-detail`,children:`Still working…`}):null]}),d&&a?(0,Z.jsx)(kJ,{className:`caps-loading-state-retry`,size:`sm`,variant:`outline`,onClick:a,children:`Retry`}):null]})}),r1=`prints.composer.v1`,i1=160,a1=96,o1=24,s1=96,c1=.4,l1={maxHeight:i1,collapsed:!1};function u1(e,t){return Math.max(a1,Math.floor(Math.min(e*.7,t-200)))}function d1(e,t){return Math.round(Math.min(Math.max(e,a1),t))}var f1=Gx(zS(J({maxHeight:yS,collapsed:nS})));function p1(){try{return window.localStorage}catch(e){return e instanceof DOMException&&e.name===`SecurityError`||oW(`composer-storage-open`,e),null}}function m1(){let e=p1();if(e===null)return l1;try{let t=f1(e.getItem(r1));return Dd(t)?{maxHeight:Math.max(t.value.maxHeight,a1),collapsed:t.value.collapsed}:l1}catch(e){return oW(`composer-size-read`,e),l1}}function h1(e){let t=p1();if(t!==null)try{t.setItem(r1,JSON.stringify(e))}catch(e){oW(`composer-size-write`,e)}}function g1(){let[e,t]=(0,G.useState)(!1);return(0,G.useLayoutEffect)(()=>{let e=window.matchMedia(`(pointer: coarse)`),n=()=>{t(e.matches)};return n(),e.addEventListener(`change`,n),()=>{e.removeEventListener(`change`,n)}},[]),e}function _1(e){return e?.closest(`[data-app-pane]`)??null}function v1(e){let[t,n]=(0,G.useState)(l1),[r,i]=(0,G.useState)(u1(800,800)),[a,o]=(0,G.useState)(800),[s,c]=(0,G.useState)(!1),l=g1();(0,G.useLayoutEffect)(()=>{n(m1())},[]),(0,G.useLayoutEffect)(()=>{let t=()=>{let t=_1(e.current);i(u1(window.innerHeight,t?.clientHeight??window.innerHeight)),o(window.visualViewport?.height??window.innerHeight)};return t(),window.addEventListener(`resize`,t),window.visualViewport?.addEventListener(`resize`,t),()=>{window.removeEventListener(`resize`,t),window.visualViewport?.removeEventListener(`resize`,t)}},[e]);let u=d1(t.maxHeight,r),d=(0,G.useCallback)(e=>{n(e),h1(e)},[]),f=s&&l;return{cap:l?Math.max(a1,Math.round(a*c1)):u,coarse:l,collapsed:t.collapsed,fullscreen:f,min:a1,max:r,maxHeight:u,setMaxHeight:e=>{d({...t,maxHeight:d1(e,r)})},reset:()=>{d({...t,maxHeight:i1})},setCollapsed:e=>{d({...t,collapsed:e})},setFullscreen:c}}function y1({layout:e}){let[t,n]=(0,G.useState)(null);return e.coarse?null:(0,Z.jsx)(`div`,{"aria-label":`Resize prompt`,"aria-orientation":`horizontal`,"aria-valuemax":e.max,"aria-valuemin":e.min,"aria-valuenow":e.maxHeight,"aria-valuetext":`${String(e.maxHeight)} pixels`,className:`prints-composer-handle`,"data-composer-handle":!0,"data-dragging":t===null?void 0:``,onDoubleClick:e.reset,onKeyDown:t=>{let n=t.shiftKey?s1:o1,r=t.key===`ArrowUp`?e.maxHeight+n:t.key===`ArrowDown`?e.maxHeight-n:t.key===`Home`?e.min:t.key===`End`?e.max:null;t.key===`Enter`?(t.preventDefault(),e.reset()):r!==null&&(t.preventDefault(),e.setMaxHeight(r))},onPointerCancel:()=>{n(null)},onPointerDown:t=>{t.preventDefault(),t.currentTarget.setPointerCapture(t.pointerId),n({y:t.clientY,height:e.maxHeight})},onPointerMove:n=>{t!==null&&e.setMaxHeight(t.height+(t.y-n.clientY))},onPointerUp:()=>{n(null)},role:`separator`,tabIndex:0})}var b1=(0,G.createContext)(null),x1=(0,G.forwardRef)(function({children:e,defaultValue:t,onValueChange:n,value:r,...i},a){let[o,s]=(0,G.useState)(t),c=r??o,l=(0,G.useId)(),u=e=>{r===void 0&&s(e),n?.(e)},d=(e,t)=>`${l}-${e}-${encodeURIComponent(t)}`;return(0,Z.jsx)(b1.Provider,{value:{onValueChange:u,panelId:e=>d(`panel`,e),selectedValue:c,tabId:e=>d(`tab`,e)},children:(0,Z.jsx)(`div`,{...i,className:Q(`w-full`,i.className),ref:a,children:e})})});function S1(){let e=(0,G.useContext)(b1);if(!e)throw Error(`Tabs parts must be used inside <Tabs>`);return e}var C1=(0,G.forwardRef)(function({className:e,variant:t=`bordered`,...n},r){return(0,Z.jsx)(`div`,{...n,"aria-orientation":n[`aria-orientation`]??`horizontal`,className:Q(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`})}),w1=(0,G.forwardRef)(function({className:e,disabled:t,onClick:n,onKeyDown:r,value:i,...a},o){let s=S1(),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,Z.jsx)(`button`,{...a,"aria-controls":s.panelId(i),"aria-disabled":t?!0:void 0,"aria-selected":c,className:Q(`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,G.forwardRef)(function({children:e,className:t,forceMount:n=!1,value:r,...i},a){let o=S1(),s=o.selectedValue===r;return!s&&!n?null:(0,Z.jsx)(`div`,{...i,"aria-labelledby":o.tabId(r),className:Q(`mt-md focus-visible:outline-none`,t),hidden:!s,id:o.panelId(r),ref:a,role:`tabpanel`,tabIndex:0,children:e})});var T1=`prints-generation-notices`;function E1({count:e,total:t,canWrite:n,onToggleAll:r,onMove:i,onFavorite:a,onDone:o}){let s=t>0&&e===t;return(0,Z.jsxs)(`div`,{className:`prints-select-bar`,role:`toolbar`,"aria-label":`Selection`,children:[(0,Z.jsx)(`span`,{className:`prints-select-count`,"aria-live":`polite`,children:e===0?`Choose prints`:`${String(e)} selected`}),(0,Z.jsxs)(kJ,{size:`sm`,variant:`ghost`,className:`prints-select-all`,disabled:t===0,onClick:r,children:[(0,Z.jsx)(`span`,{className:`prints-select-wide`,children:s?`Clear selection`:`Select all in view`}),(0,Z.jsx)(`span`,{className:`prints-select-narrow`,children:s?`None`:`All`})]}),(0,Z.jsx)(`span`,{className:`prints-select-spacer`}),(0,Z.jsxs)(kJ,{size:`sm`,variant:`ghost`,"aria-label":`Favorite`,disabled:e===0||!n,onClick:a,children:[(0,Z.jsx)(zI,{"aria-hidden":!0,size:16}),(0,Z.jsx)(`span`,{className:`prints-select-wide`,children:`Favorite`})]}),(0,Z.jsxs)(kJ,{size:`sm`,disabled:e===0||!n,onClick:i,children:[(0,Z.jsx)(II,{"aria-hidden":!0,size:16}),(0,Z.jsxs)(`span`,{className:`prints-select-wide`,children:[`Move to… (`,e,`)`]}),(0,Z.jsxs)(`span`,{className:`prints-select-narrow`,children:[`Move (`,e,`)`]})]}),(0,Z.jsx)(LJ,{className:`prints-select-done`,"aria-label":`Done selecting`,title:`Done selecting`,icon:(0,Z.jsx)(QI,{}),size:`sm`,onClick:o})]})}function D1({view:e,lastFolder:t,onOpen:n,onFolders:r,subfolders:i,onOpenSubfolder:a}){return(0,Z.jsxs)(`div`,{className:`prints-library-bar`,children:[(0,Z.jsx)(zJ,{className:`prints-folders-button`,density:`compact`,label:null,"aria-label":`Folders`,title:`Folders`,icon:(0,Z.jsx)(LI,{size:16}),onClick:r}),(0,Z.jsx)(x1,{className:`prints-view-switch`,value:e.kind,onValueChange:e=>{n(e===`all`||e===`favorites`?{kind:e}:{kind:`folder`,folder:t})},children:(0,Z.jsxs)(C1,{variant:`segmented`,"aria-label":`View`,children:[(0,Z.jsx)(w1,{value:`folder`,children:`Folder`}),(0,Z.jsx)(w1,{value:`all`,children:`All`}),(0,Z.jsx)(w1,{value:`favorites`,children:`Favorites`})]})}),i.length>0?(0,Z.jsx)(`div`,{className:`prints-folder-chips`,role:`list`,"aria-label":`Folders`,children:i.map(e=>(0,Z.jsx)(zJ,{role:`listitem`,density:`compact`,className:`prints-folder-chip`,icon:(0,Z.jsx)(RI,{size:16}),label:e,onClick:()=>{a(e)}},e))}):null]})}var O1={conflict:`a file or folder with that name is already there`,not_found:`it is no longer in the library`,invalid:`a folder can't move into itself`,not_granted:`Prints isn't allowed to change this Computer`,unavailable:`the Computer didn't answer`};function k1(e,t,n,r){let{moved:i,failed:a}=n;if(a.length>0){let e=a[0];sI.error(`Couldn't move ${String(a.length)} ${a.length===1?`item`:`items`}: ${O1[e.error]}.`,{toasterId:T1,id:`prints-move-error`})}i.length!==0&&sI(`Moved ${String(i.length)} ${i.length===1?`item`:`items`}`,{toasterId:T1,duration:8e3,action:{label:`Undo`,onClick:()=>{let n=new Map;for(let{from:e,to:r}of i){let i=WH(t,e)??``;n.set(i,[...n.get(i)??[],r])}Promise.all([...n].map(([t,n])=>eU(e,{paths:n,folder:t===``?void 0:t}))).then(()=>{r()},e=>{oW(`prints-undo-move`,e),sI.error(`Couldn't undo that move.`,{toasterId:T1}),r()})}}})}var A1=24,j1=`prints-generation-notices`;function M1(e,t){let[n,r]=(0,G.useState)({entries:[],index:-1}),i=(e,t)=>e.kind===t.kind&&(e.kind!==`folder`||t.kind===`folder`&&e.folder===t.folder),a=n=>{r(t=>{let r=t.entries[t.index]??e;if(i(r,n))return t;let a=t.entries.slice(0,t.index+1),o=a.length===0?[e]:a;return{entries:[...o,n],index:o.length}}),t(n)},o=e=>{let i=n.index+e;if(i<0||i>=n.entries.length)return!1;let a=n.entries[i];return r({...n,index:i}),t(a),!0};return{open:a,canGoBack:n.index>0,canGoForward:n.index>=0&&n.index<n.entries.length-1,back:()=>o(-1),forward:()=>o(1)}}function N1({app:e,destination:t,view:n,setView:r,entries:i,canWrite:a}){let o=vC(),s=M1(n,r),[c,l]=(0,G.useState)(0),[u,d]=(0,G.useState)(),f=n.kind===`folder`?n.folder:void 0,p=n.kind===`folder`;(0,G.useEffect)(()=>{p&&d(f)},[p,f]);let[m,h]=(0,G.useState)(!1),[g,_]=(0,G.useState)(new Set),[v,y]=(0,G.useState)(null),[b,x]=(0,G.useState)(null),[S,C]=(0,G.useState)(new Map),w=e?.capabilities.has(iP)===!0,T=Vw({queries:(0,G.useMemo)(()=>{let e=i.map(e=>e.path),t=[];for(let n=0;n<e.length;n+=A1)t.push(e.slice(n,n+A1));return t},[i]).map(n=>({...nP(e,iP,sU.described(e,n),async(t,r)=>{if(!e)return[];let i=await tU(e,n);return r.throwIfAborted(),i}),enabled:w&&t!==null,retry:!1})),combine:e=>{let t=new Map;for(let n of e)for(let e of n.data??[])t.set(e.path,e);return t}}),E=(0,G.useCallback)(()=>{l(e=>e+1),_(new Set),o.invalidateQueries({queryKey:sU.listings(e)}),o.invalidateQueries({queryKey:sU.describedAll(e)})},[e,o]),D=(0,G.useCallback)(async(n,r,i={})=>{if(!(!e||t===null)){try{k1(e,t,await eU(e,{paths:n,folder:r,createFolder:i.create??!1,name:i.name}),E)}catch(e){oW(`prints-move-files`,e),sI.error(`Couldn't move those. Check the Computer and try again.`,{toasterId:j1,id:`prints-move-error`})}E()}},[e,t,E]),O=(0,G.useCallback)((t,r)=>{e&&(C(e=>{let n=new Map(e);for(let e of t)n.set(e,r);return n}),nU(e,t,r).then(()=>{o.invalidateQueries({queryKey:sU.describedAll(e)}),n.kind===`favorites`&&o.invalidateQueries({queryKey:sU.listings(e)})},e=>{oW(`prints-set-favorite`,e),sI.error(`Couldn't change that favorite.`,{toasterId:j1,id:`prints-favorite-error`}),C(e=>{let n=new Map(e);for(let e of t)n.delete(e);return n})}))},[e,o,n.kind]),k=(0,G.useCallback)(async(n,r)=>{if(!e||t===null)return`Choose a library folder first.`;let i=r.trim();if(!HH(i)||i.includes(`/`))return`Use a single name, without slashes.`;let a=n===void 0?i:`${n}/${i}`;if(!HH(a))return`That folder name is too long.`;try{await e.capabilities.require(BF).mkdir({path:UH(t,a)})}catch(e){return oW(`prints-new-folder`,e),`Couldn't create the folder. Check Computer write access.`}return E(),s.open({kind:`folder`,folder:a}),null},[e,t,s,E]),A=(0,G.useMemo)(()=>n.kind===`folder`?[{id:``,label:t?.split(`/`).at(-1)??`Library`},...GH(n.folder).map(({name:e,folder:t})=>({id:t,label:e}))].slice(-8):[{id:n.kind,label:n.kind===`all`?`All prints`:`Favorites`}],[t,n]),j=e=>S.get(e)??T.get(e)?.favorite??!1,M=e=>{if(t===null||!e.path.startsWith(`${t}/`))return e;let r=T.get(e.path),o=S.get(e.path)??r?.favorite??!1,s=i.find(t=>t.path===e.path),c={...e,badge:void 0,folderCaption:n.kind===`folder`?void 0:s?.folder,favorite:o,select:{active:m,checked:g.has(e.path),onToggle:()=>{_(t=>{let n=new Set(t);return n.has(e.path)?n.delete(e.path):n.add(e.path),n})}}};return!e.pending&&r!==void 0&&(c.badge=r.kind===null?{label:null,seconds:null}:{label:r.modelLabel??r.model,seconds:r.durationSeconds}),w&&(c.onToggleFavorite=()=>{O([e.path],!o)}),w&&a&&(c.onMove=()=>{y([e.path])}),c},N=n.kind===`all`?`All prints`:n.kind===`favorites`?`Favorites`:n.folder?.split(`/`).at(-1)??`Library`,P=n.kind===`folder`&&n.folder!==void 0?n.folder.split(`/`).slice(0,-1).join(`/`):null;return{title:N,up:P===null?void 0:()=>{s.open({kind:`folder`,folder:P===``?void 0:P})},lastFolder:u,history:s,version:c,refresh:E,crumbs:A,selecting:m,setSelecting:e=>{h(e),e||_(new Set)},selected:g,selectAll:e=>{_(new Set(e))},moving:v,setMoving:y,newFolder:b,setNewFolder:x,move:D,toggleFavorite:O,createFolder:k,enrich:M,isFavorite:j,folderOf:WH}}function P1(e,t){return{kind:`button`,id:`folder`,text:t.checking?`Checking…`:`prints`,icon:`folder`,title:e===null?`Choose where Prints saves images`:AE(`Save prints to ${e}`,1024),opens:`dialog`,expanded:t.editing}}var F1=`modulepreload`,I1=function(e,t){return new URL(e,t).href},L1={},R1=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=I1(t,n),t=s(t),t in L1)return;L1[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`:F1,r||(i.as=`script`),i.crossOrigin=``,i.href=t,a&&i.setAttribute(`nonce`,a),document.head.appendChild(i),r)return new Promise((e,n)=>{i.addEventListener(`load`,e),i.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})};function z1(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 B1(e){let t=new Map;for(let n of e.bindings)t.set(n.commandId,[...t.get(n.commandId)??[],z1(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 V1(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 H1(e,t,n,r){return e.map(e=>({entry:e,match:V1(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 U1=[`help`,`login`,`model`];function W1(e,t,n={}){if(!t.startsWith(`/`)||t.includes(`
85
- `))return{kind:`none`};let r=t.search(/\s/u);if(r<0){let r=t.slice(1);return{kind:`commands`,query:r,items:H1(e.filter(e=>e.availability.status===`available`&&(r.length===0?e.category===(n.idleCategory??`Conversation`)||U1.includes(e.alias):e.category!==`Advanced`||e.alias.toLocaleLowerCase().startsWith(r.toLocaleLowerCase()))),e=>e.alias,r,e=>{let t=U1.indexOf(e.alias);return r.length===0&&t>=0?t-U1.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 G1=(0,G.forwardRef)(function({className:e,count:t,density:n=`row`,dismissAriaLabel:r,dismissLabel:i=`Dismiss`,message:a,onDismiss:o,onRetry:s,retryAriaLabel:c,retryLabel:l=`Retry`,role:u=`status`,...d},f){return(0,Z.jsxs)(`div`,{...d,className:Q(`caps-failure-line`,e),"data-density":n,ref:f,role:u,children:[(0,Z.jsx)(SH,{glyph:`dot`,tone:`error`}),(0,Z.jsxs)(`span`,{className:`caps-failure-line-copy`,children:[(0,Z.jsx)(`span`,{children:a}),t!==void 0&&t>1?(0,Z.jsxs)(`span`,{className:`caps-failure-line-count`,children:[`Failed `,t,` times`]}):null]}),s||o?(0,Z.jsxs)(`span`,{className:`caps-failure-line-actions`,children:[s?(0,Z.jsx)(kJ,{"aria-label":c,size:`sm`,variant:`outline`,onClick:s,children:l}):null,o?(0,Z.jsx)(kJ,{"aria-label":r,size:`sm`,variant:`ghost`,onClick:o,children:i}):null]}):null]})}),K1=G.createContext(void 0);function q1(e=!1){let t=G.useContext(K1);if(t===void 0&&!e)throw Error(nY(16));return t}function J1(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:G.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 Y1(e,t,{detail:n=0,pointerType:r=``}={}){e.dispatchEvent(new(iX(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 X1(e={}){let{disabled:t=!1,focusableWhenDisabled:n,tabIndex:r=0,native:i=!0,composite:a}=e,o=G.useRef(null),s=q1(!0),c=a??s!==void 0,{props:l}=J1({focusableWhenDisabled:n,disabled:t,composite:c,tabIndex:r,isNativeButton:i}),u=G.useCallback(()=>{let e=o.current;Z1(e)&&c&&t&&l.disabled===void 0&&e.disabled&&(e.disabled=!1)},[t,l.disabled,c]);return $(u,[u]),{getButtonProps:G.useCallback((e={})=>{let{onClick:n,onMouseDown:r,onKeyUp:a,onKeyDown:o,onPointerDown:s,...u}=e;return yY({onClick(e){if(t){e.preventDefault();return}n?.(e)},onMouseDown(e){t||r?.(e)},onKeyDown(e){if(t||(kY(e),o?.(e),e.baseUIHandlerPrevented))return;let n=e.target===e.currentTarget,r=e.currentTarget,a=Z1(r),s=!i&&Q1(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(),Y1(r,e));return}if(!l||i||!d&&!u){n&&s&&d&&e.preventDefault();return}e.defaultPrevented||(e.preventDefault(),u&&(e.preventBaseUIHandler(),Y1(r,e)))},onKeyUp(e){if(!t){if(kY(e),a?.(e),e.target===e.currentTarget&&i&&c&&Z1(e.currentTarget)&&e.key===` `){e.preventDefault();return}e.baseUIHandlerPrevented||e.target===e.currentTarget&&!i&&!c&&!e.defaultPrevented&&e.key===` `&&(e.preventBaseUIHandler(),Y1(e.currentTarget,e))}},onPointerDown(e){if(t){e.preventDefault();return}s?.(e)}},i?{type:`button`}:{role:`button`},l,u)},[t,l,c,i]),buttonRef:GJ(e=>{o.current=e,u()})}}function Z1(e){return cX(e)&&e.tagName===`BUTTON`}function Q1(e){return cX(e)&&e.tagName===`A`&&!!e.href}function $1(e,t,n,r){let i=!1,a=!1,o=r??XJ;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 e0(e,t,n){let r=n??XJ;return{reason:e,event:t??new Event(`base-ui`),...r}}var t0=`none`,n0=`trigger-press`,r0=`trigger-hover`,i0=`trigger-focus`,a0=`outside-press`,o0=`item-press`,s0=`close-press`,c0=`focus-out`,l0=`escape-key`,u0=`list-navigation`,d0=`keyboard`,f0=`pointer`,p0=`cancel-open`,m0=`sibling-open`,h0=`imperative-action`;function g0(e,t){return t!=null&&!NZ(t)?0:typeof e==`function`?e():e}function _0(e,t,n){let r=g0(e,n);return typeof r==`number`?r:r?.[t]}function v0(e){return typeof e==`function`?e():e}function y0(e,t){return t||e===`click`||e===`mousedown`}function b0(e){return e?.includes(`mouse`)&&e!==`mousedown`}function x0(...e){return()=>{for(let t=0;t<e.length;t+=1){let n=e[t];n&&n()}}}function S0(e){let t=HJ(C0,e).current;return t.next=e,$(t.effect),t}function C0(e){let t={current:e,next:e,effect:()=>{t.current=t.next}};return t}var w0=null;globalThis.requestAnimationFrame;var T0=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)}},E0=class e{static create(){return new e}static request(e){return T0.request(e)}static cancel(e){return T0.cancel(e)}currentId=w0;request(e){this.cancel(),this.currentId=T0.request(()=>{this.currentId=w0,e()})}cancel=()=>{this.currentId!==w0&&(T0.cancel(this.currentId),this.currentId=w0)};disposeEffect=()=>this.cancel};function D0(){let e=HJ(E0.create).current;return ZJ(e.disposeEffect),e}var O0={clipPath:`inset(50%)`,overflow:`hidden`,whiteSpace:`nowrap`,border:0,padding:0,width:1,height:1,margin:-1},k0={...O0,position:`fixed`,margin:0,top:0,left:0};({...O0});var A0=G.forwardRef(function(e,t){let[n,r]=G.useState();$(()=>{zX&&RX&&r(`button`)},[]);let i={tabIndex:0,role:n};return(0,Z.jsx)(`span`,{...e,ref:t,style:k0,"aria-hidden":!n||void 0,...i,"data-base-ui-focus-guard":``})});function j0(e){return`data-base-ui-${e}`}var M0=0;function N0(e,t={}){let{preventScroll:n=!1,sync:r=!1,shouldFocus:i}=t;cancelAnimationFrame(M0);function a(){i&&!i()||e?.focus({preventScroll:n})}if(r)return a(),JJ;let o=requestAnimationFrame(a);return M0=o,()=>{M0===o&&(cancelAnimationFrame(o),M0=0)}}var P0=`data-base-ui-inert`,F0=new WeakMap,I0=new WeakSet,L0=new WeakMap,R0=0;function z0(e){return e?lX(e)?e.host:z0(e.parentNode):null}var B0=(e,t)=>t.map(t=>{if(e.contains(t))return t;let n=z0(t);return e.contains(n)?n:null}).filter(e=>e!=null),V0=e=>{let t=new Set;return e.forEach(e=>{let n=e;for(;n&&!t.has(n);)t.add(n),n=n.parentNode}),t},H0=(e,t,n)=>{let r=[],i=e=>{!e||n.has(e)||Array.from(e.children).forEach(e=>{rX(e)!==`script`&&(t.has(e)?i(e):r.push(e))})};return i(e),r};function U0(e,t,n,{mark:r=!0}){let i=B0(t,e),a=r?H0(t,V0(i),new Set(i)):[],o=[],s=[];if(n){let e=B0(t,Array.from(t.querySelectorAll(`[aria-live]`))),n=i.concat(e);H0(t,V0(n),new Set(n)).forEach(e=>{let t=e.getAttribute(`aria-hidden`),n=t!==null&&t!==`false`,r=(F0.get(e)||0)+1;F0.set(e,r),o.push(e),r===1&&n&&I0.add(e),n||e.setAttribute(`aria-hidden`,`true`)})}return r&&a.forEach(e=>{let t=(L0.get(e)||0)+1;L0.set(e,t),s.push(e),t===1&&e.setAttribute(P0,``)}),R0+=1,()=>{o.forEach(e=>{let t=(F0.get(e)||0)-1;F0.set(e,t),t||(I0.has(e)||e.removeAttribute(`aria-hidden`),I0.delete(e))}),r&&s.forEach(e=>{let t=(L0.get(e)||0)-1;L0.set(e,t),t||e.removeAttribute(P0)}),--R0,R0||(F0=new WeakMap,I0=new WeakSet,L0=new WeakMap)}}function W0(e,t={}){let{ariaHidden:n=!1,mark:r=!0}=t,i=gQ(e[0]).body;return U0(e,i,n,{mark:r})}var G0={style:{transition:`none`}},K0=`data-base-ui-click-trigger`,q0={fallbackAxisSide:`none`},J0={fallbackAxisSide:`end`},Y0={clipPath:`inset(50%)`,position:`fixed`,top:0,left:0},X0=G.createContext(null),Z0=()=>G.useContext(X0),Q0=j0(`portal`);function $0(e={}){let{ref:t,container:n,componentProps:r=XJ,elementProps:i}=e,a=KY(),o=Z0()?.portalNode,[s,c]=G.useState(null),[l,u]=G.useState(null),d=GJ(e=>{e!==null&&u(e)}),f=G.useRef(null);$(()=>{if(n===null){f.current&&(f.current=null,u(null),c(null));return}let e=(n&&(oX(n)?n:n.current))??o??document.body;if(e==null){f.current&&(f.current=null,u(null),c(null));return}f.current!==e&&(f.current=e,u(null),c(e))},[n,o]);let p=MY(`div`,r,{ref:[t,d],props:[{id:a,[Q0]:``},i]}),m=s&&p?WF.createPortal(p,s):null;return{node:l,nodeId:G.isValidElement(p)?p.props.id:void 0,subtree:m}}var e2=G.forwardRef(function(e,t){let{render:n,className:r,style:i,children:a,container:o,portalOwnerRole:s,...c}=e,{node:l,nodeId:u,subtree:d}=$0({container:o,ref:t,componentProps:e,elementProps:c}),f=G.useRef(null),p=G.useRef(null),m=G.useRef(null),h=G.useRef(null),[g,_]=G.useState(null),v=G.useRef(!1),y=g?.modal,b=g?.open,x=!!g&&!g.modal&&g.open&&!!l;G.useEffect(()=>{if(!l||y)return;function e(e){l&&e.relatedTarget&&LQ(e)&&(e.type===`focusin`?v.current&&=(zQ(l),!1):(RQ(l),v.current=!0))}return x0(v$(l,`focusin`,e,!0),v$(l,`focusout`,e,!0))},[l,y]),$(()=>{!l||b!==!0||!v.current||(zQ(l),v.current=!1)},[b,l]);let S=G.useMemo(()=>({beforeOutsideRef:f,afterOutsideRef:p,beforeInsideRef:m,afterInsideRef:h,portalNode:l,setFocusManagerState:_}),[l]);return(0,Z.jsxs)(G.Fragment,{children:[d,(0,Z.jsxs)(X0.Provider,{value:S,children:[x&&l&&(0,Z.jsx)(A0,{"data-type":`outside`,ref:f,onFocus:e=>{LQ(e,l)?m.current?.focus():FQ(g?g.domReference:null)?.focus()}}),x&&l&&(0,Z.jsx)(`span`,{role:s,"aria-owns":u,style:Y0}),l&&WF.createPortal(a,l),x&&l&&(0,Z.jsx)(A0,{"data-type":`outside`,ref:p,onFocus:e=>{LQ(e,l)?h.current?.focus():(PQ(g?g.domReference:null)?.focus(),g?.closeOnFocusOut&&g?.onOpenChange(!1,$1(`focus-out`,e.nativeEvent)))}})]})]})});function t2(){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 n2=class{nodesRef={current:[]};events=t2();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)}},r2=G.createContext(null),i2=G.createContext(null),a2=()=>G.useContext(r2)?.id||null,o2=e=>{let t=G.useContext(i2);return e??t};function s2(e){let t=KY(),n=o2(e),r=a2();return $(()=>{if(!t)return;let e={id:t,parentId:r};return n?.addNode(e),()=>{n?.removeNode(e)}},[n,t,r]),t}function c2(e){let{children:t,id:n}=e,r=a2();return(0,Z.jsx)(r2.Provider,{value:G.useMemo(()=>({id:n,parentId:r}),[n,r]),children:t})}function l2(e){let{children:t,externalTree:n}=e,r=HJ(()=>n??new n2).current;return(0,Z.jsx)(i2.Provider,{value:r,children:t})}function u2(e){return e==null?e:`current`in e?e.current:e}function d2(e,t){let n=iX(WX(e));return e instanceof n.KeyboardEvent?`keyboard`:e instanceof n.FocusEvent?t||`keyboard`:`pointerType`in e?e.pointerType||(jZ(e)?`keyboard`:t||`mouse`):`touches`in e?`touch`:e instanceof n.MouseEvent?t||(e.detail===0?`keyboard`:`mouse`):``}var f2=20,p2=[];function m2(){p2=p2.filter(e=>e.deref()?.isConnected)}function h2(e){m2(),e&&rX(e)!==`body`&&(p2.push(new WeakRef(e)),p2.length>f2&&(p2=p2.slice(-20)))}function g2(){return m2(),p2[p2.length-1]?.deref()}function _2(e){return e?AQ(e)?e:MQ(e)[0]||e:null}function v2(e){if(e.hasAttribute(`tabindex`)&&!e.hasAttribute(`data-tabindex`)||!e.getAttribute(`role`)?.includes(`dialog`))return;let t=jQ(e).filter(e=>{let t=e.getAttribute(`data-tabindex`)||``;return AQ(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 y2(e){let{context:t,children:n,disabled:r=!1,initialFocus:i=!0,returnFocus:a=!0,explicitReturnFocus:o,restoreFocus:s=!1,modal:c=!0,closeOnFocusOut:l=!0,openInteractionType:u=``,nextFocusableElement:d,previousFocusableElement:f,beforeContentFocusGuardRef:p,externalTree:m,getInsideElements:h}=e,g=t.useState(`open`),_=t.useState(`domReferenceElement`),v=t.useState(`floatingElement`),{events:y,dataRef:b}=t.context,x=GJ(()=>b.current.floatingContext?.nodeId),S=i===!1,C=wZ(_)&&S,w=S0(i),T=S0(a),E=S0(o),D=S0(u),O=S0(g),k=o2(m),A=Z0(),j=G.useRef(!1),M=G.useRef(!1),N=G.useRef(!1),P=G.useRef(null),F=G.useRef(``),I=G.useRef(``),L=G.useRef(null),R=G.useRef(null),z=aY(L,p,A?.beforeInsideRef),ee=aY(R,A?.afterInsideRef),te=eY(),B=eY(),ne=D0(),re=A!=null,V=EZ(v),H=GJ((e=V)=>e?MQ(e):[]),ie=GJ(()=>h?.().filter(e=>e!=null)??[]);G.useEffect(()=>{if(r||!c)return;function e(e){e.key===`Tab`&&HX(V,VX(gQ(V)))&&H().length===0&&!C&&kZ(e)}return v$(gQ(V),`keydown`,e)},[r,V,c,C,H]),G.useEffect(()=>{if(r||!g)return;let e=gQ(V);function t(){N.current=!1}function n(e){let t=WX(e),n=ie(),r=HX(v,t)||HX(_,t)||HX(A?.portalNode,t)||n.some(e=>e===t||HX(e,t));N.current=!r,I.current=e.pointerType||`keyboard`,UX(t,`[data-base-ui-click-trigger]`)&&(M.current=!0,B.start(0,()=>{M.current=!1}))}function i(){I.current=`keyboard`}return x0(v$(e,`pointerdown`,n,!0),v$(e,`pointerup`,t,!0),v$(e,`pointercancel`,t,!0),v$(e,`keydown`,i,!0),t)},[r,v,_,V,g,A,B,ie]),G.useEffect(()=>{if(r||!l)return;let e=gQ(V);function n(){M.current=!0,B.start(0,()=>{M.current=!1})}function i(e){let t=WX(e);AQ(t)&&(P.current=t)}function a(n){let r=n.relatedTarget,i=n.currentTarget,a=WX(n);c&&r==null&&a!=null&&HX(v,a)&&h2(a),queueMicrotask(()=>{let o=x(),l=t.context.triggerElements,u=ie(),p=r?.hasAttribute(j0(`focus-guard`))&&[L.current,R.current,A?.beforeInsideRef.current,A?.afterInsideRef.current,A?.beforeOutsideRef.current,A?.afterOutsideRef.current,u2(f),u2(d)].includes(r),m=!(HX(_,r)||HX(v,r)||HX(r,v)||HX(A?.portalNode,r)||u.some(e=>e===r||HX(e,r))||l.hasMatchingElement(e=>HX(e,r))||p||k&&(DZ(k.nodesRef.current,o).find(e=>HX(e.context?.elements.floating,r)||HX(e.context?.elements.domReference,r))||OZ(k.nodesRef.current,o).find(e=>[e.context?.elements.floating,EZ(e.context?.elements.floating)].includes(r)||e.context?.elements.domReference===r)));if(i===_&&V&&v2(V),s&&i!==_&&!hQ(a)&&VX(e)===e.body){if(cX(V)&&(V.focus(),s===`popup`)){ne.request(()=>{V.focus()});return}let e=H(),t=P.current,n=(t&&e.includes(t)?t:null)||e[e.length-1]||V;cX(n)&&n.focus()}if(b.current.insideReactTree){b.current.insideReactTree=!1;return}(C||!c)&&r&&m&&!M.current&&(C||r!==g2())&&(j.current=!0,t.setOpen(!1,$1(c0,n)))})}function o(){N.current||(b.current.insideReactTree=!0,te.start(0,()=>{b.current.insideReactTree=!1}))}let u=cX(_)?_:null;if(!(!v&&!u))return x0(u&&v$(u,`focusout`,a),u&&v$(u,`pointerdown`,n),v&&v$(v,`focusin`,i),v&&v$(v,`focusout`,a),v&&A&&v$(v,`focusout`,o,!0))},[r,_,v,V,c,k,A,t,l,s,H,C,x,b,te,B,ne,d,f,ie]),G.useEffect(()=>{if(r||!v||!g)return;let e=Array.from(A?.portalNode?.querySelectorAll(`[${j0(`portal`)}]`)||[]),t=(k?OZ(k.nodesRef.current,x()):[]).find(e=>wZ(e.context?.elements.domReference||null))?.context?.elements.domReference,n=W0([v,...e,L.current,R.current,A?.beforeOutsideRef.current,A?.afterOutsideRef.current,...ie(),t,u2(f),u2(d),C?_:null].filter(e=>e!=null),{ariaHidden:c||C,mark:!1}),i=W0([v,...e].filter(e=>e!=null));return()=>{i(),n()}},[g,r,_,v,c,A,C,k,x,d,f,ie]),$(()=>{if(!g||r||!cX(V))return;F.current=``,I.current=``;let e=gQ(V),t=VX(e);queueMicrotask(()=>{let n=w.current,r=typeof n==`function`?n(D.current||``):n;if(r===void 0||r===!1||HX(V,t))return;let i=null,a=()=>(i??=H(V),i[0]||V),o;o=r===!0||r===null?a():u2(r),o||=a();let s=HX(V,VX(e)),c=b.current.openEvent,l=c?.type===`mousedown`&&jZ(c);N0(o,{sync:l,preventScroll:o===V,shouldFocus(){if(!O.current)return!1;if(s)return!0;let t=VX(e);return!(t!==o&&HX(V,t))}})})},[r,g,V,H,w,D,O,b]);let ae=G.useRef(null);$(()=>{if(r||!V){ae.current=null;return}ae.current&&=(ae.current.cancelled=!0,null);let e=gQ(V),t=VX(e),n=D.current==null;h2(t);function i(e){if(e.open||(F.current=d2(e.nativeEvent,I.current)),(e.reason===`focus-out`&&e.triggerElement?.hasAttribute(j0(`focus-guard`))||e.reason===`trigger-hover`&&e.nativeEvent.type===`mouseleave`)&&(j.current=!0),e.reason===`outside-press`){if(e.nested)j.current=!1;else if(jZ(e.nativeEvent)||MZ(e.nativeEvent))j.current=!1;else{let e=!1;gQ(V).createElement(`div`).focus({get preventScroll(){return e=!0,!1}}),e?j.current=!1:j.current=!0}}}y.on(`openchange`,i);function a(e){let r=T.current,i=typeof r==`function`?r(e):r;if(i===void 0||i===!1)return null;i===null&&(i=!0);let a=_?.isConnected?_:null,o=t?.isConnected&&rX(t)!==`body`?t:null,s=n?o||a:a||o;return s||=g2()||null,typeof i==`boolean`?s:u2(i)||s||null}return()=>{y.off(`openchange`,i);let t=VX(e),n=ie(),r=HX(v,t)||n.some(e=>e===t||HX(e,t))||k&&DZ(k.nodesRef.current,x(),!1).some(e=>HX(e.context?.elements.floating,t)),o=T.current,s=F.current,c=a(s),l={cancelled:!1};ae.current=l,queueMicrotask(()=>{ae.current===l&&(ae.current=null);let n=_2(c),i=E.current??typeof o!=`boolean`;if(!l.cancelled&&o&&!j.current&&cX(n)&&(!(!i&&n!==t&&t!==e.body)||r)){let e={preventScroll:!0};s===`keyboard`&&(e.focusVisible=!0),n.focus(e)}j.current=!1})}},[r,v,V,T,E,D,y,k,_,x,ie]),$(()=>{if(!RX||g||!v)return;let e=VX(gQ(v));!cX(e)||!SZ(e)||HX(v,e)&&e.blur()},[g,v]),$(()=>{if(!(r||!A))return A.setFocusManagerState({modal:c,closeOnFocusOut:l,open:g,onOpenChange:t.setOpen,domReference:_}),()=>{A.setFocusManagerState(null)}},[r,A,c,g,t,l,_]),$(()=>{if(!(r||!V))return v2(V),()=>{queueMicrotask(m2)}},[r,V]);let oe=!r&&(!c||!C)&&(re||c);return(0,Z.jsxs)(G.Fragment,{children:[oe&&(0,Z.jsx)(A0,{"data-type":`inside`,ref:z,onFocus:e=>{if(c){let e=H();N0(e[e.length-1])}else A?.portalNode&&(j.current=!1,LQ(e,A.portalNode)?PQ(_)?.focus():u2(f??A.beforeOutsideRef)?.focus())}}),n,oe&&(0,Z.jsx)(A0,{"data-type":`inside`,ref:ee,onFocus:e=>{c?N0(H()[0]):A?.portalNode&&(l&&(j.current=!0),LQ(e,A.portalNode)?FQ(_)?.focus():u2(d??A.afterOutsideRef)?.focus())}})]})}function b2(e,t={}){let{enabled:n=!0,event:r=`click`,toggle:i=!0,ignoreMouse:a=!1,stickIfOpen:o=!0,touchOpenDelay:s=0,reason:c=n0}=t,l=e.context.dataRef,u=G.useRef(void 0),d=D0(),f=eY(),p=G.useMemo(()=>{function t(t,n,r,i){let a=$1(c,n,r);t&&i===`touch`&&s>0?f.start(s,()=>{e.setOpen(!0,a)}):e.setOpen(t,a)}function n(t,n,r){let a=l.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){u.current=NZ(e.pointerType,!0)&&MZ(e.nativeEvent)?`virtual`:e.pointerType},onMouseDown(i){let o=u.current,s=i.nativeEvent,c=e.select(`open`);if(i.button!==0||r===`click`||NZ(o,!0)&&a)return;let l=n(c,i.currentTarget,e=>e===`click`||e===`mousedown`),f=WX(s),p=SZ(f);if(p||o===`virtual`){t(l,s,p?f:i.currentTarget,o);return}let m=i.currentTarget;d.request(()=>{t(l,s,m,o)})},onClick(i){if(r===`mousedown-only`)return;let o=u.current;if(r===`mousedown`&&o){u.current=void 0;return}NZ(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(){u.current=void 0}}},[l,r,a,c,e,o,i,d,f,s]);return G.useMemo(()=>n?{reference:p}:XJ,[n,p])}function x2(){return!1}function S2(e){return{escapeKey:typeof e==`boolean`?e:e?.escapeKey??!1,outsidePress:typeof e==`boolean`?e:e?.outsidePress??!0}}function C2(e,t={}){let{enabled:n=!0,escapeKey:r=!0,outsidePress:i=!0,outsidePressEvent:a=`sloppy`,referencePress:o=x2,bubbles:s,externalTree:c}=t,l=e.useState(`open`),u=e.useState(`floatingElement`),{dataRef:d,events:f}=e.context,p=o2(c),m=GJ(typeof i==`function`?i:()=>!1),h=typeof i==`function`?m:i,g=h!==!1,_=GJ(()=>a),{escapeKey:v,outsidePress:y}=S2(s),b=G.useRef(!1),x=G.useRef(!1),S=G.useRef(!1),C=G.useRef(!1),w=G.useRef(!1),T=G.useRef(``),E=G.useRef(null),D=eY(),O=eY(),k=eY(),A=GJ(()=>{O.clear(),d.current.insideReactTree=!1}),j=GJ(e=>{let t=d.current.floatingContext?.nodeId;return(p?DZ(p.nodesRef.current,t):[]).some(t=>t.context?.open&&!t.context.dataRef.current[e])}),M=GJ(t=>bZ(t,e.select(`floatingElement`))||bZ(t,e.select(`domReferenceElement`))),N=GJ(t=>{o()&&e.setOpen(!1,$1(n0,t.nativeEvent))}),P=GJ(t=>{if(!l||!n||!r||t.key!==`Escape`)return;let i=AZ(t)?t.nativeEvent:t;if(w.current||i.isComposing||!v&&j(`__escapeKeyBubbles`))return;let a=$1(l0,i);e.setOpen(!1,a),a.isCanceled||t.preventDefault(),!v&&!a.isPropagationAllowed&&t.stopPropagation()}),F=GJ(()=>{d.current.insideReactTree=!0,O.start(0,A)}),I=GJ(t=>{if(!l||!n||t.button!==0)return;let r=WX(t.nativeEvent);HX(e.select(`floatingElement`),r)&&(b.current||(b.current=!0,x.current=!1))}),L=GJ(e=>{!l||!n||(e.defaultPrevented||e.nativeEvent.defaultPrevented)&&b.current&&(x.current=!0)});G.useEffect(()=>{function e(e){e.open||(C.current=!1)}return f.on(`openchange`,e),()=>{f.off(`openchange`,e)}},[f]),G.useEffect(()=>A,[A]),G.useEffect(()=>{if(!l||!n)return l||(C.current=!1,w.current=!1,T.current=``,E.current=null),A;d.current.__escapeKeyBubbles=v,d.current.__outsidePressBubbles=y;let t=new $J,i=gQ(u);function a(){k.clear(),w.current=!0}function o(){w.current=!0,k.start(RX?5:0,()=>{w.current=!1})}function s(){S.current=!0,t.start(0,()=>{S.current=!1})}function c(){b.current=!1,x.current=!1}function f(){let e=T.current,t=e===`pen`||!e?`mouse`:e,n=_(),r=typeof n==`function`?n():n;return typeof r==`string`?r:r[t]}function m(e){let t=f();return t===`intentional`&&e.type!==`click`||t===`sloppy`&&e.type===`click`}function O(e){let t=d.current.floatingContext?.nodeId,n=p&&DZ(p.nodesRef.current,t).some(t=>bZ(e,t.context?.elements.floating));return M(e)||n}function N(n){if(m(n)){n.type!==`click`&&!M(n)&&(t.clear(),S.current=!1),A();return}if(d.current.insideReactTree){A();return}let r=WX(n),i=`[${j0(`inert`)}]`,a=sX(r)?r.getRootNode():null,o=Array.from((lX(a)?a:gQ(e.select(`floatingElement`))).querySelectorAll(i)),s=e.context.triggerElements;if(r&&(s.hasElement(r)||s.hasMatchingElement(e=>HX(e,r))))return;let c=sX(r)?r:null;for(;c&&!bX(c);){let e=CX(c);if(bX(e)||!sX(e))break;c=e}if(!(o.length&&sX(r)&&!xZ(r)&&!HX(r,e.select(`floatingElement`))&&o.every(e=>!HX(c,e)))){if(cX(r)&&!(`touches`in n)){let e=bX(r),t=xX(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(!O(n)){if(f()===`intentional`){if(n.detail!==0&&!jZ(n)&&!C.current)return;if(S.current){t.clear(),S.current=!1;return}}typeof h==`function`&&!h(n)||j(`__outsidePressBubbles`)||(e.setOpen(!1,$1(a0,n)),A())}}}function F(t){f()!==`sloppy`||t.pointerType===`touch`||!e.select(`open`)||!n||M(t)||N(t)}function I(t){if(f()!==`sloppy`||!e.select(`open`)||!n||M(t))return;let r=t.touches[0];r&&(E.current={startTime:Date.now(),startX:r.clientX,startY:r.clientY,dismissOnTouchEnd:!1,dismissOnMouseDown:!0},D.start(1e3,()=>{E.current&&(E.current.dismissOnTouchEnd=!1,E.current.dismissOnMouseDown=!1)}))}function L(e,t){let n=WX(e);if(!n)return;let r=v$(n,e.type,()=>{t(e),r()})}function R(e){T.current=`touch`,L(e,I)}function z(e){D.clear(),e.type===`pointerdown`&&(e.button===0&&(C.current=!0),T.current=e.pointerType),!(e.type===`mousedown`&&E.current&&!E.current.dismissOnMouseDown)&&L(e,e=>{e.type===`pointerdown`?F(e):N(e)})}function ee(e){if(e.type===`pointercancel`&&(C.current=!1),!b.current)return;let n=x.current;if(c(),f()===`intentional`){if(e.type===`pointercancel`){n&&s();return}if(!O(e)){if(n){s();return}typeof h==`function`&&!h(e)||(t.clear(),S.current=!0,A())}}}function te(e){if(f()!==`sloppy`||!E.current||M(e))return;let t=e.touches[0];if(!t)return;let n=Math.abs(t.clientX-E.current.startX),r=Math.abs(t.clientY-E.current.startY),i=Math.sqrt(n*n+r*r);i>5&&(E.current.dismissOnTouchEnd=!0),i>10&&(N(e),D.clear(),E.current=null)}function B(e){L(e,te)}function ne(e){f()!==`sloppy`||!E.current||M(e)||(E.current.dismissOnTouchEnd&&N(e),D.clear(),E.current=null)}function re(e){L(e,ne)}let V=x0(r&&x0(v$(i,`keydown`,P),v$(i,`compositionstart`,a),v$(i,`compositionend`,o)),g&&x0(v$(i,`click`,z,!0),v$(i,`pointerdown`,z,!0),v$(i,`pointerup`,ee,!0),v$(i,`pointercancel`,ee,!0),v$(i,`mousedown`,z,!0),v$(i,`mouseup`,ee,!0),v$(i,`touchstart`,R,{capture:!0,passive:!0}),v$(i,`touchmove`,B,{capture:!0,passive:!0}),v$(i,`touchend`,re,{capture:!0,passive:!0})));return()=>{V(),t.clear(),c(),S.current=!1}},[d,u,r,g,h,l,n,v,y,P,A,_,j,M,p,e,D,k]);let R=G.useMemo(()=>({onKeyDown:P,onPointerDown:N,onClick:N}),[P,N]),z=G.useMemo(()=>({onKeyDown:P,onPointerDown:L,onMouseDown:L,onClickCapture:F,onMouseDownCapture(e){F(),I(e)},onPointerDownCapture(e){F(),I(e)},onMouseUpCapture:F,onTouchEndCapture:F,onTouchMoveCapture:F}),[P,F,I,L]);return G.useMemo(()=>n?{reference:R,floating:z,trigger:R}:{},[n,R,z])}function w2(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),$(()=>{let e={open:s,floatingId:i,referenceElement:c,floatingElement:l};sX(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 T2(e,t=!1,n=!1,r=!1){let[i,a]=G.useState(e&&t?`idle`:void 0),[o,s]=G.useState(e&&!r);return e&&!o&&(s(!0),a(`starting`)),!e&&o&&i!==`ending`&&!n&&a(`ending`),!e&&!o&&i===`ending`&&a(void 0),$(()=>{if(!e&&o&&i!==`ending`&&n){let e=E0.request(()=>{a(`ending`)});return()=>{E0.cancel(e)}}},[e,o,i,n]),$(()=>{if(!e||t||i===void 0)return;let n=E0.request(()=>{a(void 0)});return()=>{E0.cancel(n)}},[t,e,i]),$(()=>{if(!e||!t)return;e&&o&&i!==`idle`&&a(`starting`);let n=E0.request(()=>{a(`idle`)});return()=>{E0.cancel(n)}},[t,e,o,i]),{mounted:o,setMounted:s,transitionStatus:i}}var E2=null;function D2(e){if(!E2){let e=[];E2=e,queueMicrotask(()=>{E2=null,WF.flushSync(()=>{for(let t of e)t()})})}E2.push(e)}function O2(e,t=!1,n=!1){let r=D0();return GJ((i,a=null)=>{r.cancel();let o=u2(e);if(o==null)return;let s=o,c=()=>{if(!n){WF.flushSync(i);return}D2(()=>{a?.aborted||i()})};if(typeof s.getAnimations!=`function`||globalThis.BASE_UI_ANIMATIONS_DISABLED){i();return}function l(){Promise.all(i$(s).map(e=>e.finished.then(JJ))).then(()=>{a?.aborted||c()},()=>{if(!a?.aborted){if(i$(s).some(e=>e.pending||e.playState!==`finished`)){l();return}c()}})}if(t){let e=ZX;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 k2(e){let{enabled:t=!0,open:n,ref:r,batch:i=!1,onComplete:a}=e,o=GJ(a),s=O2(r,n,i);G.useEffect(()=>{if(!t)return;let e=new AbortController;return s(o,e.signal),()=>{e.abort()}},[t,n,o,s])}function A2(e){let{open:t,ref:n,preventUnmountOnClose:r,setPreventUnmountOnClose:i,onUnmount:a,animateInitialOpen:o}=e,s=GJ(i),{mounted:c,setMounted:l,transitionStatus:u}=T2(t,!1,!1,o),d=!t&&r;$(()=>{t&&s(!1)},[t,s]);let f=G.useRef(c),p=G.useRef(!1),m=HY(),h=()=>{f.current=!1,l(!1),a()};$(()=>{f.current=c,p.current&&(p.current=!1,!t&&c&&h())});let g=GJ(()=>{if(f.current){if(t){p.current=!0,m();return}h()}});return k2({enabled:c&&!t&&!d,open:t,ref:n,onComplete(){t||g()}}),{mounted:c,transitionStatus:u,preventUnmountingOnClose:d,forceUnmount:g}}var j2={tabIndex:-1,[GX]:``};function M2(e){return t=>t!==`touch`||e.current}function N2(e,t=!1){let n=KY(),r=a2()!=null,i=HJ(()=>e(n,r)).current;return w2({popupStore:i,treatPopupAsFloatingElement:t,floatingRootContext:i.state.floatingRootContext,floatingId:n,nested:r,onOpenChange:i.setOpen}),i}function P2({handle:e,store:t}){return $(()=>e.attachStore(t),[e,t]),null}function F2(e){let t=e.context.triggerElements.size;e.select(`open`)&&e.state.triggerCount!==t&&e.set(`triggerCount`,t)}function I2(e,t){let n=G.useRef(null);return GJ(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),F2(a))}r!==null&&e!==void 0&&(n.current={store:t,id:e,element:r},t.context.triggerElements.add(e,r),F2(t))})}function L2(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 R2(e){let t=!1;return e.preventUnmountOnClose=()=>{t=!0},()=>t}function z2(e,t,n,r){let i=n.useState(`isMountedByTrigger`,e),a=I2(e,n),o=GJ(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=GJ(e=>{a(e),e&&o(e)});return $(()=>(s(t.current),()=>s(null)),[s,t,n,e]),$(()=>{if(i){let e={activeTriggerElement:t.current,...r};n.update(e)}},[i,n,t,...Object.values(r)]),{registerTrigger:s,isMountedByThisTrigger:i}}function B2(e,t={}){let{closeOnActiveTriggerUnmount:n=!1}=t,r=G.useRef(null),i=e.useState(`open`);$(()=>{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=$1(t0);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 V2(e,t,n,r){let{mounted:i,transitionStatus:a,forceUnmount:o}=A2({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 HJ(()=>(t.set(`mounted`,i),null)),t.useSyncedValues({mounted:i,transitionStatus:a}),{forceUnmount:o,transitionStatus:a}}function H2(e,t){e.useSyncedValues(t),$(()=>()=>{e.update({activeTriggerProps:XJ,inactiveTriggerProps:XJ,popupProps:XJ})},[e])}function U2(e,t){$(()=>{!t&&e.state.openMethod!==null&&e.set(`openMethod`,null)},[t,e]),$(()=>()=>{e.state.openMethod!==null&&e.set(`openMethod`,null)},[e])}var W2=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}},G2=[],K2=void 0;function q2(){return K2}function J2(e){G2.push(e)}function Y2(e){let t=(t,n)=>{let r=HJ(Z2).current,i;try{K2=r;for(let e of G2)e.before(r);i=e(t,n);for(let e of G2)e.after(r);r.didInitialize=!0}finally{K2=void 0}return i};return t.displayName=e.displayName||e.name,t}function X2(e){return G.forwardRef(Y2(e))}function Z2(){return{didInitialize:!1}}var Q2=fJ(),$2=fY(19)?n4:r4;function e4(e,t,n,r,i){return $2(e,t,n,r,i)}function t4(e,t,n,r,i){let a=G.useCallback(()=>t(e.getSnapshot(),n,r,i),[e,t,n,r,i]);return(0,Q2.useSyncExternalStore)(e.subscribe,a,a)}J2({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,Q2.useSyncExternalStore)(e.subscribe,e.getSnapshot,e.getSnapshot))}});function n4(e,t,n,r,i){let a=q2();if(!a)return t4(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 r4(e,t,n,r,i){return(0,mJ.useSyncExternalStoreWithSelector)(e.subscribe,e.getSnapshot,e.getSnapshot,e=>t(e,n,r,i))}var i4=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 e4(this,e,t,n,r)}},a4=class extends i4{constructor(e,t={},n){super(e),this.context=t,this.selectors=n}useSyncedValue(e,t){G.useDebugValue(e);let n=this;$(()=>{n.state[e]!==t&&n.set(e,t)},[n,e,t])}useSyncedValueWithCleanup(e,t){let n=this;$(()=>(n.state[e]!==t&&n.set(e,t),()=>{n.set(e,void 0)}),[n,e,t])}useSyncedValues(e){let t=this;$(()=>{t.update(e)},[t,...Object.values(e)])}useControlledProp(e,t){G.useDebugValue(e);let n=this,r=t!==void 0;$(()=>{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 G.useDebugValue(e),e4(this,this.selectors[e],t,n,r)}useContextCallback(e,t){G.useDebugValue(e);let n=GJ(t??JJ);this.context[e]=n}useStateSetter(e){let t=G.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)}})}},o4={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},s4=class extends a4{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:t2(),nested:n,triggerElements:i},o4),this.syncOnly=t}syncOpenEvent=(e,t)=>{(!e||!this.state.open||t!=null&&PZ(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 c4(e,t,n=!1){return{open:!1,openProp:void 0,mounted:!1,transitionStatus:void 0,floatingRootContext:new s4({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:XJ,inactiveTriggerProps:XJ,popupProps:XJ}}var l4=e=>e.triggerIdProp??e.activeTriggerId,u4=e=>e.openProp??e.open,d4=e=>(e.popupElement?.id??e.floatingId)||void 0;function f4(e,t){return t!==void 0&&u4(e)&&l4(e)===t}function p4(e,t){return f4(e,t)?!0:t!==void 0&&u4(e)&&l4(e)==null&&!e.openedWithoutTrigger&&e.triggerCount===1}var m4={open:u4,mounted:e=>e.mounted,transitionStatus:e=>u4(e)&&!e.mounted?`starting`:e.transitionStatus,floatingRootContext:e=>e.floatingRootContext,triggerCount:e=>e.triggerCount,preventUnmountingOnClose:e=>e.preventUnmountingOnClose,payload:e=>e.payload,activeTriggerId:l4,activeTriggerElement:e=>e.mounted?e.activeTriggerElement:null,popupId:d4,isTriggerActive:(e,t)=>t!==void 0&&l4(e)===t,isOpenedByTrigger:(e,t)=>f4(e,t),isMountedByTrigger:(e,t)=>t!==void 0&&l4(e)===t&&e.mounted,triggerProps:(e,t)=>t?e.activeTriggerProps:e.inactiveTriggerProps,triggerPopupId:(e,t)=>p4(e,t)?d4(e):void 0,popupProps:e=>e.popupProps,popupElement:e=>e.popupElement,positionerElement:e=>e.positionerElement};function h4(e){let t=G.useCallback(t=>e===void 0?JJ:e.subscribeStore(t),[e]),n=G.useCallback(()=>e===void 0?void 0:e.store,[e]);return(0,Q2.useSyncExternalStore)(t,n,()=>e?.serverStore)}var g4=IX&&RX;function _4(e,t={}){let{enabled:n=!0,delay:r}=t,{events:i,dataRef:a}=e.context,o=G.useRef(!1),s=G.useRef(null),c=G.useRef(!0),l=eY();G.useEffect(()=>{let t=e.select(`domReferenceElement`);if(!n)return;let r=iX(t);function i(){let t=e.select(`domReferenceElement`);!e.select(`open`)&&cX(t)&&t===VX(gQ(t))&&(o.current=!0,s.current=t)}function a(){c.current=!0}function l(){c.current=!1}return x0(v$(r,`blur`,i),g4&&v$(r,`keydown`,a,!0),g4&&v$(r,`pointerdown`,l,!0))},[e,n]),G.useEffect(()=>{if(!n)return;function t(t){if(t.reason===`trigger-press`||t.reason===`escape-key`){let t=e.select(`domReferenceElement`);sX(t)&&(s.current=t,o.current=!0)}}return i.on(`openchange`,t),()=>{i.off(`openchange`,t)}},[i,n,e]);let u=G.useMemo(()=>{function t(){o.current=!1,s.current=null}return{onMouseLeave(){t()},onFocus(n){let i=n.currentTarget;if(o.current){if(s.current===i)return;t()}let a=WX(n.nativeEvent);if(sX(a)){if(g4&&!n.relatedTarget){if(!c.current&&!SZ(a))return}else if(!TZ(a))return}let u=yZ(n.relatedTarget,e.context.triggerElements),{nativeEvent:d,currentTarget:f}=n;if(e.select(`open`)&&u||!r){e.setOpen(!0,$1(i0,d,f));return}l.start(r,()=>{o.current||e.setOpen(!0,$1(i0,d,f))})},onBlur(n){t();let r=n.relatedTarget,i=n.nativeEvent,o=sX(r)&&r.hasAttribute(j0(`focus-guard`))&&r.getAttribute(`data-type`)===`outside`;l.start(0,()=>{let t=e.select(`domReferenceElement`),n=VX(gQ(t));!r&&n===t||HX(a.current.floatingContext?.refs.floating.current,n)||HX(t,n)||o||yZ(r??n,e.context.triggerElements)||e.setOpen(!1,$1(i0,i))})}}},[a,r,e,l]);return G.useMemo(()=>n?{reference:u,trigger:u}:{},[n,u])}var v4=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},y4=new WeakMap;function b4(e){if(!e.performedPointerEventsMutation)return;let t=e.pointerEventsScopeElement;t&&y4.get(t)===e&&(e.pointerEventsScopeElement?.style.removeProperty(`pointer-events`),e.pointerEventsReferenceElement?.style.removeProperty(`pointer-events`),e.pointerEventsFloatingElement?.style.removeProperty(`pointer-events`),y4.delete(t)),e.performedPointerEventsMutation=!1,e.pointerEventsScopeElement=null,e.pointerEventsReferenceElement=null,e.pointerEventsFloatingElement=null}function x4(e,t){let{scopeElement:n,referenceElement:r,floatingElement:i}=t,a=y4.get(n);a&&a!==e&&b4(a),b4(e),e.performedPointerEventsMutation=!0,e.pointerEventsScopeElement=n,e.pointerEventsReferenceElement=r,e.pointerEventsFloatingElement=i,y4.set(n,e),n.style.pointerEvents=`none`,r.style.pointerEvents=`auto`,i.style.pointerEvents=`auto`}function S4(e){let t=e.context.dataRef.current,n=HJ(()=>t.hoverInteractionState??v4.create()).current;return t.hoverInteractionState||=n,ZJ(t.hoverInteractionState.disposeEffect),t.hoverInteractionState}function C4(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,l=o2(),u=a2(),d=S4(e),f=eY(),p=GJ(()=>y0(c.current.openEvent?.type,d.interactedInside)),m=GJ(()=>b0(c.current.openEvent?.type)),h=GJ(()=>{b4(d)});$(()=>{a||(d.pointerType=void 0,d.restTimeoutPending=!1,d.interactedInside=!1,h())},[a,d,h]),G.useEffect(()=>h,[h]),$(()=>{if(n&&a&&d.handleCloseOptions?.blockPointerEvents&&m()&&sX(s)&&o){let e=s,t=o,n=gQ(o),r=l?.nodesRef.current.find(e=>e.id===u)?.context?.elements.floating;r&&(r.style.pointerEvents=``);let i=d.pointerEventsScopeElement===t?null:d.pointerEventsScopeElement,a=r===t?null:r,c=d.handleCloseOptions?.getScope?.()??i??a??UX(e,`[data-rootownerid]`)??n.body;return x4(d,{scopeElement:c,referenceElement:e,floatingElement:t}),()=>{h()}}},[n,a,s,o,d,m,l,u,h]),G.useEffect(()=>{if(!n)return;function t(){return!!(l&&u&&DZ(l.nodesRef.current,u).length>0)}function a(t){let n=_0(r,`close`,d.pointerType),i=()=>{e.setOpen(!1,$1(r0,t)),l?.events.emit(`floating.closed`,t)};n?d.openChangeTimeout.start(n,i):(d.openChangeTimeout.clear(),i())}function s(e){let t=WX(e);if(!CZ(t)){d.interactedInside=!1;return}d.interactedInside=UX(t,`[aria-haspopup]`)!=null}function g(){d.openChangeTimeout.clear(),f.clear(),l?.events.off(`floating.closed`,v),h()}function _(n){if(t()&&l){l.events.on(`floating.closed`,v);return}if(yZ(n.relatedTarget,e.context.triggerElements))return;let r=c.current.floatingContext?.nodeId??i,o=n.relatedTarget;if(!(l&&r&&sX(o)&&DZ(l.nodesRef.current,r,!1).some(e=>HX(e.context?.elements.floating,o)))){if(d.handler){d.handler(n);return}h(),m()&&!p()&&a(n)}}function v(n){!l||!u||t()||f.start(0,()=>{l.events.off(`floating.closed`,v),e.setOpen(!1,$1(r0,n)),l.events.emit(`floating.closed`,n)})}let y=o;return x0(y&&v$(y,`mouseenter`,g),y&&v$(y,`mouseleave`,_),y&&v$(y,`pointerdown`,s,!0),()=>{l?.events.off(`floating.closed`,v)})},[n,o,e,c,r,i,m,p,h,d,l,u,f])}var w4={current:null};function T4(e,t={}){let{enabled:n=!0,delay:r=0,handleClose:i=null,mouseOnly:a=!1,restMs:o=0,move:s=!0,triggerElementRef:c=w4,externalTree:l,isActiveTrigger:u=!0,getHandleCloseContext:d,isClosing:f,shouldOpen:p,guardStaleOpen:m=!1}=t,{dataRef:h,events:g}=e.context,_=o2(l),v=S4(e),y=G.useRef(!1),b=S0(i),x=S0(r),S=S0(o),C=S0(n),w=S0(p),T=S0(f),E=GJ(()=>y0(h.current.openEvent?.type,v.interactedInside)),D=GJ(()=>w.current?.()!==!1),O=GJ((t,n,r)=>{let i=e.context.triggerElements;if(i.hasElement(n))return!t||!HX(t,n);if(!sX(r))return!1;let a=r;return i.hasMatchingElement(e=>HX(e,a))&&(!t||!HX(t,a))}),k=GJ(()=>{v.handler&&=(gQ(e.select(`domReferenceElement`)).removeEventListener(`mousemove`,v.handler),void 0)}),A=GJ(()=>{b4(v)});return u&&(v.handleCloseOptions=i?.__options),G.useEffect(()=>k,[k]),G.useEffect(()=>{if(!n)return;function e(e){e.open?y.current=!1:(y.current=e.reason===r0,k(),v.openChangeTimeout.clear(),v.restTimeout.clear(),v.blockMouseMove=!0,v.restTimeoutPending=!1)}return g.on(`openchange`,e),()=>{g.off(`openchange`,e)}},[n,g,v,k]),G.useEffect(()=>{if(!n)return;function t(t,n=!0){let r=_0(x.current,`close`,v.pointerType);r?v.openChangeTimeout.start(r,()=>{e.setOpen(!1,$1(r0,t)),_?.events.emit(`floating.closed`,t)}):n&&(v.openChangeTimeout.clear(),e.setOpen(!1,$1(r0,t)),_?.events.emit(`floating.closed`,t))}let r=c.current??(u?e.select(`domReferenceElement`):null);if(!sX(r))return;function i(t){if(v.openChangeTimeout.clear(),v.blockMouseMove=!1,a&&!NZ(v.pointerType))return;let n=v0(S.current),r=_0(x.current,`open`,v.pointerType),i=WX(t),o=t.currentTarget??null,s=e.select(`domReferenceElement`),c=o;if(sX(i)&&!e.context.triggerElements.hasElement(i)){for(let t of e.context.triggerElements.elements())if(HX(t,i)){c=t;break}}sX(o)&&sX(s)&&!e.context.triggerElements.hasElement(o)&&HX(o,s)&&(c=s);let l=c!=null&&O(s,c,i),u=e.select(`open`),d=T.current?.()??e.select(`transitionStatus`)===`ending`,f=!u&&d&&y.current,p=!l&&sX(c)&&sX(s)&&HX(s,c)&&f,m=n>0&&!r,h=l&&(u||f)||p,g=!u||l;if(h){D()&&e.setOpen(!0,$1(r0,t,c));return}m||(r?v.openChangeTimeout.start(r,()=>{g&&D()&&e.setOpen(!0,$1(r0,t,c))}):g&&D()&&e.setOpen(!0,$1(r0,t,c)))}function o(n){if(E()){A();return}k();let r=gQ(e.select(`domReferenceElement`));v.restTimeout.clear(),v.restTimeoutPending=!1;let i=h.current.floatingContext??d?.();if(!yZ(n.relatedTarget,e.context.triggerElements)){if(b.current&&i){e.select(`open`)||v.openChangeTimeout.clear();let a=c.current;v.handler=b.current({...i,tree:_,x:n.clientX,y:n.clientY,onClose(){A(),k(),C.current&&!E()&&a===e.select(`domReferenceElement`)&&t(n,!0)}}),r.addEventListener(`mousemove`,v.handler),v.handler(n);return}(v.pointerType!==`touch`||!HX(e.select(`floatingElement`),n.relatedTarget))&&t(n)}}function l(e){HX(r,e.relatedTarget)||(v.openChangeTimeout.clear(),v.restTimeout.clear(),v.restTimeoutPending=!1)}let f=m?v$(r,`mouseout`,l):void 0;return s?x0(v$(r,`mousemove`,i,{once:!0}),v$(r,`mouseenter`,i),v$(r,`mouseleave`,o),f):x0(v$(r,`mouseenter`,i),v$(r,`mouseleave`,o),f)},[k,A,h,x,e,n,b,v,u,O,E,a,s,S,c,_,C,d,T,D,m]),G.useMemo(()=>{if(!n)return;function t(e){v.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=O(i,r,t.target);if(a&&!NZ(v.pointerType))return;if(o&&s&&v.handleCloseOptions?.blockPointerEvents){let t=e.select(`floatingElement`);if(t){let e=v.handleCloseOptions?.getScope?.()??r.ownerDocument.body;x4(v,{scopeElement:e,referenceElement:r,floatingElement:t})}}let c=v0(S.current);if(o&&!s||c===0||!s&&v.restTimeoutPending&&t.movementX**2+t.movementY**2<2)return;v.restTimeout.clear();function l(){if(v.restTimeoutPending=!1,E())return;let t=e.select(`open`);!v.blockMouseMove&&(!t||s)&&D()&&e.setOpen(!0,$1(r0,n,r))}v.pointerType===`touch`?WF.flushSync(()=>{l()}):s&&o?l():(v.restTimeoutPending=!0,v.restTimeout.start(c,l))}}},[n,v,E,O,a,e,S,D])}function E4(e){return RX&&e.movementX===0&&e.movementY===0}function D4(e,t,n){switch(e){case`vertical`:return t;case`horizontal`:return n;default:return t||n}}function O4(e,t){return D4(t,e===`ArrowUp`||e===`ArrowDown`,e===`ArrowLeft`||e===`ArrowRight`)}function k4(e,t,n){return D4(t,e===`ArrowDown`,n?e===`ArrowLeft`:e===`ArrowRight`)||e===`Enter`||e===` `||e===``}function A4(e,t,n){return D4(t,n?e===qX:e===JX,e===XX)}function j4(e,t,n,r){return t===`both`||t===`horizontal`&&r?e===`Escape`:D4(t,n?e===JX:e===qX,e===YX)}function M4(e,t){let{listRef:n,activeIndex:r,onNavigate:i=()=>{},enabled:a=!0,selectedIndex:o=null,allowEscape:s=!1,loopFocus:c=!1,nested:l=!1,rtl:u=!1,virtual:d=!1,focusItemOnOpen:f=`auto`,focusItemOnHover:p=!0,openOnArrowKeyDown:m=!0,disabledIndices:h=void 0,orientation:g=`vertical`,triggerOrientation:_=g,parentOrientation:v,id:y,resetOnPointerLeave:b=!0,externalTree:x,nestedReturnFocusRef:S,grid:C}=t,w=C!=null,T=e.useState(`open`),E=e.useState(`floatingElement`),D=e.useState(`domReferenceElement`),O=e.context.dataRef,k=EZ(E),A=wZ(D),j=S0(k),M=a2(),N=o2(x),P=G.useRef(f),F=G.useRef(o??-1),I=G.useRef(null),L=G.useRef(!0),R=GJ(e=>{i(F.current===-1?null:F.current,e)}),z=G.useRef(!!E),ee=G.useRef(T),te=G.useRef(!1),B=G.useRef(!1),ne=G.useRef(null),re=S0(h),V=S0(T),H=S0(o),ie=S0(b),ae=D0(),oe=D0(),se=GJ(()=>{ae.cancel();function e(e){d||(ne.current=N0(e,{sync:te.current,preventScroll:!0}))}let t=n.current[F.current],r=B.current;t&&e(t),(te.current?e=>e():e=>ae.request(e))(()=>{let i=n.current[F.current]||t;i&&(t||e(i),pe&&(r||!L.current)&&i.scrollIntoView?.({block:`nearest`,inline:`nearest`}))})});$(()=>{O.current.orientation=g},[O,g]),$(()=>{T||(I.current=null),(!T||f!==`auto`)&&(P.current=f)},[T,f]),$(()=>{a&&(T&&E?(F.current=o??-1,P.current&&o!=null&&(B.current=!0,R())):z.current&&(F.current=-1,R()))},[a,T,E,o,R]),$(()=>{if(a){if(!T){te.current=!1;return}if(E){if(r==null){if(te.current=!1,H.current!=null)return;if(z.current&&(F.current=-1,se()),(!ee.current||!z.current)&&P.current&&(I.current!=null||P.current===!0&&I.current==null)){let e=0,t=()=>{n.current[0]==null?(e<2&&(e?e=>oe.request(e):queueMicrotask)(t),e+=1):(F.current=I.current==null||k4(I.current,_,u)||l?lQ(n):uQ(n),I.current=null,R())};t()}}else cQ(n.current,r)||(F.current=r,se(),B.current=!1)}}},[a,T,E,r,H,l,n,_,u,R,se,oe]),$(()=>{if(!a||E||!N||d||!z.current)return;let e=N.nodesRef.current,t=e.find(e=>e.id===M)?.context?.elements.floating,n=VX(gQ(D??t??null)),r=e.some(e=>e.context&&HX(e.context.elements.floating,n));t&&!r&&L.current&&t.focus({preventScroll:!0})},[a,E,D,N,M,d]),$(()=>{ee.current=T,z.current=!!E});let ce=r!=null,le=GJ(e=>{if(!V.current)return;let t=n.current.indexOf(e.currentTarget);t!==-1&&(F.current!==t||r!==t)&&(F.current=t,R(e))}),ue=GJ(()=>v??N?.nodesRef.current.find(e=>e.id===M)?.context?.dataRef?.current.orientation),de=GJ(()=>lQ(n,re.current)),fe=GJ(t=>{if(L.current=!1,te.current=!0,t.which===229||!V.current&&t.currentTarget===j.current)return;if(l&&j4(t.key,g,u,w)){O4(t.key,ue())||kZ(t),e.setOpen(!1,$1(u0,t.nativeEvent));let n=S?.current??D;cX(n)&&n.focus();return}r!=null&&r!==F.current&&!cQ(n.current,r)&&(F.current=r);let i=F.current,a=lQ(n,h),o=uQ(n,h);if(A||(t.key===`Home`&&(kZ(t),F.current=a,R(t)),t.key===`End`&&(kZ(t),F.current=o,R(t))),C!=null){let e=C(t,F.current,n,g,c,u,h,a,o);if(e!=null&&e!==F.current&&(F.current=e,R(t)),g===`both`)return}if(O4(t.key,g)){kZ(t);let e=VX(t.currentTarget.ownerDocument);if(T&&!d&&HX(t.currentTarget,e)&&!n.current.some(t=>t!=null&&HX(t,e))){F.current=k4(t.key,g,u)?a:o,R(t),r===F.current&&se();return}let{index:l,wrapped:f}=dQ(n.current,i,{decrement:!k4(t.key,g,u),loopFocus:c,allowEscape:s,disabledIndices:h,minIndex:a,maxIndex:o});f&&(te.current=!1),F.current=l,R(t)}}),pe=G.useMemo(()=>({onFocus(e){te.current=!0,le(e)},onClick({currentTarget:e}){d||e.focus({preventScroll:!0})},onMouseMove(e){E4(e)||(te.current=!0,B.current=!1,p&&le(e))},onPointerLeave(e){if(!V.current||!L.current||e.pointerType===`touch`)return;te.current=!0;let t=e.relatedTarget;if(!(!p||n.current.includes(t))&&ie.current&&(ne.current?.(),ne.current=null,F.current=-1,R(e),!d)){let e=j.current,t=VX(gQ(e));e&&HX(e,t)&&e.focus({preventScroll:!0})}}}),[le,V,j,p,n,R,ie,d]),me=G.useMemo(()=>d&&T&&ce&&{"aria-activedescendant":`${y}-${r}`},[d,T,ce,y,r]),he=G.useMemo(()=>({...A?{}:me,onKeyDown(t){if(t.key===`Tab`&&t.shiftKey&&T&&!d){let n=WX(t.nativeEvent);if(n&&!HX(j.current,n))return;kZ(t);let r=$1(c0,t.nativeEvent);e.setOpen(!1,r);let i=S?.current??D;!r.isCanceled&&cX(i)&&i.focus();return}fe(t)},onPointerMove(e){E4(e)||(L.current=!0)}}),[me,fe,j,A,e,T,d,D,S]),ge=G.useMemo(()=>{function t(t){e.setOpen(!0,$1(u0,t.nativeEvent,t.currentTarget))}function n(e){f===`auto`&&jZ(e.nativeEvent)&&(P.current=!d)}function r(e){P.current=f,f===`auto`&&MZ(e.nativeEvent)&&(P.current=!0)}return{onKeyDown(n){let r=e.select(`open`);L.current=!1;let i=n.key.startsWith(`Arrow`),a=A4(n.key,ue(),u),o=O4(n.key,r?g:_),s=(l?a:o)||n.key===`Enter`||n.key.trim()===``;if(d&&r&&(!l||SZ(n.currentTarget)))return fe(n);if(!(!r&&!m&&i)){if(s){let e=O4(n.key,ue());I.current=l&&e?null:n.key}if(l){a&&(kZ(n),r?(F.current=de(),R(n),d&&j.current?.focus()):t(n));return}o&&(H.current!=null&&(F.current=H.current),kZ(n),!r&&m?t(n):fe(n),r&&R(n))}},onFocus(t){t.target===t.currentTarget&&e.select(`open`)&&!d&&(F.current=-1,R(t))},onPointerDown:r,onPointerEnter:r,onMouseDown:n,onClick:n}},[fe,f,de,l,R,e,m,g,_,ue,u,H,d,j]),_e=G.useMemo(()=>({...me,...ge}),[me,ge]);return G.useMemo(()=>a?{reference:_e,floating:he,item:pe,trigger:ge}:{},[a,_e,he,ge,pe])}function N4(e,t){let{listRef:n,elementsRef:r,activeIndex:i,onMatch:a,disabledIndices:o,onTyping:s,enabled:c=!0,resetMs:l=750,selectedIndex:u=null}=t,d=GJ(s),f=e.useState(`open`),p=eY(),m=G.useRef(``),h=G.useRef(u??i??-1),g=G.useRef(null),_=GJ(e=>{function t(e){return r?.current[e]}function s(e){let n=t(e);return n&&!hQ(n)||n?.matches(`:disabled`)?!1:o==null||!pQ(YJ,e,o)}function c(e,t,n=0){if(e.length===0)return-1;let r=(n%e.length+e.length)%e.length,i=t.toLowerCase();for(let t=0;t<e.length;t+=1){let n=(r+t)%e.length;if(!(!e[n]?.toLowerCase().startsWith(i)||!s(n)))return n}return-1}let _=n.current;if(m.current.length>0&&e.key===` `&&(kZ(e),d?.(!0)),m.current.length>0&&m.current[0]!==` `&&c(_,m.current)===-1&&e.key!==` `&&d?.(!1),_==null||e.key.length!==1||e.ctrlKey||e.metaKey||e.altKey)return;f&&e.key!==` `&&(kZ(e),d?.(!0));let v=m.current===``;v&&(h.current=u??i??-1),_.every((e,t)=>e&&s(t)?e[0]?.toLowerCase()!==e[1]?.toLowerCase():!0)&&m.current===e.key&&(m.current=``,h.current=g.current),m.current+=e.key,p.start(l,()=>{m.current=``,h.current=g.current,d?.(!1)});let y=((v?u??i??-1:h.current)??0)+1,b=c(_,m.current,y);b===-1?e.key!==` `&&(m.current=``,d?.(!1)):(a?.(b,e),g.current=b)}),v=GJ(t=>{let n=t.relatedTarget,r=e.select(`domReferenceElement`),i=e.select(`floatingElement`);HX(r,n)||HX(i,n)||(p.clear(),m.current=``,h.current=g.current,d?.(!1))});$(()=>{!f&&u!==null||(p.clear(),g.current=null,m.current!==``&&(m.current=``,d?.(!1)))},[f,u,p,d]);let y=G.useMemo(()=>({onKeyDown:_,onBlur:v}),[_,v]);return G.useMemo(()=>c?{reference:y,floating:y}:{},[c,y])}var P4=.1,F4=P4*P4,I4=.5;function L4(e,t,n,r,i,a){return r>=t!=a>=t&&e<=(i-n)*(t-r)/(a-r)+n}function R4(e,t,n,r,i,a,o,s,c,l){let u=!1;return L4(e,t,n,r,i,a)&&(u=!u),L4(e,t,i,a,o,s)&&(u=!u),L4(e,t,o,s,c,l)&&(u=!u),L4(e,t,c,l,n,r)&&(u=!u),u}function z4(e,t,n){return e>=n.x&&e<=n.x+n.width&&t>=n.y&&t<=n.y+n.height}function B4(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 V4(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*F4;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=WX(r),g=r.type===`mouseleave`,_=HX(u,h),v=HX(a,h);if(_&&(l=!0,!g))return;if(v&&(l=!1,!g)){l=!0;return}if(g&&sX(r.relatedTarget)&&HX(u,r.relatedTarget))return;function y(){return!!(s&&DZ(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=B4(d,f,D,x.top+1,O,S.bottom-1);break;case`bottom`:j=B4(d,f,D,S.top+1,O,x.bottom-1);break;case`left`:j=B4(d,f,S.right-1,A,x.left+1,k);break;case`right`:j=B4(d,f,x.right-1,A,S.left+1,k)}if(j)return;if(l&&!z4(d,f,x)){b();return}if(!g&&p(d,f)){b();return}let M=!1;switch(c){case`top`:{let n=T?I4/2:I4*4,r=T||C?e+n:e-n,i=T?e-n:C?e+n:e-n,a=t+I4+1,o=C||T?S.bottom-I4:S.top,s=C?T?S.bottom-I4:S.top:S.bottom-I4;M=R4(d,f,r,a,i,a,S.left,o,S.right,s);break}case`bottom`:{let n=T?I4/2:I4*4,r=T||C?e+n:e-n,i=T?e-n:C?e+n:e-n,a=t-I4,o=C||T?S.top+I4:S.bottom,s=C?T?S.top+I4:S.bottom:S.top+I4;M=R4(d,f,r,a,i,a,S.left,o,S.right,s);break}case`left`:{let n=E?I4/2:I4*4,r=E||w?t+n:t-n,i=E?t-n:w?t+n:t-n,a=e+I4+1,o=w||E?S.right-I4:S.left,s=w?E?S.right-I4:S.left:S.right-I4;M=R4(d,f,o,S.top,s,S.bottom,a,r,a,i);break}case`right`:{let n=E?I4/2:I4*4,r=E||w?t+n:t-n,i=E?t-n:w?t+n:t-n,a=e-I4,o=w||E?S.left+I4:S.right,s=w?E?S.left+I4:S.right:S.left+I4;M=R4(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 H4(e,t,n){let{reference:r,floating:i}=e,a=qZ(t),o=JZ(t),s=KZ(o),c=UZ(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=WZ(t);return m&&(p[o]+=f*(m===`end`?1:-1)*(n&&l?-1:1)),p}async function U4(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}=HZ(t,e),p=oQ(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=sQ(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=sQ(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 W4=50,G4=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:U4},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=H4(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<W4&&(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}=H4(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},K4=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}=HZ(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=UZ(r),_=qZ(o),v=UZ(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[iQ(o)]:XZ(o)),x=p!==`none`;!d&&x&&b.push(...rQ(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=YZ(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`||_===qZ(t)||T.every(e=>qZ(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=qZ(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{}}}},q4=new Set([`left`,`top`]);async function J4(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=UZ(n),s=WZ(n),c=qZ(n)===`y`,l=q4.has(o)?-1:1,u=a&&c?-1:1,d=HZ(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 Y4=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 J4(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}}}}},X4=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}=HZ(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=qZ(i),p=GZ(f),m=u[p],h=u[f],g=(e,t)=>VZ(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}}}}}},Z4=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}=HZ(e,t),u={x:n,y:r},d=qZ(i),f=GZ(d),p=u[f],m=u[d],h=HZ(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=q4.has(UZ(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}}}},Q4=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}=HZ(e,t),c=await i.detectOverflow(t,s),l=UZ(n),u=WZ(n),d=qZ(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=FZ(p-c[m],g),y=FZ(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*IZ(c.left,c.right):S=p-2*IZ(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 $4(e){let t=xX(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=cX(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=LZ(n)!==a||LZ(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function e3(e){return sX(e)?e:e.contextElement}function t3(e){let t=e3(e);if(!cX(t))return zZ(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=$4(t),o=(a?LZ(n.width):n.width)/r,s=(a?LZ(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var n3=zZ(0);function r3(e){let t=iX(e);return!yX()||!t.visualViewport?n3:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function i3(e,t,n){return t===void 0&&(t=!1),!!n&&t&&n===iX(e)}function a3(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=e3(e),o=zZ(1);t&&(r?sX(r)&&(o=t3(r)):o=t3(e));let s=i3(a,n,r)?r3(a):zZ(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=iX(a),t=sX(r)?iX(r):r,n=e,i=EX(n);for(;i&&t!==n;){let e=t3(i),t=i.getBoundingClientRect(),r=xX(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=iX(i),i=EX(n)}}return sQ({width:u,height:d,x:c,y:l})}function o3(e,t){let n=SX(e).scrollLeft;return t?t.left+n:a3(aX(e)).left+n}function s3(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-o3(e,n),y:n.top+t.scrollTop}}function c3(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=aX(r),s=t?fX(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=zZ(1),u=zZ(0),d=cX(r);if((d||!a)&&((rX(r)!==`body`||uX(o))&&(c=SX(r)),d)){let e=a3(r);l=t3(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?s3(o,c):zZ(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 l3(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function u3(e){let t=SX(e),n=e.ownerDocument.body,r=IZ(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),i=IZ(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight),a=-t.scrollLeft+o3(e),o=-t.scrollTop;return xX(n).direction===`rtl`&&(a+=IZ(e.clientWidth,n.clientWidth)-r),{width:r,height:i,x:a,y:o}}var d3=25;function f3(e,t,n){n===void 0&&(n=`viewport`);let r=n===`layoutViewport`,i=iX(e),a=aX(e),o=i.visualViewport,s=a.clientWidth,c=a.clientHeight,l=0,u=0;if(o){let e=!yX()||t===`fixed`;r?e||(l=-o.offsetLeft,u=-o.offsetTop):(s=o.width,c=o.height,e&&(l=o.offsetLeft,u=o.offsetTop))}if(o3(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<=d3&&(s-=o)}return{width:s,height:c,x:l,y:u}}function p3(e,t){let n=a3(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=t3(e);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function m3(e,t,n){let r;if(t===`viewport`||t===`layoutViewport`)r=f3(e,n,t);else if(t===`document`)r=u3(aX(e));else if(sX(t))r=p3(t,n);else{let n=r3(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return sQ(r)}function h3(e,t){let n=t.get(e);if(n)return n;let r=TX(e,[],!1).filter(e=>sX(e)&&rX(e)!==`body`),i=null,a=xX(e).position===`fixed`,o=a?CX(e):e;for(;sX(o)&&!bX(o);){let e=xX(o),t=_X(o),n=i?i.position:a?`fixed`:``;!t&&(n===`fixed`||n===`absolute`&&e.position===`static`)?r=r.filter(e=>e!==o):i=e,o=CX(o)}return t.set(e,r),r}function g3(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?fX(t)?[]:h3(t,this._c):[].concat(n),r],o=m3(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=m3(t,a[e],i);s=IZ(n.top,s),c=FZ(n.right,c),l=FZ(n.bottom,l),u=IZ(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function _3(e){let{width:t,height:n}=$4(e);return{width:t,height:n}}function v3(e,t,n){let r=cX(t),i=aX(t),a=n===`fixed`,o=a3(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=zZ(0);if((r||!a)&&((rX(t)!==`body`||uX(i))&&(s=SX(t)),r)){let e=a3(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}!r&&i&&(c.x=o3(i));let l=i&&!r&&!a?s3(i,s):zZ(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 y3(e){return xX(e).position===`static`}function b3(e,t){if(!cX(e)||xX(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return aX(e)===n&&(n=n.ownerDocument.body),n}function x3(e,t){let n=iX(e);if(fX(e))return n;if(!cX(e)){let t=CX(e);for(;t&&!bX(t);){if(sX(t)&&!y3(t))return t;t=CX(t)}return n}let r=b3(e,t);for(;r&&dX(r)&&y3(r);)r=b3(r,t);return r&&bX(r)&&y3(r)&&!_X(r)?n:r||vX(e)||n}var S3=async function(e){let t=this.getOffsetParent||x3,n=this.getDimensions,r=await n(e.floating);return{reference:v3(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function C3(e){return xX(e).direction===`rtl`}var w3={convertOffsetParentRelativeRectToViewportRelativeRect:c3,getDocumentElement:aX,getClippingRect:g3,getOffsetParent:x3,getElementRects:S3,getClientRects:l3,getDimensions:_3,getScale:t3,isElement:sX,isRTL:C3};function T3(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function E3(e,t,n){let r=null,i,a=aX(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=RZ(d),h=RZ(a.clientWidth-(u+f)),g=RZ(a.clientHeight-(d+p)),_=RZ(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:IZ(0,FZ(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(!T3(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=iX(e),l=()=>s(n);return c.addEventListener(`resize`,l),s(!0),()=>{c.removeEventListener(`resize`,l),o()}}function D3(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=e3(e),u=i||a?[...l?TX(l):[],...t?TX(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n),a&&e.addEventListener(`resize`,n)});let d=l&&s?E3(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?a3(e):null;c&&g();function g(){let t=a3(e);h&&!T3(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 O3=Y4,k3=X4,A3=K4,j3=Q4,M3=Z4,N3=(e,t,n)=>{let r=new Map,i=n??{},a={...w3,...i.platform,_c:r};return G4(e,t,{...i,platform:a})},P3=typeof document<`u`?G.useLayoutEffect:function(){};function F3(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(!F3(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)&&!F3(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function I3(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function L3(e,t){let n=I3(e);return Math.round(t*n)/n}function R3(e){let t=G.useRef(e);return P3(()=>{t.current=e}),t}function z3(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:l}=e,[u,d]=G.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=G.useState(r);F3(f,r)||p(r);let[m,h]=G.useState(null),[g,_]=G.useState(null),v=G.useCallback(e=>{e!==S.current&&(S.current=e,h(e))},[]),y=G.useCallback(e=>{e!==C.current&&(C.current=e,_(e))},[]),b=a||m,x=o||g,S=G.useRef(null),C=G.useRef(null),w=G.useRef(u),T=c!=null,E=R3(c),D=R3(i),O=R3(l),k=G.useCallback(()=>{if(!S.current||!C.current)return;let e={placement:t,strategy:n,middleware:f};D.current&&(e.platform=D.current),N3(S.current,C.current,e).then(e=>{let t={...e,isPositioned:O.current!==!1};A.current&&!F3(w.current,t)&&(w.current=t,WF.flushSync(()=>{d(t)}))})},[f,t,n,D,O]);P3(()=>{l===!1&&w.current.isPositioned&&(w.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let A=G.useRef(!1);P3(()=>(A.current=!0,()=>{A.current=!1}),[]),P3(()=>{if(b&&(S.current=b),x&&(C.current=x),b&&x){if(E.current)return E.current(b,x,k);k()}},[b,x,k,E,T]);let j=G.useMemo(()=>({reference:S,floating:C,setReference:v,setFloating:y}),[v,y]),M=G.useMemo(()=>({reference:b,floating:x}),[b,x]),N=G.useMemo(()=>{let e={position:n,left:0,top:0};if(!M.floating)return e;let t=L3(M.floating,u.x),r=L3(M.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...I3(M.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,M.floating,u.x,u.y]);return G.useMemo(()=>({...u,update:k,refs:j,elements:M,floatingStyles:N}),[u,k,j,M,N])}var B3=(e,t)=>{let n=O3(e);return{name:n.name,fn:n.fn,options:[e,t]}},V3=(e,t)=>{let n=k3(e);return{name:n.name,fn:n.fn,options:[e,t]}},H3=(e,t)=>({fn:M3(e).fn,options:[e,t]}),U3=(e,t)=>{let n=A3(e);return{name:n.name,fn:n.fn,options:[e,t]}},W3=(e,t)=>{let n=j3(e);return{name:n.name,fn:n.fn,options:[e,t]}},G3=new Set([`ArrowUp`,`ArrowDown`,`ArrowLeft`,`ArrowRight`,`Home`,`End`]);function K3(e){return fY(19)?e:e?`true`:void 0}var q3=G.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,Z.jsx)(`div`,{ref:t,role:`presentation`,"data-base-ui-inert":``,...r,style:{position:`fixed`,inset:0,userSelect:`none`,WebkitUserSelect:`none`,clipPath:i}})}),J3={},Y3={},X3=``;function Z3(e,t){return uX(e)?e:t}function Q3(e,t,n){return/hidden|clip/.test(e.getComputedStyle(Z3(t,n)).overflowY)}function $3(e){if(typeof document>`u`)return!1;let t=gQ(e);return iX(t).innerWidth-t.documentElement.clientWidth>0}function e6(e){if(!(typeof CSS<`u`&&CSS.supports&&CSS.supports(`scrollbar-gutter`,`stable`))||typeof document>`u`)return!1;let t=gQ(e),n=t.documentElement,r=t.body,i=Z3(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 t6(e){let t=gQ(e),n=t.documentElement,r=t.body,i=Z3(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 n6(e){let t=gQ(e),n=t.documentElement,r=t.body,i=iX(n),a=0,o=0,s=!1,c=E0.create();if(RX&&(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,J3={scrollbarGutter:n.style.scrollbarGutter,overflowY:n.style.overflowY,overflowX:n.style.overflowX},X3=n.style.scrollBehavior,Y3={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=Z3(n,r);if(s=e6(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,J3),Object.assign(r.style,Y3),s||(n.scrollTop=a,n.scrollLeft=o,n.removeAttribute(`data-base-ui-scroll-locked`),n.style.scrollBehavior=X3)}function d(){u(),c.request(l)}l();let f=v$(i,`resize`,d);return()=>{c.cancel(),u(),typeof i.removeEventListener==`function`&&f()}}var r6=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=gQ(e),n=t.documentElement,r=t.body,i=iX(n);if(Q3(i,n,r)){let t=new i.MutationObserver(()=>{Q3(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=NX||!$3(e);this.restore=a?t6(e):n6(e)}};function i6(e=!0,t=null){$(()=>{if(e)return r6.acquire(t)},[e,t])}function a6(e){let t=G.useRef(``),n=G.useCallback(n=>{n.defaultPrevented||(t.current=n.pointerType,e(n,n.pointerType))},[e]);return{onClick:G.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 o6(e,t){let n=G.useRef(e),r=GJ(t);$(()=>{n.current!==e&&r(n.current),n.current=e},[e,r])}function s6(e,t){let{onClick:n,onPointerDown:r}=a6(GJ((n,r)=>{(typeof e==`function`?e():e)||t(r||(NX?`touch`:``))}));return G.useMemo(()=>({onClick:n,onPointerDown:r}),[n,r])}function c6(e){let[t,n]=G.useState(null),r=s6(e,n);return o6(e,t=>{t&&!e&&n(null)}),G.useMemo(()=>({openMethod:t,triggerProps:r}),[t,r])}var l6=VN({keyCode:UN(229)});function u6(e){return e.nativeEvent.isComposing||Se(l6,e.nativeEvent).success}function d6(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:qR(t,t.easeExit),fill:`backwards`})}function f6(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:qR(t,t.ease),fill:`backwards`})}function p6(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:qR(t,t.ease),fill:`backwards`})}function m6(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:qR(t,`ease-out`)})}var h6=(0,G.forwardRef)(function({state:e,onStop:t,stopLabel:n=`Stop`,iconSize:r=20,onClick:i,disabled:a,className:o,tone:s=`primary`,"aria-label":c,...l},u){let d=(0,G.useRef)(null);(0,G.useImperativeHandle)(u,()=>d.current);let f=(0,G.useRef)(e);(0,G.useLayoutEffect)(()=>{let t=d.current,n=f.current;if(f.current=e,!t||n===e||!JR(t))return;let r=t.querySelector(`[data-glyph="arrow"]`),i=t.querySelector(`[data-glyph="busy"]`);if(!r||!i)return;let a=BR(t),o=[];return e===`busy`?o.push(d6(r,a),p6(i,a,1)):n===`busy`&&o.push(p6(i,a,0),f6(r,a)),n===`empty`&&e===`ready`&&!a.reduced&&o.push(m6(t,a)),()=>{for(let e of o)e.cancel()}},[e]);let p=e===`busy`,m=p&&t!==void 0;return(0,Z.jsx)(zJ,{...l,ref:d,className:Q(`caps-send-action`,o),tone:s,"aria-busy":p?!0:void 0,"aria-label":m?n:c,"data-send-state":e,disabled:a===!0||e===`empty`||p&&!m,onClick:m?t:i,label:null,icon:(0,Z.jsxs)(`span`,{className:`caps-send-glyph`,"data-state":e,children:[(0,Z.jsx)(`span`,{"data-glyph":`arrow`,children:(0,Z.jsx)(OI,{"aria-hidden":`true`,size:r})}),(0,Z.jsx)(`span`,{"data-glyph":`busy`,children:t===void 0?(0,Z.jsx)(lH,{decorative:!0,size:`sm`}):(0,Z.jsx)(XI,{"aria-hidden":`true`,fill:`currentColor`,size:Math.round(r*.7)})})]})})}),g6=new Intl.NumberFormat(`en-US`,{style:`currency`,currency:`USD`,minimumFractionDigits:2,maximumFractionDigits:2}),_6=new Intl.NumberFormat(`en-US`,{style:`currency`,currency:`USD`,minimumFractionDigits:2,maximumFractionDigits:5});function v6(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?_6.format(e):g6.format(e)}var y6=(0,G.forwardRef)(function({className:e,label:t,...n},r){return(0,Z.jsx)(zJ,{...n,ref:r,className:Q(`parakeet-composer-model-key`,e),label:t,readout:(0,Z.jsx)(jI,{"aria-hidden":`true`,className:`size-[var(--stipe-icon-size-sm)] shrink-0`})})}),b6=(0,G.forwardRef)(function({className:e,...t},n){return(0,Z.jsx)(`div`,{...t,ref:n,className:Q(`caps-popover-anchor`,e)})}),x6=(0,G.forwardRef)(function({className:e,open:t,side:n=`top`,...r},i){return t?(0,Z.jsx)(`div`,{...r,ref:i,className:Q(`caps-popover`,e),"data-side":n}):null}),S6=(0,G.forwardRef)(function({active:e,className:t,onMouseDown:n,...r},i){return(0,Z.jsx)(`div`,{role:`option`,"aria-selected":e,...r,ref:i,className:Q(`caps-popover-option`,t),"data-active":e,onMouseDown:e=>{e.preventDefault(),n?.(e)}})});function C6({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,G.useId)(),f=(0,G.useRef)(null),p=(0,G.useRef)(null),m=(0,G.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,G.useEffect)(()=>{g&&p.current?.focus()},[g]),(0,G.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,G.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,Z.jsxs)(b6,{...u,ref:f,className:Q(`caps-status-tray`,l),"data-placement":o,"data-align":s,children:[h?(0,Z.jsxs)(x6,{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,Z.jsxs)(`div`,{className:`caps-status-tray-head`,children:[h.tone?(0,Z.jsx)(SH,{size:`compact`,tone:h.tone,glyph:h.glyph??`dot`}):null,(0,Z.jsx)(`span`,{id:`${d}-title`,className:`caps-status-tray-title`,children:h.title??h.label}),h.actions,(0,Z.jsx)(LJ,{"aria-label":`Close tray`,icon:(0,Z.jsx)(QI,{"aria-hidden":`true`}),onClick:_})]}),(0,Z.jsx)(`div`,{className:`caps-status-tray-body`,children:h.content})]}):null,o===`host`?null:(0,Z.jsxs)(`div`,{className:`caps-status-tray-row`,children:[r,(0,Z.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,Z.jsxs)(Z.Fragment,{children:[e.tone?(0,Z.jsx)(SH,{size:`compact`,glyph:e.glyph??`dot`,motion:e.motion??`none`,tone:e.tone}):null,(0,Z.jsx)(`span`,{className:`caps-status-tray-label`,children:e.label}),e.count!==void 0&&e.count>0?(0,Z.jsx)(`span`,{className:`caps-status-tray-count`,children:e.count}):null]})};return(0,Z.jsxs)(G.Fragment,{children:[a?a(r):(0,Z.jsx)(`button`,{...r}),e.after]},e.id)})}),i]})]})}function w6({children:e,className:t,...n}){return(0,Z.jsx)(`div`,{...n,className:Q(`caps-status-tray-list`,t),children:e})}function T6({icon:e,primary:t,secondary:n,actions:r,className:i,...a}){return(0,Z.jsxs)(`div`,{...a,className:Q(`caps-status-tray-item`,i),children:[e?(0,Z.jsx)(`span`,{className:`caps-status-tray-icon`,children:e}):null,(0,Z.jsxs)(`span`,{className:`caps-status-tray-text`,children:[(0,Z.jsx)(`span`,{className:`caps-status-tray-primary`,children:t}),n?(0,Z.jsx)(`span`,{className:`caps-status-tray-secondary`,children:n}):null]}),r?(0,Z.jsx)(`span`,{className:`caps-status-tray-actions`,children:r}):null]})}function E6({children:e=`All caught up.`,title:t}){return(0,Z.jsxs)(`div`,{className:`caps-status-tray-note`,children:[t?(0,Z.jsx)(`strong`,{className:`caps-status-tray-note-title`,children:t}):null,(0,Z.jsx)(`p`,{children:e})]})}var D6=(0,G.forwardRef)(function({className:e,invalid:t,...n},r){return(0,Z.jsx)(`textarea`,{...n,"aria-invalid":t?!0:n[`aria-invalid`]===!1?void 0:n[`aria-invalid`],className:Q(`textarea textarea-bordered w-full`,t&&`textarea-error`,e),ref:r})});function O6(e,t){return`${e}-${String(t)}`}function k6(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 A6(e){return{role:`combobox`,"aria-autocomplete":`list`,"aria-expanded":e.open,"aria-controls":e.open?e.listId:void 0,"aria-activedescendant":e.open?O6(e.listId,e.selected):void 0}}function j6({open:e,rows:t,selected:n,listId:r,label:i,kind:a,hint:o,empty:s,onHighlight:c,onChoose:l}){return(0,Z.jsx)(x6,{open:e,side:`top`,"data-parakeet-slash":``,children:(0,Z.jsxs)(`div`,{className:`parakeet-slash-menu`,"data-kind":a,children:[o===void 0?null:(0,Z.jsx)(`p`,{className:`parakeet-slash-hint`,children:o}),t.length===0?s===void 0?null:(0,Z.jsx)(`p`,{className:`parakeet-slash-hint`,children:s}):(0,Z.jsx)(`div`,{id:r,role:`listbox`,"aria-label":i,children:t.map((e,t)=>(0,Z.jsxs)(S6,{id:O6(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,Z.jsx)(`span`,{"aria-hidden":`true`,className:`parakeet-slash-media`,children:e.media}),(0,Z.jsx)(`span`,{className:`parakeet-slash-label`,children:e.label}),(0,Z.jsx)(`span`,{className:`parakeet-slash-detail`,children:e.detail}),e.keys===void 0||e.keys.length===0?null:(0,Z.jsx)(`kbd`,{className:`parakeet-slash-keys`,children:e.keys})]},e.key))})]})})}var M6={unchecked:`M3.25 5.9 L5.1 7.9 L8.8 3.8`,checked:`M3.25 5.9 L5.1 7.9 L8.8 3.8`,mixed:`M3.4 6 L6 6 L8.6 6`},N6={blurStdDeviation:.22,alphaSlope:18,alphaIntercept:-8};function P6({state:e}){let t=`caps-checkbox-${(0,G.useId)().replaceAll(`:`,``)}`,n=(0,G.useRef)(null),r=(0,G.useRef)(e).current,i=(0,G.useRef)(e),a=$R();return(0,G.useLayoutEffect)(()=>{if(!n.current)return;let t=e!==`unchecked`,r=i.current!==`unchecked`,o=a||i.current===e;i.current=e;let s=BR(n.current),c=fH(s,{ease:`inCubic`,duration:160}),l=UV(n.current,{d:{to:M6[e],...o?uH:fH(s,{ease:`outCubic`,duration:200})},"stroke-dashoffset":{to:+!t,...o?uH:t?fH(s,{ease:`inOutSine`,duration:260}):c},"stroke-width":o?{to:t?2.4:0,duration:0}:t&&!r?[{to:2.2,...fH(s,{ease:`outCubic`,duration:65})},{to:2.4,delay:WR(s,120),...dH(s,{bounce:.35,duration:220})}]:{to:t?2.4:0,...c}});return()=>{l.cancel()}},[e,a]),(0,Z.jsxs)(`svg`,{className:`caps-checkbox-visual`,width:`24`,height:`24`,viewBox:`0 0 12 12`,"aria-hidden":`true`,focusable:`false`,children:[(0,Z.jsxs)(`defs`,{children:[(0,Z.jsx)(YV,{id:`${t}-surface`,transform:`matrix(1 0 0 1 6 6)`}),(0,Z.jsx)(XV,{id:`${t}-shadow`}),(0,Z.jsx)(ZV,{id:`${t}-inset`}),(0,Z.jsx)($V,{id:`${t}-goo`,values:N6}),(0,Z.jsxs)(`filter`,{id:`${t}-relief`,x:`-25%`,y:`-25%`,width:`150%`,height:`150%`,colorInterpolationFilters:`sRGB`,children:[(0,Z.jsx)(`feGaussianBlur`,{in:`SourceAlpha`,stdDeviation:`0.28`,result:`relief`}),(0,Z.jsx)(`feSpecularLighting`,{in:`relief`,surfaceScale:`1.2`,specularConstant:`0.55`,specularExponent:`18`,lightingColor:`color-mix(in srgb, var(--color-white) calc(var(--depth) * 100%), var(--color-black))`,result:`light`,children:(0,Z.jsx)(`feDistantLight`,{azimuth:`225`,elevation:`55`})}),(0,Z.jsx)(`feComposite`,{in:`light`,in2:`SourceAlpha`,operator:`in`,result:`clipped-light`}),(0,Z.jsx)(`feBlend`,{in:`SourceGraphic`,in2:`clipped-light`,mode:`screen`})]}),(0,Z.jsx)(`mask`,{id:`${t}-contour`,maskUnits:`userSpaceOnUse`,x:`0`,y:`0`,width:`12`,height:`12`,style:{maskType:`alpha`},children:(0,Z.jsx)(`path`,{ref:n,d:M6[r],fill:`none`,stroke:`var(--color-white)`,strokeWidth:r===`unchecked`?0:2.4,pathLength:`1`,strokeDasharray:`1`,strokeDashoffset:+(r===`unchecked`),strokeLinecap:`round`,strokeLinejoin:`round`,filter:e===`mixed`?void 0:`url(#${t}-goo)`})}),(0,Z.jsx)(`clipPath`,{id:`${t}-well`,children:(0,Z.jsx)(`rect`,{x:`1`,y:`1`,width:`10`,height:`10`,rx:`2.5`})})]}),(0,Z.jsx)(`rect`,{className:`caps-checkbox-track`,x:`0.5`,y:`0.5`,width:`11`,height:`11`,rx:`3`,filter:`url(#${t}-inset)`}),(0,Z.jsx)(`g`,{clipPath:`url(#${t}-well)`,children:(0,Z.jsx)(`g`,{filter:`url(#${t}-shadow)`,children:(0,Z.jsx)(`g`,{filter:`url(#${t}-relief)`,children:(0,Z.jsx)(`g`,{mask:`url(#${t}-contour)`,children:(0,Z.jsx)(`rect`,{x:`0`,y:`0`,width:`12`,height:`12`,fill:`url(#${t}-surface)`})})})})})]})}var F6=(0,G.forwardRef)(function({className:e,appearance:t,indicator:n,invalid:r,indeterminate:i=!1,checked:a,defaultChecked:o=!1,onChange:s,...c},l){let u=(0,G.useRef)(null),[d,f]=(0,G.useState)(o),p=a??d,m=i?`mixed`:p?`checked`:`unchecked`;return(0,G.useImperativeHandle)(l,()=>{if(!u.current)throw Error(`Checkbox input is not mounted`);return u.current},[]),(0,G.useLayoutEffect)(()=>{u.current&&(u.current.indeterminate=i)},[i]),(0,G.useEffect)(()=>{let e=u.current?.form;if(!e||a!==void 0)return;let t=e=>{queueMicrotask(()=>{!e.defaultPrevented&&u.current&&f(o)})};return e.addEventListener(`reset`,t),()=>{e.removeEventListener(`reset`,t)}},[a,o,c.form]),(0,Z.jsxs)(`span`,{className:`caps-checkbox`,"data-appearance":t===`compact`?t:void 0,"data-state":m,"data-custom-indicator":n!==void 0||void 0,children:[(0,Z.jsx)(`input`,{...c,checked:p,"aria-checked":i?`mixed`:p,"aria-invalid":r?!0:c[`aria-invalid`]===!1?void 0:c[`aria-invalid`],className:Q(`caps-checkbox-input`,e),onChange:e=>{a===void 0&&f(e.target.checked),s?.(e),e.currentTarget.indeterminate=i},ref:u,type:`checkbox`}),n===void 0?(0,Z.jsx)(P6,{state:m}):n]})}),I6=`data-glide-stand-in`;function L6(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 R6(e){return{transform:`translate(${String(e.x)}px, ${String(e.y)}px)`,width:`${String(e.width)}px`,height:`${String(e.height)}px`}}function z6(e){let t=(0,G.useRef)(null);return(0,G.useCallback)(n=>{t.current?.(),t.current=n?B6(n,e):null},[e])}function B6(e,t){if(!JR(e))return()=>void 0;let n=e.ownerDocument,r=e.querySelector(t),i=r?L6(e,r):null,a=null,o=null,s=new Set,c=()=>{for(let e of s)e.removeAttribute(I6);s.clear(),a&&(a.hidden=!0),o=null},l=()=>{if(a)return a;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`),a=t,t},u=(t,n)=>{let r=BR(e),u=L6(e,t),d=o&&a?L6(e,a):i;if(i=u,o?.cancel(),c(),r.reduced||d===null||Math.abs(d.y-u.y)<1&&Math.abs(d.x-u.x)<1)return;t.setAttribute(I6,`measure`);let f=getComputedStyle(t),p=f.backgroundColor,m=f.borderRadius;for(let e of[t,n])e&&(e.setAttribute(I6,``),s.add(e));let h=l();h.hidden=!1,h.style.backgroundColor=p,h.style.borderRadius=m;let g=h.animate([R6(d),R6(u)],{duration:r.normal,easing:qR(r,r.ease),fill:`forwards`});o=g,g.addEventListener(`finish`,()=>{o===g&&c()})},d=()=>{let n=e.querySelector(t);if(n===r)return;let i=r;r=n,n&&u(n,i)},f=new MutationObserver(d);return f.observe(e,{subtree:!0,attributes:!0,attributeFilter:[`data-highlighted`,`data-active`,`data-navigation`,`aria-selected`]}),e.addEventListener(`pointerover`,d),e.addEventListener(`pointerout`,d),()=>{f.disconnect(),e.removeEventListener(`pointerover`,d),e.removeEventListener(`pointerout`,d),o?.cancel(),c(),a?.remove()}}function V6({controlled:e,default:t,name:n,state:r=`value`}){let{current:i}=G.useRef(e!==void 0),[a,o]=G.useState(()=>t);return[i&&e!==void 0?e:a,G.useCallback(e=>{i||o(e)},[])]}var H6=aL(`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`}}),U6=(0,G.forwardRef)(function({className:e,density:t,featured:n=!1,state:r,variant:i,...a},o){return(0,Z.jsx)(`div`,{...a,className:Q(H6({density:t,variant:i}),n&&`caps-card-featured`,e),"data-state":r,ref:o})});(0,G.forwardRef)(function({className:e,density:t,variant:n,width:r=`default`,...i},a){return(0,Z.jsx)(`main`,{className:`caps-centered-card-stage`,children:(0,Z.jsx)(U6,{...i,className:Q(`caps-centered-card`,r===`wide`&&`caps-centered-card-wide`,e),ref:a,variant:n??`surface`,...t?{density:t}:{}})})}),(0,G.forwardRef)(function({alignment:e=`start`,className:t,...n},r){return(0,Z.jsx)(`div`,{...n,className:Q(`caps-card-header`,e===`center`&&`caps-card-header-centered`,t),ref:r})}),(0,G.forwardRef)(function({className:e,level:t=3,...n},r){return(0,Z.jsx)(t===2?`h2`:`h3`,{...n,className:Q(`caps-card-title`,e),ref:r})}),(0,G.forwardRef)(function({className:e,...t},n){return(0,Z.jsx)(`p`,{...t,className:Q(`caps-card-description`,e),ref:n})}),(0,G.forwardRef)(function({className:e,...t},n){return(0,Z.jsx)(`div`,{...t,className:Q(`caps-card-content`,e),ref:n})}),(0,G.forwardRef)(function({className:e,...t},n){return(0,Z.jsx)(`div`,{...t,className:Q(`caps-card-footer`,e),ref:n})});var W6=(0,G.forwardRef)(function({action:e,attachments:t,className:n,input:r,toolbar:i,...a},o){return(0,Z.jsxs)(`div`,{...a,ref:o,className:Q(`caps-composer`,n),children:[t===void 0?null:(0,Z.jsx)(`div`,{className:`caps-composer-attachments`,children:t}),(0,Z.jsx)(`div`,{className:`caps-composer-input`,children:r}),i===void 0&&e===void 0?null:(0,Z.jsxs)(`div`,{className:`caps-composer-bar`,children:[(0,Z.jsx)(`div`,{className:`caps-composer-toolbar`,children:i}),e]})]})});function G6({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 K6({attachments:e,action:t,children:n,className:r,input:i,menu:a,row:o,...s}){return(0,Z.jsxs)(b6,{className:`parakeet-composer-anchor`,children:[a,(0,Z.jsxs)(U6,{...s,className:Q(`parakeet-composer-shell`,r),children:[(0,Z.jsx)(W6,{action:t,attachments:e,input:i,toolbar:o===void 0?void 0:(0,Z.jsx)(C6,{className:`parakeet-composer-row`,align:`start`,items:o.items,openId:o.openId,onOpenChange:o.onOpenChange,renderTrigger:({children:e,...t})=>(0,Z.jsx)(zJ,{...t,label:e,expanded:t[`aria-expanded`]===!0}),leading:o.controls,trailing:(0,Z.jsxs)(`span`,{className:`parakeet-composer-trailing`,children:[o.status,o.readout==null?null:(0,Z.jsx)(`span`,{className:`parakeet-composer-readout`,children:o.readout}),(0,Z.jsx)(`span`,{className:`parakeet-composer-action`,children:o.action})]})})}),n]})]})}var q6=G.createContext(void 0);function J6(e){let t=G.useContext(q6);if(t===void 0&&!e)throw Error(nY(33));return t}var Y6=G.createContext(void 0);function X6(e){let t=G.useContext(Y6);if(t===void 0&&!e)throw Error(nY(36));return t}var Z6=G.createContext(void 0);function Q6(e=!0){let t=G.useContext(Z6);if(t===void 0&&!e)throw Error(nY(25));return t}var $6=G.createContext(null);function e8(e=`root`){let t=G.useContext($6),n=G.useContext(Y6);return t===null||n===void 0?null:(e===`submenu-trigger`?n.virtualFocus||n.parentVirtualFocus:n.virtualFocus)?t:null}var t8={visible:!0,ref:null};function n8(){return t8}function r8(e,t,n=`root`){let r=e8(n),i=((n===`submenu-trigger`?r?.useSubmenuTrigger:r?.useItem)??n8)({label:e.label,children:e.children,render:e.render}),a=aY(t,i.ref);return{visible:i.visible,ref:a,props:i.props}}var i8=G.createContext(void 0);function a8(){let e=G.useContext(i8);if(e===void 0)throw Error(nY(30));return e}function o8(e){e.preventDefault()}function s8(e){let{closeOnClick:t,highlighted:n,id:r,nodeId:i,store:a,typingRef:o,itemRef:s,itemMetadata:c}=e,l=X6(),u=Q6(!0),d=c.type===`submenu-trigger`,f=d?l.parentVirtualFocus:l.virtualFocus,p=(d&&l.parent.type===`menu`?l.parent.store:l.store).useState(`webkitAriaSelected`,n),{events:m}=a.useState(`floatingTreeRoot`),h=a.useState(`open`),g=u!==void 0,_=!f&&h&&n?0:-1;return G.useMemo(()=>({id:r,role:`menuitem`,tabIndex:_,"aria-selected":p,onMouseDown:f?o8:void 0,onKeyDown(e){e.key===` `&&o?.current&&e.preventDefault()},onMouseMove(e){i&&m.emit(`itemhover`,{nodeId:i,target:e.currentTarget})},onClick(e){t&&m.emit(`close`,{domEvent:e.nativeEvent,reason:o0})},onMouseUp(e){if(u){let t=u.initialCursorPointRef.current;if(u.initialCursorPointRef.current=null,g&&t&&Math.abs(e.clientX-t.x)<=1&&Math.abs(e.clientY-t.y)<=1||g&&!IX&&e.button===2)return}s.current&&a.context.allowMouseUpTriggerRef.current&&(!g||e.button===2)&&c.type===`regular-item`&&Y1(s.current,e,{detail:1,pointerType:`mouse`})}}),[t,_,r,m,i,a.context.allowMouseUpTriggerRef,o,s,u,g,c.type,p,f])}var c8={type:`regular-item`};function l8(e){let{closeOnClick:t,disabled:n,highlighted:r,id:i,store:a,typingRef:o=a.context.typingRef,nativeButton:s,itemMetadata:c,nodeId:l}=e,u=G.useRef(null),{getButtonProps:d,buttonRef:f}=X1({disabled:n,focusableWhenDisabled:!0,native:s,composite:!0}),p=s8({closeOnClick:t,highlighted:r,id:i,nodeId:l,store:a,typingRef:o,itemRef:u,itemMetadata:c}),m=G.useCallback(e=>yY(p,{onMouseEnter(e){c.type===`submenu-trigger`&&c.setActive(e.nativeEvent)}},e,d),[p,d,c]),h=aY(u,f);return G.useMemo(()=>({getItemProps:m,itemRef:h}),[m,h])}var u8=G.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},nextIndexRef:{current:0}});function d8(){return G.useContext(u8)}function f8(e={}){let{guess:t,label:n,metadata:r,textRef:i,index:a}=e,{register:o,unregister:s,subscribeMapChange:c,nextIndexRef:l}=d8(),u=G.useRef(-1),[d,f]=G.useState(a==null&&t?()=>{if(u.current===-1){let e=l.current;l.current+=1,u.current=e}return u.current}:-1),p=a??d,m=G.useRef(null),h=G.useCallback(e=>{let t=m.current;t&&s(t),m.current=e,e&&o(e,{metadata:r??null,index:a??null,label:n,textRef:i})},[a,o,s,r,n,i]);return $(()=>{if(a==null)return c(e=>{let t=m.current?e.get(m.current)?.index:null;t!=null&&f(t)})},[a,c]),{ref:h,index:p}}var p8=`data-checked`,m8=`data-unchecked`,h8={checked(e){return e?{[p8]:``}:{[m8]:``}},...tZ},g8=G.forwardRef(function(e,t){let{render:n,className:r,id:i,label:a,nativeButton:o=!1,disabled:s=!1,closeOnClick:c=!1,checked:l=!1,onCheckedChange:u,style:d,...f}=e,{store:p}=X6(),m=f8({guess:!0,label:a}),h=qY(i),g=p.useState(`disabled`),_=p.useState(`isActive`,m.index),v=p.useState(`floatingNodeId`),y=p.useState(`itemProps`),b=s||g,{getItemProps:x,itemRef:S}=l8({closeOnClick:c,disabled:b,highlighted:_,id:h,store:p,nativeButton:o,nodeId:v,itemMetadata:c8}),C=G.useMemo(()=>({disabled:b,highlighted:_,checked:l}),[b,_,l]);function w(e){let t=$1(o0,e.nativeEvent,void 0,{preventUnmountOnClose:JJ});u?.(!l,t)}let T=MY(`div`,e,{state:C,stateAttributesMapping:h8,props:[y,{role:`menuitemcheckbox`,"aria-checked":l,onClick:w},f,x],ref:[S,t,m.ref]});return(0,Z.jsx)(i8.Provider,{value:C,children:T})}),_8=G.forwardRef(function(e,t){let{checked:n,defaultChecked:r,onCheckedChange:i,...a}=e,[o,s]=V6({controlled:n,default:r??!1,name:`MenuCheckboxItem`,state:`checked`}),c=r8(e,t);function l(e,t){i?.(e,t),t.isCanceled||s(e)}return c.visible?(0,Z.jsx)(g8,{...a,checked:o,onCheckedChange:l,ref:c.ref}):null}),v8=G.forwardRef(function(e,t){let{render:n,className:r,style:i,keepMounted:a=!1,...o}=e,s=a8(),c=G.useRef(null),{transitionStatus:l,mounted:u,setMounted:d}=T2(s.checked);return k2({batch:!0,enabled:!s.checked,open:s.checked,ref:c,onComplete(){s.checked||d(!1)}}),MY(`span`,e,{state:{checked:s.checked,disabled:s.disabled,highlighted:s.highlighted,transitionStatus:l},ref:[t,c],stateAttributesMapping:h8,props:{"aria-hidden":!0,...o},enabled:a||u})}),y8=G.createContext(void 0);function b8(){let e=G.useContext(y8);if(e===void 0)throw Error(nY(31));return e}var x8=G.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,[o,s]=G.useState(void 0),c=MY(`div`,e,{ref:t,props:{role:`group`,"aria-labelledby":o,...a}});return(0,Z.jsx)(y8.Provider,{value:s,children:c})}),S8=G.forwardRef(function(e,t){let n=e8()?.Group??x8;return(0,Z.jsx)(n,{...e,ref:t})}),C8=G.forwardRef(function(e,t){let{render:n,className:r,style:i,id:a,...o}=e,s=qY(a),c=b8();return $(()=>(c(s),()=>{c(e=>e===s?void 0:e)}),[c,s]),MY(`div`,e,{ref:t,props:{id:s,"aria-hidden":!0,...o}})}),w8=G.forwardRef(function(e,t){let{render:n,className:r,id:i,label:a,nativeButton:o=!1,disabled:s=!1,closeOnClick:c=!0,style:l,...u}=e,{store:d}=X6(),f=f8({guess:!0,label:a}),p=qY(i),m=d.useState(`disabled`),h=d.useState(`isActive`,f.index),g=d.useState(`floatingNodeId`),_=d.useState(`itemProps`),v=s||m,{getItemProps:y,itemRef:b}=l8({closeOnClick:c,disabled:v,highlighted:h,id:p,store:d,nativeButton:o,nodeId:g,itemMetadata:c8});return MY(`div`,e,{state:{disabled:v,highlighted:h},props:[_,u,y],ref:[b,t,f.ref]})}),T8=G.forwardRef(function(e,t){let n=r8(e,t);return n.visible?(0,Z.jsx)(w8,{...e,ref:n.ref}):null}),E8=G.createContext(void 0);function D8(e){let t=G.useContext(E8);if(t===void 0&&!e)throw Error(nY(69));return t}function O8(e){return e===`starting`?G0:XJ}var k8=G.createContext(void 0);function A8(){return G.useContext(k8)}function j8(e,t){let n=IY(e.render);if(G.isValidElement(n)){let e=n.props;if(Object.hasOwn(e,`id`))return e.id??``}return e.id??t}function M8(e,t,n){let r=j8(e,t),i=r===t?void 0:r;return[r,G.useCallback(e=>n?.(e?i:void 0),[i,n])]}function N8(e,t,n){let r=IY(e.render),i=G.isValidElement(r)?r.props:void 0,a=e[`aria-label`]??i?.[`aria-label`],o=e[`aria-labelledby`]??i?.[`aria-labelledby`];return o==null&&!a&&(o=t?t.id||void 0:n||void 0),o}var P8=G.forwardRef(function(e,t){let{render:n,className:r,style:i,finalFocus:a,id:o,initialFocus:s,...c}=e,{store:l,defaultFloatingId:u,setRenderedFloatingId:d,virtualFocus:f,orientation:p}=X6(),m=A8(),{side:h,align:g}=J6(),_=D8(!0)!=null,v=l.useState(`open`),y=l.useState(`transitionStatus`),b=l.useState(`popupProps`),x=l.useState(`mounted`),S=l.useState(`instantType`),C=l.useState(`activeTriggerElement`),w=l.useState(`parent`),T=l.useState(`lastOpenChangeReason`),E=l.useState(`rootId`),D=l.useState(`floatingRootContext`),O=l.useState(`floatingTreeRoot`),k=l.useState(`closeDelay`),A=l.useState(`hoverEnabled`),j=l.useState(`disabled`),M=l.useState(`openMethod`),N=l.useState(`activeTriggerId`),P=l.useState(`listElement`),[F,I]=M8(e,u,d),L=N8(e,C,N),R=w.type===`menu`?m:void 0,z=w.type===`context-menu`,ee=s??w.type!==`menu`;s===void 0&&P&&w.type!==`menu`&&(ee=()=>l.state.activeIndex===null&&P),k2({open:v,ref:l.context.popupRef,onComplete(){v&&l.context.onOpenChangeComplete?.(!0)}}),G.useEffect(()=>{function e(e){l.setOpen(!1,$1(e.reason,e.domEvent))}return O.events.on(`close`,e),()=>{O.events.off(`close`,e)}},[O.events,l]),C4(D,{enabled:A&&!j&&!z&&w.type!==`menubar`,closeDelay:k});let te=l.useStateSetter(`popupElement`),{parentVirtualFocusRef:B,handleFocus:ne}=(G.useContext($6)?.useParentHandoff??I8)(l,w,v,f),re=MY(`div`,e,{state:{transitionStatus:y,side:h,align:g,open:v,nested:w.type===`menu`,instant:S},ref:[t,l.context.popupRef,te,I],stateAttributesMapping:_Z,props:[b,{id:F,...P?{role:`presentation`}:{role:`menu`,"aria-orientation":p===`horizontal`?`horizontal`:void 0,"aria-labelledby":L},onKeyDown(e){R?.onPopupKeyDown?.(e),_&&G3.has(e.key)&&e.stopPropagation()},onFocus:ne},O8(y),c,{"data-rootownerid":E}]}),V=w.type===void 0||z;(C||w.type===`menubar`&&T!==`outside-press`)&&(V=!0);let H=R?.getReturnElement??B;return(0,Z.jsx)(y2,{context:D,openInteractionType:M,modal:z,disabled:!x,returnFocus:a??H??V,explicitReturnFocus:a===void 0&&H?!1:void 0,initialFocus:ee,restoreFocus:!0,getInsideElements:w.type===void 0?()=>[l.context.beforeTriggerFocusGuardRef.current]:void 0,externalTree:w.type===`menubar`?void 0:O,previousFocusableElement:C,nextFocusableElement:w.type===void 0?l.context.triggerFocusTargetRef:void 0,beforeContentFocusGuardRef:l.context.beforeContentFocusGuardRef,children:re})}),F8={parentVirtualFocusRef:void 0,handleFocus:void 0};function I8(){return F8}var L8=G.forwardRef(function(e,t){let n=e8()?.Popup??P8;return(0,Z.jsx)(n,{...e,ref:t})}),R8=G.createContext(void 0);function z8(){let e=G.useContext(R8);if(e===void 0)throw Error(nY(32));return e}var B8=G.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e,{store:i,parent:a}=X6();if(!(i.useState(`mounted`)||n))return null;let o=a.type===`menu`||a.type===`menubar`?`group`:void 0;return(0,Z.jsx)(R8.Provider,{value:n,children:(0,Z.jsx)(e2,{ref:t,...r,portalOwnerRole:o})})});function V8(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`),[l,u]=G.useState(null),d=G.useRef(null),f=o2(n),p=G.useMemo(()=>({reference:i,floating:a,domReference:o}),[i,a,o]),m=z3({...e,elements:{...p,...l&&{reference:l}}}),h=G.useCallback(e=>{let t=sX(e)?{getBoundingClientRect:()=>e.getBoundingClientRect(),getClientRects:()=>e.getClientRects(),contextElement:e}:e;u(t),m.refs.setReference(t)},[m.refs]),g=G.useMemo(()=>({...m.refs,setPositionReference:h,domReference:d}),[m.refs,h]),_=G.useMemo(()=>({...m.elements,domReference:o}),[m.elements,o]),v=G.useMemo(()=>({...m,dataRef:r.context.dataRef,open:s,onOpenChange:r.setOpen,events:r.context.events,floatingId:c,refs:g,elements:_,nodeId:t,rootStore:r}),[m,g,_,t,r,s,c]);return $(()=>{o&&(d.current=o)},[o]),$(()=>{r.context.dataRef.current.floatingContext=v;let e=f?.nodesRef.current.find(e=>e.id===t);e&&(e.context=v)}),G.useMemo(()=>({...m,context:v,refs:g,elements:_,rootStore:r}),[m,g,_,v,r])}var H8=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}=HZ(e,t)||{};if(l==null)return{};let d=oQ(u),f={x:n,y:r},p=JZ(i),m=KZ(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=VZ(D,k,O),j=!c.arrow&&WZ(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}}}),U8=(e,t)=>{let{name:n,fn:r}=H8(e);return{name:n,fn:r,options:[e,t]}},W8={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}}}},G8={sideX:`left`,sideY:`top`},K8=`--available-width`,q8=`--available-height`,J8=`--anchor-width`,Y8=`--anchor-height`,X8=`--transform-origin`,Z8=K8,Q8=q8;function $8(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 e5(e,t,n){let{rects:r,placement:i}=e;return{side:$8(t,UZ(i),n),align:WZ(i)||`center`,anchor:{width:r.reference.width,height:r.reference.height},positioner:{width:r.floating.width,height:r.floating.height}}}function t5(e){return n5(e,V8)}function n5(e,t){let{anchor:n,positionMethod:r=`absolute`,side:i=`bottom`,sideOffset:a=0,align:o=`center`,alignOffset:s=0,collisionBoundary:c,collisionPadding:l=5,sticky:u=!1,arrowPadding:d=5,disableAnchorTracking:f=!1,inline:p,keepMounted:m=!1,floatingRootContext:h,mounted:g,collisionAvoidance:_,shift:v,nodeId:y,adaptiveOrigin:b,lazyFlip:x=!1,externalTree:S}=e,C=_.side||`flip`,w=_.align||`flip`,T=_.fallbackAxisSide||`end`,E=v?.crossAxis??!1,D=v?.rootBoundary,O=typeof n==`function`?n:void 0,k=GJ(O),A=O?k:n,j=S0(n),M=S0(g),N=n$()===`rtl`,[P,F]=G.useState(null);!g&&P!==null&&F(null);let I=x===`placement`,L=P?UZ(P):null,R=P&&I?WZ(P)||`center`:null,z=L||{top:`top`,right:`right`,bottom:`bottom`,left:`left`,"inline-end":N?`left`:`right`,"inline-start":N?`right`:`left`}[i],ee=R||o,te=ee===`center`?z:`${z}-${ee}`,B=l;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 ne=+(i===`bottom`),re=+(i===`top`),V=+(i===`right`),H=+(i===`left`),ie={boundary:c===`clipping-ancestors`?`clippingAncestors`:c,padding:B},ae=G.useRef(null),oe=S0(a),se=S0(s),ce=typeof a==`function`?0:a,le=typeof s==`function`?0:s,ue=[];p&&ue.push(p),ue.push(B3(e=>{let t=e5(e,i,N),n=typeof oe.current==`function`?oe.current(t):oe.current,r=typeof se.current==`function`?se.current(t):se.current;return{mainAxis:n,crossAxis:r,alignmentAxis:r}},[ce,le,N,i]));let de=w===`none`&&C!==`shift`,fe=!de&&(u||E||C===`shift`),pe=C===`none`?null:U3({...ie,padding:{top:B.top+1+ne,right:B.right+1+H,bottom:B.bottom+1+re,left:B.left+1+V},mainAxis:!E&&C===`flip`,crossAxis:w===`flip`&&`alignment`,fallbackAxisSideDirection:T}),me=de?null:V3({...ie,rootBoundary:D,mainAxis:w!==`none`,crossAxis:fe,limiter:u||E?void 0:H3(e=>{if(!ae.current)return{};let{width:t,height:n}=ae.current.getBoundingClientRect(),r=qZ(UZ(e.placement)),i=r===`y`?t:n,a=r===`y`?B.left+B.right:B.top+B.bottom;return{offset:i/2+a/2}})},[ie,u,E,D,B,w]);C===`shift`||w===`shift`||ee===`center`?ue.push(me,pe):ue.push(pe,me),ue.push(W3({...ie,apply({elements:{floating:e},availableWidth:t,availableHeight:n,rects:r}){if(!M.current)return;let i=e.style;i.setProperty(Z8,`${t}px`),i.setProperty(Q8,`${n}px`);let a=iX(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(J8,`${u}px`),i.setProperty(Y8,`${d}px`)}}),U8(e=>({element:ae.current||gQ(e.elements.floating).createElement(`div`),padding:ae.current?d:0}),[d]),{name:`transformOrigin`,fn(e){let{elements:{floating:t},middlewareData:n,placement:r,platform:o,rects:s,y:c}=e,l=UZ(r),u=WZ(r),d=qZ(l)===`y`,f=ae.current,p=typeof a==`function`?a(e5(e,i,N)):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 fe&&d&&Math.abs(n.shift?.y||0)>p&&(h=`${s.reference.y+s.reference.height/2-c}px`),t.style.setProperty(X8,d?`${m} ${h}`:`${h} ${m}`),{}}},W8,b),$(()=>{!g&&h&&h.update({referenceElement:null,floatingElement:null,domReferenceElement:null,positionReference:null})},[g,h]);let he=G.useMemo(()=>({ancestorScroll:!f,elementResize:!f&&typeof ResizeObserver<`u`,layoutShift:!f&&typeof IntersectionObserver<`u`}),[f]),{refs:ge,elements:_e,x:ve,y:ye,middlewareData:be,update:xe,placement:Se,context:Ce,isPositioned:we,floatingStyles:Te}=t({rootContext:h,open:m?g:void 0,placement:te,middleware:ue,strategy:r,whileElementsMounted:m?void 0:(...e)=>D3(...e,he),nodeId:y,externalTree:S}),{sideX:Ee,sideY:De}=be.adaptiveOrigin||G8,Oe=we?r:`fixed`,ke=G.useMemo(()=>{let e;return e=we?b?{position:Oe,[Ee]:ve,[De]:ye}:{...Te,position:Oe}:{position:Oe,top:0,left:0},e[Z8]=`100vw`,e[Q8]=`100vh`,we||(e.opacity=0),e},[b,Oe,Ee,ve,De,ye,Te,we]),Ae=G.useRef(null);$(()=>{if(!g)return;let e=j.current,t=typeof e==`function`?e():e,n=(r5(t)?t.current:t)||null;n!==Ae.current&&(ge.setPositionReference(n),Ae.current=n)},[g,ge,A,j]),G.useEffect(()=>{if(!g)return;let e=j.current;typeof e!=`function`&&r5(e)&&e.current!==Ae.current&&(ge.setPositionReference(e.current),Ae.current=e.current)},[g,ge,A,j]),G.useEffect(()=>{if(m&&g&&_e.reference&&_e.floating)return D3(_e.reference,_e.floating,xe,he)},[m,g,_e,xe,he]);let je=UZ(Se),Me=$8(i,je,N),Ne=WZ(Se)||`center`,Pe=!!be.hide?.referenceHidden;$(()=>{x&&g&&we&&(je!==z||I&&Ne!==ee)&&F(Se)},[x,I,g,we,Se,je,Ne,z,ee]);let Fe=G.useMemo(()=>({position:`absolute`,top:be.arrow?.y,left:be.arrow?.x}),[be.arrow]),Ie=be.arrow?.centerOffset!==0;return G.useMemo(()=>({positionerStyles:ke,arrowStyles:Fe,arrowRef:ae,arrowUncentered:Ie,side:Me,align:Ne,physicalSide:je,anchorHidden:Pe,refs:ge,context:Ce,isPositioned:we,update:xe}),[ke,Fe,ae,Ie,Me,Ne,je,Pe,ge,Ce,we,xe])}function r5(e){return e!=null&&`current`in e}function i5(e){let{children:t,elementsRef:n,labelsRef:r,onMapChange:i}=e,a=GJ(i),[,o]=G.useState(0),s=HJ(o5).current,c=HJ(a5).current,l=G.useRef(0),u=G.useRef(!0),d=G.useRef(null),f=G.useRef(null),p=GJ(()=>{u.current||(u.current=!0,o(e=>e+1))}),m=GJ((e,t)=>{c.set(e,t),p()}),h=GJ(e=>{c.delete(e),p()}),g=GJ(e=>{let t=new Map;return n.current.length=0,r&&(r.current.length=0),e.forEach(e=>{t.set(e.element,{...e.registration.metadata??{},index:e.index}),n.current[e.index]=e.element,r&&(r.current[e.index]=e.registration.label===void 0?e.registration.textRef?.current?.textContent??e.element.textContent:e.registration.label)}),l.current=n.current.length,t});function _(e){if(f.current?.disconnect(),f.current=null,typeof MutationObserver!=`function`||e.length<2)return;let t=new MutationObserver(n=>{if(!l5(n))return;let r=null;for(let n of e)if(n.isConnected){if(r&&u5(r,n)>0){t.disconnect(),p();return}r=n}});f.current=t;let n=new Set;for(let t=1;t<e.length;t+=1){let r=c5(e[t-1],e[t]);r&&n.add(r)}n.forEach(e=>t.observe(e,{childList:!0}))}let v=GJ(()=>{let[e,t]=s5(c),n=g(e),r=d.current,i=!r||r.length!==e.length||e.some((e,t)=>{let n=r[t];return e.index!==n.index||e.element!==n.element||e.registration.index!==n.registration.index||e.registration.metadata!==n.registration.metadata});_(t),d.current=e,u.current=!1,i&&(s.forEach(e=>e(n)),a(n))});$(()=>(!u.current&&d.current&&g(d.current),()=>{n.current=[],r&&(r.current=[])}),[n,r,g]),$(()=>{u.current&&v()}),$(()=>()=>{f.current?.disconnect(),u.current=!0},[]);let y=GJ(e=>(s.add(e),()=>{s.delete(e)})),b=G.useMemo(()=>({register:m,unregister:h,subscribeMapChange:y,nextIndexRef:l}),[m,h,y,l]);return(0,Z.jsx)(u8.Provider,{value:b,children:t})}function a5(){return new Map}function o5(){return new Set}function s5(e){let t=new Set,n=[],r=[];e.forEach((e,i)=>{if(!i.isConnected)return;let a=e.index,o={index:a??-1,element:i,registration:e};a===null?r.push(o):a>=0&&(t.add(a),n.push(o))});let i=0;return r.sort((e,t)=>u5(e.element,t.element)),r.forEach(e=>{for(;t.has(i);)i+=1;e.index=i,n.push(e),i+=1}),t.size>0&&n.sort((e,t)=>e.index-t.index),[n,r.map(e=>e.element)]}function c5(e,t){let n=e.parentElement;for(;n&&!n.contains(t);)n=n.parentElement;return n}function l5(e){for(let t of e)for(let e=0;e<t.removedNodes.length;e+=1)if(t.removedNodes[e].isConnected)return!0;return!1}function u5(e,t){return e.nextElementSibling===t?-1:t.nextElementSibling===e?1:e.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1}function d5(e){let{store:t,domReference:n,positionerElement:r,open:i}=e,a=G.useRef(null),o=G.useRef(null),s=O2(r);$(()=>{i||(o.current?.abort(),o.current=null,t.state.instantType===`trigger-change`&&t.set(`instantType`,void 0))},[i,t]),$(()=>{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 f5(e,t,{styles:n,transitionStatus:r,props:i,refs:a,hidden:o,inert:s=!1}){let c={...n};return s&&(c.pointerEvents=`none`),MY(`div`,e,{state:t,ref:a,props:[{role:`presentation`,hidden:o,style:c},O8(r),i],stateAttributesMapping:gZ})}var p5=20;function m5(e,t,n,r){let[i,a]=G.useState(!1);$(()=>{if(!e||!t||n==null){a(!1);return}let r=gQ(n).documentElement.clientWidth,i=n.offsetWidth;a(r>0&&i>0&&i>=r-p5)},[e,t,n]),i6(e&&(!t||i),r)}var h5=G.forwardRef(function(e,t){let{anchor:n,positionMethod:r=`absolute`,className:i,render:a,side:o,align:s,sideOffset:c=0,alignOffset:l=0,collisionBoundary:u=`clipping-ancestors`,collisionPadding:d=5,arrowPadding:f=5,sticky:p=!1,disableAnchorTracking:m=!1,collisionAvoidance:h=q0,style:g,..._}=e,{store:v,virtualFocus:y,syncHighlightedItem:b}=X6(),x=z8(),S=Q6(!0),C=v.useState(`parent`),w=v.useState(`floatingRootContext`),T=v.useState(`floatingTreeRoot`),E=v.useState(`mounted`),D=v.useState(`open`),O=v.useState(`modal`),k=v.useState(`openMethod`),A=v.useState(`activeTriggerElement`),j=v.useState(`transitionStatus`),M=v.useState(`positionerElement`),N=v.useState(`instantType`),P=v.useState(`adaptiveOrigin`),F=v.useState(`lastOpenChangeReason`),I=v.useState(`floatingNodeId`),L=v.useState(`floatingParentNodeId`),R=w.useState(`domReferenceElement`),z=n,ee=c,te=l,B=s,ne=h;C.type===`context-menu`&&(z=n??C.context?.anchor,B??=`start`,!o&&B!==`center`&&(te=e.alignOffset??2,ee=e.sideOffset??-5));let re=o,V=B;C.type===`menu`?(re??=`inline-end`,V??=`start`,ne=e.collisionAvoidance??J0):C.type===`menubar`&&(re??=C.context.orientation===`vertical`?`inline-end`:`bottom`,V??=`start`);let H=C.type===`context-menu`,ie=t5({anchor:z,floatingRootContext:w,positionMethod:S?`fixed`:r,mounted:E,side:re,sideOffset:ee,align:V,alignOffset:te,arrowPadding:H?0:f,collisionBoundary:u,collisionPadding:d,sticky:p,nodeId:I,keepMounted:x,disableAnchorTracking:m,collisionAvoidance:ne,shift:H?{crossAxis:!(`side`in ne&&ne.side===`flip`),rootBoundary:`layoutViewport`}:void 0,externalTree:T,adaptiveOrigin:P,lazyFlip:y?`placement`:!1});G.useEffect(()=>{function e(e){e.open&&(e.parentNodeId===I&&v.set(`hoverEnabled`,!1),e.nodeId!==I&&e.parentNodeId===v.select(`floatingParentNodeId`)&&v.setOpen(!1,$1(m0)))}return T.events.on(`menuopenchange`,e),()=>{T.events.off(`menuopenchange`,e)}},[v,T.events,I]),G.useEffect(()=>{if(v.select(`floatingParentNodeId`)==null)return;function e(e){if(e.open||e.nodeId!==v.select(`floatingParentNodeId`))return;let t=e.reason??`sibling-open`;v.setOpen(!1,$1(t))}return T.events.on(`menuopenchange`,e),()=>{T.events.off(`menuopenchange`,e)}},[T.events,v]);let ae=eY();G.useEffect(()=>{D||ae.clear()},[D,ae]),G.useEffect(()=>{function e(e){if(!(!D||e.nodeId!==v.select(`floatingParentNodeId`))){if(e.target&&A&&A!==e.target){let e=v.select(`closeDelay`);e>0?ae.isStarted()||ae.start(e,()=>{v.setOpen(!1,$1(m0))}):v.setOpen(!1,$1(m0))}else ae.clear()}}return T.events.on(`itemhover`,e),()=>{T.events.off(`itemhover`,e)}},[T.events,D,A,v,ae]),G.useEffect(()=>{let e={open:D,nodeId:I,parentNodeId:L,reason:v.select(`lastOpenChangeReason`)};T.events.emit(`menuopenchange`,e)},[T.events,D,v,I,L]),d5({store:v,domReference:R,positionerElement:M,open:D});let oe={open:D,side:ie.side,align:ie.align,anchorHidden:ie.anchorHidden,nested:C.type===`menu`,instant:N},se=C.type===`menubar`&&C.context.modal;m5(D&&(se||O&&F!==`trigger-hover`),k===`touch`,M,A);let ce=f5(e,oe,{styles:ie.positionerStyles,transitionStatus:j,props:_,refs:[t,v.useStateSetter(`positionerElement`)],hidden:!E,inert:!D}),le=E&&C.type!==`menu`&&(C.type!==`menubar`&&O&&F!==`trigger-hover`||C.type===`menubar`&&C.context.modal),ue=null;return C.type===`menubar`?ue=C.context.contentElement:C.type===void 0&&(ue=A),(0,Z.jsxs)(q6.Provider,{value:ie,children:[le&&(0,Z.jsx)(q3,{ref:C.type===`context-menu`||C.type===`nested-context-menu`?C.context.internalBackdropRef:null,inert:K3(!D),cutout:ue}),(0,Z.jsx)(c2,{id:I,children:(0,Z.jsx)(i5,{elementsRef:v.context.itemDomElements,labelsRef:v.context.itemLabels,onMapChange:b,children:ce})})]})}),g5=G.createContext(null);function _5(e){let t=G.useContext(g5);if(t===null&&!e)throw Error(nY(5));return t}function v5(e){return e==null?t0:e.type.startsWith(`key`)?d0:e.type.startsWith(`mouse`)||e.type.startsWith(`pointer`)?f0:t0}var y5={...m4,disabled:e=>e.parent.type===`menubar`&&e.parent.context.disabled||e.disabled,modal:e=>(e.parent.type===void 0||e.parent.type===`context-menu`)&&(e.modal??!0),openMethod:e=>e.openMethod,keyboardOpen:e=>e.keyboardOpen,allowMouseEnter:e=>e.allowMouseEnter,highlightItemOnHover:e=>e.highlightItemOnHover,parent:e=>e.parent,rootId:e=>e.parent.type===`menu`?e.parent.store.select(`rootId`):e.parent.type===void 0?e.rootId:e.parent.context.rootId,activeIndex:e=>e.activeIndex,listElement:e=>e.listElement,triggerControlsId:(e,t)=>{let n=m4.triggerPopupId(e,t);return n?e.listElement?.id||n:void 0},filterTriggerProps:e=>e.filterTriggerProps,inputProps:e=>e.inputProps,webkitAriaSelected:(e,t)=>RX&&e.inputFocused&&t?!0:void 0,highlightedItemId:e=>e.highlightedItem?.id||void 0,isActive:(e,t)=>e.activeIndex===t,hoverEnabled:e=>e.hoverEnabled,instantType:e=>e.instantType===`trigger-change`&&!m4.open(e)?void 0:e.instantType,lastOpenChangeReason:e=>e.openChangeReason,floatingTreeRoot:e=>e.parent.type===`menu`?e.parent.store.select(`floatingTreeRoot`):e.floatingTreeRoot,floatingNodeId:e=>e.floatingNodeId,floatingParentNodeId:e=>e.floatingParentNodeId,itemProps:e=>e.itemProps,closeDelay:e=>e.closeDelay,adaptiveOrigin:e=>e.adaptiveOrigin,keyboardEventRelay:e=>{if(e.keyboardEventRelay)return e.keyboardEventRelay;if(e.parent.type===`menu`)return e.parent.store.select(`keyboardEventRelay`)}},b5=class extends a4{constructor(e,t,n=!1){let r=new W2,i=S5(r,t,n,e);super(i,x5(r),y5),this.observe(`parent`,e=>{e.type===`menu`?this.context.allowMouseUpTriggerRef=e.store.context.allowMouseUpTriggerRef:e.type!==void 0&&(this.context.allowMouseUpTriggerRef=e.context.allowMouseUpTriggerRef)})}subscribeToParentMenu(){let e=this.state.parent;if(e.type!==`menu`)return;let t=e.store.select(`rootId`),n=e.store.select(`floatingTreeRoot`),r=e.store.select(`keyboardEventRelay`);return e.store.subscribe(()=>{let i=e.store.select(`rootId`),a=e.store.select(`floatingTreeRoot`),o=e.store.select(`keyboardEventRelay`);(t!==i||n!==a||r!==o)&&(t=i,n=a,r=o,this.notifyAll())})}setOpen(e,t){this.state.floatingRootContext.context.events.emit(`setOpen`,{open:e,eventDetails:t})}setActiveIndex(e,t,n){if(this.state.activeIndex!==e){let r=(e===null?void 0:this.context.itemDomElements.current[e])===this.context.reportedItem;this.context.highlightReason=r?`none`:t,this.context.highlightEvent=r?void 0:n}this.set(`activeIndex`,e)}highlightItem(e,t,n){let r=this.context.itemDomElements.current.indexOf(e);r>-1&&this.setActiveIndex(r,t,n)}};function x5(e){return{positionerRef:G.createRef(),popupRef:G.createRef(),typingRef:{current:!1},itemDomElements:{current:[]},itemLabels:{current:[]},highlightReason:`none`,highlightEvent:void 0,reportedItem:void 0,allowMouseUpTriggerRef:{current:!1},virtualFocusRef:void 0,triggerFocusTargetRef:G.createRef(),beforeTriggerFocusGuardRef:G.createRef(),beforeContentFocusGuardRef:G.createRef(),onOpenChangeComplete:void 0,triggerElements:e}}function S5(e,t,n=!1,r){return{...c4(e,t,n),disabled:!1,modal:!0,openMethod:null,keyboardOpen:!1,allowMouseEnter:!1,highlightItemOnHover:!0,parent:{type:void 0},rootId:void 0,activeIndex:null,listElement:null,filterTriggerProps:XJ,inputProps:XJ,inputFocused:!1,highlightedItem:void 0,hoverEnabled:!0,instantType:void 0,openChangeReason:null,floatingTreeRoot:new n2,floatingNodeId:void 0,floatingParentNodeId:null,itemProps:XJ,keyboardEventRelay:void 0,closeDelay:0,adaptiveOrigin:void 0,...r}}var C5=G.createContext(null);function w5(e,t){return(e===`trigger-press`||e===`item-press`)&&t?.detail===0}function T5(e,t){return e===`list-navigation`||w5(e,t)}var E5=Y2(function(e){let{children:t,open:n,onOpenChange:r,onOpenChangeComplete:i,onItemHighlighted:a,defaultOpen:o=!1,disabled:s=!1,modal:c,loopFocus:l=!0,orientation:u=`vertical`,actionsRef:d,closeParentOnEsc:f=!1,handle:p,triggerId:m,defaultTriggerId:h=null,highlightItemOnHover:g=!0,isSubmenu:_=!1,virtualFocus:v=!1,virtualFocusRef:y,allowEscape:b=!0,resetOnPointerLeave:x=!0}=e,S=Q6(!0),C=X6(!0),w=_5(!0),T=C?.store,E=C?.virtualFocus??!1,D=G.useMemo(()=>_&&T?{type:`menu`,store:T}:w?{type:`menubar`,context:w}:S&&!T?{type:`context-menu`,context:S}:{type:void 0},[S,T,w,_]),O=qY(),k=qY(),[A,j]=G.useState(void 0),M=(A??k)||void 0,N=a2(),P=D.type===`menu`?D.store:void 0,F=(n??o)&&P?.state.transitionStatus===`starting`,I=HJ(()=>F?P?.state.instantType:void 0).current,L=HJ(()=>{let e=new b5({open:o,openProp:n,activeTriggerId:h,triggerIdProp:m,parent:D,disabled:s,highlightItemOnHover:g,modal:D.type===void 0?c:void 0,rootId:O,instantType:I},M,N!=null);return e.context.virtualFocusRef=y,e}).current;L.useControlledProp(`openProp`,n),L.useControlledProp(`triggerIdProp`,m),L.useContextCallback(`onOpenChangeComplete`,i);let R=L.useState(`floatingTreeRoot`),z=s2(R),ee=L.useState(`open`),te=L.useState(`activeTriggerElement`),B=L.useState(`positionerElement`),ne=L.useState(`hoverEnabled`),re=L.useState(`disabled`),V=L.useState(`lastOpenChangeReason`),H=L.useState(`parent`),ie=L.useState(`activeIndex`),ae=L.useState(`keyboardOpen`),oe=L.useState(`payload`),se=L.useState(`floatingParentNodeId`),ce=G.useRef(null),le=G.useRef(H.type!==`context-menu`),ue=eY(),de=G.useRef(!0),fe=eY(),pe=se!=null,{openMethod:me,triggerProps:he}=c6(ee);L.useSyncedValues({disabled:s,highlightItemOnHover:g,modal:H.type===void 0?c:void 0,openMethod:me,rootId:O}),B2(L);let{forceUnmount:ge,transitionStatus:_e}=V2(ee,L,()=>{L.set(`allowMouseEnter`,!1)},F),ve=O2(L.context.popupRef);G.useEffect(()=>{if(I===void 0)return;let e=()=>{L.state.instantType===I&&L.set(`instantType`,void 0)};if(!ee){e();return}if(_e!==void 0)return;if(L.context.popupRef.current==null){e();return}let t=new AbortController;return ve(e,t.signal),()=>{t.abort()}},[I,ee,_e,ve,L]),$(()=>{S&&!C?L.update({parent:{type:`context-menu`,context:S},floatingNodeId:z,floatingParentNodeId:N}):(C||!L.select(`activeTriggerElement`))&&L.update({floatingNodeId:z,floatingParentNodeId:N})},[S,C,z,N,te,L]),G.useEffect(()=>{if(ee||(ce.current=null),H.type===`context-menu`){if(!ee){ue.clear(),le.current=!1;return}ue.start(500,()=>{le.current=!0})}},[ue,ee,H.type]),$(()=>{!ee&&!ne&&L.set(`hoverEnabled`,!0)},[ee,ne,L]);let ye=GJ((e,t)=>{let n=t.reason;if(!e&&!L.select(`open`)||ee===e&&t.trigger===te&&V===n)return;let i=R2(t);if(!e&&t.trigger==null&&(t.trigger=te??void 0),r?.(e,t),t.isCanceled)return;L.state.floatingRootContext.dispatchOpenChange(e,t);let a=t.event;if(e===!1&&n!==`item-press`&&a?.type===`click`&&a.pointerType===`touch`&&!de.current)return;e&&n===`trigger-focus`?(de.current=!1,fe.start(300,()=>{de.current=!0})):(de.current=!0,fe.clear());let o=!e&&(n===`escape-key`||n==null);ce.current=t.event;let s=L2(L.state,e,t.trigger,i());s.openChangeReason=n,s.keyboardOpen=e&&T5(n,a),s.instantType=H.type===`menubar`&&(n===`trigger-focus`||n===`focus-out`||n===`trigger-hover`||n===`list-navigation`||n===`sibling-open`)?`group`:w5(n,a)?`click`:o?`dismiss`:void 0,L.update(s)}),be=w2({popupStore:L,floatingRootContext:L.state.floatingRootContext,floatingId:M,nested:N!=null,onOpenChange:ye}),xe=be.context.events;$(()=>{let e=({open:e,eventDetails:t})=>ye(e,t);return xe.on(`setOpen`,e),()=>{xe?.off(`setOpen`,e)}},[xe,ye]),$(()=>L.subscribeToParentMenu(),[L]);let Se=G.useCallback(()=>{L.setOpen(!1,$1(h0))},[L]);G.useImperativeHandle(d,()=>({unmount:ge,close:Se}),[ge,Se]);let Ce;H.type===`context-menu`&&(Ce=H.context),G.useImperativeHandle(Ce?.positionerRef,()=>B,[B]),G.useImperativeHandle(Ce?.actionsRef,()=>({setOpen:ye}),[ye]);let we=C2(be,{enabled:!re,bubbles:{escapeKey:f&&H.type===`menu`},outsidePress(){return H.type!==`context-menu`||ce.current?.type===`contextmenu`||le.current},externalTree:pe?R:void 0}),Te=n$(),Ee=M4(be,{enabled:!re,listRef:L.context.itemDomElements,activeIndex:ie,virtual:v,nested:H.type===`menubar`||!v&&H.type!==void 0,parentOrientation:H.type===`menubar`?H.context.orientation:void 0,loopFocus:l,focusItemOnOpen:v?ae:void 0,allowEscape:v&&l&&b,orientation:u,triggerOrientation:v?`vertical`:u,rtl:Te===`rtl`,disabledIndices:YJ,onNavigate(e,t){L.setActiveIndex(e,v5(t),t?.nativeEvent)},openOnArrowKeyDown:H.type!==`context-menu`&&!(v&&_),externalTree:!v&&pe?R:void 0,nestedReturnFocusRef:P?.context.virtualFocusRef,focusItemOnHover:g,resetOnPointerLeave:x}),De=G.useCallback(e=>{L.context.typingRef.current=e},[L]),Oe=N4(be,{enabled:!re&&!v,listRef:L.context.itemLabels,elementsRef:L.context.itemDomElements,activeIndex:ie,resetMs:500,onMatch:(e,t)=>{ee&&e!==ie&&L.setActiveIndex(e,d0,t.nativeEvent)},onTyping:De}),ke=GJ(a),Ae=G.useRef(-1),je=GJ(()=>{let e=L.state.activeIndex,t=e===null?void 0:L.context.itemDomElements.current[e]??void 0;if(t?.isConnected===!1)return;let n=t===void 0?-1:e;if(Ae.current===n&&L.context.reportedItem===t)return;Ae.current=n,L.context.reportedItem=t,v&&L.set(`highlightedItem`,t);let{highlightReason:r,highlightEvent:i}=L.context;L.context.highlightReason=t0,L.context.highlightEvent=void 0,a&&ke(t,e0(r,i,{label:t===void 0?void 0:L.context.itemLabels.current[n]??void 0}))});$(()=>{je()},[ie,je]);let Me=G.useMemo(()=>{if(!v)return Ee.reference;if(!Ee.trigger)return XJ;let{onFocus:e,...t}=Ee.trigger;return t},[v,Ee.reference,Ee.trigger]);L.useSyncedValue(`inputProps`,v?Ee.reference??XJ:XJ);let Ne=G.useMemo(()=>{let e=yY(Oe.reference,Me,we.reference,{onMouseMove(){L.set(`allowMouseEnter`,!0)}},he);return e[`aria-haspopup`]=`menu`,e[`aria-expanded`]=ee,e},[L,Oe.reference,Me,we.reference,he,ee]),Pe=G.useMemo(()=>{let e=yY(Ee.trigger,we.trigger,he);return e[`aria-haspopup`]=`menu`,e[`aria-expanded`]=!1,e},[Ee.trigger,we.trigger,he]);HJ(()=>(L.update({inactiveTriggerProps:Pe}),null)),H2(L,{floatingRootContext:be,activeTriggerProps:Ne,inactiveTriggerProps:Pe,popupProps:G.useMemo(()=>yY(j2,{onMouseMove(){L.set(`allowMouseEnter`,!0),H.type===`menu`&&L.set(`hoverEnabled`,!1)},onClick(){L.select(`hoverEnabled`)&&L.set(`hoverEnabled`,!1)},onKeyDown(e){let t=L.select(`keyboardEventRelay`);t&&!e.isPropagationStopped()&&t(e)}},Oe.floating,Ee.floating,we.floating),[H.type,L,Oe.floating,Ee.floating,we.floating]),itemProps:Ee.item??XJ});let Fe=G.useMemo(()=>({store:L,parent:D,orientation:u,loopFocus:l,allowEscape:b,defaultFloatingId:k,setRenderedFloatingId:j,virtualFocus:v,parentVirtualFocus:E,syncHighlightedItem:je}),[L,D,u,l,b,k,v,E,je]),Ie=typeof t==`function`?t({payload:oe}):t,Le=(0,Z.jsxs)(Y6.Provider,{value:Fe,children:[p&&(0,Z.jsx)(P2,{handle:p,store:L}),Ie]});return(H.type===void 0||H.type===`context-menu`)&&(Le=(0,Z.jsx)(l2,{externalTree:R,children:Le})),Le});function D5(e){let t=G.useContext(C5);if(t===null)return(0,Z.jsx)(E5,{...e});let n=t.Root;return(0,Z.jsx)(C5.Provider,{value:null,children:(0,Z.jsx)(n,{...t.options,...e})})}var O5=5;function k5(e,t){let n=A5(t);return e.clientX>=n.left-O5&&e.clientX<=n.right+O5&&e.clientY>=n.top-O5&&e.clientY<=n.bottom+O5}function A5(e){let t=e.getBoundingClientRect(),n=iX(e);if(BX)return t;let r=n.getComputedStyle(e,`::before`),i=n.getComputedStyle(e,`::after`);if(r.content===`none`&&i.content===`none`)return t;let a=parseFloat(r.width)||0,o=parseFloat(r.height)||0,s=parseFloat(i.width)||0,c=parseFloat(i.height)||0,l=Math.max(t.width,a,s),u=Math.max(t.height,o,c),d=l-t.width,f=u-t.height;return{left:t.left-d/2,right:t.right+d/2,top:t.top-f/2,bottom:t.bottom+f/2}}function j5(e={}){let{highlightItemOnHover:t,highlightedIndex:n,onHighlightedIndexChange:r}=q1(),{ref:i,index:a}=f8(e),o=n===a,s=G.useRef(null),c=aY(i,s);return{compositeProps:{tabIndex:o?0:-1,onFocus(){r(a)},onMouseMove(){let e=s.current;if(!t||!e)return;let n=e.hasAttribute(`disabled`)||e.ariaDisabled===`true`;!o&&!n&&e.focus()}},compositeRef:c,index:a}}function M5(e){let{render:t,className:n,style:r,state:i=XJ,props:a=YJ,refs:o=YJ,metadata:s,stateAttributesMapping:c,tag:l=`div`,...u}=e,{compositeProps:d,compositeRef:f}=j5({metadata:s});return MY(l,e,{state:i,ref:[f,...o],props:[d,...a,u],stateAttributesMapping:c})}function N5(e){if(cX(e)&&e.hasAttribute(`data-rootownerid`))return e.getAttribute(`data-rootownerid`);if(!bX(e))return N5(CX(e))}function P5(e,t){function n(n,r,i){let a=n.currentTarget;WF.flushSync(()=>{e.setOpen(!1,$1(c0,n.nativeEvent,a))}),IQ(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&&LQ(t,r)?e.context.beforeContentFocusGuardRef.current?.focus():n(t,1,r)}return{handlePreFocusGuardFocus:r,handleFocusTargetFocus:i}}function F5(e){let{enabled:t=!0,mouseDownAction:n,open:r}=e,i=G.useRef(!1);return G.useMemo(()=>t?{onMouseDown:e=>{(n===`open`&&!r||n===`close`&&r)&&(i.current=!0,gQ(e.currentTarget).addEventListener(`click`,()=>{i.current=!1},{once:!0}))},onClick:e=>{i.current&&(i.current=!1,e.preventBaseUIHandler())}}:XJ,[t,n,r])}var I5=X2(function(e,t){let{render:n,className:r,style:i,disabled:a=!1,nativeButton:o=!0,id:s,openOnHover:c,delay:l=100,closeDelay:u=0,handle:d,payload:f,...p}=e,m=X6(!0),h=h4(d)??m?.store;if(!h)throw Error(nY(85));let g=qY(s),_=h.useState(`isTriggerActive`,g),v=h.useState(`floatingRootContext`),y=h.useState(`isOpenedByTrigger`,g),b=h.useState(`triggerControlsId`,g),x=G.useRef(null),S=R5(),C=q1(!0),w=o2(),T=G.useMemo(()=>w??new n2,[w]),{registerTrigger:E,isMountedByThisTrigger:D}=z2(g,x,h,{payload:f,closeDelay:u,parent:S,floatingTreeRoot:T,floatingNodeId:s2(T),floatingParentNodeId:a2(),keyboardEventRelay:C?.relayKeyboardEvent}),O=S.type===`menubar`,k=h.useState(`disabled`),A=a||k||O&&S.context.disabled,{getButtonProps:j,buttonRef:M}=X1({disabled:A,native:o});G.useEffect(()=>{!y&&S.type===void 0&&(h.context.allowMouseUpTriggerRef.current=!1)},[h,y,S.type]);let N=G.useRef(null),P=eY(),F=GJ(e=>{if(!N.current)return;P.clear(),h.context.allowMouseUpTriggerRef.current=!1;let t=e.target;HX(N.current,t)||HX(h.select(`positionerElement`),t)||t===N.current||(t==null||N5(t)!==h.select(`rootId`))&&(k5(e,N.current)||T.events.emit(`close`,{domEvent:e,reason:p0}))});G.useEffect(()=>{let e=gQ(N.current);if(y&&h.select(`lastOpenChangeReason`)===`trigger-hover`)return e.addEventListener(`mouseup`,F,{once:!0}),()=>{e.removeEventListener(`mouseup`,F)}},[y,F,h]);let I=O&&S.context.hasSubmenuOpen,L=T4(v,{enabled:(c??I)&&!A&&(!O||I&&!D),handleClose:V4({blockPointerEvents:!O}),mouseOnly:!0,move:!1,restMs:S.type===void 0?l:void 0,delay:{close:u},triggerElementRef:x,externalTree:T,isActiveTrigger:_,isClosing:()=>h.select(`transitionStatus`)===`ending`}),R=L5(y,h.select(`lastOpenChangeReason`)),z=b2(v,{enabled:!A,event:y&&O?`click`:`mousedown`,toggle:!0,ignoreMouse:!1,stickIfOpen:S.type===void 0&&R}),ee=_4(v,{enabled:!A&&I}),te=F5({open:y,enabled:O,mouseDownAction:`open`}),B=G.useMemo(()=>yY(ee.reference,z.reference),[ee.reference,z.reference]),ne=h.useState(`triggerProps`,D),re=h.useState(`filterTriggerProps`),{handlePreFocusGuardFocus:V,handleFocusTargetFocus:H}=P5(h,x),ie={disabled:A,open:y},ae=[N,t,M,E,x],oe=[B,L??XJ,ne,{"aria-haspopup":`menu`,"aria-controls":b,id:g,onMouseDown:e=>{h.select(`open`)||(P.start(200,()=>{h.context.allowMouseUpTriggerRef.current=!0}),gQ(e.currentTarget).addEventListener(`mouseup`,F,{once:!0}))}},re,O?{role:`menuitem`}:{},te,p,j],se=MY(`button`,e,{enabled:!O,stateAttributesMapping:hZ,state:ie,ref:ae,props:oe});return O?(0,Z.jsx)(M5,{tag:`button`,render:n,className:r,style:i,state:ie,refs:ae,props:oe,stateAttributesMapping:hZ}):y?(0,Z.jsxs)(G.Fragment,{children:[(0,Z.jsx)(A0,{ref:h.context.beforeTriggerFocusGuardRef,onFocus:V},`${g}-pre-focus-guard`),(0,Z.jsx)(G.Fragment,{children:se},g),(0,Z.jsx)(A0,{ref:h.context.triggerFocusTargetRef,onFocus:H},`${g}-post-focus-guard`)]}):(0,Z.jsx)(G.Fragment,{children:se},g)});function L5(e,t){let n=eY(),[r,i]=G.useState(!1);return $(()=>{e&&t===`trigger-hover`?(i(!0),n.start(500,()=>{i(!1)})):e||(n.clear(),i(!1))},[e,t,n]),r}function R5(){let e=_5(!0);return G.useMemo(()=>e?{type:`menubar`,context:e}:{type:void 0},[e])}var z5=G.forwardRef(function(e,t){let{className:n,render:r,orientation:i=`horizontal`,style:a,...o}=e;return MY(`div`,e,{state:{orientation:i},ref:t,props:[{role:`separator`,"aria-orientation":i},o]})}),B5=(0,G.createContext)(null);function V5({actionsRef:e,children:t,interactionOwner:n=`local`,onOpenChange:r,...i}){let a=(0,G.useRef)(null),o=e??a;return DH(()=>o.current?.close()),(0,Z.jsx)(B5.Provider,{value:{actionsRef:o,interactionOwner:n},children:(0,Z.jsx)(D5,{...i,actionsRef:o,onOpenChange:(e,t)=>{if(n===`host`&&!e&&t.reason===`escape-key`){t.cancel(),t.allowPropagation();return}r?.(e,t)},children:t})})}function H5(){let e=(0,G.useContext)(B5);if(!e)throw Error(`DropdownMenu parts must be used inside <DropdownMenu>`);return e}var U5=(0,G.forwardRef)(function({className:e,render:t,type:n=`button`,...r},i){return(0,Z.jsx)(I5,{...r,className:t=>Q(`btn caps-dropdown-trigger`,jR(e,t)),ref:i,render:t,type:n})}),W5=(0,G.forwardRef)(function({container:e,...t},n){let r=EH(`popover`);return e==null&&r===null?null:(0,Z.jsx)(B8,{...t,container:e??r,ref:n})}),G5=(0,G.forwardRef)(function({collisionBoundary:e,...t},n){let r=EH(`popover`);return(0,Z.jsx)(h5,{...t,collisionBoundary:e??(r&&r!==document.body?r:void 0),ref:n})}),K5=(0,G.forwardRef)(function({className:e,finalFocus:t,...n},r){let{interactionOwner:i}=H5(),a=(0,G.useRef)(null);(0,G.useImperativeHandle)(r,()=>a.current);let o=z6(`.caps-dropdown-item[data-highlighted]`),s=(0,G.useCallback)(e=>{a.current=e,o(e)},[o]);return(0,Z.jsx)(L8,{...n,className:t=>Q(`caps-dropdown-popup min-w-40 rounded-box border border-base-300 bg-base-100 p-xs shadow-lg outline-none`,jR(e,t)),finalFocus:i===`host`?!1:t??!0,ref:s})}),q5=(0,G.forwardRef)(function({align:e=`end`,alignOffset:t,children:n,container:r,keepMounted:i,side:a=`bottom`,sideOffset:o=4,...s},c){return(0,Z.jsx)(W5,{container:r,keepMounted:i,children:(0,Z.jsx)(G5,{align:e,alignOffset:t,side:a,sideOffset:o,children:(0,Z.jsx)(K5,{...s,ref:c,children:n})})})}),J5=`caps-dropdown-item flex min-h-2xl w-full items-center gap-sm rounded-field px-md py-xs text-left text-sm outline-none transition-colors hover:bg-base-200 focus-visible:bg-base-200 aria-[current=page]:bg-base-200 aria-[current=page]:font-semibold disabled:cursor-not-allowed disabled:text-base-content/40 data-disabled:cursor-not-allowed data-disabled:text-base-content/40`,Y5=(0,G.forwardRef)(function({className:e,onClick:t,onSelect:n,variant:r=`default`,...i},a){return(0,Z.jsx)(T8,{...i,className:t=>Q(J5,r===`destructive`&&`text-error hover:bg-error hover:text-error-content focus-visible:bg-error focus-visible:text-error-content`,jR(e,t)),onClick:e=>{t?.(e),e.defaultPrevented||n?.(e)},ref:a})}),X5=(0,G.forwardRef)(function({children:e,className:t,onClick:n,onSelect:r,...i},a){return(0,Z.jsxs)(_8,{...i,className:e=>Q(J5,jR(t,e)),onClick:e=>{n?.(e),e.defaultPrevented||r?.(e)},ref:a,children:[(0,Z.jsx)(`span`,{className:`min-w-0 flex-1`,children:e}),(0,Z.jsx)(v8,{"aria-hidden":`true`,className:`shrink-0`,children:`✓`})]})}),Z5=(0,G.forwardRef)(function({className:e,...t},n){return(0,Z.jsx)(z5,{...t,className:t=>Q(`my-xs h-px bg-base-300`,jR(e,t)),ref:n})}),Q5=S8,$5=(0,G.forwardRef)(function({className:e,...t},n){return(0,Z.jsx)(C8,{...t,className:t=>Q(`px-md pb-xs pt-sm text-xs font-semibold text-base-content/60`,jR(e,t)),ref:n})});function e7(e){return e?.closest(`[data-app-pane="media"]`)??e}function t7(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 n7(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 r7(e,t=64){let n=await new OfflineAudioContext(1,1,44100).decodeAudioData(e);return{peaks:n7(Array.from({length:n.numberOfChannels},(e,t)=>n.getChannelData(t)),t),durationSeconds:n.duration}}var i7=new Map;async function a7(e,t){let n=await fetch(e);if(!n.ok)throw Error(`audio responded ${String(n.status)}`);return r7(await n.arrayBuffer(),t)}function o7(e,t){let n=`${String(t)}:${e}`,r=i7.get(n);if(r!==void 0)return r;let i=a7(e,t).catch(e=>{throw i7.delete(n),e});return i7.set(n,i),i}function s7(e,t=64){let[n,r]=(0,G.useState)({status:`loading`});return(0,G.useEffect)(()=>{if(e===``){r({status:`failed`});return}let n=!0;return r({status:`loading`}),o7(e,t).then(e=>{n&&r({status:`ready`,...e})},e=>{oW(`decode-audio-waveform`,e),n&&r({status:`failed`})}),()=>{n=!1}},[e,t]),n}var c7={voice:`Voice`,sfx:`Sound effects`,music:`Music`};function l7(e){return e.audio.mode===`speech`?`voice`:`music`}function u7(e){return e.flatMap(e=>e.audio===null?[]:[{id:e.id,label:e.label,audio:e.audio}])}function d7(e){return e.audio===null?null:e.audio.mode===`speech`?`voice`:`music`}function f7(e){let t=new Set(e.map(l7));return[`voice`,`sfx`,`music`].filter(e=>t.has(e))}function p7(e,t){return e.filter(e=>l7(e)===t)}function m7({modes:e,value:t,onChange:n,disabled:r=!1}){return(0,Z.jsx)(x1,{className:`prints-audio-modes`,value:t,onValueChange:t=>{let r=e.find(e=>e===t);r!==void 0&&n(r)},children:(0,Z.jsx)(C1,{"aria-label":`Audio type`,className:`prints-audio-modes-list`,variant:`segmented`,children:e.map(e=>(0,Z.jsx)(w1,{"data-audio-mode":e,disabled:r,value:e,children:c7[e]},e))})})}function h7({label:e,name:t,options:n,value:r,disabled:i,onChange:a,icon:o,compact:s=!1}){let[c,l]=(0,G.useState)(null);return(0,Z.jsx)(`span`,{className:`contents`,ref:l,children:(0,Z.jsxs)(V5,{children:[(0,Z.jsx)(U5,{"aria-label":t,disabled:i||n.length===0,render:(t,n)=>(0,Z.jsx)(zJ,{...t,className:Q(`parakeet-composer-model-key`,s&&`prints-audio-key-compact`),expanded:n.open,icon:o,label:e,readout:(0,Z.jsx)(jI,{"aria-hidden":`true`,className:`size-[var(--stipe-icon-size-sm)] shrink-0`})})}),(0,Z.jsx)(q5,{align:`start`,"aria-label":t,container:e7(c),side:`top`,children:n.map(e=>(0,Z.jsx)(X5,{checked:e.value===r,closeOnClick:!0,onSelect:()=>{a(e.value)},children:e.label},String(e.value)))})]})})}function g7({models:e,value:t,onChange:n,disabled:r=!1}){let i=e.find(e=>e.id===t);return(0,Z.jsx)(h7,{disabled:r,label:i===void 0?`Model`:eG(i),name:`Generation model`,onChange:n,options:e.map(e=>({value:e.id,label:e.label})),value:t})}function _7({voices:e,value:t,onChange:n,disabled:r=!1}){let i=e.find(e=>e.id===t);return(0,Z.jsx)(h7,{disabled:r,compact:!0,icon:(0,Z.jsx)(WI,{}),label:i?.label??`Voice`,name:`Voice`,onChange:n,options:e.map(e=>({value:e.id,label:e.label})),value:t})}var v7=[10,15,30,60,90,120,180,300,600];function y7(e){let t=v7.filter(t=>t>=e.min&&t<=e.max);return[...new Set([...t,e.default])].sort((e,t)=>e-t)}function b7({seconds:e,value:t,onChange:n,disabled:r=!1}){return(0,Z.jsx)(h7,{disabled:r,compact:!0,icon:(0,Z.jsx)(NI,{}),label:t7(t),name:`Length`,onChange:n,options:y7(e).map(e=>({value:e,label:t7(e)})),value:t})}var x7=1e5;function S7(e){return!Number.isFinite(e)||e<=0?null:v6(e/x7)}var C7={draft:`Draft`,balanced:`Balanced`,premium:`Premium`,max:`Max`};function w7(e){if(e.kind!==`video`||e.video===null)return C7[e.tier];let t=Math.min(...e.video.prices.map(e=>e.silentMilliunitsPerSecond)),n=Number.isFinite(t)?S7(t):null;return n===null?`Video`:`Video · from ${n}/s`}var T7=[{kind:`image`,label:`Images`},{kind:`video`,label:`Video`}];function E7(e){let t=()=>{e.scrollHeight-e.scrollTop-e.clientHeight>1?e.setAttribute(`data-more`,``):e.removeAttribute(`data-more`)};t();let n=requestAnimationFrame(t);return e.addEventListener(`scroll`,t,{passive:!0}),()=>{cancelAnimationFrame(n),e.removeEventListener(`scroll`,t)}}function D7({compact:e=!1,disabled:t,emptyLabel:n,models:r,onChange:i,value:a}){let o=r.find(e=>e.id===a),[s,c]=(0,G.useState)(null);(0,G.useEffect)(()=>{if(s!==null)return E7(s)},[s]);let[l,u]=(0,G.useState)(null);return(0,Z.jsx)(`span`,{className:`contents`,ref:u,children:(0,Z.jsxs)(V5,{children:[(0,Z.jsx)(U5,{"aria-label":`Generation model`,"data-generation-model":a,disabled:t||r.length===0,render:(t,r)=>{let i=o===void 0?n:eG(o);return e?(0,Z.jsx)(zJ,{...t,className:`parakeet-composer-model-key`,expanded:r.open,icon:(0,Z.jsx)(PI,{}),label:null,readout:(0,Z.jsx)(jI,{"aria-hidden":`true`,className:`size-[var(--stipe-icon-size-sm)] shrink-0`}),title:i}):(0,Z.jsx)(y6,{...t,expanded:r.open,label:i})}}),(0,Z.jsx)(q5,{ref:c,"data-generation-model-menu":!0,container:e7(l),side:`top`,align:`start`,"aria-label":`Generation models`,children:T7.map((e,t)=>{let n=r.filter(t=>t.kind===e.kind);return n.length===0?null:(0,Z.jsxs)(Q5,{children:[t>0?(0,Z.jsx)(Z5,{}):null,(0,Z.jsx)($5,{children:e.label}),n.map(e=>(0,Z.jsx)(X5,{"data-generation-model-option":e.id,checked:e.id===a,closeOnClick:!0,onSelect:()=>{i(e.id)},children:(0,Z.jsxs)(`span`,{className:`prints-model-row flex items-baseline gap-lg`,children:[(0,Z.jsx)(`span`,{className:`min-w-0 flex-1`,children:eG(e)}),(0,Z.jsx)(`span`,{className:`prints-model-detail`,children:w7(e)})]})},e.id))]},e.kind)})})]})})}var O7={kind:`folder`,folder:void 0};function k7(e){let t=ON(e),n=(0,G.useRef)(e);n.current=e;let r=vC(),i=Uw(DK(e)),a=Xw(dU(e,i.data?.configured?{kind:`folder`,path:i.data.path}:null)),o=`${t??``}:${i.data?.path??``}`,[s,c]=(0,G.useState)({scope:o,view:O7}),l=s.scope===o?s.view:O7,u=e=>{c({scope:o,view:e})},[d,f]=(0,G.useState)(null),p=n=>n?.app===e&&n.computerId===t,m=Jw({mutationKey:TK.folder(e),mutationFn:async({owner:e,id:t,path:r,create:i})=>{let a=()=>{if(n.current!==e||e.context.get().computerId!==t)throw new X(`Computer selection changed`,{code:`SELECTION_CHANGED`,retryable:!1})};return a(),i&&await e.capabilities.require(BF).mkdir({path:r}),a(),await zF(e.capabilities,{path:r,limit:1,offset:0}),a(),OG(e.capabilities,t,r)},onSuccess:(e,t)=>{t.owner===n.current&&t.owner.context.get().computerId===t.id&&f(null)},onSettled:(e,t,n)=>Promise.all([r.invalidateQueries({queryKey:n.queryKey,exact:!0}),r.invalidateQueries({queryKey:sU.listing(n.owner,n.path),exact:!0})])}),h=m.variables?.owner===e&&m.variables.id===t,g=i.isFetching||h&&m.isPending,_=async(n,r)=>{if(!e||!t||g)return`Computer selection changed. Try again.`;let i=n.trim();if(!Ux(vU)(i))return`Enter an absolute Computer folder, such as /media.`;try{return await m.mutateAsync({owner:e,id:t,path:i,create:r,queryKey:TK.folder(e)}),null}catch{return`Could not use this folder. Check its location and your Computer permissions.`}},v=i.isError||a.isError,y=v||!i.data?.configured?null:i.data.path,b=y===null?null:l.kind===`folder`?UH(y,l.folder):y,x=y===null?null:l.kind===`folder`?{kind:`folder`,path:b??y}:{kind:l.kind,path:y};return{view:l,setView:u,destination:y,landingPath:b??(v?null:i.data?.path??null),source:x,path:v?null:i.data?.path??null,computerId:t,available:e?.capabilities.has(iP)===!0,writable:e?.capabilities.has(BF)===!0,busy:g,error:v?`Your media folder is unavailable. Choose or create a folder.`:null,editing:p(d),setEditing:n=>{f(n?{app:e,computerId:t}:null)},choose:_,ensureCreated:async()=>i.data?i.data.configured?null:_(i.data.path,!0):`Your Prints library is still loading.`,recheck:()=>{r.invalidateQueries({queryKey:sU.listing(e,i.data?.path??null),exact:!0}),r.invalidateQueries({queryKey:TK.folder(e),exact:!0})}}}var A7={error:0,warning:1,info:2};function j7(e,t){let n=t.generating+t.uploading>0;if(n)return{busy:n,tone:void 0,label:[t.generating?`Creating ${String(t.generating)}`:``,t.uploading?`Uploading ${String(t.uploading)}`:``].filter(Boolean).join(` · `)};let r=[...e].sort((e,t)=>Number(t.blocking??!1)-Number(e.blocking??!1)||A7[e.tone]-A7[t.tone]).at(0);return r?{busy:n,tone:r.tone===`info`?`neutral`:r.tone,label:r.short+(e.length>1?` +${String(e.length-1)}`:``)}:null}function M7(e,t,n){let r=j7(e,t);if(!r)return null;let i={kind:`button`,id:`activity`,text:`Activity`,count:e.length+t.generating+t.uploading,busy:r.busy,title:AE(`Activity: ${r.label}`,1024),opens:`dialog`,expanded:n};return r.tone===void 0?i:{...i,tone:r.tone}}var N7={image:`Image`,video:`Video`,audio:`Audio`,media:`Media`};function P7({connected:e,mediaCapability:t,modelsError:n,retryModels:r,modelsLoading:i,models:a,canGenerate:o,mediaSetupMissing:s,canWrite:c,generationErrors:l,recoveryError:u,pendingGenerations:d,activeGenerations:f,atGenerationLimit:p,gallerySlots:m,computerId:h,failed:g,uploadError:_,uploads:v,permissions:y,resume:b,discard:x,retryUpload:S}){let C=[];if(e)h===null?C.push({key:`no-computer`,group:`Setup`,tone:`info`,blocking:!0,short:`Choose a Computer`,title:`No Computer selected`,detail:`Choose a Computer for this window, or create one in Grove.`}):t?n===null?!i&&!o&&!s&&C.push({key:`approval`,group:`Setup`,tone:`warning`,blocking:!0,short:`Generation not enabled`,title:`Media generation isn’t enabled`,detail:`Turn it on in this App’s Team permissions. Images already generated can still be saved.`,actions:[{label:`Permissions`,run:()=>{y()}}]}):C.push({key:`models:${n}`,group:`Setup`,tone:`warning`,blocking:!0,short:`Models unavailable`,title:`Couldn’t load image models`,detail:n,actions:[{label:`Retry`,run:r}]}):C.push({key:`no-media`,group:`Setup`,tone:`info`,blocking:!0,short:`Image creation off`,title:`Image creation is off for this Computer`,detail:`You can still browse and upload images.`});else{let e=lC(new X(`Prints disconnected`,{code:`DISCONNECTED`,retryable:!0}));C.push({key:`disconnected`,group:`Setup`,tone:`warning`,blocking:!0,short:e.title,title:e.title,detail:e.message})}e&&h!==null&&!c&&C.push({key:`read-only`,group:`Setup`,tone:`info`,blocking:!0,short:`Read-only`,title:`Read-only Computer`,detail:`Uploads and new prints are off.`});for(let e of l){let t=`${N7[e.mediaKind??`media`]} failed`;C.push({key:e.key,group:`Images`,tone:`error`,short:t,title:`${t}: ${e.message}`,detail:e.prompt,blocking:e.dismiss!==void 0,actions:[...e.billing?[{label:`Open Billing`,run:e.billing}]:e.retry?[{label:`Retry`,run:e.retry}]:[],...e.dismiss?[{label:`Dismiss`,run:e.dismiss}]:[]]})}p&&C.push({key:`generation-limit`,group:`Images`,tone:`info`,short:`At the limit`,title:`At the limit`,detail:pW,blocking:!0}),u!==null&&C.push({key:`recovery:${u}`,group:`Images`,tone:`error`,short:`Retry blocked`,title:u});for(let e of d){if(f.has(e.reference.requestId)||m.some(t=>t.computerId===e.reference.computerId&&t.path===e.input.destination.path))continue;let t=`${N7[tG(a,e.input.settings.model)?.kind??`media`]} failed`;C.push({key:`unfinished:${e.reference.requestId}`,group:`Images`,tone:`error`,blocking:!0,short:t,title:`${t}: ${e.failure?.message??`Stopped when Prints closed. Retry to run it again.`}`,detail:e.reference.computerId===h?e.typed.prompt:`${e.typed.prompt} · select the original Computer to retry`,actions:[...e.reference.computerId===h?[{label:`Retry`,run:()=>{b(e)}}]:[],{label:`Dismiss`,run:()=>{x(e)}}]})}g.length>0&&C.push({key:`files:${g.join(`|`)}`,group:`Images`,tone:`error`,short:`Couldn’t open images`,title:`Couldn’t open some images`,detail:g.join(`, `)}),_!==null&&C.push({key:`uploads:${_}`,group:`Uploads`,tone:`error`,short:`Upload failed`,title:`Couldn’t add images`,detail:_});for(let e of v)(e.status===`error`||e.status===`cancelled`)&&C.push({key:`upload:${e.id}:${e.status}`,group:`Uploads`,tone:e.status===`error`?`error`:`info`,short:`Upload failed`,title:`${e.file.name} wasn’t saved`,detail:e.message,actions:[{label:`Retry`,run:()=>{S(e.id)}}]});return C}function F7(e,t){let n=Uw(OK(e)),r=Jw(rP({queryKey:TK.dismissals(e),mutationFn:({owner:e,id:t,keys:n})=>TG(e.capabilities,t,n),apply:(e,t)=>({keys:[...new Set([...e.keys,...t.keys])].slice(-200)})})),i=n=>{e&&t&&n.length>0&&r.mutate({owner:e,id:t,keys:n})};return{error:r.variables?.owner===e&&r.variables.id===t&&r.isError?`Could not dismiss activity. Please try again.`:n.isError?`Could not load dismissed activity. Notices may reappear.`:null,visible:e=>e.filter(e=>(e.blocking??!1)||!n.data?.keys.includes(e.key)),dismiss:e=>{i([e])},dismissAll:e=>{i(e.filter(e=>!e.blocking).map(e=>e.key).slice(-200))}}}var I7=0,L7=1,R7=2,z7=0,B7=1;function V7(e,t,n){let r=e.list,i;for(;r;){if(r.index===n)return!1;if(t>r.high)break;i=r,r=r.next}return i||(e.list={index:n,high:t,next:r}),i&&(i.next={index:n,high:t,next:i.next}),!0}function H7(e,t){let n=e.list;if(n.index===t)return n.next===null?z7:(e.list=n.next,B7);let r=n;for(n=n.next;n!==null;){if(n.index===t)return r.next=n.next,B7;r=n,n=n.next}}var U7={low:0,max:0,high:0,C:R7,P:void 0,R:void 0,L:void 0,list:void 0};U7.P=U7,U7.L=U7,U7.R=U7;function W7(e){let t=e.high;e.max=e.L===U7&&e.R===U7?t:e.L===U7?Math.max(e.R.max,t):e.R===U7?Math.max(e.L.max,t):Math.max(Math.max(e.L.max,e.R.max),t)}function G7(e){let t=e;for(;t.P!==U7;)W7(t.P),t=t.P}function K7(e,t){if(t.R===U7)return;let n=t.R;t.R=n.L,n.L!==U7&&(n.L.P=t),n.P=t.P,t.P===U7?e.root=n:t===t.P.L?t.P.L=n:t.P.R=n,n.L=t,t.P=n,W7(t),W7(n)}function q7(e,t){if(t.L===U7)return;let n=t.L;t.L=n.R,n.R!==U7&&(n.R.P=t),n.P=t.P,t.P===U7?e.root=n:t===t.P.R?t.P.R=n:t.P.L=n,n.R=t,t.P=n,W7(t),W7(n)}function J7(e,t,n){t.P===U7?e.root=n:t===t.P.L?t.P.L=n:t.P.R=n,n.P=t.P}function Y7(e,t){let n;for(;t!==U7&&t.C===L7;)t===t.P.L?(n=t.P.R,n.C===I7&&(n.C=L7,t.P.C=I7,K7(e,t.P),n=t.P.R),n.L.C===L7&&n.R.C===L7?(n.C=I7,t=t.P):(n.R.C===L7&&(n.L.C=L7,n.C=I7,q7(e,n),n=t.P.R),n.C=t.P.C,t.P.C=L7,n.R.C=L7,K7(e,t.P),t=e.root)):(n=t.P.L,n.C===I7&&(n.C=L7,t.P.C=I7,q7(e,t.P),n=t.P.L),n.R.C===L7&&n.L.C===L7?(n.C=I7,t=t.P):(n.L.C===L7&&(n.R.C=L7,n.C=I7,K7(e,n),n=t.P.L),n.C=t.P.C,t.P.C=L7,n.L.C=L7,q7(e,t.P),t=e.root));t.C=L7}function X7(e){for(;e.L!==U7;)e=e.L;return e}function Z7(e,t){let n;for(;t.P.C===I7;)t.P===t.P.P.L?(n=t.P.P.R,n.C===I7?(t.P.C=L7,n.C=L7,t.P.P.C=I7,t=t.P.P):(t===t.P.R&&(t=t.P,K7(e,t)),t.P.C=L7,t.P.P.C=I7,q7(e,t.P.P))):(n=t.P.P.L,n.C===I7?(t.P.C=L7,n.C=L7,t.P.P.C=I7,t=t.P.P):(t===t.P.L&&(t=t.P,q7(e,t)),t.P.C=L7,t.P.P.C=I7,K7(e,t.P.P)));e.root.C=L7}function Q7(){let e={root:U7,size:0},t={};return{insert(n,r,i){let a=e.root,o=U7;for(;a!==U7&&(o=a,n!==o.low);)a=n<a.low?a.L:a.R;if(n===o.low&&o!==U7){if(!V7(o,r,i))return;o.high=Math.max(o.high,r),W7(o),G7(o),t[i]=o,e.size++;return}let s={low:n,high:r,max:r,C:I7,P:o,L:U7,R:U7,list:{index:i,high:r,next:null}};o===U7?e.root=s:(s.low<o.low?o.L=s:o.R=s,G7(s)),Z7(e,s),t[i]=s,e.size++},remove(n){let r=t[n];if(r===void 0)return;delete t[n];let i=H7(r,n);if(i===void 0)return;if(i===B7){r.high=r.list.high,W7(r),G7(r),e.size--;return}let a=r,o=a.C,s;r.L===U7?(s=r.R,J7(e,r,r.R)):r.R===U7?(s=r.L,J7(e,r,r.L)):(a=X7(r.R),o=a.C,s=a.R,a.P===r?s.P=a:(J7(e,a,a.R),a.R=r.R,a.R.P=a),J7(e,r,a),a.L=r.L,a.L.P=a,a.C=r.C),W7(s),G7(s),o===L7&&Y7(e,s),e.size--},search(t,n,r){let i=[e.root];for(;i.length!==0;){let e=i.pop();if(!(e===U7||t>e.max)&&(e.L!==U7&&i.push(e.L),e.R!==U7&&i.push(e.R),e.low<=n&&e.high>=t)){let n=e.list;for(;n!==null;)n.high>=t&&r(n.index,e.low),n=n.next}}},get size(){return e.size}}}var $7=e=>{let t=G.useRef(e);return G.useEffect(()=>{t.current=e}),t},e9=(e,t)=>{let n=t||t9,r,i;return function(){return r&&n(arguments,r)?i:i=e.apply(null,r=arguments)}},t9=(e,t)=>e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3],n9=class{constructor(){this.set=void 0,this.get=void 0;let e,t;this.get=n=>n===e?t:void 0,this.set=(n,r)=>{e=n,t=r}}},r9=e=>{try{return new e}catch{let e={};return{set(t,n){e[t]=n},get(t){return e[t]}}}},i9=e=>{let t=e.length,n=r9(e[0]),r,i,a,o,s=t===1;return t<3?{g:e=>(r=n.get(e[0]))===void 0||s?r:r.get(e[1]),s:(t,a)=>(s?n.set(t[0],a):(r=n.get(t[0]))===void 0?(i=r9(e[1]),i.set(t[1],a),n.set(t[0],i)):r.set(t[1],a),a)}:{g:e=>{for(o=n,a=0;a<t;a++)if((o=o.get(e[a]))===void 0)return;return o},s:(r,s)=>{for(o=n,a=0;a<t-1;a++)(i=o.get(r[a]))===void 0?(i=r9(e[a+1]),o.set(r[a],i),o=i):o=i;return o.set(r[t-1],s),s}}},a9=(e,t)=>{let n,{g:r,s:i}=i9(e);return function(){return(n=r(arguments))===void 0?i(arguments,t.apply(null,arguments)):n}},o9=new WeakMap;function s9(){let e=G.useState(c9)[1];return G.useRef(()=>e({})).current}var c9={},l9=G.createElement;function u9(e){let{positioner:t,resizeObserver:n,items:r,as:i=`div`,id:a,className:o,style:s,role:c=`grid`,tabIndex:l=0,containerRef:u,itemAs:d=`div`,itemStyle:f,itemHeightEstimate:p=300,itemKey:m=g9,overscanBy:h=2,scrollTop:g,isScrolling:_,height:v,render:y,onRender:b}=e,x=0,S,C=s9(),w=v9(t,n),T=r.length,{columnWidth:E,columnCount:D,range:O,estimateHeight:k,size:A,shortestColumn:j}=t,M=A(),N=j(),P=[],F=c===`list`?`listitem`:c===`grid`?`gridcell`:void 0,I=$7(b);h=v*h;let L=g+h,R=N<L&&M<T;if(O(Math.max(0,g-h/2),L,(e,t,n)=>{let i=r[e],a=m(i,e),o={top:n,left:t,width:E,writingMode:`horizontal-tb`,position:`absolute`};P.push(l9(d,{key:a,ref:w(e),role:F,style:typeof f==`object`&&f?Object.assign({},o,f):o},f9(y,e,i,E))),S===void 0?(x=e,S=e):(x=Math.min(x,e),S=Math.max(S,e))}),R){let e=Math.min(T-M,Math.ceil((g+h-N)/p*D)),t=M,n=_9(E);for(;t<M+e;t++){let e=r[t],i=m(e,t);P.push(l9(d,{key:i,ref:w(t),role:F,style:typeof f==`object`?Object.assign({},n,f):n},f9(y,t,e,E)))}}G.useEffect(()=>{typeof I.current==`function`&&S!==void 0&&I.current(x,S,r),d9=`1`},[x,S,r,I]),G.useEffect(()=>{R&&C()},[R,t]);let z=p9(_,k(T,p));return l9(i,{ref:u,key:d9,id:a,role:c,className:o,tabIndex:l,style:typeof s==`object`?h9(z,s):z,children:P})}var d9=`0`,f9=a9([n9,{},WeakMap,n9],(e,t,n,r)=>l9(e,{index:t,data:n,width:r})),p9=e9((e,t)=>({position:`relative`,width:`100%`,maxWidth:`100%`,height:Math.ceil(t),maxHeight:Math.ceil(t),willChange:e?`contents`:void 0,pointerEvents:e?`none`:void 0})),m9=(e,t)=>e[0]===t[0]&&e[1]===t[1],h9=e9((e,t)=>Object.assign({},e,t),m9);function g9(e,t){return t}var _9=e9(e=>({width:e,zIndex:-1e3,visibility:`hidden`,position:`absolute`,writingMode:`horizontal-tb`}),(e,t)=>e[0]===t[0]),v9=e9((e,t)=>n=>r=>{r!==null&&(t&&(t.observe(r),o9.set(r,n)),e.get(n)===void 0&&e.set(n,r.offsetHeight))},m9),y9=function(e,t,n,r){n===void 0&&(n=0),r===void 0&&(r=n);let i=Q7(),a=Array(e),o=[],s=Array(e);for(let t=0;t<e;t++)a[t]=0,s[t]=[];return{columnCount:e,columnWidth:t,set:function(e,c){c===void 0&&(c=0);let l=0;for(let e=1;e<a.length;e++)a[e]<a[l]&&(l=e);let u=a[l]||0;a[l]=u+c+r,s[l].push(e),o[e]={left:l*(t+n),top:u,height:c,column:l},i.insert(u,u+c,e)},get:e=>o[e],update:t=>{let n=Array(e),c=0,l=0;for(;c<t.length-1;c++){let e=t[c],r=o[e];r.height=t[++c],i.remove(e),i.insert(r.top,r.top+r.height,e),n[r.column]=n[r.column]===void 0?e:Math.min(e,n[r.column])}for(c=0;c<n.length;c++){if(n[c]===void 0)continue;let e=s[c],t=b9(e,n[c]),u=s[c][t],d=o[u];for(a[c]=d.top+d.height+r,l=t+1;l<e.length;l++){let t=e[l],n=o[t];n.top=a[c],a[c]=n.top+n.height+r,i.remove(t),i.insert(n.top,n.top+n.height,t)}}},range:(e,t,n)=>i.search(e,t,(e,t)=>n(e,o[e].left,t)),estimateHeight:(t,n)=>{let r=Math.max(0,Math.max.apply(null,a));return t===i.size?r:r+Math.ceil((t-i.size)/e)*n},shortestColumn:()=>a.length>1?Math.min.apply(null,a):a[0]||0,size(){return i.size},all(){return o}}},b9=(e,t)=>{let n=0,r=e.length-1;for(;n<=r;){let i=n+r>>>1,a=e[i];if(a===t)return i;a<=t?n=i+1:r=i-1}return-1},x9={queued:`Waiting to start`,generating:`Generating`,refining:`Refining`,done:void 0,failed:void 0},S9=(0,G.forwardRef)(function({status:e,children:t,aspectRatio:n,label:r,indicator:i,failure:a,className:o,style:s,...c},l){let u=(0,G.useRef)(null);(0,G.useImperativeHandle)(l,()=>u.current);let d=(0,G.useRef)(e),[f,p]=(0,G.useState)(!1),[m,h]=(0,G.useState)(e);m!==e&&(h(e),p(e===`done`)),(0,G.useLayoutEffect)(()=>{let t=u.current,n=d.current;if(d.current=e,!t||n===e)return;if(!JR(t)){p(!1);return}let r=BR(t),i=qR(r,r.ease),a=[],o=t.querySelector(`:scope > [data-layer="media"]`),s=t.querySelector(`:scope > [data-layer="placeholder"]`),c=t.querySelector(`:scope > [data-layer="failure"]`);if(e===`done`&&o){let e=o.animate(r.reduced?[{opacity:0},{opacity:1}]:[{opacity:0,filter:`blur(10px)`,transform:`scale(1.03)`},{opacity:1,filter:`blur(0px)`,transform:`none`}],{duration:r.reduced?r.fast:r.slow*2,easing:i,fill:`backwards`});e.addEventListener(`finish`,()=>{p(!1)}),a.push(e),s&&a.push(s.animate([{opacity:1},{opacity:0}],{duration:r.reduced?r.fast:r.slow,easing:i,fill:`forwards`}))}return e===`failed`&&c&&a.push(c.animate([{opacity:0,transform:`translateY(${String(r.distance)}px)`},{opacity:1,transform:`none`}],{duration:r.normal,easing:i})),n===`failed`&&s&&a.push(s.animate([{opacity:.4},{opacity:1}],{duration:r.normal,easing:i})),()=>{for(let e of a)e.cancel()}},[e]);let g=e===`queued`||e===`generating`||e===`refining`,_=r??x9[e],v=e===`done`||e===`refining`;return(0,Z.jsxs)(`div`,{...c,ref:u,className:Q(`caps-generation-frame`,o),"data-status":e,"data-aspect":n===void 0?void 0:``,"aria-busy":g,style:n===void 0?s:{aspectRatio:n,...s},children:[e===`done`&&!f?null:(0,Z.jsxs)(`div`,{className:Q(`caps-generation-placeholder`,e===`queued`&&`skeleton`),"data-layer":`placeholder`,role:e===`done`?void 0:`status`,"aria-hidden":e===`done`||void 0,children:[e===`generating`||e===`refining`||e===`done`?i??(0,Z.jsx)(lH,{decorative:!0,size:`lg`,variant:`bloom`}):null,_===void 0?null:(0,Z.jsx)(LR,{children:_})]}),v?(0,Z.jsx)(`div`,{className:`caps-generation-media`,"data-layer":`media`,children:t}):null,e===`failed`&&a!==void 0?(0,Z.jsx)(`div`,{className:`caps-generation-failure`,"data-layer":`failure`,role:`alert`,children:a}):null]})}),C9=null;function w9(e,t){let n=(0,G.useRef)(null),r=(0,G.useRef)(t);r.current=t;let[i,a]=(0,G.useState)(!1),[o,s]=(0,G.useState)(0);(0,G.useEffect)(()=>()=>{let e=n.current;e!==null&&(e.pause(),C9===e&&(C9=null),n.current=null)},[e]),(0,G.useEffect)(()=>{if(!i)return;let e=0,t=()=>{let r=n.current;r!==null&&r.duration>0&&s(Math.min(1,r.currentTime/r.duration)),e=requestAnimationFrame(t)};return e=requestAnimationFrame(t),()=>{cancelAnimationFrame(e)}},[i]);let c=(0,G.useCallback)(()=>{if(n.current!==null)return n.current;let t=new Audio(e);return t.preload=`auto`,t.addEventListener(`ended`,()=>{a(!1),s(0),C9===t&&(C9=null)}),t.addEventListener(`pause`,()=>{a(!1)}),t.addEventListener(`error`,()=>{a(!1),r.current(`This audio could not be played.`)}),n.current=t,t},[e]);return{playing:i,progress:o,toggle:(0,G.useCallback)(()=>{let e=c();if(!e.paused){e.pause();return}C9!==null&&C9!==e&&C9.pause(),C9=e,a(!0),e.play().catch(e=>{oW(`play-audio`,e),a(!1),r.current(`This audio could not be played.`)})},[c]),seek:(0,G.useCallback)(e=>{let t=c();Number.isFinite(t.duration)&&t.duration>0&&(t.currentTime=Math.min(1,Math.max(0,e))*t.duration,s(Math.min(1,Math.max(0,e))))},[c])}}function T9({url:e,progress:t=0,bars:n=64,className:r}){let i=s7(e,n),a=i.status===`ready`?i.peaks:null;return(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:Q(`prints-waveform`,r),"data-waveform":i.status,children:Array.from({length:n},(e,r)=>(0,Z.jsx)(`span`,{className:`prints-waveform-bar`,"data-played":r/n<t?``:void 0,style:{height:`max(2px, ${String((a?.[r]??0)*100)}%)`}},r))})}var E9=(0,G.createContext)(null);function D9(){let e=(0,G.useContext)(E9);if(e===null)throw Error(`An audio tile part must sit inside an AudioTileScope`);return e}function O9({url:e,children:t}){let n=w9(e,IH);return(0,Z.jsx)(E9.Provider,{value:n,children:t})}function k9({url:e}){let{progress:t}=D9();return(0,Z.jsx)(`span`,{className:`prints-audio-tile`,children:(0,Z.jsx)(T9,{progress:t,url:e})})}function A9({title:e}){let t=D9();return(0,Z.jsx)(LJ,{"aria-label":`${t.playing?`Pause`:`Play`} ${e}`,className:`prints-audio-tile-play`,icon:t.playing?(0,Z.jsx)(KI,{}):(0,Z.jsx)(qI,{}),iconSize:`sm`,size:`sm`,variant:`accent`,onClick:t.toggle})}var j9=8,M9=320,N9=4,P9=640,F9=656;function bee(e,t){return e<=0||!Number.isFinite(t)||t<=0?0:e===1?1:e<=N9?t<P9?1:e===2||t<F9?2:3:t>=1280?4:t>=F9?3:2}function I9({item:e}){return NH(e.path)?(0,Z.jsx)(k9,{url:e.url}):LH(e.path)?(0,Z.jsx)(`video`,{"aria-label":e.path,className:`block h-full w-full object-cover`,"data-media-thumb":!0,loop:!0,muted:!0,playsInline:!0,src:e.url}):(0,Z.jsx)(`img`,{alt:e.path,className:`block h-full w-full object-cover`,"data-media-thumb":!0,src:e.url})}var L9=(0,G.memo)(function({item:e}){let t=(0,G.useRef)(null);(0,G.useEffect)(()=>{e.onVisible?.()},[e.onVisible]);let[n,r]=(0,G.useState)(e.pending===!0&&!e.onVisible);return e.pending&&!e.onVisible&&!n&&r(!0),(0,G.useLayoutEffect)(()=>{let r=t.current;if(!r||e.pending||n)return;let i=window.matchMedia(`(prefers-reduced-motion: reduce)`);if(i.matches)return;let a=!0,o,s,c=()=>o?.();return R1(async()=>{let{animate:e,spring:t}=await Promise.resolve().then(()=>JV);return{animate:e,spring:t}},void 0,import.meta.url).then(({animate:e,spring:t})=>{if(!a)return;let n=e(r,{opacity:{from:0,to:1,duration:160,ease:`outQuad`},translateY:{from:6,to:0,ease:t({bounce:.16,duration:320})},scale:{from:.985,to:1,ease:t({bounce:.16,duration:320})}});o=()=>{n.complete()},s=()=>{n.revert()}}),i.addEventListener(`change`,c),()=>{a=!1,i.removeEventListener(`change`,c),s?.()}},[e.key,e.pending,n]),(0,Z.jsxs)(`div`,{ref:t,className:`prints-gallery-tile`,"data-referenced":e.referenced?!0:void 0,children:[e.error?(0,Z.jsx)(`div`,{className:`block h-full w-full overflow-hidden bg-base-200`,"data-media-failed":!0,title:e.path,children:(0,Z.jsx)(S9,{status:`failed`,failure:(0,Z.jsxs)(`div`,{className:`flex max-w-full flex-col items-center gap-xs`,children:[e.prompt?(0,Z.jsx)(`p`,{className:`m-0 max-w-full truncate px-md text-xs text-(--stipe-fg-muted)`,children:e.prompt}):null,(0,Z.jsx)(G1,{density:`tile`,message:e.error,onRetry:e.onRetry,onDismiss:e.onDismiss})]})})}):(0,Z.jsx)(`button`,{className:`block h-full w-full overflow-hidden bg-base-200 p-0 text-left`,"data-media-thumb-wrap":!0,type:`button`,disabled:e.pending,"aria-pressed":e.select?.active?e.select.checked:void 0,onClick:()=>{e.select?.active?e.select.onToggle():e.onOpen(e.path)},onKeyDown:t=>{t.key.toLowerCase()===`i`&&!t.ctrlKey&&!t.metaKey&&!t.altKey&&e.onInfo&&(t.preventDefault(),e.onInfo())},title:e.path,children:(0,Z.jsx)(`div`,{className:`caps-item block! h-full w-full overflow-hidden rounded-none! border-0! bg-transparent! shadow-none! z-auto! -outline-offset-2!`,"data-selected":e.selected??!1,children:e.pending||n?(0,Z.jsx)(S9,{"data-media-pending":e.pending?`true`:void 0,indicator:(0,Z.jsx)(`div`,{className:`prints-pending-loader`,"data-run":e.pending&&(e.prompt||e.onStop)?``:void 0,children:(0,Z.jsx)(lH,{decorative:!0,size:`fill`,tone:`accent`,variant:`bloom`})}),label:e.pendingLabel??`Preparing image…`,status:e.pending?`generating`:`done`,children:e.pending?null:(0,Z.jsx)(I9,{item:e})}):(0,Z.jsx)(I9,{item:e})})}),e.pending&&!e.error&&(e.prompt||e.onStop)?(0,Z.jsxs)(`div`,{className:`prints-tile-run`,"data-media-run":!0,children:[e.prompt?(0,Z.jsx)(`p`,{className:`prints-tile-caption`,"data-media-caption":!0,children:e.prompt}):null,e.onStop?(0,Z.jsx)(LJ,{"aria-label":`Stop`,title:`Stop`,size:`sm`,variant:`outline`,iconSize:`sm`,className:`prints-tile-stop`,onClick:e.onStop,icon:(0,Z.jsx)(XI,{fill:`currentColor`})}):null]}):null,!e.pending&&!e.error?(0,Z.jsx)(Cee,{item:e}):null,(0,Z.jsxs)(`div`,{className:`prints-gallery-tools`,children:[!e.pending&&!e.error?(0,Z.jsx)(wee,{item:e}):null,!e.pending&&e.onInfo?(0,Z.jsx)(LJ,{className:`prints-gallery-secondary`,"aria-label":`Image info: ${e.path}`,title:`Image info (I)`,"aria-keyshortcuts":`I`,onClick:e.onInfo,icon:(0,Z.jsx)(HI,{})}):null,!e.pending&&e.onToggleReference?(0,Z.jsx)(LJ,{className:`prints-gallery-reference prints-gallery-secondary`,"aria-label":`${e.referenced?`Remove reference`:`Add reference`}: ${e.path}`,title:e.referenced?`Remove reference`:`Add reference`,"aria-pressed":e.referenced??!1,disabled:e.referenceDisabled,onClick:e.onToggleReference,icon:e.referenced?(0,Z.jsx)(AI,{}):(0,Z.jsx)(BI,{})}):null]})]})}),xee=(0,G.memo)(function({item:e}){return NH(e.path)?(0,Z.jsx)(O9,{url:e.url,children:(0,Z.jsx)(L9,{item:e})}):(0,Z.jsx)(L9,{item:e})}),See=e=>`${String(e)}s`;function Cee({item:e}){let{select:t}=e;return(0,Z.jsxs)(Z.Fragment,{children:[NH(e.path)&&e.url!==``?(0,Z.jsx)(A9,{title:e.path}):null,(0,Z.jsx)(`div`,{className:`prints-tile-mark`,"data-checked":t?.active?t.checked:void 0,"data-favorite":e.favorite?!0:void 0,children:t?.active?(0,Z.jsx)(F6,{appearance:`compact`,"aria-label":`Select ${e.path}`,checked:t.checked,onChange:t.onToggle}):e.onToggleFavorite?(0,Z.jsx)(LJ,{"aria-label":`${e.favorite?`Unfavorite`:`Favorite`}: ${e.path}`,"aria-pressed":e.favorite??!1,className:`prints-tile-heart`,icon:(0,Z.jsx)(zI,{fill:e.favorite?`currentColor`:`none`}),onClick:e.onToggleFavorite,title:e.favorite?`Remove from favorites`:`Favorite`}):null}),e.badge?(0,Z.jsx)(`div`,{className:`prints-tile-badge`,"data-media-badge":!0,children:e.badge.label===null?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(ZI,{"aria-hidden":!0,size:12}),(0,Z.jsx)(`span`,{children:`Upload`})]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`span`,{className:`prints-tile-badge-model`,children:e.badge.label}),e.badge.seconds===null?null:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(NI,{"aria-hidden":!0,size:12}),(0,Z.jsx)(`span`,{children:See(e.badge.seconds)})]})]})}):null,e.folderCaption?(0,Z.jsx)(`div`,{className:`prints-tile-folder`,title:e.folderCaption,children:e.folderCaption}):null]})}function wee({item:e}){return!e.onMove||e.select?.active?null:(0,Z.jsxs)(V5,{children:[(0,Z.jsx)(U5,{render:(0,Z.jsx)(LJ,{"aria-label":`More actions: ${e.path}`,title:`More actions`,icon:(0,Z.jsx)(FI,{})})}),(0,Z.jsxs)(q5,{children:[(0,Z.jsxs)(Y5,{onSelect:e.onMove,children:[(0,Z.jsx)(II,{"aria-hidden":!0,size:16}),` Move to…`]}),e.onToggleFavorite?(0,Z.jsxs)(Y5,{onSelect:e.onToggleFavorite,children:[(0,Z.jsx)(zI,{"aria-hidden":!0,size:16}),` `,e.favorite?`Remove from favorites`:`Favorite`]}):null,e.onInfo?(0,Z.jsxs)(Y5,{onSelect:e.onInfo,children:[(0,Z.jsx)(HI,{"aria-hidden":!0,size:16}),` Image info`]}):null,e.onToggleReference?(0,Z.jsxs)(Y5,{disabled:e.referenceDisabled,onSelect:e.onToggleReference,children:[e.referenced?(0,Z.jsx)(AI,{"aria-hidden":!0,size:16}):(0,Z.jsx)(BI,{"aria-hidden":!0,size:16}),` `,e.referenced?`Remove reference`:`Add reference`]}):null]})]})}var Tee=(0,G.memo)(function({children:e,style:t,...n}){return(0,Z.jsx)(`div`,{"data-media-grid":!0,...n,style:t,children:e})});function Eee(e,t){let[n,r]=(0,G.useState)({height:0,width:0});return(0,G.useEffect)(()=>{let t=e.current;if(!t)return;let n=()=>{r(e=>{let n={height:t.clientHeight,width:t.clientWidth};return n.width===e.width&&n.height===e.height?e:n})};n();let i=new ResizeObserver(n);return i.observe(t),window.addEventListener(`resize`,n),()=>{i.disconnect(),window.removeEventListener(`resize`,n)}},[e,t]),n}function Dee(e){let[t,n]=(0,G.useState)(0),[r,i]=(0,G.useState)(!1);return(0,G.useEffect)(()=>{let t=e.current;if(!t)return;let r=null,a=()=>{n(t.scrollTop),i(!0),r!==null&&clearTimeout(r),r=setTimeout(()=>{i(!1)},150)};return t.addEventListener(`scroll`,a,{passive:!0}),()=>{t.removeEventListener(`scroll`,a),r!==null&&clearTimeout(r)}},[e]),{isScrolling:r,scrollTop:t}}function R9(e,t){let n=t.height>0?t.width/t.height:1;return Math.round(e/n)}function z9(e,t,n,r){let i=Math.floor((t-(n-1)*j9)/n),a=e.length===1?e[0]:void 0;if(!a||r<=0)return i;let o=a.height>0?a.width/a.height:1;return Math.max(1,Math.min(i,Math.floor(r*o)))}function Oee(e,t,n){let r=e.some(e=>e.select!==void 0),i=Math.max(1,bee(e.length,t),r&&e.length>=2?2:1),a=t-16,o=n-16;return(0,G.useMemo)(()=>{let t=z9(e,a,i,o),n=y9(i,t,j9);return t>0&&e.forEach((e,r)=>{n.set(r,R9(t,e))}),n},[e,a,i,o])}var kee=132,Aee=(0,G.memo)(function({data:e,width:t}){let n=R9(t,e);return(0,Z.jsx)(`div`,{"data-media-tile":e.key,"data-short":n<kee?``:void 0,style:{height:n,width:t},children:(0,Z.jsx)(xee,{item:e})})});function B9(e,t){let n=Array.from(e.querySelectorAll(`[data-media-tile]`)).find(e=>e.dataset.mediaTile===t)?.querySelector(`[data-media-thumb-wrap]`);return!n||n.disabled?!1:(n.focus({preventScroll:!0}),!0)}function jee(e,t,n){let r=e.ownerDocument;(r.activeElement!==r.body||B9(e,t))&&n()}function Mee(e,t,n){let r=n.top+t.getBoundingClientRect().top-e.getBoundingClientRect().top+e.scrollTop;return(r<e.scrollTop||r+n.height>e.scrollTop+e.clientHeight)&&e.scrollTo({top:r,behavior:`instant`}),r}var Nee=(0,G.memo)(function({items:e,scrollRef:t,focus:n}){let r=Eee(t,e.length),i=r.width||M9,a=e.length===1&&r.height>0,o=i-16,s=r.height-16,c=Oee(e,i,r.height),{isScrolling:l,scrollTop:u}=Dee(t),d=(0,G.useRef)(new Set),f=(0,G.useRef)(null),p=(0,G.useRef)(null);(0,G.useEffect)(()=>{if(!n)return;let a=f.current===n.requestId;if(a&&p.current===i)return;let o=t.current,s=e.findIndex(e=>e.key===n.key),l=c.get(s);if(!o||!l||r.height===0)return;let u=o.querySelector(`[data-media-grid]`);if(!u)return;let d=Mee(o,u,l);if(a){jee(o,n.key,()=>{p.current=i});return}B9(o,n.key)?(f.current=n.requestId,p.current=i,n.onFocus()):o.scrollTo({top:d,behavior:`instant`})},[n,e,r.height,t,u,c,i]),(0,G.useEffect)(()=>{let n=t.current;if(!n||r.width===0||r.height===0)return;let i=e.findIndex(e=>e.pending&&!e.onVisible&&!d.current.has(e.key));if(d.current=new Set(e.map(e=>e.key)),i<0)return;let a=c.get(i),o=n.querySelector(`[data-media-grid]`);if(!a||!o)return;let s=o.getBoundingClientRect().top-n.getBoundingClientRect().top+n.scrollTop,l=i===0?0:s+a.top,u=l+a.height;l>=n.scrollTop&&u<=n.scrollTop+n.clientHeight||n.scrollTo({top:Math.max(0,l-j9),behavior:window.matchMedia(`(prefers-reduced-motion: reduce)`).matches?`instant`:`smooth`})},[e,r.width,r.height,t,c]);let m=(0,G.useCallback)(({data:e,width:t})=>(0,Z.jsx)(Aee,{data:e,width:t}),[]),h=u9({as:Tee,height:r.height,isScrolling:l,itemKey:e=>e.key,items:e,overscanBy:2,positioner:c,render:m,scrollTop:u});return(0,Z.jsx)(`div`,{"data-media-sole":a?``:void 0,style:{boxSizing:`border-box`,padding:j9,...a?{display:`flex`,alignItems:`center`,justifyContent:`center`,minHeight:r.height}:void 0},children:(0,Z.jsx)(`div`,{style:{width:a?z9(e,o,1,s):`100%`},children:h})})});function Pee({items:e,scrollRef:t,focus:n}){return(0,Z.jsx)(`section`,{"data-media-mosaic":!0,children:(0,Z.jsx)(Nee,{items:e,scrollRef:t,focus:n})})}function Fee(e,t,n){let r=new Map(e.map(e=>[e.key,e])),i=new Set(t.map(e=>e.key));return[...[...t].reverse().filter(e=>!e.resolved||r.has(e.key)).map(e=>{let t=r.get(e.key);return t&&e.resolved?t:n(e)}),...e.filter(e=>!i.has(e.key))]}var V9=`prints-prompt-counter`;function Iee({busy:e,disabled:t,disabledReason:n,draft:r,label:i,onGenerate:a,promptOver:o}){return(0,Z.jsx)(h6,{"aria-describedby":o?V9:void 0,"aria-label":i,className:`prints-generate`,"data-generation-submit":!0,disabled:t||o,onClick:a,state:G6({draft:r,busy:e}),title:(t||o)&&n?n:i})}function H9({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 Lee=.8;function Ree(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 zee({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,G.useRef)(null),x=(0,G.useRef)(y),[S,C]=(0,G.useState)([]),[w,T]=(0,G.useState)(-1),[E,D]=(0,G.useState)(!1),O=(0,G.useRef)(!1),k=(0,G.useRef)(!1);x.current=y,(0,G.useLayoutEffect)(()=>{if(E||i||!k.current)return;k.current=!1;let e=b.current;e&&e.ownerDocument.activeElement===e.ownerDocument.body&&e.focus({preventScroll:!0})},[i,E]),(0,G.useLayoutEffect)(()=>{let t=b.current;!t||e?.value!==y||(t.setSelectionRange(e.caret,e.caret),t.focus({preventScroll:!0}))},[e,y]);let{cap:A,collapsed:j,fullscreen:M}=t;(0,G.useLayoutEffect)(()=>{let e=b.current;if(!e)return;if(M){e.style.height=``,n(!1);return}e.style.height=`auto`;let t=e.scrollHeight;e.style.height=`${String(j?Ree(e):Math.min(t,A))}px`,n(!j&&t>A+1),j&&(e.scrollTop=0),j&&t>e.clientHeight+1?e.setAttribute(`data-clipped`,``):e.removeAttribute(`data-clipped`)},[y,A,j,M,n]),(0,G.useLayoutEffect)(()=>{let e=b.current;!e||!M||(e.setSelectionRange(e.value.length,e.value.length),e.scrollTop=e.scrollHeight)},[M]);let N=(0,G.useCallback)(async()=>{let e=x.current.trim();if(!(!e||i||O.current)){if(a!==void 0&&e.length+o>a){r(H9({addedLength:o,length:e.length+o,maxLength:a}));return}k.current=b.current===b.current?.ownerDocument.activeElement,O.current=!0,D(!0);try{if(!await m())return;C(t=>t.at(-1)===e?t:[...t,e].slice(-20)),T(-1)}finally{O.current=!1,D(!1)}}},[i,a,r,m,o]),P=y.trim().length,F=P>0?P+o:0,I=a!==void 0&&F>a,L=a!==void 0&&F>=Math.floor(a*Lee);return(0,Z.jsxs)(`div`,{className:`relative min-w-0 flex-1`,children:[(0,Z.jsx)(D6,{"aria-invalid":I?!0:void 0,"aria-label":`Prompt`,className:`w-full`,"data-generation-prompt":!0,"data-counting":L?``:void 0,...A6(s),disabled:i===!0||E,onChange:e=>{u(e.currentTarget.value),l(e.currentTarget.selectionStart),T(-1)},onScroll:e=>{j&&(e.currentTarget.scrollTop=0)},onSelect:e=>{l(e.currentTarget.selectionStart)},onKeyDown:e=>{if(u6(e))return;let t=k6(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(),N();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:M?void 0:A},rows:1,value:y}),L?(0,Z.jsxs)(`p`,{className:`prints-prompt-counter ${I?`text-error`:`text-dim`}`,"data-prompt-counter":!0,id:V9,role:`status`,title:I?H9({addedLength:o,length:F,maxLength:a}):void 0,children:[`${String(F)} / ${String(a)}`,I?(0,Z.jsxs)(`span`,{className:`sr-only`,children:[` `,H9({addedLength:o,length:F,maxLength:a})]}):null]}):null]})}function Bee({index:e,listId:t,matches:n,onHighlight:r,onPick:i}){return(0,Z.jsx)(j6,{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 Vee(e,t){let[n,r]=(0,G.useState)(0),i=t.startsWith(`/`),a=(0,G.useMemo)(()=>{if(!i)return[];let n=W1(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,G.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 Hee({images:e,index:t,listId:n,matches:r,onHighlight:i,onPick:a}){return(0,Z.jsx)(j6,{open:!0,rows:r.map(t=>{if(t.kind===`reference`)return{key:qG(t.reference.number),label:`@${qG(t.reference.number)}`,detail:t.reference.name,media:(0,Z.jsx)(`span`,{className:`prints-character-thumb mask mask-squircle`,children:t.reference.url?(0,Z.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,Z.jsx)(`span`,{className:`prints-character-thumb mask mask-squircle`,children:i?(0,Z.jsx)(`img`,{src:i.url,alt:``}):null})}}),selected:t,listId:n,label:`References and characters`,kind:`characters`,onHighlight:i,onChoose:a})}var Uee=e=>e.kind===`reference`?qG(e.reference.number):e.character.name;function U9(e,t,n,r){return dK(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 W9({tokens:e}){return e.length===0?null:(0,Z.jsx)(`ul`,{className:`prints-mention-tokens`,"aria-label":`Mentioned in the prompt`,children:e.map(e=>(0,Z.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,Z.jsx)(`span`,{className:`prints-mention-thumb mask mask-squircle`,children:e.url?(0,Z.jsx)(`img`,{src:e.url,alt:``}):null}),(0,Z.jsx)(`span`,{children:e.label}),e.valid?null:(0,Z.jsx)(`span`,{children:` · not attached`})]},e.key))})}function Wee(e,t,n){let[r,i]=(0,G.useState)(0),[a,o]=(0,G.useState)(0),[s,c]=(0,G.useState)(null),[l,u]=(0,G.useState)(null),d=s===n?null:vK(n,r),f=d?yK(e,t,d.query):[];return(0,G.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=Uee(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 Gee(e,t,n){let[r,i]=(0,G.useState)(XG),a=e.map(e=>YG(e,n)),o=ZG(r,a,t);return o!==r&&i(o),QG(o,a)}var Kee=400;function qee(e){let{draft:t,model:n}=e;if(n===void 0||t.prompt.trim()===``)return null;let r=JG(t.prompt).length>0,i=n.kind===`audio`?gK(t.prompt):_K({prompt:t.prompt,saved:e.characters,references:t.references,labels:e.labels,wording:e=>$G(oG(e,n,r),n),computerId:e.computerId,model:{label:n.label,maxReferences:n.input.maxReferences}});if(i.kind===`refused`)return null;let a=oG(i.references,n,r),o={...t,prompt:RG(n.kind===`audio`?void 0:e.styleText,i.prompt),references:a};return dG(o,n)!==void 0||n.video!==null&&!n.video.formats.some(e=>e.width===o.width&&e.height===o.height)?null:cG(o,n).settings}function Jee(e,t){let n=e===null?null:JSON.stringify(e),r=(0,G.useRef)(e);r.current=e;let[i,a]=(0,G.useState)({key:n,settings:e});return(0,G.useEffect)(()=>{let e=setTimeout(()=>{a({key:n,settings:r.current})},t);return()=>{clearTimeout(e)}},[n,t]),i}function Yee(e,t){return Ww({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 G9(e,t){let n=t===null?null:JSON.stringify(t),r=Jee(t,Kee),i=Uw(Yee(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:S7(i.data.costMilliunits)}}function Xee(e,t){let n=G9(e,t);return n.state===`ready`?n.price:null}function Zee(e){let t=vC(),n=Uw(jK(e)),r=n=>({mutationFn:t=>{let r=e?.context.get().computerId;if(!e||!r)throw Error(`No Computer selected`);return n(e,r,t)},onSuccess:n=>{t.setQueryData(TK.characters(e),n)}}),i=Jw(r((e,t,n)=>CK(e.capabilities,t,n))),a=Jw(r((e,t,n)=>wK(e.capabilities,t,n)));return{characters:n.data?.characters??[],error:n.error?lC(n.error).message:null,busy:i.isPending||a.isPending,save:(e,t)=>{i.mutate(e,{onError:()=>{A$(`The character could not be saved. Try again.`,`prints-character-save`)},onSuccess:t})},remove:(e,t)=>{a.mutate(e,{onSuccess:t,onError:()=>{A$(`The character could not be deleted. Try again.`,`prints-character-delete`)}})}}}var K9=J({destination:Yx(lS(eS)),height:Yx(jS),model:Yx(eS),prompt:Yx(eS),references:Yx(aS(J({computerId:Yx(eS),path:eS,role:Yx(cS([`first-frame`,`last-frame`,`reference`]))}))),generateAudio:Yx(lS(nS)),steps:Yx(lS(jS)),style:Yx(lS(eS)),width:Yx(jS)}),Qee=fo(U(),Jo()).parse(structuredClone(WS(K9,{onExcessProperty:`error`}).schema)),q9=(e,t,n,r)=>({id:e,title:t,category:`Image generation`,description:n,projections:{agent:{}},action:r===void 0?{presentation:{type:`action`}}:{inputSchema:r,presentation:{type:`action`}}}),$ee=q9(`inspect-generation-draft`,`Inspect image draft`,`Read the current Prints image form and available models`),ete=q9(`set-generation-draft`,`Edit image draft`,`Set selected Prints image form fields; this does not generate an image`,Qee),J9=q9(`submit-generation-draft`,`Generate image`,`Submit the current Prints image form using the same action as the Send button`);function tte(e,t){let n=!1,r=new Set,i=(t,i)=>{e.commands.register(t,i).then(e=>{n?e():r.add(e)},()=>void 0)};return i($ee,()=>{if(n)return;let e=t.readDraft();return{draft:{destination:e.destination??null,height:e.height,model:e.model,prompt:e.prompt,generateAudio:e.generateAudio??null,references:e.references.map(e=>{let t={path:e.path,role:e.role??null};return e.computerId===void 0?t:{...t,computerId:e.computerId}}),steps:e.steps??null,style:e.style??null,width:e.width},models:t.readModels().map(e=>({id:e.id,label:e.label,defaultHeight:e.input.defaultHeight,defaultWidth:e.input.defaultWidth,maxReferences:e.input.maxReferences}))}}),i(ete,({arguments:e})=>{if(n)return;let r=qx(K9,{onExcessProperty:`error`})(e);t.setDraft(r)}),i(J9,async()=>{if(!n)return{accepted:await t.submit()}}),()=>{if(!n){n=!0;for(let e of r)e();r.clear()}}}function nte(e){return[{id:`clear-prompt`,title:`Clear prompt`,category:`Prompt`,description:`Remove the current prompt`,projections:{slash:{aliases:[`clear`],order:0},palette:{}},handler:()=>{e().clear()}},...xW.map((t,n)=>({id:`size-${t}`,title:`Use ${t} size`,category:`Prompt`,description:`Use ${String(bW[t].width)} × ${String(bW[t].height)}`,projections:{slash:{aliases:[t],order:n+1},palette:{}},handler:()=>{e().useSize(t)}})),{id:`choose-style`,title:`Choose style`,category:`Prompt`,description:`Pick, create or edit a saved style`,projections:{slash:{aliases:[`style`],order:4},palette:{}},handler:()=>{e().openStyles()}},{id:`no-style`,title:`Use no style`,category:`Prompt`,description:`Send the prompt without a style`,projections:{slash:{aliases:[`nostyle`],order:5},palette:{}},handler:()=>{e().clearStyle()}}]}function rte(e,t){let n=(0,G.useRef)(e);n.current=e;let r=AN(t,{sourceId:`media-prompt`,namespace:`media`},(0,G.useCallback)(()=>nte(()=>n.current),[])),i=(0,G.useSyncExternalStore)(r.subscribe,r.snapshot,r.snapshot);return{items:(0,G.useMemo)(()=>B1(i).map(e=>({id:e.commandId,command:e.command,slash:e.alias,title:e.title,description:e.description})),[i]),run:e=>{r.execute(e,{origin:`slash`})}}}function ite(e){let t=vC(),n=Uw(kK(e)),r=n=>({mutationFn:t=>{let r=e?.context.get().computerId;if(!e||!r)throw Error(`No Computer selected`);return n(e,r,t)},onSuccess:n=>{t.setQueryData(TK.styles(e),n)}}),i=Jw(r((e,t,n)=>UG(e.capabilities,t,n))),a=Jw(r((e,t,n)=>WG(e.capabilities,t,n)));return{styles:n.data?.styles??[],error:n.error?lC(n.error).message:null,busy:i.isPending||a.isPending,save:(e,t)=>{i.mutate(e,{onError:()=>{A$(`The style could not be saved. Try again.`,`prints-style-save`)},onSuccess:n=>{t(n.styles.find(t=>t.name===e.name))}})},remove:(e,t)=>{a.mutate(e,{onSuccess:t,onError:()=>{A$(`The style could not be deleted. Try again.`,`prints-style-delete`)}})}}}function Y9(e){let t=e.filter(e=>e.kind===`video`&&e.video!==null&&e.video.prices.length>0&&e.input.maxReferences>=1&&e.video.referenceRoles.includes(`first-frame`));return t.find(e=>e.video?.provider===`seedance`)??t.at(0)}function ate(e,t,n){let r=e.video;if(r===null)return;let i=Math.log(t/n),a=e=>Math.abs(Math.log(e.width/e.height)-i);return r.formats.filter(e=>e.resolution===r.defaultResolution).reduce((e,t)=>e===void 0||a(t)<a(e)?t:e,void 0)}function ote(e,t){let{lineage:n,printPath:r,models:i,current:a}=t,o=e===`animate`?Y9(i):void 0;if(e===`animate`&&o===void 0)return{kind:`refused`,message:`No video model on this Computer takes a first frame.`};let s=tG(i,n.model),c=s?.transform!=null;if(c&&e===`reuse`)return{kind:`refused`,message:`This print was an image edit, so there is no prompt to reuse. Remix or animate it instead.`};let l=o??(c?void 0:s)??tG(i,a.model);if(l===void 0)return{kind:`refused`,message:`Choose a model from the granted registry.`};let u=o===void 0&&s===void 0?`This print was made with ${n.model}, which is no longer available. Loaded it with ${eG(l)} instead.`:null,d=c?[]:n.references.slice(0,n.typed.references),f=e===`animate`?{path:r,role:`first-frame`}:{path:r},p=[f,...d.filter(e=>!gW(e,t.printComputerId)||e.path!==r)];if(e!==`reuse`&&l.input.maxReferences===0)return{kind:`refused`,message:`${l.label} does not take reference images.`};let m=e===`reuse`?d:e===`remix`?p:[f],h=nG(a,l),g={width:n.width??h.width,height:n.height??h.height},_=o===void 0?$W(g,l,void 0):ate(l,g.width,g.height)??h,v=o===void 0&&l.input.steps!==`fixed`&&n.steps!==null&&l.id===n.model?n.steps:h.steps,y=n.style!==null&&t.styles.includes(n.style)?n.style:void 0;return{kind:`draft`,notice:u,draft:{...h,destination:void 0,prompt:tK(c?``:n.typed.prompt,e=>{let t=d.at(e-1),n=t===void 0?-1:m.findIndex(e=>e.path===t.path&&e.computerId===t.computerId);return n<0?void 0:n+1}),references:m,steps:v,style:y,width:_.width,height:_.height}}}function ste({id:e,styles:t,selected:n,disabled:r,onSelect:i}){let a=n===void 0||t.some(e=>e.name===n);return(0,Z.jsxs)(J$,{id:e,"aria-label":`Prompt style`,"data-generation-style":!0,className:`select-sm`,disabled:r,onChange:e=>{i(e.currentTarget.value||void 0)},value:n??``,children:[(0,Z.jsx)(`option`,{value:``,children:`No style`}),a?null:(0,Z.jsx)(`option`,{value:n,children:n}),t.map(e=>(0,Z.jsx)(`option`,{value:e.name,children:e.name},e.id))]})}function X9({active:e,children:t}){let[n,r]=(0,G.useState)(e);return e&&!n&&r(!0),n?(0,Z.jsx)(G.Suspense,{fallback:null,children:t}):null}var cte=(0,G.lazy)(async()=>({default:(await R1(()=>import(`./prints-activity-tray-fBvz4KPN.js`),__vite__mapDeps([0,1,2,3]),import.meta.url)).PrintsActivityTray})),lte=(0,G.lazy)(async()=>({default:(await R1(()=>import(`./prompt-styles-dialog-C78A_y2L.js`),__vite__mapDeps([4,5]),import.meta.url)).PromptStylesDialog})),ute=(0,G.lazy)(async()=>({default:(await R1(()=>import(`./prompt-character-controls-CULFAqk_.js`),__vite__mapDeps([6,5]),import.meta.url)).PromptCharactersDialog})),dte=(0,G.lazy)(async()=>({default:(await R1(()=>import(`./reference-lightbox-CRP9rCzA.js`),__vite__mapDeps([7,8,5]),import.meta.url)).ReferenceLightbox})),fte=(0,G.lazy)(async()=>({default:(await R1(()=>import(`./library-dialogs-0ZSodLWS.js`),__vite__mapDeps([9,5]),import.meta.url)).MoveDialog})),pte=(0,G.lazy)(async()=>({default:(await R1(()=>import(`./library-dialogs-0ZSodLWS.js`),__vite__mapDeps([9,5]),import.meta.url)).NewFolderDialog})),mte=(0,G.lazy)(async()=>({default:(await R1(()=>import(`./library-folders-dialog-K8RdUGuo.js`),__vite__mapDeps([10,5,11,12]),import.meta.url)).LibraryFoldersDialog})),hte=(0,G.lazy)(async()=>({default:(await R1(()=>import(`./library-rail-BWvTDKYy.js`),__vite__mapDeps([11,12]),import.meta.url)).LibraryRail})),gte=(0,G.lazy)(async()=>({default:(await R1(()=>import(`./print-viewer-Bo6rgETj.js`),__vite__mapDeps([13,8,5]),import.meta.url)).PrintViewer})),_te=(0,G.lazy)(async()=>({default:(await R1(()=>import(`./prints-folder-dialog-F7K-fTDo.js`),__vite__mapDeps([14,5,2,3]),import.meta.url)).PrintsFolderDialog})),vte=(0,G.lazy)(async()=>({default:(await R1(()=>import(`./print-info-drawer-l12Feb31.js`),__vite__mapDeps([15,3,12,1]),import.meta.url)).PrintInfoDrawer})),yte=[`a mushroom knight`,`moss on a keyboard`,`a tiny house made of mushrooms`];function Z9(e){sI.error(e,{id:`prints-generation-error`,toasterId:`prints-generation-notices`})}function bte(e){let t=(0,G.useRef)(!1),n=EJ({defaultValues:jW(),onSubmit:async({value:n})=>{t.current=await e.current(n)}}),r=(0,G.useCallback)(async()=>(t.current=!1,await n.handleSubmit(),t.current),[n]);return Object.assign(n,{submitCurrent:r})}function xte(e){let t=[...new Set(e.map(e=>e.group))];return t.length<2?[{group:void 0,choices:e}]:t.map(t=>({group:t,choices:e.filter(e=>e.group===t)}))}function Ste({form:e,selected:t,stylePicker:n,sizeChoices:r,sizeMode:i,onCustomSize:a,match:o,onEditStyles:s,onEditCharacters:c}){let l=t?.input.dimensions===`none`,u=t!==void 0&&t.sizes!==null,d=t?.video??null;return(0,Z.jsxs)(`div`,{className:`prints-settings`,children:[(0,Z.jsx)(H$,{label:`Style`,orientation:`horizontal`,children:n}),(0,Z.jsx)(H$,{label:`Size`,orientation:`horizontal`,children:(0,Z.jsx)(J$,{"aria-label":`Generation size`,"data-generation-size":!0,className:`select-sm`,disabled:l,title:l?`This model chooses the output size.`:void 0,onChange:t=>{let n=t.currentTarget.value;o.onChange(n===`match`),a(n===`custom`);let i=r.find(e=>e.value===n);i&&(e.setFieldValue(`width`,i.width),e.setFieldValue(`height`,i.height))},value:l?`provider`:i,children:l?(0,Z.jsx)(`option`,{value:`provider`,children:`Model default`}):(0,Z.jsxs)(Z.Fragment,{children:[o.offered?(0,Z.jsx)(`option`,{value:`match`,disabled:o.size===void 0,children:o.size===void 0?`Match first reference: attach an image first`:`Match first reference · ${VW(o.size.width,o.size.height)}`}):null,u&&i!==`match`&&!r.some(e=>e.value===i)?(0,Z.jsx)(`option`,{value:i,disabled:!0,children:`Choose a supported resolution`}):null,xte(r).map(({group:e,choices:t})=>e===void 0?t.map(e=>(0,Z.jsx)(`option`,{value:e.value,children:e.label},e.value)):(0,Z.jsx)(`optgroup`,{label:e,children:t.map(e=>(0,Z.jsx)(`option`,{value:e.value,children:e.label},e.value))},e)),u?null:(0,Z.jsx)(`option`,{value:`custom`,children:`Custom size`})]})})}),!l&&!u&&i===`custom`?(0,Z.jsxs)(`div`,{className:`prints-custom-size`,children:[(0,Z.jsx)(e.Field,{name:`width`,children:e=>(0,Z.jsx)(H$,{label:`Width`,children:(0,Z.jsx)(k$,{"aria-label":`Generation width`,"data-generation-width":!0,max:4096,min:1,onChange:t=>{e.handleChange(Number(t.currentTarget.value)||1)},type:`number`,value:e.state.value})})}),(0,Z.jsx)(e.Field,{name:`height`,children:e=>(0,Z.jsx)(H$,{label:`Height`,children:(0,Z.jsx)(k$,{"aria-label":`Generation height`,"data-generation-height":!0,max:4096,min:1,onChange:t=>{e.handleChange(Number(t.currentTarget.value)||1)},type:`number`,value:e.state.value})})})]}):null,d?(0,Z.jsx)(e.Field,{name:`durationSeconds`,children:e=>(0,Z.jsx)(H$,{label:`Length`,orientation:`horizontal`,children:(0,Z.jsx)(J$,{"aria-label":`Video length in seconds`,className:`select-sm`,"data-generation-duration":!0,onChange:t=>{let n=t.currentTarget.value;e.handleChange(d.durations.find(e=>String(e)===n))},value:e.state.value===void 0?``:String(e.state.value),children:d.durations.map(e=>(0,Z.jsxs)(`option`,{value:String(e),children:[e,` seconds`]},e))})})}):null,d?.supportsAudio?(0,Z.jsx)(e.Field,{name:`generateAudio`,children:e=>d.defaultGenerateAudio===null?(0,Z.jsx)(H$,{label:`Sound`,orientation:`horizontal`,children:(0,Z.jsxs)(J$,{"aria-label":`Video sound`,className:`select-sm`,"data-generation-audio":!0,onChange:t=>{let n=t.currentTarget.value;e.handleChange(n===``?void 0:n===`on`)},value:e.state.value===void 0?``:e.state.value?`on`:`off`,children:[(0,Z.jsx)(`option`,{value:``,children:`Model default`}),(0,Z.jsx)(`option`,{value:`on`,children:`On`}),(0,Z.jsx)(`option`,{value:`off`,children:`Off`})]})}):(0,Z.jsx)(H$,{label:`Sound`,orientation:`horizontal`,children:(0,Z.jsx)(X$,{"aria-label":`Video sound`,checked:e.state.value??!0,"data-generation-audio":!0,onCheckedChange:e.handleChange})})}):null,t&&t.input.steps!==`fixed`?(0,Z.jsx)(e.Field,{name:`steps`,children:e=>(0,Z.jsx)(H$,{label:`Steps`,optional:!0,orientation:`horizontal`,children:(0,Z.jsx)(k$,{"aria-label":`Generation steps`,className:`input-sm`,"data-generation-steps":!0,max:t.input.maxSteps??void 0,min:1,onChange:t=>{e.handleChange(t.currentTarget.value===``?void 0:Number(t.currentTarget.value))},type:`number`,value:e.state.value??``})})}):null,(0,Z.jsxs)(`div`,{className:`prints-settings-library`,children:[(0,Z.jsx)(kJ,{size:`xs`,variant:`ghost`,type:`button`,onClick:()=>{s()},children:`Edit styles…`}),(0,Z.jsx)(kJ,{size:`xs`,variant:`ghost`,type:`button`,onClick:()=>{c()},children:`Characters…`})]})]})}function Q9(e){return e.detail===void 0?e.title:e.group===`Images`?e.detail:`${e.title}. ${e.detail}`}function Cte({actions:e,guidance:t,commandApp:n,form:r,models:i,modelsLoading:a,mediaCapability:o,submitting:s,generateLimitReason:c,values:l,computerId:u,mediaDirectory:d,referenceImages:f,referenceLabels:p,price:m,characters:h,characterDialog:g,onSubmit:_,styleControls:v,addedLength:y}){let b=tG(i,l.model),x=!o||a||i.length===0,S=x&&t?.group===`Setup`&&t.blocking===!0?t:void 0,C=l.prompt.trim().length,w=b!==void 0&&C>0&&C+y>b.maxPromptLength,T=aG(b),E=b?.video??null,D=JG(l.prompt).length>0,O=oG(l.references,b,D),k=b?.input.maxReferences??0,A=l.references.length>k,j=(0,G.useRef)(null),M=(0,G.useId)(),N=v1(j),[P,F]=(0,G.useState)(!1),I=w?C+y:0,L=b!==void 0&&w?H9({addedLength:y,length:I,maxLength:b.maxPromptLength}):void 0,[R,z]=(0,G.useState)(!1),[ee,te]=(0,G.useState)(!1),B=l.references.find(e=>u!==null&&gW(e,u)),ne=f.find(e=>e.path===B?.path),re=ne===void 0?void 0:XW(b,ne.width,ne.height),V=r.setFieldValue,H=(0,G.useRef)({width:l.width,height:l.height});H.current={width:l.width,height:l.height},(0,G.useEffect)(()=>{if(ee){if(re===void 0){te(!1),sI(`Size kept at ${String(H.current.width)} × ${String(H.current.height)}; Match first reference turned off`,{toasterId:`prints-generation-notices`});return}V(`width`,re.width),V(`height`,re.height)}},[ee,re?.width,re?.height,V]);let[ie,ae]=(0,G.useState)(!1),oe=b!==void 0&&b.sizes!==null,se=QW(b),ce=ee?`match`:oe?`${String(l.width)}x${String(l.height)}`:R?`custom`:se.find(e=>e.width===l.width&&e.height===l.height)?.value??`custom`,[le,ue]=(0,G.useState)(!1),de=rte({clear:()=>{r.setFieldValue(`prompt`,``)},useSize:e=>{z(!1),te(!1),r.setFieldValue(`width`,bW[e].width),r.setFieldValue(`height`,bW[e].height),r.setFieldValue(`prompt`,``)},openStyles:()=>{r.setFieldValue(`prompt`,``),ue(!0)},clearStyle:()=>{r.setFieldValue(`style`,void 0),r.setFieldValue(`prompt`,``)}},n),[fe,pe]=(0,G.useState)(!1),me=l.references.map((e,t)=>({number:p[t]??t+1,name:e.path.split(`/`).at(-1)??e.path,url:u!==null&&gW(e,u)?f.find(t=>t.path===e.path)?.url:void 0})),he=Wee(h,me,l.prompt),ge=U9(l.prompt,h,me,f),_e=Vee(de.items,l.prompt),ve=(0,G.useId)(),ye=`${ve}-commands`,be=`${ve}-characters`,xe=fK(l.prompt,h).characters,Se=e=>{let t=_e.slashMatches.at(e);t&&(_e.resetSlash(),de.run(t.command))},Ce=v({open:le,onOpenChange:ue}),we=[l.style,ee?`Match · ${YW(l.width,l.height)}`:ZW(b,l.width,l.height),E&&l.durationSeconds!==void 0?`${String(l.durationSeconds)}s`:void 0,E?.supportsAudio&&l.generateAudio===!1?`silent`:void 0].filter(e=>e!=null),Te=(0,Z.jsx)(Ste,{form:r,selected:b,stylePicker:Ce.picker,sizeChoices:se,sizeMode:ce,onCustomSize:z,match:{offered:b?.kind===`image`&&b.input.dimensions===`own`,size:re,onChange:te},onEditStyles:()=>{ae(!1),ue(!0)},onEditCharacters:()=>{ae(!1),pe(!0)}}),Ee=e=>{let t=r.store.state.fieldMeta,n=nG(l,e),i=$W(l,e,b);r.setFieldValue(`model`,e.id),(e.input.dimensions===`none`||e.sizes!==null)&&z(!1),r.setFieldValue(`width`,i.width),r.setFieldValue(`height`,i.height),r.setFieldValue(`durationSeconds`,n.durationSeconds),r.setFieldValue(`voiceId`,n.voiceId),r.setFieldValue(`generateAudio`,n.generateAudio),e.kind===`audio`&&r.setFieldValue(`references`,[]),(e.input.steps===`fixed`||!t.steps?.isTouched)&&r.setFieldValue(`steps`,n.steps)},De=b?.kind===`audio`,[Oe,ke]=(0,G.useState)(null),Ae=(0,G.useRef)(null),je=De?0:l.references.length,Me=u7(IW(i)),Ne=(0,G.useRef)(null);b!==void 0&&b.kind!==`audio`&&(Ne.current=b.id);let Pe=()=>{let e=De?tG(i,Ne.current??``)??tG(i,`@cf/black-forest-labs/flux-2-klein-4b`)??FW(i).at(0):tG(i,Me.at(0)?.id??``);e&&Ee(e)},Fe=b===void 0?null:d7(b),Ie=Fe===null?[]:p7(Me,Fe),Le=b?.audio==null||Fe===null?null:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(m7,{disabled:s,modes:f7(Me),value:Fe,onChange:e=>{let t=tG(i,p7(Me,e).at(0)?.id??``);t&&Ee(t)}}),Ie.length>1?(0,Z.jsx)(g7,{disabled:s,models:Ie,value:b.id,onChange:e=>{let t=tG(i,e);t&&Ee(t)}}):null,b.audio.mode===`speech`?(0,Z.jsx)(_7,{disabled:s,voices:b.audio.voices,value:l.voiceId??b.audio.defaultVoiceId??``,onChange:e=>{r.setFieldValue(`voiceId`,e)}}):null,b.audio.seconds===null?null:(0,Z.jsx)(b7,{disabled:s,seconds:b.audio.seconds,value:l.durationSeconds??b.audio.seconds.default,onChange:e=>{r.setFieldValue(`durationSeconds`,e)}})]}),Re=e=>JSON.stringify([e.computerId??u,e.path]),ze=e=>u!==null&&gW(e,u)?f.find(t=>t.path===e.path):void 0,Be=e=>{let t=O[e]?.role;return t===void 0?`@${qG(p[e]??e+1)}`:rG[t]},Ve=l.references.flatMap((e,t)=>{let n=ze(e);return n===void 0?[]:[{key:Re(e),label:Be(t),name:e.path.split(`/`).at(-1)??e.path,url:n.url}]}),He=Ve.findIndex(e=>e.key===Oe);return(0,Z.jsxs)(K6,{"aria-label":De?`Audio generation`:`Image generation`,"data-generation-form":!0,"data-composer-collapsed":N.collapsed?``:void 0,"data-composer-fullscreen":N.fullscreen?``:void 0,attachments:!De&&l.references.length>0?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{ref:Ae,className:`prints-reference-tray`,"aria-label":`Image references`,"data-over-limit":A?``:void 0,title:`${String(l.references.length)} / ${String(k)} references`,children:l.references.map((e,t)=>{let n=ze(e),i=O[t]?.role,a=iG(T,O,t);return(0,Z.jsxs)(`div`,{className:`prints-reference-tile`,"data-reference-chip":!0,title:e.computerId===void 0?e.path:`${e.computerId}:${e.path}`,children:[n?(0,Z.jsx)(`button`,{type:`button`,className:`prints-reference-face prints-reference-open mask mask-squircle`,"aria-label":`Enlarge ${Be(t)}: ${e.path.split(`/`).at(-1)??e.path}`,"aria-haspopup":`dialog`,"data-reference-key":Re(e),onClick:()=>{ke(Re(e))},children:(0,Z.jsx)(`img`,{src:n.url,alt:e.path.split(`/`).at(-1)})}):(0,Z.jsx)(`div`,{className:`prints-reference-face mask mask-squircle`,children:(0,Z.jsx)(`span`,{children:qG(p[t]??t+1)})}),(0,Z.jsx)(`span`,{className:`prints-reference-label`,"data-reference-label":!0,children:qG(p[t]??t+1)}),i===void 0?null:a===void 0?(0,Z.jsx)(`span`,{className:`prints-reference-role`,"data-reference-role":i,children:rG[i]}):(0,Z.jsx)(kJ,{size:`xs`,variant:`ghost`,type:`button`,className:`prints-reference-role`,"data-reference-role":i,"aria-label":`Reference ${String(t+1)}: ${rG[i]}. Use as ${rG[a]}`,title:`Use as ${rG[a]}`,onClick:()=>{r.setFieldValue(`references`,O.map((e,n)=>n===t?{...e,role:a}:e))},children:rG[i]}),(0,Z.jsx)(LJ,{icon:(0,Z.jsx)(QI,{}),className:`prints-reference-remove`,"aria-label":`Remove reference ${String(t+1)}`,onClick:()=>{r.setFieldValue(`references`,l.references.filter((e,n)=>n!==t))}})]},Re(e))})}),(0,Z.jsx)(X9,{active:He>=0,children:(0,Z.jsx)(dte,{slides:Ve,index:He<0?null:He,onIndexChange:e=>{ke(Ve[e]?.key??null)},onClose:()=>{ke(null)},returnFocusTo:e=>[...Ae.current?.querySelectorAll(`[data-reference-key]`)??[]].find(t=>t.dataset.referenceKey===e)??null})})]}):void 0,input:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`form`,{"aria-busy":s,onSubmit:e=>{e.preventDefault(),_()},children:(0,Z.jsx)(r.Field,{name:`prompt`,children:e=>(0,Z.jsxs)(`div`,{className:`prints-prompt`,"data-guidance-placeholder":S?``:void 0,id:M,ref:j,children:[_e.slashOpen?(0,Z.jsx)(Bee,{index:_e.slashIndex,listId:ye,matches:_e.slashMatches,onHighlight:_e.highlightSlash,onPick:Se}):null,!_e.slashOpen&&he.matches.length>0?(0,Z.jsx)(Hee,{images:f,index:he.index,listId:be,matches:he.matches,onHighlight:he.highlight,onPick:t=>{let n=he.complete(t);n!==null&&e.handleChange(n)}}):null,(0,Z.jsx)(zee,{caretRequest:he.caretRequest,layout:N,onOver:Z9,onOverflow:F,menu:_e.slashOpen?{open:_e.slashMatches.length>0,listId:ye,selected:_e.slashIndex}:{open:he.matches.length>0,listId:be,selected:he.index},mentionCount:_e.slashOpen?0:he.matches.length,onCaret:he.setCaret,onMentionDismiss:he.dismiss,onMentionMove:he.move,onMentionPick:()=>{let t=he.complete(he.index);t!==null&&e.handleChange(t)},disabled:x||s,maxLength:b?.maxPromptLength,addedLength:y,onChange:t=>{e.handleChange(t)},onSend:_,onSlashMove:_e.moveSlash,onSlashPick:()=>{Se(_e.slashIndex)},placeholder:S?Q9(S):b?.audio?.mode===`speech`?`What should it say?`:b?.audio?.mode===`music`?`Describe the music`:`What are we making?`,slashCount:_e.slashMatches.length,value:e.state.value}),xe.length>0||ge.length>0?(0,Z.jsxs)(`div`,{className:`prints-composer-notes`,children:[(0,Z.jsx)(W9,{tokens:ge}),xe.length>0?(0,Z.jsx)(`span`,{className:`prints-reference-count`,"data-generation-characters":!0,children:`Characters: ${xe.map(e=>e.name).join(`, `)}`}):null]}):null]})})}),t&&!S?(0,Z.jsxs)(`div`,{className:`prints-composer-guidance`,role:`status`,"data-composer-guidance":!0,children:[(0,Z.jsx)(`span`,{children:Q9(t)}),t.actions?.map(e=>(0,Z.jsx)(kJ,{variant:`ghost`,size:`xs`,onClick:e.run,children:e.label},e.label))]}):null]}),row:{controls:(0,Z.jsxs)(Z.Fragment,{children:[N.fullscreen?null:(0,Z.jsx)(zJ,{"aria-controls":M,"aria-expanded":!N.collapsed,"aria-label":N.collapsed?`Expand composer`:`Collapse composer`,"data-composer-collapse":!0,icon:N.collapsed?(0,Z.jsx)(MI,{}):(0,Z.jsx)(jI,{}),label:null,onClick:()=>{N.setCollapsed(!N.collapsed)},onMouseDown:e=>{e.preventDefault()},title:N.collapsed?`Expand composer`:`Collapse composer`}),N.collapsed&&je>0?(0,Z.jsxs)(`span`,{"aria-label":`${String(je)} ${je===1?`reference`:`references`} attached`,className:`prints-composer-count`,"data-composer-count":!0,role:`img`,title:`${String(je)} ${je===1?`reference`:`references`} attached`,children:[(0,Z.jsx)(VI,{"aria-hidden":`true`}),je]}):null,N.coarse&&P&&!N.collapsed?(0,Z.jsx)(zJ,{"aria-label":`Open full-screen editor`,"data-composer-expand":!0,icon:(0,Z.jsx)(UI,{}),label:null,onClick:()=>{N.setFullscreen(!0),j.current?.querySelector(`textarea`)?.focus()},title:`Open full-screen editor`}):null,S?S.actions?.map(e=>(0,Z.jsx)(kJ,{variant:`ghost`,size:`xs`,onClick:e.run,children:e.label},e.label)):null,De?null:e,Me.length>0?(0,Z.jsx)(zJ,{"aria-label":`Audio`,"data-generation-audio-key":!0,icon:(0,Z.jsx)(kI,{}),label:null,pressed:De,tone:De?`accent`:`neutral`,title:De?`Back to pictures`:`Make audio`,disabled:a||!o,onClick:Pe}):null,De?Le:(0,Z.jsx)(r.Field,{name:`model`,children:e=>(0,Z.jsx)(D7,{compact:N.coarse,models:FW(i),emptyLabel:u===null?`Choose a Computer`:a?`Loading models…`:`Models unavailable`,disabled:a||!o,onChange:e=>{let t=tG(i,e);t&&Ee(t)},value:e.state.value})}),u&&d?(0,Z.jsx)(`span`,{className:`sr-only`,"data-generation-computer":!0,title:`Where new prints are saved`,children:`Saved in your Prints folder`}):null]}),action:(0,Z.jsxs)(`span`,{className:`prints-generate-action`,children:[m===null?null:(0,Z.jsx)(`span`,{className:`prints-generate-price`,"data-generation-price":!0,title:`Estimated price`,children:m.startsWith(`<`)?m:`≈ ${m}`}),(0,Z.jsx)(Iee,{busy:s,draft:l.prompt,disabled:!o||a||i.length===0||s||c!==void 0,disabledReason:c??L,label:PW(b),onGenerate:()=>{_()},promptOver:w})]}),items:De?[]:[{id:`settings`,accessibleLabel:`Generation settings`,title:`Settings`,label:(0,Z.jsxs)(`span`,{className:`prints-settings-chip`,children:[(0,Z.jsx)(YI,{"aria-hidden":`true`,className:`size-[var(--stipe-icon-size-sm)]`}),(0,Z.jsx)(`span`,{className:`prints-settings-chip-text`,children:we.length>0?we.join(` · `):`Settings`})]}),content:Te}],openId:ie?`settings`:null,onOpenChange:e=>{ae(e===`settings`)}},children:[(0,Z.jsx)(y1,{layout:N}),(0,Z.jsxs)(`div`,{className:`prints-composer-editor-bar`,"data-composer-editor-bar":!0,children:[(0,Z.jsx)(`span`,{children:`Prompt`}),(0,Z.jsx)(zJ,{"data-composer-done":!0,label:`Done`,onClick:()=>{N.setFullscreen(!1),j.current?.querySelector(`textarea`)?.focus()}})]}),Ce.dialog,g({open:fe,onOpenChange:pe})]})}function wte({connection:e}){let t=(0,G.useRef)(null),n=(0,G.useRef)(e);n.current=e;let r=k7(e?.app??null),i=DN(e?.app??null)?.setup?.media===`missing`,[a,o]=(0,G.useState)(!1),[s,c]=(0,G.useState)(!1),l=()=>{let t=e?.app;t&&(o(!0),c(!1),t.ui.openSetup(`media`).then(e=>{o(!1),c(e===`unavailable`)},e=>{o(!1),c(!0),oW(`open-media-setup`,e)}))},u=s?(0,Z.jsxs)(Z.Fragment,{children:[`Image setup couldn’t open.`,` `,(0,Z.jsx)(`a`,{href:`https://github.com/fungi-computer/oyster#deploy-to-cloudflare`,target:`_blank`,rel:`noreferrer`,children:`Open the image setup guide`}),`.`]}):`Image generation isn’t set up yet.`,[d,f]=(0,G.useState)(!1),[p,m]=(0,G.useState)(),h=F7(e?.app??null,r.computerId),[g,_]=(0,G.useState)(null),[v,y]=(0,G.useState)(null),[b,x]=(0,G.useState)(),S=(0,G.useRef)(0);(0,G.useEffect)(()=>{_(null),y(null),x(void 0)},[e,r.computerId,r.path]);let C=r.path,w=dW(e,r),{gallery:T,images:E,failed:D,loading:O,gallerySlots:k,canBrowse:A,canRead:j,canWrite:M,reserveSlot:N,failSlot:P,clearSlotError:F,removeSlot:I,addComputerFile:L,retryFile:R,uploads:z,uploadFiles:ee}=w,te=e!==null&&r.destination!==null&&A&&j,B=N1({app:e?.app??null,destination:r.destination,view:r.view,setView:r.setView,entries:T.entries,canWrite:M}),[ne,re]=(0,G.useState)(!1),V=B.selecting||T.entries.length>0||w.gallery.folders.length>0,H=KH({selectable:V,atFolderRoot:r.view.kind===`folder`&&!B.up,loading:O||T.loading,failed:!!T.error});jN(te?e.app.window.navigation:null,{canGoBack:B.history.canGoBack,canGoForward:B.history.canGoForward,crumbs:B.crumbs,primary:V?[{id:`select`,label:`Select`,variant:`outline`}]:[],onAction:e=>{e===`select`&&B.setSelecting(!B.selecting)},onBack:B.history.back,onForward:B.history.forward,onCrumb:e=>{B.history.open(e===`all`||e===`favorites`?{kind:e}:{kind:`folder`,folder:e===``?void 0:e})}});let[ie,ae]=(0,G.useState)(Date.now),oe=k.some(e=>e.startedAt!==void 0&&!e.resolved&&!e.error);(0,G.useEffect)(()=>{if(!oe)return;let e=setInterval(()=>{ae(Date.now())},1e3);return()=>{clearInterval(e)}},[oe]);let se=eF(e,(e,t,n)=>(T.refresh(),L(e,t,n)));(0,G.useLayoutEffect)(()=>{x(void 0),se.target&&(_(null),y(null))},[se.target]),(0,G.useEffect)(()=>{se.error&&A$(`Could not open this print. It may no longer be available on this Computer.`,`prints-navigation-error`)},[se.error]);let ce=T.entries.some(e=>e.path===se.target?.path);(0,G.useEffect)(()=>{se.target&&!ce&&T.nextPageReady&&T.loadMore()},[se.target,ce,T.nextPageReady,T.loadMore]);let le=E.find(e=>e.source.kind===`computer`&&e.source.computerId===se.target?.computerId&&e.source.path===se.target.path),ue=ite(e?.app??null),de=Zee(e?.app??null),[fe,pe]=(0,G.useState)(new Set),me=KK({connection:e,folder:r,styles:ue.styles,characters:de.characters,effects:{reserve:e=>{pe(t=>{if(!t.has(e.key))return t;let n=new Set(t);return n.delete(e.key),n}),N(e)},failed:P,release:I,notifyFailure:Z9,saved:({result:e},t)=>{pe(t=>new Set(t).add(`${e.destination.computerId}:${e.destination.path}`)),j?L(e.destination.path,t,e.destination.computerId):P(`${e.destination.computerId}:${e.destination.path}`,`Image saved, but this App cannot read its preview.`)}}}),{state:he,models:ge,modelsLoading:_e,modelsError:ve,canGenerate:ye,mediaCapability:be,pendingGenerations:xe,activeGenerations:Se,recoveryError:Ce}=me,we=(0,G.useRef)(ge),Te=(0,G.useRef)(me);Te.current=me;let Ee=(0,G.useRef)(null),De=(0,G.useRef)(null),Oe=(0,G.useRef)(0),[ke,Ae]=(0,G.useState)(null),je=(0,G.useRef)([]),Me=(0,G.useRef)(e=>me.submit(e,je.current));Me.current=async e=>{let t=await me.submit(e,je.current);return t&&Ae(null),t};let Ne=bte(Me),Pe=e=>{Ne.setFieldValue(`model`,e.model),Ne.setFieldValue(`width`,e.width),Ne.setFieldValue(`height`,e.height),Ne.setFieldValue(`steps`,e.steps),Ne.setFieldValue(`durationSeconds`,e.durationSeconds),Ne.setFieldValue(`generateAudio`,e.generateAudio),Ne.setFieldValue(`prompt`,e.prompt),Ne.setFieldValue(`references`,e.references),Ne.setFieldValue(`style`,e.style),Ne.setFieldValue(`destination`,void 0)},Fe=(0,G.useRef)(Ne);Fe.current=Ne;let Ie=gJ(Ne.store,e=>e.values),Le=Gee(Ie.references,Ie.prompt,r.computerId);je.current=Le;let Re=Xee(me.session,qee({draft:Ie,model:tG(me.models,Ie.model),styleText:ue.styles.find(e=>e.name===Ie.style)?.text,characters:de.characters,labels:Le,computerId:r.computerId})),ze=gJ(Ne.store,e=>e.isSubmitting),Be=e?.app;(0,G.useEffect)(()=>{if(Be)return tte(Be,{readDraft:()=>Fe.current.store.state.values,readModels:()=>we.current,setDraft:e=>{let t=Fe.current;if(e.model!==void 0){let n=tG(we.current,e.model);if(!n)throw Error(`Choose a model from the granted registry.`);let r=nG(t.store.state.values,n),i=tG(we.current,t.store.state.values.model),a=$W(t.store.state.values,n,i);t.setFieldValue(`model`,r.model),t.setFieldValue(`width`,a.width),t.setFieldValue(`height`,a.height),t.setFieldValue(`steps`,r.steps),t.setFieldValue(`durationSeconds`,r.durationSeconds),t.setFieldValue(`generateAudio`,r.generateAudio)}e.generateAudio!==void 0&&t.setFieldValue(`generateAudio`,e.generateAudio??void 0),e.destination!==void 0&&t.setFieldValue(`destination`,e.destination??void 0),e.height!==void 0&&t.setFieldValue(`height`,e.height),e.prompt!==void 0&&t.setFieldValue(`prompt`,e.prompt),e.references!==void 0&&t.setFieldValue(`references`,e.references),e.steps!==void 0&&t.setFieldValue(`steps`,e.steps??void 0),e.style!==void 0&&t.setFieldValue(`style`,e.style??void 0),e.width!==void 0&&t.setFieldValue(`width`,e.width)},submit:()=>Fe.current.store.state.isSubmitting||Te.current.atLimit?Promise.resolve(!1):Fe.current.submitCurrent()})},[Be]),(0,G.useEffect)(()=>{we.current=ge},[ge]),(0,G.useEffect)(()=>{if(ge.length===0||ve)return;let e=ge.find(e=>e.id===`@cf/black-forest-labs/flux-2-klein-4b`)??FW(ge).at(0)??ge[0];if(!Ne.store.state.fieldMeta.model?.isTouched){let t=nG(Ne.store.state.values,e);Ne.setFieldValue(`model`,t.model),Ne.store.state.fieldMeta.width?.isTouched||Ne.setFieldValue(`width`,t.width),Ne.store.state.fieldMeta.height?.isTouched||Ne.setFieldValue(`height`,t.height),Ne.store.state.fieldMeta.steps?.isTouched||Ne.setFieldValue(`steps`,t.steps)}},[Ne,ve,ge]);let Ve=tG(ge,Ie.model),He=Ie.references,Ue=Ve?.input.maxReferences??0,We=(0,G.useRef)({addComputerFile:L,retryPath:me.retryPath,uploads:z});We.current={addComputerFile:L,retryPath:me.retryPath,uploads:z};let Ge=le?cW(le):null,Ke=(0,G.useMemo)(()=>E.map(e=>({key:cW(e),selected:cW(e)===Ge,path:e.source.kind===`computer`?e.source.path:e.file.name,referenced:He.some(t=>e.source.kind===`computer`&&gW(t,e.source.computerId)&&t.path===e.source.path),referenceDisabled:He.length>=Ue&&!He.some(t=>e.source.kind===`computer`&&gW(t,e.source.computerId)&&t.path===e.source.path),onToggleReference:e.source.kind===`computer`&&Ue>0&&!NH(e.source.path)?()=>{if(e.source.kind!==`computer`)return;let t=e.source.path,n=e.source.computerId,r=He.some(e=>gW(e,n)&&e.path===t);Ne.setFieldValue(`references`,r?He.filter(e=>!gW(e,n)||e.path!==t):[...He,{path:t}])}:void 0,onInfo:()=>{_(e)},url:e.url,width:e.width,height:e.height,onOpen:()=>{_(null),y(cW(e))}})),[E,He,Ue,Ne,Ge]),qe=(0,G.useMemo)(()=>{let e=r.computerId;if(!e)return Ke;let t=new Map(Ke.map(e=>[e.key,e])),n=T.entries.map(n=>{let r=`${e}:${n.path}`;return{...t.get(r)??{key:r,path:n.path,width:1,height:1,url:``,pending:!0,pendingLabel:`Loading print…`,onOpen:()=>void 0,onVisible:()=>{T.loadFile(n.path)},error:D.includes(n.name)?`Could not load this print.`:void 0},onRetry:()=>{R(n.path)}}}),i=new Set(n.map(e=>e.key));return[...n,...Ke.filter(e=>!i.has(e.key)&&e.key!==Ge)]},[Ke,T.entries,T.loadFile,R,D,r.computerId,Ge]),Je=te&&!(r.view.kind===`folder`&&!B.up)?r.view.kind===`all`?{title:`No prints yet`,description:`Prints in any folder of the library appear here.`}:r.view.kind===`favorites`?{title:`No favorites yet`,description:`Tap the heart on a print to keep it here for your whole Team.`}:{title:`Nothing in ${B.title} yet`,description:`New prints you make here land in it. You can also drop in images or move prints from another folder.`}:null,Ye=[...Se].sort().join(`|`),Xe=k.filter(e=>e.error!==void 0).length,Ze=(0,G.useMemo)(()=>xe.filter(e=>e.reference.computerId===r.computerId&&!Ye.split(`|`).includes(e.reference.requestId)&&!k.some(t=>t.computerId===e.reference.computerId&&t.path===e.input.destination.path)).map(e=>({key:`${e.reference.computerId}:${e.input.destination.path}`,path:e.input.destination.path,width:1024,height:1280,url:``,pending:!0,error:e.failure===void 0?`Stopped when Prints closed. Retry to run it again.`:yW,prompt:e.typed.prompt,onOpen:()=>void 0,onRetry:()=>{Te.current.resume(e)},onDismiss:()=>{Te.current.discard(e)}})),[xe,r.computerId,Ye,k]),Qe=(0,G.useMemo)(()=>[...Ze,...Fee(qe,k,e=>{let t=z.items.find(t=>t.id===e.uploadId),r=e.error??(t?.status===`error`||t?.status===`cancelled`?t.message:void 0);return{key:e.key,path:e.path,width:e.width,height:r===void 0?e.height:Math.max(e.height,e.width*1.25),url:``,pending:!0,error:r,prompt:xe.find(t=>t.reference.computerId===e.computerId&&t.input.destination.path===e.path)?.typed.prompt??me.promptAt(e.path),pendingLabel:t?.status===`complete`||fe.has(e.key)?`Loading preview…`:e.uploadId?`Uploading image…`:e.startedAt===void 0?e.pendingLabel:zW(ge.find(e=>e.kind===`video`),ie-e.startedAt,e.resumed),onOpen:()=>void 0,onStop:r===void 0&&e.uploadId===void 0?()=>{Te.current.stopPath(e.path)}:void 0,onRetry:r&&(j||t&&t.status!==`complete`)?()=>{if(F(e.key),t&&t.status!==`complete`){We.current.uploads.retry(t.id);return}!e.uploadId&&We.current.retryPath(e.path)||n.current&&We.current.addComputerFile(e.path,n.current,e.computerId)}:void 0,onDismiss:r?()=>{I(e.key),e.uploadId&&We.current.uploads.remove(e.uploadId)}:void 0}})],[Ze,xe,Xe,me.promptAt,fe,qe,k,z.items,j,ge,ie]),$e=!i&&be&&ye&&M&&C!==null&&he.kind===`ready`&&!_e&&ge.length>0,et=z.items.filter(e=>e.computerId===r.computerId),tt=()=>{e&&e.app.ui.openTeamBilling().catch(t=>{oW(`open-team-billing`,t),n.current===e&&me.reportRecoveryError(t)})},nt=[...he.kind===`error`&&ve===null?[{key:`generation:draft`,mediaKind:he.mediaKind,message:he.message,billing:he.action===`billing`?tt:void 0}]:[],...me.failures.map(e=>({key:e.key,mediaKind:e.mediaKind,message:e.message,billing:e.action===`billing`?tt:void 0,prompt:e.prompt,retry:e.retry,dismiss:()=>{for(let t of k)t.path===e.path&&I(t.key);e.dismiss()}}))],rt=P7({connected:e!==null,mediaCapability:be,modelsError:ve,retryModels:me.retryModels,modelsLoading:_e,models:ge,canGenerate:ye,mediaSetupMissing:i,canWrite:M,generationErrors:nt,recoveryError:Ce,pendingGenerations:xe,activeGenerations:Se,atGenerationLimit:me.atLimit,gallerySlots:k,computerId:r.computerId,failed:D,uploadError:z.error,uploads:et,permissions:()=>{e?.app.ui.requestAppPermissions({}).catch(e=>{me.reportRecoveryError(e)})},resume:e=>{me.resume(e)},discard:e=>{me.discard(e)},retryUpload:e=>{z.retry(e)}});h.error&&rt.push({key:`dismissal-storage`,group:`Setup`,tone:`warning`,blocking:!0,short:`Activity not saved`,title:`Activity not saved`,detail:h.error});let it=h.visible(rt),at={generating:Se.size,uploading:et.filter(e=>e.status===`sending`||e.status===`queued`).length},ot={items:et.filter(e=>e.status===`sending`||e.status===`queued`).map(e=>({id:e.id,name:e.file.name,preview:{kind:`image`,url:e.previewUrl},progress:null,progressLabel:``,statusLabel:e.message,actions:{cancel:{label:`Cancel`,accessibleLabel:`Cancel ${e.file.name}`}}})),onCancel:e=>{z.cancel(e)},onRetry:e=>{z.retry(e)},onRemove:e=>{z.remove(e)}},st=new Set([...T.entries.map(e=>`${r.computerId??``}:${e.path}`),...E.map(e=>e.source.kind===`computer`?`${e.source.computerId}:${e.source.path}`:e.file.name)]).size,ct=M7(it,at,d);kN(e?.app,[...r.available?[P1(r.landingPath??r.path,{checking:r.busy&&r.path===null,editing:r.editing})]:[],...ct===null?[]:[ct],...A?[{kind:`text`,id:`prints`,text:`${String(st)} ${st===1?`print`:`prints`}`}]:[]],e=>e.itemId===`activity`?(m(e.anchor?.start),f(e=>!e),!0):e.itemId!==`folder`||!r.available?!1:(r.setEditing(!0),!0),t=>{oW(`prints.status.report`,t),e?.app.ui.showToast({message:`Prints couldn't update its status bar.`,tone:`error`}).catch(e=>{oW(`prints.status.toast`,e)})});let lt=E.flatMap(e=>e.source.kind===`computer`?[{path:e.source.path,url:e.url,width:e.width,height:e.height}]:[]),ut=e=>{y(null),S.current+=1,x({key:e,requestId:`viewer-close-${String(S.current)}`,onFocus:()=>void 0})},dt=(t,n,i)=>(0,Z.jsx)(G.Suspense,{fallback:null,children:(0,Z.jsx)(vte,{image:t,app:e?.app??null,referenceImages:lt,models:ge,canAnimate:Y9(ge)!==void 0,operations:{session:me.session,atLimit:me.atLimit,onRun:async(e,n)=>{if(t.source.kind!==`computer`)return;let r=await me.operate({computerId:t.source.computerId,path:t.source.path,width:t.width,height:t.height},e,n);if(r!==null){Z9(r);return}_(null),v!==null&&ut(cW(t))}},download:i,library:te&&t.source.kind===`computer`&&r.destination!==null&&t.source.path.startsWith(`${r.destination}/`)?(()=>{let e=t.source.path,n=B.isFavorite(e);return{favorite:n,onToggleFavorite:()=>{B.toggleFavorite([e],!n)},onMove:M?()=>{B.setMoving([e])}:void 0}})():void 0,onIterate:(e,n)=>{if(t.source.kind!==`computer`)return null;let r=ote(e,{lineage:n,printComputerId:t.source.computerId,printPath:t.source.path,models:ge,styles:ue.styles.map(e=>e.name),current:Ne.store.state.values});return r.kind===`refused`?r.message:(Pe(r.draft),Ae(r.notice===null?null:{model:r.draft.model,message:r.notice}),_(null),v!==null&&ut(cW(t)),null)},onClose:n},t.url)}),ft={label:`Upload images`,onSelect:()=>De.current?.click(),disabled:!M||C===null,disabledReason:`Choose a writable Computer and folder to upload images.`},pt=!i&&Je===null&&r.computerId!==null&&r.available&&C===null,mt={label:`Choose folder`,onSelect:()=>{r.setEditing(!0)}},ht=(0,Z.jsx)(kJ,{variant:`ghost`,loading:a,onClick:l,children:`Set up image generation`});return(0,Z.jsxs)(`main`,{ref:t,className:`h-full w-full flex flex-col overflow-hidden`,"data-app-pane":`media`,"data-generation-state":he.kind,"data-computer-capability":A?`connected`:`absent`,onPaste:e=>{let t=Array.from(e.clipboardData.files);t.length&&M&&(e.preventDefault(),ee(t.map(e=>(Oe.current+=1,new File([e],`paste-${String(Oe.current)}-${hU(e.name)}`,{type:e.type,lastModified:e.lastModified})))))},children:[(0,Z.jsx)(MH,{id:`prints-generation-notices`}),(0,Z.jsxs)(`div`,{className:`prints-library`,"data-library":te||void 0,children:[te&&r.destination?(0,Z.jsx)(G.Suspense,{fallback:(0,Z.jsx)(`nav`,{className:`prints-rail`,"aria-label":`Library`,"aria-busy":`true`}),children:(0,Z.jsx)(hte,{app:e.app,root:r.destination,view:r.view,onView:B.history.open,canWrite:M,version:B.version,onNewFolder:e=>{B.setNewFolder({parent:e})},onDrop:(e,t)=>{B.move(e,t)},onRename:(e,t)=>{B.move([e],B.folderOf(r.destination??``,e),{name:t})},onMoveRows:B.setMoving})}):null,(0,Z.jsxs)(`div`,{className:`prints-library-main`,"data-selecting":B.selecting||void 0,children:[te?(0,Z.jsxs)(Z.Fragment,{children:[H?null:(0,Z.jsx)(D1,{view:r.view,lastFolder:B.lastFolder,onOpen:B.history.open,onFolders:()=>{re(!0)},subfolders:r.view.kind===`folder`?w.gallery.folders:[],onOpenSubfolder:e=>{B.history.open({kind:`folder`,folder:r.view.kind===`folder`&&r.view.folder?`${r.view.folder}/${e}`:e})}}),B.selecting?(0,Z.jsx)(E1,{count:B.selected.size,total:T.entries.length,canWrite:M,onToggleAll:()=>{B.selectAll(B.selected.size===T.entries.length?[]:T.entries.map(e=>e.path))},onMove:()=>{B.setMoving([...B.selected])},onFavorite:()=>{B.toggleFavorite([...B.selected],!0)},onDone:()=>{B.setSelecting(!1)}}):null]}):null,(0,Z.jsxs)(`div`,{className:`prints-gallery-region`,children:[(0,Z.jsx)(O$,{screen:!0,ref:Ee,className:`prints-gallery-scroll flex-1 min-h-0`,"data-media-scroll":!0,"aria-busy":O||T.loading,onDragOver:e=>{e.preventDefault()},onDrop:e=>{e.preventDefault();let t=Array.from(e.dataTransfer.files);t.length&&M&&ee(t)},children:(0,Z.jsxs)(`div`,{className:`prints-gallery-content`,children:[Qe.length>0?(0,Z.jsx)(Pee,{items:te?Qe.map(B.enrich):Qe,scrollRef:Ee,focus:v===null?b??(le&&se.target?{key:`${se.target.computerId}:${se.target.path}`,requestId:se.target.requestId,onFocus:()=>{_(null),y(cW(le))}}:void 0):void 0}):O||T.loading?(0,Z.jsx)(n1,{"data-media-loading":!0,framed:!1,message:`Loading prints…`,detail:`Your library is on its way.`,variant:`wander`}):(0,Z.jsx)(e1,{"aria-live":`polite`,"data-absence":!0,"data-media-empty":!0,role:`status`,variant:`speech`,className:`prints-invitation`,visual:`blobs`,title:i?`Make and collect images`:Je?.title??`Make your first print`,description:i?`Upload images to start your collection. Open any image to view or download it.`:Je===null?r.computerId===null?`Your images will appear here.`:pt?`Choose where Prints saves, then describe something.`:`Describe something and it lands here, or drop in images from your Computer.`:Je.description,primaryAction:i?ft:pt?mt:void 0,actions:pt?void 0:i?(0,Z.jsxs)(`div`,{className:`prints-image-setup`,children:[(0,Z.jsx)(`span`,{children:u}),ht]}):(0,Z.jsx)(kJ,{variant:`ghost`,size:`sm`,disabled:!M||C===null,onClick:()=>De.current?.click(),children:`Upload images`}),suggestions:i||pt?void 0:yte.map(e=>({label:e,disabled:!$e,onSelect:()=>{Ne.setFieldValue(`prompt`,e),t.current?.querySelector(`[data-generation-prompt]`)?.focus()}}))}),T.hasNextPage&&(0,Z.jsx)(kJ,{variant:`ghost`,disabled:T.loading,onClick:T.loadMore,children:T.loading?`Loading images…`:`Load more images`})]})}),g&&(g.source.kind===`local`||g.source.connection===e&&g.source.computerId===r.computerId)?dt(g,()=>{_(null)}):null]})]})]}),te&&r.destination?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(X9,{active:B.moving!==null,children:(0,Z.jsx)(fte,{app:e.app,root:r.destination,from:r.view.kind===`folder`?{folder:r.view.folder}:null,canWrite:M,count:B.moving?.length??0,open:B.moving!==null,version:B.version,onClose:()=>{B.setMoving(null)},onMove:(e,t)=>{let n=B.moving??[];B.setMoving(null),B.setSelecting(!1),B.move(n,e,{create:t})}})}),(0,Z.jsx)(X9,{active:B.newFolder!==null,children:(0,Z.jsx)(pte,{parent:B.newFolder?.parent,open:B.newFolder!==null,onClose:()=>{B.setNewFolder(null)},onCreate:e=>B.createFolder(B.newFolder?.parent,e)})}),(0,Z.jsx)(X9,{active:ne,children:(0,Z.jsx)(mte,{open:ne,onOpenChange:re,app:e.app,root:r.destination,view:r.view,onView:e=>{B.history.open(e),re(!1)},canWrite:M,version:B.version,onNewFolder:e=>{re(!1),B.setNewFolder({parent:e})},onMoveRows:B.setMoving})})]}):null,v===null?null:(0,Z.jsx)(G.Suspense,{fallback:null,children:(0,Z.jsx)(gte,{items:Qe,images:E,viewerKey:v,app:e?.app??null,onNavigate:y,onClose:ut,renderInfo:(e,t)=>dt(e,t,null)})}),i&&Qe.length>0?(0,Z.jsxs)(`div`,{className:`prints-library-actions`,children:[(0,Z.jsx)(kJ,{size:`sm`,onClick:ft.onSelect,disabled:ft.disabled,children:`Upload images`}),ht,s?(0,Z.jsx)(`div`,{className:`prints-image-setup`,children:u}):null]}):null,(0,Z.jsxs)(`div`,{className:`prints-composer-dock`,children:[(0,Z.jsx)(`section`,{"aria-label":`Computer uploads`,className:`prints-uploads`,children:(0,Z.jsx)(`input`,{ref:De,type:`file`,disabled:!M||C===null,accept:`image/*`,multiple:!0,hidden:!0,"aria-label":`Choose images to upload`,onChange:e=>{ee(Array.from(e.currentTarget.files??[])),e.currentTarget.value=``}})}),i?null:(0,Z.jsx)(Cte,{addedLength:Ve?.kind===`audio`?0:pK(Ie.prompt,ue.styles.find(e=>e.name===Ie.style)?.text,de.characters),styleControls:e=>({picker:(0,Z.jsx)(ste,{styles:ue.styles,selected:Ie.style,disabled:!be||_e||ze,onSelect:e=>{Ne.setFieldValue(`style`,e)}}),dialog:(0,Z.jsx)(X9,{active:e.open,children:(0,Z.jsx)(lte,{open:e.open,onOpenChange:e.onOpenChange,styles:ue.styles,selected:Ie.style,busy:ue.busy,error:ue.error,onSelect:e=>{Ne.setFieldValue(`style`,e)},onSave:ue.save,onDelete:(e,t)=>{ue.remove(e.id,t)}})})}),characters:de.characters,characterDialog:e=>(0,Z.jsx)(X9,{active:e.open,children:(0,Z.jsx)(ute,{open:e.open,onOpenChange:e.onOpenChange,characters:de.characters,images:lt,busy:de.busy,error:de.error,canUpload:M&&C!==null,onUpload:()=>De.current?.click(),onSave:de.save,onDelete:(e,t)=>{de.remove(e.id,t)}})}),guidance:it.find(e=>e.blocking&&e.group===`Setup`)??(ke!==null&&ke.model===Ie.model?{key:`iteration-model`,group:`Images`,tone:`warning`,short:`Model changed`,title:`Model changed`,detail:ke.message,actions:[{label:`Dismiss`,run:()=>{Ae(null)}}]}:void 0),commandApp:Be,actions:(0,Z.jsx)(zJ,{"aria-label":`Upload images`,title:M?`Upload images to Computer`:`Connect a writable Computer to upload`,icon:(0,Z.jsx)(ZI,{}),label:null,className:`prints-upload-key`,disabled:!M||C===null,onClick:()=>De.current?.click()}),form:Ne,mediaCapability:be&&ye&&M&&C!==null,models:ge,modelsLoading:_e,onSubmit:Ne.submitCurrent,submitting:ze,generateLimitReason:me.atLimit?pW:void 0,values:Ie,computerId:r.computerId,mediaDirectory:C,referenceImages:lt,referenceLabels:Le,price:Re}),ct===null?null:(0,Z.jsx)(X9,{active:d,children:(0,Z.jsx)(cte,{notices:it,uploads:ot,open:d,inset:p,onOpenChange:f,onDismiss:h.dismiss,onDismissAll:()=>{h.dismissAll(rt)},onLoadMore:me.hasMore?me.loadMore:void 0})})]}),r.editing?(0,Z.jsx)(G.Suspense,{fallback:null,children:(0,Z.jsx)(_te,{folder:r})}):null]})}var $9=document.getElementById(`media-root`);if(!$9)throw Error(`Media root is missing`);wN($9,{name:`Prints`,queryClient:tP()},({app:e})=>(0,G.createElement)(wte,{connection:e?{app:e}:null}));export{N2 as $,qI as $n,M_ as $r,cX as $t,s6 as A,d as Ai,UH as An,nS as Ar,L$ as At,m4 as B,lH as Bn,dS as Br,E$ as Bt,F6 as C,no as Ci,cW as Cn,Uw as Cr,x1 as Ct,E6 as D,eo as Di,XU as Dn,X as Dr,J$ as Dt,w6 as E,Ra as Ei,oW as En,gC as Er,X$ as Et,V4 as F,DH as Fn,eS as Fr,N$ as Ft,j2 as G,UR as Gn,Hx as Gr,mZ as Gt,Y2 as H,XV as Hn,pS as Hr,gZ as Ht,T4 as I,EH as In,J as Ir,A$ as It,M2 as J,jR as Jn,L_ as Jr,nZ as Jt,P2 as K,LR as Kn,z_ as Kr,rZ as Kt,C4 as L,SH as Ln,VS as Lr,k$ as Lt,q3 as M,l as Mi,NH as Mn,Qx as Mr,z$ as Mt,K3 as N,IH as Nn,lS as Nr,q$ as Nt,T6 as O,U as Oi,vU as On,lC as Or,H$ as Ot,G3 as P,TH as Pn,iS as Pr,M$ as Pt,H2 as Q,YI as Qn,P_ as Qr,WX as Qt,h4 as R,fH as Rn,$x as Rr,O$ as Rt,z6 as S,fa as Si,pW as Sn,Jw as Sr,R1 as St,C6 as T,Qa as Ti,uW as Tn,vC as Tr,w1 as Tt,X2 as U,YV as Un,Ux as Ur,_Z as Ut,a4 as V,ZV as Vn,Gx as Vr,$ as Vt,W2 as W,UV as Wn,hS as Wr,hZ as Wt,B2 as X,QI as Xn,F_ as Xr,tZ as Xt,L2 as Y,aL as Yn,j_ as Yr,iZ as Yt,V2 as Z,ZI as Zn,B_ as Zr,HX as Zt,f5 as _,La as _i,gG as _n,iP as _r,r0 as _t,w9 as a,kd as ai,zJ as an,RI as ar,y2 as at,O8 as b,No as bi,tG as bn,ON as br,X1 as bt,c7 as c,Nd as ci,EJ as cn,PI as cr,s2 as ct,V5 as d,Za as di,Mq as dn,jI as dr,J0 as dt,V_ as ei,qY as en,KI as er,U2 as et,q5 as f,Va as fi,AK as fn,AI as fr,A0 as ft,m5 as g,Co as gi,hG as gn,RF as gr,h0 as gt,P5 as h,ho as hi,pG as hn,TF as hr,c0 as ht,T9 as i,Oy as ii,GJ as in,zI as ir,b2 as it,i6 as j,o as ji,LH as jn,yS as jr,I$ as jt,u6 as k,nr as ki,HH as kn,aS as kr,B$ as kt,t7 as l,Od as li,vJ as ln,NI as lr,e2 as lt,U5 as m,po as mi,fG as mn,sI as mr,l0 as mt,W9 as n,qy as ni,nY as nn,HI as nr,k2 as nt,S9 as o,Md as oi,LJ as on,II as or,c2 as ot,Y5 as p,To as pi,rK as pn,DI as pr,s0 as pt,R2 as q,Q as qn,I_ as qr,aZ as qt,U9 as r,Ky as ri,$J as rn,BI as rr,C2 as rt,S7 as s,Dd as si,kJ as sn,FI as sr,l2 as st,G9 as t,Gy as ti,MY as tn,UI as tr,z2 as tt,s7 as u,Ad as ui,gJ as un,MI as ur,K0 as ut,d5 as v,$a as vi,mG as vn,nP as vr,n0 as vt,D6 as w,mo as wi,lW as wn,Vw as wr,C1 as wt,D8 as x,ma as xi,eG as xn,eT as xr,G1 as xt,t5 as y,yo as yi,gW as yn,$N as yr,$1 as yt,c4 as z,dH as zn,sS as zr,D$ as zt};
84
+ `+e.stack}return{value:e,source:t,stack:i,digest:null}}function Os(e,t,n){return{value:e,source:null,stack:n??null,digest:t??null}}function ks(e,t){try{console.error(t.value)}catch(e){setTimeout(function(){throw e})}}var As=typeof WeakMap==`function`?WeakMap:Map;function js(e,t,n){n=ro(-1,n),n.tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){cl||(cl=!0,ll=r),ks(e,t)},n}function Ms(e,t,n){n=ro(-1,n),n.tag=3;var r=e.type.getDerivedStateFromError;if(typeof r==`function`){var i=t.value;n.payload=function(){return r(i)},n.callback=function(){ks(e,t)}}var a=e.stateNode;return a!==null&&typeof a.componentDidCatch==`function`&&(n.callback=function(){ks(e,t),typeof r!=`function`&&(ul===null?ul=new Set([this]):ul.add(this));var n=t.stack;this.componentDidCatch(t.value,{componentStack:n===null?``:n})}),n}function Ns(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new As;var i=new Set;r.set(t,i)}else i=r.get(t),i===void 0&&(i=new Set,r.set(t,i));i.has(n)||(i.add(n),e=Gl.bind(null,e,t,n),t.then(e,e))}function Ps(e){do{var t;if((t=e.tag===13)&&(t=e.memoizedState,t=t===null||t.dehydrated!==null),t)return e;e=e.return}while(e!==null);return null}function Fs(e,t,n,r,i){return e.mode&1?(e.flags|=65536,e.lanes=i,e):(e===t?e.flags|=65536:(e.flags|=128,n.flags|=131072,n.flags&=-52805,n.tag===1&&(n.alternate===null?n.tag=17:(t=ro(-1,1),t.tag=2,io(n,t,1))),n.lanes|=1),e)}var Is=S.ReactCurrentOwner,Ls=!1;function Rs(e,t,n,r){t.child=e===null?Va(t,null,n,r):Ba(t,e.child,n,r)}function zs(e,t,n,r,i){n=n.render;var a=t.ref;return Ya(t,i),r=Fo(e,t,n,r,a,i),n=Io(),e!==null&&!Ls?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i,ac(e,t,i)):(wa&&n&&ba(t),t.flags|=1,Rs(e,t,r,i),t.child)}function Bs(e,t,n,r,i){if(e===null){var a=n.type;return typeof a==`function`&&!$l(a)&&a.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(t.tag=15,t.type=a,Vs(e,t,a,r,i)):(e=nu(n.type,null,r,t,t.mode,i),e.ref=t.ref,e.return=t,t.child=e)}if(a=e.child,(e.lanes&i)===0){var o=a.memoizedProps;if(n=n.compare,n=n===null?Or:n,n(o,r)&&e.ref===t.ref)return ac(e,t,i)}return t.flags|=1,e=tu(a,r),e.ref=t.ref,e.return=t,t.child=e}function Vs(e,t,n,r,i){if(e!==null){var a=e.memoizedProps;if(Or(a,r)&&e.ref===t.ref){if(Ls=!1,t.pendingProps=r=a,(e.lanes&i)!==0)e.flags&131072&&(Ls=!0);else return t.lanes=e.lanes,ac(e,t,i)}}return Ws(e,t,n,r,i)}function Hs(e,t,n){var r=t.pendingProps,i=r.children,a=e===null?null:e.memoizedState;if(r.mode===`hidden`){if(!(t.mode&1))t.memoizedState={baseLanes:0,cachePool:null,transitions:null},Ki(Zc,Xc),Xc|=n;else{if(!(n&1073741824))return e=a===null?n:a.baseLanes|n,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,Ki(Zc,Xc),Xc|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=a===null?n:a.baseLanes,Ki(Zc,Xc),Xc|=r}}else a===null?r=n:(r=a.baseLanes|n,t.memoizedState=null),Ki(Zc,Xc),Xc|=r;return Rs(e,t,i,n),t.child}function Us(e,t){var n=t.ref;(e===null&&n!==null||e!==null&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function Ws(e,t,n,r,i){var a=Qi(n)?Xi:Ji.current;return a=Zi(t,a),Ya(t,i),n=Fo(e,t,n,r,a,i),r=Io(),e!==null&&!Ls?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i,ac(e,t,i)):(wa&&r&&ba(t),t.flags|=1,Rs(e,t,n,i),t.child)}function Gs(e,t,n,r,i){if(Qi(n)){var a=!0;na(t)}else a=!1;if(Ya(t,i),t.stateNode===null)ic(e,t),ws(t,n,r),Es(t,n,r,i),r=!0;else if(e===null){var o=t.stateNode,s=t.memoizedProps;o.props=s;var c=o.context,l=n.contextType;typeof l==`object`&&l?l=Xa(l):(l=Qi(n)?Xi:Ji.current,l=Zi(t,l));var u=n.getDerivedStateFromProps,d=typeof u==`function`||typeof o.getSnapshotBeforeUpdate==`function`;d||typeof o.UNSAFE_componentWillReceiveProps!=`function`&&typeof o.componentWillReceiveProps!=`function`||(s!==r||c!==l)&&Ts(t,o,r,l),W=!1;var f=t.memoizedState;o.state=f,so(t,r,o,i),c=t.memoizedState,s!==r||f!==c||Yi.current||W?(typeof u==`function`&&(xs(t,n,u,r),c=t.memoizedState),(s=W||Cs(t,n,s,r,f,c,l))?(d||typeof o.UNSAFE_componentWillMount!=`function`&&typeof o.componentWillMount!=`function`||(typeof o.componentWillMount==`function`&&o.componentWillMount(),typeof o.UNSAFE_componentWillMount==`function`&&o.UNSAFE_componentWillMount()),typeof o.componentDidMount==`function`&&(t.flags|=4194308)):(typeof o.componentDidMount==`function`&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=c),o.props=r,o.state=c,o.context=l,r=s):(typeof o.componentDidMount==`function`&&(t.flags|=4194308),r=!1)}else{o=t.stateNode,no(e,t),s=t.memoizedProps,l=t.type===t.elementType?s:bs(t.type,s),o.props=l,d=t.pendingProps,f=o.context,c=n.contextType,typeof c==`object`&&c?c=Xa(c):(c=Qi(n)?Xi:Ji.current,c=Zi(t,c));var p=n.getDerivedStateFromProps;(u=typeof p==`function`||typeof o.getSnapshotBeforeUpdate==`function`)||typeof o.UNSAFE_componentWillReceiveProps!=`function`&&typeof o.componentWillReceiveProps!=`function`||(s!==d||f!==c)&&Ts(t,o,r,c),W=!1,f=t.memoizedState,o.state=f,so(t,r,o,i);var m=t.memoizedState;s!==d||f!==m||Yi.current||W?(typeof p==`function`&&(xs(t,n,p,r),m=t.memoizedState),(l=W||Cs(t,n,l,r,f,m,c)||!1)?(u||typeof o.UNSAFE_componentWillUpdate!=`function`&&typeof o.componentWillUpdate!=`function`||(typeof o.componentWillUpdate==`function`&&o.componentWillUpdate(r,m,c),typeof o.UNSAFE_componentWillUpdate==`function`&&o.UNSAFE_componentWillUpdate(r,m,c)),typeof o.componentDidUpdate==`function`&&(t.flags|=4),typeof o.getSnapshotBeforeUpdate==`function`&&(t.flags|=1024)):(typeof o.componentDidUpdate!=`function`||s===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof o.getSnapshotBeforeUpdate!=`function`||s===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=m),o.props=r,o.state=m,o.context=c,r=l):(typeof o.componentDidUpdate!=`function`||s===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof o.getSnapshotBeforeUpdate!=`function`||s===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),r=!1)}return Ks(e,t,n,r,a,i)}function Ks(e,t,n,r,i,a){Us(e,t);var o=!!(t.flags&128);if(!r&&!o)return i&&ra(t,n,!1),ac(e,t,a);r=t.stateNode,Is.current=t;var s=o&&typeof n.getDerivedStateFromError!=`function`?null:r.render();return t.flags|=1,e!==null&&o?(t.child=Ba(t,e.child,null,a),t.child=Ba(t,null,s,a)):Rs(e,t,s,a),t.memoizedState=r.state,i&&ra(t,n,!0),t.child}function qs(e){var t=e.stateNode;t.pendingContext?ea(e,t.pendingContext,t.pendingContext!==t.context):t.context&&ea(e,t.context,!1),ho(e,t.containerInfo)}function Js(e,t,n,r,i){return Na(),Pa(i),t.flags|=256,Rs(e,t,n,r),t.child}var Ys={dehydrated:null,treeContext:null,retryLane:0};function Xs(e){return{baseLanes:e,cachePool:null,transitions:null}}function Zs(e,t,n){var r=t.pendingProps,i=yo.current,a=!1,o=!!(t.flags&128),s;if((s=o)||(s=e!==null&&e.memoizedState===null?!1:!!(i&2)),s?(a=!0,t.flags&=-129):(e===null||e.memoizedState!==null)&&(i|=1),Ki(yo,i&1),e===null)return ka(t),e=t.memoizedState,e!==null&&(e=e.dehydrated,e!==null)?(t.lanes=t.mode&1?e.data===`$!`?8:1073741824:1,null):(o=r.children,e=r.fallback,a?(r=t.mode,a=t.child,o={mode:`hidden`,children:o},!(r&1)&&a!==null?(a.childLanes=0,a.pendingProps=o):a=iu(o,r,0,null),e=ru(e,r,n,null),a.return=t,e.return=t,a.sibling=e,t.child=a,t.child.memoizedState=Xs(n),t.memoizedState=Ys,e):Qs(t,o));if(i=e.memoizedState,i!==null&&(s=i.dehydrated,s!==null))return ec(e,t,o,r,s,i,n);if(a){a=r.fallback,o=t.mode,i=e.child,s=i.sibling;var c={mode:`hidden`,children:r.children};return!(o&1)&&t.child!==i?(r=t.child,r.childLanes=0,r.pendingProps=c,t.deletions=null):(r=tu(i,c),r.subtreeFlags=i.subtreeFlags&14680064),s===null?(a=ru(a,o,n,null),a.flags|=2):a=tu(s,a),a.return=t,r.return=t,r.sibling=a,t.child=r,r=a,a=t.child,o=e.child.memoizedState,o=o===null?Xs(n):{baseLanes:o.baseLanes|n,cachePool:null,transitions:o.transitions},a.memoizedState=o,a.childLanes=e.childLanes&~n,t.memoizedState=Ys,r}return a=e.child,e=a.sibling,r=tu(a,{mode:`visible`,children:r.children}),!(t.mode&1)&&(r.lanes=n),r.return=t,r.sibling=null,e!==null&&(n=t.deletions,n===null?(t.deletions=[e],t.flags|=16):n.push(e)),t.child=r,t.memoizedState=null,r}function Qs(e,t){return t=iu({mode:`visible`,children:t},e.mode,0,null),t.return=e,e.child=t}function $s(e,t,n,r){return r!==null&&Pa(r),Ba(t,e.child,null,n),e=Qs(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function ec(e,t,n,i,a,o,s){if(n)return t.flags&256?(t.flags&=-257,i=Os(Error(r(422))),$s(e,t,s,i)):t.memoizedState===null?(o=i.fallback,a=t.mode,i=iu({mode:`visible`,children:i.children},a,0,null),o=ru(o,a,s,null),o.flags|=2,i.return=t,o.return=t,i.sibling=o,t.child=i,t.mode&1&&Ba(t,e.child,null,s),t.child.memoizedState=Xs(s),t.memoizedState=Ys,o):(t.child=e.child,t.flags|=128,null);if(!(t.mode&1))return $s(e,t,s,null);if(a.data===`$!`){if(i=a.nextSibling&&a.nextSibling.dataset,i)var c=i.dgst;return i=c,o=Error(r(419)),i=Os(o,i,void 0),$s(e,t,s,i)}if(c=(s&e.childLanes)!==0,Ls||c){if(i=qc,i!==null){switch(s&-s){case 4:a=2;break;case 16:a=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:a=32;break;case 536870912:a=268435456;break;default:a=0}a=(a&(i.suspendedLanes|s))===0?a:0,a!==0&&a!==o.retryLane&&(o.retryLane=a,eo(e,a),bl(i,e,a,-1))}return Pl(),i=Os(Error(r(421))),$s(e,t,s,i)}return a.data===`$?`?(t.flags|=128,t.child=e.child,t=ql.bind(null,e),a._reactRetry=t,null):(e=o.treeContext,Ca=ki(a.nextSibling),Sa=t,wa=!0,Ta=null,e!==null&&(ma[U++]=ga,ma[U++]=_a,ma[U++]=ha,ga=e.id,_a=e.overflow,ha=t),t=Qs(t,i.children),t.flags|=4096,t)}function tc(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),Ja(e.return,t,n)}function nc(e,t,n,r,i){var a=e.memoizedState;a===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:i}:(a.isBackwards=t,a.rendering=null,a.renderingStartTime=0,a.last=r,a.tail=n,a.tailMode=i)}function rc(e,t,n){var r=t.pendingProps,i=r.revealOrder,a=r.tail;if(Rs(e,t,r.children,n),r=yo.current,r&2)r=r&1|2,t.flags|=128;else{if(e!==null&&e.flags&128)a:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&tc(e,n,t);else if(e.tag===19)tc(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break a;for(;e.sibling===null;){if(e.return===null||e.return===t)break a;e=e.return}e.sibling.return=e.return,e=e.sibling}r&=1}if(Ki(yo,r),!(t.mode&1))t.memoizedState=null;else switch(i){case`forwards`:for(n=t.child,i=null;n!==null;)e=n.alternate,e!==null&&bo(e)===null&&(i=n),n=n.sibling;n=i,n===null?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null),nc(t,!1,i,n,a);break;case`backwards`:for(n=null,i=t.child,t.child=null;i!==null;){if(e=i.alternate,e!==null&&bo(e)===null){t.child=i;break}e=i.sibling,i.sibling=n,n=i,i=e}nc(t,!0,n,null,a);break;case`together`:nc(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function ic(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function ac(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),el|=t.lanes,(n&t.childLanes)===0)return null;if(e!==null&&t.child!==e.child)throw Error(r(153));if(t.child!==null){for(e=t.child,n=tu(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=tu(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function oc(e,t,n){switch(t.tag){case 3:qs(t),Na();break;case 5:_o(t);break;case 1:Qi(t.type)&&na(t);break;case 4:ho(t,t.stateNode.containerInfo);break;case 10:var r=t.type._context,i=t.memoizedProps.value;Ki(Ha,r._currentValue),r._currentValue=i;break;case 13:if(r=t.memoizedState,r!==null)return r.dehydrated===null?(n&t.child.childLanes)===0?(Ki(yo,yo.current&1),e=ac(e,t,n),e===null?null:e.sibling):Zs(e,t,n):(Ki(yo,yo.current&1),t.flags|=128,null);Ki(yo,yo.current&1);break;case 19:if(r=(n&t.childLanes)!==0,e.flags&128){if(r)return rc(e,t,n);t.flags|=128}if(i=t.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),Ki(yo,yo.current),r)break;return null;case 22:case 23:return t.lanes=0,Hs(e,t,n)}return ac(e,t,n)}var sc=function(e,t){for(var n=t.child;n!==null;){if(n.tag===5||n.tag===6)e.appendChild(n.stateNode);else if(n.tag!==4&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===t)break;for(;n.sibling===null;){if(n.return===null||n.return===t)return;n=n.return}n.sibling.return=n.return,n=n.sibling}},cc=function(e,t,n,r){var i=e.memoizedProps;if(i!==r){e=t.stateNode,mo(uo.current);var o=null;switch(n){case`input`:i=le(e,i),r=le(e,r),o=[];break;case`select`:i=R({},i,{value:void 0}),r=R({},r,{value:void 0}),o=[];break;case`textarea`:i=_e(e,i),r=_e(e,r),o=[];break;default:typeof i.onClick!=`function`&&typeof r.onClick==`function`&&(e.onclick=yi)}je(n,r);var s;for(u in n=null,i)if(!r.hasOwnProperty(u)&&i.hasOwnProperty(u)&&i[u]!=null){if(u===`style`){var c=i[u];for(s in c)c.hasOwnProperty(s)&&(n||={},n[s]=``)}else u!==`dangerouslySetInnerHTML`&&u!==`children`&&u!==`suppressContentEditableWarning`&&u!==`suppressHydrationWarning`&&u!==`autoFocus`&&(a.hasOwnProperty(u)?o||=[]:(o||=[]).push(u,null))}for(u in r){var l=r[u];if(c=i?.[u],r.hasOwnProperty(u)&&l!==c&&(l!=null||c!=null)){if(u===`style`){if(c){for(s in c)!c.hasOwnProperty(s)||l&&l.hasOwnProperty(s)||(n||={},n[s]=``);for(s in l)l.hasOwnProperty(s)&&c[s]!==l[s]&&(n||={},n[s]=l[s])}else n||(o||=[],o.push(u,n)),n=l}else u===`dangerouslySetInnerHTML`?(l=l?l.__html:void 0,c=c?c.__html:void 0,l!=null&&c!==l&&(o||=[]).push(u,l)):u===`children`?typeof l!=`string`&&typeof l!=`number`||(o||=[]).push(u,``+l):u!==`suppressContentEditableWarning`&&u!==`suppressHydrationWarning`&&(a.hasOwnProperty(u)?(l!=null&&u===`onScroll`&&ai(`scroll`,e),o||c===l||(o=[])):(o||=[]).push(u,l))}}n&&(o||=[]).push(`style`,n);var u=o;(t.updateQueue=u)&&(t.flags|=4)}},lc=function(e,t,n,r){n!==r&&(t.flags|=4)};function uc(e,t){if(!wa)switch(e.tailMode){case`hidden`:t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case`collapsed`:n=e.tail;for(var r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:r.sibling=null}}function dc(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,r=0;if(t)for(var i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags&14680064,r|=i.flags&14680064,i.return=e,i=i.sibling;else for(i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags,r|=i.flags,i.return=e,i=i.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function fc(e,t,n){var i=t.pendingProps;switch(xa(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return dc(t),null;case 1:return Qi(t.type)&&$i(),dc(t),null;case 3:return i=t.stateNode,go(),Gi(Yi),Gi(Ji),So(),i.pendingContext&&(i.context=i.pendingContext,i.pendingContext=null),(e===null||e.child===null)&&(ja(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,Ta!==null&&(wl(Ta),Ta=null))),dc(t),null;case 5:vo(t);var o=mo(po.current);if(n=t.type,e!==null&&t.stateNode!=null)cc(e,t,n,i,o),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!i){if(t.stateNode===null)throw Error(r(166));return dc(t),null}if(e=mo(uo.current),ja(t)){i=t.stateNode,n=t.type;var s=t.memoizedProps;switch(i[Mi]=t,i[Ni]=s,e=!!(t.mode&1),n){case`dialog`:ai(`cancel`,i),ai(`close`,i);break;case`iframe`:case`object`:case`embed`:ai(`load`,i);break;case`video`:case`audio`:for(o=0;o<ti.length;o++)ai(ti[o],i);break;case`source`:ai(`error`,i);break;case`img`:case`image`:case`link`:ai(`error`,i),ai(`load`,i);break;case`details`:ai(`toggle`,i);break;case`input`:ue(i,s),ai(`invalid`,i);break;case`select`:i._wrapperState={wasMultiple:!!s.multiple},ai(`invalid`,i);break;case`textarea`:ve(i,s),ai(`invalid`,i)}for(var c in je(n,s),o=null,s)if(s.hasOwnProperty(c)){var l=s[c];c===`children`?typeof l==`string`?i.textContent!==l&&(!0!==s.suppressHydrationWarning&&vi(i.textContent,l,e),o=[`children`,l]):typeof l==`number`&&i.textContent!==``+l&&(!0!==s.suppressHydrationWarning&&vi(i.textContent,l,e),o=[`children`,``+l]):a.hasOwnProperty(c)&&l!=null&&c===`onScroll`&&ai(`scroll`,i)}switch(n){case`input`:oe(i),pe(i,s,!0);break;case`textarea`:oe(i),be(i);break;case`select`:case`option`:break;default:typeof s.onClick==`function`&&(i.onclick=yi)}i=o,t.updateQueue=i,i!==null&&(t.flags|=4)}else{c=o.nodeType===9?o:o.ownerDocument,e===`http://www.w3.org/1999/xhtml`&&(e=xe(n)),e===`http://www.w3.org/1999/xhtml`?n===`script`?(e=c.createElement(`div`),e.innerHTML=`<script><\/script>`,e=e.removeChild(e.firstChild)):typeof i.is==`string`?e=c.createElement(n,{is:i.is}):(e=c.createElement(n),n===`select`&&(c=e,i.multiple?c.multiple=!0:i.size&&(c.size=i.size))):e=c.createElementNS(e,n),e[Mi]=t,e[Ni]=i,sc(e,t,!1,!1),t.stateNode=e;a:{switch(c=Me(n,i),n){case`dialog`:ai(`cancel`,e),ai(`close`,e),o=i;break;case`iframe`:case`object`:case`embed`:ai(`load`,e),o=i;break;case`video`:case`audio`:for(o=0;o<ti.length;o++)ai(ti[o],e);o=i;break;case`source`:ai(`error`,e),o=i;break;case`img`:case`image`:case`link`:ai(`error`,e),ai(`load`,e),o=i;break;case`details`:ai(`toggle`,e),o=i;break;case`input`:ue(e,i),o=le(e,i),ai(`invalid`,e);break;case`option`:o=i;break;case`select`:e._wrapperState={wasMultiple:!!i.multiple},o=R({},i,{value:void 0}),ai(`invalid`,e);break;case`textarea`:ve(e,i),o=_e(e,i),ai(`invalid`,e);break;default:o=i}for(s in je(n,o),l=o,l)if(l.hasOwnProperty(s)){var u=l[s];s===`style`?ke(e,u):s===`dangerouslySetInnerHTML`?(u=u?u.__html:void 0,u!=null&&we(e,u)):s===`children`?typeof u==`string`?(n!==`textarea`||u!==``)&&Te(e,u):typeof u==`number`&&Te(e,``+u):s!==`suppressContentEditableWarning`&&s!==`suppressHydrationWarning`&&s!==`autoFocus`&&(a.hasOwnProperty(s)?u!=null&&s===`onScroll`&&ai(`scroll`,e):u!=null&&x(e,s,u,c))}switch(n){case`input`:oe(e),pe(e,i,!1);break;case`textarea`:oe(e),be(e);break;case`option`:i.value!=null&&e.setAttribute(`value`,``+H(i.value));break;case`select`:e.multiple=!!i.multiple,s=i.value,s==null?i.defaultValue!=null&&ge(e,!!i.multiple,i.defaultValue,!0):ge(e,!!i.multiple,s,!1);break;default:typeof o.onClick==`function`&&(e.onclick=yi)}switch(n){case`button`:case`input`:case`select`:case`textarea`:i=!!i.autoFocus;break a;case`img`:i=!0;break a;default:i=!1}}i&&(t.flags|=4)}t.ref!==null&&(t.flags|=512,t.flags|=2097152)}return dc(t),null;case 6:if(e&&t.stateNode!=null)lc(e,t,e.memoizedProps,i);else{if(typeof i!=`string`&&t.stateNode===null)throw Error(r(166));if(n=mo(po.current),mo(uo.current),ja(t)){if(i=t.stateNode,n=t.memoizedProps,i[Mi]=t,(s=i.nodeValue!==n)&&(e=Sa,e!==null))switch(e.tag){case 3:vi(i.nodeValue,n,!!(e.mode&1));break;case 5:!0!==e.memoizedProps.suppressHydrationWarning&&vi(i.nodeValue,n,!!(e.mode&1))}s&&(t.flags|=4)}else i=(n.nodeType===9?n:n.ownerDocument).createTextNode(i),i[Mi]=t,t.stateNode=i}return dc(t),null;case 13:if(Gi(yo),i=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(wa&&Ca!==null&&t.mode&1&&!(t.flags&128))Ma(),Na(),t.flags|=98560,s=!1;else if(s=ja(t),i!==null&&i.dehydrated!==null){if(e===null){if(!s)throw Error(r(318));if(s=t.memoizedState,s=s===null?null:s.dehydrated,!s)throw Error(r(317));s[Mi]=t}else Na(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;dc(t),s=!1}else Ta!==null&&(wl(Ta),Ta=null),s=!0;if(!s)return t.flags&65536?t:null}return t.flags&128?(t.lanes=n,t):(i=i!==null,i!==(e!==null&&e.memoizedState!==null)&&i&&(t.child.flags|=8192,t.mode&1&&(e===null||yo.current&1?Qc===0&&(Qc=3):Pl())),t.updateQueue!==null&&(t.flags|=4),dc(t),null);case 4:return go(),e===null&&ci(t.stateNode.containerInfo),dc(t),null;case 10:return qa(t.type._context),dc(t),null;case 17:return Qi(t.type)&&$i(),dc(t),null;case 19:if(Gi(yo),s=t.memoizedState,s===null)return dc(t),null;if(i=!!(t.flags&128),c=s.rendering,c===null){if(i)uc(s,!1);else{if(Qc!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(c=bo(e),c!==null){for(t.flags|=128,uc(s,!1),i=c.updateQueue,i!==null&&(t.updateQueue=i,t.flags|=4),t.subtreeFlags=0,i=n,n=t.child;n!==null;)s=n,e=i,s.flags&=14680066,c=s.alternate,c===null?(s.childLanes=0,s.lanes=e,s.child=null,s.subtreeFlags=0,s.memoizedProps=null,s.memoizedState=null,s.updateQueue=null,s.dependencies=null,s.stateNode=null):(s.childLanes=c.childLanes,s.lanes=c.lanes,s.child=c.child,s.subtreeFlags=0,s.deletions=null,s.memoizedProps=c.memoizedProps,s.memoizedState=c.memoizedState,s.updateQueue=c.updateQueue,s.type=c.type,e=c.dependencies,s.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext}),n=n.sibling;return Ki(yo,yo.current&1|2),t.child}e=e.sibling}s.tail!==null&&ft()>ol&&(t.flags|=128,i=!0,uc(s,!1),t.lanes=4194304)}}else{if(!i){if(e=bo(c),e!==null){if(t.flags|=128,i=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),uc(s,!0),s.tail===null&&s.tailMode===`hidden`&&!c.alternate&&!wa)return dc(t),null}else 2*ft()-s.renderingStartTime>ol&&n!==1073741824&&(t.flags|=128,i=!0,uc(s,!1),t.lanes=4194304)}s.isBackwards?(c.sibling=t.child,t.child=c):(n=s.last,n===null?t.child=c:n.sibling=c,s.last=c)}return s.tail===null?(dc(t),null):(t=s.tail,s.rendering=t,s.tail=t.sibling,s.renderingStartTime=ft(),t.sibling=null,n=yo.current,Ki(yo,i?n&1|2:n&1),t);case 22:case 23:return Al(),i=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==i&&(t.flags|=8192),i&&t.mode&1?Xc&1073741824&&(dc(t),t.subtreeFlags&6&&(t.flags|=8192)):dc(t),null;case 24:return null;case 25:return null}throw Error(r(156,t.tag))}function pc(e,t){switch(xa(t),t.tag){case 1:return Qi(t.type)&&$i(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return go(),Gi(Yi),Gi(Ji),So(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return vo(t),null;case 13:if(Gi(yo),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(r(340));Na()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Gi(yo),null;case 4:return go(),null;case 10:return qa(t.type._context),null;case 22:case 23:return Al(),null;case 24:return null;default:return null}}var mc=!1,hc=!1,gc=typeof WeakSet==`function`?WeakSet:Set,K=null;function _c(e,t){var n=e.ref;if(n!==null){if(typeof n==`function`)try{n(null)}catch(n){Wl(e,t,n)}else n.current=null}}function vc(e,t,n){try{n()}catch(n){Wl(e,t,n)}}var yc=!1;function bc(e,t){if(bi=dn,e=Mr(),Nr(e)){if(`selectionStart`in e)var n={start:e.selectionStart,end:e.selectionEnd};else a:{n=(n=e.ownerDocument)&&n.defaultView||window;var i=n.getSelection&&n.getSelection();if(i&&i.rangeCount!==0){n=i.anchorNode;var a=i.anchorOffset,o=i.focusNode;i=i.focusOffset;try{n.nodeType,o.nodeType}catch{n=null;break a}var s=0,c=-1,l=-1,u=0,d=0,f=e,p=null;b:for(;;){for(var m;f!==n||a!==0&&f.nodeType!==3||(c=s+a),f!==o||i!==0&&f.nodeType!==3||(l=s+i),f.nodeType===3&&(s+=f.nodeValue.length),(m=f.firstChild)!==null;)p=f,f=m;for(;;){if(f===e)break b;if(p===n&&++u===a&&(c=s),p===o&&++d===i&&(l=s),(m=f.nextSibling)!==null)break;f=p,p=f.parentNode}f=m}n=c===-1||l===-1?null:{start:c,end:l}}else n=null}n||={start:0,end:0}}else n=null;for(xi={focusedElem:e,selectionRange:n},dn=!1,K=t;K!==null;)if(t=K,e=t.child,t.subtreeFlags&1028&&e!==null)e.return=t,K=e;else for(;K!==null;){t=K;try{var h=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(h!==null){var g=h.memoizedProps,_=h.memoizedState,v=t.stateNode;v.__reactInternalSnapshotBeforeUpdate=v.getSnapshotBeforeUpdate(t.elementType===t.type?g:bs(t.type,g),_)}break;case 3:var y=t.stateNode.containerInfo;y.nodeType===1?y.textContent=``:y.nodeType===9&&y.documentElement&&y.removeChild(y.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(r(163))}}catch(e){Wl(t,t.return,e)}if(e=t.sibling,e!==null){e.return=t.return,K=e;break}K=t.return}return h=yc,yc=!1,h}function xc(e,t,n){var r=t.updateQueue;if(r=r===null?null:r.lastEffect,r!==null){var i=r=r.next;do{if((i.tag&e)===e){var a=i.destroy;i.destroy=void 0,a!==void 0&&vc(t,n,a)}i=i.next}while(i!==r)}}function Sc(e,t){if(t=t.updateQueue,t=t===null?null:t.lastEffect,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function Cc(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t==`function`?t(e):t.current=e}}function wc(e){var t=e.alternate;t!==null&&(e.alternate=null,wc(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[Mi],delete t[Ni],delete t[Fi],delete t[Ii],delete t[Li])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function Tc(e){return e.tag===5||e.tag===3||e.tag===4}function Ec(e){a:for(;;){for(;e.sibling===null;){if(e.return===null||Tc(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue a;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Dc(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=yi));else if(r!==4&&(e=e.child,e!==null))for(Dc(e,t,n),e=e.sibling;e!==null;)Dc(e,t,n),e=e.sibling}function Oc(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(Oc(e,t,n),e=e.sibling;e!==null;)Oc(e,t,n),e=e.sibling}var kc=null,Ac=!1;function jc(e,t,n){for(n=n.child;n!==null;)Mc(e,t,n),n=n.sibling}function Mc(e,t,n){if(bt&&typeof bt.onCommitFiberUnmount==`function`)try{bt.onCommitFiberUnmount(yt,n)}catch{}switch(n.tag){case 5:hc||_c(n,t);case 6:var r=kc,i=Ac;kc=null,jc(e,t,n),kc=r,Ac=i,kc!==null&&(Ac?(e=kc,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):kc.removeChild(n.stateNode));break;case 18:kc!==null&&(Ac?(e=kc,n=n.stateNode,e.nodeType===8?Oi(e.parentNode,n):e.nodeType===1&&Oi(e,n),ln(e)):Oi(kc,n.stateNode));break;case 4:r=kc,i=Ac,kc=n.stateNode.containerInfo,Ac=!0,jc(e,t,n),kc=r,Ac=i;break;case 0:case 11:case 14:case 15:if(!hc&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){i=r=r.next;do{var a=i,o=a.destroy;a=a.tag,o!==void 0&&(a&2||a&4)&&vc(n,t,o),i=i.next}while(i!==r)}jc(e,t,n);break;case 1:if(!hc&&(_c(n,t),r=n.stateNode,typeof r.componentWillUnmount==`function`))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(e){Wl(n,t,e)}jc(e,t,n);break;case 21:jc(e,t,n);break;case 22:n.mode&1?(hc=(r=hc)||n.memoizedState!==null,jc(e,t,n),hc=r):jc(e,t,n);break;default:jc(e,t,n)}}function Nc(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new gc),t.forEach(function(t){var r=Jl.bind(null,e,t);n.has(t)||(n.add(t),t.then(r,r))})}}function Pc(e,t){var n=t.deletions;if(n!==null)for(var i=0;i<n.length;i++){var a=n[i];try{var o=e,s=t,c=s;a:for(;c!==null;){switch(c.tag){case 5:kc=c.stateNode,Ac=!1;break a;case 3:kc=c.stateNode.containerInfo,Ac=!0;break a;case 4:kc=c.stateNode.containerInfo,Ac=!0;break a}c=c.return}if(kc===null)throw Error(r(160));Mc(o,s,a),kc=null,Ac=!1;var l=a.alternate;l!==null&&(l.return=null),a.return=null}catch(e){Wl(a,t,e)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)Fc(t,e),t=t.sibling}function Fc(e,t){var n=e.alternate,i=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(Pc(t,e),Ic(e),i&4){try{xc(3,e,e.return),Sc(3,e)}catch(t){Wl(e,e.return,t)}try{xc(5,e,e.return)}catch(t){Wl(e,e.return,t)}}break;case 1:Pc(t,e),Ic(e),i&512&&n!==null&&_c(n,n.return);break;case 5:if(Pc(t,e),Ic(e),i&512&&n!==null&&_c(n,n.return),e.flags&32){var a=e.stateNode;try{Te(a,``)}catch(t){Wl(e,e.return,t)}}if(i&4&&(a=e.stateNode,a!=null)){var o=e.memoizedProps,s=n===null?o:n.memoizedProps,c=e.type,l=e.updateQueue;if(e.updateQueue=null,l!==null)try{c===`input`&&o.type===`radio`&&o.name!=null&&de(a,o),Me(c,s);var u=Me(c,o);for(s=0;s<l.length;s+=2){var d=l[s],f=l[s+1];d===`style`?ke(a,f):d===`dangerouslySetInnerHTML`?we(a,f):d===`children`?Te(a,f):x(a,d,f,u)}switch(c){case`input`:fe(a,o);break;case`textarea`:ye(a,o);break;case`select`:var p=a._wrapperState.wasMultiple;a._wrapperState.wasMultiple=!!o.multiple;var m=o.value;m==null?p!==!!o.multiple&&(o.defaultValue==null?ge(a,!!o.multiple,o.multiple?[]:``,!1):ge(a,!!o.multiple,o.defaultValue,!0)):ge(a,!!o.multiple,m,!1)}a[Ni]=o}catch(t){Wl(e,e.return,t)}}break;case 6:if(Pc(t,e),Ic(e),i&4){if(e.stateNode===null)throw Error(r(162));a=e.stateNode,o=e.memoizedProps;try{a.nodeValue=o}catch(t){Wl(e,e.return,t)}}break;case 3:if(Pc(t,e),Ic(e),i&4&&n!==null&&n.memoizedState.isDehydrated)try{ln(t.containerInfo)}catch(t){Wl(e,e.return,t)}break;case 4:Pc(t,e),Ic(e);break;case 13:Pc(t,e),Ic(e),a=e.child,a.flags&8192&&(o=a.memoizedState!==null,a.stateNode.isHidden=o,!o||a.alternate!==null&&a.alternate.memoizedState!==null||(al=ft())),i&4&&Nc(e);break;case 22:if(d=n!==null&&n.memoizedState!==null,e.mode&1?(hc=(u=hc)||d,Pc(t,e),hc=u):Pc(t,e),Ic(e),i&8192){if(u=e.memoizedState!==null,(e.stateNode.isHidden=u)&&!d&&e.mode&1)for(K=e,d=e.child;d!==null;){for(f=K=d;K!==null;){switch(p=K,m=p.child,p.tag){case 0:case 11:case 14:case 15:xc(4,p,p.return);break;case 1:_c(p,p.return);var h=p.stateNode;if(typeof h.componentWillUnmount==`function`){i=p,n=p.return;try{t=i,h.props=t.memoizedProps,h.state=t.memoizedState,h.componentWillUnmount()}catch(e){Wl(i,n,e)}}break;case 5:_c(p,p.return);break;case 22:if(p.memoizedState!==null){Bc(f);continue}}m===null?Bc(f):(m.return=p,K=m)}d=d.sibling}a:for(d=null,f=e;;){if(f.tag===5){if(d===null){d=f;try{a=f.stateNode,u?(o=a.style,typeof o.setProperty==`function`?o.setProperty(`display`,`none`,`important`):o.display=`none`):(c=f.stateNode,l=f.memoizedProps.style,s=l!=null&&l.hasOwnProperty(`display`)?l.display:null,c.style.display=Oe(`display`,s))}catch(t){Wl(e,e.return,t)}}}else if(f.tag===6){if(d===null)try{f.stateNode.nodeValue=u?``:f.memoizedProps}catch(t){Wl(e,e.return,t)}}else if((f.tag!==22&&f.tag!==23||f.memoizedState===null||f===e)&&f.child!==null){f.child.return=f,f=f.child;continue}if(f===e)break a;for(;f.sibling===null;){if(f.return===null||f.return===e)break a;d===f&&(d=null),f=f.return}d===f&&(d=null),f.sibling.return=f.return,f=f.sibling}}break;case 19:Pc(t,e),Ic(e),i&4&&Nc(e);break;case 21:break;default:Pc(t,e),Ic(e)}}function Ic(e){var t=e.flags;if(t&2){try{a:{for(var n=e.return;n!==null;){if(Tc(n)){var i=n;break a}n=n.return}throw Error(r(160))}switch(i.tag){case 5:var a=i.stateNode;i.flags&32&&(Te(a,``),i.flags&=-33),Oc(e,Ec(e),a);break;case 3:case 4:var o=i.stateNode.containerInfo;Dc(e,Ec(e),o);break;default:throw Error(r(161))}}catch(t){Wl(e,e.return,t)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function Lc(e,t,n){K=e,Rc(e,t,n)}function Rc(e,t,n){for(var r=!!(e.mode&1);K!==null;){var i=K,a=i.child;if(i.tag===22&&r){var o=i.memoizedState!==null||mc;if(!o){var s=i.alternate,c=s!==null&&s.memoizedState!==null||hc;s=mc;var l=hc;if(mc=o,(hc=c)&&!l)for(K=i;K!==null;)o=K,c=o.child,o.tag===22&&o.memoizedState!==null||c===null?Vc(i):(c.return=o,K=c);for(;a!==null;)K=a,Rc(a,t,n),a=a.sibling;K=i,mc=s,hc=l}zc(e,t,n)}else i.subtreeFlags&8772&&a!==null?(a.return=i,K=a):zc(e,t,n)}}function zc(e){for(;K!==null;){var t=K;if(t.flags&8772){var n=t.alternate;try{if(t.flags&8772)switch(t.tag){case 0:case 11:case 15:hc||Sc(5,t);break;case 1:var i=t.stateNode;if(t.flags&4&&!hc){if(n===null)i.componentDidMount();else{var a=t.elementType===t.type?n.memoizedProps:bs(t.type,n.memoizedProps);i.componentDidUpdate(a,n.memoizedState,i.__reactInternalSnapshotBeforeUpdate)}}var o=t.updateQueue;o!==null&&co(t,o,i);break;case 3:var s=t.updateQueue;if(s!==null){if(n=null,t.child!==null)switch(t.child.tag){case 5:n=t.child.stateNode;break;case 1:n=t.child.stateNode}co(t,s,n)}break;case 5:var c=t.stateNode;if(n===null&&t.flags&4){n=c;var l=t.memoizedProps;switch(t.type){case`button`:case`input`:case`select`:case`textarea`:l.autoFocus&&n.focus();break;case`img`:l.src&&(n.src=l.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(t.memoizedState===null){var u=t.alternate;if(u!==null){var d=u.memoizedState;if(d!==null){var f=d.dehydrated;f!==null&&ln(f)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(r(163))}hc||t.flags&512&&Cc(t)}catch(e){Wl(t,t.return,e)}}if(t===e){K=null;break}if(n=t.sibling,n!==null){n.return=t.return,K=n;break}K=t.return}}function Bc(e){for(;K!==null;){var t=K;if(t===e){K=null;break}var n=t.sibling;if(n!==null){n.return=t.return,K=n;break}K=t.return}}function Vc(e){for(;K!==null;){var t=K;try{switch(t.tag){case 0:case 11:case 15:var n=t.return;try{Sc(4,t)}catch(e){Wl(t,n,e)}break;case 1:var r=t.stateNode;if(typeof r.componentDidMount==`function`){var i=t.return;try{r.componentDidMount()}catch(e){Wl(t,i,e)}}var a=t.return;try{Cc(t)}catch(e){Wl(t,a,e)}break;case 5:var o=t.return;try{Cc(t)}catch(e){Wl(t,o,e)}}}catch(e){Wl(t,t.return,e)}if(t===e){K=null;break}var s=t.sibling;if(s!==null){s.return=t.return,K=s;break}K=t.return}}var Hc=Math.ceil,Uc=S.ReactCurrentDispatcher,Wc=S.ReactCurrentOwner,Gc=S.ReactCurrentBatchConfig,Kc=0,qc=null,Jc=null,Yc=0,Xc=0,Zc=Wi(0),Qc=0,$c=null,el=0,tl=0,nl=0,rl=null,il=null,al=0,ol=1/0,sl=null,cl=!1,ll=null,ul=null,dl=!1,fl=null,pl=0,ml=0,hl=null,gl=-1,_l=0;function vl(){return Kc&6?ft():gl===-1?gl=ft():gl}function yl(e){return e.mode&1?Kc&2&&Yc!==0?Yc&-Yc:Fa.transition===null?(e=Rt,e===0?(e=window.event,e=e===void 0?16:_n(e.type),e):e):(_l===0&&(_l=Nt()),_l):1}function bl(e,t,n,i){if(50<ml)throw ml=0,hl=null,Error(r(185));Ft(e,n,i),(!(Kc&2)||e!==qc)&&(e===qc&&(!(Kc&2)&&(tl|=n),Qc===4&&El(e,Yc)),xl(e,i),n===1&&Kc===0&&!(t.mode&1)&&(ol=ft()+500,aa&&la()))}function xl(e,t){var n=e.callbackNode;jt(e,t);var r=kt(e,e===qc?Yc:0);if(r===0)n!==null&&lt(n),e.callbackNode=null,e.callbackPriority=0;else if(t=r&-r,e.callbackPriority!==t){if(n!=null&&lt(n),t===1)e.tag===0?ca(Dl.bind(null,e)):sa(Dl.bind(null,e)),Ei(function(){!(Kc&6)&&la()}),n=null;else{switch(zt(r)){case 1:n=mt;break;case 4:n=ht;break;case 16:n=gt;break;case 536870912:n=vt;break;default:n=gt}n=Xl(n,Sl.bind(null,e))}e.callbackPriority=t,e.callbackNode=n}}function Sl(e,t){if(gl=-1,_l=0,Kc&6)throw Error(r(327));var n=e.callbackNode;if(Hl()&&e.callbackNode!==n)return null;var i=kt(e,e===qc?Yc:0);if(i===0)return null;if(i&30||(i&e.expiredLanes)!==0||t)t=Fl(e,i);else{t=i;var a=Kc;Kc|=2;var o=Nl();(qc!==e||Yc!==t)&&(sl=null,ol=ft()+500,jl(e,t));do try{Ll();break}catch(t){Ml(e,t)}while(1);Ka(),Uc.current=o,Kc=a,Jc===null?(qc=null,Yc=0,t=Qc):t=0}if(t!==0){if(t===2&&(a=Mt(e),a!==0&&(i=a,t=Cl(e,a))),t===1)throw n=$c,jl(e,0),El(e,i),xl(e,ft()),n;if(t===6)El(e,i);else{if(a=e.current.alternate,!(i&30)&&!Tl(a)&&(t=Fl(e,i),t===2&&(o=Mt(e),o!==0&&(i=o,t=Cl(e,o))),t===1))throw n=$c,jl(e,0),El(e,i),xl(e,ft()),n;switch(e.finishedWork=a,e.finishedLanes=i,t){case 0:case 1:throw Error(r(345));case 2:Bl(e,il,sl);break;case 3:if(El(e,i),(i&130023424)===i&&(t=al+500-ft(),10<t)){if(kt(e,0)!==0)break;if(a=e.suspendedLanes,(a&i)!==i){vl(),e.pingedLanes|=e.suspendedLanes&a;break}e.timeoutHandle=Ci(Bl.bind(null,e,il,sl),t);break}Bl(e,il,sl);break;case 4:if(El(e,i),(i&4194240)===i)break;for(t=e.eventTimes,a=-1;0<i;){var s=31-St(i);o=1<<s,s=t[s],s>a&&(a=s),i&=~o}if(i=a,i=ft()-i,i=(120>i?120:480>i?480:1080>i?1080:1920>i?1920:3e3>i?3e3:4320>i?4320:1960*Hc(i/1960))-i,10<i){e.timeoutHandle=Ci(Bl.bind(null,e,il,sl),i);break}Bl(e,il,sl);break;case 5:Bl(e,il,sl);break;default:throw Error(r(329))}}}return xl(e,ft()),e.callbackNode===n?Sl.bind(null,e):null}function Cl(e,t){var n=rl;return e.current.memoizedState.isDehydrated&&(jl(e,t).flags|=256),e=Fl(e,t),e!==2&&(t=il,il=n,t!==null&&wl(t)),e}function wl(e){il===null?il=e:il.push.apply(il,e)}function Tl(e){for(var t=e;;){if(t.flags&16384){var n=t.updateQueue;if(n!==null&&(n=n.stores,n!==null))for(var r=0;r<n.length;r++){var i=n[r],a=i.getSnapshot;i=i.value;try{if(!Dr(a(),i))return!1}catch{return!1}}}if(n=t.child,t.subtreeFlags&16384&&n!==null)n.return=t,t=n;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function El(e,t){for(t&=~nl,t&=~tl,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var n=31-St(t),r=1<<n;e[n]=-1,t&=~r}}function Dl(e){if(Kc&6)throw Error(r(327));Hl();var t=kt(e,0);if(!(t&1))return xl(e,ft()),null;var n=Fl(e,t);if(e.tag!==0&&n===2){var i=Mt(e);i!==0&&(t=i,n=Cl(e,i))}if(n===1)throw n=$c,jl(e,0),El(e,t),xl(e,ft()),n;if(n===6)throw Error(r(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,Bl(e,il,sl),xl(e,ft()),null}function Ol(e,t){var n=Kc;Kc|=1;try{return e(t)}finally{Kc=n,Kc===0&&(ol=ft()+500,aa&&la())}}function kl(e){fl!==null&&fl.tag===0&&!(Kc&6)&&Hl();var t=Kc;Kc|=1;var n=Gc.transition,r=Rt;try{if(Gc.transition=null,Rt=1,e)return e()}finally{Rt=r,Gc.transition=n,Kc=t,!(Kc&6)&&la()}}function Al(){Xc=Zc.current,Gi(Zc)}function jl(e,t){e.finishedWork=null,e.finishedLanes=0;var n=e.timeoutHandle;if(n!==-1&&(e.timeoutHandle=-1,wi(n)),Jc!==null)for(n=Jc.return;n!==null;){var r=n;switch(xa(r),r.tag){case 1:r=r.type.childContextTypes,r!=null&&$i();break;case 3:go(),Gi(Yi),Gi(Ji),So();break;case 5:vo(r);break;case 4:go();break;case 13:Gi(yo);break;case 19:Gi(yo);break;case 10:qa(r.type._context);break;case 22:case 23:Al()}n=n.return}if(qc=e,Jc=e=tu(e.current,null),Yc=Xc=t,Qc=0,$c=null,nl=tl=el=0,il=rl=null,Za!==null){for(t=0;t<Za.length;t++)if(n=Za[t],r=n.interleaved,r!==null){n.interleaved=null;var i=r.next,a=n.pending;if(a!==null){var o=a.next;a.next=i,r.next=o}n.pending=r}Za=null}return e}function Ml(e,t){do{var n=Jc;try{if(Ka(),Co.current=gs,ko){for(var i=Eo.memoizedState;i!==null;){var a=i.queue;a!==null&&(a.pending=null),i=i.next}ko=!1}if(To=0,Oo=Do=Eo=null,Ao=!1,jo=0,Wc.current=null,n===null||n.return===null){Qc=1,$c=t,Jc=null;break}a:{var o=e,s=n.return,c=n,l=t;if(t=Yc,c.flags|=32768,typeof l==`object`&&l&&typeof l.then==`function`){var u=l,d=c,f=d.tag;if(!(d.mode&1)&&(f===0||f===11||f===15)){var p=d.alternate;p?(d.updateQueue=p.updateQueue,d.memoizedState=p.memoizedState,d.lanes=p.lanes):(d.updateQueue=null,d.memoizedState=null)}var m=Ps(s);if(m!==null){m.flags&=-257,Fs(m,s,c,o,t),m.mode&1&&Ns(o,u,t),t=m,l=u;var h=t.updateQueue;if(h===null){var g=new Set;g.add(l),t.updateQueue=g}else h.add(l);break a}if(!(t&1)){Ns(o,u,t),Pl();break a}l=Error(r(426))}else if(wa&&c.mode&1){var _=Ps(s);if(_!==null){!(_.flags&65536)&&(_.flags|=256),Fs(_,s,c,o,t),Pa(Ds(l,c));break a}}o=l=Ds(l,c),Qc!==4&&(Qc=2),rl===null?rl=[o]:rl.push(o),o=s;do{switch(o.tag){case 3:o.flags|=65536,t&=-t,o.lanes|=t;var v=js(o,l,t);oo(o,v);break a;case 1:c=l;var y=o.type,b=o.stateNode;if(!(o.flags&128)&&(typeof y.getDerivedStateFromError==`function`||b!==null&&typeof b.componentDidCatch==`function`&&(ul===null||!ul.has(b)))){o.flags|=65536,t&=-t,o.lanes|=t;var x=Ms(o,c,t);oo(o,x);break a}}o=o.return}while(o!==null)}zl(n)}catch(e){t=e,Jc===n&&n!==null&&(Jc=n=n.return);continue}break}while(1)}function Nl(){var e=Uc.current;return Uc.current=gs,e===null?gs:e}function Pl(){(Qc===0||Qc===3||Qc===2)&&(Qc=4),qc===null||!(el&268435455)&&!(tl&268435455)||El(qc,Yc)}function Fl(e,t){var n=Kc;Kc|=2;var i=Nl();(qc!==e||Yc!==t)&&(sl=null,jl(e,t));do try{Il();break}catch(t){Ml(e,t)}while(1);if(Ka(),Kc=n,Uc.current=i,Jc!==null)throw Error(r(261));return qc=null,Yc=0,Qc}function Il(){for(;Jc!==null;)Rl(Jc)}function Ll(){for(;Jc!==null&&!ut();)Rl(Jc)}function Rl(e){var t=Yl(e.alternate,e,Xc);e.memoizedProps=e.pendingProps,t===null?zl(e):Jc=t,Wc.current=null}function zl(e){var t=e;do{var n=t.alternate;if(e=t.return,t.flags&32768){if(n=pc(n,t),n!==null){n.flags&=32767,Jc=n;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{Qc=6,Jc=null;return}}else if(n=fc(n,t,Xc),n!==null){Jc=n;return}if(t=t.sibling,t!==null){Jc=t;return}Jc=t=e}while(t!==null);Qc===0&&(Qc=5)}function Bl(e,t,n){var r=Rt,i=Gc.transition;try{Gc.transition=null,Rt=1,Vl(e,t,n,r)}finally{Gc.transition=i,Rt=r}return null}function Vl(e,t,n,i){do Hl();while(fl!==null);if(Kc&6)throw Error(r(327));n=e.finishedWork;var a=e.finishedLanes;if(n===null)return null;if(e.finishedWork=null,e.finishedLanes=0,n===e.current)throw Error(r(177));e.callbackNode=null,e.callbackPriority=0;var o=n.lanes|n.childLanes;if(It(e,o),e===qc&&(Jc=qc=null,Yc=0),!(n.subtreeFlags&2064)&&!(n.flags&2064)||dl||(dl=!0,Xl(gt,function(){return Hl(),null})),o=!!(n.flags&15990),n.subtreeFlags&15990||o){o=Gc.transition,Gc.transition=null;var s=Rt;Rt=1;var c=Kc;Kc|=4,Wc.current=null,bc(e,n),Fc(n,e),Pr(xi),dn=!!bi,xi=bi=null,e.current=n,Lc(n,e,a),dt(),Kc=c,Rt=s,Gc.transition=o}else e.current=n;if(dl&&(dl=!1,fl=e,pl=a),o=e.pendingLanes,o===0&&(ul=null),xt(n.stateNode,i),xl(e,ft()),t!==null)for(i=e.onRecoverableError,n=0;n<t.length;n++)a=t[n],i(a.value,{componentStack:a.stack,digest:a.digest});if(cl)throw cl=!1,e=ll,ll=null,e;return pl&1&&e.tag!==0&&Hl(),o=e.pendingLanes,o&1?e===hl?ml++:(ml=0,hl=e):ml=0,la(),null}function Hl(){if(fl!==null){var e=zt(pl),t=Gc.transition,n=Rt;try{if(Gc.transition=null,Rt=16>e?16:e,fl===null)var i=!1;else{if(e=fl,fl=null,pl=0,Kc&6)throw Error(r(331));var a=Kc;for(Kc|=4,K=e.current;K!==null;){var o=K,s=o.child;if(K.flags&16){var c=o.deletions;if(c!==null){for(var l=0;l<c.length;l++){var u=c[l];for(K=u;K!==null;){var d=K;switch(d.tag){case 0:case 11:case 15:xc(8,d,o)}var f=d.child;if(f!==null)f.return=d,K=f;else for(;K!==null;){d=K;var p=d.sibling,m=d.return;if(wc(d),d===u){K=null;break}if(p!==null){p.return=m,K=p;break}K=m}}}var h=o.alternate;if(h!==null){var g=h.child;if(g!==null){h.child=null;do{var _=g.sibling;g.sibling=null,g=_}while(g!==null)}}K=o}}if(o.subtreeFlags&2064&&s!==null)s.return=o,K=s;else b:for(;K!==null;){if(o=K,o.flags&2048)switch(o.tag){case 0:case 11:case 15:xc(9,o,o.return)}var v=o.sibling;if(v!==null){v.return=o.return,K=v;break b}K=o.return}}var y=e.current;for(K=y;K!==null;){s=K;var b=s.child;if(s.subtreeFlags&2064&&b!==null)b.return=s,K=b;else b:for(s=y;K!==null;){if(c=K,c.flags&2048)try{switch(c.tag){case 0:case 11:case 15:Sc(9,c)}}catch(e){Wl(c,c.return,e)}if(c===s){K=null;break b}var x=c.sibling;if(x!==null){x.return=c.return,K=x;break b}K=c.return}}if(Kc=a,la(),bt&&typeof bt.onPostCommitFiberRoot==`function`)try{bt.onPostCommitFiberRoot(yt,e)}catch{}i=!0}return i}finally{Rt=n,Gc.transition=t}}return!1}function Ul(e,t,n){t=Ds(n,t),t=js(e,t,1),e=io(e,t,1),t=vl(),e!==null&&(Ft(e,1,t),xl(e,t))}function Wl(e,t,n){if(e.tag===3)Ul(e,e,n);else for(;t!==null;){if(t.tag===3){Ul(t,e,n);break}if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError==`function`||typeof r.componentDidCatch==`function`&&(ul===null||!ul.has(r))){e=Ds(n,e),e=Ms(t,e,1),t=io(t,e,1),e=vl(),t!==null&&(Ft(t,1,e),xl(t,e));break}}t=t.return}}function Gl(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),t=vl(),e.pingedLanes|=e.suspendedLanes&n,qc===e&&(Yc&n)===n&&(Qc===4||Qc===3&&(Yc&130023424)===Yc&&500>ft()-al?jl(e,0):nl|=n),xl(e,t)}function Kl(e,t){t===0&&(e.mode&1?(t=Dt,Dt<<=1,!(Dt&130023424)&&(Dt=4194304)):t=1);var n=vl();e=eo(e,t),e!==null&&(Ft(e,t,n),xl(e,n))}function ql(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Kl(e,n)}function Jl(e,t){var n=0;switch(e.tag){case 13:var i=e.stateNode,a=e.memoizedState;a!==null&&(n=a.retryLane);break;case 19:i=e.stateNode;break;default:throw Error(r(314))}i!==null&&i.delete(t),Kl(e,n)}var Yl=function(e,t,n){if(e!==null){if(e.memoizedProps!==t.pendingProps||Yi.current)Ls=!0;else{if((e.lanes&n)===0&&!(t.flags&128))return Ls=!1,oc(e,t,n);Ls=!!(e.flags&131072)}}else Ls=!1,wa&&t.flags&1048576&&ya(t,pa,t.index);switch(t.lanes=0,t.tag){case 2:var i=t.type;ic(e,t),e=t.pendingProps;var a=Zi(t,Ji.current);Ya(t,n),a=Fo(null,t,i,e,a,n);var o=Io();return t.flags|=1,typeof a==`object`&&a&&typeof a.render==`function`&&a.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,Qi(i)?(o=!0,na(t)):o=!1,t.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,to(t),a.updater=Ss,t.stateNode=a,a._reactInternals=t,Es(t,i,e,n),t=Ks(null,t,i,!0,o,n)):(t.tag=0,wa&&o&&ba(t),Rs(null,t,a,n),t=t.child),t;case 16:i=t.elementType;a:{switch(ic(e,t),e=t.pendingProps,a=i._init,i=a(i._payload),t.type=i,a=t.tag=eu(i),e=bs(i,e),a){case 0:t=Ws(null,t,i,e,n);break a;case 1:t=Gs(null,t,i,e,n);break a;case 11:t=zs(null,t,i,e,n);break a;case 14:t=Bs(null,t,i,bs(i.type,e),n);break a}throw Error(r(306,i,``))}return t;case 0:return i=t.type,a=t.pendingProps,a=t.elementType===i?a:bs(i,a),Ws(e,t,i,a,n);case 1:return i=t.type,a=t.pendingProps,a=t.elementType===i?a:bs(i,a),Gs(e,t,i,a,n);case 3:a:{if(qs(t),e===null)throw Error(r(387));i=t.pendingProps,o=t.memoizedState,a=o.element,no(e,t),so(t,i,null,n);var s=t.memoizedState;if(i=s.element,o.isDehydrated){if(o={element:i,isDehydrated:!1,cache:s.cache,pendingSuspenseBoundaries:s.pendingSuspenseBoundaries,transitions:s.transitions},t.updateQueue.baseState=o,t.memoizedState=o,t.flags&256){a=Ds(Error(r(423)),t),t=Js(e,t,i,n,a);break a}if(i!==a){a=Ds(Error(r(424)),t),t=Js(e,t,i,n,a);break a}for(Ca=ki(t.stateNode.containerInfo.firstChild),Sa=t,wa=!0,Ta=null,n=Va(t,null,i,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling}else{if(Na(),i===a){t=ac(e,t,n);break a}Rs(e,t,i,n)}t=t.child}return t;case 5:return _o(t),e===null&&ka(t),i=t.type,a=t.pendingProps,o=e===null?null:e.memoizedProps,s=a.children,Si(i,a)?s=null:o!==null&&Si(i,o)&&(t.flags|=32),Us(e,t),Rs(e,t,s,n),t.child;case 6:return e===null&&ka(t),null;case 13:return Zs(e,t,n);case 4:return ho(t,t.stateNode.containerInfo),i=t.pendingProps,e===null?t.child=Ba(t,null,i,n):Rs(e,t,i,n),t.child;case 11:return i=t.type,a=t.pendingProps,a=t.elementType===i?a:bs(i,a),zs(e,t,i,a,n);case 7:return Rs(e,t,t.pendingProps,n),t.child;case 8:return Rs(e,t,t.pendingProps.children,n),t.child;case 12:return Rs(e,t,t.pendingProps.children,n),t.child;case 10:a:{if(i=t.type._context,a=t.pendingProps,o=t.memoizedProps,s=a.value,Ki(Ha,i._currentValue),i._currentValue=s,o!==null){if(Dr(o.value,s)){if(o.children===a.children&&!Yi.current){t=ac(e,t,n);break a}}else for(o=t.child,o!==null&&(o.return=t);o!==null;){var c=o.dependencies;if(c!==null){s=o.child;for(var l=c.firstContext;l!==null;){if(l.context===i){if(o.tag===1){l=ro(-1,n&-n),l.tag=2;var u=o.updateQueue;if(u!==null){u=u.shared;var d=u.pending;d===null?l.next=l:(l.next=d.next,d.next=l),u.pending=l}}o.lanes|=n,l=o.alternate,l!==null&&(l.lanes|=n),Ja(o.return,n,t),c.lanes|=n;break}l=l.next}}else if(o.tag===10)s=o.type===t.type?null:o.child;else if(o.tag===18){if(s=o.return,s===null)throw Error(r(341));s.lanes|=n,c=s.alternate,c!==null&&(c.lanes|=n),Ja(s,n,t),s=o.sibling}else s=o.child;if(s!==null)s.return=o;else for(s=o;s!==null;){if(s===t){s=null;break}if(o=s.sibling,o!==null){o.return=s.return,s=o;break}s=s.return}o=s}}Rs(e,t,a.children,n),t=t.child}return t;case 9:return a=t.type,i=t.pendingProps.children,Ya(t,n),a=Xa(a),i=i(a),t.flags|=1,Rs(e,t,i,n),t.child;case 14:return i=t.type,a=bs(i,t.pendingProps),a=bs(i.type,a),Bs(e,t,i,a,n);case 15:return Vs(e,t,t.type,t.pendingProps,n);case 17:return i=t.type,a=t.pendingProps,a=t.elementType===i?a:bs(i,a),ic(e,t),t.tag=1,Qi(i)?(e=!0,na(t)):e=!1,Ya(t,n),ws(t,i,a),Es(t,i,a,n),Ks(null,t,i,!0,e,n);case 19:return rc(e,t,n);case 22:return Hs(e,t,n)}throw Error(r(156,t.tag))};function Xl(e,t){return ct(e,t)}function Zl(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Ql(e,t,n,r){return new Zl(e,t,n,r)}function $l(e){return e=e.prototype,!(!e||!e.isReactComponent)}function eu(e){if(typeof e==`function`)return+!!$l(e);if(e!=null){if(e=e.$$typeof,e===A)return 11;if(e===N)return 14}return 2}function tu(e,t){var n=e.alternate;return n===null?(n=Ql(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function nu(e,t,n,i,a,o){var s=2;if(i=e,typeof e==`function`)$l(e)&&(s=1);else if(typeof e==`string`)s=5;else a:switch(e){case T:return ru(n.children,a,o,t);case E:s=8,a|=8;break;case D:return e=Ql(12,n,t,a|2),e.elementType=D,e.lanes=o,e;case j:return e=Ql(13,n,t,a),e.elementType=j,e.lanes=o,e;case M:return e=Ql(19,n,t,a),e.elementType=M,e.lanes=o,e;case F:return iu(n,a,o,t);default:if(typeof e==`object`&&e)switch(e.$$typeof){case O:s=10;break a;case k:s=9;break a;case A:s=11;break a;case N:s=14;break a;case P:s=16,i=null;break a}throw Error(r(130,e==null?e:typeof e,``))}return t=Ql(s,n,t,a),t.elementType=e,t.type=i,t.lanes=o,t}function ru(e,t,n,r){return e=Ql(7,e,r,t),e.lanes=n,e}function iu(e,t,n,r){return e=Ql(22,e,r,t),e.elementType=F,e.lanes=n,e.stateNode={isHidden:!1},e}function au(e,t,n){return e=Ql(6,e,null,t),e.lanes=n,e}function ou(e,t,n){return t=Ql(4,e.children===null?[]:e.children,e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function su(e,t,n,r,i){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Pt(0),this.expirationTimes=Pt(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Pt(0),this.identifierPrefix=r,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function cu(e,t,n,r,i,a,o,s,c){return e=new su(e,t,n,s,c),t===1?(t=1,!0===a&&(t|=8)):t=0,a=Ql(3,null,null,t),e.current=a,a.stateNode=e,a.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},to(a),e}function lu(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:w,key:r==null?null:``+r,children:e,containerInfo:t,implementation:n}}function uu(e){if(!e)return qi;e=e._reactInternals;a:{if(nt(e)!==e||e.tag!==1)throw Error(r(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break a;case 1:if(Qi(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break a}}t=t.return}while(t!==null);throw Error(r(171))}if(e.tag===1){var n=e.type;if(Qi(n))return ta(e,n,t)}return t}function du(e,t,n,r,i,a,o,s,c){return e=cu(n,r,!0,e,i,a,o,s,c),e.context=uu(null),n=e.current,r=vl(),i=yl(n),a=ro(r,i),a.callback=t??null,io(n,a,i),e.current.lanes=i,Ft(e,i,r),xl(e,r),e}function fu(e,t,n,r){var i=t.current,a=vl(),o=yl(i);return n=uu(n),t.context===null?t.context=n:t.pendingContext=n,t=ro(a,o),t.payload={element:e},r=r===void 0?null:r,r!==null&&(t.callback=r),e=io(i,t,o),e!==null&&(bl(e,i,o,a),ao(e,i,o)),o}function pu(e){if(e=e.current,!e.child)return null;switch(e.child.tag){case 5:return e.child.stateNode;default:return e.child.stateNode}}function mu(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function hu(e,t){mu(e,t),(e=e.alternate)&&mu(e,t)}function gu(){return null}var _u=typeof reportError==`function`?reportError:function(e){console.error(e)};function vu(e){this._internalRoot=e}yu.prototype.render=vu.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(r(409));fu(e,t,null,null)},yu.prototype.unmount=vu.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;kl(function(){fu(null,e,null,null)}),t[Pi]=null}};function yu(e){this._internalRoot=e}yu.prototype.unstable_scheduleHydration=function(e){if(e){var t=Ut();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Qt.length&&t!==0&&t<Qt[n].priority;n++);Qt.splice(n,0,e),n===0&&rn(e)}};function bu(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function xu(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==` react-mount-point-unstable `))}function Su(){}function Cu(e,t,n,r,i){if(i){if(typeof r==`function`){var a=r;r=function(){var e=pu(o);a.call(e)}}var o=du(t,r,e,0,null,!1,!1,``,Su);return e._reactRootContainer=o,e[Pi]=o.current,ci(e.nodeType===8?e.parentNode:e),kl(),o}for(;i=e.lastChild;)e.removeChild(i);if(typeof r==`function`){var s=r;r=function(){var e=pu(c);s.call(e)}}var c=cu(e,0,!1,null,null,!1,!1,``,Su);return e._reactRootContainer=c,e[Pi]=c.current,ci(e.nodeType===8?e.parentNode:e),kl(function(){fu(t,c,n,r)}),c}function wu(e,t,n,r,i){var a=n._reactRootContainer;if(a){var o=a;if(typeof i==`function`){var s=i;i=function(){var e=pu(o);s.call(e)}}fu(t,o,e,i)}else o=Cu(n,t,e,i,r);return pu(o)}Bt=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var n=Ot(t.pendingLanes);n!==0&&(Lt(t,n|1),xl(t,ft()),!(Kc&6)&&(ol=ft()+500,la()))}break;case 13:kl(function(){var t=eo(e,1);t!==null&&bl(t,e,1,vl())}),hu(e,1)}},Vt=function(e){if(e.tag===13){var t=eo(e,134217728);t!==null&&bl(t,e,134217728,vl()),hu(e,134217728)}},Ht=function(e){if(e.tag===13){var t=yl(e),n=eo(e,t);n!==null&&bl(n,e,t,vl()),hu(e,t)}},Ut=function(){return Rt},Wt=function(e,t){var n=Rt;try{return Rt=e,t()}finally{Rt=n}},Fe=function(e,t,n){switch(t){case`input`:if(fe(e,n),t=n.name,n.type===`radio`&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll(`input[name=`+JSON.stringify(``+t)+`][type="radio"]`),t=0;t<n.length;t++){var i=n[t];if(i!==e&&i.form===e.form){var a=Vi(i);if(!a)throw Error(r(90));se(i),fe(i,a)}}}break;case`textarea`:ye(e,n);break;case`select`:t=n.value,t!=null&&ge(e,!!n.multiple,t,!1)}},Ve=Ol,He=kl;var Tu={usingClientEntryPoint:!1,Events:[zi,Bi,Vi,ze,Be,Ol]},Eu={findFiberByHostInstance:Ri,bundleType:0,version:`18.3.1`,rendererPackageName:`react-dom`},Du={bundleType:Eu.bundleType,version:Eu.version,rendererPackageName:Eu.rendererPackageName,rendererConfig:Eu.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:S.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=ot(e),e===null?null:e.stateNode},findFiberByHostInstance:Eu.findFiberByHostInstance||gu,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:`18.3.1-next-f1338f8080-20240426`};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`){var Ou=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Ou.isDisabled&&Ou.supportsFiber)try{yt=Ou.inject(Du),bt=Ou}catch{}}e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Tu,e.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!bu(t))throw Error(r(200));return lu(e,t,null,n)},e.createRoot=function(e,t){if(!bu(e))throw Error(r(299));var n=!1,i=``,a=_u;return t!=null&&(!0===t.unstable_strictMode&&(n=!0),t.identifierPrefix!==void 0&&(i=t.identifierPrefix),t.onRecoverableError!==void 0&&(a=t.onRecoverableError)),t=cu(e,1,!1,null,null,n,!1,i,a),e[Pi]=t.current,ci(e.nodeType===8?e.parentNode:e),new vu(t)},e.findDOMNode=function(e){if(e==null)return null;if(e.nodeType===1)return e;var t=e._reactInternals;if(t===void 0)throw typeof e.render==`function`?Error(r(188)):(e=Object.keys(e).join(`,`),Error(r(268,e)));return e=ot(t),e=e===null?null:e.stateNode,e},e.flushSync=function(e){return kl(e)},e.hydrate=function(e,t,n){if(!xu(t))throw Error(r(200));return wu(null,e,t,!0,n)},e.hydrateRoot=function(e,t,n){if(!bu(e))throw Error(r(405));var i=n!=null&&n.hydratedSources||null,a=!1,o=``,s=_u;if(n!=null&&(!0===n.unstable_strictMode&&(a=!0),n.identifierPrefix!==void 0&&(o=n.identifierPrefix),n.onRecoverableError!==void 0&&(s=n.onRecoverableError)),t=du(t,null,e,1,n??null,a,!1,o,s),e[Pi]=t.current,ci(e),i)for(e=0;e<i.length;e++)n=i[e],a=n._getVersion,a=a(n._source),t.mutableSourceEagerHydrationData==null?t.mutableSourceEagerHydrationData=[n,a]:t.mutableSourceEagerHydrationData.push(n,a);return new yu(t)},e.render=function(e,t,n){if(!xu(t))throw Error(r(200));return wu(null,e,t,!1,n)},e.unmountComponentAtNode=function(e){if(!xu(e))throw Error(r(40));return e._reactRootContainer?(kl(function(){wu(null,null,e,!1,function(){e._reactRootContainer=null,e[Pi]=null})}),!0):!1},e.unstable_batchedUpdates=Ol,e.unstable_renderSubtreeIntoContainer=function(e,t,n,i){if(!xu(n))throw Error(r(200));if(e==null||e._reactInternals===void 0)throw Error(r(38));return wu(e,t,n,!1,i)},e.version=`18.3.1-next-f1338f8080-20240426`})),eT=o(((e,t)=>{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=$w()})),tT=o((e=>{var t=eT();e.createRoot=t.createRoot,e.hydrateRoot=t.hydrateRoot}))();function nT(e,t){console.error(JSON.stringify({source:`agar`,operation:e,failureKind:t instanceof Error?`Error`:`NonErrorThrown`}),cg(t))}var rT=Symbol(`workers-module`);Symbol.dispose||(Symbol.dispose=Symbol.for(`dispose`)),Symbol.asyncDispose||(Symbol.asyncDispose=Symbol.for(`asyncDispose`)),Promise.withResolvers||(Promise.withResolvers=function(){let e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}});var iT=globalThis[rT],aT=iT?iT.RpcTarget:class{},oT=async function(){}.constructor,sT=typeof Buffer<`u`?Buffer.prototype:void 0;function cT(e){switch(typeof e){case`boolean`:case`number`:case`string`:return`primitive`;case`undefined`:return`undefined`;case`object`:case`function`:break;case`bigint`:return`bigint`;default:return`unsupported`}if(e===null)return`primitive`;let t=Object.getPrototypeOf(e);switch(t){case Object.prototype:return`object`;case Function.prototype:case oT.prototype:return`function`;case Array.prototype:return`array`;case Date.prototype:return`date`;case Uint8Array.prototype:case sT:case ArrayBuffer.prototype:case DataView.prototype:case Int8Array.prototype:case Uint8ClampedArray.prototype:case Int16Array.prototype:case Uint16Array.prototype:case Int32Array.prototype:case Uint32Array.prototype:case BigInt64Array.prototype:case BigUint64Array.prototype:case Float32Array.prototype:case Float64Array.prototype:return`bytes`;case WritableStream.prototype:return`writable`;case ReadableStream.prototype:return`readable`;case URL.prototype:return`url`;case Headers.prototype:return`headers`;case Request.prototype:return`request`;case Response.prototype:return`response`;case Blob.prototype:return`blob`;case bT.prototype:return`stub`;case xT.prototype:return`rpc-promise`;default:if(iT){if(t==iT.RpcStub.prototype||e instanceof iT.ServiceStub)return`rpc-target`;if(t==iT.RpcPromise.prototype||t==iT.RpcProperty.prototype)return`rpc-thenable`}return e instanceof aT?`rpc-target`:e instanceof Error?`error`:`unsupported`}}function lT(){throw Error(`RPC map() implementation was not loaded.`)}var uT={applyMap:lT,sendMap:lT};function dT(){throw Error(`Stream implementation was not loaded.`)}var fT={createWritableStreamHook:dT,createWritableStreamFromHook:dT,createReadableStreamHook:dT},pT=class{stream(e,t){let n=this.call(e,t),r;try{r=n.pull()}catch(e){throw n.dispose(),e}let i;return r instanceof Promise?i=r.then(e=>{e.dispose()}):(r.dispose(),i=Promise.resolve()),{promise:i}}},mT=class extends pT{error;constructor(e){super(),this.error=e}call(e,t){return t.dispose(),this}map(e,t,n){for(let e of t)e.dispose();return this}get(e){return this}dup(){return this}pull(){return Promise.reject(this.error)}ignoreUnhandledRejections(){}dispose(){}onBroken(e){try{e(this.error)}catch(e){Promise.resolve(e)}}},hT=new mT(Error(`Attempted to use RPC stub after it has been disposed.`)),gT=(e,t,n)=>e.call(t,n);function _T(e,t){let n=gT;gT=e;try{return t()}finally{gT=n}}var vT=Symbol(`realStub`),yT={apply(e,t,n){let r=e.raw;return new xT(gT(r.hook,r.pathIfPromise||[],OT.fromAppParams(n)),[])},get(e,t,n){let r=e.raw;if(t===vT)return r;if(t in xT.prototype)return r[t];if(typeof t==`string`)return new xT(r.hook,r.pathIfPromise?[...r.pathIfPromise,t]:[t]);if(t===Symbol.dispose&&(!r.pathIfPromise||r.pathIfPromise.length==0))return()=>{r.hook.dispose(),r.hook=hT}},has(e,t){let n=e.raw;return t===vT?!0:t in xT.prototype?t in n:typeof t==`string`||t===Symbol.dispose&&(!n.pathIfPromise||n.pathIfPromise.length==0)},construct(e,t){throw Error(`An RPC stub cannot be used as a constructor.`)},defineProperty(e,t,n){throw Error(`Can't define properties on RPC stubs.`)},deleteProperty(e,t){throw Error(`Can't delete properties on RPC stubs.`)},getOwnPropertyDescriptor(e,t){},getPrototypeOf(e){return Object.getPrototypeOf(e.raw)},isExtensible(e){return!1},ownKeys(e){return[]},preventExtensions(e){return!0},set(e,t,n,r){throw Error(`Can't assign properties on RPC stubs.`)},setPrototypeOf(e,t){throw Error(`Can't override prototype of RPC stubs.`)}},bT=class e extends aT{constructor(e,t){if(super(),!(e instanceof pT)){let n=e;if(e=n instanceof aT||n instanceof Function?NT.create(n,void 0):new jT(OT.fromAppReturn(n)),t)throw TypeError(`RpcStub constructor expected one argument, received two.`)}this.hook=e,this.pathIfPromise=t;let n=()=>{};return n.raw=this,new Proxy(n,yT)}hook;pathIfPromise;dup(){let t=this[vT];return t.pathIfPromise?new e(t.hook.get(t.pathIfPromise)):new e(t.hook.dup())}onRpcBroken(e){this[vT].hook.onBroken(e)}map(e){let{hook:t,pathIfPromise:n}=this[vT];return uT.sendMap(t,n||[],e)}toString(){return`[object RpcStub]`}},xT=class extends bT{constructor(e,t){if(e instanceof pT)super(e,t??[]);else{if(t!==void 0)throw TypeError(`RpcPromise constructor expected one argument, received two.`);let n=cT(e);if(n===`rpc-promise`){let t=ET(e);if(t.pathIfPromise.length>0)super(t.hook,t.pathIfPromise);else{let e=t.hook;t.hook=hT,super(e,[])}}else if(n===`rpc-thenable`)super(NT.create(e,void 0),[]);else{let t=new PT(Promise.resolve(e).then(e=>new jT(OT.fromAppReturn(e))));t.ignoreUnhandledRejections(),super(t,[])}}}then(e,t){return DT(this).then(...arguments)}catch(e){return DT(this).catch(...arguments)}finally(e){return DT(this).finally(...arguments)}toString(){return`[object RpcPromise]`}};function ST(e){let{hook:t,pathIfPromise:n}=e[vT];return n&&n.length>0?t.get(n):t}function CT(e){let{hook:t,pathIfPromise:n}=e[vT];return n?t.get(n):t.dup()}function wT(e){let{hook:t,pathIfPromise:n}=e[vT];if(!(n&&n.length>0))return t}function TT(e){return e[vT].hook}function ET(e){return e[vT]}async function DT(e){let{hook:t,pathIfPromise:n}=e[vT];return n.length>0&&(t=t.get(n)),(await t.pull()).deliverResolve()}var OT=class e{value;source;hooks;promises;static fromAppParams(t){return new e(t,`params`)}static fromAppReturn(t){return new e(t,`return`)}static fromArray(t){let n=[],r=[],i=[];for(let e of t){e.ensureDeepCopied();for(let t of e.hooks)n.push(t);for(let t of e.promises)t.parent===e&&(t={parent:i,property:i.length,promise:t.promise}),r.push(t);i.push(e.value)}return new e(i,`owned`,n,r)}static forEvaluate(t,n){return new e(null,`owned`,t,n)}static deepCopyFrom(t,n,r){let i=new e(null,`owned`,[],[]);return i.value=i.deepCopy(t,n,`value`,i,!0,r),i}constructor(e,t,n,r){this.value=e,this.source=t,this.hooks=n,this.promises=r}rpcTargets;getHookForRpcTarget(e,t,n=!0){if(this.source===`params`){if(n){let t=e;typeof t.dup==`function`&&(e=t.dup())}return NT.create(e,t)}if(this.source===`return`){let r=this.rpcTargets?.get(e);return r?n?r.dup():(this.rpcTargets?.delete(e),r):(r=NT.create(e,t),n?(this.rpcTargets||=new Map,this.rpcTargets.set(e,r),r.dup()):r)}throw Error(`owned payload shouldn't contain raw RpcTargets`)}getHookForWritableStream(e,t,n=!0){if(this.source===`params`)return fT.createWritableStreamHook(e);if(this.source===`return`){let t=this.rpcTargets?.get(e);return t?n?t.dup():(this.rpcTargets?.delete(e),t):(t=fT.createWritableStreamHook(e),n?(this.rpcTargets||=new Map,this.rpcTargets.set(e,t),t.dup()):t)}throw Error(`owned payload shouldn't contain raw WritableStreams`)}getHookForReadableStream(e,t,n=!0){if(this.source===`params`)return fT.createReadableStreamHook(e);if(this.source===`return`){let t=this.rpcTargets?.get(e);return t?n?t.dup():(this.rpcTargets?.delete(e),t):(t=fT.createReadableStreamHook(e),n?(this.rpcTargets||=new Map,this.rpcTargets.set(e,t),t.dup()):t)}throw Error(`owned payload shouldn't contain raw ReadableStreams`)}deepCopy(e,t,n,r,i,a){switch(cT(e)){case`unsupported`:return e;case`primitive`:case`bigint`:case`date`:case`bytes`:case`blob`:case`url`:case`error`:case`undefined`:return e;case`array`:{let t=e,n=t.length,r=Array(n);for(let e=0;e<n;e++)r[e]=this.deepCopy(t[e],t,e,r,i,a);return r}case`object`:{let t={},n=e;for(let e in n)t[e]=this.deepCopy(n[e],n,e,t,i,a);return t}case`stub`:case`rpc-promise`:{let t=e,a;if(a=i?CT(t):ST(t),t instanceof xT){let e=new xT(a,[]);return this.promises.push({parent:r,property:n,promise:e}),e}return this.hooks.push(a),new bT(a)}case`function`:case`rpc-target`:{let n=e,r;return r=a?a.getHookForRpcTarget(n,t,i):NT.create(n,t),this.hooks.push(r),new bT(r)}case`rpc-thenable`:{let o=e,s;return s=a?new xT(a.getHookForRpcTarget(o,t,i),[]):new xT(NT.create(o,t),[]),this.promises.push({parent:r,property:n,promise:s}),s}case`writable`:{let n=e,r;return r=a?a.getHookForWritableStream(n,t,i):fT.createWritableStreamHook(n),this.hooks.push(r),n}case`readable`:{let n=e,r;return r=a?a.getHookForReadableStream(n,t,i):fT.createReadableStreamHook(n),this.hooks.push(r),n}case`headers`:return new Headers(e);case`request`:{let t=e;return t.body&&this.deepCopy(t.body,t,`body`,t,i,a),new Request(t)}case`response`:{let t=e;return t.body&&this.deepCopy(t.body,t,`body`,t,i,a),new Response(t.body,t)}default:throw Error(`unreachable`)}}ensureDeepCopied(){if(this.source!==`owned`){let e=this.source===`params`;this.hooks=[],this.promises=[];try{this.value=this.deepCopy(this.value,void 0,`value`,this,e,this)}catch(e){throw this.hooks=void 0,this.promises=void 0,e}if(this.source=`owned`,this.rpcTargets&&this.rpcTargets.size>0)throw Error(`Not all rpcTargets were accounted for in deep-copy?`);this.rpcTargets=void 0}}deliverTo(t,n,r){if(this.ensureDeepCopied(),this.value instanceof xT)e.deliverRpcPromiseTo(this.value,t,n,r);else{t[n]=this.value;for(let t of this.promises)e.deliverRpcPromiseTo(t.promise,t.parent,t.property,r)}}static deliverRpcPromiseTo(t,n,r,i){let a=wT(t);if(!a)throw Error(`property promises should have been resolved earlier`);let o=a.pull();o instanceof e?o.deliverTo(n,r,i):i.push(o.then(e=>{let t=[];if(e.deliverTo(n,r,t),t.length>0)return Promise.all(t)}))}async deliverCall(t,n){try{let r=[];this.deliverTo(this,`value`,r),r.length>0&&await Promise.all(r);let i=Function.prototype.apply.call(t,n,this.value);return i instanceof xT?e.fromAppReturn(i):e.fromAppReturn(await i)}finally{this.dispose()}}async deliverStreamWrite(t){try{let n=[];this.deliverTo(this,`value`,n),n.length>0&&await Promise.all(n);let r=this.value[0];return(this.hooks.length>0||this.promises.length>0)&&r instanceof Object?(Symbol.dispose in r||Object.defineProperty(r,Symbol.dispose,{value:()=>this.dispose(),writable:!0,enumerable:!1,configurable:!0}),await t.write(r),e.fromAppReturn(void 0)):(await t.write(r),this.dispose(),e.fromAppReturn(void 0))}catch(e){throw this.dispose(),e}}async deliverResolve(){try{let e=[];this.deliverTo(this,`value`,e),e.length>0&&await Promise.all(e);let t=this.value;return t instanceof Object&&(Symbol.dispose in t||Object.defineProperty(t,Symbol.dispose,{value:()=>this.dispose(),writable:!0,enumerable:!1,configurable:!0})),t}catch(e){throw this.dispose(),e}}dispose(){if(this.source===`owned`)this.hooks.forEach(e=>e.dispose()),this.promises.forEach(e=>e.promise[Symbol.dispose]());else if(this.source===`return`&&(this.disposeImpl(this.value,void 0),this.rpcTargets&&this.rpcTargets.size>0))throw Error(`Not all rpcTargets were accounted for in disposeImpl()?`);this.source=`owned`,this.hooks=[],this.promises=[]}disposeImpl(e,t){switch(cT(e)){case`unsupported`:case`primitive`:case`bigint`:case`bytes`:case`blob`:case`date`:case`url`:case`error`:case`undefined`:return;case`array`:{let t=e,n=t.length;for(let e=0;e<n;e++)this.disposeImpl(t[e],t);return}case`object`:{let t=e;for(let e in t)this.disposeImpl(t[e],t);return}case`stub`:case`rpc-promise`:{let t=wT(e);t&&t.dispose();return}case`function`:case`rpc-target`:{let t=e,n=this.rpcTargets?.get(t);n?(n.dispose(),this.rpcTargets.delete(t)):MT(t);return}case`rpc-thenable`:return;case`headers`:return;case`request`:{let t=e;t.body&&this.disposeImpl(t.body,t);return}case`response`:{let t=e;t.body&&this.disposeImpl(t.body,t);return}case`writable`:{let t=e,n=this.rpcTargets?.get(t);n?this.rpcTargets.delete(t):n=fT.createWritableStreamHook(t),n.dispose();return}case`readable`:{let t=e,n=this.rpcTargets?.get(t);n?this.rpcTargets.delete(t):n=fT.createReadableStreamHook(t),n.dispose();return}default:return}}ignoreUnhandledRejections(){this.hooks?(this.hooks.forEach(e=>{e.ignoreUnhandledRejections()}),this.promises.forEach(e=>TT(e.promise).ignoreUnhandledRejections())):this.ignoreUnhandledRejectionsImpl(this.value)}ignoreUnhandledRejectionsImpl(e){switch(cT(e)){case`unsupported`:case`primitive`:case`bigint`:case`bytes`:case`blob`:case`date`:case`error`:case`undefined`:case`function`:case`rpc-target`:case`writable`:case`readable`:case`url`:case`headers`:case`request`:case`response`:return;case`array`:{let t=e,n=t.length;for(let e=0;e<n;e++)this.ignoreUnhandledRejectionsImpl(t[e]);return}case`object`:{let t=e;for(let e in t)this.ignoreUnhandledRejectionsImpl(t[e]);return}case`stub`:case`rpc-promise`:TT(e).ignoreUnhandledRejections();return;case`rpc-thenable`:e.then(e=>{},e=>{});return;default:return}}};function kT(e,t,n,r){for(let i=0;i<n.length;i++){t=e;let a=n[i];if(a in Object.prototype){e=void 0;continue}switch(cT(e)){case`object`:case`function`:e=Object.hasOwn(e,a)?e[a]:void 0;break;case`array`:e=Number.isInteger(a)&&a>=0?e[a]:void 0;break;case`rpc-target`:case`rpc-thenable`:if(Object.hasOwn(e,a))throw TypeError(`Attempted to access property '${a}', which is an instance property of the RpcTarget. To avoid leaking private internals, instance properties cannot be accessed over RPC. If you want to make this property available over RPC, define it as a method or getter on the class, instead of an instance property.`);e=e[a],r=null;break;case`stub`:case`rpc-promise`:{let{hook:t,pathIfPromise:r}=ET(e);return{hook:t,remainingPath:r?r.concat(n.slice(i)):n.slice(i)}}case`writable`:e=void 0;break;case`readable`:e=void 0;break;case`primitive`:case`bigint`:case`bytes`:case`blob`:case`date`:case`error`:case`url`:case`headers`:case`request`:case`response`:e=void 0;break;case`undefined`:e=e[a];break;case`unsupported`:if(i===0)throw TypeError(`RPC stub points at a non-serializable type.`);{let e=n.slice(0,i).join(`.`),t=n.slice(0,i).join(`.`);throw TypeError(`'${e}' is not a serializable type, so property ${t} cannot be accessed.`)}default:throw TypeError(`unreachable`)}}if(e instanceof xT){let{hook:t,pathIfPromise:n}=ET(e);return{hook:t,remainingPath:n||[]}}return{value:e,parent:t,owner:r}}var AT=class extends pT{call(e,t){let n;try{let{value:t,owner:r}=this.getValue();n=kT(t,void 0,e,r)}catch(e){return t.dispose(),new mT(e)}return n.hook?n.hook.call(n.remainingPath,t):typeof n.value==`function`?new PT(t.deliverCall(n.value,n.parent).then(e=>new jT(e))):(t.dispose(),new mT(TypeError(`'${e.join(`.`)}' is not a function.`)))}map(e,t,n){try{let r;try{let{value:t,owner:n}=this.getValue();r=kT(t,void 0,e,n)}catch(e){for(let e of t)e.dispose();throw e}return r.hook?r.hook.map(r.remainingPath,t,n):uT.applyMap(r.value,r.parent,r.owner,t,n)}catch(e){return new mT(e)}}get(e){try{let{value:t,owner:n}=this.getValue();if(e.length===0&&n===null){if(t instanceof Object&&`then`in t)return this.dup();throw Error(`Can't dup an RpcTarget stub as a promise.`)}let r=kT(t,void 0,e,n);return r.hook?r.hook.get(r.remainingPath):new jT(OT.deepCopyFrom(r.value,r.parent,r.owner))}catch(e){return new mT(e)}}},jT=class e extends AT{constructor(e){super(),this.payload=e}payload;getPayload(){if(this.payload)return this.payload;throw Error(`Attempted to use an RPC StubHook after it was disposed.`)}getValue(){let e=this.getPayload();return{value:e.value,owner:e}}dup(){let t=this.getPayload();return new e(OT.deepCopyFrom(t.value,void 0,t))}pull(){return this.getPayload()}ignoreUnhandledRejections(){this.payload&&this.payload.ignoreUnhandledRejections()}dispose(){this.payload&&=(this.payload.dispose(),void 0)}onBroken(e){this.payload&&this.payload.value instanceof bT&&this.payload.value.onRpcBroken(e)}};function MT(e){if(Symbol.dispose in e)try{e[Symbol.dispose]()}catch(e){Promise.reject(e)}}var NT=class e extends AT{static create(t,n){return typeof t!=`function`&&(n=void 0),new e(t,n)}constructor(e,t,n){super(),this.target=e,this.parent=t,n?n.refcount&&(this.refcount=n.refcount,++this.refcount.count):Symbol.dispose in e&&(this.refcount={count:1})}target;parent;refcount;getTarget(){if(this.target)return this.target;throw Error(`Attempted to use an RPC StubHook after it was disposed.`)}getValue(){return{value:this.getTarget(),owner:null}}dup(){return new e(this.getTarget(),this.parent,this)}pull(){let e=this.getTarget();return`then`in e?Promise.resolve(e).then(e=>OT.fromAppReturn(e)):Promise.reject(Error(`Tried to resolve a non-promise stub.`))}ignoreUnhandledRejections(){}dispose(){this.target&&=(this.refcount&&--this.refcount.count==0&&MT(this.target),void 0)}onBroken(e){let t=this.target;t&&`then`in t&&Promise.resolve(t).then(()=>{},e)}},PT=class e extends pT{promise;resolution;constructor(e){super(),this.promise=e.then(e=>(this.resolution=e,e))}call(t,n){return n.ensureDeepCopied(),new e(this.promise.then(e=>e.call(t,n),e=>{throw n.dispose(),e}))}stream(e,t){return t.ensureDeepCopied(),{promise:this.promise.then(n=>n.stream(e,t).promise,e=>{throw t.dispose(),e})}}map(t,n,r){return new e(this.promise.then(e=>e.map(t,n,r),e=>{for(let e of n)e.dispose();throw e}))}get(t){return new e(this.promise.then(e=>e.get(t)))}dup(){return this.resolution?this.resolution.dup():new e(this.promise.then(e=>e.dup()))}pull(){return this.resolution?this.resolution.pull():this.promise.then(e=>e.pull())}ignoreUnhandledRejections(){this.resolution?this.resolution.ignoreUnhandledRejections():this.promise.then(e=>{e.ignoreUnhandledRejections()},e=>{})}dispose(){this.promise.then(e=>e.dispose(),()=>{})}onBroken(e){this.resolution?this.resolution.onBroken(e):this.promise.then(t=>{t.onBroken(e)},e)}},FT={maxBigIntDigits:16384,maxDepth:256,maxMessageSize:33554432},IT=new Uint8Array(new Uint16Array([1]).buffer)[0]===1,LT=[`ArrayBuffer`,`DataView`,`Int8Array`,`Uint8Array`,`Uint8ClampedArray`,`Int16Array`,`Uint16Array`,`Int32Array`,`Uint32Array`,`BigInt64Array`,`BigUint64Array`,`Float32Array`,`Float64Array`];function RT(e){return LT.includes(e)}var zT={ArrayBuffer:void 0,DataView:void 0,Int8Array:void 0,Uint8Array:void 0,Uint8ClampedArray:void 0,Int16Array:2,Uint16Array:2,Int32Array:4,Uint32Array:4,BigInt64Array:8,BigUint64Array:8,Float32Array:4,Float64Array:8},BT={ArrayBuffer:ArrayBuffer.prototype,DataView:DataView.prototype,Int8Array:Int8Array.prototype,Uint8ClampedArray:Uint8ClampedArray.prototype,Int16Array:Int16Array.prototype,Uint16Array:Uint16Array.prototype,Int32Array:Int32Array.prototype,Uint32Array:Uint32Array.prototype,BigInt64Array:BigInt64Array.prototype,BigUint64Array:BigUint64Array.prototype,Float32Array:Float32Array.prototype,Float64Array:Float64Array.prototype},VT=new Map;for(let e of Object.keys(BT))VT.set(BT[e],e);function HT(e,t){if(t!==2&&t!==4&&t!==8)throw RangeError(`Unsupported element size: ${t}`);let n=new DataView(e.buffer,e.byteOffset,e.byteLength);for(let r=0;r<e.byteLength;r+=t)switch(t){case 2:n.setUint16(r,n.getUint16(r,!1),!0);break;case 4:n.setUint32(r,n.getUint32(r,!1),!0);break;case 8:n.setBigUint64(r,n.getBigUint64(r,!1),!0)}}var UT=new class{exportStub(e){throw Error(`Cannot serialize RPC stubs without an RPC session.`)}exportPromise(e){throw Error(`Cannot serialize RPC stubs without an RPC session.`)}getImport(e){}unexport(e){}createPipe(e){throw Error(`Cannot create pipes without an RPC session.`)}onSendError(e){}};async function WT(e,t){let n=await new Response(e).blob();return n.type===t?n:n.slice(0,n.size,t)}var GT={__proto__:null,Error,EvalError,RangeError,ReferenceError,SyntaxError,TypeError,URIError,AggregateError},KT=class e{exporter;source;encodingLevel;constructor(e,t,n){this.exporter=e,this.source=t,this.encodingLevel=n}static devaluate(t,n,r=UT,i,a=`string`){let o=new e(r,i,a);try{return o.devaluateImpl(t,n,0)}catch(e){if(o.exports)try{r.unexport(o.exports)}catch{}throw e}}exports;devaluateImpl(e,t,n){if(n>=256)throw Error(`Serialization exceeded maximum allowed depth. (Does the message contain cycles?)`);switch(cT(e)){case`unsupported`:{let t;try{t=`Cannot serialize value: ${e}`}catch{t=`Cannot serialize value: (couldn't stringify value)`}throw TypeError(t)}case`primitive`:return typeof e==`number`&&!isFinite(e)?this.encodingLevel===`structuredClonable`?e:e===1/0?[`inf`]:e===-1/0?[`-inf`]:[`nan`]:e;case`object`:{let t=e,r={};for(let e in t)r[e]=this.devaluateImpl(t[e],t,n+1);return r}case`array`:{let t=e,r=t.length,i=Array(r);for(let e=0;e<r;e++)i[e]=this.devaluateImpl(t[e],t,n+1);return[i]}case`bigint`:return this.encodingLevel===`structuredClonable`?e:[`bigint`,e.toString()];case`date`:{if(this.encodingLevel===`structuredClonable`)return e;let t=e.getTime();return[`date`,Number.isNaN(t)?null:t]}case`bytes`:{let t=VT.get(Object.getPrototypeOf(e)),n;if(t===`ArrayBuffer`)n=new Uint8Array(e);else if(t===void 0)n=e;else{let r=e;n=new Uint8Array(r.buffer,r.byteOffset,r.byteLength);let i=zT[t];!IT&&i&&(n=n.slice(),HT(n,i))}if(this.encodingLevel===`structuredClonable`||this.encodingLevel===`jsonCompatibleWithBytes`)return t===void 0?[`bytes`,n]:[`bytes`,n,t];let r;if(n.toBase64)r=n.toBase64({omitPadding:!0});else if(typeof Buffer<`u`)r=(n instanceof Buffer?n:Buffer.from(n.buffer,n.byteOffset,n.byteLength)).toString(`base64`);else{let e=``;for(let t=0;t<n.length;t++)e+=String.fromCharCode(n[t]);r=btoa(e)}return r=r.replace(/=+$/,``),t===void 0?[`bytes`,r]:[`bytes`,r,t]}case`url`:return[`url`,e.href];case`headers`:return[`headers`,[...e]];case`request`:{let t=e,r={};t.method!==`GET`&&(r.method=t.method);let i=[...t.headers];if(i.length>0&&(r.headers=i),t.body)r.body=this.devaluateImpl(t.body,t,n+1),r.duplex=t.duplex||`half`;else if(t.body===void 0&&![`GET`,`HEAD`,`OPTIONS`,`TRACE`,`DELETE`].includes(t.method)){let e=t.arrayBuffer(),n=new ReadableStream({async start(t){try{t.enqueue(new Uint8Array(await e)),t.close()}catch(e){t.error(e)}}}),i=fT.createReadableStreamHook(n);r.body=[`readable`,this.exporter.createPipe(n,i)],r.duplex=t.duplex||`half`}t.cache&&t.cache!=="default"&&(r.cache=t.cache),t.redirect!==`follow`&&(r.redirect=t.redirect),t.integrity&&(r.integrity=t.integrity),t.mode&&t.mode!==`cors`&&(r.mode=t.mode),t.credentials&&t.credentials!==`same-origin`&&(r.credentials=t.credentials),t.referrer&&t.referrer!==`about:client`&&(r.referrer=t.referrer),t.referrerPolicy&&(r.referrerPolicy=t.referrerPolicy),t.keepalive&&(r.keepalive=t.keepalive);let a=t;return a.cf&&(r.cf=a.cf),a.encodeResponseBody&&a.encodeResponseBody!==`automatic`&&(r.encodeResponseBody=a.encodeResponseBody),[`request`,t.url,r]}case`response`:{let t=e,r=this.devaluateImpl(t.body,t,n+1),i={};t.status!==200&&(i.status=t.status),t.statusText&&(i.statusText=t.statusText);let a=[...t.headers];a.length>0&&(i.headers=a);let o=t;if(o.cf&&(i.cf=o.cf),o.encodeBody&&o.encodeBody!==`automatic`&&(i.encodeBody=o.encodeBody),o.webSocket)throw TypeError(`Can't serialize a Response containing a webSocket.`);return[`response`,r,i]}case`blob`:{let t=e,n=t.stream(),r=fT.createReadableStreamHook(n),i=this.exporter.createPipe(n,r);return[`blob`,t.type,[`readable`,i]]}case`error`:{let t=e,r=this.exporter.onSendError(t);r&&(t=r);let i=t,a,o=(e,r)=>{let i=this.exports?.length??0;try{let i=this.devaluateImpl(r,t,n+1);a||={},a[e]=i}catch{if(this.exports&&this.exports.length>i){let e=this.exports.splice(i);try{this.exporter.unexport(e)}catch{}}}};for(let e of Object.keys(t))e!==`name`&&e!==`message`&&e!==`stack`&&o(e,i[e]);`cause`in t&&o(`cause`,i.cause),t instanceof AggregateError&&o(`errors`,t.errors);let s=[`error`,t.name,t.message];return a?(s.push(r&&r.stack?r.stack:null),s.push(a)):r&&r.stack&&s.push(r.stack),s}case`undefined`:return this.encodingLevel===`structuredClonable`?void 0:[`undefined`];case`stub`:case`rpc-promise`:{if(!this.source)throw Error(`Can't serialize RPC stubs in this context.`);let{hook:t,pathIfPromise:n}=ET(e),r=this.exporter.getImport(t);return r===void 0?(t=n?t.get(n):t.dup(),this.devaluateHook(n?`promise`:`export`,t)):n?n.length>0?[`pipeline`,r,n]:[`pipeline`,r]:[`import`,r]}case`function`:case`rpc-target`:{if(!this.source)throw Error(`Can't serialize RPC stubs in this context.`);let n=this.source.getHookForRpcTarget(e,t);return this.devaluateHook(`export`,n)}case`rpc-thenable`:{if(!this.source)throw Error(`Can't serialize RPC stubs in this context.`);let n=this.source.getHookForRpcTarget(e,t);return this.devaluateHook(`promise`,n)}case`writable`:{if(!this.source)throw Error(`Can't serialize WritableStream in this context.`);let n=this.source.getHookForWritableStream(e,t);return this.devaluateHook(`writable`,n)}case`readable`:{if(!this.source)throw Error(`Can't serialize ReadableStream in this context.`);let n=e,r=this.source.getHookForReadableStream(n,t);return[`readable`,this.exporter.createPipe(n,r)]}default:throw Error(`unreachable`)}}devaluateHook(e,t){this.exports||=[];let n=e===`promise`?this.exporter.exportPromise(t):this.exporter.exportStub(t);return this.exports.push(n),[e,n]}};new class{importStub(e){throw Error(`Cannot deserialize RPC stubs without an RPC session.`)}importPromise(e){throw Error(`Cannot deserialize RPC stubs without an RPC session.`)}getExport(e){}getPipeReadable(e){throw Error(`Cannot retrieve pipe readable without an RPC session.`)}getLimits(){return FT}};function qT(e,t){return new xT(new PT(new Response(t).arrayBuffer().then(t=>{let n=new Uint8Array(t),r=new Request(e,{body:n});return new jT(OT.fromAppReturn(r))})),[])}function JT(e,t){return new xT(new PT(WT(e,t).then(e=>new jT(OT.fromAppReturn(e)))),[])}var YT=class e{importer;encodingLevel;limits;constructor(e,t=`string`){this.importer=e,this.encodingLevel=t,this.limits=e.getLimits()}hooks=[];promises=[];evaluate(e){return this.evaluateWithDepth(e,0)}evaluateWithDepth(e,t){let n=OT.forEvaluate(this.hooks,this.promises);try{return n.value=this.evaluateImpl(e,n,`value`,t),n}catch(e){throw n.dispose(),e}}evaluateCopy(e){return this.evaluate(structuredClone(e))}evaluateImpl(t,n,r,i){let a=this.limits.maxDepth;if(i>=a)throw TypeError(`Deserialization exceeded maximum allowed message depth of ${a}.`);if(this.encodingLevel===`structuredClonable`&&(t instanceof Date||typeof t==`bigint`))return t;if(t instanceof Array){if(t.length==1&&t[0]instanceof Array){let e=t[0];for(let t=0;t<e.length;t++)e[t]=this.evaluateImpl(e[t],e,t,i+1);return e}switch(t[0]){case`bigint`:if(typeof t[1]==`string`){let e=t[1],n=this.limits.maxBigIntDigits;if(e.length>n)throw TypeError(`Deserialized bigint exceeds maximum length of ${n} digits.`);return BigInt(e)}break;case`date`:if(t[1]===null)return new Date(NaN);if(typeof t[1]==`number`)return new Date(t[1]);break;case`bytes`:{let e;if(t[1]instanceof Uint8Array)e=t[1];else if(typeof t[1]==`string`){if(typeof Buffer<`u`)e=Buffer.from(t[1],`base64`);else if(Uint8Array.fromBase64)e=Uint8Array.fromBase64(t[1]);else{let n=atob(t[1]),r=n.length;e=new Uint8Array(r);for(let t=0;t<r;t++)e[t]=n.charCodeAt(t)}}else break;if(t.length===2)return e;if(typeof t[2]!=`string`)throw TypeError(`Unknown bytes type marker type: ${typeof t[2]}`);if(!RT(t[2])){let e=t[2].slice(0,64);throw TypeError(`Unknown bytes type marker: ${e}`)}let n=t[2],r=zT[n];if(r!==void 0&&e.byteLength%r!==0)throw TypeError(`Invalid byte length ${e.byteLength} for ${n}; expected a multiple of ${r}`);let i=e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength);switch(!IT&&r!==void 0&&HT(new Uint8Array(i),r),n){case`ArrayBuffer`:return i;case`DataView`:return new DataView(i);case`Int8Array`:return new Int8Array(i);case`Uint8Array`:return new Uint8Array(i);case`Uint8ClampedArray`:return new Uint8ClampedArray(i);case`Int16Array`:return new Int16Array(i);case`Uint16Array`:return new Uint16Array(i);case`Int32Array`:return new Int32Array(i);case`Uint32Array`:return new Uint32Array(i);case`BigInt64Array`:return new BigInt64Array(i);case`BigUint64Array`:return new BigUint64Array(i);case`Float32Array`:return new Float32Array(i);case`Float64Array`:return new Float64Array(i)}}case`error`:if(t.length>=3&&typeof t[1]==`string`&&typeof t[2]==`string`){let e=GT[t[1]]||Error,n=e===AggregateError?new e([],t[2]):new e(t[2]);if(typeof t[3]==`string`&&(n.stack=t[3]),t.length>=5){let e=t[4];if(!e||typeof e!=`object`||Array.isArray(e))break;let r=n,a=e;for(let e of Object.keys(a))if(e!==`name`&&e!==`message`&&e!==`stack`){if(e in Object.prototype||e===`toJSON`){this.evaluateImpl(a[e],n,e,i+1);continue}r[e]=this.evaluateImpl(a[e],n,e,i+1)}}return n}break;case`undefined`:if(t.length===1)return;break;case`inf`:return 1/0;case`-inf`:return-1/0;case`nan`:return NaN;case`url`:if(t.length===2&&typeof t[1]==`string`)return new URL(t[1]);break;case`headers`:if(t.length===2&&t[1]instanceof Array)return new Headers(t[1]);break;case`request`:{if(t.length!==3||typeof t[1]!=`string`)break;let e=t[1],a=t[2];if(typeof a!=`object`||!a)break;if(a.body&&(a.body=this.evaluateImpl(a.body,a,`body`,i+1),!(a.body===null||typeof a.body==`string`||a.body instanceof Uint8Array||a.body instanceof ReadableStream)))throw TypeError(`Request body must be of type ReadableStream.`);if(a.signal&&(a.signal=this.evaluateImpl(a.signal,a,`signal`,i+1),!(a.signal instanceof AbortSignal)))throw TypeError(`Request siganl must be of type AbortSignal.`);if(a.headers&&!(a.headers instanceof Array))throw TypeError(`Request headers must be serialized as an array of pairs.`);let o=new Request(e,a);if(a.body instanceof ReadableStream&&o.body===void 0){let e=qT(o,a.body);return this.promises.push({promise:e,parent:n,property:r}),e}return o}case`response`:{if(t.length!==3)break;let e=this.evaluateImpl(t[1],n,r,i+1);if(!(e===null||typeof e==`string`||e instanceof Uint8Array||e instanceof ReadableStream))throw TypeError(`Response body must be of type ReadableStream.`);let a=t[2];if(typeof a!=`object`||!a)break;if(a.webSocket)throw TypeError(`Can't deserialize a Response containing a webSocket.`);if(a.headers&&!(a.headers instanceof Array))throw TypeError(`Request headers must be serialized as an array of pairs.`);return new Response(e,a)}case`blob`:{if(t.length!==3||typeof t[1]!=`string`)break;let e=t[1],a=this.evaluateImpl(t[2],n,r,i+1);if(!(a instanceof ReadableStream))throw TypeError(`Blob content must be serialized as a ReadableStream.`);let o=JT(a,e);return this.promises.push({promise:o,parent:n,property:r}),o}case`import`:case`pipeline`:{if(t.length<2||t.length>4||typeof t[1]!=`number`)break;let a=this.importer.getExport(t[1]);if(!a)throw Error(`no such entry on exports table: ${t[1]}`);let o=t[0]==`pipeline`,s=e=>{if(o){let t=new xT(e,[]);return this.promises.push({promise:t,parent:n,property:r}),t}return this.hooks.push(e),new xT(e,[])};if(t.length==2)return s(o?a.get([]):a.dup());let c=t[2];if(!(c instanceof Array)||!c.every(e=>typeof e==`string`||typeof e==`number`))break;if(t.length==3)return s(a.get(c));let l=t[3];if(!(l instanceof Array))break;return l=new e(this.importer).evaluateWithDepth([l],i),s(a.call(c,l))}case`remap`:{if(t.length!==5||typeof t[1]!=`number`||!(t[2]instanceof Array)||!(t[3]instanceof Array)||!(t[4]instanceof Array))break;let e=this.importer.getExport(t[1]);if(!e)throw Error(`no such entry on exports table: ${t[1]}`);let i=t[2];if(!i.every(e=>typeof e==`string`||typeof e==`number`))break;let a=t[3].map(e=>{if(!(e instanceof Array)||e.length!==2||e[0]!==`import`&&e[0]!==`export`||typeof e[1]!=`number`)throw TypeError(`unknown map capture: ${JSON.stringify(e)}`);if(e[0]===`export`)return this.importer.importStub(e[1]);{let t=this.importer.getExport(e[1]);if(!t)throw Error(`no such entry on exports table: ${e[1]}`);return t.dup()}}),o=t[4],s=new xT(e.map(i,a,o),[]);return this.promises.push({promise:s,parent:n,property:r}),s}case`export`:case`promise`:if(typeof t[1]==`number`){if(t[0]==`promise`){let e=new xT(this.importer.importPromise(t[1]),[]);return this.promises.push({parent:n,property:r,promise:e}),e}{let e=this.importer.importStub(t[1]);return this.hooks.push(e),new bT(e)}}break;case`writable`:if(typeof t[1]==`number`){let e=this.importer.importStub(t[1]),n=fT.createWritableStreamFromHook(e);return this.hooks.push(e),n}break;case`readable`:if(typeof t[1]==`number`){let e=this.importer.getPipeReadable(t[1]),n=fT.createReadableStreamHook(e);return this.hooks.push(n),e}}throw TypeError(`unknown special value: ${JSON.stringify(t)}`)}if(t instanceof Object){let e=t;for(let t in e)t in Object.prototype||t===`toJSON`?(this.evaluateImpl(e[t],e,t,i+1),delete e[t]):e[t]=this.evaluateImpl(e[t],e,t,i+1);return e}return t}},XT=16,ZT=8,QT=16,$T=64;function eE(e){return 2+e.length*3}function tE(e,t,n=0){if(n>=$T)return ZT;switch(typeof e){case`string`:return eE(e);case`number`:return 16;case`bigint`:return 16;case`boolean`:return 8;case`undefined`:return 16;case`object`:{if(e===null)return 8;if(ArrayBuffer.isView(e)||e instanceof ArrayBuffer)return QT+e.byteLength;if(typeof Blob<`u`&&e instanceof Blob)return QT+e.size;if(e instanceof Date)return 16;if(t??=new WeakSet,t.has(e))return ZT;if(t.add(e),e instanceof Array){let r=XT;for(let i of e)r+=ZT+tE(i,t,n+1);return r}if(e instanceof Error){let r=XT+eE(e.name)+eE(e.message)+eE(e.stack??``);for(let i of Object.keys(e))r+=ZT+eE(i)+tE(e[i],t,n+1);return r}let r=XT;for(let i of Object.keys(e))r+=ZT+eE(i)+tE(e[i],t,n+1);return r}default:return 16}}var nE=class{session;importId;constructor(e,t,n){this.session=e,this.importId=t,n&&(this.activePull=Promise.withResolvers())}localRefcount=0;remoteRefcount=1;activePull;resolution;onBrokenRegistrations;resolve(e){if(this.localRefcount==0){e.dispose();return}if(this.resolution=e,this.sendRelease(),this.onBrokenRegistrations){for(let t of this.onBrokenRegistrations){let n=this.session.onBrokenCallbacks[t],r=this.session.onBrokenCallbacks.length;e.onBroken(n),this.session.onBrokenCallbacks[r]===n?delete this.session.onBrokenCallbacks[r]:delete this.session.onBrokenCallbacks[t]}this.onBrokenRegistrations=void 0}this.activePull&&=(this.activePull.resolve(),void 0)}async awaitResolution(){return this.activePull||=(this.session.sendPull(this.importId),Promise.withResolvers()),await this.activePull.promise,this.resolution.pull()}dispose(){this.resolution?this.resolution.dispose():(this.abort(Error(`RPC was canceled because the RpcPromise was disposed.`)),this.sendRelease())}abort(e){if(!this.resolution){if(this.resolution=new mT(e),this.activePull&&=(this.activePull.reject(e),void 0),this.onBrokenRegistrations)for(let e of this.onBrokenRegistrations)delete this.session.onBrokenCallbacks[e];this.onBrokenRegistrations=void 0}}onBroken(e){if(this.resolution)this.resolution.onBroken(e);else{let t=this.session.onBrokenCallbacks.length;this.session.onBrokenCallbacks.push(e),this.onBrokenRegistrations||=[],this.onBrokenRegistrations.push(t)}}sendRelease(){this.remoteRefcount>0&&(this.session.sendRelease(this.importId,this.remoteRefcount),this.remoteRefcount=0)}},rE=class e extends pT{isPromise;entry;constructor(e,t){super(),this.isPromise=e,++t.localRefcount,this.entry=t}collectPath(e){return this}getEntry(){if(this.entry)return this.entry;throw Error(`This RpcImportHook was already disposed.`)}getEntryTakingOwnership(e){try{return this.getEntry()}catch(t){throw e(),t}}call(e,t){let n=this.getEntryTakingOwnership(()=>t.dispose());return n.resolution?n.resolution.call(e,t):n.session.sendCall(n.importId,e,t)}stream(e,t){let n=this.getEntryTakingOwnership(()=>t.dispose());return n.resolution?n.resolution.stream(e,t):n.session.sendStream(n.importId,e,t)}map(e,t,n){let r=this.getEntryTakingOwnership(()=>{for(let e of t)e.dispose()});return r.resolution?r.resolution.map(e,t,n):r.session.sendMap(r.importId,e,t,n)}get(e){let t=this.getEntry();return t.resolution?t.resolution.get(e):t.session.sendCall(t.importId,e)}dup(){return new e(!1,this.getEntry())}pull(){let e=this.getEntry();if(!this.isPromise)throw Error(`Can't pull this hook because it's not a promise hook.`);return e.resolution?e.resolution.pull():e.awaitResolution()}ignoreUnhandledRejections(){}dispose(){let e=this.entry;this.entry=void 0,e&&--e.localRefcount===0&&e.dispose()}onBroken(e){this.entry&&this.entry.onBroken(e)}},iE=class extends rE{session;constructor(e){super(!1,e),this.session=e.session}dispose(){if(this.session){let e=this.session;this.session=void 0,e.shutdown()}}},aE=class{transport;options;exports=[];reverseExports=new Map;imports=[];abortReason;cancelReadLoop;nextExportId=-1;onBatchDone;pullCount=0;onBrokenCallbacks=[];encodingLevel;limits;constructor(e,t,n){this.transport=e,this.options=n;let r=`string`;if(`encodingLevel`in e){let t=e.encodingLevel;if(t!==void 0){if(t!==`string`&&t!==`jsonCompatible`&&t!==`jsonCompatibleWithBytes`&&t!==`structuredClonable`)throw TypeError(`Unknown transport encodingLevel: ${String(t)}`);r=t}}this.encodingLevel=r,this.limits={...FT,...n.limits},this.exports.push({hook:t,refcount:1}),this.imports.push(new nE(this,0,!1)),this.readLoop().catch(e=>this.abort(e))}getMainImport(){return new iE(this.imports[0])}shutdown(){this.abort(Error(`RPC session was shut down by disposing the main stub`),!1)}exportStub(e){if(this.abortReason)throw this.abortReason;let t=this.reverseExports.get(e);if(t!==void 0)return++this.exports[t].refcount,t;{let t=this.nextExportId--;return this.exports[t]={hook:e,refcount:1},this.reverseExports.set(e,t),this.watchExport(t,e),t}}exportPromise(e){if(this.abortReason)throw this.abortReason;let t=this.nextExportId--;return this.exports[t]={hook:e,refcount:1},this.reverseExports.set(e,t),this.ensureResolvingExport(t),t}unexport(e){for(let t of e)this.releaseExport(t,1)}watchExport(e,t){t.onBroken(n=>{queueMicrotask(()=>{if(this.abortReason===void 0&&this.exports[e]?.hook===t)try{this.send([`reject`,e,KT.devaluate(n,void 0,this,void 0,this.encodingLevel)])}catch(e){this.abort(e)}})})}releaseExport(e,t){let n=this.exports[e];if(!n)throw Error(`no such export ID: ${e}`);if(n.refcount<t)throw Error(`refcount would go negative: ${n.refcount} < ${t}`);n.refcount-=t,n.refcount===0&&(delete this.exports[e],this.reverseExports.delete(n.hook),n.hook.dispose())}onSendError(e){if(this.options.onSendError)return this.options.onSendError(e)}ensureResolvingExport(e){let t=this.exports[e];if(!t)throw Error(`no such export ID: ${e}`);if(!t.pull){let n=async()=>{let e=t.hook;for(;;){let t=await e.pull();if(t.value instanceof bT){let{hook:n,pathIfPromise:r}=ET(t.value);if(r&&r.length==0&&this.getImport(e)===void 0){e=n;continue}}return t}},r=t.autoRelease;++this.pullCount,t.pull=n().then(t=>{let n=KT.devaluate(t.value,void 0,this,t,this.encodingLevel);this.send([`resolve`,e,n]),r&&this.releaseExport(e,1)},t=>{this.send([`reject`,e,KT.devaluate(t,void 0,this,void 0,this.encodingLevel)]),r&&this.releaseExport(e,1)}).catch(t=>{try{this.send([`reject`,e,KT.devaluate(t,void 0,this,void 0,this.encodingLevel)]),r&&this.releaseExport(e,1)}catch(e){this.abort(e)}}).finally(()=>{--this.pullCount===0&&this.onBatchDone&&this.onBatchDone.resolve()})}}getImport(e){if(e instanceof rE&&e.entry&&e.entry.session===this)return e.entry.importId}importStub(e){if(this.abortReason)throw this.abortReason;let t=this.imports[e];return t||(t=new nE(this,e,!1),this.imports[e]=t),new rE(!1,t)}importPromise(e){if(this.abortReason)throw this.abortReason;if(this.imports[e])return new mT(Error(`Bug in RPC system: The peer sent a promise reusing an existing export ID.`));let t=new nE(this,e,!0);return this.imports[e]=t,new rE(!0,t)}getExport(e){return this.exports[e]?.hook}getPipeReadable(e){let t=this.exports[e];if(!t||!t.pipeReadable)throw Error(`Export ${e} is not a pipe or its readable end was already consumed.`);let n=t.pipeReadable;return t.pipeReadable=void 0,n}getLimits(){return this.limits}createPipe(e,t){if(this.abortReason)throw this.abortReason;this.send([`pipe`]);let n=this.imports.length,r=new nE(this,n,!1);this.imports.push(r);let i=new rE(!1,r),a=fT.createWritableStreamFromHook(i);return e.pipeTo(a).catch(()=>{}).finally(()=>t.dispose()),n}send(e){if(this.abortReason!==void 0)return 0;if(this.encodingLevel===`string`){let t;try{t=JSON.stringify(e)}catch(e){try{this.abort(e)}catch{}throw e}try{let e=this.transport.send(t);e!==void 0&&typeof e.catch==`function`&&e.catch(e=>this.abort(e,!1))}catch(e){queueMicrotask(()=>this.abort(e,!1))}return t.length}try{let t=this.transport.send(e);if(typeof t==`number`)return t;let n=t;n&&typeof n.then==`function`&&Promise.resolve(n).catch(e=>this.abort(e,!1));return}catch(e){queueMicrotask(()=>this.abort(e,!1));return}}sendCall(e,t,n){if(this.abortReason)throw n?.dispose(),this.abortReason;let r=[`pipeline`,e,t];if(n){let e;try{e=KT.devaluate(n.value,void 0,this,n,this.encodingLevel)}catch(e){throw n.dispose(),e}r.push(e[0])}this.send([`push`,r]);let i=new nE(this,this.imports.length,!1);return this.imports.push(i),new rE(!0,i)}sendStream(e,t,n){if(this.abortReason)throw n.dispose(),this.abortReason;let r=[`pipeline`,e,t],i;try{i=KT.devaluate(n.value,void 0,this,n,this.encodingLevel)}catch(e){throw n.dispose(),e}r.push(i[0]);let a=[`stream`,r],o=this.send(a);o===void 0&&(o=tE(a));let s=this.imports.length,c=new nE(this,s,!0);return c.remoteRefcount=0,c.localRefcount=1,this.imports.push(c),{promise:c.awaitResolution().then(e=>{e.dispose(),delete this.imports[s]},e=>{throw delete this.imports[s],e}),size:o}}sendMap(e,t,n,r){if(this.abortReason){for(let e of n)e.dispose();throw this.abortReason}let i=[`remap`,e,t,n.map(e=>{let t=this.getImport(e);return t===void 0?[`export`,this.exportStub(e)]:[`import`,t]}),r];this.send([`push`,i]);let a=new nE(this,this.imports.length,!1);return this.imports.push(a),new rE(!0,a)}sendPull(e){if(this.abortReason)throw this.abortReason;this.send([`pull`,e])}sendRelease(e,t){this.abortReason||(this.send([`release`,e,t]),delete this.imports[e])}abort(e,t=!0){if(this.abortReason===void 0){if(this.cancelReadLoop?.(e),this.cancelReadLoop=void 0,t)try{let t=[`abort`,KT.devaluate(e,void 0,this,void 0,this.encodingLevel)];if(this.encodingLevel===`string`){let e=this.transport.send(JSON.stringify(t));e!==void 0&&typeof e.catch==`function`&&e.catch(e=>{})}else{let e=this.transport.send(t);e&&typeof e.then==`function`&&Promise.resolve(e).catch(e=>{})}}catch{}if(e===void 0&&(e=`undefined`),this.abortReason=e,this.onBatchDone&&this.onBatchDone.reject(e),this.transport.abort)try{this.transport.abort(e)}catch(e){Promise.resolve(e)}for(let t of Object.values(this.onBrokenCallbacks))try{t(e)}catch(e){Promise.resolve(e)}for(let t in this.imports)this.imports[t].abort(e);for(let e in this.exports)this.exports[e].hook.dispose()}}async readLoop(){for(;!this.abortReason;){let e=Promise.withResolvers();this.cancelReadLoop=e.reject;let t;try{t=await Promise.race([this.transport.receive(),e.promise])}finally{this.cancelReadLoop===e.reject&&(this.cancelReadLoop=void 0)}if(this.encodingLevel===`string`&&t.length>this.limits.maxMessageSize)throw TypeError(`Incoming message exceeds maximum size of ${this.limits.maxMessageSize} UTF-16 code units.`);if(this.abortReason)break;let n=this.encodingLevel===`string`?JSON.parse(t):t;if(n instanceof Array)switch(n[0]){case`push`:if(n.length>1){let e=new jT(new YT(this,this.encodingLevel).evaluate(n[1]));e.ignoreUnhandledRejections(),this.exports.push({hook:e,refcount:1});continue}break;case`stream`:if(n.length>1){let e=new jT(new YT(this,this.encodingLevel).evaluate(n[1]));e.ignoreUnhandledRejections();let t=this.exports.length;this.exports.push({hook:e,refcount:1,autoRelease:!0}),this.ensureResolvingExport(t);continue}break;case`pipe`:{let{readable:e,writable:t}=new TransformStream,n=fT.createWritableStreamHook(t),r=this.exports.length;this.exports.push({hook:n,refcount:1,pipeReadable:e}),this.watchExport(r,n);continue}case`pull`:{let e=n[1];if(typeof e==`number`){this.ensureResolvingExport(e);continue}break}case`resolve`:case`reject`:{let e=n[1];if(typeof e==`number`&&n.length>2){let t=this.imports[e];if(t){if(n[0]==`resolve`)t.resolve(new jT(new YT(this,this.encodingLevel).evaluate(n[2])));else{let e=new YT(this,this.encodingLevel).evaluate(n[2]);e.dispose(),t.resolve(new mT(e.value))}}else n[0]==`resolve`&&new YT(this,this.encodingLevel).evaluate(n[2]).dispose();continue}break}case`release`:{let e=n[1],t=n[2];if(typeof e==`number`&&typeof t==`number`){this.releaseExport(e,t);continue}break}case`abort`:{let e=new YT(this,this.encodingLevel).evaluate(n[1]);e.dispose(),this.abort(e.value,!1);break}}throw Error(`bad RPC message: ${JSON.stringify(n)}`)}}async drain(){if(this.abortReason)throw this.abortReason;if(this.pullCount>0){let{promise:e,resolve:t,reject:n}=Promise.withResolvers();this.onBatchDone={resolve:t,reject:n},await e}}getStats(){let e={imports:0,exports:0};for(let t in this.imports)++e.imports;for(let t in this.exports)++e.exports;return e}},oE=class{#e;#t;constructor(e,t,n={}){let r;r=t?new jT(OT.fromAppReturn(t)):new mT(Error(`This connection has no main object.`)),this.#e=new aE(e,r,n),this.#t=new bT(this.#e.getMainImport())}getRemoteMain(){return this.#t}getStats(){return this.#e.getStats()}drain(){return this.#e.drain()}};function sE(e,t,n){return new oE(new cE(e),t,n).getRemoteMain()}var cE=class{encodingLevel=`structuredClonable`;constructor(e){this.#e=e,e.start(),e.addEventListener(`message`,e=>{this.#i||(e.data===null?this.#a(Error(`Peer closed MessagePort connection.`)):this.#t?(this.#t(e.data),this.#t=void 0,this.#n=void 0):this.#r.push(e.data))}),e.addEventListener(`messageerror`,e=>{this.#a(Error(`MessagePort message error.`))})}#e;#t;#n;#r=[];#i;send(e){if(this.#i)throw this.#i;this.#e.postMessage(e)}async receive(){if(this.#r.length>0)return this.#r.shift();if(this.#i)throw this.#i;return new Promise((e,t)=>{this.#t=e,this.#n=t})}abort(e){try{this.#e.postMessage(null)}catch{}this.#e.close(),this.#i||=e}#a(e){this.#i||(this.#i=e,this.#n&&=(this.#n(e),this.#t=void 0,void 0))}},lE,uE=class{context;captureMap=new Map;instructions=[];constructor(e,t){this.context=lE?{parent:lE,captures:[],subject:lE.capture(e),path:t}:{parent:void 0,captures:[],subject:e,path:t},lE=this}unregister(){lE=this.context.parent}makeInput(){return new fE(this,0)}makeOutput(e){let t;try{t=KT.devaluate(e.value,void 0,this,e)}finally{e.dispose()}return this.instructions.push(t),this.context.parent?(this.context.parent.instructions.push([`remap`,this.context.subject,this.context.path,this.context.captures.map(e=>[`import`,e]),this.instructions]),new fE(this.context.parent,this.context.parent.instructions.length)):this.context.subject.map(this.context.path,this.context.captures,this.instructions)}pushCall(e,t,n){let r=KT.devaluate(n.value,void 0,this,n);r=r[0];let i=this.capture(e.dup());return this.instructions.push([`pipeline`,i,t,r]),new fE(this,this.instructions.length)}pushGet(e,t){let n=this.capture(e.dup());return this.instructions.push([`pipeline`,n,t]),new fE(this,this.instructions.length)}capture(e){if(e instanceof fE&&e.mapper===this)return e.idx;let t=this.captureMap.get(e);if(t===void 0){if(this.context.parent){let t=this.context.parent.capture(e);this.context.captures.push(t)}else this.context.captures.push(e);t=-this.context.captures.length,this.captureMap.set(e,t)}return t}exportStub(e){throw Error(`Can't construct an RpcTarget or RPC callback inside a mapper function. Try creating a new RpcStub outside the callback first, then using it inside the callback.`)}exportPromise(e){return this.exportStub(e)}getImport(e){return this.capture(e)}unexport(e){}createPipe(e){throw Error(`Cannot send ReadableStream inside a mapper function.`)}onSendError(e){}};uT.sendMap=(e,t,n)=>{let r=new uE(e,t),i;try{i=OT.fromAppReturn(_T(r.pushCall.bind(r),()=>n(new xT(r.makeInput(),[]))))}finally{r.unregister()}if(i instanceof Promise)throw i.catch(e=>{}),Error(`RPC map() callbacks cannot be async.`);return new xT(r.makeOutput(i),[])};function dE(){throw Error(`Attempted to use an abstract placeholder from a mapper function. Please make sure your map function has no side effects.`)}var fE=class extends pT{mapper;idx;constructor(e,t){super(),this.mapper=e,this.idx=t}dup(){return this}dispose(){}get(e){if(e.length==0)return this;if(lE)return lE.pushGet(this,e);dE()}call(e,t){t.dispose(),dE()}map(e,t,n){for(let e of t)e.dispose();dE()}pull(){dE()}ignoreUnhandledRejections(){}onBroken(e){dE()}},pE=class{captures;variables;constructor(e,t){this.captures=e,this.variables=[t]}dispose(){for(let e of this.variables)e.dispose()}apply(e){try{if(e.length<1)throw Error(`Invalid empty mapper function.`);for(let t of e.slice(0,-1)){let e=new YT(this).evaluateCopy(t);if(e.value instanceof bT){let t=wT(e.value);if(t){this.variables.push(t);continue}}this.variables.push(new jT(e))}return new YT(this).evaluateCopy(e[e.length-1])}finally{for(let e of this.variables)e.dispose()}}importStub(e){throw Error(`A mapper function cannot refer to exports.`)}importPromise(e){return this.importStub(e)}getExport(e){return e<0?this.captures[-e-1]:this.variables[e]}getPipeReadable(e){throw Error(`A mapper function cannot use pipe readables.`)}getLimits(){return FT}};function mE(e,t,n,r,i){let a=new pE(r,new jT(OT.deepCopyFrom(e,t,n)));try{return a.apply(i)}finally{a.dispose()}}uT.applyMap=(e,t,n,r,i)=>{try{let a;if(e instanceof xT)throw Error(`applyMap() can't be called on RpcPromise`);if(e instanceof Array){let t=[];try{for(let a of e)t.push(mE(a,e,n,r,i))}catch(e){for(let e of t)e.dispose();throw e}a=OT.fromArray(t)}else a=e==null?OT.fromAppReturn(e):mE(e,t,n,r,i);return new jT(a)}finally{for(let e of r)e.dispose()}};var hE=class e extends pT{state;static create(t){let n=t.getWriter();return new e({refcount:1,writer:n,closed:!1})}constructor(e,t){super(),this.state=e,t&&++e.refcount}getState(){if(this.state)return this.state;throw Error(`Attempted to use a WritableStreamStubHook after it was disposed.`)}call(e,t){try{let n=this.getState();if(e.length!==1||typeof e[0]!=`string`)throw Error(`WritableStream stub only supports direct method calls`);let r=e[0];if(r!==`write`&&r!==`close`&&r!==`abort`)throw Error(`Unknown WritableStream method: ${r}`);return(r===`close`||r===`abort`)&&(n.closed=!0),new PT((r===`write`?t.deliverStreamWrite(n.writer):t.deliverCall(n.writer[r],n.writer)).then(e=>new jT(e)))}catch(e){return t.dispose(),new mT(e)}}map(e,t,n){for(let e of t)e.dispose();return new mT(Error(`Cannot use map() on a WritableStream`))}get(e){return new mT(Error(`Cannot access properties on a WritableStream stub`))}dup(){let t=this.getState();return new e(t,this)}pull(){return Promise.reject(Error(`Cannot pull a WritableStream stub`))}ignoreUnhandledRejections(){}dispose(){let e=this.state;this.state=void 0,e&&--e.refcount===0&&(e.closed||e.writer.abort(Error(`WritableStream RPC stub was disposed without calling close()`)).catch(()=>{}),e.writer.releaseLock())}onBroken(e){this.getState().writer.closed.then(void 0,e)}},gE=262144,_E=1073741824,vE=65536,yE=2,bE=1.25,xE=.9,SE=3,CE=class{now;window=gE;bytesInFlight=0;inStartupPhase=!0;delivered=0;deliveredTime=0;firstAckTime=0;firstAckDelivered=0;minRtt=1/0;roundsWithoutIncrease=0;lastRoundWindow=0;roundStartTime=0;constructor(e){this.now=e}onSend(e){this.bytesInFlight+=e;let t={sentTime:this.now(),size:e,deliveredAtSend:this.delivered,deliveredTimeAtSend:this.deliveredTime,windowAtSend:this.window,windowFullAtSend:this.bytesInFlight>=this.window};return{token:t,shouldBlock:t.windowFullAtSend}}onError(e){this.bytesInFlight-=e.size}onAck(e){let t=this.now();this.delivered+=e.size,this.deliveredTime=t,this.bytesInFlight-=e.size;let n=t-e.sentTime;if(this.minRtt=Math.min(this.minRtt,n),this.firstAckTime===0)this.firstAckTime=t,this.firstAckDelivered=this.delivered;else{let n,r;e.deliveredTimeAtSend===0?(n=this.firstAckTime,r=this.firstAckDelivered):(n=e.deliveredTimeAtSend,r=e.deliveredAtSend);let i=t-n,a=(this.delivered-r)/i,o=this.inStartupPhase?yE:bE,s=a*this.minRtt*o;s=Math.min(s,e.windowAtSend*o),s=e.windowFullAtSend?Math.max(s,e.windowAtSend*xE):Math.max(s,this.window),this.window=Math.max(Math.min(s,_E),vE),this.inStartupPhase&&e.sentTime>=this.roundStartTime&&(this.window>this.lastRoundWindow*bE?this.roundsWithoutIncrease=0:++this.roundsWithoutIncrease>=SE&&(this.inStartupPhase=!1),this.roundStartTime=t,this.lastRoundWindow=this.window)}return this.bytesInFlight<this.window}};function wE(e){let t,n=!1,r=new CE(()=>performance.now()),i,a,o=()=>{n||(n=!0,e.dispose())};return new WritableStream({start(n){e.onBroken(e=>{t===void 0&&(t=e,n.error(e),o()),a&&=(a(e),i=void 0,void 0)})},write(n,s){if(t!==void 0)throw t;let c=OT.fromAppParams([n]),{promise:l,size:u}=e.stream([`write`],c);if(u===void 0)return l.catch(e=>{throw t===void 0&&(t=e),e});{let{token:e,shouldBlock:n}=r.onSend(u);if(l.then(()=>{r.onAck(e)&&i&&(i(),i=void 0,a=void 0)},n=>{r.onError(e),t===void 0&&(t=n,s.error(n),o()),a&&=(a(n),i=void 0,void 0)}),n)return new Promise((e,t)=>{i=e,a=t})}},async close(){if(t!==void 0)throw o(),t;let{promise:n}=e.stream([`close`],OT.fromAppParams([]));try{await n}catch(e){throw t??e}finally{o()}},abort(n){if(t!==void 0)return;t=n??Error(`WritableStream was aborted`),a&&=(a(t),i=void 0,void 0);let{promise:r}=e.stream([`abort`],OT.fromAppParams([n]));r.then(()=>o(),()=>o())}})}var TE=class e extends pT{state;static create(t){return new e({refcount:1,stream:t,canceled:!1})}constructor(e,t){super(),this.state=e,t&&++e.refcount}call(e,t){return t.dispose(),new mT(Error(`Cannot call methods on a ReadableStream stub`))}map(e,t,n){for(let e of t)e.dispose();return new mT(Error(`Cannot use map() on a ReadableStream`))}get(e){return new mT(Error(`Cannot access properties on a ReadableStream stub`))}dup(){let t=this.state;if(!t)throw Error(`Attempted to dup a ReadableStreamStubHook after it was disposed.`);return new e(t,this)}pull(){return Promise.reject(Error(`Cannot pull a ReadableStream stub`))}ignoreUnhandledRejections(){}dispose(){let e=this.state;this.state=void 0,e&&--e.refcount===0&&(e.canceled||(e.canceled=!0,e.stream.locked||e.stream.cancel(Error(`ReadableStream RPC stub was disposed without being consumed`)).catch(()=>{})))}onBroken(e){}};fT.createWritableStreamHook=hE.create,fT.createWritableStreamFromHook=wE,fT.createReadableStreamHook=TE.create;var EE=bT,DE=aT,OE=sE;function kE(e){return e<32||e>=127&&e<=159||e===1564||e>=8203&&e<=8207||e===8232||e===8233||e>=8234&&e<=8238||e>=8294&&e<=8297||e===65279}function AE(e,t=80){let n=``;for(let t=0;t<e.length;t+=1){let r=e.charCodeAt(t);n+=kE(r)?` `:e.charAt(t)}return n=n.replace(/\s+/gu,` `).trim(),n.length<=t?n:`${n.slice(0,Math.max(0,t-1)).trimEnd()}…`}function jE(e,t){let n=e.find(e=>e.id===t.itemId);if(n===void 0||n.kind===`text`)return!1;if(n.kind===`menu`){let e=n.options.find(e=>e.id===t.optionId);return e!==void 0&&e.disabled!==!0}return t.optionId===void 0?n.kind!==`button`||n.disabled!==!0:!1}Object.freeze({publish:()=>Promise.resolve(),onBack:()=>()=>void 0,onForward:()=>()=>void 0,onActivate:()=>()=>void 0});function ME(e,t){if(t.kind===`action`){let n=[...e.primary??[],...e.menu??[]].find(e=>e.id===t.actionId);return n!==void 0&&n.disabled!==!0}let n=e.crumbs?.find(e=>e.id===t.crumbId);return n===void 0?!1:t.siblingId===void 0||n.siblings?.some(e=>e.id===t.siblingId)===!0}function NE(e){let t=e.trim().toLowerCase();if(!t)throw Error(`Invalid keymap token: token cannot be empty`);return t}function PE(e){let t=e.trim().toLowerCase();if(!t)throw Error(`Invalid key name: key name cannot be empty`);return t}function FE(e){return{name:PE(e.name),ctrl:e.ctrl??!1,shift:e.shift??!1,meta:e.meta??!1,super:e.super??!1,hyper:e.hyper||void 0}}function IE(e){return{name:e.name,ctrl:e.ctrl,shift:e.shift,meta:e.meta,super:e.super,hyper:e.hyper||void 0}}function LE(e,t){let n=IE(FE(e));return{stroke:n,display:t?.display??GE(n),match:t?.match??VE(n),tokenName:t?.tokenName?NE(t.tokenName):void 0}}function RE(e){return{stroke:IE(e.stroke),display:e.display,match:e.match,tokenName:e.tokenName,patternName:e.patternName,payloadKey:e.payloadKey}}function zE(e){return e.map(e=>RE(e))}function BE(e){return`match`in e?e.match:`stroke`in e?VE(e.stroke):VE(e)}function VE(e){return`key:${KE(FE(e))}`}function HE(e){let t=e.trim();if(!t)throw Error(`Invalid keymap match id: id cannot be empty`);return`text:${t}`}function UE(e,t){return`stroke`in e?t?.preferDisplay&&e.display?e.display:GE(e.stroke):GE(FE(e))}function WE(e,t){return e.map(e=>UE(e,t)).join(t?.separator??``)}function GE(e){let t=[];return e.ctrl&&t.push(`ctrl`),e.shift&&t.push(`shift`),e.meta&&t.push(`meta`),e.super&&t.push(`super`),e.hyper&&t.push(`hyper`),t.push(e.name===`return`?`enter`:e.name),t.join(`+`)}function KE(e){return`${e.name}:${+!!e.ctrl}:${+!!e.shift}:${+!!e.meta}:${+!!e.super}:${+!!e.hyper}`}var qE=Symbol(`keymap-extension-context`);function JE(e){return e.isDestroyed?null:e.getFocusedTarget()}function YE(e,t,n){let r=t??e.rootTarget,i=t!==null;for(;r;){if(n(r,i)===!1)return;r=e.getParentTarget(r),i=!1}}function XE(e,t){let n=new Set;return YE(e,t,e=>{n.add(e)}),n}function ZE(e,t,n){let r=[],i=XE(t,n),a=Array.isArray(e)?e:QE(e);for(let e of a)$E(t,e,n,i)&&r.push(e);return r}function QE(e){return[...e].sort((e,t)=>t.priority-e.priority||t.order-e.order)}function $E(e,t,n,r=XE(e,n)){let i=t.target;return i?e.isTargetDestroyed(i)?!1:t.targetMode===`focus`?i===n:r.has(i):!0}function eD(e){let t=e.binding.sequence[e.index];if(!t?.patternName)return 0;let n=e.patterns?.at(-1);return n?.name===t.patternName?n.values.length:0}function tD(e,t,n=!0){let r=e.binding.sequence[e.index];if(!r?.patternName)return!0;let i=t.get(r.patternName);return i?eD(e)>=i.min:n}function nD(e,t,n=!0){let r=e.binding.sequence[e.index];if(r?.patternName){let n=t.get(r.patternName);if(n&&eD(e)<n.max)return!0}return tD(e,t,n)&&e.index+1<e.binding.sequence.length}function rD(e,t){return e.index===e.binding.sequence.length-1&&tD(e,t,!1)}function iD(e,t,n,r){return{parent:e,depth:e?e.depth+1:0,stroke:t,match:n,pattern:r,children:new Map,patternChildren:[],bindings:[],reachableBindings:[]}}function aD(e,t){let n=iD(null,null,null);for(let r of e){if(r.event!==`press`)continue;let e=n;for(let n of r.sequence){let i;if(n.patternName){let r=t.get(n.patternName);i=e.patternChildren.find(e=>e.pattern?.name===n.patternName),i||(i=iD(e,n.stroke,n.match,r),e.patternChildren.push(i))}else i=e.children.get(n.match),i||(i=iD(e,n.stroke,n.match),e.children.set(n.match,i));i.reachableBindings.push(r),e=i}e.bindings.push(r)}return n}function oD(e,t){let n=[];for(let r of e){if(!tD(r,t))continue;let e=r.index+1,i=r.binding.sequence[e];i&&n.push({part:i,binding:r.binding,index:e,exact:e===r.binding.sequence.length-1,continues:e<r.binding.sequence.length-1})}return n}function sD(e,t,n,r){let i=n.patternName;if(!i)return{...e,index:t};let a=[...e.patterns??[]],o=a.at(-1);return o?.name===i?a[a.length-1]={...o,values:[...o.values,r],parts:[...o.parts,n]}:a.push({name:i,payloadKey:n.payloadKey??i,values:[r],parts:[n]}),{layer:e.layer,binding:e.binding,index:t,parts:[...e.parts,n],patterns:a}}function cD(e,t){let n=e.parts.at(-1);if(!n||n.patternName)return t.length;let r=t.indexOf(n.match);return r===-1?t.length:r}function lD(e,t,n,r,i,a,o,s,c){let l=t.sequence[n];if(l){if(l.patternName){let a=s(l.patternName,o);if(!a)return;let u=c(o,l.patternName,a);return sD({layer:e,binding:t,index:n,parts:r,patterns:i},n,u,a.value??o.name)}if(a.includes(l.match))return{layer:e,binding:t,index:n,parts:[...r,l],patterns:i}}}function uD(e,t,n,r,i,a){let o=e.binding.sequence[e.index];if(o?.patternName){let s=r.get(o.patternName);if(s&&eD(e)<s.max){let t=i(s.name,n);if(t){let r=a(n,s.name,t);return sD(e,e.index,r,t.value??n.name)}}return tD(e,r,!1)?lD(e.layer,e.binding,e.index+1,e.parts,e.patterns,t,n,i,a):void 0}return lD(e.layer,e.binding,e.index+1,e.parts,e.patterns,t,n,i,a)}function dD(e,t,n,r,i){let a=[],o=1/0;for(let s of e.bindings){if(s.event!==`press`)continue;let c=lD(e,s,0,[],void 0,t,n,r,i);if(!c)continue;let l=cD(c,t);l<o&&(o=l,a.length=0),l===o&&a.push(c)}return a}import.meta.require;function fD(e){let t=Object.create(null),n=(e,n)=>{let r=t[e];if(!r)return;let i=r.filter(e=>e!==n);i.length===0?delete t[e]:i.length!==r.length&&(t[e]=i)};return{hook(e,r){return t[e]=[...t[e]??[],r],()=>n(e,r)},has(e){return(t[e]?.length??0)>0},emit(n,...r){let i=t[n];if(i)for(let t of i)try{r.length===0?t():t(r[0])}catch(t){e(n,t)}}}}function pD(){let e=[];return{get:()=>e,set:t=>{e=t},remove(t){e=e.filter(e=>e!==t)},has:()=>e.length>0,clear:()=>{e=[]}}}function mD(){let e=pD();return{append(t){return e.set([...e.get(),t]),()=>e.remove(t)},prepend(t){return e.set([t,...e.get()]),()=>e.remove(t)},values:e.get,has:e.has,clear:e.clear}}function hD(){let e=pD(),t=0;return{register(n,r){let i={...r,listener:n,order:t++};return e.set([...e.get(),i].sort((e,t)=>t.priority-e.priority||e.order-t.order)),()=>e.remove(i)},entries:e.get,has:e.has,clear:e.clear}}function gD(e){return typeof e==`string`||!!e&&typeof e==`object`&&!Array.isArray(e)}function _D(e){if(!Array.isArray(e))return{ok:!1,reason:`Invalid keymap bindings: expected an array of binding objects`};for(let[t,n]of e.entries()){if(!n||typeof n!=`object`||Array.isArray(n))return{ok:!1,reason:`Invalid keymap binding at index ${t}: expected a binding object`};if(!gD(n.key))return{ok:!1,reason:`Invalid keymap binding at index ${t}: expected "key" to be a string or keystroke object`}}return{ok:!0}}function vD(e){let t=_D(e);if(!t.ok)throw Error(t.reason);return e.map(e=>({...e,key:typeof e.key==`string`?e.key:{...e.key}}))}function yD(e){return{...e,sequence:zE(e.sequence)}}function bD(e,t){let n=mD();return{prependLayerAnalyzer(e){return n.prepend(e)},appendLayerAnalyzer(e){return n.append(e)},clearLayerAnalyzers(){n.clear()},analyzeLayer(r){let i=n.values();if(i.length===0)return;let a=xD(r.bindings),o={target:r.target,order:r.order,sourceBindings:r.sourceBindings,bindings:a,hasTokenBindings:r.hasTokenBindings,checkCommandResolution(e){return t.getCommandResolutionStatus(e,r.commands)},warn(t,n,r){e.emitWarning(t,n,r)},warnOnce(t,n,r,i){e.warnOnce(t,n,r,i)},error(t,n,r){e.emitError(t,n,r)}};for(let t of i)try{t(o)}catch(t){e.emitError(`layer-analyzer-error`,t,`[Keymap] Error in layer analyzer:`)}}}}function xD(e){return e.map(t=>({sequence:zE(t.sequence),command:t.command,attrs:t.attrs,event:t.event,preventDefault:t.preventDefault,fallthrough:t.fallthrough,parsedBinding:yD(t.parsedBinding),sourceTarget:t.sourceTarget,sourceLayerOrder:t.sourceLayerOrder,bindingIndex:t.bindingIndex,hasCommandAtSequence:e.some(e=>e.event===`press`&&e.command!==void 0&&SD(e,t)),hasContinuations:e.some(e=>e.event===`press`&&CD(t,e))}))}function SD(e,t){return e.sequence.length===t.sequence.length&&e.sequence.every((e,n)=>e.match===t.sequence[n]?.match)}function CD(e,t){return e.sequence.length<t.sequence.length&&e.sequence.every((e,n)=>e.match===t.sequence[n]?.match)}function wD(){return{version:-1,notifyVersion:-1,focused:void 0,value:[],targets:new WeakMap}}function TD(){return{plain:wD(),bindings:wD(),metadata:wD(),bindingsAndMetadata:wD()}}function ED(e,t){if(t===void 0)return e.plain;let n=t.includeBindings===!0,r=t.includeMetadata===!0;return n?r?e.bindingsAndMetadata:e.bindings:r?e.metadata:e.plain}function DD(e,t,n){let r=n?e.targets.get(n):e.nullTarget;return r?.version===t?r:void 0}function OD(e,t,n,r){let i={version:t,value:r};n?e.targets.set(n,i):e.nullTarget=i}function kD(e,t){if(e===t)return!0;if(!e||!t||e.captures.length!==t.captures.length)return!1;for(let n=0;n<e.captures.length;n+=1){let r=e.captures[n],i=t.captures[n];if(!r||!i||r.layer!==i.layer||r.binding!==i.binding||r.index!==i.index||r.parts.length!==i.parts.length)return!1;for(let e=0;e<r.parts.length;e+=1)if(r.parts[e]?.match!==i.parts[e]?.match)return!1;let a=r.patterns??[],o=i.patterns??[];if(a.length!==o.length)return!1;for(let e=0;e<a.length;e+=1){let t=a[e],n=o[e];if(!t||!n||t.name!==n.name||t.values.length!==n.values.length)return!1;for(let e=0;e<t.values.length;e+=1)if(!Object.is(t.values[e],n.values[e]))return!1}}return!0}function AD(e){let t=e.parts.at(-1);if(!t||e.parts.length<=1)return;let n=e.index-1,r=e.patterns;if(t.patternName){let i=r?.at(-1);i?.name===t.patternName&&(i.values.length>1?(n=e.index,r=[...(r??[]).slice(0,-1),{...i,values:i.values.slice(0,-1),parts:i.parts.slice(0,-1)}]):r=(r??[]).slice(0,-1))}return{layer:e.layer,binding:e.binding,index:n,parts:e.parts.slice(0,-1),patterns:r}}function jD(e){let t=e.captures[0];if(!t||t.parts.length===0)return[];let n=[];for(let r=0;r<t.parts.length;r+=1){let i=t.parts[r];if(!i)continue;let a,o,s=!1,c=!1;for(let t of e.captures){let e=t.parts[r];if(e){if(a===void 0){a=e.display,o=e.tokenName;continue}!s&&a!==e.display&&(s=!0),!c&&o!==e.tokenName&&(c=!0)}}(a===void 0||s)&&(a=UE(i.stroke)),c&&(o=void 0),n.push(LE(i.stroke,{display:a,match:i.match,tokenName:o}))}return n}function MD(e){if(e.isDestroyed)throw Error(`Cannot use a keymap after its host was destroyed`);return e}function ND(e,t,n,r,i,a,o={}){let s=TD(),c=-1,l=[],u=()=>MD(t).getFocusedTarget(),d=()=>JE(t),f=t=>{let n=e.pending;kD(n,t)||(e.pending=t,o.onPendingSequenceChanged?.(n,t),V(),r.queueStateChange())},p=()=>{let t=e.pending;if(!t)return;let n=u(),r=a.getActiveCommandView(n),o=t.captures.filter(t=>e.layers.has(t.layer)&&C(t.layer,n)&&i.matchesConditions(t.layer)&&D(t.binding,n,r)&&nD(t,e.patterns));if(o.length===0){f(null);return}return o.length!==t.captures.length&&f({captures:o}),e.pending??void 0},m=()=>{t.isDestroyed||!e.pending||p()},h=()=>!t.isDestroyed&&e.pending!==null,g=()=>{if(c===e.cacheVersion)return l;let t=p(),n=t?jD(t):[];return(!t||T())&&(c=e.cacheVersion,l=n),n},_=()=>{let e=p();if(!e)return!1;let t=e.captures[0];if(!t||t.parts.length<=1)return f(null),!0;let n=[];for(let t of e.captures){let e=AD(t);e&&n.push(e)}return n.length===0?(f(null),!0):(f({captures:n}),!0)},v=t=>{let n=t?.includeBindings===!0,r=t?.includeMetadata===!0,i=ED(s,t);return i.notifyVersion===e.derivedVersion?i.value:y(i,n,r)},y=(n,r,i)=>{t.isDestroyed&&MD(t);let o=u(),s=DD(n,e.cacheVersion,o);if(s)return n.notifyVersion=e.derivedVersion,n.version=e.cacheVersion,n.focused=o,n.value=s.value,s.value;let c=a.getActiveCommandView(o),l=p(),d=l?[]:S(o),f=l?F(l.captures,r,i,o,c):j(d,r,i,o,c);return(l?T():w(d))&&(n.version=e.cacheVersion,n.notifyVersion=e.derivedVersion,n.focused=o,n.value=f,OD(n,e.cacheVersion,o,f)),f},b=(e,t)=>{let n=t?.includeBindings===!0,r=t?.includeMetadata===!0,i=u(),o=a.getActiveCommandView(i);return F(e,n,r,i,o)},x=(e,t)=>{let n=t?.includeBindings===!0,r=t?.includeMetadata===!0,i=e===d()?p():void 0,o=a.getActiveCommandView(e);return i?F(i.captures,n,r,e,o):j(S(e),n,r,e,o)},S=n=>e.activeLayersCacheVersion===e.cacheVersion&&e.activeLayersCacheFocused===n?e.activeLayersCache:(e.activeLayersCacheVersion=e.cacheVersion,e.activeLayersCacheFocused=n,e.activeLayersCache=ZE(e.sortedLayers,t,n),e.activeLayersCache),C=(e,n)=>$E(t,e,n),w=t=>!e.commandResolvers.has()&&e.activeKeyCacheBlockers===0,T=()=>!e.commandResolvers.has()&&e.activeKeyCacheBlockers===0,E=(e,t,n)=>{let r=[];for(let o of e)i.matchesConditions(o)&&a.isBindingVisible(o,t,n)&&r.push(o);return r},D=(e,t,n)=>i.matchesConditions(e)&&a.isBindingVisible(e,t,n),O=(e,t)=>{let n,r,i=!1,a=!1;for(let o of e){let e=o.sequence[t];if(e){if(n===void 0){n=e.display,r=e.tokenName;continue}!i&&n!==e.display&&(i=!0),!a&&r!==e.tokenName&&(a=!0)}}if(n===void 0||i){let r=e[0]?.sequence[t]?.stroke;n=r?UE(r):``}return a&&(r=void 0),{display:n,tokenName:r}},k=(e,t,n)=>({sequence:e.sequence,command:e.command,commandAttrs:a.getBindingCommandAttrs(e,t,n),attrs:e.attrs,event:e.event,preventDefault:e.preventDefault,fallthrough:e.fallthrough}),A=(e,t,n)=>e.map(e=>k(e,t,n)),j=(e,t,n,r,a)=>{let o=new Map,s=new Set;for(let n of e)n.root.children.size===0&&n.root.patternChildren.length===0||!i.matchesConditions(n)||(M(n.root.children.values(),o,s,t,r,a),M(n.root.patternChildren,o,s,t,r,a));return R(o,t,n,r,a)},M=(e,t,n,r,i,a)=>{for(let o of e){let e=o.match;if(!e||n.has(e)||!o.stroke)continue;let s=N(o,r,i,a);if(!s)continue;let c=t.get(e);c?ne(c,s,r):t.set(e,B(o.stroke,s,r)),s.stop&&n.add(e)}},N=(e,t,n,r)=>{if(!(e.children.size>0||e.patternChildren.length>0)){let i=te(P(e)?E(e.bindings,n,r):e.bindings,n,r);if(!i)return;let a=O(i.bindings,e.depth-1);return{display:a.display,tokenName:a.tokenName,continues:!1,firstBinding:i.bindings[0],commandBinding:i.commandBinding,bindings:t?[...i.bindings]:void 0,stop:i.stop}}let i=E(e.reachableBindings,n,r);if(i.length===0)return;let a=te(e.bindings,n,r),o=O(i,e.depth-1);return{display:o.display,tokenName:o.tokenName,continues:!0,firstBinding:a?.bindings[0],commandBinding:a?.commandBinding,bindings:t&&a?[...a.bindings]:void 0,stop:!0}},P=t=>{if(e.commandResolvers.has())return!0;for(let e of t.bindings)if(e.matchers.length>0)return!0;return!1},F=(t,n,r,i,a)=>{let o=new Map,s=new Set;return I(oD(t,e.patterns),o,s,n,i,a),R(o,n,r,i,a)},I=(e,t,n,r,i,a)=>{let o=new Set;for(let s of e)o.has(s.part.match)||(o.add(s.part.match),L(s,e,t,n,r,i,a))},L=(e,t,n,r,i,a,o)=>{let s=e.part.match;if(r.has(s))return;let c=z(e,t,i,a,o);if(!c)return;let l=n.get(s);l?ne(l,c,i):n.set(s,B(e.part.stroke,c,i)),c.stop&&r.add(s)},R=(e,t,n,r,i)=>{let a=[];for(let o of e.values()){let e=re(o,t,n,r,i);e&&a.push(e)}return a},z=(e,t,n,r,i)=>{let a=t.filter(t=>t.part.match===e.part.match),o=a.filter(e=>e.exact).map(e=>e.binding),s=te(o,r,i),c=a.some(e=>e.continues);if(!c&&!s)return;let l=ee(a);return{display:l.display,tokenName:l.tokenName,continues:c,firstBinding:s?.bindings[0],commandBinding:s?.commandBinding,bindings:n&&s?[...s.bindings]:void 0,stop:c||s?.stop===!0}},ee=e=>{let t,n,r=!1,i=!1;for(let a of e){let e=a.part;if(t===void 0){t=e.display,n=e.tokenName;continue}!r&&t!==e.display&&(r=!0),!i&&n!==e.tokenName&&(i=!0)}let a=e[0]?.part;return(t===void 0||r)&&(t=a?UE(a.stroke):``),i&&(n=void 0),{display:t,tokenName:n}},te=(e,t,n)=>{let r=[],o;for(let s of e)if(!(!i.matchesConditions(s)||!a.isBindingVisible(s,t,n))&&(r.push(s),s.command!==void 0&&(o??=s,!s.fallthrough)))return{bindings:r,commandBinding:o,stop:!0};if(r.length!==0)return{bindings:r,commandBinding:o,stop:!1}},B=(e,t,n)=>({stroke:e,display:t.display,tokenName:t.tokenName,continues:t.continues,firstBinding:t.firstBinding,commandBinding:t.commandBinding,bindings:n&&t.bindings?[...t.bindings]:void 0}),ne=(e,t,n)=>{if(!e.firstBinding&&t.firstBinding&&(e.firstBinding=t.firstBinding),!e.commandBinding&&t.commandBinding&&(e.commandBinding=t.commandBinding),t.continues&&(e.continues=!0),!(!n||!t.bindings||t.bindings.length===0)){if(!e.bindings){e.bindings=[...t.bindings];return}e.bindings.push(...t.bindings)}},re=(e,t,n,r,i)=>{if(!e.commandBinding&&!e.continues)return;let o={stroke:IE(e.stroke),display:e.display,continues:e.continues};if(e.tokenName&&(o.tokenName=e.tokenName),e.commandBinding&&(o.command=e.commandBinding.command),t&&e.bindings&&e.bindings.length>0&&(o.bindings=e.bindings.length===1?[k(e.bindings[0],r,i)]:A(e.bindings,r,i)),n){e.firstBinding?.attrs&&(o.bindingAttrs=e.firstBinding.attrs);let t=e.commandBinding?a.getBindingCommandAttrs(e.commandBinding,r,i):void 0;t&&(o.commandAttrs=t)}return o},V=()=>{n.has(`pendingSequence`)&&n.emit(`pendingSequence`,e.pending?jD(e.pending):[])};return{getFocusedTarget:u,getFocusedTargetIfAvailable:d,setPendingSequence:f,ensureValidPendingSequence:p,revalidatePendingSequenceIfNeeded:m,hasPendingSequenceState:h,getPendingSequence:g,popPendingSequence:_,getActiveKeys:v,getActiveKeysForCaptures:b,getActiveKeysForFocused:x,getActiveLayers:S,isLayerActiveForFocused:C,collectSequencePartsFromPending:jD,collectMatchingBindings:E,collectActiveBindings:A}}var PD=new Set([`name`,`run`,`fields`,`attrs`,`rejectedResult`]),FD=new Set([`key`,`cmd`,`event`,`preventDefault`,`fallthrough`]),ID=new Set([`target`,`targetMode`,`priority`,`bindings`,`commands`]);function LD(e){if(e===void 0||typeof e==`function`)return e;let t=e.trim();if(!t)throw Error(`Invalid keymap command: command cannot be empty`);return t}function RD(e){let t=e.trim();if(!t)throw Error(`Invalid keymap command name: name cannot be empty`);if(/\s/.test(t))throw Error(`Invalid keymap command name "${e}": command names cannot contain whitespace`);return t}function zD(e,t,n){let r=e.get(t);r?r.push(n):e.set(t,[n])}function BD(e){let t=[],n=new Map;for(let r of e.layers)for(let e of r.commands){let i={layer:r,commandState:e};t.push(i),zD(n,e.command.name,i)}return{entries:t,chainsByName:n}}function VD(e,t,n){let r=[],i=[],a=new Map,o=new Map;for(let s of e)if(s.commands.length!==0&&!(n&&!t.matchesConditions(s)))for(let e of s.commands){if(!t.matchesConditions(e))continue;let n={layer:s,commandState:e};r.push(n),zD(o,e.command.name,n),a.has(e.command.name)||(a.set(e.command.name,n),i.push(n))}return{layers:e,entries:r,reachable:i,reachableByName:a,chainsByName:o}}function HD(e,t,n,r){return(e.activeLayersCacheVersion!==e.cacheVersion||e.activeLayersCacheFocused!==r)&&(e.activeLayersCacheVersion=e.cacheVersion,e.activeLayersCacheFocused=r,e.activeLayersCache=ZE(e.sortedLayers,t,r)),VD(e.activeLayersCache,n,!0)}function UD(e,t,n,r){if(Object.prototype.hasOwnProperty.call(e,t)&&!Object.is(e[t],n))throw Error(`Conflicting keymap requirement for "${t}" from ${r}`);e[t]=n}function WD(e,t,n,r){if(Object.prototype.hasOwnProperty.call(e,t)&&!Object.is(e[t],n))throw Error(`Conflicting keymap attribute for "${t}" from ${r}`);e[t]=n}function GD(e){let t=`field ${e.fieldName}`;return{require(n,r){UD(e.requirements,n,r,t)},attr(n,r){if(!e.attrs)throw Error(`Keymap ${t} cannot publish attrs`);WD(e.attrs,n,r,t)},activeWhen(n){e.matchers.push(e.conditions.buildRuntimeMatcher(n,t))}}}function KD(e){let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}function qD(e,t){return e instanceof Error&&e.message?e.message:t}function JD(e){return!e||typeof e!=`object`&&typeof e!=`function`?!1:typeof e.then==`function`}function YD(e,t){let n=t?.deep===!0,r=t?.freeze===!0,i=t?.preserveNonPlainObjects===!0;if(Array.isArray(e)){let i=n?e.map(e=>YD(e,t)):[...e];return r?Object.freeze(i):i}if(e&&typeof e==`object`){if(i&&!KD(e))return e;let a={};for(let[r,i]of Object.entries(e))a[r]=n?YD(i,t):i;return r?Object.freeze(a):a}return e}var XD=[`name`],ZD=Object.freeze({}),QD=new WeakMap;function $D(e,t,n,r,i){let a=-1,o,s=-1,c,l,u=-1,d,f,p=-1,m,h=-1,g=new Map,_=t=>tO({commands:t,commandFields:e.commandFields,conditions:r,onError:(e,t,r)=>{n.emitError(e,t,r)}}),v=t=>R(()=>e.commandResolvers.prepend(t),t),y=t=>R(()=>e.commandResolvers.append(t),t),b=()=>{e.commandResolvers.has()&&n.runWithStateChangeBatch(()=>{e.commandResolvers.clear(),i.onCommandResolversChanged(),n.queueStateChange()})},x=e=>ie(e).map(e=>eO(e.commandState)),S=e=>{let t=H(e),n=ie(e,t);if(n.length===0)return[];let r=n.map(e=>({entry:e,command:eO(e.commandState),commandAttrs:e.commandState.attrs,bindings:[]})),i=new Map;for(let[e,t]of r.entries()){let n=i.get(t.command.name);n?n.push(e):i.set(t.command.name,[e])}return i.size>0&&ae(r,i,t),r.map(e=>({command:e.command,bindings:e.bindings}))},C=t=>{if(t.visibility===`registered`&&u===e.derivedVersion&&d===t.commands&&f)return f;let n=new Map;for(let e of t.commands)n.has(e)||n.set(e,[]);return n.size===0?n:(oe(n,H(t)),t.visibility===`registered`&&(u=e.derivedVersion,d=t.commands,f=n),n)},w=(e,t,n)=>{let r=M(t);if(n){let i=[],a=r.chainsByName.get(e);if(a)for(let e of a)i.push({target:e.layer.target,command:e.commandState.command,attrs:e.commandState.attrs,payload:n.payload});let o=fe(e,t,{mode:`active`,execution:n});return o.resolved&&i.push(o.resolved),{entries:i.length>0?i:void 0,hadError:o.hadError}}let i=[];for(let t of r.chainsByName.get(e)??[])i.push({target:t.layer.target,command:t.commandState.command,attrs:t.commandState.attrs});let a=fe(e,t,{mode:`active`});return a.resolved&&i.push(a.resolved),{entries:i.length>0?i:void 0,hadError:a.hadError}},T=t=>{if(h!==e.derivedVersion&&(h=e.derivedVersion,g=new Map),g.has(t))return g.get(t)??void 0;let n=B(te(t));return g.set(t,n??null),n},E=(e,t)=>B(M(t).chainsByName.get(e)),D=(e,t)=>fe(e,null,{mode:`registered`,execution:t}),O=(e,t,n)=>fe(e,t,{mode:`active`,execution:n}),k=(e,t)=>z(e,t)?.command,A=e=>ee(e)?.commandState.command,j=(e,n,i)=>{let a=N().chainsByName.get(e);if(!a||a.length===0)return;let o,s;for(let e of a){if(!$E(t,e.layer,n)){o??=e;continue}(!r.matchesConditions(e.layer)||!r.matchesConditions(e.commandState))&&(s??=e)}let c=s??o;if(c)return{reason:s?`disabled`:`inactive`,command:i?c.commandState.command:void 0}},M=n=>{if(s===e.derivedVersion&&c===n&&l)return l;let i=HD(e,t,r,n);return P()&&(s=e.derivedVersion,c=n,l=i),i},N=()=>a===e.derivedVersion&&o?o:(a=e.derivedVersion,o=BD(e),o),P=()=>e.activeCommandViewCacheBlockers===0,F=(e,t,n)=>e.command===void 0||e.run?!0:typeof e.command==`string`?n.reachableByName.has(e.command)?!0:ne(e.command,t,`active`)!==void 0:!1,I=(e,t,n)=>{if(typeof e.command!=`string`)return;let r=n.reachableByName.get(e.command);return r?r.commandState.attrs:ne(e.command,t,`active`)?.attrs},L=(e,n)=>{if(n?.some(t=>t.command.name===e)||N().chainsByName.has(e))return`resolved`;let r=fe(e,JE(t));return r.resolved||r.hadError?r.resolved?`resolved`:`error`:`unresolved`},R=(t,r)=>n.runWithStateChangeBatch(()=>{let a=t();return i.onCommandResolversChanged(),n.queueStateChange(),()=>{n.runWithStateChangeBatch(()=>{a(),!e.commandResolvers.values().includes(r)&&(i.onCommandResolversChanged(),n.queueStateChange())})}}),z=(e,t)=>{let n=M(t).reachableByName.get(e);return n?{target:n.layer.target,command:n.commandState.command,attrs:n.commandState.attrs}:ne(e,t,`active`)},ee=e=>te(e)?.[0],te=t=>{let n=[];for(let r of e.sortedLayers)for(let e of r.commands)e.command.name===t&&n.push({layer:r,commandState:e});return n.length>0?n:void 0},B=e=>{if(e?.length)return e.map(e=>({target:e.layer.target,command:e.commandState.command,attrs:e.commandState.attrs}))},ne=(e,t,n)=>fe(e,t,{mode:n}).resolved,re=()=>N().entries,V=()=>{if(p===e.derivedVersion&&m)return m;let t=new Map;for(let n of e.layers)for(let e of n.bindings){if(typeof e.command!=`string`)continue;let n=t.get(e.command);n?n.push(e):t.set(e.command,[e])}return p=e.derivedVersion,m=t,t},H=e=>{let n=e?.visibility??`reachable`,r=e&&Object.prototype.hasOwnProperty.call(e,`focused`)?e.focused??null:JE(t);return n===`registered`?{visibility:n,focused:r}:{visibility:n,focused:r,activeView:M(r)}},ie=(e,t=H(e))=>{let r;return r=t.visibility===`registered`?re():t.visibility===`active`?t.activeView?.entries??[]:t.activeView?.reachable??[],oO({entries:r,query:e,getCommand:e=>eO(e),onFilterError:e=>{n.emitError(`command-query-filter-error`,e,`[Keymap] Error in command query filter:`)}})},ae=(e,t,n)=>{se(n,n=>{ce(e,t,n)})},oe=(e,t)=>{if(t.visibility===`registered`){let t=V();for(let[n,r]of e){let e=N().chainsByName.get(n)?.[0]?.commandState.attrs;for(let i of t.get(n)??[])r.push(ue(i,e))}return}se(t,n=>{le(e,n,t)})},se=(t,n)=>{if(t.visibility===`registered`){for(let t of e.layers)for(let e of t.bindings)n(e);return}let i=t.activeView;if(i){for(let e of i.layers)if(!(e.bindings.length===0||!r.matchesConditions(e)))for(let a of e.bindings)r.matchesConditions(a)&&F(a,t.focused,i)&&n(a)}},ce=(e,t,n)=>{if(typeof n.command!=`string`)return;let r=t.get(n.command);if(!(!r||r.length===0))for(let t of r){let r=e[t];r&&r.bindings.push(ue(n,r.commandAttrs))}},le=(e,t,n)=>{if(typeof t.command!=`string`)return;let r=e.get(t.command);r&&r.push(ue(t,de(t,n)))},ue=(e,t)=>({sequence:e.sequence,command:e.command,commandAttrs:t,attrs:e.attrs,event:e.event,preventDefault:e.preventDefault,fallthrough:e.fallthrough}),de=(e,t)=>{if(typeof e.command!=`string`)return;if(t.visibility===`registered`)return N().chainsByName.get(e.command)?.[0]?.commandState.attrs;let n=t.activeView;if(n)return I(e,t.focused,n)},fe=(t,r,i)=>{let a=i?.mode??`active`,o=i?.execution??{input:t},s=nO(t,e.commandResolvers.values(),()=>he(r,a,o),e=>{n.emitError(`command-resolver-error`,e,`[Keymap] Error in command resolver for "${t}":`)}),c=s.resolved;if(c){let e=me(c.command.name,r,a);e?.commandState.command===c.command&&c.target===void 0&&(c={...c,target:e.layer.target},s.resolved=c)}if(c&&!c.attrs){let e=pe(c.command.name,r,a)??aO(c.command);e&&(s.resolved={...c,attrs:e})}return s},pe=(e,t,n)=>n===`registered`?ee(e)?.commandState.attrs:M(t).reachableByName.get(e)?.commandState.attrs,me=(e,t,n)=>n===`registered`?ee(e):M(t).reachableByName.get(e),he=(e,t,n)=>{let r=n.input,i=n.payload;return{context:{get input(){return r},get payload(){return i},setInput(e){r=e},setPayload(e){i=e},getCommand:n=>t===`registered`?A(n):k(n,e)},getExecutionFields(){return{input:r,payload:i}}}};return{normalizeCommands:_,prependCommandResolver:v,appendCommandResolver:y,clearCommandResolvers:b,getCommands:x,getCommandEntries:S,getCommandBindings:C,getResolvedCommandChain:w,getRegisteredResolvedEntries:T,getActiveRegisteredResolvedEntries:E,resolveRegisteredResolverFallback:D,resolveActiveResolverFallback:O,getTopCommand:k,getDispatchUnavailableCommandState:j,getActiveCommandView:M,isBindingVisible:F,getBindingCommandAttrs:I,getCommandResolutionStatus:L}}function eO(e){return e.command}function tO(e){let t=[],n=new Set;for(let r of e.commands)try{let i={},a=[],o=RD(r.name),s=rO(r),c={};if(n.has(o)){e.onError(`duplicate-command`,{command:o},`Duplicate keymap command "${o}" in the same layer`);continue}r.name=o;for(let[t,n]of Object.entries(s)){if(n===void 0)continue;let r=e.commandFields.get(t);r&&r(n,GD({fieldName:t,conditions:e.conditions,requirements:i,matchers:a,attrs:c}))}let l={command:r,fields:s,attrs:Object.keys(c).length===0?void 0:c,requires:Object.entries(i),matchers:a};n.add(l.command.name),t.push(l)}catch(t){e.onError(`register-command-failed`,t,qD(t,`Failed to register keymap command "${String(r.name)}"`));continue}return t}function nO(e,t,n,r){if(t.length===0)return{hadError:!1};let i=!1;for(let a of t){let t,o=n();try{t=a(e,o.context)}catch(e){i=!0,r(e);continue}if(t)return{hadError:i,resolved:iO(t,o.getExecutionFields())}}return{hadError:i}}function rO(e){let t={};for(let[n,r]of Object.entries(e))!PD.has(n)&&r!==void 0&&(t[n]=r);return Object.keys(t).length===0?ZD:t}function iO(e,t){return{command:e,input:t.input,payload:t.payload}}function aO(e){let t=rO(e);return t===ZD?void 0:t}function oO(e){let t=e.query?.namespace,n=sO(e.query?.limit);if(n===0)return[];let r=e.query?.search?.trim().toLowerCase()??``,i=XD;e.query?.searchIn&&e.query.searchIn.length>0&&(i=e.query.searchIn);let a=e.query?.filter,o,s,c;if(typeof a==`function`)s=a;else if(a){let e=Object.entries(a),t=[];for(let[n,r]of e){if(n===`name`){if(typeof r==`string`){c=new Set([r]);continue}if(Array.isArray(r)){let e=new Set;for(let t of r)typeof t==`string`&&e.add(t);c=e;continue}}t.push([n,r])}o=t.length>0?t:void 0}let l=[];for(let a of e.entries){let u=a.commandState;if(lO(u,t)&&cO(u,r,i)&&!(c&&!c.has(u.command.name))&&uO(u,o,e)){if(s){let t=!1;try{t=s(e.getCommand(u))}catch(t){e.onFilterError(t);continue}if(!t)continue}if(l.push(a),n!==void 0&&l.length>=n)break}}return l}function sO(e){if(e===void 0)return;let t=Math.floor(Number(e));return!Number.isFinite(t)||t<=0?0:t}function cO(e,t,n){if(!t)return!0;for(let r of n)if(dO(e,r,t))return!0;return!1}function lO(e,t){if(t===void 0)return!0;let n=e.fields;return Object.prototype.hasOwnProperty.call(n,`namespace`)?vO(n.namespace,t):!1}function uO(e,t,n){if(!t)return!0;for(let[r,i]of t)if(!hO(e,r,i,n))return!1;return!0}function dO(e,t,n){return fO(e,t)?.includes(n)===!0}function fO(e,t){let n=QD.get(e);if(n||(n=new Map,QD.set(e,n)),n.has(t))return n.get(t);let r=e.fields,i=e.attrs,a;t===`name`?a=e.command.name:Object.prototype.hasOwnProperty.call(r,t)?a=r[t]:i&&Object.prototype.hasOwnProperty.call(i,t)&&(a=i[t]);let o=pO(a);return n.set(t,o),o}function pO(e){if(Array.isArray(e)){let t=[];for(let n of e){let e=pO(n);e!==void 0&&t.push(e)}return t.length>0?t.join(`\0`):void 0}if(typeof e==`string`)return e.toLowerCase();if(typeof e==`number`||typeof e==`boolean`||typeof e==`bigint`)return String(e).toLowerCase()}function mO(e,t,n,r){try{return e(t,n)}catch(e){return r(e),!1}}function hO(e,t,n,r){return typeof n==`function`?gO(e,t,n,r):_O(e,t,n)}function gO(e,t,n,r){let i=e.command,a=e.fields,o=e.attrs,s,c=!1,l=()=>s??=r.getCommand(e);return t===`name`&&(c=!0,mO(n,i.name,l(),r.onFilterError))||Object.prototype.hasOwnProperty.call(a,t)&&(c=!0,mO(n,a[t],l(),r.onFilterError))||o&&Object.prototype.hasOwnProperty.call(o,t)&&(c=!0,mO(n,o[t],l(),r.onFilterError))?!0:!c&&mO(n,void 0,l(),r.onFilterError)}function _O(e,t,n){let r=e.command,i=e.fields,a=e.attrs;return t===`name`&&vO(r.name,n)||Object.prototype.hasOwnProperty.call(i,t)&&vO(i[t],n)?!0:!!a&&Object.prototype.hasOwnProperty.call(a,t)&&vO(a[t],n)}function vO(e,t){return Array.isArray(t)?t.some(t=>yO(e,t)):yO(e,t)}function yO(e,t){return Array.isArray(e)?e.some(e=>yO(e,t)):Object.is(e,t)}function bO(e,t,n,r,i){let a=(e,t,n,r,a,o)=>({keymap:i.keymap,event:e,focused:t,target:n,data:r,input:a,payload:o}),o=(t,n,r,i)=>{let a=typeof n==`function`?void 0:n,o=typeof n==`function`?n:n.run,s=i?a:void 0,c;try{c=o(a?{...r,command:a}:r)}catch(n){return e.emitError(`command-execution-error`,n,`[Keymap] Error running command "${t}":`),{status:`error`,result:s?{ok:!1,reason:`error`,command:s}:{ok:!1,reason:`error`}}}if(JD(c))return c.catch(n=>{e.emitError(`async-command-error`,n,`[Keymap] Async error in command "${t}":`)}),{status:`handled`,result:s?{ok:!0,command:s}:{ok:!0}};if(xO(c)){let e=c;return(!c.ok&&c.reason!==`not-found`&&i&&a&&!c.command||c.ok&&i&&a&&!c.command)&&(e={...c,command:a}),{status:c.ok?`handled`:`rejected`,result:e}}return c===!1?{status:`rejected`,result:s?{ok:!1,reason:`rejected`,command:s}:{ok:!1,reason:`rejected`}}:{status:`handled`,result:s?{ok:!0,command:s}:{ok:!0}}},s=(e,t,n,r,i,s,c,l)=>{let u;for(let d of t??[]){let t=o(e,d.command,a(n,r,i??d.target??null,s,e,c),l);if(t.status===`handled`||t.status===`error`)return[t.result,u];u=t.result}return[void 0,u]},c=(e,c,l)=>{let u;try{u=LD(e)}catch{return{ok:!1,reason:`invalid-args`}}if(typeof u!=`string`)return{ok:!1,reason:`not-found`};let d=c?.includeCommand===!0,f=c?.focused??n.getFocusedTargetIfAvailable(),p=c?.event??i.createCommandEvent(),m=t.getReadonlyData(),h=c?.payload,g=l===`registered`?r.getRegisteredResolvedEntries(u):r.getActiveRegisteredResolvedEntries(u,f),[_,v]=s(u,g,p,f,c?.target,m,h,d);if(_)return _;let y=v,b=l===`registered`?r.resolveRegisteredResolverFallback(u,{input:u,payload:h}):r.resolveActiveResolverFallback(u,f,{input:u,payload:h});if(b.resolved){let e=o(u,b.resolved.command,a(p,f,c?.target??b.resolved.target??null,m,b.resolved.input??u,b.resolved.payload),d);if(e.status===`handled`||e.status===`error`)return e.result;y=e.result}if(b.hadError)return{ok:!1,reason:`error`};if(l===`active`){let e=r.getDispatchUnavailableCommandState(u,f,d);if(e)return e.command?{ok:!1,reason:e.reason,command:e.command}:{ok:!1,reason:e.reason}}return y??{ok:!1,reason:`not-found`}};return{runCommand(e,t){return c(e,t,`registered`)},dispatchCommand(e,t){return c(e,t,`active`)},runBinding(e,n,i,s,c){let l=t.getReadonlyData();if(n.run)return o(typeof n.command==`string`?n.command:`<function>`,n.run,a(i,s,e.target??null,l,typeof n.command==`string`?n.command:`<function>`,c),!1).status!==`rejected`&&(SO(n,i),!0);if(typeof n.command!=`string`)return!1;let u=r.getResolvedCommandChain(n.command,s,c===void 0?void 0:{input:n.command,payload:c}).entries;for(let t of u??[])if(o(n.command,t.command,a(i,s,t.target??e.target??null,l,t.input??n.command,t.payload),!1).status!==`rejected`)return SO(n,i),!0;return!1}}}function xO(e){return typeof e==`object`&&!!e&&`ok`in e}function SO(e,t){e.preventDefault&&(t.preventDefault(),t.stopPropagation())}var CO=Object.freeze({}),wO=[],TO=[];function EO(e){if(Object.keys(e).length!==0)return YD(e,{freeze:!0})}function DO(e,t,n,r){let i=t=>NO(t,e.bindingParsers.values(),{tokens:e.tokens,patterns:e.patterns,layer:CO,parseObjectKey:(e,t)=>c(e,t)}),a=t=>{if(typeof t!=`string`)return[c(t)];let n=MO(t,e.bindingParsers.values(),{tokens:e.tokens,patterns:e.patterns,layer:CO,parseObjectKey:(e,t)=>c(e,t)});for(let e of n.unknownTokens)r.warnUnknownToken(e,t);return n.unknownTokens.length>0?[]:n.parts},o=(e,t)=>WE(a(e),t),s=(i,a,o,s,d)=>{let f=[],p=!1,m=e.bindingExpanders.values(),h=e.bindingParsers.values(),g=e.bindingFields,_=e.disambiguationResolvers.has(),v=r.warnUnknownField,y=r.warnUnknownToken;for(let[r,b]of i.entries()){let i;try{i=AO(b.key,m,{layer:d})}catch(e){t.emitError(`binding-expand-error`,e,qD(e,`Failed to expand keymap binding`));continue}for(let m of i){let i=m.key,x;try{x=typeof i==`string`?MO(i,h,{tokens:a,patterns:e.patterns,layer:d,parseObjectKey:(e,t)=>c(e,t)}):{parts:[c(i)],usedTokens:[],unknownTokens:[],hasTokenBindings:!1},x=jO(x,m)}catch(e){t.emitError(`binding-parse-error`,e,qD(e,`Failed to parse keymap binding`));continue}let S=x.parts;p||=x.hasTokenBindings;for(let e of x.unknownTokens)y(e,typeof i==`string`?i:String(i.name));if(!(x.unknownTokens.length>0))for(let i of u(b,S,a,h,d))try{let t=l(i.event),a=i.sequence,c={},u={},d=[];for(let e in i){if(e===`sequence`||FD.has(e))continue;let t=i[e];if(t===void 0)continue;let r=g.get(e);if(!r){v(`binding`,e);continue}r(t,GD({fieldName:e,conditions:n,requirements:c,matchers:d,attrs:u}))}let p=Object.keys(u).length>0?EO(u):void 0,m=LD(i.cmd),h={binding:b,sequence:a,command:m,event:t,parsedBinding:yD(i),sourceTarget:o,sourceLayerOrder:s,bindingIndex:r,requires:Object.keys(c).length>0?Object.entries(c):wO,matchers:d.length>0?d:TO,preventDefault:i.preventDefault!==!1,fallthrough:i.fallthrough??!1};if(p&&(h.attrs=p),typeof m==`function`&&(h.run=m),a.length===0)continue;if(t===`release`&&a.length>1)throw Error(`Keymap release bindings only support a single key stroke`);let y=a.at(-1);if(y?.patternName){let t=e.patterns.get(y.patternName);if(t&&t.max!==t.min)throw Error(`Keymap unbounded sequence patterns must be followed by a concrete continuation`)}t===`press`&&!_&&kO(f,h),f.push(h)}catch(e){t.emitError(`binding-compile-error`,e,qD(e,`Failed to compile keymap binding`))}}}return{bindings:f,hasTokenBindings:p}},c=(e,t)=>LE(e,t),l=e=>{if(e===void 0||e===`press`)return`press`;if(e===`release`)return`release`;throw Error(`Invalid keymap binding event "${String(e)}": expected "press" or "release"`)},u=(n,r,i,a,o)=>{let s=e.bindingTransformers.values();if(s.length===0)return[{...n,sequence:zE(r)}];let l={...n,sequence:zE(r)},u=[],d=!0,f=o??CO;for(let n of s)try{n(l,{layer:f,parseKey:t=>NO(t,a,{tokens:i,patterns:e.patterns,layer:f,parseObjectKey:(e,t)=>c(e,t)}),add:e=>{u.push(yD(e))},skipOriginal:()=>{d=!1}})}catch(e){t.emitError(`binding-transformer-error`,e,`[Keymap] Error in binding transformer:`)}return d?u.length===0?[l]:[l,...u]:u};return{parseTokenKey:i,parseKeySequence:a,formatKey:o,compileBindings:s}}function OO(e,t){if(e.length>=t.length)return!1;for(let n=0;n<e.length;n+=1)if(e[n]?.match!==t[n]?.match)return!1;return!0}function kO(e,t){for(let n of e)if(n.event===`press`&&(n.command!==void 0&&OO(n.sequence,t.sequence)||t.command!==void 0&&OO(t.sequence,n.sequence)))throw Error(`Keymap bindings cannot use the same sequence as both an exact match and a prefix in the same layer`)}function AO(e,t,n){if(typeof e!=`string`||t.length===0)return[{key:e}];let r=n?.layer??CO,i=[{key:e}];for(let e of t){let t=[];for(let n of i){let i=e({input:n.key,displays:n.displays,layer:r});if(!i){t.push(n);continue}if(i.length===0)throw Error(`Keymap binding expander must return at least one key sequence for "${n.key}"`);for(let e of i){if(!e||typeof e!=`object`||Array.isArray(e)||typeof e.key!=`string`)throw Error(`Keymap binding expander must return expansion objects with string keys for "${n.key}"`);if(e.displays!==void 0){if(!Array.isArray(e.displays))throw Error(`Keymap binding expander displays must be an array of strings for "${n.key}"`);for(let t of e.displays)if(typeof t!=`string`)throw Error(`Keymap binding expander displays must be an array of strings for "${n.key}"`)}t.push(e)}}i=t}return i}function jO(e,t){if(!t.displays)return e;if(t.displays.length!==e.parts.length)throw Error(`Keymap binding expansion displays length must match parsed sequence length for "${String(t.key)}"`);return{...e,parts:e.parts.map((e,n)=>({...e,display:t.displays[n]}))}}function MO(e,t,n){if(e.length===0)throw Error(`Invalid key sequence: sequence cannot be empty`);if(t.length===0)throw Error(`No keymap binding parsers are registered`);let r=n.tokens??new Map,i=n.patterns??new Map,a=n.layer??CO,o=n.parseObjectKey,s=[],c=new Set,l=new Set,u=0;for(;u<e.length;){let n=!1;for(let d of t){let t=d({input:e,index:u,layer:a,tokens:r,patterns:i,normalizeTokenName:NE,createMatch:HE,parseObjectKey:o});if(t){if(t.nextIndex<=u||t.nextIndex>e.length)throw Error(`Keymap binding parser must advance the input for "${e}" at index ${u}`);s.push(...t.parts);for(let e of t.usedTokens??[])c.add(e);for(let e of t.unknownTokens??[])l.add(e);u=t.nextIndex,n=!0;break}}if(!n)throw Error(`No keymap binding parser handled input at index ${u} in "${e}"`)}return{parts:s,usedTokens:[...c],unknownTokens:[...l],hasTokenBindings:c.size>0||l.size>0}}function NO(e,t,n){if(typeof e!=`string`)return n.parseObjectKey(e);let{parts:r}=MO(e,t,n),[i]=r;if(!i||r.length!==1)throw Error(`Invalid key "${String(e)}": expected a single key stroke`);return i}function PO(e){if(!e||typeof e!=`object`)return!1;let t=e;return typeof t.get==`function`&&typeof t.subscribe==`function`}function FO(e,t){let n=e=>e.requires.length===0&&e.matchers.length===0,r=e=>{try{return e.match()}catch(n){return t.emitError(`runtime-matcher-error`,n,`[Keymap] Error evaluating runtime matcher from ${e.source}:`),!1}},i=e=>{if(e.matchers.length===0)return!0;if(e.matchers.length===1){let[t]=e.matchers;return!t||r(t)}for(let t of e.matchers)if(!r(t))return!1;return!0},a=t=>{if(t.length===0)return!0;for(let[n,r]of t)if(!Object.is(e.data[n],r))return!1;return!0};return{buildRuntimeMatcher(e,t){if(typeof e==`function`)return{source:t,match:e};if(PO(e))return{source:t,match:()=>e.get(),subscribe:t=>e.subscribe(t)};throw Error(`Keymap ${t} expected a function or a reactive matcher`)},matchesConditions:e=>n(e)||a(e.requires)&&i(e)}}var IO=Symbol(`keymap-disambiguation-decision`),LO=Symbol(`keymap-deferred-disambiguation-decision`);function RO(e,t){return{[IO]:!0,action:e,handler:t}}function zO(e){return{[LO]:!0,action:e}}function BO(e){return!!e&&typeof e==`object`&&e[IO]===!0}function VO(e){return!!e&&typeof e==`object`&&e[LO]===!0}function HO(e,t){return t.aborted?Promise.resolve(!1):new Promise(n=>{let r=setTimeout(()=>{t.removeEventListener(`abort`,i),n(!0)},Math.max(0,e)),i=()=>{clearTimeout(r),t.removeEventListener(`abort`,i),n(!1)};t.addEventListener(`abort`,i,{once:!0})})}function UO(e,t,n,r){let i=e.get(n);if(i)try{return i.matcher(r)}catch(e){t.emitError(`sequence-pattern-match-error`,e,`[Keymap] Error matching sequence pattern "${i.name}":`);return}}function WO(e,t,n,r){let i=e.get(n)?.payloadKey??n;return{...LE({name:t.name,ctrl:t.ctrl,shift:t.shift,meta:t.meta,super:t.super??!1,hyper:t.hyper||void 0},{display:r.display??String(r.value??t.name)}),patternName:n,payloadKey:i}}function GO(e,t,n){if(!n?.patterns||n.patterns.length===0)return;let r={},i=!1;for(let a of n.patterns){let n=e.get(a.name),o;try{o=n?.finalize?n.finalize(a.values):a.values.length===1?a.values[0]:[...a.values]}catch(e){t.emitError(`sequence-pattern-finalize-error`,e,`[Keymap] Error finalizing sequence pattern "${a.name}":`);continue}let s=r[a.payloadKey];s===void 0?(r[a.payloadKey]=o,i=!0):Array.isArray(s)?s.push(o):r[a.payloadKey]=[s,o]}return i?r:void 0}function KO(e,t,n,r,i,a,o,s,c,l){let u={resolveKey:e=>o.parseTokenKey(e).match},d=null,f=0;function p(t,n,r){if(t===`key`){let t=r;return e.keyHooks.register(n,{priority:t?.priority??0,release:t?.release??!1})}if(t===`key:after`){let t=r;return e.keyAfterHooks.register(n,{priority:t?.priority??0,release:t?.release??!1})}let i=r;return e.rawHooks.register(n,{priority:i?.priority??0})}function m(t){return e.eventMatchResolvers.prepend(t)}function h(t){return e.eventMatchResolvers.append(t)}function g(){e.eventMatchResolvers.clear()}function _(t){return L(()=>e.disambiguationResolvers.prepend(t),t)}function v(t){return L(()=>e.disambiguationResolvers.append(t),t)}function y(){e.disambiguationResolvers.has()&&t.runWithStateChangeBatch(()=>{e.disambiguationResolvers.clear(),c.recompileBindings()})}function b(e,t){d&&ue()}function x(n){let r=e.rawHooks.entries();if(r.length===0)return!1;let i=!1,a={sequence:n,stop(){i=!0}};for(let e of r){try{e.listener(a)}catch(e){t.emitError(`raw-intercept-error`,e,`[Keymap] Error in raw intercept listener:`)}if(i)return!0}return!1}function S(e,t){return{sequence:zE(e.sequence),command:e.command,commandAttrs:s.getBindingCommandAttrs(e,t,s.getActiveCommandView(t)),attrs:e.attrs,event:e.event,preventDefault:e.preventDefault,fallthrough:e.fallthrough,sourceLayerOrder:e.sourceLayerOrder,bindingIndex:e.bindingIndex}}function C(e){l.has(`dispatch`)&&l.emit(`dispatch`,e)}function w(e,t,n,r){l.has(`dispatch`)&&C({phase:e,event:n.event,focused:r,layer:{order:t.order,priority:t.priority,target:t.target,targetMode:t.targetMode},binding:S(n,r),sequence:zE(n.sequence),command:n.command})}function T(e,t,n){if(!l.has(`dispatch`))return;let i=t[0],a=t.length>0?r.collectSequencePartsFromPending({captures:t}):[];C({phase:e,event:`press`,focused:n,layer:i?{order:i.layer.order,priority:i.layer.priority,target:i.layer.target,targetMode:i.layer.targetMode}:void 0,sequence:a})}function E(t){let n=e.keyAfterHooks.entries();for(let e of n)if(e.release===t)return n}function D(e){return e.sequence?zE(e.sequence):e.captures?r.collectSequencePartsFromPending({captures:e.captures}):[]}function O(e,t){return{handled:e!==`sequence-miss`,reason:e,captures:t}}function k(e,t){return{handled:t,reason:t?`binding-handled`:`binding-rejected`,sequence:e.sequence}}function A(e,t){return t.handled||e.reason===`no-match`?t:e}function j(e,i,a,o,s){let c={event:i,eventType:a?`release`:`press`,focused:o,handled:s.handled,reason:s.reason,sequence:D(s),pendingSequence:r.getPendingSequence(),setData:(e,t)=>{n.setData(e,t)},getData:e=>n.getData(e),consume:e=>{let t=e?.preventDefault??!0,n=e?.stopPropagation??!0;t&&i.preventDefault(),n&&i.stopPropagation()}};for(let n of e)if(n.release===a)try{n.listener(c)}catch(e){t.emitError(`key-after-intercept-error`,e,`[Keymap] Error in key:after intercept listener:`)}}function M(){return{handled:!1,reason:`no-match`}}function N(e){e.preventDefault(),e.stopPropagation()}function P(e,t,n,i){r.setPendingSequence({captures:t});let a=O(`sequence-pending`,t);return T(e,t,n),N(i),a}function F(e,t,n,i){let a=O(e,t);return T(`sequence-clear`,t,n),r.setPendingSequence(null),N(i),a}function I(i,a){a||ue();let o=E(a),s=o?r.getFocusedTarget():null,c=e.keyHooks.entries(),l={event:i,setData:(e,t)=>{n.setData(e,t)},getData:e=>n.getData(e),consume:e=>{let t=e?.preventDefault??!0,n=e?.stopPropagation??!0;t&&i.preventDefault(),n&&i.stopPropagation()}};for(let e of c)if(e.release===a){try{e.listener(l)}catch(e){t.emitError(`key-intercept-error`,e,`[Keymap] Error in key intercept listener:`)}if(i.propagationStopped){o&&j(o,i,a,s,{handled:!0,reason:`intercept-consumed`,sequence:[]});return}}if(a){let e=R(i);o&&j(o,i,a,s,e);return}let u=z(i);o&&j(o,i,a,s,u)}function L(n,r){return t.runWithStateChangeBatch(()=>{let i=e.disambiguationResolvers.has(),a=n();return!i&&e.disambiguationResolvers.has()&&c.recompileBindings(),()=>{t.runWithStateChangeBatch(()=>{let t=e.disambiguationResolvers.has();a(),!e.disambiguationResolvers.values().includes(r)&&t&&!e.disambiguationResolvers.has()&&c.recompileBindings()})}})}function R(e){let t=r.getFocusedTarget(),n=r.getActiveLayers(t),a=ge(e),o=M();for(let r of a)layerLoop:for(let a of n){if(a.bindings.length===0||!i.matchesConditions(a))continue;let n=_e(a,r,e,t);if(o=A(o,n.outcome),n.handled){if(n.stop)return o;continue layerLoop}}return o}function z(e){let t=r.getFocusedTarget(),n=r.ensureValidPendingSequence(),i=ge(e);if(n)return ee(n,i,e,t);let a=r.getActiveLayers(t),o=M();for(let n of i){let r=B(a,[n],e,t);if(o=A(o,r),r.handled)return o}return o}function ee(t,n,i,a){let o=s.getActiveCommandView(a),c=[];for(let r of t.captures){let t=uD(r,n,i,e.patterns,ve,ye);t&&c.push(t)}let l=c.reduce((e,t)=>Math.min(e,cD(t,n)),1/0),u=c.filter(e=>cD(e,n)===l);if(u.length===0||!u.some(e=>Ce(e,a,o))){let e=O(`sequence-miss`,t.captures);return T(`sequence-clear`,t.captures,a),r.setPendingSequence(null),e}return te(u,0,!1,i,a)}function te(t,n,i,a,o){let s=i,c=M(),l=new Set;for(let i=n;i<t.length;i+=1){let n=t[i];if(!n||l.has(n))continue;let u=me(t,i,n);if(u.length>0){if(s)continue;let e=he(t,n);return V(t,i,u,e,a,o,s)||P(`sequence-advance`,u,o,a)}if(!rD(n,e.patterns))continue;let d=he(t,n);for(let e of d)l.add(e);let f=we(n.layer,d,a,o);if(c=A(c,f.outcome),f.handled&&(s=!0,f.stop))return T(`sequence-clear`,t,o),r.setPendingSequence(null),c}return T(`sequence-clear`,t,o),r.setPendingSequence(null),c}function B(e,t,n,r){return ne(e,0,t,n,r)}function ne(t,n,r,a,o){let c=s.getActiveCommandView(o),l=M();for(let s=n;s<t.length;s+=1){let n=t[s];if(!n||!i.matchesConditions(n))continue;let u=be(n,r,a,o,c);if(u.length===0)continue;if(u.filter(t=>nD(t,e.patterns,!1)).length>0){let n=u.filter(t=>rD(t,e.patterns)),i=pe(t,s,r,a,o);return re(t,s,r,i,n,a,o)||P(`sequence-start`,i,o,a)}let d=we(n,u.filter(t=>rD(t,e.patterns)),a,o);if(l=A(l,d.outcome),d.handled&&d.stop)return l}return l}function re(e,t,n,i,a,o,s){return H({event:o,focused:s,continuationCaptures:i,exactBindingsSource:a.map(e=>e.binding),sequencePhase:`sequence-start`,runExact:()=>{r.setPendingSequence(null);let i=a[0]?.layer;if(!i)return M();let c=we(i,a,o,s);return c.stop?c.outcome:A(c.outcome,ne(e,t+1,n,o,s))}})}function V(e,t,n,i,a,o,s){return H({event:a,focused:o,continuationCaptures:n,exactBindingsSource:i.map(e=>e.binding),sequencePhase:`sequence-advance`,runExact:()=>{r.setPendingSequence(null);let n=i[0]?.layer;if(!n)return M();let c=we(n,i,a,o);return c.stop?c.outcome:A(c.outcome,te(e,t+1,s||c.handled,a,o))}})}function H(t){let{event:n,focused:i,continuationCaptures:a,exactBindingsSource:o,sequencePhase:c,runExact:l}=t;if(!e.disambiguationResolvers.has()||a.length===0)return;let u=s.getActiveCommandView(i),d=r.collectMatchingBindings(o,i,u);if(!d.some(e=>e.command!==void 0))return;let f=()=>P(c,a,i,n),p=()=>F(`sequence-cleared`,a,i,n),m,h=()=>(m??=r.collectSequencePartsFromPending({captures:a}),m),g=ae({event:n,focused:i,getSequence:h,exactBindings:d,continuationCaptures:a,activeView:u});return g?ie(g,a,l,f,p,i,h):(fe(h()),f())}function ie(e,t,n,r,i,a,o){if(e.action===`run-exact`)return n();if(e.action===`continue-sequence`)return r();if(e.action===`clear`)return i();let s=r();return oe(t,e.handler,a,o(),e=>{if(e){if(e.action===`run-exact`){n();return}if(e.action===`continue-sequence`){r();return}i()}}),s}function ae(i){let a,o,s,c,l={event:i.event,focused:i.focused,get sequence(){return a??=zE(i.getSequence()),a},get stroke(){let e=i.getSequence().at(-1);if(!e)throw Error(`Disambiguation context expected a non-empty sequence`);return c??={...e,stroke:IE(e.stroke)},c},get exact(){return o??=r.collectActiveBindings(i.exactBindings,i.focused,i.activeView).map(e=>({...e,sequence:zE(e.sequence)})),o},get continuations(){return s??=r.getActiveKeysForCaptures(i.continuationCaptures,{includeBindings:!0,includeMetadata:!0}),s},getData:e=>n.getData(e),setData:(e,t)=>{n.setData(e,t)},runExact:()=>RO(`run-exact`),continueSequence:()=>RO(`continue-sequence`),clear:()=>RO(`clear`),defer:e=>RO(`defer`,e)};for(let n of e.disambiguationResolvers.values()){let e;try{e=n(l)}catch(e){t.emitError(`disambiguation-resolver-error`,e,`[Keymap] Error in disambiguation resolver:`);continue}if(e!==void 0){if(JD(e)){t.emitError(`invalid-disambiguation-resolver-return`,e,`[Keymap] Disambiguation resolvers must return synchronously; use ctx.defer(...) for async handling`);continue}if(!BO(e)){t.emitError(`invalid-disambiguation-decision`,e,`[Keymap] Invalid disambiguation decision returned by resolver:`);continue}return e}}}function oe(e,t,n,r,i){ue();let a=new AbortController,o={id:f++,controller:a,captures:e,apply:i};d=o,queueMicrotask(()=>{se(o,t,n,r)})}function se(e,n,r,i){if(!de(e))return;let a={signal:e.controller.signal,sequence:zE(i),focused:r,sleep:t=>HO(t,e.controller.signal),runExact:()=>zO(`run-exact`),continueSequence:()=>zO(`continue-sequence`),clear:()=>zO(`clear`)},o;try{o=n(a)}catch(n){de(e)&&(t.emitError(`deferred-disambiguation-error`,n,`[Keymap] Error in deferred disambiguation handler:`),le(e));return}if(JD(o)){o.then(t=>{ce(e,t)}).catch(n=>{de(e)&&(t.emitError(`deferred-disambiguation-error`,n,`[Keymap] Error in deferred disambiguation handler:`),le(e))});return}ce(e,o)}function ce(e,n){if(de(e)){if(n!==void 0&&!VO(n)){t.emitError(`invalid-deferred-disambiguation-decision`,n,`[Keymap] Invalid deferred disambiguation decision returned by handler:`),le(e);return}le(e),e.apply(n)}}function le(e){de(e)&&(d=null)}function ue(){let e=d;e&&(d=null,e.controller.abort())}function de(e){return d===e}function fe(e){let n=WE(e,{preferDisplay:!0});t.warnOnce(`unresolved-disambiguation:${n}`,`unresolved-disambiguation`,{sequence:n},`[Keymap] Ambiguous exact/prefix sequence "${n}" fell back to prefix handling because no disambiguation resolver resolved it`)}function pe(t,n,r,a,o){let c=[],l=s.getActiveCommandView(o);for(let s=n;s<t.length;s+=1){let n=t[s];if(n&&i.matchesConditions(n))for(let t of be(n,r,a,o,l))nD(t,e.patterns,!1)&&c.push(t)}return c}function me(t,n,r){return t.filter((t,i)=>i>=n&&nD(t,e.patterns,!1)&&JO(t.parts,r.parts))}function he(t,n){return t.filter(t=>t.layer===n.layer&&rD(t,e.patterns)&&JO(t.parts,n.parts))}function ge(n){let r=e.eventMatchResolvers.values();if(r.length===0)return[];if(r.length===1)return qO(r[0],n,u,t);let i=[],a=new Set;for(let e of r){let r;try{r=e(n,u)}catch(e){t.emitError(`event-match-resolver-error`,e,`[Keymap] Error in event match resolver:`);continue}if(!(!r||r.length===0))for(let e of r){if(typeof e!=`string`){t.emitError(`invalid-event-match-resolver-candidate`,e,`[Keymap] Invalid event match resolver candidate:`);continue}a.has(e)||(a.add(e),i.push(e))}}return i}function _e(e,t,n,r){let o=!1,s=M();for(let c of e.bindings){if(c.event!==`release`)continue;let l=c.sequence[0];if(!l||l.match!==t||!i.matchesConditions(c))continue;let u=a.runBinding(e,c,n,r);if(s=A(s,k(c,u)),!u){w(`binding-reject`,e,c,r);continue}if(w(`binding-execute`,e,c,r),o=!0,!c.fallthrough)return{handled:!0,stop:!0,outcome:s}}return{handled:o,stop:!1,outcome:s}}function ve(n,r){return UO(e.patterns,t,n,r)}function ye(t,n,r){return WO(e.patterns,t,n,r)}function be(e,t,n,r,i){let a=dD(e,t,n,ve,ye);return a.some(e=>Ce(e,r,i))?a:[]}function xe(n){return GO(e.patterns,t,n)}function Se(e,t,n){return i.matchesConditions(e)&&s.isBindingVisible(e,t,n)}function Ce(e,t,n){return Se(e.binding,t,n)}function we(e,t,n,r){let o=!1,s=M();for(let c of t){let t=c.binding;if(!i.matchesConditions(t))continue;let l=a.runBinding(e,t,n,r,xe(c));if(s=A(s,k(t,l)),!l){w(`binding-reject`,e,t,r);continue}if(w(`binding-execute`,e,t,r),o=!0,!t.fallthrough)return{handled:!0,stop:!0,outcome:s}}return{handled:o,stop:!1,outcome:s}}return{intercept:p,prependEventMatchResolver:m,appendEventMatchResolver:h,clearEventMatchResolvers:g,prependDisambiguationResolver:_,appendDisambiguationResolver:v,clearDisambiguationResolvers:y,handlePendingSequenceChange:b,handleRawSequence:x,handleKeyEvent:I}}function qO(e,t,n,r){let i;try{i=e(t,n)}catch(e){return r.emitError(`event-match-resolver-error`,e,`[Keymap] Error in event match resolver:`),[]}if(!i||i.length===0)return[];if(i.length===1){let[e]=i;return typeof e==`string`?[e]:(r.emitError(`invalid-event-match-resolver-candidate`,e,`[Keymap] Invalid event match resolver candidate:`),[])}let a=[],o=new Set;for(let e of i){if(typeof e!=`string`){r.emitError(`invalid-event-match-resolver-candidate`,e,`[Keymap] Invalid event match resolver candidate:`);continue}o.has(e)||(o.add(e),a.push(e))}return a}function JO(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n+=1)if(e[n]?.match!==t[n]?.match)return!1;return!0}var YO=()=>{};function XO(e,t,n,r){if(n===void 0)return r;if(typeof n!=`number`||!Number.isInteger(n)||n<0)throw Error(`Keymap sequence pattern "${e}" ${t} must be a non-negative integer`);return n}function ZO(e,t){let{kind:n,reservedFields:r,registeredFields:i,emitError:a}=t,o=Object.entries(e),s=[];for(let[e,t]of o){if(r.has(e)){a(`reserved-${n}-field`,{field:e,kind:n},`Keymap ${n} field "${e}" is reserved`);continue}if(i.has(e)){a(`duplicate-${n}-field`,{field:e,kind:n},`Keymap ${n} field "${e}" is already registered`);continue}i.set(e,t),s.push([e,t])}return()=>{for(let[e,t]of s)i.get(e)===t&&i.delete(e)}}function QO(e,t,n,r,i){let a;try{a=NE(i.name)}catch(e){return t.emitError(`token-name-normalize-error`,e,qD(e,`Failed to register keymap token`)),YO}if(e.tokens.has(a)||e.patterns.has(a))return t.emitError(`duplicate-token`,{token:a},`Keymap token "${a}" is already registered`),YO;let o;try{if(o=n.parseTokenKey(i.key),o.patternName)throw Error(`Invalid key "${String(i.key)}": expected a concrete key stroke`)}catch(e){return t.emitError(`token-parse-error`,e,qD(e,`Failed to register keymap token "${a}"`)),YO}let s={stroke:o.stroke,match:o.match},c=new Map(e.tokens);c.set(a,s);try{r.applyTokenState(c)}catch(e){return t.emitError(`token-register-error`,e,qD(e,`Failed to register keymap token "${a}"`)),YO}return()=>{if(e.tokens.get(a)!==s)return;let n=new Map(e.tokens);n.delete(a);try{r.applyTokenState(n)}catch(e){t.emitError(`token-unregister-error`,e,qD(e,`Failed to unregister keymap token "${a}"`))}}}function $O(e,t,n,r){let i,a;try{i=NE(r.name);let e=XO(i,`min`,r.min,1),t=XO(i,`max`,r.max,2**53-1);if(t<e)throw Error(`Keymap sequence pattern "${i}" max must be greater than or equal to min`);a={name:i,display:r.display,payloadKey:r.payloadKey??i,match:HE(`pattern:${i}`),min:e,max:t,matcher:e=>r.match(e),finalize:r.finalize}}catch(e){return t.emitError(`sequence-pattern-register-error`,e,qD(e,`Failed to register keymap sequence pattern`)),YO}return e.tokens.has(i)||e.patterns.has(i)?(t.emitError(`duplicate-sequence-pattern`,{pattern:i},`Keymap sequence pattern "${i}" is already registered`),YO):(e.patterns.set(i,a),n.recompileBindings(),()=>{e.patterns.get(i)===a&&(e.patterns.delete(i),n.recompileBindings())})}function ek(e,t,n,r){return ZO(r,{kind:n,reservedFields:n===`layer`?ID:n===`binding`?FD:PD,registeredFields:n===`layer`?e.layerFields:n===`binding`?e.bindingFields:e.commandFields,emitError:(e,n,r)=>t.emitError(e,n,r)})}var tk=()=>{};function nk(e,t){return t.priority-e.priority||t.order-e.order}function rk(e){if(e.matchers.length>0)return!0;for(let t of e.commands)if(t.matchers.length>0)return!0;for(let t of e.bindings)if(t.matchers.length>0)return!0;return!1}function ik(e){if(e.commands.length===0)return!1;if(e.matchers.length>0)return!0;for(let t of e.commands)if(t.matchers.length>0)return!0;return!1}function ak(e,t,n,r,i){let a=n=>t.runWithStateChangeBatch(()=>{let a=n.target;if(a&&i.host.isTargetDestroyed(a))return t.emitError(`destroyed-layer-target`,{target:a},`Cannot register a keymap layer for a destroyed keymap target`),tk;let o,s,c,p,m,v,y;try{y=l(n),o=u(vD(n.bindings??[]),n);let e=d(n.commands??[],n);v=e.length===0?[]:i.commands.normalizeCommands(e),{requires:s,matchers:c,fields:p,attrs:m}=f(n)}catch(e){return t.emitError(`register-layer-failed`,e,qD(e,`Failed to register keymap layer`)),tk}let b=e.order++,x=i.compiler.compileBindings(o,e.tokens,a,b,p);if(x.bindings.length===0&&!x.hasTokenBindings&&v.length===0)return tk;i.diagnostics?.analyzeLayer({target:a,order:b,commands:v,sourceBindings:o,bindings:x.bindings,hasTokenBindings:x.hasTokenBindings});let S={order:b,target:a,targetMode:y,priority:n.priority??0,requires:s,matchers:c,fields:p,attrs:m,commands:v,sourceBindings:o,bindings:x.bindings,root:aD(x.bindings,e.patterns),hasTokenBindings:x.hasTokenBindings,activeKeyCacheBlocked:!1,activeCommandViewCacheBlocked:!1};_(S),e.layers.add(S),e.sortedLayers=[...e.sortedLayers,S].sort(nk),g(S);for(let e of S.commands)g(e);for(let e of S.bindings)g(e);return a&&(S.offTargetDestroy=i.host.onTargetDestroy(a,()=>{h(S)})),S.commands.length>0&&r.ensureValidPendingSequence(),t.queueStateChange(),()=>{h(S)}}),o=n=>{t.runWithStateChangeBatch(()=>{let i=new Map;for(let t of e.layers)t.hasTokenBindings&&i.set(t,p(t,n));e.tokens=n;let a=!1;for(let[e,t]of i)m(e,t)&&(a=!0);a&&r.setPendingSequence(null),i.size>0&&t.queueStateChange()})},s=()=>{t.runWithStateChangeBatch(()=>{let n=0,i=!1;for(let t of e.layers){if(t.sourceBindings.length===0)continue;let r=p(t,e.tokens);m(t,r)&&(i=!0),n+=1}i&&r.setPendingSequence(null),n>0&&t.queueStateChange()})},c=()=>{for(let t of e.layers){y(t);for(let e of t.commands)y(e);for(let e of t.bindings)y(e);t.offTargetDestroy?.(),t.offTargetDestroy=void 0}},l=e=>{if(e.targetMode){if(!e.target)throw Error(`Keymap targetMode "${e.targetMode}" requires a target`);return e.targetMode}return e.target?`focus-within`:void 0},u=(t,n)=>{let r=e.layerBindingsTransformers.values();if(r.length===0)return t;let i=t;for(let e of r){let t=e(i,{layer:n,validateBindings:e=>_D(e)});t&&(i=vD(t))}return i},d=(n,r)=>{let i=e.commandTransformers.values();if(n.length===0||i.length===0)return n;let a=[];for(let e of n){let n={...e},o=[],s=!0;for(let e of i)try{e(n,{layer:r,add(e){o.push({...e})},skipOriginal(){s=!1}})}catch(e){t.emitError(`command-transformer-error`,e,`[Keymap] Error in command transformer:`)}s&&a.push(n),a.push(...o)}return a},f=t=>{let r={},a=[],o=Object.create(null),s={};for(let[c,l]of Object.entries(t)){if(ID.has(c)||l===void 0)continue;o[c]=YD(l);let t=e.layerFields.get(c);if(!t){i.warnUnknownField(`layer`,c);continue}t(l,GD({fieldName:c,conditions:n,requirements:r,matchers:a,attrs:s}))}return{requires:Object.entries(r),matchers:a,fields:Object.keys(o).length>0?Object.freeze(o):void 0,attrs:Object.keys(s).length>0?YD(s,{freeze:!0}):void 0}},p=(e,t)=>i.compiler.compileBindings(e.sourceBindings,t,e.target,e.order,e.fields),m=(t,n)=>{i.diagnostics?.analyzeLayer({target:t.target,order:t.order,commands:t.commands,sourceBindings:t.sourceBindings,bindings:n.bindings,hasTokenBindings:n.hasTokenBindings}),v(t);for(let e of t.bindings)y(e);t.bindings=n.bindings,t.root=aD(n.bindings,e.patterns),t.hasTokenBindings=n.hasTokenBindings,_(t);for(let e of t.bindings)g(e);return e.pending?.captures.some(e=>e.layer===t)??!1},h=n=>{t.runWithStateChangeBatch(()=>{if(e.layers.delete(n)){e.sortedLayers=e.sortedLayers.filter(e=>e!==n),v(n),y(n);for(let e of n.commands)y(e);for(let e of n.bindings)y(e);n.offTargetDestroy?.(),n.offTargetDestroy=void 0,e.pending?.captures.some(e=>e.layer===n)?r.setPendingSequence(null):n.commands.length>0&&!i.host.isDestroyed&&r.ensureValidPendingSequence(),t.queueStateChange()}})},g=e=>{for(let n of e.matchers)if(n.subscribe)try{n.dispose=n.subscribe(()=>{if(!r.hasPendingSequenceState()){t.queueStateChange();return}t.runWithStateChangeBatch(()=>{r.revalidatePendingSequenceIfNeeded(),t.queueStateChange()})})}catch(e){t.emitError(`reactive-matcher-subscribe-error`,e,qD(e,`Failed to subscribe to reactive matcher from ${n.source}`))}},_=t=>{let n=rk(t),r=ik(t);t.activeKeyCacheBlocked=n,t.activeCommandViewCacheBlocked=r,n&&(e.activeKeyCacheBlockers+=1),r&&(e.activeCommandViewCacheBlockers+=1)},v=t=>{t.activeKeyCacheBlocked&&=(--e.activeKeyCacheBlockers,!1),t.activeCommandViewCacheBlocked&&=(--e.activeCommandViewCacheBlockers,!1)},y=e=>{for(let n of e.matchers)if(n.dispose){try{n.dispose()}catch(e){t.emitError(`reactive-matcher-dispose-error`,e,qD(e,`Failed to dispose reactive matcher from ${n.source}`))}n.dispose=void 0}};return{registerLayer:a,applyTokenState:o,recompileBindings:s,cleanup:c}}var ok=1e3;function sk(e,t,n){let r=(e,n,r)=>{if(!t.has(`warning`)){let t=`[${e}] ${r}`;n instanceof Error?console.warn(t,n):console.warn(t);return}t.emit(`warning`,{code:e,message:r,warning:n})},i=(e,n,r)=>{if(!t.has(`error`)){let t=`[${e}] ${r}`;n instanceof Error?console.error(t,n):console.error(t);return}t.emit(`error`,{code:e,message:r,error:n})},a=()=>{if(!(!e.stateChangePending||e.stateChangeDepth>0||e.flushingStateChange)){e.flushingStateChange=!0;try{let t=0;for(;e.stateChangePending&&e.stateChangeDepth===0;){if(t>=ok){e.stateChangePending=!1,i(`state-change-feedback-loop`,{iterations:ok},`[Keymap] Possible infinite state listener feedback loop detected after ${ok} iterations; pending state notifications were dropped`);break}t+=1,e.stateChangePending=!1,n.emit(`state`)}}finally{e.flushingStateChange=!1}}};return{runWithStateChangeBatch(t){e.stateChangeDepth+=1;try{return t()}finally{--e.stateChangeDepth,e.stateChangeDepth===0&&a()}},queueStateChange(t){e.derivedVersion+=1,t?.invalidateCaches!==!1&&(e.cacheVersion+=1),n.has(`state`)&&(e.stateChangePending=!0,e.stateChangeDepth===0&&!e.flushingStateChange&&a())},emitWarning:r,emitError:i,reportListenerError(e,t){if(e===`state`){i(`state-listener-error`,t,`[Keymap] Error in state listener:`);return}if(e===`pendingSequence`){i(`pending-sequence-listener-error`,t,`[Keymap] Error in pending sequence listener:`);return}e===`dispatch`&&i(`dispatch-listener-error`,t,`[Keymap] Error in dispatch listener:`)},warnOnce(t,n,i,a){e.usedWarningKeys.has(t)||(e.usedWarningKeys.add(t),r(n,i,a))}}}function ck(e,t,n){return{getData(t){return e.data[t]},setData(r,i){t.runWithStateChangeBatch(()=>{if(i===void 0){if(!(r in e.data))return;delete e.data[r],e.dataVersion+=1,n.ensureValidPendingSequence(),t.queueStateChange();return}Object.is(e.data[r],i)||(e.data[r]=i,e.dataVersion+=1,n.ensureValidPendingSequence(),t.queueStateChange())})},getReadonlyData(){return e.readonlyDataVersion===e.dataVersion?e.readonlyData:(e.readonlyData=Object.freeze({...e.data}),e.readonlyDataVersion=e.dataVersion,e.readonlyData)}}}var lk=Object.freeze({});function uk(){return{order:0,tokens:new Map,patterns:new Map,layerFields:new Map,layerBindingsTransformers:mD(),bindingExpanders:mD(),bindingParsers:mD(),bindingTransformers:mD(),bindingFields:new Map,commandTransformers:mD(),commandFields:new Map,eventMatchResolvers:mD(),disambiguationResolvers:mD(),keyHooks:hD(),keyAfterHooks:hD(),rawHooks:hD(),layers:new Set,sortedLayers:[],activeLayersCacheVersion:-1,activeLayersCacheFocused:void 0,activeLayersCache:[],activeKeyCacheBlockers:0,activeCommandViewCacheBlockers:0,commandResolvers:mD(),pending:null,data:{},dataVersion:0,readonlyDataVersion:-1,readonlyData:lk,cacheVersion:0,derivedVersion:0,stateChangeDepth:0,stateChangePending:!1,flushingStateChange:!1,usedWarningKeys:new Set}}function dk(e){return BE(e)}var fk=class{#e=uk();#t=!1;#n=new Map;#r=[];#i=fD(()=>{});#a;#o;#s;#c;#l;#u;#d;#f;#p;#m;#h;#g;#_;#v;#y;#b;getPendingSequence;getActiveKeys;constructor(e){if(this.#b=e,e.isDestroyed)throw Error(`Cannot create a keymap for a destroyed host`);this.#a=fD((e,t)=>{this.#o.reportListenerError(e,t)}),this.#o=sk(this.#e,this.#i,this.#a),this.#l=FO(this.#e,this.#o),this.#u=$D(this.#e,this.#b,this.#o,this.#l,{onCommandResolversChanged:()=>{this.#s.ensureValidPendingSequence()}}),this.#s=ND(this.#e,this.#b,this.#a,this.#o,this.#l,this.#u,{onPendingSequenceChanged:(e,t)=>{this.#p?.handlePendingSequenceChange(e,t)}}),this.#c=ck(this.#e,this.#o,this.#s),this.#d=bO(this.#o,this.#c,this.#s,this.#u,{keymap:this,createCommandEvent:()=>this.#b.createCommandEvent()}),this.#f=DO(this.#e,this.#o,this.#l,{warnUnknownField:(e,t)=>{this.#C(e,t)},warnUnknownToken:(e,t)=>{this.#w(e,t)}}),this.#h=bD(this.#o,this.#u),this.#m=ak(this.#e,this.#o,this.#l,this.#s,{compiler:this.#f,commands:this.#u,host:this.#b,diagnostics:this.#h,warnUnknownField:(e,t)=>{this.#C(e,t)}}),this.#p=KO(this.#e,this.#o,this.#c,this.#s,this.#l,this.#d,this.#f,this.#u,this.#m,this.#a),this.getPendingSequence=this.#s.getPendingSequence,this.getActiveKeys=this.#s.getActiveKeys,this.#g=e=>{this.#p.handleKeyEvent(e,!1)},this.#_=e=>{this.#p.handleKeyEvent(e,!0)},this.#v=e=>this.#p.handleRawSequence(e),this.#y=e=>{this.#S(e)},this.#r.push(this.#b.onKeyPress(this.#g)),this.#r.push(this.#b.onKeyRelease(this.#_)),this.#b.onRawInput&&this.#r.push(this.#b.onRawInput(this.#v)),this.#r.push(this.#b.onFocusChange(this.#y)),this.#b.onDestroy&&this.#r.push(this.#b.onDestroy(()=>{this.#x()}))}[qE](){return{state:this.#e,host:this.#b,conditions:this.#l,catalog:this.#u,activation:this.#s}}#x(){if(!this.#t){this.#t=!0,this.#s.setPendingSequence(null);for(let e of this.#n.values())e.dispose();this.#n.clear(),this.#m.cleanup();for(let e of this.#r.splice(0))e()}}setData(e,t){this.#c.setData(e,t)}getData(e){return this.#c.getData(e)}getHostMetadata(){return this.#b.metadata}hasPendingSequence(){return this.#s.ensureValidPendingSequence()!==void 0}createKeyMatcher(e){let t=this.#f.parseTokenKey(e).match;return e=>e?dk(e)===t:!1}parseKeySequence(e){return this.#f.parseKeySequence(e)}formatKey(e,t){return this.#f.formatKey(e,t)}clearPendingSequence(){this.#s.setPendingSequence(null)}popPendingSequence(){return this.#s.popPendingSequence()}getCommands(e){return this.#u.getCommands(e)}getCommandEntries(e){return this.#u.getCommandEntries(e)}getCommandBindings(e){return this.#u.getCommandBindings(e)}acquireResource(e,t){if(this.#t||this.#b.isDestroyed)throw Error(`Cannot use a keymap after its host was destroyed`);let n=this.#n.get(e);if(n)return n.count+=1,()=>{this.#T(e,n)};let r={count:1,dispose:t()};return this.#n.set(e,r),()=>{this.#T(e,r)}}runCommand(e,t){return this.#d.runCommand(e,t)}dispatchCommand(e,t){return this.#d.dispatchCommand(e,t)}on(e,t){return e===`warning`||e===`error`?this.#i.hook(e,t):this.#a.hook(e,t)}intercept(e,t,n){return this.#p.intercept(e,t,n)}registerLayer(e){return this.#m.registerLayer(e)}registerLayerFields(e){return ek(this.#e,this.#o,`layer`,e)}prependLayerBindingsTransformer(e){return this.#e.layerBindingsTransformers.prepend(e)}appendLayerBindingsTransformer(e){return this.#e.layerBindingsTransformers.append(e)}clearLayerBindingsTransformers(){this.#e.layerBindingsTransformers.clear()}prependBindingTransformer(e){return this.#e.bindingTransformers.prepend(e)}appendBindingTransformer(e){return this.#e.bindingTransformers.append(e)}clearBindingTransformers(){this.#e.bindingTransformers.clear()}prependCommandTransformer(e){return this.#e.commandTransformers.prepend(e)}appendCommandTransformer(e){return this.#e.commandTransformers.append(e)}clearCommandTransformers(){this.#e.commandTransformers.clear()}prependBindingParser(e){return this.#e.bindingParsers.prepend(e)}appendBindingParser(e){return this.#e.bindingParsers.append(e)}clearBindingParsers(){this.#e.bindingParsers.clear()}registerToken(e){return QO(this.#e,this.#o,this.#f,this.#m,e)}registerSequencePattern(e){return $O(this.#e,this.#o,this.#m,e)}prependBindingExpander(e){return this.#e.bindingExpanders.prepend(e)}appendBindingExpander(e){return this.#e.bindingExpanders.append(e)}clearBindingExpanders(){this.#e.bindingExpanders.clear()}registerBindingFields(e){return ek(this.#e,this.#o,`binding`,e)}registerCommandFields(e){return ek(this.#e,this.#o,`command`,e)}prependCommandResolver(e){return this.#u.prependCommandResolver(e)}appendCommandResolver(e){return this.#u.appendCommandResolver(e)}clearCommandResolvers(){this.#u.clearCommandResolvers()}prependLayerAnalyzer(e){return this.#h.prependLayerAnalyzer(e)}appendLayerAnalyzer(e){return this.#h.appendLayerAnalyzer(e)}clearLayerAnalyzers(){this.#h.clearLayerAnalyzers()}prependEventMatchResolver(e){return this.#p.prependEventMatchResolver(e)}appendEventMatchResolver(e){return this.#p.appendEventMatchResolver(e)}clearEventMatchResolvers(){this.#p.clearEventMatchResolvers()}prependDisambiguationResolver(e){return this.#p.prependDisambiguationResolver(e)}appendDisambiguationResolver(e){return this.#p.appendDisambiguationResolver(e)}clearDisambiguationResolvers(){this.#p.clearDisambiguationResolvers()}#S(e){this.#o.runWithStateChangeBatch(()=>{this.#s.setPendingSequence(null),this.#o.queueStateChange({invalidateCaches:!1})})}#C(e,t){this.#o.warnOnce(`${e}:${t}`,`unknown-${e}-field`,{field:t,kind:e},`[Keymap] Unknown ${e} field "${t}" was ignored`)}#w(e,t){this.#o.warnOnce(`token:${e}`,`unknown-token`,{token:e,sequence:t},`[Keymap] Unknown token "${e}" in key sequence "${t}"; binding was skipped until the token is registered`)}#T(e,t){this.#n.get(e)===t&&(--t.count,!(t.count>0)&&(t.dispose(),this.#n.delete(e)))}},pk=new Set(`up.down.left.right.clear.escape.return.linefeed.enter.tab.backspace.delete.insert.home.end.pageup.pagedown.space.lt.gt.plus.minus.equal.comma.period.slash.backslash.semicolon.quote.backquote.leftbracket.rightbracket.capslock.numlock.scrolllock.printscreen.pause.menu.apps.kp0.kp1.kp2.kp3.kp4.kp5.kp6.kp7.kp8.kp9.kpdecimal.kpdivide.kpmultiply.kpminus.kpplus.kpenter.kpequal.kpseparator.kpleft.kpright.kpup.kpdown.kppageup.kppagedown.kphome.kpend.kpinsert.kpdelete.mediaplay.mediapause.mediaplaypause.mediareverse.mediastop.mediafastforward.mediarewind.medianext.mediaprev.mediarecord.volumedown.volumeup.mute.leftshift.leftctrl.leftalt.leftsuper.lefthyper.leftmeta.rightshift.rightctrl.rightalt.rightsuper.righthyper.rightmeta.iso_level3_shift.iso_level5_shift.option.alt.meta.super.hyper.control.ctrl.shift`.split(`.`)),mk=new Set([`ctrl`,`control`,`shift`,`meta`,`alt`,`option`,`super`,`hyper`]),hk=_k(pk),gk=_k(mk);function _k(e){let t=new Map;for(let n of e){let e=n.charCodeAt(0);if(Number.isNaN(e))continue;let r=t.get(e);r||(r=[],t.set(e,r)),r.push(n)}for(let e of t.values())e.sort((e,t)=>t.length-e.length);return t}function vk(e){return e>=65&&e<=90?e+32:e}function yk(e){return e>=48&&e<=57}function bk(e,t,n){if(e.startsWith(t,n))return!0;if(n+t.length>e.length)return!1;for(let r=0;r<t.length;r+=1)if(vk(e.charCodeAt(n+r))!==t.charCodeAt(r))return!1;return!0}function xk(e,t,n){let r=t.charCodeAt(n);if(Number.isNaN(r))return;let i=e.get(vk(r));if(i){for(let e of i)if(bk(t,e,n))return e}}function Sk(e,t,n,r,i){return e.parseObjectKey(t,{display:n,match:r,tokenName:i})}function Ck(e,t){if(e===` `)return t.parseObjectKey({name:`space`},{display:`space`});if(e===`+`)return t.parseObjectKey({name:`+`},{display:`+`});let n=e.split(`+`),r=``,i=``,a=!1,o=!1,s=!1,c=!1,l=!1;for(let t of n){let n=t.trim();if(!n)continue;let u=n.toLowerCase();if(u===`ctrl`||u===`control`){a=!0;continue}if(u===`shift`){o=!0;continue}if(u===`meta`||u===`alt`||u===`option`){s=!0;continue}if(u===`super`){c=!0;continue}if(u===`hyper`){l=!0;continue}if(r)throw Error(`Invalid key "${e}": multiple key names are not supported`);r=n,i=u}if(!r)throw Error(`Invalid key "${e}": missing key name`);let u=[];return a&&u.push(`ctrl`),o&&u.push(`shift`),s&&u.push(`meta`),c&&u.push(`super`),l&&u.push(`hyper`),u.push(i),t.parseObjectKey({name:r,ctrl:a,shift:o,meta:s,super:c,hyper:l||void 0},{display:u.join(`+`)})}function wk(e,t){let n=e.trim().toLowerCase();return t.parseObjectKey({name:n},{display:n})}function Tk(e,t){let n=xk(hk,e,t);if(n)return n;if(vk(e.charCodeAt(t))!==102||!yk(e.charCodeAt(t+1)))return;let r=yk(e.charCodeAt(t+2))?t+3:t+2;return e.slice(t,r).toLowerCase()}function Ek(e,t){return xk(gk,e,t)}function Dk(e,t,n){let r=t,i=!1,a=!1,o=!1,s=!1,c=!1;for(;r<e.length;){let t=Ek(e,r);if(!t)break;let n=r+t.length;if(e[n]!==`+`)break;t===`ctrl`||t===`control`?i=!0:t===`shift`?a=!0:t===`meta`||t===`alt`||t===`option`?o=!0:t===`super`?s=!0:t===`hyper`&&(c=!0),r=n+1}if(r===t)return;let l=e[r];if(l===void 0)throw Error(`Invalid key "${e.slice(t)}": missing key name`);let u=Tk(e,r)??l,d=u===` `?`space`:u===`+`?`+`:u.toLowerCase(),f=[];return i&&f.push(`ctrl`),a&&f.push(`shift`),o&&f.push(`meta`),s&&f.push(`super`),c&&f.push(`hyper`),f.push(d),{part:n.parseObjectKey({name:u===` `?`space`:u,ctrl:i,shift:a,meta:o,super:s,hyper:c||void 0},{display:f.join(`+`)}),nextIndex:r+u.length}}var Ok=e=>{let{input:t,index:n,tokens:r,normalizeTokenName:i}=e;if(n===0&&t.includes(`+`)&&/\s/.test(t))return{parts:[Ck(t,e)],nextIndex:t.length};let a=t[n];if(a===void 0)return;if(a===`<`){let o=t.indexOf(`>`,n);if(o===-1)return{parts:[Ck(a,e)],nextIndex:n+1};let s=i(t.slice(n+1,o)),c=r.get(s);return c?{parts:[Sk(e,c.stroke,`<${s}>`,c.match,s)],nextIndex:o+1,usedTokens:[s]}:{parts:[],nextIndex:o+1,unknownTokens:[s]}}if(a===`{`){let r=t.indexOf(`}`,n);if(r===-1)return{parts:[Ck(a,e)],nextIndex:n+1};let o=i(t.slice(n+1,r)),s=e.patterns.get(o);return s?{parts:[{...e.parseObjectKey({name:o,ctrl:!1,shift:!1,meta:!1,super:!1},{display:s.display??`{${o}}`,match:s.match}),patternName:s.name,payloadKey:s.payloadKey}],nextIndex:r+1,usedTokens:[o]}:{parts:[],nextIndex:r+1,unknownTokens:[o]}}let o=Dk(t,n,e);if(o)return{parts:[o.part],nextIndex:o.nextIndex};let s=Tk(t,n);return s?{parts:[wk(s,e)],nextIndex:n+s.length}:{parts:[Ck(a,e)],nextIndex:n+1}},kk=(e,t)=>[t.resolveKey({name:e.name,ctrl:e.ctrl,shift:e.shift,meta:e.meta,super:e.super??!1,hyper:e.hyper||void 0})];function Ak(e){return e.appendBindingParser(e=>Ok(e))}function jk(e){return e.appendEventMatchResolver((e,t)=>kk(e,t))}function Mk(e){let t=Ak(e),n=jk(e);return()=>{n(),t()}}var Nk=Symbol(`keymap:mod-bindings`),Pk=/(^|[+,\s])mod(?=\s*\+)/i,Fk=/(^|[+,\s])mod(?=\s*\+)/gi;function Ik(e){let t=e.primaryModifier;return(t===`ctrl`||t===`super`)&&e.modifiers[t]!==`unsupported`?t:e.modifiers.ctrl===`unsupported`?`super`:`ctrl`}function Lk(e){if(e.includes(`,`))return[e];let t=e.trim();return t.includes(` `)?t.split(/\s+/):[e]}function Rk(e){return e.acquireResource(Nk,()=>e.appendBindingExpander(({input:t,displays:n})=>{if(!Pk.test(t))return;let r=Ik(e.getHostMetadata());return[{key:t.replace(Fk,(e,t)=>`${t}${r}`),displays:n??Lk(t)}]}))}var zk=new Map([[` `,`space`],[`Spacebar`,`space`],[`ArrowUp`,`up`],[`ArrowDown`,`down`],[`ArrowLeft`,`left`],[`ArrowRight`,`right`],[`Escape`,`escape`],[`Esc`,`escape`],[`Enter`,`return`],[`Backspace`,`backspace`],[`Delete`,`delete`],[`Tab`,`tab`],[`Home`,`home`],[`End`,`end`],[`PageUp`,`pageup`],[`PageDown`,`pagedown`],[`Insert`,`insert`],[`CapsLock`,`capslock`],[`NumLock`,`numlock`],[`ScrollLock`,`scrolllock`],[`ContextMenu`,`menu`],[`Meta`,`super`],[`OS`,`super`],[`Alt`,`alt`],[`Control`,`control`],[`Shift`,`shift`]]);function Bk(e){let t=e?.trim().toLowerCase();return t?t.includes(`mac`)||t.includes(`darwin`)?`macos`:t.includes(`win`)?`windows`:t.includes(`linux`)||t.includes(`x11`)?`linux`:`unknown`:`unknown`}function Vk(){let e=globalThis.navigator,t=e?.userAgentData?.platform,n=Bk(t);return n===`unknown`?Bk(e?.platform??e?.userAgent):n}function Hk(){let e=Vk();return{platform:e,primaryModifier:e===`macos`?`super`:e===`unknown`?`unknown`:`ctrl`,modifiers:{ctrl:`supported`,shift:`supported`,meta:`supported`,super:`supported`,hyper:`unsupported`}}}function Uk(e){return e.length===1&&!/^[a-z0-9]$/i.test(e)}function Wk(e){let t={name:e.name,ctrl:e.ctrl,shift:e.shift,meta:e.meta,super:e.super??!1,hyper:e.hyper||void 0};return!t.shift||!Uk(t.name)?[t]:[t,{...t,shift:!1}]}var Gk=class{name;ctrl;shift;meta;superKey;originalEvent;propagationStopped=!1;constructor(e,t,n,r,i,a){this.name=e,this.ctrl=t,this.shift=n,this.meta=r,this.superKey=i,this.originalEvent=a}get super(){return this.superKey}preventDefault(){this.originalEvent?.preventDefault()}stopPropagation(){this.propagationStopped=!0,this.originalEvent?.stopPropagation()}};function Kk(){return globalThis.MutationObserver}function qk(e){return zk.get(e)||(/^F\d{1,2}$/i.test(e)||e.length===1?e.toLowerCase():e.trim().toLowerCase().replace(/\s+/g,``))}function Jk(e){if(!e)return new Gk(`command`,!1,!1,!1,!1);let t=globalThis.KeyboardEvent;return new Gk(qk(e.key),e.ctrlKey,e.shiftKey,e.altKey,e.metaKey,t&&e instanceof t?e:void 0)}var Yk=class{metadata=Hk();rootTarget;isDestroyed=!1;observer;targetDestroyListeners=new Map;constructor(e){this.rootTarget=e}getFocusedTarget(){let e=this.rootTarget.ownerDocument.activeElement;return!e||typeof e!=`object`?null:e===this.rootTarget||this.rootTarget.contains(e)?e:null}getParentTarget(e){return e.parentElement}isTargetDestroyed(e){return e===this.rootTarget?!1:!e.isConnected||!this.rootTarget.contains(e)}onKeyPress(e){let t=t=>{e(Jk(t))};return this.rootTarget.addEventListener(`keydown`,t,{capture:!0}),()=>{this.rootTarget.removeEventListener(`keydown`,t,{capture:!0})}}onKeyRelease(e){let t=t=>{e(Jk(t))};return this.rootTarget.addEventListener(`keyup`,t,{capture:!0}),()=>{this.rootTarget.removeEventListener(`keyup`,t,{capture:!0})}}onFocusChange(e){let t=()=>{queueMicrotask(()=>{e(this.getFocusedTarget())})};return this.rootTarget.addEventListener(`focusin`,t,{capture:!0}),this.rootTarget.addEventListener(`focusout`,t,{capture:!0}),()=>{this.rootTarget.removeEventListener(`focusin`,t,{capture:!0}),this.rootTarget.removeEventListener(`focusout`,t,{capture:!0})}}onTargetDestroy(e,t){let n=this.targetDestroyListeners.get(e);return n||(n=new Set,this.targetDestroyListeners.set(e,n)),n.add(t),this.ensureObserver(),this.flushDisconnectedTargets(),()=>{let n=this.targetDestroyListeners.get(e);n&&(n.delete(t),n.size===0&&this.targetDestroyListeners.delete(e),this.targetDestroyListeners.size===0&&this.disconnectObserver())}}createCommandEvent(){return Jk()}ensureObserver(){if(this.observer||this.targetDestroyListeners.size===0)return;let e=Kk();e&&(this.observer=new e(()=>{this.flushDisconnectedTargets()}),this.observer.observe(this.rootTarget,{childList:!0,subtree:!0}))}disconnectObserver(){this.observer&&=(this.observer.disconnect(),void 0)}flushDisconnectedTargets(){for(let[e,t]of this.targetDestroyListeners)if(this.isTargetDestroyed(e)){this.targetDestroyListeners.delete(e);for(let e of[...t])e()}this.targetDestroyListeners.size===0&&this.disconnectObserver()}};function Xk(e){return new Yk(e)}var Zk=(e,t)=>Wk(e).map(e=>t.resolveKey(e)),Qk=[2,3],$k=`fungi.app.ready.v3`,eA=`fungi.app.ready`,tA=`fungi.app.connect`,nA=e=>eS.pipe(Y(MS(1)),Y(FS(e))),rA=e=>q(nA(e)),iA=tS.pipe(Y(AS()),Y(hS(Number.isSafeInteger,{message:`Expected a safe integer`}))),aA=iA.pipe(Y(DS(0))),oA=iA.pipe(Y(ES(0))),sA=J({appId:nA(160),releaseId:nA(160),surfaceId:nA(160)}),cA=J({editing:nS,surface:sS([nA(160),Qx])}),lA=sS([J({kind:Xx(`compose`),requestId:nA(160),text:nA(2e3)}),J({kind:Xx(`navigate`),requestId:nA(160),params:aS(J({key:nA(64),value:nA(4096)})).pipe(Y(FS(16)))})]),uA=Yx(cS([`granted`,`missing`])),dA=J({"agent.list":uA,"agent.manage":uA,"agent.read":uA,"agent.send":uA,"computer.list":uA,"computer.readFile":uA,"computer.writeFile":uA,"computer.execute":uA,"git.repository":uA,"workflow.publish":uA,"workflow.arm":uA,"workflow.run":uA,"app.events.emit":uA,"llm.generation":uA,"media.generation":uA,"media.share":uA}),fA=cS([`ready`,`missing`,`unknown`]),pA=J({models:fA,media:fA,git:fA,terminal:cS([`ready`,`exec-only`,`missing`,`unknown`]),terminalReason:q(eS)}),mA=cS([`model`,`media`,`git`,`computer`]),hA=cS([`opened`,`unavailable`]),gA=J({computerId:sS([nA(256),Qx]),computerName:q(lS(eS)),teamHasComputers:q(lS(nS)),computerAccessGranted:q(nS),setup:q(pA),permissions:q(dA),focus:cA,openRequest:sS([Qx,lA]),visibility:cS([`visible`,`hidden`])}),_A=cS([`connecting`,`connected`,`suspended`,`disconnected`,`disposing`,`disposed`]),vA=J({altKey:nS,ctrlKey:nS,id:nA(160),key:nA(64),metaKey:nS,shiftKey:nS}),yA=J({action:q(Zx),availability:q(Zx),category:nA(160),description:rA(512),id:nA(160),projections:q(Zx),title:nA(160)}),bA=J({arguments:q(Zx),commandId:nA(321),origin:cS([`agent`,`browser`,`keyboard`,`menu`,`palette`,`programmatic`,`slash`,`terminal`]),requestId:nA(160)}),xA=sS([J({result:q(Zx),status:Xx(`handled`)}),J({error:Zx,status:Xx(`failed`)})]),SA=e=>nA(e).pipe(Y(hS(e=>{for(let t=0;t<e.length;t+=1)if(kE(e.charCodeAt(t)))return!1;return!0},{message:`Expected one line of plain text`}))),CA={id:nA(64),text:SA(80),end:Yx(nS),priority:Yx(Xx(`low`))},wA=Yx(tS.pipe(Y(AS()),Y(kS({minimum:0,maximum:9999})))),TA=aS(sS([J({...CA,kind:Xx(`text`),tone:Yx(cS([`neutral`,`success`,`warning`,`error`]))}),J({...CA,kind:Xx(`button`),icon:Yx(cS([`folder`,`ports`,`processes`,`access`])),count:wA,tone:Yx(cS([`neutral`,`success`,`warning`,`error`])),busy:Yx(nS),title:Yx(SA(1024)),disabled:Yx(nS),opens:Yx(Xx(`dialog`)),expanded:Yx(nS)}),J({...CA,kind:Xx(`toggle`),pressed:nS}),J({...CA,kind:Xx(`menu`),count:wA,title:Yx(SA(1024)),options:aS(J({id:nA(64),text:SA(80),checked:Yx(nS),disabled:Yx(nS)})).pipe(Y(FS(16)),Y(hS(e=>new Set(e.map(e=>e.id)).size===e.length,{message:`Expected unique status option ids`})))})])).pipe(Y(FS(6)),Y(hS(e=>new Set(e.map(e=>e.id)).size===e.length,{message:`Expected unique status item ids`}))),EA=J({computerId:nA(256),path:nA(1024)}),DA=nA(80).pipe(Y(hS(e=>e.trim()===e,{message:`Expected a trimmed title`}))),OA=nA(64),kA=nA(80),AA=e=>new Set(e.map(e=>e.id)).size===e.length,jA=J({id:OA,label:kA,siblings:q(aS(J({id:OA,label:kA})).pipe(Y(FS(16)),Y(hS(AA,{message:`Expected unique crumb sibling ids`}))))}),MA=J({id:OA,label:kA,icon:q(Xx(`play`)),variant:q(cS([`primary`,`outline`,`ghost`])),tone:q(Xx(`destructive`)),disabled:q(nS)}),NA=e=>aS(MA).pipe(Y(FS(e)),Y(hS(AA,{message:`Expected unique header command ids`}))),PA={status:q(aS(J({id:OA,label:kA,presentation:q(Xx(`bead`)),tone:q(cS([`neutral`,`info`,`warning`,`success`,`error`]))})).pipe(Y(FS(4)),Y(hS(AA,{message:`Expected unique header status ids`})))),crumbs:q(aS(jA).pipe(Y(FS(8)),Y(hS(AA,{message:`Expected unique crumb ids`})))),primary:q(NA(3)),menu:q(NA(12))},FA=J({contractVersion:Xx(2),canGoBack:nS,canGoForward:nS,title:q(DA),...PA}),IA=J({canGoBack:nS,canGoForward:nS,title:q(eS),...PA}),LA=sS([J({kind:Xx(`crumb`),crumbId:OA,siblingId:q(OA)}),J({kind:Xx(`action`),actionId:OA})]),RA=lS(J({agentId:nA(256),sessionId:nA(256)})),zA=e=>q(aS(cS(e)).pipe(Y(FS(e.length)))),BA=J({agents:q(aS(cS([`agent.list`,`agent.manage`,`agent.read`,`agent.send`])).pipe(Y(FS(4)))),computers:q(aS(cS([`computer.list`,`computer.readFile`,`computer.writeFile`,`computer.execute`])).pipe(Y(FS(4)))),git:zA([`git.repository`]),workflows:zA([`workflow.publish`,`workflow.arm`,`workflow.run`]),events:zA([`app.events.emit`]),generation:zA([`llm.generation`,`media.generation`,`media.share`])}),VA=cS([`granted`,`declined`,`customize`]),HA=J({message:nA(512),tone:q(cS([`info`,`success`,`warning`,`error`]))}),UA=cS(eC);J({code:UA.pick([`DELIVERY_PENDING`])});var WA=J({code:UA,message:nA(512),retryable:nS,need:Yx(GS)}),GA=sS([J({protocolVersion:Xx(3),type:Xx($k)}),J({protocolVersion:Xx(2),type:Xx(eA)})]),KA=J({epoch:nA(160),protocolVersion:cS(Qk),type:Xx(tA)}),qA=J({epoch:nA(160),protocolVersion:cS(Qk)}),JA={[Symbol.dispose]:q(Zx)},YA=sS([J({...JA,ok:Xx(!0),value:Zx}),J({...JA,error:WA,ok:Xx(!1)})]);function XA(e,t,n=`PROTOCOL`){return kc(Kx(e,{onExcessProperty:`error`}),zd({onFailure:e=>{throw new X(`The peer sent malformed protocol data`,{cause:e,code:n,retryable:!1})},onSuccess:t}))}function ZA(e){return Object.freeze(e)}function QA(e,t){let n=e.arguments===void 0?void 0:$o(e.arguments),r={origin:e.origin,signal:t};return n!==void 0&&Object.assign(r,{arguments:n}),ZA(r)}var $A=XA(yA,e=>{let t={category:e.category,id:e.id,title:e.title};return e.action!==void 0&&Object.assign(t,{action:e.action}),e.availability!==void 0&&Object.assign(t,{availability:e.availability}),e.description!==void 0&&Object.assign(t,{description:e.description}),e.projections!==void 0&&Object.assign(t,{projections:e.projections}),ZA(Wj(()=>fs(t)))},`INVALID_ARGUMENT`),ej=XA(nA(321),e=>e),tj=XA(bA,e=>{let t=e.arguments===void 0?void 0:$o(e.arguments),n={commandId:e.commandId,origin:e.origin,requestId:e.requestId};return t!==void 0&&Object.assign(n,{arguments:t}),ZA(n)}),nj=XA(sS([$x,Zx]),e=>e===void 0?void 0:$o(e)),rj=XA(KA,e=>ZA(e));XA(qA,e=>ZA(e));var ij=XA(gA,e=>{let t={computerId:e.computerId,focus:ZA({...e.focus}),openRequest:e.openRequest===null?null:ZA({...e.openRequest}),visibility:e.visibility};return e.teamHasComputers!==void 0&&(t.teamHasComputers=e.teamHasComputers),e.computerName!==void 0&&(t.computerName=e.computerName),e.computerAccessGranted!==void 0&&(t.computerAccessGranted=e.computerAccessGranted),e.setup!==void 0&&(t.setup=ZA({...e.setup})),e.permissions!==void 0&&(t.permissions=ZA({...e.permissions})),ZA(t)}),aj=XA(WA,e=>ZA({...e})),oj=XA(cA,e=>ZA({...e}),`INVALID_ARGUMENT`),sj=XA(sA,e=>ZA({...e})),cj=XA(_A,e=>e),lj=XA(TA,e=>ZA(e.map(e=>e.kind===`menu`?ZA({...e,options:ZA(e.options.map(e=>ZA(e)))}):ZA(e))),`INVALID_ARGUMENT`),uj=XA(J({itemId:nA(64),optionId:Yx(nA(64)),anchor:Yx(J({start:tS.pipe(Y(kS({minimum:0,maximum:1e5}))),width:tS.pipe(Y(kS({minimum:0,maximum:1e5})))}))}),e=>ZA(e.anchor===void 0?{...e}:{...e,anchor:ZA({...e.anchor})}),`INVALID_ARGUMENT`),dj=XA(EA,e=>ZA({...e}),`INVALID_ARGUMENT`);function fj(e){let t={id:e.id,label:e.label};return e.presentation!==void 0&&(t={...t,presentation:e.presentation}),e.tone!==void 0&&(t={...t,tone:e.tone}),ZA(t)}function pj(e){let t={id:e.id,label:e.label};return e.siblings===void 0?ZA(t):ZA({...t,siblings:ZA(e.siblings.map(e=>ZA({...e})))})}function mj(e){let t={id:e.id,label:e.label};return e.icon!==void 0&&(t={...t,icon:e.icon}),e.variant!==void 0&&(t={...t,variant:e.variant}),e.tone!==void 0&&(t={...t,tone:e.tone}),e.disabled!==void 0&&(t={...t,disabled:e.disabled}),ZA(t)}function hj(e){let t={canGoBack:e.canGoBack,canGoForward:e.canGoForward};return e.title!==void 0&&(t={...t,title:e.title}),e.crumbs!==void 0&&(t={...t,crumbs:ZA(e.crumbs.map(pj))}),e.primary!==void 0&&(t={...t,primary:ZA(e.primary.map(mj))}),e.menu!==void 0&&(t={...t,menu:ZA(e.menu.map(mj))}),e.status!==void 0&&(t={...t,status:ZA(e.status.map(fj))}),ZA(t)}var gj=XA(FA,hj,`INVALID_ARGUMENT`),_j=XA(IA,e=>{let t=e.title?.trim();return vj({...hj({...e,title:t===void 0||t.length===0?void 0:t}),contractVersion:2})},`INVALID_ARGUMENT`),vj=XA(FA,e=>ZA({...hj(e),contractVersion:2}),`INVALID_ARGUMENT`),yj=XA(LA,e=>e.kind===`action`?ZA({...e}):ZA(e.siblingId===void 0?{kind:e.kind,crumbId:e.crumbId}:e),`INVALID_ARGUMENT`),bj=XA(RA,e=>e===null?null:ZA({...e}),`INVALID_ARGUMENT`),xj=XA(BA,e=>ZA({agents:ZA([...new Set(e.agents??[])]),computers:ZA([...new Set(e.computers??[])]),...e.git&&{git:ZA([...new Set(e.git)])},...e.workflows&&{workflows:ZA([...new Set(e.workflows)])},...e.events&&{events:ZA([...new Set(e.events)])},...e.generation&&{generation:ZA([...new Set(e.generation)])}}),`INVALID_ARGUMENT`),Sj=XA(mA,e=>e,`INVALID_ARGUMENT`);XA(GA,e=>ZA(e));var Cj=XA(nA(512),e=>e),wj=XA(HA,e=>ZA({...e}),`INVALID_ARGUMENT`);XA(J({id:nA(160),repeat:nS}),e=>ZA(e));var Tj=XA(aS(vA).pipe(Y(FS(64))),e=>{if(new Set(e.map(e=>e.id)).size!==e.length)throw new X(`Reserved chords are invalid`,{code:`PROTOCOL`,retryable:!1});return ZA(e.map(e=>ZA({...e})))});function Ej(e){return XA(J({value:Zx,version:aA}),t=>ZA({value:e(t.value),version:t.version}))}var Dj=Ej(ij),Oj=XA(J({capabilities:aS(Zx).pipe(Y(FS(128))),context:Zx}),e=>ZA({capabilities:ZA(e.capabilities.map(e=>Pj(e))),context:Dj(e.context)})),kj=Ej(cj),Aj=Ej(Tj),jj=Ej(Cj),Mj=kc(kj,e=>{if(e.value!==`connected`&&e.value!==`suspended`)throw new X(`The host lifecycle is invalid`,{code:`PROTOCOL`,retryable:!1});return ZA({value:e.value,version:e.version})});function Nj(e){return XA(J({handle:Zx,id:nA(160),version:oA}),t=>{if(!(t.handle instanceof EE)&&!(e&&t.handle instanceof DE))throw new X(`A capability handle is invalid`,{code:`PROTOCOL`,retryable:!1});return ZA({handle:t.handle,id:t.id,version:t.version})})}var Pj=Nj(!1),Fj=Nj(!0);function Ij(e){let t=e?Fj:Pj;return XA(J({capabilities:aS(Zx).pipe(Y(FS(128))),context:Zx,identity:Zx,lifecycle:Zx,reservedChords:Zx,theme:Zx}),e=>ZA({capabilities:ZA(e.capabilities.map(e=>t(e))),context:Dj(e.context),identity:sj(e.identity),lifecycle:Mj(e.lifecycle),reservedChords:Aj(e.reservedChords),theme:jj(e.theme)}))}var Lj=Ij(!1);Ij(!0);function Rj(e){return XA(YA,t=>t.ok?ZA({ok:!0,value:e(t.value)}):ZA({ok:!1,error:aj(t.error)}))}var zj=Rj(Lj),Bj=Rj(XA(J({commandId:nA(321)}),e=>ZA(e)));Rj(XA(xA,e=>{if(e.status===`failed`)return ZA({status:`failed`,error:Wj(()=>ts(e.error))});let t=e.result===void 0?void 0:$o(e.result);return ZA(t===void 0?{status:`handled`}:{status:`handled`,result:t})}));var Vj=Rj(XA($x,()=>void 0)),Hj=Rj(XA(VA,e=>e)),Uj=Rj(XA(hA,e=>e));Rj(XA(nS,e=>e)),Rj(XA(nS,e=>e));function Wj(e){try{return e()}catch(e){throw new X(`The command metadata is invalid`,{cause:e,code:`INVALID_ARGUMENT`,retryable:!1})}}var Gj=sS([J({kind:Xx(`saveFile`),name:nA(255).pipe(Y(vS(/^[^\p{Cc}/\\]+$/u))),mime:nA(255),bytes:US}),J({kind:Xx(`copyText`),text:eS})]);function Kj(e){let t=Kx(Gj,{onExcessProperty:`error`})(e);if(Id(t))return{kind:`refused`,reason:`invalid-request`};let n=t.success;return n.kind===`saveFile`?n.name===`.`||n.name===`..`?{kind:`refused`,reason:`invalid-request`}:n.bytes.byteLength>33554432?{kind:`refused`,reason:`too-large`}:{...n,bytes:new Uint8Array(n.bytes)}:n.text.length>1048576||new TextEncoder().encode(n.text).byteLength>1048576?{kind:`refused`,reason:`too-large`}:n}var qj=Rj(XA(sS([J({kind:Xx(`saved`)}),J({kind:Xx(`copied`)}),J({kind:Xx(`refused`),reason:cS([`no-user-gesture`,`too-large`,`invalid-request`,`unavailable`,`denied`,`busy`])})]),e=>ZA(e)));function Jj(e){return e instanceof X?{code:e.code,message:Xj(e.message),retryable:e.retryable,...e.need!==void 0&&{need:e.need}}:{code:`HOST_FAILURE`,message:`Host operation failed`,retryable:!1}}function Yj(e){try{let t=aj(e);return new X(t.message,{code:t.code,retryable:t.retryable,...t.need!==void 0&&{need:t.need}})}catch(e){return new X(`The host returned a malformed error`,{cause:e,code:`PROTOCOL`,retryable:!1})}}function Xj(e){return e.trim().slice(0,512)||`Host operation failed`}var Zj=e=>({ok:!0,value:e}),Qj=e=>({error:Jj(e),ok:!1});async function $j(e,t){let n,r=new Set;try{return n=await e,eM(t(n))}catch(e){throw tM(e)&&nM(e,r),e instanceof X?e:new X(`The remote operation failed`,{cause:e,code:`HOST_FAILURE`,retryable:!0})}finally{n!==e&&tM(n)&&nM(n,r)}}function eM(e){if(e.ok)return e.value;throw Yj(e.error)}function tM(e){return Kc(e)&&Symbol.dispose in e&&Hc(e[Symbol.dispose])}function nM(e,t){if(!t.has(e)){t.add(e);try{e[Symbol.dispose]()}catch(e){console.warn(`RPC result disposal failed`,e)}}}function rM(){let e=[],t=new Set;return{get:()=>e,subscribe:e=>(t.add(e),()=>t.delete(e)),update:n=>{e=n;for(let e of Array.from(t))try{e()}catch(e){console.warn(`App binding subscriber failed`,e)}}}}function iM(e){let t=Tj(e),n=new Set;return{get:()=>t,subscribe:e=>(n.add(e),()=>n.delete(e)),update:e=>{t=Tj(e);for(let e of Array.from(n))try{e()}catch(e){console.warn(`Reserved chord subscriber failed`,e)}}}}function aM(e){let t=!0,n,r=e.window.document.querySelector(`html`);if(!r)return()=>{t=!1};let i=Xk(r),a=new fk(i);Mk(a),Rk(a),a.prependEventMatchResolver(Zk);let o=sM(e.onBroken),s=dM(a,e.chords,e.remote,o),c=oM(e,o,()=>t,e=>{n=e},()=>n),l=i.onFocusChange(()=>{queueMicrotask(c)}),u=e=>()=>{queueMicrotask(()=>{c(e)})},d=u(!0),f=u(!1),p=()=>{let t=e.window.document.activeElement?.tagName;t!==`IFRAME`&&t!==`FRAME`&&t!==`OBJECT`&&t!==`EMBED`&&f()};e.window.addEventListener(`focus`,d),e.window.addEventListener(`blur`,p);let m=e.bindings,h=()=>cM(e.window.document,e.identity.surfaceId).editing,g=m===void 0?()=>void 0:lM(a,m,h),_=m===void 0?()=>void 0:m.subscribe(()=>{g(),g=lM(a,m,h)}),v=e.chords.subscribe(()=>{s(),s=dM(a,e.chords,e.remote,o)});return queueMicrotask(c),()=>{t&&(t=!1,l(),e.window.removeEventListener(`focus`,d),e.window.removeEventListener(`blur`,p),v(),s(),_(),g())}}function oM(e,t,n,r,i){return a=>{if(!n())return;let o=cM(e.window.document,e.identity.surfaceId),s=a===void 0?o:oj({editing:o.editing,surface:a?e.identity.surfaceId:null}),c=i();(a===!0||s.editing!==c?.editing||s.surface!==c.surface)&&(r(s),t(()=>e.remote.reportFocus(s)))}}function sM(e){return t=>{try{$j(t(),Vj).catch(t=>{nT(`browser-bridge.host-call`,t),e(t)})}catch(t){nT(`browser-bridge.host-call`,t),e(t)}}}function cM(e,t){let n=e.activeElement;return oj({editing:!!(n?.matches(`input, textarea, select, [contenteditable='true']`)===!0||n?.closest(`[contenteditable='true']`)),surface:e.hasFocus()?t:null})}function lM(e,t,n){let r=t.get();return e.registerLayer({bindings:r.map((e,t)=>({cmd:`app/${String(t)}`,key:e.key})),commands:r.map((e,t)=>({name:`app/${String(t)}`,run:t=>{let r=t.event.originalEvent;if(r?.defaultPrevented||r?.isComposing||uM(e.key)&&n())return!1;e.run()}})),priority:500})}function uM(e){return!/(?:^|\+)(?:ctrl|control|super|meta|cmd|alt|option|mod)\+/iu.test(e)}function dM(e,t,n,r){let i=t.get();return e.registerLayer({bindings:i.map(e=>({cmd:`reserved/${e.id}`,key:{ctrl:e.ctrlKey,meta:e.altKey,name:qk(e.key),shift:e.shiftKey,super:e.metaKey}})),commands:i.map(e=>({name:`reserved/${e.id}`,run:t=>{let i=t.event.originalEvent;if(i?.defaultPrevented||i?.isComposing)return!1;r(()=>n.invokeReservedChord(e.id,i?.repeat??!1))}})),priority:1e3})}function fM(e){let t=t=>{if(t.defaultPrevented||t.isComposing)return;let n=hM(t,e.mac);n!==null&&(t.preventDefault(),!t.repeat&&(n===`back`&&e.canGoBack()&&e.back(),n===`forward`&&e.canGoForward()&&e.forward()))},n=t=>{let n=mM(t.button);if(n===null)return;let r=t.defaultPrevented;t.preventDefault(),!(t.type!==`mouseup`||r)&&(n===`back`&&e.canGoBack()&&e.back(),n===`forward`&&e.canGoForward()&&e.forward())};e.window.addEventListener(`keydown`,t);for(let t of pM)e.window.addEventListener(t,n);return()=>{e.window.removeEventListener(`keydown`,t);for(let t of pM)e.window.removeEventListener(t,n)}}var pM=[`mousedown`,`mouseup`,`auxclick`];function mM(e){return e===3?`back`:e===4?`forward`:null}function hM(e,t){return e.shiftKey||e.ctrlKey?null:t?!e.metaKey||e.altKey?null:e.key===`[`?`back`:e.key===`]`?`forward`:gM(e.target)?null:e.key===`ArrowLeft`?`back`:e.key===`ArrowRight`?`forward`:null:!e.altKey||e.metaKey?null:e.key===`ArrowLeft`?`back`:e.key===`ArrowRight`?`forward`:null}function gM(e){return e instanceof HTMLElement?e.isContentEditable||e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement||e instanceof HTMLSelectElement:!1}function _M(){return!Uc(globalThis.navigator)&&/Mac|iPhone|iPad/u.test(globalThis.navigator.userAgent)}function vM(e){let t=e,n=new Set;return{get:()=>t,subscribe(e){n.add(e);let t=!0;return()=>{t&&(t=!1,n.delete(e))}},update(e){if(!Object.is(t,e)){t=e;for(let e of Array.from(n))try{e(t)}catch(e){console.warn(`App store subscriber failed`,e)}}}}}function yM(e){let t=new Map,n=vM(0),r=!1,i=e=>{let t=new Map;try{for(let n of e){let e=Pj(n),r=wM(e.id,e.version);if(t.has(r))throw xM(e.handle),new X(`Duplicate capability grant`,{code:`PROTOCOL`,retryable:!1});t.set(r,e.handle)}}catch(e){for(let e of t.values())xM(e);throw e}return t};for(let[n,r]of i(e))t.set(n,r);let a=e=>{for(let t of e)xM(t)},o=e=>{if(r)throw new X(`The app connection is disposed`,{code:`DISCONNECTED`,retryable:!0});let n=wM(e.id,e.version);return t.get(n)};return{directory:Object.freeze({get version(){return n.get()},subscribe:e=>n.subscribe(e),has(e){return!!o(e)},require(e){let t=o(e);if(!t)throw new X(`The capability is not granted`,{code:`CAPABILITY_DENIED`,retryable:!1});try{return e.schema.parse(t)}catch(e){throw new X(`The capability interface is malformed`,{cause:e,code:`PROTOCOL`,retryable:!1})}}}),replace(e){if(r)throw new X(`The app connection is disposed`,{code:`DISCONNECTED`,retryable:!0});let o=i(e),s=[...t.values()];t.clear();for(let[e,n]of o)t.set(e,n);a(s.filter(e=>![...o.values()].includes(e))),n.update(n.get()+1)},disconnect(){r||(r=!0,a(t.values()),t.clear(),n.update(n.get()+1))}}}var bM=Ka().transform(e=>{let t=qo(Object).safeParse(e);if(!t.success)return;let n=Object.create(t.data),r=qx(J({[Symbol.dispose]:q(pS(Function))}))(n);return{owner:t.data,dispose:r[Symbol.dispose]}});function xM(e){try{let t=bM.parse(e);if(t===void 0||CM.has(t.owner))return;CM.add(t.owner),t.dispose?.call(t.owner)}catch(e){console.warn(`RPC value disposal failed`,e)}}function SM(e){return{value:e,[Symbol.dispose](){xM(e)}}}var CM=new WeakSet;function wM(e,t){return`${e}@${String(t)}`}var TM=`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(`.`),EM=`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 DM(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 OM(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=[DM(TM)];for(let e=1;e<t;e++)r.push(DM(EM));return r.join(n)}var kM=[];for(let e=0;e<256;++e)kM.push((e+256).toString(16).slice(1));function AM(e,t=0){return(kM[e[t+0]]+kM[e[t+1]]+kM[e[t+2]]+kM[e[t+3]]+`-`+kM[e[t+4]]+kM[e[t+5]]+`-`+kM[e[t+6]]+kM[e[t+7]]+`-`+kM[e[t+8]]+kM[e[t+9]]+`-`+kM[e[t+10]]+kM[e[t+11]]+kM[e[t+12]]+kM[e[t+13]]+kM[e[t+14]]+kM[e[t+15]]).toLowerCase()}var jM,MM=new Uint8Array(16);function NM(){if(!jM){if(typeof crypto>`u`||!crypto.getRandomValues)throw Error(`crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported`);jM=crypto.getRandomValues.bind(crypto)}return jM(MM)}var PM={randomUUID:typeof crypto<`u`&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function FM(e,t,n){if(PM.randomUUID&&!t&&!e)return PM.randomUUID();e||={};let r=e.random??e.rng?.()??NM();if(r.length<16)throw Error(`Random bytes length must be >= 16`);if(r[6]=r[6]&15|64,r[8]=r[8]&63|128,t){if(n||=0,n<0||n+16>t.length)throw RangeError(`UUID byte range ${n}:${n+15} is out of buffer bounds`);for(let e=0;e<16;++e)t[n+e]=r[e];return t}return AM(r)}U().regex(/^replay_[a-f0-9]{64}$/);var IM=ya({version:`v4`}),LM=Wo(e=>IM.safeParse(e).success);function RM(){return LM.parse(FM())}var zM=class extends DE{#e=!0;#t;#n=new Map;constructor(e){super(),this.#t=e}cancel(e){try{return this.#n.get(ej(e))?.abort(),Promise.resolve(Zj(void 0))}catch(e){return Promise.resolve(Qj(e))}}dispose(){if(this.#e){this.#e=!1;for(let e of this.#n.values())e.abort();this.#n.clear()}}async invoke(e){try{if(!this.#e)throw new X(`The command is disposed`,{code:`DISCONNECTED`,retryable:!0});let t=tj(e);if(this.#n.has(t.requestId))throw new X(`Duplicate command request`,{code:`PROTOCOL`,retryable:!1});if(this.#n.size>=64)throw new X(`Too many command requests`,{code:`HOST_FAILURE`,retryable:!0});let n=new AbortController;this.#n.set(t.requestId,n);try{let e=nj(await this.#t(QA(t,n.signal)));return Zj(e===void 0?{status:`handled`}:{status:`handled`,result:e})}finally{this.#n.delete(t.requestId)}}catch(e){if(e instanceof xs)try{return Zj({status:`failed`,error:ts({code:e.code,message:e.message,details:e.details})})}catch(e){return Qj(e)}return Qj(e)}}[Symbol.dispose](){this.dispose()}};function BM(e){let t=[];for(let n of e.values()){let{commandId:e,definition:r,target:i}=n;if(e===void 0)continue;let a=r.availability?.status!==`unavailable`;for(let n of r.projections?.bindings?.values??[])n.trim().includes(` `)||n.startsWith(`<`)||t.push({key:n,run:()=>{a&&Promise.resolve().then(async()=>{let t=eM(await i.invoke({commandId:e,origin:`keyboard`,requestId:RM()}));if(t.status===`failed`)throw new xs(t.error.code,t.error.message,t.error.details)}).catch(e=>{console.warn(`App key command failed`,e)})}})}return t}function VM(e,t,n,r){let i=new Map,a=!1,o=()=>{r?.update(a?[]:BM(i))},s=e=>{try{n()}catch(t){console.warn(`App command failure callback failed`,t,e)}},c=e=>{try{$j(e(),Vj).catch(e=>{s(e)})}catch(e){console.warn(`App command RPC supervision failed`,e),s(e)}};return{commands:UM(e,t,i,()=>a,t=>{let n=i.get(t);if(!n)return;i.delete(t),n.target.dispose(),o();let r=n.commandId;!a&&r!==void 0&&c(()=>e.unregisterCommand(r))},o),dispose(){if(!a){a=!0;for(let e of i.values())e.target[Symbol.dispose]();i.clear(),o()}}}}function HM(e,t,n){let r=t.id;if(e.size>=128||e.has(r))throw n.dispose(),new X(`Command registration is unavailable`,{code:`INVALID_ARGUMENT`,retryable:!1});let i={commandId:void 0,definition:t,target:n};e.set(r,i);let a=!1;return{commit(e){a||(i.commandId=e)},release(){a||(a=!0,e.get(r)===i&&e.delete(r),n.dispose())},target:n}}function UM(e,t,n,r,i,a){return Object.freeze({async register(o,s){if(t(),!Hc(s))throw new X(`Command handler must be a function`,{code:`INVALID_ARGUMENT`,retryable:!1});let c=$A(o),l=new zM(s),u=HM(n,c,l);try{let t=await WM(e,c,u.target);r()&&await GM(e,t.commandId,l),u.commit(t.commandId),a()}catch(e){throw u.release(),e}let d=!0;return()=>{d&&(d=!1,i(c.id))}}})}async function WM(e,t,n){return $j(e.registerCommand(t,n),Bj)}async function GM(e,t,n){throw n.dispose(),await $j(e.unregisterCommand(t),Vj),new X(`The command controller is disposed`,{code:`DISCONNECTED`,retryable:!0})}var KM=Fx(e=>e instanceof EE),qM=class extends DE{#e=!1;#t;constructor(e){super(),this.#t=e}disconnect(e){try{if(this.#e)throw iN();let t=e===void 0?void 0:aj(e);return setTimeout(()=>this.#t.disconnect?.(t??cN()),0),Promise.resolve(Zj(void 0))}catch(e){return Promise.resolve(Qj(e))}}async requestClose(){try{if(this.#e)throw iN();return Zj(await(this.#t.beforeClose?.()??!0))}catch(e){return Qj(e)}}async requestBack(){try{if(this.#e)throw iN();return Zj(await(this.#t.back?.()??!1))}catch(e){return Qj(e)}}async requestForward(){try{if(this.#e)throw iN();return Zj(await(this.#t.forward?.()??!1))}catch(e){return Qj(e)}}async activateNavigation(e){try{if(this.#e)throw iN();let t=yj(e);return ME(this.#t.navigation,t)?Zj(await(this.#t.activate?.(t)??!1)):Zj(!1)}catch(e){return Qj(e)}}async activateStatus(e){try{if(this.#e)throw iN();let t=uj(e);return jE(this.#t.statusItems,t)?Zj(await(this.#t.statusAction?.(t)??!1)):Zj(!1)}catch(e){return Qj(e)}}[Symbol.dispose](){this.#e=!0}async updateContext(e){return this.#e?Qj(iN()):this.#n(e,`context`,ij,e=>{this.#t.context.update(e)})}reconfigure(e){let t=[];try{if(this.#e)throw iN();let n=Oj(e);if(n.context.version<=this.#t.versions.context)return Promise.resolve(Zj(void 0));for(let e of n.capabilities)t.push({...e,handle:qx(KM)(e.handle).dup()});if(!this.#t.capabilities)throw iN();return this.#t.capabilities.replace(t),t=[],this.#t.versions.context=n.context.version,this.#t.context.update(n.context.value),Promise.resolve(Zj(void 0))}catch(e){for(let e of t)xM(e.handle);return Promise.resolve(Qj(e))}}updateLifecycle(e){try{if(this.#e)throw iN();let t=Ej(cj)(e);if(t.version<=this.#t.versions.lifecycle)return Promise.resolve(Zj(void 0));if(!lN(this.#t.lifecycle.get(),t.value))throw new X(`The host sent an invalid lifecycle transition`,{code:`PROTOCOL`,retryable:!1});return this.#t.versions.lifecycle=t.version,this.#t.lifecycle.update(t.value),Promise.resolve(Zj(void 0))}catch(e){return Promise.resolve(Qj(e))}}async updateReservedChords(e){return this.#e?Qj(iN()):this.#n(e,`chords`,Tj,e=>{this.#t.chords.update(e)})}async updateTheme(e){return this.#e?Qj(iN()):this.#n(e,`theme`,Cj,e=>{this.#t.theme.update(e)})}#n(e,t,n,r){try{let i=Ej(n)(e);return i.version>this.#t.versions[t]&&(this.#t.versions[t]=i.version,r(i.value)),Promise.resolve(Zj(void 0))}catch(e){return Promise.resolve(Qj(e))}}};async function JM(e){let t=QM(),n=new qM(t),r=OE(e.port,n),i,a=ZM(r);try{performance.mark(`fungi.app-open.agar-rpc-connect-start`);let o=await Promise.race([r.connect({epoch:e.epoch,protocolVersion:e.protocolVersion}),a]);performance.mark(`fungi.app-open.agar-rpc-connect-ready`),i=o;let s=eM(zj(o));if(!e.isActive())throw XM();let c=$M({bootstrap:s,bootstrapOwner:i,options:e,remote:r,state:t,target:n});return performance.mark(`fungi.app-open.agar-root-created`),i=void 0,c}catch(t){return dN(t,e,n,r,i)}}function YM(e,t){e.context.update(t.context.value),e.theme.update(t.theme.value),e.lifecycle.update(t.lifecycle.value),e.chords.update(t.chords.value),e.versions.context=t.context.version,e.versions.theme=t.theme.version,e.versions.lifecycle=t.lifecycle.version,e.versions.chords=t.chords.version}function XM(){return new X(`App connection was cancelled`,{code:`CANCELLED`,retryable:!1})}function ZM(e){let t,n=new Promise((e,n)=>{t=n});return n.catch(e=>{nT(`app-session.rpc-disconnect`,e)}),e.onRpcBroken(()=>t?.(new X(`The app host disconnected`,{code:`DISCONNECTED`,retryable:!0}))),n}function QM(){return{statusItems:[],navigation:{canGoBack:!1,canGoForward:!1},bindings:rM(),chords:iM([]),context:vM({computerId:null,focus:{editing:!1,surface:null},openRequest:null,visibility:`hidden`}),lifecycle:vM(`connecting`),theme:vM(`default`),canGoBack:!1,canGoForward:!1,versions:{chords:-1,context:-1,lifecycle:-1,theme:-1}}}function $M(e){let t=sj(e.bootstrap.identity),n=uN(e.bootstrap);YM(e.state,n);let r=yM(e.bootstrap.capabilities);return e.state.capabilities=r,tN(e,t,r)}function eN(e,t,n){return aM({bindings:e.state.bindings,chords:e.state.chords,identity:t,onBroken:e=>{n({code:`DISCONNECTED`,message:e instanceof X?e.message:`The app host rejected a browser bridge operation`,retryable:!0})},remote:e.remote,window:e.options.window})}function tN(e,t,n){let r=!1,i=t=>{r||(r=!0,oN([()=>{t&&e.state.lifecycle.update(`disconnected`)},()=>{e.state.lifecycle.update(`disposing`)},l,u,()=>{o.dispose()},()=>{e.state.beforeClose=void 0,e.state.back=void 0,e.state.forward=void 0,e.state.activate=void 0,e.state.statusAction=void 0},()=>{n.disconnect()},()=>{e.target[Symbol.dispose]()},()=>{xM(e.bootstrapOwner)},()=>{xM(e.remote)},()=>{e.options.port.close()},()=>{e.state.lifecycle.update(`disposed`)},e.options.onDisposed],`app connection disposal`))},a=()=>{if(r)throw new X(`The app connection is disposed`,{code:`DISCONNECTED`,retryable:!0})},o=VM(e.remote,a,()=>{i({code:`DISCONNECTED`,message:`The app host rejected a terminal command operation`,retryable:!0})},e.state.bindings),s=rN(e.remote,a,e.state),c=nN(e.state,e.remote,a),l=eN(e,t,i),u=fM({window:e.options.window,mac:_M(),canGoBack:()=>e.state.canGoBack&&e.state.back!==void 0,back:()=>{let t=e.state.back;t&&Promise.resolve().then(t).catch(e=>{nT(`app-window.back-input`,e)})},canGoForward:()=>e.state.canGoForward&&e.state.forward!==void 0,forward:()=>{let t=e.state.forward;t&&Promise.resolve().then(t).catch(e=>{nT(`app-window.forward-input`,e)})}});return e.state.disconnect=i,e.remote.onRpcBroken(()=>{aN(i)}),sN({capabilities:n.directory,commands:o.commands,context:e.state.context,dispose:i,identity:t,lifecycle:e.state.lifecycle,theme:e.state.theme,ui:s,window:c})}function nN(e,t,n){let r=Object.freeze({async publish(r){n();let i=_j(r);e.canGoBack=i.canGoBack,e.canGoForward=i.canGoForward,e.navigation=gj(i),await $j(t.reportNavigation(i),Vj)},onActivate(t){if(n(),e.activate!==void 0)throw new X(`The App already owns navigation activations`,{code:`INVALID_ARGUMENT`,retryable:!1});e.activate=t;let r=!1;return()=>{r||(r=!0,e.activate===t&&(e.activate=void 0))}},onForward(t){if(n(),e.forward!==void 0)throw new X(`The App already owns Forward requests`,{code:`INVALID_ARGUMENT`,retryable:!1});e.forward=t;let r=!1;return()=>{r||(r=!0,e.forward===t&&(e.forward=void 0))}},onBack(t){if(n(),e.back!==void 0)throw new X(`The App already owns Back requests`,{code:`INVALID_ARGUMENT`,retryable:!1});e.back=t;let r=!1;return()=>{r||(r=!0,e.back===t&&(e.back=void 0))}}});return Object.freeze({navigation:r,onBeforeClose(t){if(n(),e.beforeClose!==void 0)throw new X(`The App already owns a close consultation`,{code:`INVALID_ARGUMENT`,retryable:!1});e.beforeClose=t;let r=!1;return()=>{r||(r=!0,e.beforeClose===t&&(e.beforeClose=void 0))}}})}function rN(e,t,n){return Object.freeze({async requestComputerChoice(){t(),await $j(e.requestComputerChoice(),Vj)},async requestBrowserAction(n){t();let r=Kj(n);return r.kind===`refused`?r:await $j(e.requestBrowserAction(r),qj)},onStatusAction(e){if(t(),n.statusAction!==void 0)throw new X(`The App already owns its status actions`,{code:`INVALID_ARGUMENT`,retryable:!1});n.statusAction=e;let r=!1;return()=>{r||(r=!0,n.statusAction===e&&(n.statusAction=void 0))}},async requestAppPermissions(n){return t(),await $j(e.requestAppPermissions(xj(n)),Hj)},async openDesktopSettings(){t(),await $j(e.openDesktopSettings(),Vj)},async openSetup(n){return t(),await $j(e.openSetup(Sj(n)),Uj)},async openTeamBilling(){t(),await $j(e.openTeamBilling(),Vj)},async openNavigation(n){t(),await $j(e.openNavigation(dj(n)),Vj)},async reportStatus(r){t();let i=lj(r);n.statusItems=i,await $j(e.reportStatus(i),Vj)},async reportAgentSessionSelection(n){t(),await $j(e.reportAgentSessionSelection(bj(n)),Vj)},async showToast(n){t(),await $j(e.showToast(wj(n)),Vj)}})}function iN(){return new X(`The app connection is disposed`,{code:`DISCONNECTED`,retryable:!0})}function aN(e){e({code:`DISCONNECTED`,message:`The app host disconnected`,retryable:!0})}function oN(e,t){for(let n of e)try{n()}catch(e){console.warn(`${t} cleanup failed`,e)}}function sN(e){return Object.freeze(e)}function cN(){return{code:`DISCONNECTED`,message:`The app host disconnected`,retryable:!1}}function lN(e,t){return e===t||e===`connected`&&t===`suspended`||e===`suspended`&&t===`connected`}function uN(e){let t=Ej(ij)(e.context),n=Ej(Cj)(e.theme),r=Ej(cj)(e.lifecycle),i=Ej(Tj)(e.reservedChords);if(r.value!==`connected`&&r.value!==`suspended`)throw new X(`The bootstrap lifecycle is invalid`,{code:`PROTOCOL`,retryable:!1});return{chords:i,context:t,lifecycle:r,theme:n}}function dN(e,t,n,r,i){throw oN([()=>{n[Symbol.dispose]()},()=>{i&&xM(i)},()=>{xM(r)},()=>{t.port.close()},t.onDisposed],`app connection rejection`),e instanceof X?e:new X(`Unable to establish the app RPC session`,{cause:e,code:`PROTOCOL`,retryable:!1})}var fN=!1,pN=class{options;#e;#t;#n=!1;#r;#i;constructor(e){this.options=e,this.#e=globalThis.window}start(){performance.mark(`fungi.app-open.agar-connect-start`);let e=this.#l();return e?Promise.reject(e):(fN=!0,this.#a())}#a(){return new Promise((e,t)=>{let n=(n,a)=>{this.#o(n,a,i,r,e,t)},r=()=>{n(hN())},i=e=>{this.#s(e,n,i)};this.#e.addEventListener(`message`,i),this.options.signal?.addEventListener(`abort`,r,{once:!0});let a=()=>{try{performance.mark(`fungi.app-open.agar-ready-sent`),this.#e.parent.postMessage({protocolVersion:3,type:$k},`*`),this.#e.parent.postMessage({protocolVersion:2,type:eA},`*`)}catch(e){nT(`connect.notify-host`,e),n(xN(e))}};this.#r=setInterval(a,200),this.#i=setTimeout(()=>{n(_N())},1e4),a()})}#o(e,t,n,r,i,a){if(!this.#n){if(this.#n=!0,this.#c(),this.#e.removeEventListener(`message`,n),this.options.signal?.removeEventListener(`abort`,r),e||!t){this.#t?.close(),fN=!1,a(e??_N());return}i(t)}}#s(e,t,n){if(!bN(e.data))return;if(performance.mark(`fungi.app-open.agar-connect-received`),e.source!==this.#e.parent||vN(e.origin)===void 0){t(yN());return}let r=SN(e,t);if(!r)return;let i=e.ports.length===1?e.ports[0]:void 0;if(!i){t(CN(`The app host did not transfer exactly one port`));return}this.#t=i,this.#c(),this.#e.removeEventListener(`message`,n),JM({epoch:r.epoch,protocolVersion:r.protocolVersion,isActive:()=>!this.#n,onDisposed:()=>{fN=!1},port:i,window:this.#e}).then(e=>{performance.mark(`fungi.app-open.agar-root-ready`),t(void 0,e)},e=>{t(gN(e))})}#c(){clearInterval(this.#r),clearTimeout(this.#i),this.#r=void 0,this.#i=void 0}#l(){if(this.options.signal?.aborted)return hN();if(fN)return new X(`An app connection is already live`,{code:`IDENTITY`,retryable:!1});if(Uc(globalThis.window)||this.#e.parent===this.#e)return new X(`The app host is unavailable`,{code:`DISCONNECTED`,retryable:!0})}};function mN(e){return new pN(e).start()}function hN(){return new X(`App connection was cancelled`,{code:`CANCELLED`,retryable:!1})}function gN(e){return e instanceof X?e:new X(`Unable to connect to the app host`,{cause:e,code:`PROTOCOL`,retryable:!1})}function _N(){return new X(`The app host disconnected`,{code:`DISCONNECTED`,retryable:!0})}function vN(e){if(!URL.canParse(e))return;let t=new URL(e).origin;return t===e?t:void 0}function yN(){return new X(`The app connection identity is invalid`,{code:`IDENTITY`,retryable:!1})}var bN=Ux(J({type:Xx(tA)}));function xN(e){return new X(`Unable to notify the app host`,{cause:e,code:`DISCONNECTED`,retryable:!0})}function SN(e,t){try{return rj(e.data)}catch(e){nT(`connect.decode-message`,e),t(e instanceof X?e:new X(`Malformed app connection`,{cause:e,code:`PROTOCOL`,retryable:!1}));return}}function CN(e){return new X(e,{code:`PROTOCOL`,retryable:!1})}function wN(e,t,n){e.style.isolation=`isolate`;let r=(0,tT.createRoot)(e),i=new AbortController,a=e.ownerDocument.documentElement,o=mC(a),s,c,l,u=!1,d=e=>{let i=(0,G.createElement)(TN,{state:e,render:n});r.render(t.queryClient?(0,G.createElement)(yC,{client:t.queryClient},i):i)},f=()=>{l?.(),l=void 0,c?.(),c=void 0;let e=s;s=void 0,e?.dispose(),u&&=(o===null?a.removeAttribute(`data-theme`):pC(o,a),!1)},{defaultView:p}=e.ownerDocument;return performance.mark(`fungi.app-open.react-root-render-start`),p?p.parent===p?d({app:null,status:`standalone`}):(d({app:null,status:`connecting`}),mN({host:`parent`,signal:i.signal}).then(e=>{if(i.signal.aborted){e.dispose();return}s=e;let t=()=>{let t=e.lifecycle.get();return t===`disposing`||t===`disconnected`||t===`disposed`?(f(),d({app:null,status:`ended`}),!0):!1};l=e.lifecycle.subscribe(t),!t()&&(u=!0,pC(e.theme.get(),a),c=e.theme.subscribe(e=>{pC(e,a)}),d({app:e,status:`live`}))}).catch(e=>{i.signal.aborted&&e instanceof X&&e.code===`CANCELLED`||(console.error(`${t.name} host connection failed`,e),f(),i.signal.aborted||d({app:null,status:`not-hosted`,error:e instanceof X?e:new X(`The App host is unavailable`,{cause:e,code:`HOST_FAILURE`,retryable:!0})}))})):d({app:null,status:`not-hosted`,error:new X(`The App document has no window`,{code:`DISCONNECTED`,retryable:!1})}),()=>{i.signal.aborted||(i.abort(),r.unmount(),f())}}function TN({state:e,render:t}){return(0,G.useLayoutEffect)(()=>{performance.mark(`fungi.app-open.react-initial-commit`)},[]),(0,G.useLayoutEffect)(()=>{e.app&&performance.mark(`fungi.app-open.react-connected-commit`)},[e.app]),(0,G.createElement)(G.Fragment,null,e.status===`not-hosted`?(0,G.createElement)(`p`,{role:`alert`},`App host connection unavailable. Open this App through its host to try again.`):null,t(e))}function EN(e){let t=(0,G.useCallback)(t=>e?.subscribe(t)??(()=>void 0),[e]),n=(0,G.useCallback)(()=>e?.get(),[e]);return(0,G.useSyncExternalStore)(t,n,n)}function DN(e){return EN(e?.context)??null}function ON(e){return DN(e)?.computerId??null}function kN(e,t,n,r){let i=(0,G.useRef)(t);i.current=t;let a=(0,G.useRef)(n);a.current=n;let o=(0,G.useRef)(r);o.current=r;let s=JSON.stringify(t),c=n!==void 0;(0,G.useEffect)(()=>{e&&e.ui.reportStatus(i.current).catch(e=>{o.current?o.current(e):console.error(`Window status report failed`,e)})},[e,s]),(0,G.useEffect)(()=>{if(!(!e||!c))return e.ui.onStatusAction(e=>a.current?.(e)??!1)},[e,c]),(0,G.useEffect)(()=>()=>{e?.ui.reportStatus([]).catch(e=>{console.error(`Window status report failed`,e)})},[e])}function AN(e,{sourceId:t,namespace:n},r){let i=(0,G.useMemo)(()=>Cs(),[]),a=(0,G.useMemo)(r,[r]);return(0,G.useEffect)(()=>{let e=i.contribute({sourceId:t,namespace:n,commands:a});return()=>{e.dispose()}},[i,t,n,a]),(0,G.useEffect)(()=>e?vc(e.commands,a):void 0,[e,a]),i}function jN(e,{canGoBack:t,canGoForward:n,title:r,crumbs:i,primary:a,menu:o,status:s,onBack:c,onForward:l,onCrumb:u,onAction:d}){let f=(0,G.useRef)(c),p=(0,G.useRef)(l),m=(0,G.useRef)(u),h=(0,G.useRef)(d);(0,G.useEffect)(()=>{f.current=c,p.current=l,m.current=u,h.current=d},[c,l,u,d]),(0,G.useEffect)(()=>{if(!e)return;let t=e.onBack(()=>f.current()),n=e.onForward(()=>p.current()),r=e.onActivate(e=>{if(e.kind===`action`){let t=h.current;return t?.(e.actionId),t!==void 0}let t=m.current;return e.siblingId===void 0?t?.(e.crumbId):t?.(e.crumbId,e.siblingId),t!==void 0});return()=>{t(),n(),r(),MN(e,{canGoBack:!1,canGoForward:!1})}},[e]);let g=JSON.stringify([i,a,o,s]),_=(0,G.useRef)({crumbs:i,primary:a,menu:o,status:s});(0,G.useEffect)(()=>{_.current={crumbs:i,primary:a,menu:o,status:s}},[i,a,o,s]),(0,G.useEffect)(()=>{if(!e)return;let i={canGoBack:t,canGoForward:n};r!==void 0&&(i={...i,title:r});let a=_.current;a.crumbs!==void 0&&(i={...i,crumbs:a.crumbs}),a.primary!==void 0&&(i={...i,primary:a.primary}),a.menu!==void 0&&(i={...i,menu:a.menu}),a.status!==void 0&&(i={...i,status:a.status}),MN(e,i)},[e,t,n,r,g])}function MN(e,t){e.publish(t).catch(e=>{e instanceof X&&e.code===`DISCONNECTED`||console.warn(`App navigation report failed`,e)})}var NN=class{id;version;#e;constructor(e,t,n){this.id=e,this.version=t,this.#e=n,Object.freeze(this)}get schema(){return this.#e}};function PN(e,t,n){return new NN(e,t,n)}function FN(e){let t=eo(e),n=qo(Object),r=eo(Object.fromEntries(Object.keys(e).map(e=>[e,Ka().optional()])));return Ka().transform(e=>{let i=n.parse(e),a=Object.create(i),o=r.parse(a),s=Object.fromEntries(Object.entries(o).flatMap(([e,t])=>t===void 0?[]:[[e,Ho().parse(t).bind(i)]]));return{...t.parse(s),[Symbol.dispose](){xM(e)}}})}function IN(e){return Ka().transform(t=>{try{return e.parse(t)}catch(e){throw e instanceof X?e:new X(`The capability returned malformed data`,{cause:e,code:`PROTOCOL`,retryable:!1})}finally{xM(t)}})}function LN(e){return Ho({output:Bo(Ka().transform(t=>{try{return e.parse(t)}catch(e){throw xM(t),e instanceof X?e:new X(`The capability returned a malformed result`,{cause:e,code:`PROTOCOL`,retryable:!1})}}))})}var RN=LN(IN(Xa()));FN({fetch:LN(qo(Response)),close:RN});var zN=p(`ZodMiniType`,(e,t)=>{if(!e._zod)throw Error(`Uninitialized schema in ZodMiniType.`);At.init(e,t),e.def=t,e.type=t.type,e.parse=(t,n)=>ve(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>Se(e,t,n),e.parseAsync=async(t,n)=>be(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>we(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)=>L(e,t,n),e.brand=()=>e,e.register=((t,n)=>(t.add(e,n),e)),e.apply=t=>t(e)}),BN=p(`ZodMiniObject`,(e,t)=>{vn.init(e,t),zN.init(e,t),T(e,`shape`,()=>t.shape)});function VN(e,t){return new BN({type:`object`,shape:e??{},...R(t)})}var HN=p(`ZodMiniLiteral`,(e,t)=>{Mn.init(e,t),zN.init(e,t)});function UN(e,t){return new HN({type:`literal`,values:Array.isArray(e)?e:[e],...R(t)})}var WN=to({status:Ra()}),GN=3,KN=/network ?(?:changed|error)|failed to fetch|load failed|network connection was lost/iu;function qN(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 JN(e){return qN(e).some(e=>{if(e instanceof TypeError)return!0;if(e instanceof X)return e.code===`HOST_FAILURE`&&e.retryable;let t=WN.safeParse(e);return t.success?t.data.status>=500:e instanceof Error&&KN.test(e.message)})}function YN(e,t){return e<GN&&JN(t)}function XN(e){return 250*2**e}function ZN(e){return e instanceof X?e:new X(`App operation failed`,{cause:e,code:`HOST_FAILURE`,retryable:!1})}var QN=new WeakMap,$N={of(e,...t){return[e?.identity.surfaceId??null,e?.context.get().computerId??null,...t]}};function eP(e){let t={};return e&&QN.set(t,e),t}function tP(){let e=new jw({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&&QN.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 nP(e,t,n,r){let i=e?.context.get().computerId;return Ww({queryKey:n,meta:eP(e),enabled:e!==null,retry:YN,retryDelay:XN,queryFn:async({signal:n})=>{try{if(!e)throw new X(`No App connection`,{code:`DISCONNECTED`,retryable:!0});if(e.context.get().computerId!==i)throw new X(`The selected Computer changed`,{code:`SELECTION_CHANGED`,retryable:!1});return await r(e.capabilities.require(t),n)}catch(e){throw ZN(e)}}})}function rP(e){return Yw({mutationKey:e.queryKey,scope:{id:MC(e.queryKey)},mutationFn:async(t,n)=>{try{return await e.mutationFn(t,n)}catch(e){throw ZN(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})})}PN(`app.backend`,1,Ro(()=>FN({request:LN(IN(Ka().transform(e=>$o(e))))})));var iP=PN(`app.methods`,1,Ro(()=>FN({call:LN(IN(Ka().transform(e=>$o(e))))})));PN(`app.region`,1,Ro(()=>FN({connect:LN(FN({messages:LN(qo(ReadableStream).transform(e=>e.pipeThrough(new TransformStream({transform(e,t){t.enqueue(U().parse(e))}})))),send:RN,close:RN}))})));var aP=72e4,oP=mo({png:`png`,jpeg:`jpeg`,webp:`webp`}),sP=mo({draft:`draft`,balanced:`balanced`,premium:`premium`,max:`max`}),cP=Ro(()=>W({transport:mo({json:`json`,multipart:`multipart`}),dimensions:mo({none:`none`,own:`own`}),maxDimension:Ra().int().positive().nullable(),maxDimensionDocumented:Ha(),defaultWidth:Ra().int().positive(),defaultHeight:Ra().int().positive(),steps:mo({steps:`steps`,num_steps:`num_steps`,fixed:`fixed`}),maxSteps:Ra().int().positive().nullable(),defaultSteps:Ra().int().nonnegative().nullable(),guidance:W({min:Ra().nonnegative(),max:Ra().positive(),default:Ra().nonnegative()}).readonly().refine(e=>e.min<=e.default&&e.default<=e.max,`guidance default must lie within its bounds`).nullable().default(null),referenceField:U().min(1).max(256).nullable(),maxReferences:Ra().int().nonnegative(),referenceDimension:Ra().int().positive().nullable(),referenceFormat:mo({png:`png`,webp:`webp`})}).readonly()),lP=mo({seedance25:`bytedance/seedance-2.5`,seedance:`bytedance/seedance-2.0`,seedanceFast:`bytedance/seedance-2.0-fast`,seedanceMini:`bytedance/seedance-2.0-mini`,veo:`google/veo-3.1`,veoFast:`google/veo-3.1-fast`,minimaxH3Max:`minimax/h3-max`}),uP=mo({p480:`480p`,p720:`720p`,p768:`768p`,p1080:`1080p`,p4k:`4k`}),dP=mo({wide:`16:9`,landscape:`4:3`,square:`1:1`,portrait:`3:4`,tall:`9:16`,ultrawide:`21:9`,ultratall:`9:21`}),fP=mo({first:`first-frame`,last:`last-frame`,reference:`reference`}),pP=Ro(()=>W({resolution:uP,aspectRatio:dP,width:Ra().int().positive(),height:Ra().int().positive()}).readonly()),mP=Ro(()=>W({minSeconds:Ra().int().positive(),maxSeconds:Ra().int().positive(),defaultSeconds:Ra().int().positive(),durations:Qa(Ra().int().positive()).readonly(),provider:mo({seedance:`seedance`,veo:`veo`,minimax:`minimax`}),formats:Qa(pP).readonly(),defaultResolution:uP,defaultAspectRatio:dP,supportsAudio:Ha(),defaultGenerateAudio:Ha().nullable(),referenceRoles:Qa(fP).readonly(),maxReferenceImages:Ra().int().nonnegative(),referenceResolutions:Qa(uP).readonly(),audioReferences:W({max:Ra().int().positive(),totalSeconds:Ra().int().positive()}).readonly().nullable(),prices:Qa(W({resolution:uP,silentMilliunitsPerSecond:Ra().int().positive(),audioMilliunitsPerSecond:Ra().int().positive()}).readonly()).readonly()}).readonly()),hP=mo({multilingual:`elevenlabs/eleven-multilingual-v2`,v3:`elevenlabs/eleven-v3`,music:`elevenlabs/music-v2`}),gP=Ro(()=>W({id:U().min(1).max(64),label:U().min(1).max(128)}).readonly()),_P=Ro(()=>W({provider:go(`elevenlabs`),mode:mo({speech:`speech`,music:`music`}),voices:Qa(gP).readonly(),defaultVoiceId:U().min(1).max(64).nullable(),seconds:W({min:Ra().int().positive(),max:Ra().int().positive(),default:Ra().int().positive()}).readonly().nullable(),milliunitsPerUnit:Ra().int().positive()}).readonly()),vP=32e3,yP=2048,bP=mo({remove_background:`remove_background`,upscale:`upscale`}),xP=Ro(()=>W({operation:bP,source:W({formats:Qa(oP).readonly(),maxBytes:Ra().int().positive(),maxPixels:Ra().int().positive()}).readonly(),defaultMegapixels:Ra().int().positive().nullable(),milliunits:Ra().int().positive().nullable(),sizes:Qa(W({megapixels:Ra().int().positive(),milliunits:Ra().int().positive()}).readonly()).readonly()}).readonly()),SP=[[4,.005],[8,.01],[16,.02],[32,.04],[64,.06],[128,.12]],CP=[4,8,16],wP=1e5,TP=.018,EP=8388608,DP=25e6,OP=mo({image:`image`,video_second:`video_second`,audio_second:`audio_second`,audio_character_block:`audio_character_block`}),kP=e=>e.kind===`video`?`video_second`:e.kind===`audio`?e.audio?.mode===`speech`?`audio_character_block`:`audio_second`:`image`,AP=W({id:U().min(1).max(256),label:U().min(1).max(512),kind:mo({image:`image`,video:`video`,audio:`audio`}),tier:sP,outputFormats:Qa(oP).max(3).readonly(),maxPromptLength:Ra().int().positive().max(vP),input:cP,sizes:Qa(U().regex(/^\d+x\d+$/u)).readonly().nullable(),video:mP.nullable(),audio:_P.nullable(),billingUnit:OP,transform:xP.nullable()}).readonly(),jP=e=>{let t={kind:`image`,sizes:null,video:null,audio:null,transform:null,outputFormats:Object.freeze([]),...e};return Object.freeze({...t,billingUnit:kP(t),input:Object.freeze(e.input)})},MP=3840,NP=8294400,PP=[[1,1],[4,3],[3,4],[3,2],[2,3],[16,9],[9,16],[21,9]],FP=(()=>{let e=new Set([`1024x1024`,`1024x1536`,`1536x1024`]),t=[],n=[];for(let[r,i]of PP){let a=((e,t)=>{let n=e,r=t;for(;r!==0;)[n,r]=[r,n%r];return n})(r,i),o=16*r/a,s=16*i/a,c=o*s,l=e=>`${String(o*e)}x${String(s*e)}`,u=Math.round(Math.sqrt(1048576/c)),d=[...e].find(e=>{let[t,n]=e.split(`x`).map(Number);return(t??0)*i===(n??0)*r});t.push(d??l(u)),n.push(l(Math.floor(Math.min(MP/Math.max(o,s),Math.sqrt(NP/c)))))}return Object.freeze([...t,...n])})(),IP=(e=>Object.freeze(PP.map(([t,n])=>{let r=t,i=n;for(;i!==0;)[r,i]=[i,r%i];let a=16*t/r,o=16*n/r,s=Math.round(Math.sqrt(e/(a*o)));return`${String(a*s)}x${String(o*s)}`})))(1327104),LP={"480p":480,"720p":720,"768p":768,"1080p":1080,"4k":2160},RP={"16:9":[16,9],"4:3":[4,3],"1:1":[1,1],"3:4":[3,4],"9:16":[9,16],"21:9":[21,9],"9:21":[9,21]},zP={maxSeconds:30,maxReferenceImages:30,audioReferences:{max:10,totalSeconds:30},maxPromptLength:25e3,resolutions:[`480p`,`720p`],aspects:dP.options.filter(e=>e!==dP.enum.ultratall)};function BP(e,t,n,r,i,a){let o=r===`seedance`,s=a?.resolutions??i.map(([e])=>e),c=a?.maxSeconds??(o?12:8),l=a?.maxReferenceImages??(o?4:0),u=a?a.aspects:o?dP.options:[dP.enum.wide,dP.enum.tall,dP.enum.square],d=Object.freeze(s.flatMap(e=>u.map(t=>{let[n,r]=RP[t],i=LP[e],a=Math.min(n,r);return Object.freeze({resolution:e,aspectRatio:t,width:Math.ceil(i*n/a/2)*2,height:Math.ceil(i*r/a/2)*2})}))),f=Object.freeze(o?Array.from({length:c-3},(e,t)=>t+4):[4,6,8]),p=Object.freeze({minSeconds:4,maxSeconds:c,defaultSeconds:o?5:6,durations:f,provider:r,formats:d,defaultResolution:`720p`,defaultAspectRatio:`16:9`,supportsAudio:!0,defaultGenerateAudio:!0,referenceRoles:Object.freeze(o?fP.options:[fP.enum.first]),maxReferenceImages:l,audioReferences:a===void 0?null:Object.freeze({...a.audioReferences}),referenceResolutions:Object.freeze(o?s.filter(e=>e!==`1080p`):[]),prices:Object.freeze(i.map(([e,t,n])=>Object.freeze({resolution:e,silentMilliunitsPerSecond:t,audioMilliunitsPerSecond:n})))});return jP({id:e,label:t,tier:n,maxPromptLength:a?.maxPromptLength??(o?1e4:yP),kind:`video`,video:p,sizes:Object.freeze(d.map(({width:e,height:t})=>`${String(e)}x${String(t)}`)),input:{transport:`json`,dimensions:`own`,maxDimension:Math.max(...d.map(({width:e,height:t})=>Math.max(e,t))),maxDimensionDocumented:!1,defaultWidth:1280,defaultHeight:720,steps:`fixed`,maxSteps:null,defaultSteps:null,guidance:null,referenceField:o?`image`:`image_input`,maxReferences:o?l:1,referenceDimension:null,referenceFormat:`png`}})}function VP(){let e=[`480p`,`768p`],t=[dP.enum.wide,dP.enum.landscape,dP.enum.square,dP.enum.portrait,dP.enum.tall,dP.enum.ultrawide],n=Object.freeze(e.flatMap(e=>t.map(t=>{let[n,r]=RP[t],i=LP[e],a=Math.min(n,r);return Object.freeze({resolution:e,aspectRatio:t,width:Math.ceil(i*n/a/2)*2,height:Math.ceil(i*r/a/2)*2})}))),r=uP.enum.p768,i=dP.enum.wide,a=n.find(e=>e.resolution===r&&e.aspectRatio===i);if(a===void 0)throw Error(`minimax/h3-max is missing its default format`);let o=Object.freeze(Array.from({length:11},(e,t)=>t+5)),s=Object.freeze({minSeconds:5,maxSeconds:15,defaultSeconds:5,durations:o,provider:`minimax`,formats:n,defaultResolution:r,defaultAspectRatio:i,defaultGenerateAudio:null,supportsAudio:!1,referenceRoles:Object.freeze([fP.enum.first,fP.enum.reference]),maxReferenceImages:4,audioReferences:null,referenceResolutions:Object.freeze(e),prices:Object.freeze([{resolution:uP.enum.p480,silentMilliunitsPerSecond:5e3,audioMilliunitsPerSecond:5e3},{resolution:uP.enum.p768,silentMilliunitsPerSecond:8e3,audioMilliunitsPerSecond:8e3}])});return jP({id:lP.enum.minimaxH3Max,label:`MiniMax H3 Max`,tier:`balanced`,maxPromptLength:7e3,kind:`video`,video:s,sizes:Object.freeze(n.map(({width:e,height:t})=>`${String(e)}x${String(t)}`)),input:{transport:`json`,dimensions:`own`,maxDimension:Math.max(...n.map(({width:e,height:t})=>Math.max(e,t))),maxDimensionDocumented:!1,defaultWidth:a.width,defaultHeight:a.height,steps:`fixed`,maxSteps:null,defaultSteps:null,guidance:null,referenceField:`image_url`,maxReferences:4,referenceDimension:null,referenceFormat:`png`}})}var HP=Object.freeze([Object.freeze({id:`JBFqnCBsd6RMkjVDRZzb`,label:`Default voice`})]);function UP(e,t,n,r){return GP(e,t,n,1e4,{provider:`elevenlabs`,mode:`speech`,voices:HP,defaultVoiceId:HP[0]?.id??null,seconds:null,milliunitsPerUnit:r})}function WP(){return GP(hP.enum.music,`Eleven Music v2`,`premium`,yP,{provider:`elevenlabs`,mode:`music`,voices:Object.freeze([]),defaultVoiceId:null,seconds:Object.freeze({min:3,max:600,default:30}),milliunitsPerUnit:250})}function GP(e,t,n,r,i){return jP({id:e,label:t,tier:n,maxPromptLength:r,kind:`audio`,audio:Object.freeze(i),input:{transport:`json`,dimensions:`none`,maxDimension:null,maxDimensionDocumented:!1,defaultWidth:1,defaultHeight:1,steps:`fixed`,maxSteps:null,defaultSteps:null,guidance:null,referenceField:null,maxReferences:0,referenceDimension:null,referenceFormat:`png`}})}function KP(e){let t=SP.find(([t])=>e<=t);if(t===void 0)throw Error(`no published upscale price for ${String(e)} MP`);return t[1]}function qP(e){return jP({id:e.id,label:e.label,tier:e.tier,outputFormats:Object.freeze([e.outputFormat]),maxPromptLength:256,transform:Object.freeze({operation:e.operation,source:Object.freeze({formats:Object.freeze([`png`,`jpeg`]),maxBytes:EP,maxPixels:DP}),defaultMegapixels:e.defaultMegapixels,milliunits:e.flatUsd===null?null:Math.round(e.flatUsd*wP),sizes:Object.freeze(e.sizes.map(({megapixels:e,usd:t})=>Object.freeze({megapixels:e,milliunits:Math.round(t*wP)})))}),input:{transport:`json`,dimensions:`none`,maxDimension:null,maxDimensionDocumented:!1,defaultWidth:1024,defaultHeight:1024,steps:`fixed`,maxSteps:null,defaultSteps:null,guidance:null,referenceField:`image`,maxReferences:1,referenceDimension:8192,referenceFormat:`png`}})}Object.freeze([jP({id:`@cf/black-forest-labs/flux-1-schnell`,maxPromptLength:2048,outputFormats:Object.freeze([`jpeg`]),tier:`draft`,label:`Flux 1 Schnell — cheap/fast sketches`,input:{transport:`json`,dimensions:`none`,maxDimension:null,maxDimensionDocumented:!1,defaultWidth:1024,defaultHeight:768,steps:`steps`,maxSteps:8,defaultSteps:4,guidance:null,referenceField:null,maxReferences:0,referenceDimension:512,referenceFormat:`png`}}),jP({id:`@cf/black-forest-labs/flux-2-klein-4b`,maxPromptLength:yP,tier:`balanced`,label:`Flux 2 Klein 4b — balanced default`,input:{transport:`multipart`,dimensions:`own`,maxDimension:1920,maxDimensionDocumented:!1,defaultWidth:1024,defaultHeight:768,steps:`fixed`,maxSteps:null,defaultSteps:4,guidance:null,referenceField:`input_image_`,maxReferences:4,referenceDimension:512,referenceFormat:`png`}}),jP({id:`@cf/black-forest-labs/flux-2-klein-9b`,maxPromptLength:yP,tier:`premium`,label:`Flux 2 Klein 9b — higher quality flux-2`,input:{transport:`multipart`,dimensions:`own`,maxDimension:1920,maxDimensionDocumented:!1,defaultWidth:1024,defaultHeight:768,steps:`fixed`,maxSteps:null,defaultSteps:4,guidance:null,referenceField:`input_image_`,maxReferences:4,referenceDimension:512,referenceFormat:`png`}}),jP({id:`@cf/black-forest-labs/flux-2-dev`,maxPromptLength:yP,tier:`max`,label:`Flux 2 Dev — best detailed quality, expensive`,input:{transport:`multipart`,dimensions:`own`,maxDimension:1920,maxDimensionDocumented:!1,defaultWidth:1024,defaultHeight:768,steps:`steps`,maxSteps:null,defaultSteps:20,guidance:null,referenceField:`input_image_`,maxReferences:4,referenceDimension:512,referenceFormat:`png`}}),jP({id:`@cf/leonardo/lucid-origin`,maxPromptLength:yP,tier:`premium`,label:`Leonardo Lucid Origin — premium prompt adherence`,input:{transport:`json`,dimensions:`own`,maxDimension:2500,maxDimensionDocumented:!0,defaultWidth:1120,defaultHeight:1120,steps:`num_steps`,maxSteps:40,defaultSteps:null,guidance:{min:0,max:10,default:5},referenceField:null,maxReferences:0,referenceDimension:512,referenceFormat:`png`}}),jP({id:`@cf/leonardo/phoenix-1.0`,maxPromptLength:yP,tier:`balanced`,label:`Leonardo Phoenix 1.0 — best prompt adherence`,input:{transport:`json`,dimensions:`own`,maxDimension:2048,maxDimensionDocumented:!0,defaultWidth:1024,defaultHeight:1024,steps:`num_steps`,maxSteps:50,defaultSteps:25,guidance:{min:2,max:10,default:3},referenceField:null,maxReferences:0,referenceDimension:512,referenceFormat:`png`}}),jP({id:`openai/gpt-image-2`,maxPromptLength:32e3,outputFormats:Object.freeze([`png`,`jpeg`,`webp`]),tier:`premium`,label:`GPT Image 2 — strong text and layout, premium`,sizes:FP,input:{transport:`json`,dimensions:`own`,maxDimension:MP,maxDimensionDocumented:!0,defaultWidth:1024,defaultHeight:1024,steps:`fixed`,maxSteps:null,defaultSteps:null,guidance:null,referenceField:`images`,maxReferences:16,referenceDimension:1024,referenceFormat:`webp`}}),jP({id:`bytedance/seedream-5-pro`,maxPromptLength:yP,outputFormats:Object.freeze([`jpeg`]),tier:`premium`,label:`Seedream 5 Pro — ByteDance, high-quality images`,sizes:IP,input:{transport:`json`,dimensions:`own`,maxDimension:1792,maxDimensionDocumented:!1,defaultWidth:1536,defaultHeight:864,steps:`fixed`,maxSteps:null,defaultSteps:null,guidance:null,referenceField:null,maxReferences:0,referenceDimension:512,referenceFormat:`png`}}),qP({id:`bria/remove-background`,label:`Remove background — Bria RMBG 2.0`,tier:`draft`,operation:`remove_background`,outputFormat:`png`,flatUsd:TP,sizes:[],defaultMegapixels:null}),qP({id:`pruna/p-image-upscale`,label:`Upscale — Pruna P-Image-Upscale`,tier:`draft`,operation:`upscale`,outputFormat:`webp`,flatUsd:null,sizes:CP.map(e=>({megapixels:e,usd:KP(e)})),defaultMegapixels:4}),BP(lP.enum.seedance25,`Seedance 2.5`,`balanced`,`seedance`,[[`480p`,10280,10280],[`720p`,23120,23120]],zP),BP(lP.enum.seedance,`Seedance 2.0`,`balanced`,`seedance`,[[`480p`,7e3,7e3],[`720p`,15e3,15e3],[`1080p`,37e3,37e3],[`4k`,78e3,78e3]]),BP(lP.enum.seedanceFast,`Seedance 2.0 Fast`,`draft`,`seedance`,[[`480p`,6e3,6e3],[`720p`,12e3,12e3]]),BP(lP.enum.seedanceMini,`Seedance 2.0 Mini`,`draft`,`seedance`,[[`480p`,4e3,4e3],[`720p`,9e3,9e3]]),BP(lP.enum.veo,`Veo 3.1`,`premium`,`veo`,[[`720p`,2e4,4e4],[`1080p`,2e4,4e4]]),BP(lP.enum.veoFast,`Veo 3.1 Fast`,`balanced`,`veo`,[[`720p`,8e3,1e4],[`1080p`,1e4,12e3]]),VP(),UP(hP.enum.multilingual,`Eleven Multilingual v2 — natural speech`,`balanced`,10),UP(hP.enum.v3,`Eleven v3 — expressive speech`,`premium`,10),WP()]),Qa(AP.unwrap().extend({billingUnit:OP.optional(),audio:_P.unwrap().nullable().default(null),transform:xP.unwrap().nullable().default(null),video:mP.unwrap().unwrap().extend({audioReferences:mP.unwrap().unwrap().shape.audioReferences.default(null),provider:mo({seedance:`seedance`,veo:`veo`,minimax:`minimax`,host:`host`})}).readonly().nullable()}).readonly()).min(1).max(256).superRefine((e,t)=>{let n=new Set;e.forEach((e,r)=>{let i=e=>{t.addIssue({code:`custom`,message:e,path:[r]})};n.has(e.id)&&i(`duplicate model id "${e.id}"`),n.add(e.id),e.kind===`video`!=(e.video!==null)&&i(`${e.id} must carry video bounds exactly when kind is video`),e.kind===`audio`!=(e.audio!==null)&&i(`${e.id} must carry audio bounds exactly when kind is audio`),e.billingUnit!==void 0&&e.billingUnit!==kP(e)&&i(`${e.id} billingUnit must be ${kP(e)} for ${e.kind===`image`?`an`:`a`} ${e.kind} model`);let a=e.video;a!==null&&((a.minSeconds>a.maxSeconds||a.durations.some(e=>e<a.minSeconds||e>a.maxSeconds)||!a.durations.includes(a.defaultSeconds))&&i(`${e.id} durations must sit inside min/max and include the default`),a.formats.some(({resolution:e,aspectRatio:t})=>e===a.defaultResolution&&t===a.defaultAspectRatio)||i(`${e.id} formats must include the default resolution and aspect`))})}).transform(e=>Object.freeze(e.map(e=>Object.freeze({...e,input:Object.freeze(e.input)}))));var JP=e=>U().min(1).max(e),YP=Ra().int().min(-(2**53-1)).max(2**53-1),XP=YP.positive(),ZP=YP.nonnegative(),QP=W({printId:JP(256),computerId:JP(256),kind:mo([`image`,`video`,`audio`]),prompt:JP(vP),model:JP(256),width:XP.nullable(),height:XP.nullable(),steps:ZP.nullable(),durationSeconds:ZP.nullable(),format:JP(32),bytes:XP,costMilliunits:ZP,actorKind:mo([`member`,`agent`]),actorId:JP(256),derivedFrom:JP(256).nullable(),createdAt:ZP,source:mo([`recorded`,`file`]),schemaVersion:XP}),$P=eo({printId:QP.shape.printId,path:U().startsWith(`/`).min(2).max(4096)});function eF(e,t){let n=e?.app??null,r=DN(n),i=r?.openRequest,a=r?.computerId,o=i?.kind===`navigate`?i.params.find(e=>e.key===`print`):void 0,s=QP.shape.printId.safeParse(o?.value),c=s.success?s.data:null,l=i?.kind===`navigate`?i.requestId:null,u=(0,G.useRef)({app:n,requestId:l,computerId:a});(u.current.app!==n||u.current.requestId!==l)&&(u.current={app:n,requestId:l,computerId:a});let d=u.current.computerId===a,f=Uw({...nP(n,iP,$N.of(n,`prints`,`navigate`,a,l,c),async(e,t)=>{if(!n||!a||!c||!l)throw Error(`No print selected`);let r=await e.call(`openOutput`,JSON.stringify({printId:c,byteLength:1}));if(t.throwIfAborted(),n.context.get().computerId!==a)throw Error(`Computer selection changed`);let i=$P.parse(r);if(i.printId!==c)throw Error(`Print selection changed`);return{path:i.path,requestId:l,computerId:a}}),enabled:!!(n&&d&&a&&l&&c&&n.capabilities.has(iP)),retry:!1,staleTime:1/0}),p=(0,G.useRef)(t);p.current=t;let m=(0,G.useRef)(void 0);return(0,G.useEffect)(()=>{let t=f.data;!e||!t||m.current===t||e.app.context.get().computerId!==t.computerId||(m.current=t,p.current(t.path,e,t.computerId))},[e,f.data]),{target:f.data??null,error:f.error}}var tF=sS([J({kind:Xx(`compose`),text:eS.pipe(Y(MS(1)),Y(FS(2e3)))}),J({kind:Xx(`navigate`),params:aS(J({key:eS.pipe(Y(MS(1)),Y(FS(64))),value:eS.pipe(Y(FS(1024)))})).pipe(Y(FS(16)))})]);sS([J({role:eS.pipe(Y(MS(1)),Y(FS(80))),intent:tF}),J({appId:eS.pipe(Y(MS(1)),Y(FS(128))),intent:tF})],{mode:`oneOf`});var nF=W({displayName:U().min(1).max(80).nullable()}).nullable(),rF=PN(`apps.open`,1,Ro(()=>FN({open:RN,role:LN(IN(nF))})));PN(`apps.call`,1,Ro(()=>FN({call:LN(IN(Ka().transform(e=>$o(e))))})));var iF=U().regex(/^[a-zA-Z0-9._-]{1,128}$/).refine(e=>e!==`.`&&e!==`..`),aF=U().regex(/^[0-9a-f]{40}$/);W({ref:U().startsWith(`refs/`).max(1024),before:aF,after:aF}),Ro(()=>U().min(1).max(512));var oF=`files`,sF=W({name:U(),email:U()}),cF=W({hash:aF,treeHash:aF,message:U(),author:sF,committer:sF,parents:Qa(aF),authoredAt:Ra(),committedAt:Ra()}),lF=W({name:U(),mode:U(),hash:aF,type:mo([`blob`,`tree`,`commit`])});W({ref:U(),commit:cF,path:U(),entries:Qa(lF)});var uF=65536,dF=U().min(1).max(1024).refine(e=>!e.startsWith(`/`)&&!e.includes(`\\`)&&!e.includes(`\0`)&&e.split(`/`).every(e=>e!==``&&e!==`.`&&e!==`..`&&e!==`.git`),`Choose a relative repository file path.`),fF=U().min(1).max(256),pF={repo:iF,branch:fF,path:dF},mF=mo([`pending`,`synced`,`conflict`,`failed`]),hF=W({text:U(),revision:Ra().int().positive(),state:mF,theirs:W({blob:aF.nullable(),commit:aF}).optional(),failure:mo([`branch_missing`,`access_changed`,`sync_failed`,`permanent_material`]).optional()});W({...pF,baseBlob:aF.nullable(),baseCommit:aF,text:U().max(uF),revision:Ra().int().positive().nullable()});var gF=ro([W({kind:go(`saved`),revision:Ra().int().positive(),state:go(`pending`)}),W({kind:go(`synced`),revision:Ra().int().positive(),commit:aF}),W({kind:go(`conflict`),revision:Ra().int().nonnegative(),theirs:hF.shape.theirs.optional()}),W({kind:go(`failed`),revision:Ra().int().positive(),reason:mo([`branch_missing`,`access_changed`,`sync_failed`,`permanent_material`])}),W({kind:go(`refused`),reason:mo([`not-source-writer`,`background-unavailable`])})]);W({...pF,revision:Ra().int().positive()}),ro([W({kind:mo([`discarded`,`not_found`])}),W({kind:go(`conflict`),revision:Ra().int().positive()})]),W({settled:Qa(W({...pF,result:gF})),more:Ha()}),W({version:Ra().int().positive().nullable(),commit:aF,blob:aF.nullable(),pending:hF.optional(),ref:U(),path:U(),size:Ra(),binary:Ha(),text:U().nullable()}),W({ref:U(),commits:Qa(W({commit:cF,agent:U().nullable()})),next:U().optional()}),W({ref:U(),commit:cF,paths:Qa(U()),truncated:Ha()}),W({kind:go(`rebuilding`)}),W({done:Ha(),cursor:U().nullable()}),ro([W({repository:iF,branch:fF,path:dF}),W({path:U().min(1).max(1024)})]);var _F=Gx(zS(J({error:Xx(`too_large`)})));async function vF(e,t){let n,r=()=>n??=e.close(),i=()=>{r().catch(e=>{nT(`files.read.abort-close`,e)})};t.signal?.addEventListener(`abort`,i,{once:!0});try{t.signal?.throwIfAborted();let n=await e.response();try{let e=qx(pS(Response))(n);if(e.status===413)throw new X(`App file exceeds the read bound`,{code:_F(await e.text())._tag===`Some`?`FILE_TOO_LARGE`:`PROTOCOL`,retryable:!1});if(!e.ok)throw Error(`App file unavailable (${String(e.status)})`);let r=await e.blob();return t.signal?.throwIfAborted(),new File([r],t.name,{type:r.type,lastModified:0})}finally{xM(n)}}finally{t.signal?.removeEventListener(`abort`,i);try{await r()}finally{e[Symbol.dispose]()}}}async function yF(e,t,n){let r,i=()=>r??=e.close(),a=()=>{i().catch(e=>{nT(`files.write.abort-close`,e)})};n.signal?.addEventListener(`abort`,a,{once:!0});try{n.signal?.throwIfAborted(),await e.write(t.stream())}finally{n.signal?.removeEventListener(`abort`,a);try{await i()}catch(e){nT(`files.write.remote-close`,e)}try{e[Symbol.dispose]()}catch(e){nT(`files.write.local-dispose`,e)}}}var bF=mo([`exec`,`write`,`media`]),xF=Ro(()=>W({error:go(`attachment_budget_exceeded`),kind:bF,retryAfterMs:Ra()})),SF=Ro(()=>W({error:go(`unavailable`),ref:U().min(1).max(128)}));Ro(()=>ro([W({error:mo([`revoked`,`not_granted`,`grantor_lost_authority`,`unavailable`])}),SF,xF])),Ro(()=>W({error:mo([`too_large`,`invalid_path`,`invalid`])})),Ro(()=>ro([W({error:mo([`not_granted`,`too_large`,`conflict`,`capacity`,`unfunded`,`admission_unavailable`,`backend_unavailable`,`unavailable`])}),SF])),Ro(()=>ro([W({error:mo([`capacity`,`unfunded`,`admission_unavailable`,`backend_unavailable`])}),SF])),Ro(()=>W({error:go(`timeout`),requestId:U()}));var CF=mo([`revoked`,`not_granted`,`grantor_lost_authority`,`attachment_budget_exceeded`,`too_large`,`invalid_path`,`invalid`,`not_found`,`conflict`,`timeout`,`capacity`,`unfunded`,`admission_unavailable`,`backend_unavailable`,`unavailable`]);Ro(()=>ro([W({error:CF.exclude([`attachment_budget_exceeded`,`timeout`])}),SF]));var wF=J({path:eS,entries:aS(J({name:eS,type:cS([`file`,`directory`,`symlink`]),size:tS,modifiedAt:tS})),nextOffset:lS(tS)}),TF=PN(`computer.list`,1,Ro(()=>FN({list:LN(IN(Ka().transform(e=>qx(wF)(e))))}))),EF=sS([J({state:cS([`running`,`sleeping`,`starting`])}),J({state:Xx(`start_failed`),reason:Yx(eS.pipe(Y(MS(1)),Y(FS(1024))))}),J({state:Xx(`queued`),position:tS.pipe(Y(AS()),Y(ES(0)))})]),DF=J({enabled:nS,effective:nS,blockedBy:lS(cS([`team`,`global`]))}),OF=J({computerId:LS,name:LS,runtime:EF,backends:aS(J({id:LS,kind:cS([`platform-container`,`on-box-vm`,`local`]),status:cS([`ready`,`queued`,`online`,`offline`]),queuePosition:lS(tS.pipe(Y(AS()),Y(ES(0)))),hostId:lS(eS),hostLabel:lS(eS),folderLabel:lS(eS),detachable:nS})),internet:DF});PN(`computer.instrument.read`,1,Ro(()=>FN({read:LN(IN(Ka().transform(e=>qx(OF)(e))))}))),PN(`computer.instrument.control`,1,Ro(()=>FN({start:LN(IN(Ka().transform(e=>qx(EF)(e)))),setInternetAccess:LN(IN(Ka().transform(e=>qx(DF)(e)))),detachLocal:LN(IN(Ka().transform(e=>qx(J({detached:nS}))(e))))})));var kF=sS([J({ports:aS(J({port:tS.pipe(Y(AS()),Y(kS({minimum:1,maximum:65535}))),previewUrl:LS,openMode:cS([`inline`,`external-only`])})).pipe(Y(FS(64)))}),J({error:Xx(`port_previews_not_configured`)})]),AF=J({port:tS.annotate({message:`Use a port from 1 to 65535.`}).check(AS({message:`Use a port from 1 to 65535.`}),kS({minimum:1,maximum:65535},{message:`Use a port from 1 to 65535.`})),exposed:nS}),jF=J({port:tS.pipe(Y(AS()),Y(kS({minimum:1,maximum:65535}))),removed:nS});PN(`computer.ports`,2,Ro(()=>FN({list:LN(IN(Ka().transform(e=>qx(kF)(e)))),expose:LN(IN(Ka().transform(e=>qx(AF)(e)))),unexpose:LN(IN(Ka().transform(e=>qx(jF)(e))))})));var MF=cS([`synced`,`pending`,`unknown`]),NF=J({port:lS(AF.fields.port),id:LS,command:LS,cwd:lS(eS),startedAt:tS.pipe(Y(AS()),Y(DS(0))),state:cS([`running`,`exited`,`uncertain`]),exitCode:lS(tS.pipe(Y(AS()))),sync:MF,endedAt:lS(tS.pipe(Y(AS()),Y(DS(0)))),endedReason:lS(Xx(`idle-sleep`))}),PF=J({processes:aS(NF)}),FF=J({process:NF,signalled:nS}),IF=J({process:NF,lines:aS(eS.pipe(Y(FS(2e3)))).pipe(Y(FS(200))),truncated:nS});J({requestId:LS.pipe(Y(FS(256))),command:LS.pipe(Y(FS(16384))),cwd:Yx(eS),port:Yx(AF.fields.port)}),PN(`computer.processes`,1,Ro(()=>FN({start:LN(IN(Ka().transform(e=>qx(NF)(e)))),list:LN(IN(Ka().transform(e=>qx(PF)(e)))),kill:LN(IN(Ka().transform(e=>qx(FF)(e)))),logs:LN(IN(Ka().transform(e=>qx(IF)(e))))}))),J({error:cS(CF.options),ref:q(eS)});var LF=PN(`computer.readFile`,1,Ro(()=>FN({open:LN(FN({response:LN(qo(Response)),close:RN}))})));async function RF(e,t,n){return await vF(await e.require(LF).open(t),{...n,name:t.path.split(`/`).at(-1)??`file`})}async function zF(e,t){return qx(wF)(await e.require(TF).list(t))}var BF=PN(`computer.writeFile`,3,Ro(()=>FN({open:LN(FN({write:RN,close:RN})),mkdir:RN,replace:LN(IN(Ka().transform(e=>qx(VF)(e))))}))),VF=sS([J({kind:Xx(`replaced`),path:LS,bytes:tS.pipe(Y(AS()),Y(DS(0)))}),J({kind:Xx(`conflict`)})]),HF=J({computerName:LS.pipe(Y(FS(256))),teamName:LS.pipe(Y(FS(256))),modelDoor:LS.pipe(Y(FS(256))),uptimeSeconds:tS.pipe(Y(AS()),Y(DS(0))),version:LS.pipe(Y(FS(64)))});PN(`computer.terminal`,2,Ro(()=>FN({open:LN(FN({information:LN(IN(Ka().transform(e=>qx(HF)(e)))),output:LN(qo(ReadableStream).transform(e=>e.pipeThrough(new TransformStream({transform(e,t){t.enqueue(qo(Uint8Array).parse(e))}})))),input:LN(qo(WritableStream)),resize:RN,close:RN}))})));async function UF(e,t,n){await yF(await e.require(BF).open({path:t.path}),t.content,n)}var WF=l(eT(),1);function GF(e){if(!e||typeof document>`u`)return;let t=document.head||document.getElementsByTagName(`head`)[0],n=document.createElement(`style`);n.type=`text/css`,t.appendChild(n),n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}var KF=e=>{switch(e){case`success`:return YF;case`info`:return ZF;case`warning`:return XF;case`error`:return QF;default:return null}},qF=Array(12).fill(0),JF=({visible:e,className:t})=>G.createElement(`div`,{className:[`sonner-loading-wrapper`,t].filter(Boolean).join(` `),"data-visible":e},G.createElement(`div`,{className:`sonner-spinner`},qF.map((e,t)=>G.createElement(`div`,{className:`sonner-loading-bar`,key:`spinner-bar-${t}`})))),YF=G.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 20 20`,fill:`currentColor`,height:`20`,width:`20`,"aria-hidden":`true`},G.createElement(`path`,{fillRule:`evenodd`,d:`M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z`,clipRule:`evenodd`})),XF=G.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,fill:`currentColor`,height:`20`,width:`20`,"aria-hidden":`true`},G.createElement(`path`,{fillRule:`evenodd`,d:`M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z`,clipRule:`evenodd`})),ZF=G.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 20 20`,fill:`currentColor`,height:`20`,width:`20`,"aria-hidden":`true`},G.createElement(`path`,{fillRule:`evenodd`,d:`M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z`,clipRule:`evenodd`})),QF=G.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 20 20`,fill:`currentColor`,height:`20`,width:`20`,"aria-hidden":`true`},G.createElement(`path`,{fillRule:`evenodd`,d:`M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z`,clipRule:`evenodd`})),$F=G.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`12`,height:`12`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`},G.createElement(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),G.createElement(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})),eI=()=>{let[e,t]=G.useState(document.hidden);return G.useEffect(()=>{let e=()=>{t(document.hidden)};return document.addEventListener(`visibilitychange`,e),()=>document.removeEventListener(`visibilitychange`,e)},[]),e},tI=1,nI=100,rI=e=>typeof e?.id==`number`||e?.id?.length>0?e.id:tI++,iI=new class{constructor(){this.subscribe=e=>(this.subscribers.push(e),this.getActiveToasts().forEach(t=>e(t)),()=>{let t=this.subscribers.indexOf(e);this.subscribers.splice(t,1)}),this.publish=e=>{this.subscribers.forEach(t=>t(e))},this.addToast=e=>{this.publish(e),this.toasts=[...this.toasts,e],this.trimHistory()},this.trimHistory=()=>{let e=this.toasts.length-nI;e<=0||(this.toasts=this.toasts.filter(t=>e>0&&this.dismissedToasts.has(t.id)?(this.dismissedToasts.delete(t.id),e--,!1):!0))},this.create=e=>{let{message:t,...n}=e,r=rI(e),i=this.pendingDismissals.get(r);i!==void 0&&(cancelAnimationFrame(i),this.pendingDismissals.delete(r),this.dismissedToasts.delete(r));let a=this.dismissedToasts.has(r),o=e.dismissible===void 0||e.dismissible;return a&&(this.dismissedToasts.delete(r),this.toasts=this.toasts.filter(e=>e.id!==r)),!a&&this.toasts.find(e=>e.id===r)?this.toasts=this.toasts.map(n=>n.id===r?(this.publish({...n,...e,id:r,title:t}),{...n,...e,id:r,dismissible:o,title:t}):n):this.addToast({title:t,...n,dismissible:o,id:r}),r},this.dismiss=e=>{if(e==null)return this.getActiveToasts().forEach(e=>{this.dismissedToasts.add(e.id),this.subscribers.forEach(t=>t({id:e.id,dismiss:!0}))}),e;this.dismissedToasts.add(e);let t=this.pendingDismissals.get(e);return t!==void 0&&cancelAnimationFrame(t),this.pendingDismissals.set(e,requestAnimationFrame(()=>{this.pendingDismissals.delete(e),this.subscribers.forEach(t=>t({id:e,dismiss:!0}))})),e},this.message=(e,t)=>this.create({...t,message:e,type:void 0}),this.error=(e,t)=>this.create({...t,message:e,type:`error`}),this.success=(e,t)=>this.create({...t,type:`success`,message:e}),this.info=(e,t)=>this.create({...t,type:`info`,message:e}),this.warning=(e,t)=>this.create({...t,type:`warning`,message:e}),this.loading=(e,t)=>this.create({...t,type:`loading`,message:e}),this.promise=(e,t)=>{if(!t)return;let n;t.loading!==void 0&&(n=this.create({...t,promise:e,type:`loading`,message:t.loading,description:typeof t.description==`function`?void 0:t.description}));let r=Promise.resolve(e instanceof Function?e():e),i=n!==void 0,a,o=r.then(async e=>{if(a=[`resolve`,e],G.isValidElement(e))i=!1,this.create({id:n,type:`default`,message:e});else if(oI(e)&&!e.ok){i=!1;let r=typeof t.error==`function`?await t.error(`HTTP error! status: ${e.status}`):t.error,a=typeof t.description==`function`?await t.description(`HTTP error! status: ${e.status}`):t.description,o=typeof r==`object`&&!G.isValidElement(r)?r:{message:r};this.create({id:n,type:`error`,description:a,...o})}else if(e instanceof Error){i=!1;let r=typeof t.error==`function`?await t.error(e):t.error,a=typeof t.description==`function`?await t.description(e):t.description,o=typeof r==`object`&&!G.isValidElement(r)?r:{message:r};this.create({id:n,type:`error`,description:a,...o})}else if(t.success!==void 0){i=!1;let r=typeof t.success==`function`?await t.success(e):t.success,a=typeof t.description==`function`?await t.description(e):t.description,o=typeof r==`object`&&!G.isValidElement(r)?r:{message:r};this.create({id:n,type:`success`,description:a,...o})}}).catch(async e=>{if(a=[`reject`,e],t.error!==void 0){i=!1;let r=typeof t.error==`function`?await t.error(e):t.error,a=typeof t.description==`function`?await t.description(e):t.description,o=typeof r==`object`&&!G.isValidElement(r)?r:{message:r};this.create({id:n,type:`error`,description:a,...o})}}).finally(()=>{i&&(this.dismiss(n),n=void 0),t.finally==null||t.finally.call(t)}),s=()=>new Promise((e,t)=>o.then(()=>a[0]===`reject`?t(a[1]):e(a[1])).catch(t));return typeof n!=`string`&&typeof n!=`number`?{unwrap:s}:Object.assign(n,{unwrap:s})},this.custom=(e,t)=>{let n=rI(t);return this.create({...t,jsx:e(n),id:n,type:void 0}),n},this.getActiveToasts=()=>this.toasts.filter(e=>!this.dismissedToasts.has(e.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set,this.pendingDismissals=new Map}},aI=(e,t)=>iI.message(e,t),oI=e=>e&&typeof e==`object`&&`ok`in e&&typeof e.ok==`boolean`&&`status`in e&&typeof e.status==`number`,sI=Object.assign(aI,{success:iI.success,info:iI.info,warning:iI.warning,error:iI.error,custom:iI.custom,message:iI.message,promise:iI.promise,dismiss:iI.dismiss,loading:iI.loading},{getHistory:()=>iI.toasts,getToasts:()=>iI.getActiveToasts()});GF(`[data-sonner-toaster][dir=ltr],html[dir=ltr]{--toast-icon-margin-start:-3px;--toast-icon-margin-end:4px;--toast-svg-margin-start:-1px;--toast-svg-margin-end:0px;--toast-button-margin-start:auto;--toast-button-margin-end:0;--toast-close-button-start:0;--toast-close-button-end:unset;--toast-close-button-transform:translate(-35%, -35%)}[data-sonner-toaster][dir=rtl],html[dir=rtl]{--toast-icon-margin-start:4px;--toast-icon-margin-end:-3px;--toast-svg-margin-start:0px;--toast-svg-margin-end:-1px;--toast-button-margin-start:0;--toast-button-margin-end:auto;--toast-close-button-start:unset;--toast-close-button-end:0;--toast-close-button-transform:translate(35%, -35%)}[data-sonner-toaster]{position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1:hsl(0, 0%, 99%);--gray2:hsl(0, 0%, 97.3%);--gray3:hsl(0, 0%, 95.1%);--gray4:hsl(0, 0%, 93%);--gray5:hsl(0, 0%, 90.9%);--gray6:hsl(0, 0%, 88.7%);--gray7:hsl(0, 0%, 85.8%);--gray8:hsl(0, 0%, 78%);--gray9:hsl(0, 0%, 56.1%);--gray10:hsl(0, 0%, 52.3%);--gray11:hsl(0, 0%, 43.5%);--gray12:hsl(0, 0%, 9%);--border-radius:8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:0;z-index:999999999;transition:transform .4s ease}@media (hover:none) and (pointer:coarse){[data-sonner-toaster][data-lifted=true]{transform:none}}[data-sonner-toaster][data-x-position=right]{right:var(--offset-right)}[data-sonner-toaster][data-x-position=left]{left:var(--offset-left)}[data-sonner-toaster][data-x-position=center]{left:50%;transform:translateX(-50%)}[data-sonner-toaster][data-y-position=top]{top:var(--offset-top)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--offset-bottom)}[data-sonner-toast]{--y:translateY(100%);--lift-amount:calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:0;overflow-wrap:anywhere}[data-sonner-toast][data-styled=true]{padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px rgba(0,0,0,.1);width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}[data-sonner-toast]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-y-position=top]{top:0;--y:translateY(-100%);--lift:1;--lift-amount:calc(1 * var(--gap))}[data-sonner-toast][data-y-position=bottom]{bottom:0;--y:translateY(100%);--lift:-1;--lift-amount:calc(var(--lift) * var(--gap))}[data-sonner-toast][data-styled=true] [data-description]{font-weight:400;line-height:1.4;color:#3f3f3f}[data-rich-colors=true][data-sonner-toast][data-styled=true] [data-description]{color:inherit}[data-sonner-toaster][data-sonner-theme=dark] [data-description]{color:#e8e8e8}[data-sonner-toast][data-styled=true] [data-title]{font-weight:500;line-height:1.5;color:inherit}[data-sonner-toast][data-styled=true] [data-icon]{display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}[data-sonner-toast][data-promise=true] [data-icon]>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}[data-sonner-toast][data-styled=true] [data-icon]>*{flex-shrink:0}[data-sonner-toast][data-styled=true] [data-icon] svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}[data-sonner-toast][data-styled=true] [data-content]{display:flex;flex-direction:column;gap:2px;flex:1;min-width:0}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;font-weight:500;cursor:pointer;outline:0;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}[data-sonner-toast][data-styled=true] [data-button]:focus-visible{box-shadow:0 0 0 2px rgba(0,0,0,.4)}[data-sonner-toast][data-styled=true] [data-button]:first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}[data-sonner-toast][data-styled=true] [data-cancel]{color:var(--normal-text);background:rgba(0,0,0,.08)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-styled=true] [data-cancel]{background:rgba(255,255,255,.3)}[data-sonner-toast][data-styled=true] [data-close-button]{position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--normal-text);background:var(--normal-bg);border:1px solid var(--normal-border);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast][data-styled=true] [data-close-button]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-styled=true] [data-disabled=true]{cursor:not-allowed}[data-sonner-toast][data-styled=true]:hover [data-close-button]:hover{background:var(--gray2);border-color:var(--gray5)}[data-sonner-toast][data-swiping=true]::before{content:'';position:absolute;left:-100%;right:-100%;height:100%;z-index:-1}[data-sonner-toast][data-y-position=top][data-swiping=true]::before{bottom:50%;transform:scaleY(3) translateY(50%)}[data-sonner-toast][data-y-position=bottom][data-swiping=true]::before{top:50%;transform:scaleY(3) translateY(-50%)}[data-sonner-toast][data-swiping=false][data-removed=true]::before{content:'';position:absolute;inset:0;transform:scaleY(2)}[data-sonner-toast][data-expanded=true]::after{content:'';position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}[data-sonner-toast][data-mounted=true]{--y:translateY(0);opacity:1}[data-sonner-toast][data-expanded=false][data-front=false]{--scale:var(--toasts-before) * 0.05 + 1;--y:translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}[data-sonner-toast]>*{transition:opacity .4s}[data-sonner-toast][data-x-position=right]{right:0}[data-sonner-toast][data-x-position=left]{left:0}[data-sonner-toast][data-expanded=false][data-front=false][data-styled=true]>*{opacity:0}[data-sonner-toast][data-visible=false]{opacity:0;pointer-events:none}[data-sonner-toast][data-mounted=true][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}[data-sonner-toast][data-removed=true][data-front=true][data-swipe-out=false]{--y:translateY(calc(var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=false]{--y:translateY(40%);opacity:0;transition:transform .5s,opacity .2s}[data-sonner-toast][data-removed=true][data-front=false]::before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y,0)) translateX(var(--swipe-amount-x,0));transition:none}[data-sonner-toast][data-swiped=true]{-webkit-user-select:none;user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width:600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-sonner-theme=light]{--normal-bg:#fff;--normal-border:var(--gray4);--normal-text:var(--gray12);--success-bg:hsl(143, 85%, 96%);--success-border:hsl(145, 92%, 87%);--success-text:hsl(140, 100%, 27%);--info-bg:hsl(208, 100%, 97%);--info-border:hsl(221, 91%, 93%);--info-text:hsl(210, 92%, 45%);--warning-bg:hsl(49, 100%, 97%);--warning-border:hsl(49, 91%, 84%);--warning-text:hsl(31, 92%, 45%);--error-bg:hsl(359, 100%, 97%);--error-border:hsl(359, 100%, 94%);--error-text:hsl(360, 100%, 45%)}[data-sonner-toaster][data-sonner-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg:#000;--normal-border:hsl(0, 0%, 20%);--normal-text:var(--gray1)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg:#fff;--normal-border:var(--gray3);--normal-text:var(--gray12)}[data-sonner-toaster][data-sonner-theme=dark]{--normal-bg:#000;--normal-bg-hover:hsl(0, 0%, 12%);--normal-border:hsl(0, 0%, 20%);--normal-border-hover:hsl(0, 0%, 25%);--normal-text:var(--gray1);--success-bg:hsl(150, 100%, 6%);--success-border:hsl(147, 100%, 12%);--success-text:hsl(150, 86%, 65%);--info-bg:hsl(215, 100%, 6%);--info-border:hsl(223, 43%, 17%);--info-text:hsl(216, 87%, 65%);--warning-bg:hsl(64, 100%, 6%);--warning-border:hsl(60, 100%, 9%);--warning-text:hsl(46, 87%, 65%);--error-bg:hsl(358, 76%, 10%);--error-border:hsl(357, 89%, 16%);--error-text:hsl(358, 100%, 81%)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size:16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:first-child{animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}100%{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}100%{opacity:.15}}@media (prefers-reduced-motion){.sonner-loading-bar,[data-sonner-toast],[data-sonner-toast]>*{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}`);function cI(e){return e.label!==void 0}var lI=3,uI=`24px`,dI=`16px`,fI=4e3,pI=356,mI=14,hI=45,gI=200;function _I(...e){return e.filter(Boolean).join(` `)}function vI(e){let[t,n]=e.split(`-`),r=[];return t&&r.push(t),n&&r.push(n),r}var yI=e=>{let{invert:t,toast:n,unstyled:r,interacting:i,setHeights:a,visibleToasts:o,heights:s,index:c,toasts:l,expanded:u,removeToast:d,defaultRichColors:f,closeButton:p,style:m,cancelButtonStyle:h,actionButtonStyle:g,className:_=``,descriptionClassName:v=``,duration:y,position:b,gap:x,expandByDefault:S,classNames:C,icons:w,closeButtonAriaLabel:T=`Close toast`}=e,[E,D]=G.useState(null),[O,k]=G.useState(null),[A,j]=G.useState(!1),[M,N]=G.useState(!1),[P,F]=G.useState(!1),[I,L]=G.useState(!1),[R,z]=G.useState(!1),[ee,te]=G.useState(0),[B,ne]=G.useState(0),re=G.useRef(n.duration||y||fI),V=G.useRef(null),H=G.useRef(null),ie=c===0,ae=c+1<=o,oe=n.type,se=oe??`default`,ce=n.dismissible!==!1,le=n.className||``,ue=n.descriptionClassName||``,de=G.useMemo(()=>s.findIndex(e=>e.toastId===n.id)||0,[s,n.id]),fe=G.useMemo(()=>n.closeButton??p,[n.closeButton,p]),pe=G.useMemo(()=>n.duration||y||fI,[n.duration,y]),me=G.useRef(0),he=G.useRef(0),ge=G.useRef(0),_e=G.useRef(null),[ve,ye]=b.split(`-`),be=G.useMemo(()=>s.reduce((e,t,n)=>n>=de?e:e+t.height,0),[s,de]),xe=eI(),Se=G.useMemo(()=>e.swipeDirections??vI(b),[e.swipeDirections,b]),Ce=n.invert||t,we=oe===`loading`;he.current=G.useMemo(()=>de*x+be,[de,be]),G.useEffect(()=>{re.current=pe},[pe]),G.useEffect(()=>{j(!0)},[]),G.useEffect(()=>{let e=H.current;if(e){let t=e.getBoundingClientRect().height;return ne(t),a(e=>[{toastId:n.id,height:t,position:n.position},...e]),()=>a(e=>e.filter(e=>e.toastId!==n.id))}},[a,n.id]),G.useLayoutEffect(()=>{if(!A)return;let e=H.current,t=e.style.height;e.style.height=`auto`;let r=e.getBoundingClientRect().height;e.style.height=t,ne(r),a(e=>e.find(e=>e.toastId===n.id)?e.map(e=>e.toastId===n.id?{...e,height:r}:e):[{toastId:n.id,height:r,position:n.position},...e])},[A,n.title,n.description,a,n.id,n.jsx,n.action,n.cancel]);let Te=G.useCallback(()=>{N(!0),te(he.current),a(e=>e.filter(e=>e.toastId!==n.id)),setTimeout(()=>{d(n)},gI)},[n,d,a,he]);G.useEffect(()=>{if(n.promise&&oe===`loading`||n.duration===1/0||n.type===`loading`)return;let e;return u||i||xe?(()=>{if(ge.current<me.current){let e=new Date().getTime()-me.current;re.current-=e}ge.current=new Date().getTime()})():re.current!==1/0&&(me.current=new Date().getTime(),e=setTimeout(()=>{n.onAutoClose==null||n.onAutoClose.call(n,n),Te()},re.current)),()=>clearTimeout(e)},[u,i,n,oe,xe,Te]),G.useEffect(()=>{n.delete&&(Te(),n.onDismiss==null||n.onDismiss.call(n,n))},[Te,n.delete]);function Ee(){return w?.loading?G.createElement(`div`,{className:_I(C?.loader,n?.classNames?.loader,`sonner-loader`),"data-visible":oe===`loading`},w.loading):G.createElement(JF,{className:_I(C?.loader,n?.classNames?.loader),visible:oe===`loading`})}let De=n.icon||w?.[oe]||KF(oe);return G.createElement(`li`,{tabIndex:0,ref:H,className:_I(_,le,C?.toast,n?.classNames?.toast,C?.[se],n?.classNames?.[se]),"data-sonner-toast":``,"data-rich-colors":n.richColors??f,"data-styled":!(n.jsx||n.unstyled||r),"data-mounted":A,"data-promise":!!n.promise,"data-swiped":R,"data-removed":M,"data-visible":ae,"data-y-position":ve,"data-x-position":ye,"data-index":c,"data-front":ie,"data-swiping":P,"data-dismissible":ce,"data-type":oe,"data-invert":Ce,"data-swipe-out":I,"data-swipe-direction":O,"data-expanded":!!(u||S&&A),"data-testid":n.testId,style:{"--index":c,"--toasts-before":c,"--z-index":l.length-c,"--offset":`${M?ee:he.current}px`,"--initial-height":S?`auto`:`${B}px`,...m,...n.style},onDragEnd:()=>{F(!1),D(null),_e.current=null},onPointerDown:e=>{e.button!==2&&(we||!ce||(V.current=new Date,te(he.current),e.target.setPointerCapture(e.pointerId),e.target.tagName!==`BUTTON`&&(F(!0),_e.current={x:e.clientX,y:e.clientY})))},onPointerUp:()=>{if(I||!ce)return;_e.current=null;let e=Number(H.current?.style.getPropertyValue(`--swipe-amount-x`).replace(`px`,``)||0),t=Number(H.current?.style.getPropertyValue(`--swipe-amount-y`).replace(`px`,``)||0),r=new Date().getTime()-V.current?.getTime(),i=E===`x`?e:t,a=Math.abs(i)/r;if((E===`x`?Se.includes(e>0?`right`:`left`):Se.includes(t>0?`bottom`:`top`))&&(Math.abs(i)>=hI||a>.11)){te(he.current),n.onDismiss==null||n.onDismiss.call(n,n),k(E===`x`?e>0?`right`:`left`:t>0?`down`:`up`),Te(),L(!0);return}var o,s;(o=H.current)==null||o.style.setProperty(`--swipe-amount-x`,`0px`),(s=H.current)==null||s.style.setProperty(`--swipe-amount-y`,`0px`),z(!1),F(!1),D(null)},onPointerMove:e=>{var t,n;if(!_e.current||!ce||window.getSelection()?.toString().length>0)return;let r=e.clientY-_e.current.y,i=e.clientX-_e.current.x;!E&&(Math.abs(i)>1||Math.abs(r)>1)&&D(Math.abs(i)>Math.abs(r)?`x`:`y`);let a={x:0,y:0},o=e=>1/(1.5+Math.abs(e)/20);if(E===`y`){if(Se.includes(`top`)||Se.includes(`bottom`)){if(Se.includes(`top`)&&r<0||Se.includes(`bottom`)&&r>0)a.y=r;else{let e=r*o(r);a.y=Math.abs(e)<Math.abs(r)?e:r}}}else if(E===`x`&&(Se.includes(`left`)||Se.includes(`right`))){if(Se.includes(`left`)&&i<0||Se.includes(`right`)&&i>0)a.x=i;else{let e=i*o(i);a.x=Math.abs(e)<Math.abs(i)?e:i}}(Math.abs(a.x)>0||Math.abs(a.y)>0)&&z(!0),(t=H.current)==null||t.style.setProperty(`--swipe-amount-x`,`${a.x}px`),(n=H.current)==null||n.style.setProperty(`--swipe-amount-y`,`${a.y}px`)}},fe&&!n.jsx&&oe!==`loading`?G.createElement(`button`,{"aria-label":T,"data-disabled":we,"data-close-button":!0,onClick:we||!ce?()=>{}:()=>{Te(),n.onDismiss==null||n.onDismiss.call(n,n)},className:_I(C?.closeButton,n?.classNames?.closeButton)},w?.close??$F):null,(oe||n.icon||n.promise)&&n.icon!==null&&(w?.[oe]!==null||n.icon)?G.createElement(`div`,{"data-icon":``,className:_I(C?.icon,n?.classNames?.icon)},oe===`loading`?n.icon||Ee():n.promise?Ee():null,oe===`loading`?null:De):null,G.createElement(`div`,{"data-content":``,className:_I(C?.content,n?.classNames?.content)},G.createElement(`div`,{"data-title":``,className:_I(C?.title,n?.classNames?.title)},n.jsx?n.jsx:typeof n.title==`function`?n.title():n.title),n.description?G.createElement(`div`,{"data-description":``,className:_I(v,ue,C?.description,n?.classNames?.description)},typeof n.description==`function`?n.description():n.description):null),G.isValidElement(n.cancel)?n.cancel:n.cancel&&cI(n.cancel)?G.createElement(`button`,{"data-button":!0,"data-cancel":!0,style:n.cancelButtonStyle||h,onClick:e=>{cI(n.cancel)&&ce&&(n.cancel.onClick==null||n.cancel.onClick.call(n.cancel,e),Te())},className:_I(C?.cancelButton,n?.classNames?.cancelButton)},n.cancel.label):null,G.isValidElement(n.action)?n.action:n.action&&cI(n.action)?G.createElement(`button`,{"data-button":!0,"data-action":!0,style:n.actionButtonStyle||g,onClick:e=>{cI(n.action)&&(n.action.onClick==null||n.action.onClick.call(n.action,e),!e.defaultPrevented&&Te())},className:_I(C?.actionButton,n?.classNames?.actionButton)},n.action.label):null)};function bI(){if(typeof window>`u`||typeof document>`u`)return`ltr`;let e=document.documentElement.getAttribute(`dir`);return e===`auto`||!e?window.getComputedStyle(document.documentElement).direction:e}function xI(e,t){let n={};return[e,t].forEach((e,t)=>{let r=t===1,i=r?`--mobile-offset`:`--offset`,a=r?dI:uI;function o(e){[`top`,`right`,`bottom`,`left`].forEach(t=>{n[`${i}-${t}`]=typeof e==`number`?`${e}px`:e})}typeof e==`number`||typeof e==`string`?o(e):typeof e==`object`?[`top`,`right`,`bottom`,`left`].forEach(t=>{e[t]===void 0?n[`${i}-${t}`]=a:n[`${i}-${t}`]=typeof e[t]==`number`?`${e[t]}px`:e[t]}):o(a)}),n}var SI=G.forwardRef(function(e,t){let{id:n,invert:r,position:i=`bottom-right`,hotkey:a=[`altKey`,`KeyT`],expand:o,closeButton:s,className:c,offset:l,mobileOffset:u,theme:d=`light`,richColors:f,duration:p,style:m,visibleToasts:h=lI,toastOptions:g,dir:_=bI(),gap:v=mI,icons:y,customAriaLabel:b,containerAriaLabel:x=`Notifications`}=e,[S,C]=G.useState([]),w=G.useMemo(()=>n?S.filter(e=>e.toasterId===n):S.filter(e=>!e.toasterId),[S,n]),T=G.useMemo(()=>Array.from(new Set([i].concat(w.filter(e=>e.position).map(e=>e.position)))),[w,i]),[E,D]=G.useState([]),[O,k]=G.useState(!1),[A,j]=G.useState(!1),[M,N]=G.useState(d===`system`?typeof window<`u`&&window.matchMedia&&window.matchMedia(`(prefers-color-scheme: dark)`).matches?`dark`:`light`:d),P=G.useRef(null),F=a.join(`+`).replace(/Key/g,``).replace(/Digit/g,``),I=G.useRef(null),L=G.useRef(!1),R=G.useCallback(e=>{C(t=>(t.find(t=>t.id===e.id)?.delete||iI.dismiss(e.id),t.filter(({id:t})=>t!==e.id)))},[]);return G.useEffect(()=>iI.subscribe(e=>{if(e.dismiss){requestAnimationFrame(()=>{C(t=>t.map(t=>t.id===e.id?{...t,delete:!0}:t))});return}setTimeout(()=>{WF.flushSync(()=>{C(t=>{let n=t.findIndex(t=>t.id===e.id);return n===-1?[e,...t]:[...t.slice(0,n),{...t[n],...e},...t.slice(n+1)]})})})}),[]),G.useEffect(()=>{if(d!==`system`){N(d);return}if(d===`system`&&(window.matchMedia&&window.matchMedia(`(prefers-color-scheme: dark)`).matches?N(`dark`):N(`light`)),typeof window>`u`)return;let e=window.matchMedia(`(prefers-color-scheme: dark)`);try{e.addEventListener(`change`,({matches:e})=>{N(e?`dark`:`light`)})}catch{e.addListener(({matches:e})=>{try{N(e?`dark`:`light`)}catch(e){console.error(e)}})}},[d]),G.useEffect(()=>{S.length<=1&&k(!1)},[S]),G.useEffect(()=>{let e=e=>{if(a.length>0&&a.every(t=>e[t]||e.code===t)){var t;k(!0),(t=P.current)==null||t.focus()}e.code===`Escape`&&(document.activeElement===P.current||P.current?.contains(document.activeElement))&&k(!1)};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[a]),G.useEffect(()=>{if(P.current)return()=>{I.current&&(I.current.focus({preventScroll:!0}),I.current=null,L.current=!1)}},[P.current]),G.createElement(`section`,{ref:t,"aria-label":b??`${x} ${F}`,tabIndex:-1,"aria-live":`polite`,"aria-relevant":`additions text`,"aria-atomic":`false`,suppressHydrationWarning:!0,"data-react-aria-top-layer":!0},T.map((t,n)=>{let[i,a]=t.split(`-`);return w.length?G.createElement(`ol`,{key:t,dir:_===`auto`?bI():_,tabIndex:-1,ref:P,className:c,"data-sonner-toaster":!0,"data-sonner-theme":M,"data-y-position":i,"data-x-position":a,style:{"--front-toast-height":`${E[0]?.height||0}px`,"--width":`${pI}px`,"--gap":`${v}px`,...m,...xI(l,u)},onBlur:e=>{L.current&&!e.currentTarget.contains(e.relatedTarget)&&(L.current=!1,I.current&&=(I.current.focus({preventScroll:!0}),null))},onFocus:e=>{e.target instanceof HTMLElement&&e.target.dataset.dismissible===`false`||L.current||(L.current=!0,I.current=e.relatedTarget)},onMouseEnter:()=>k(!0),onMouseMove:()=>k(!0),onMouseLeave:()=>{A||k(!1)},onDragEnd:()=>k(!1),onPointerDown:e=>{e.target instanceof HTMLElement&&e.target.dataset.dismissible===`false`||j(!0)},onPointerUp:()=>j(!1)},w.filter(e=>!e.position&&n===0||e.position===t).map((n,i)=>G.createElement(yI,{key:n.id,icons:y,index:i,toast:n,defaultRichColors:f,duration:g?.duration??p,className:g?.className,descriptionClassName:g?.descriptionClassName,invert:r,visibleToasts:h,closeButton:g?.closeButton??s,interacting:A,position:t,style:g?.style,unstyled:g?.unstyled,classNames:g?.classNames,cancelButtonStyle:g?.cancelButtonStyle,actionButtonStyle:g?.actionButtonStyle,closeButtonAriaLabel:g?.closeButtonAriaLabel,removeToast:R,toasts:w.filter(e=>e.position==n.position),heights:E.filter(e=>e.position==n.position),setHeights:D,expandByDefault:o,gap:v,expanded:O,swipeDirections:e.swipeDirections}))):null}))}),CI=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),wI=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),TI={xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`},EI=(0,G.forwardRef)(({color:e=`currentColor`,size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:i=``,children:a,iconNode:o,...s},c)=>(0,G.createElement)(`svg`,{ref:c,...TI,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:wI(`lucide`,i),...s},[...o.map(([e,t])=>(0,G.createElement)(e,t)),...Array.isArray(a)?a:[a]])),DI=(e,t)=>{let n=(0,G.forwardRef)(({className:n,...r},i)=>(0,G.createElement)(EI,{ref:i,iconNode:t,className:wI(`lucide-${CI(e)}`,n),...r}));return n.displayName=`${e}`,n},OI=DI(`ArrowUp`,[[`path`,{d:`m5 12 7-7 7 7`,key:`hav0vg`}],[`path`,{d:`M12 19V5`,key:`x0mq9r`}]]),kI=DI(`AudioLines`,[[`path`,{d:`M2 10v3`,key:`1fnikh`}],[`path`,{d:`M6 6v11`,key:`11sgs0`}],[`path`,{d:`M10 3v18`,key:`yhl04a`}],[`path`,{d:`M14 8v7`,key:`3a1oy3`}],[`path`,{d:`M18 5v13`,key:`123xd1`}],[`path`,{d:`M22 10v3`,key:`154ddg`}]]),AI=DI(`Check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),jI=DI(`ChevronDown`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]),MI=DI(`ChevronUp`,[[`path`,{d:`m18 15-6-6-6 6`,key:`153udz`}]]),NI=DI(`Clock`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`polyline`,{points:`12 6 12 12 16 14`,key:`68esgv`}]]),PI=DI(`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`}]]),FI=DI(`Ellipsis`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`19`,cy:`12`,r:`1`,key:`1wjl8i`}],[`circle`,{cx:`5`,cy:`12`,r:`1`,key:`1pcz8c`}]]),II=DI(`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`}]]),LI=DI(`FolderTree`,[[`path`,{d:`M20 10a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1h-2.5a1 1 0 0 1-.8-.4l-.9-1.2A1 1 0 0 0 15 3h-2a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z`,key:`hod4my`}],[`path`,{d:`M20 21a1 1 0 0 0 1-1v-3a1 1 0 0 0-1-1h-2.9a1 1 0 0 1-.88-.55l-.42-.85a1 1 0 0 0-.92-.6H13a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z`,key:`w4yl2u`}],[`path`,{d:`M3 5a2 2 0 0 0 2 2h3`,key:`f2jnh7`}],[`path`,{d:`M3 3v13a2 2 0 0 0 2 2h3`,key:`k8epm1`}]]),RI=DI(`Folder`,[[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}]]),zI=DI(`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`}]]),BI=DI(`ImagePlus`,[[`path`,{d:`M16 5h6`,key:`1vod17`}],[`path`,{d:`M19 2v6`,key:`4bpg5p`}],[`path`,{d:`M21 11.5V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h7.5`,key:`1ue2ih`}],[`path`,{d:`m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21`,key:`1xmnt7`}],[`circle`,{cx:`9`,cy:`9`,r:`2`,key:`af1f0g`}]]),VI=DI(`Image`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}],[`circle`,{cx:`9`,cy:`9`,r:`2`,key:`af1f0g`}],[`path`,{d:`m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21`,key:`1xmnt7`}]]),HI=DI(`Info`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 16v-4`,key:`1dtifu`}],[`path`,{d:`M12 8h.01`,key:`e9boi3`}]]),UI=DI(`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`}]]),WI=DI(`Mic`,[[`path`,{d:`M12 2a3 3 0 0 0-3 3v7a3 3 0 0 0 6 0V5a3 3 0 0 0-3-3Z`,key:`131961`}],[`path`,{d:`M19 10v2a7 7 0 0 1-14 0v-2`,key:`1vc78b`}],[`line`,{x1:`12`,x2:`12`,y1:`19`,y2:`22`,key:`x3vr5v`}]]),GI=DI(`Minus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}]]),KI=DI(`Pause`,[[`rect`,{x:`14`,y:`4`,width:`4`,height:`16`,rx:`1`,key:`zuxfzm`}],[`rect`,{x:`6`,y:`4`,width:`4`,height:`16`,rx:`1`,key:`1okwgv`}]]),qI=DI(`Play`,[[`polygon`,{points:`6 3 20 12 6 21 6 3`,key:`1oa8hb`}]]),JI=DI(`Plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]),YI=DI(`SlidersHorizontal`,[[`line`,{x1:`21`,x2:`14`,y1:`4`,y2:`4`,key:`obuewd`}],[`line`,{x1:`10`,x2:`3`,y1:`4`,y2:`4`,key:`1q6298`}],[`line`,{x1:`21`,x2:`12`,y1:`12`,y2:`12`,key:`1iu8h1`}],[`line`,{x1:`8`,x2:`3`,y1:`12`,y2:`12`,key:`ntss68`}],[`line`,{x1:`21`,x2:`16`,y1:`20`,y2:`20`,key:`14d8ph`}],[`line`,{x1:`12`,x2:`3`,y1:`20`,y2:`20`,key:`m0wm8r`}],[`line`,{x1:`14`,x2:`14`,y1:`2`,y2:`6`,key:`14e1ph`}],[`line`,{x1:`8`,x2:`8`,y1:`10`,y2:`14`,key:`1i6ji0`}],[`line`,{x1:`16`,x2:`16`,y1:`18`,y2:`22`,key:`1lctlv`}]]),XI=DI(`Square`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}]]),ZI=DI(`Upload`,[[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}],[`polyline`,{points:`17 8 12 3 7 8`,key:`t8dd8p`}],[`line`,{x1:`12`,x2:`12`,y1:`3`,y2:`15`,key:`widbto`}]]),QI=DI(`X`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]),$I=Object.freeze({alphaIntercept:-9,alphaSlope:19,blurStdDeviation:1.5}),eL=Object.freeze([`2xs`,`xs`,`sm`,`md`,`lg`,`xl`,`2xl`,`3xl`,`4xl`]);Object.freeze(`--stipe-font-synthesis.--stipe-surface-frame-width.--stipe-surface-frame-image.--stipe-surface-molding-contrast.--stipe-shadow-raised.--stipe-shadow-inset.--stipe-shadow-edge.--stipe-display-gasket-face.--stipe-display-texture-image.--stipe-display-text-shadow.--stipe-canvas.--stipe-surface.--stipe-surface-raised.--stipe-surface-selected.--stipe-fg-muted.--stipe-linework.--stipe-hairline.--stipe-hairline-quiet.--stipe-figure-ink.--stipe-density-compact.--stipe-density-comfortable.--stipe-motion-spring.--stipe-motion-squish.--stipe-motion-fast.--stipe-motion-normal.--stipe-motion-slow.--stipe-motion-ease.--stipe-motion-ease-exit.--stipe-motion-bounce.--stipe-motion-spring-duration.--stipe-motion-stretch.--stipe-motion-distance.--stipe-motion-stagger.--stipe-motion-blur.--stipe-motion-shake.--stipe-motion-steps.--stipe-motion-fuse.--stipe-press-depth.--stipe-press-scale.--stipe-layer-desktop.--stipe-layer-windows.--stipe-layer-chrome.--stipe-layer-popover.--stipe-layer-dialog.--stipe-layer-toast.--stipe-layer-tooltip.--stipe-overlay-shadow-outset.--stipe-icon-size-sm.--stipe-icon-size-md.--stipe-icon-size-lg.--stipe-icon-stroke.--stipe-card-rim.--stipe-card-rim-edge.--stipe-card-face.--stipe-card-panel.--stipe-card-ink.--stipe-card-ink-muted.--stipe-card-accent.--stipe-card-shadow.--stipe-card-foil-highlight.--stipe-card-foil-warm.--stipe-card-foil-cool.--stipe-avatar-shadow.--stipe-art-coral.--stipe-art-blue.--stipe-art-mint.--stipe-art-grape.--stipe-art-yellow.--stipe-art-cream.--stipe-art-ink.--stipe-art-inkcap.--stipe-art-graphite.--stipe-sketch-ink`.split(`.`));function tL(e){var t,n,r=``;if(typeof e==`string`||typeof e==`number`)r+=e;else if(typeof e==`object`){if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(n=tL(e[t]))&&(r&&(r+=` `),r+=n)}else for(n in e)e[n]&&(r&&(r+=` `),r+=n)}return r}function nL(){for(var e,t,n=0,r=``,i=arguments.length;n<i;n++)(e=arguments[n])&&(t=tL(e))&&(r&&(r+=` `),r+=t);return r}var rL=e=>typeof e==`boolean`?`${e}`:e===0?`0`:e,iL=nL,aL=(e,t)=>n=>{if(t?.variants==null)return iL(e,n?.class,n?.className);let{variants:r,defaultVariants:i}=t,a=Object.keys(r).map(e=>{let t=n?.[e],a=i?.[e];if(t===null)return null;let o=rL(t)||rL(a);return r[e][o]}),o=n&&Object.entries(n).reduce((e,t)=>{let[n,r]=t;return r===void 0||(e[n]=r),e},{});return iL(e,a,t?.compoundVariants?.reduce((e,t)=>{let{class:n,className:r,...a}=t;return Object.entries(a).every(e=>{let[t,n]=e;return Array.isArray(n)?n.includes({...i,...o}[t]):{...i,...o}[t]===n})?[...e,n,r]:e},[]),n?.class,n?.className)},oL=Object.defineProperty,sL=((e,t)=>{let n={};for(var r in e)oL(n,r,{get:e[r],enumerable:!0});return t||oL(n,Symbol.toStringTag,{value:`Module`}),n})({isAny:()=>xL,isAnyNonArbitrary:()=>EL,isArbitraryFamilyName:()=>UL,isArbitraryImage:()=>GL,isArbitraryLength:()=>BL,isArbitraryNumber:()=>VL,isArbitraryPosition:()=>WL,isArbitraryShadow:()=>KL,isArbitrarySize:()=>RL,isArbitraryValue:()=>zL,isArbitraryVariable:()=>qL,isArbitraryVariableFamilyName:()=>YL,isArbitraryVariableImage:()=>QL,isArbitraryVariableLength:()=>JL,isArbitraryVariablePosition:()=>XL,isArbitraryVariableShadow:()=>$L,isArbitraryVariableSize:()=>ZL,isArbitraryVariableWeight:()=>eR,isArbitraryWeight:()=>HL,isFraction:()=>gL,isInteger:()=>vL,isNamedContainerQuery:()=>DL,isNumber:()=>_L,isPercent:()=>yL,isTshirtSize:()=>bL}),cL=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,lL=/^\((?:(\w[\w-]*):)?(.+)\)$/i,uL=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,dL=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,fL=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,pL=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,mL=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,hL=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,gL=e=>uL.test(e),_L=e=>!!e&&!Number.isNaN(Number(e)),vL=e=>!!e&&Number.isInteger(Number(e)),yL=e=>e.endsWith(`%`)&&_L(e.slice(0,-1)),bL=e=>dL.test(e),xL=()=>!0,SL=e=>fL.test(e)&&!pL.test(e),CL=()=>!1,wL=e=>mL.test(e),TL=e=>hL.test(e),EL=e=>!zL(e)&&!qL(e),DL=e=>e.startsWith(`@container`)&&(e[10]===`/`&&e[11]!==void 0||e[11]===`s`&&e[16]!==void 0&&e.startsWith(`-size/`,10)||e[11]===`n`&&e[18]!==void 0&&e.startsWith(`-normal/`,10)),OL=(e,t,n)=>{let r=cL.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},kL=(e,t,n=!1)=>{let r=lL.exec(e);return r?r[1]?t(r[1]):n:!1},AL=e=>e===`position`||e===`percentage`,jL=e=>e===`image`||e===`url`,ML=e=>e===`length`||e===`size`||e===`bg-size`,NL=e=>e===`length`,PL=e=>e===`number`,FL=e=>e===`family-name`,IL=e=>e===`number`||e===`weight`,LL=e=>e===`shadow`,RL=e=>OL(e,ML,CL),zL=e=>cL.test(e),BL=e=>OL(e,NL,SL),VL=e=>OL(e,PL,_L),HL=e=>OL(e,IL,xL),UL=e=>OL(e,FL,CL),WL=e=>OL(e,AL,CL),GL=e=>OL(e,jL,TL),KL=e=>OL(e,LL,wL),qL=e=>lL.test(e),JL=e=>kL(e,NL),YL=e=>kL(e,FL),XL=e=>kL(e,AL),ZL=e=>kL(e,ML),QL=e=>kL(e,jL),$L=e=>kL(e,LL,!0),eR=e=>kL(e,IL,!0),tR=(e,t)=>{let n=Object.keys(e);return n.length===1&&n[0]===t&&typeof e[t]==`string`},nR=e=>typeof e==`function`&&e.isThemeGetter===!0,rR=e=>({...e,theme:{...e.theme},classGroups:{...e.classGroups},conflictingClassGroups:{...e.conflictingClassGroups},conflictingClassGroupModifiers:{...e.conflictingClassGroupModifiers},orderSensitiveModifiers:[...e.orderSensitiveModifiers],postfixLookupClassGroups:[...e.postfixLookupClassGroups??[]]}),iR=(e,t)=>{let n=rR(e);t.prefix!==void 0&&(n.prefix=t.prefix);let r=(e,t)=>{if(t)for(let n in t)t[n]!==void 0&&(e[n]=t[n])},i=t.override;i&&(i.orderSensitiveModifiers&&(n.orderSensitiveModifiers=[...i.orderSensitiveModifiers]),r(n.theme,i.theme),r(n.classGroups,i.classGroups),r(n.conflictingClassGroups,i.conflictingClassGroups),r(n.conflictingClassGroupModifiers,i.conflictingClassGroupModifiers));let a=(e,t)=>{if(t)for(let n in t){let r=t[n];r&&(e[n]=(e[n]??[]).concat(r))}},o=t.extend;return o&&(o.orderSensitiveModifiers&&(n.orderSensitiveModifiers=[...n.orderSensitiveModifiers,...o.orderSensitiveModifiers]),a(n.theme,o.theme),a(n.classGroups,o.classGroups),a(n.conflictingClassGroups,o.conflictingClassGroups),a(n.conflictingClassGroupModifiers,o.conflictingClassGroupModifiers)),n},aR={isAny:0,isAnyNonArbitrary:1,isArbitraryValue:2,isArbitraryVariable:3,isFraction:4,isNumber:5,isInteger:6,isPercent:7,isTshirtSize:8,isNamedContainerQuery:9,isArbitraryLength:10,isArbitraryNumber:11,isArbitraryWeight:12,isArbitraryFamilyName:13,isArbitraryPosition:14,isArbitrarySize:15,isArbitraryImage:16,isArbitraryShadow:17,isArbitraryVariableLength:18,isArbitraryVariableFamilyName:19,isArbitraryVariablePosition:20,isArbitraryVariableSize:21,isArbitraryVariableImage:22,isArbitraryVariableShadow:23,isArbitraryVariableWeight:24},oR=25,sR=()=>({names:[],idByName:new Map,impls:{},fnName:new Map,classifierFns:new Map}),cR=(e,t,n)=>{let r=e.idByName.get(t);return r===void 0&&(r=e.names.length,e.names.push(t),e.idByName.set(t,r),e.classifierFns.set(t,n)),r},lR=(e,t)=>{if(typeof t==`function`){let n=e.fnName.get(t);return n===void 0&&(n=`$c`+e.fnName.size,e.fnName.set(t,n),e.impls[n]=t),cR(e,n,t)}let n=t.$v,r=sL[n];if(aR[n]===void 0||!r)throw Error(`cn: unknown validator "${n}"`);return cR(e,n,r)},uR=()=>({nextPart:new Map,validators:null,classGroupId:-1,lit:[]}),dR=(e,t)=>e.theme[t]??[],fR=(e,t,n)=>{let r=uR(),i=(e,t)=>{for(let n of t.split(`-`)){let t=e.nextPart.get(n);t||(t=uR(),e.nextPart.set(n,t)),e=t}return e},a=(n,r,o)=>{if(typeof n==`string`){let e=n===``?r:i(r,n);e.classGroupId=o;return}if(typeof n==`function`){if(nR(n)){for(let t of n(e.theme))a(t,r,o);return}(r.validators??=[]).push({validatorId:lR(t,n),groupId:o});return}if(tR(n,`$t`)){for(let t of dR(e,n.$t))a(t,r,o);return}if(tR(n,`$v`)){(r.validators??=[]).push({validatorId:lR(t,n),groupId:o});return}for(let[e,t]of Object.entries(n)){let n=i(r,e);for(let e of t)a(e,n,o)}};for(let[t,i]of Object.entries(e.classGroups)){let e=n(t);for(let t of i)a(t,r,e)}return r},pR=e=>{let t=sR(),n=[],r=new Map,i=e=>{let t=r.get(e);return t===void 0&&(t=n.length,n.push(e),r.set(e,t)),t},a=fR(e,t,i),o=e=>{if(e.validators)return!1;for(let t of e.nextPart.values())if(!o(t))return!1;return!0},s=(e,t,n)=>{e.classGroupId>=0&&n.push({tail:t,gid:e.classGroupId});for(let[r,i]of e.nextPart)s(i,t+`-`+r,n)},c=e=>{for(let[t,n]of[...e.nextPart])o(n)?(s(n,t,e.lit),e.nextPart.delete(t)):c(n)};c(a);let l=[{edges:new Map,groupId:-1,vlist:-1}],u=()=>(l.push({edges:new Map,groupId:-1,vlist:-1}),l.length-1),d=[],f=new Map,p=e=>{let t=e.map(e=>e.validatorId+`:`+e.groupId).join(`,`),n=f.get(t);return n===void 0&&(n=d.length,d.push(e.map(e=>[e.validatorId,e.groupId])),f.set(t,n)),n},m=(e,t)=>{let n=e;for(let e=0;e<t.length;e++){let r=t.charCodeAt(e),i=l[n].edges.get(r);i===void 0&&(i=u(),l[n].edges.set(r,i)),n=i}return n},h=[],g=(e,t,n)=>{e.classGroupId>=0&&(l[t].groupId=e.classGroupId),e.validators&&(l[t].vlist=p(e.validators));for(let{tail:n,gid:r}of e.lit)h.push({anchor:t,tail:n,gid:r});for(let[r,i]of e.nextPart){let e=t;if(!n){let n=l[t].edges.get(45);n===void 0&&(n=u(),l[t].edges.set(45,n)),e=n}let a=m(e,r);g(i,a,!1)}};g(a,0,!0);let _=new Set(h.map(e=>e.anchor)),v=e=>l[e].groupId>=0||l[e].vlist>=0||_.has(e),y=new Map,b=[],x=e=>{let t=b.length;y.set(e,t);let n={edges:[],groupId:l[e].groupId,vlist:l[e].vlist};b.push(n);let r=[...l[e].edges.entries()].sort((e,t)=>e[0]-t[0]);for(let[e,t]of r){let r=String.fromCharCode(e),i=t;for(;l[i].edges.size===1&&!v(i);){let[[e,t]]=l[i].edges.entries();r+=String.fromCharCode(e),i=t}n.edges.push({label:r,oldTarget:i})}for(let e of n.edges)x(e.oldTarget);return t};x(0);let S=b.length,C=0;for(let e of b)C+=e.edges.length;let w=new Int32Array(S),T=new Int32Array(C),E=``,D=new Int32Array(S),O=new Int32Array(S),k=[];{let e=0;for(let t=0;t<S;t++){let n=b[t];w[t]=n.edges.length;for(let t of n.edges)T[e]=t.label.length,E+=t.label,k.push(y.get(t.oldTarget)),e++;D[t]=n.groupId,O[t]=n.vlist}}{let e=new Int32Array(S);for(let t=S-1;t>=0;t--){let n=1,r=t+1;for(let i=0;i<w[t];i++)n+=e[r],r+=e[r];e[t]=n}let t=0;for(let n=0;n<S;n++){let r=n+1;for(let i=0;i<w[n];i++){if(r!==k[t])throw Error(`cn compiler: edge target mismatch at ${t}`);r+=e[r],t++}}}for(let e of h)e.anchor=y.get(e.anchor);{let e=new Int32Array(d.length).fill(-1),t=[];for(let n=0;n<S;n++){let r=O[n];r>=0&&(e[r]===-1&&(e[r]=t.length,t.push(d[r])),O[n]=e[r])}d.length=0,d.push(...t)}let A=0;for(let e of d)A+=e.length;let j=new Int32Array(A),M=new Int32Array(A);{let e=0;for(let t of d)for(let[n,r]of t)j[e]=n,M[e]=r,e++}h.sort((e,t)=>e.anchor-t.anchor||e.gid-t.gid||(e.tail<t.tail?-1:1));let N=[];for(let e of h){let t=N[N.length-1];t&&t.anchor===e.anchor&&t.gid===e.gid?t.tails.push(e.tail):N.push({anchor:e.anchor,gid:e.gid,tails:[e.tail],set:-1})}let P=new Map,F=[];for(let e of N){let t=e.tails.join(` `),n=P.get(t);n===void 0&&(n=F.length,P.set(t,n),F.push(e.tails)),e.set=n}for(let e of F.flat())if(e.includes(`|`)||e.includes(` `))throw Error(`cn compiler: tail contains delimiter: `+e);let I=new Set(F.flat()).size;N.sort((e,t)=>e.anchor-t.anchor||e.set-t.set);for(let t of Object.values(e.conflictingClassGroups))for(let e of t)i(e);for(let t of Object.values(e.conflictingClassGroupModifiers))for(let e of t)i(e);for(let t of e.postfixLookupClassGroups??[])i(t);let L=n.length,R=new Int32Array(L).fill(-1),z=0,ee=e=>(R[e]===-1&&(R[e]=z++),R[e]);for(let e=0;e<M.length;e++)M[e]=ee(M[e]);for(let e of N)e.gid=ee(e.gid);for(let e=0;e<D.length;e++)D[e]>=0&&(D[e]=ee(D[e]));for(let e=0;e<L;e++)R[e]===-1&&(R[e]=z++);let te=Array(L);for(let e=0;e<L;e++)te[R[e]]=n[e];let B=[],ne=[],re=[],V=[],H=[];for(let t=0;t<L;t++){let n=te[t],i=(e.conflictingClassGroups[n]??[]).map(e=>R[r.get(e)]),a=(e.conflictingClassGroupModifiers[n]??[]).map(e=>R[r.get(e)]);i.length&&(B.push(t),ne.push(i.length),re.push(...i));for(let e of a)V.push(t),H.push(e)}let ie=(e.postfixLookupClassGroups??[]).map(e=>R[r.get(e)]),ae=[],oe=new Int32Array(j.length);for(let e=0;e<j.length;e++){let n=t.names[j[e]],r=aR[n];if(r!==void 0)oe[e]=r;else{let t=ae.indexOf(n);t===-1&&(t=ae.length,ae.push(n)),oe[e]=oR+t}}let se=new Map,ce=[],le=[],ue=[];{let e=0;for(let t of d){let n=[];for(let r=0;r<t.length;r++)n.push(oe[e++]);let r=n.join(`,`),i=se.get(r);i===void 0&&(i=ce.length,se.set(r,i),ce.push(n.length),le.push(...n)),ue.push(i)}}let de={};for(let e of ae)de[e]=t.classifierFns.get(e);return{G:L,customNames:ae,impls:de,edgeCounts:w,edgeLabelLen:T,labelText:E,edgeTargetActual:k,nodeGroup:D,nodeVlist:O,nodeCount:S,totalEdges:C,patCounts:ce,patOps:le,listPat:ue,vlistGroup:M,litEntries:h,sets:F,attachments:N,uniqueTailCount:I,adjGid:B,adjCnt:ne,adjTgt:re,patGid:V,patTgt:H,postfixLookup:ie,orderSensitiveModifiers:e.orderSensitiveModifiers.join(` `),prefix:e.prefix}},mR=e=>{let t=new Int32Array(e.length+1);for(let n=0;n<e.length;n++)t[n+1]=t[n]+e[n];return t},hR=e=>{let t=pR(e),n=t.litEntries.length,r=new Int32Array(n),i=new Int32Array(n),a=new Int32Array(n),o=``,s=new Int32Array(t.uniqueTailCount*2);{let e=new Map,n=0,c=0;for(let l of t.attachments)for(let u of t.sets[l.set]){let t=e.get(u);t===void 0&&(t=n++,e.set(u,t),s[t*2]=o.length,s[t*2+1]=u.length,o+=u),r[c]=l.anchor,i[c]=l.gid,a[c]=t,c++}}return{tables:{GROUP_COUNT:t.G,edgeStart:mR(t.edgeCounts),labelStart:mR(t.edgeLabelLen),labelText:t.labelText,edgeTarget:Int32Array.from(t.edgeTargetActual),nodeGroup:t.nodeGroup,nodeVlist:t.nodeVlist,vlistPat:mR(t.patCounts),vlistOps:Int32Array.from(t.patOps),vlistRef:Int32Array.from(t.listPat),vlistGroup:t.vlistGroup,litAnchor:r,litGroup:i,litPool:a,poolOffsets:s,poolText:o,adjGid:Int32Array.from(t.adjGid),adjStart:mR(t.adjCnt),adjTgt:Int32Array.from(t.adjTgt),patGid:Int32Array.from(t.patGid),patTgt:Int32Array.from(t.patTgt),postfixLookupGroups:Int32Array.from(t.postfixLookup),customValidatorNames:t.customNames,orderSensitiveModifiers:t.orderSensitiveModifiers},validatorImpls:t.impls,prefix:t.prefix}},gR=`line`in Error(),_R=-1,vR=-1,yR=(e,t,n)=>{let r=2166136261;for(let i=t;i<n;i++)r=Math.imul(r^e.charCodeAt(i),16777619);return r},bR=(e,t,n)=>{let r=n-t,i=Math.imul(r,2654435761)^e.charCodeAt(t);if(r>3){let a=r>>2,o=r>>1;i=Math.imul(i^e.charCodeAt(t+1)<<8^e.charCodeAt(t+2)<<16^e.charCodeAt(t+a),2246822507),i=Math.imul(i^e.charCodeAt(t+o)<<8^e.charCodeAt(t+o+a)<<16^e.charCodeAt(n-3),3266489909),i^=e.charCodeAt(n-2)<<8^e.charCodeAt(n-1)<<16;for(let r=t+3,a=n-4;r<t+8&&r<a;r++,a--)i=Math.imul(i^e.charCodeAt(r)^e.charCodeAt(a)<<8,16777619)}return i^i>>>15|0},xR=(e,t,n={})=>{let{GROUP_COUNT:r,edgeStart:i,labelStart:a,labelText:o,edgeTarget:s,nodeGroup:c,nodeVlist:l,vlistPat:u,vlistOps:d,vlistRef:f,vlistGroup:p,litAnchor:m,litGroup:h,litPool:g,poolOffsets:_,poolText:v,adjGid:y,adjStart:b,adjTgt:x,patGid:S,patTgt:C,postfixLookupGroups:w,customValidatorNames:T,orderSensitiveModifiers:E}=e,D=new Int32Array(r).fill(-1);for(let e=0;e<y.length;e++)D[y[e]]=e;let O=0;for(let e=0;e+1<b.length;e++){let t=b[e+1]-b[e];t>O&&(O=t)}let k=32;for(;k<2*(1+O+S.length);)k<<=1;let A=new Int32Array(f.length+1);for(let e=0;e<f.length;e++)A[e+1]=A[e]+u[f[e]+1]-u[f[e]];let j=new Uint8Array(r);for(let e=0;e<w.length;e++)j[w[e]]=1;let M=i.length-1,N=new Uint8Array(M),P=0,F=!0;for(let e=0;e<m.length;e++){N[m[e]]=1;let t=_[g[e]*2+1];t>P&&(P=t);let n=v.charCodeAt(_[g[e]*2]);(n===91||n===40)&&(F=!1)}let I=1;for(;I<m.length*2;)I<<=1;let L=new Int32Array(I).fill(-1);for(let e=0;e<m.length;e++){let t=_[g[e]*2],n=(yR(v,t,t+_[g[e]*2+1])^Math.imul(m[e],2654435761)|0)&I-1;for(;L[n]!==-1;)n=n+1&I-1;L[n]=e}let R=(e,t,n,r)=>{let i=(yR(t,n,r)^Math.imul(e,2654435761)|0)&I-1,a=r-n;for(;;){let r=L[i];if(r===-1)return-1;if(m[r]===e&&_[g[r]*2+1]===a){let e=_[g[r]*2],i=!0;for(let r=0;r<a;r++)if(v.charCodeAt(e+r)!==t.charCodeAt(n+r)){i=!1;break}if(i)return h[r]}i=i+1&I-1}},z=n.cacheSize??8192,ee=n.prefix??e.prefix??``,te=ee===``?``:ee+`:`,B=te.length,ne=(T??[]).map(e=>{let n=t&&t[e];if(!n)throw Error(`cn: missing validator `+e);return n}),re=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,V=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,H=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,ie=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,ae=0,oe=-1,se=-1,ce=-1,le=-1,ue=e=>e>=97&&e<=122||e>=65&&e<=90||e>=48&&e<=57||e===95,de=e=>/\s/.test(String.fromCharCode(e)),fe=(e,t,n)=>{if(ae=0,oe=-1,n-t<3)return;let r=e.charCodeAt(t),i=e.charCodeAt(n-1);if(r===91&&i===93)ae=1;else if(r===40&&i===41)ae=2;else return;ce=t+1,le=n-1;let a=t+1;if(ue(e.charCodeAt(a))){for(a++;a<n-1;){let t=e.charCodeAt(a);if(!ue(t)&&t!==45)break;a++}a<n-2&&e.charCodeAt(a)===58&&(oe=t+1,se=a,ce=a+1)}},pe=(e,t,n,r)=>{if(n-t!==r.length)return!1;for(let n=0;n<r.length;n++)if(e.charCodeAt(t+n)!==r.charCodeAt(n))return!1;return!0},me=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,he=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,ge=e=>!!e&&!Number.isNaN(Number(e)),_e=(e,t,n)=>{if(n-t<11||!pe(e,t,t+10,`@container`))return!1;if(e.charCodeAt(t+10)===47)return n-t>=12;let r=e.charCodeAt(t+11);return r===115&&n-t>=17&&pe(e,t+10,t+16,`-size/`)||r===110&&n-t>=19&&pe(e,t+10,t+18,`-normal/`)},ve=[1,1,1,1,1,1,1,1,2,2,2,2,2,2,2],ye=`length|number|number weight|family-name|position percentage|length size bg-size|image url|shadow|length|family-name|position percentage|length size bg-size|image url|shadow|number weight`.split(`|`).map(e=>e.split(` `)),be=[2,3,1,0,0,0,4,5,0,0,0,0,0,1,1],xe=(e,t,n,r)=>{if(e>=10){if(e>=25)return ne[e-25](t.slice(n,r));let i=e-10;if(ae!==ve[i])return!1;if(oe>=0){for(let e of ye[i])if(pe(t,oe,se,e))return!0;return!1}switch(be[i]){case 0:return!1;case 1:return!0;case 2:{let e=t.slice(ce,le);return re.test(e)&&!V.test(e)}case 3:return ge(t.slice(ce,le));case 4:return ie.test(t.slice(ce,le));default:return H.test(t.slice(ce,le))}}switch(e){case 0:return!0;case 1:return ae===0;case 2:return ae===1;case 3:return ae===2;case 4:return me.test(t.slice(n,r));case 5:return ge(t.slice(n,r));case 6:{let e=t.slice(n,r);return!!e&&Number.isInteger(Number(e))}case 7:return r>n&&t.charCodeAt(r-1)===37&&ge(t.slice(n,r-1));case 8:return he.test(t.slice(n,r));default:return _e(t,n,r)}},Se=new Set(typeof E==`string`?E.split(` `):E),Ce=(e,t,n,r,i,a)=>{let o=yR(t,n,r)^(i?2654435769:0)|0,s=e.get(o);if(s!==void 0)outer:for(let e=0;e<s.length;e++){let a=s[e];if(a.imp===i&&a.k.length===r-n){for(let e=0;e<a.k.length;e++)if(a.k.charCodeAt(e)!==t.charCodeAt(n+e))continue outer;return a.id}}else e.set(o,s=[]);let c=t.slice(n,r),l=a(c);return s.push({k:c,imp:i,id:l}),l},we=new Map,Te=new Map,Ee=2,De=4096,Oe=(e,t)=>{let n=[],r=0,i=0,a=0;for(let t=0;t<e.length;t++){let o=e.charCodeAt(t);r===0&&i===0&&o===58?(n.push(e.slice(a,t)),a=t+1):o===91?r++:o===93?r--:o===40?i++:o===41&&i--}n.push(e.slice(a));let o=n[0];if(n.length>1){let e=[],t=[];for(let r of n)r.charCodeAt(0)===91||Se.has(r)?(t.length&&(e.push(...t.sort()),t=[]),e.push(r)):t.push(r);t.length&&e.push(...t.sort()),o=e.join(`:`)}let s=t?o+` !`:o,c=Te.get(s);return c===void 0&&Te.set(s,c=Ee++),c},ke=new Map,Ae=r,je=r+4096,Me=()=>Ae++,Ne=2097152,Pe=8192,Fe=new Int32Array(Pe),Ie=Array(Pe).fill(null),Le=new Int32Array(Pe),Re=new Int32Array(Pe),ze=new Uint8Array(Pe),Be=0,Ve=(e,t,n,r,i,a,o,s)=>{let c=e;if(Ie[e]!==null){if(Ie[e|1]===null)c=e|1;else if(!(Be++&3))c=e|Be>>2&1;else return}Ie[c]=t.slice(n,r),Fe[c]=i,Le[c]=a,Re[c]=o,ze[c]=s},He=()=>Ie.fill(null),Ue=256,We=[new Int32Array(Ue),new Int32Array(Ue),new Int32Array(Ue),new Int32Array(Ue)],[Ge,Ke,qe,Je]=We,Ye=new Uint8Array(Ue),Xe=new Uint8Array(Ue),Ze=()=>{Ue*=2,We=We.map(e=>{let t=new Int32Array(Ue);return t.set(e),t}),[Ge,Ke,qe,Je]=We;let e=new Uint8Array(Ue);e.set(Ye),Ye=e,Xe=new Uint8Array(Ue)},Qe=64,$e=new Int32Array(Qe),et=new Int32Array(Qe),tt=new Int32Array(r),nt=2048,rt=21,it=new Float64Array(nt),at=new Int32Array(nt),ot=0,st=(e,t)=>{if(e===0&&t<r)return tt[t]===ot?1:(tt[t]=ot,0);let n=e*2097152+t+1,i=Math.imul(n,2654435761)>>>rt;for(;at[i]===ot;){if(it[i]===n)return 1;i=i+1&nt-1}return it[i]=n,at[i]=ot,0},ct=(e,t,n,r,i)=>{if(n-t>=2&&e.charCodeAt(t)===91&&e.charCodeAt(n-1)===93){let r=-1;for(let i=t+1;i<n-1;i++)if(e.charCodeAt(i)===58){r=i;break}return r===-1||r===t+1?_R:Ce(ke,e,t+1,r,0,Me)}if(r>=0&&c[r]>=0)return c[r];for(let t=i-1;t>=0;t--){let r=et[t];if(r>n)continue;let i=$e[t],a=n-r;if(N[i]===1&&a>0&&a<=P){let t=e.charCodeAt(r);if(F===!1||t!==91&&t!==40){let t=R(i,e,r,n);if(t>=0)return t}}let o=l[i];if(o<0)continue;let s=f[o],c=u[s],m=u[s+1];if(c===m)continue;fe(e,r,n);let h=A[o]-c;for(let t=c;t<m;t++)if(xe(d[t],e,r,n))return p[h+t]}return _R},lt=e=>{let t=e.length,n=0,c=0,u=!1;(Ee>De||we.size>De)&&(we=new Map,Te=new Map,Ee=2,He()),Ae>je&&(ke=new Map,Ae=r,He());let d=0;for(;d<t;){let f=e.charCodeAt(d);if(f===32||f>=9&&f<=13||f>=160&&de(f)){f!==32&&(u=!0),d++;continue}let p=d,m=0;for(;d<t;){if(f=e.charCodeAt(d),f<=32){if(f===32)break;if(f>=9&&f<=13){u=!0;break}}else if(f>=160&&de(f)){u=!0;break}m=Math.imul(m^f,16777619),d++}let h=d,g=h-p;n===Ue&&Ze();let _=n++;Ge[_]=p,Ke[_]=h,c+=g,m^=Math.imul(g,2654435761);let v=m^m>>>15|0,y=v&8190;{let t=-1;if(Fe[y]===v&&Ie[y]!==null&&Ie[y].length===g?t=y:Fe[y|1]===v&&Ie[y|1]!==null&&Ie[y|1].length===g&&(t=y|1),t>=0){let n=Ie[t],r=!0;for(let t=0;t<g;t++)if(n.charCodeAt(t)!==e.charCodeAt(p+t)){r=!1;break}if(r){qe[_]=Le[t],Je[_]=Re[t],Ye[_]=ze[t];continue}}}let b=p;if(B!==0){if(h-p<=B||!e.startsWith(te,p)){qe[_]=_R,Ve(y,e,p,h,v,_R,0,0);continue}b=p+B}let x=0,S=0,C=-1,w=-1;for(let t=b;t<h;t++){let n=e.charCodeAt(t);if(x===0&&S===0){if(n===58){C=t;continue}if(n===47){w=t;continue}}n===91?x++:n===93?x--:n===40?S++:n===41&&S--}let T=C>=b?C+1:b,E=T,D=h,O=!1,k=0;D>E&&e.charCodeAt(D-1)===33?(O=!0,D--):D>E&&e.charCodeAt(E)===33&&(O=!0,E++,k=1);let A=-1;w>T&&(A=w+k,A>=D&&(A=-1));let M=E;D-E>1&&e.charCodeAt(E)===45&&(M=E+1);let P=0,F=0,I=0,L=-1,R=0;(l[0]>=0||N[0]===1)&&($e[0]=0,et[0]=M,R=1);let z=vR,ee=0;for(let t=M;t<D;t++)if(t===A&&(z=F<I?vR:P,ee=R),P!==vR){let n=e.charCodeAt(t),r=-1;if(F<I)o.charCodeAt(F)===n?(F++,F===I&&(r=P=L)):P=vR;else{let e=i[P],t=i[P+1],c=vR;for(let i=e;i<t;i++){let e=a[i];if(o.charCodeAt(e)===n){a[i+1]-e===1?r=c=s[i]:(F=e+1,I=a[i+1],L=s[i],c=P);break}}P=c}if(r>=0&&(l[r]>=0||N[r]===1)&&t+1<D&&e.charCodeAt(t+1)===45){if(R===Qe){Qe*=2;let e=new Int32Array(Qe);e.set($e),$e=e;let t=new Int32Array(Qe);t.set(et),et=t}$e[R]=r,et[R]=t+2,R++}}A===D&&(z=F<I?vR:P,ee=R);let ne=F<I?vR:P,re,V=!1;if(A>=0){if(V=!0,re=ct(e,E,A,z,ee),re!==_R&&re<r&&j[re]){let t=ct(e,E,D,ne,R);t!==_R&&t!==re&&(re=t,V=!1)}else re===_R&&(re=ct(e,E,D,ne,R),V=!1)}else re=ct(e,E,D,ne,R);let H=0,ie=0;re===_R?qe[_]=_R:(ie=+!!V,H=b>=C?+!!O:Ce(we,e,b,C,+!!O,e=>Oe(e,O)),qe[_]=re,Ye[_]=ie,Je[_]=H),Ve(y,e,p,h,v,re,H,ie)}if(n===0)return``;if(n===1)return Ge[0]===0&&Ke[0]===t?e:e.slice(Ge[0],Ke[0]);if(n*k>nt){for(;n*k>nt;)nt<<=1,rt--;it=new Float64Array(nt),at=new Int32Array(nt)}if(Ee>=Ne||Ae>=Ne)throw Error(`cn: too many distinct classes in one merge`);ot=ot+1|0,ot===0&&(tt.fill(0),at.fill(0),ot=1);let f=!1;for(let e=n-1;e>=0;e--){let t=qe[e];if(t===_R){Xe[e]=1;continue}let n=Je[e];if(st(n,t)===1){Xe[e]=0,f=!0;continue}if(Xe[e]=1,t<r){let r=D[t];if(r>=0)for(let e=b[r];e<b[r+1];e++)st(n,x[e]);if(Ye[e]&1)for(let e=0;e<S.length;e++)S[e]===t&&st(n,C[e])}}if(!f&&!u&&t===c+n-1)return e;let p=``,m=0;for(;m<n;){if(!Xe[m]){m++;continue}let t=Ge[m],r=Ke[m],i=m+1;for(;i<n&&Xe[i]&&Ge[i]===r+1&&e.charCodeAt(r)===32;)r=Ke[i],i++;p.length>0&&(p+=` `),p+=e.slice(t,r),m=i}return p},ut=16384,dt=new Int32Array(ut*2),ft=0,pt=1,mt=Object.create(null),ht=Object.create(null),gt=new Map,_t=new Map,vt=0,yt=0,bt=()=>{ft^=ut,pt=pt+1|0,yt=0},xt=e=>{let t=mt[e];if(t!==void 0)return t;let n=bR(e,0,e.length),r=(n&16383)+ft,i=dt[r]===(n^pt)||dt[r^ut]===(n^pt-1);return i&&(t=ht[e],t!==void 0)?(mt[e]=t,t):(t=lt(e),i?(mt[e]=t,++vt>z&&(vt=0,ht=mt,mt=Object.create(null),bt())):(dt[r]=n^pt,++yt>ut&&bt()),t)},St=e=>{let t=gt.get(e);if(t!==void 0)return t;let n=bR(e,0,e.length),r=(n&16383)+ft,i=dt[r]===(n^pt)||dt[r^ut]===(n^pt-1);return i&&(t=_t.get(e),t!==void 0)?(gt.set(e,t),t):(t=lt(e),i?(gt.set(e,t),++vt>z&&(vt=0,_t=gt,gt=new Map,bt())):(dt[r]=n^pt,++yt>ut&&bt()),t)},Ct=e=>{let t=bR(e,0,e.length),n=(t&16383)+ft;return dt[n]===(t^pt)||dt[n^ut]===(t^pt-1)||(dt[n]=t^pt,++yt>ut&&bt(),!1)},wt=z===0?lt:gR?e=>{let t=gt.get(e);return t===void 0?St(e):t}:xt;return{merge:function(){return arguments.length===1&&typeof arguments[0]==`string`?wt(arguments[0]):wt(wR.apply(null,arguments))},mergeString:wt,seenBefore:z===0?()=>!1:Ct,mergeUncached:lt}},SR=(e,t)=>{if(!e)return``;if(typeof e==`string`)return e;let n=``;if(typeof e.length==`number`&&(!t||Array.isArray(e))){let r=e;for(let e=0;e<r.length;e++){let i=r[e];if(!i)continue;let a=typeof i==`string`?i:SR(i,t);a&&(n&&(n+=` `),n+=a)}return n}if(t){if(typeof e==`number`)return``+e;if(typeof e==`object`)for(let t in e)e[t]&&(n&&(n+=` `),n+=t)}return n},CR=(e,t)=>{let n=``;for(let r=0;r<e.length;r++){let i=e[r];if(!i)continue;let a=typeof i==`string`?i:SR(i,t);a&&(n&&(n+=` `),n+=a)}return n},wR=function(){return CR(arguments,!1)},TR=(e,t)=>{let n=t===void 0?()=>!0:t.seenBefore,r=t===void 0?e:t.mergeUncached,i=new Map,a=new Map,o=0,s=null,c=(e,t,n,r)=>{let i=0;if(t){if(t!==e.a0)return!1;i=1}if(n){if(n!==(i===0?e.a0:e.a1))return!1;i++}if(r){if(r!==(i===0?e.a0:i===1?e.a1:e.a2))return!1;i++}return i===e.t},l=(e,t)=>{let n=e.a,r=0;for(let e=0;e<t.length;e++){let i=t[e];if(i){if(i!==n[r])return!1;r++}}return r===e.t},u=(t,c)=>{let u=t.length,d=s===null?null:s.n;if(!c){if(d!==null&&l(d,t))return s=d,d.r;if(s!==null&&s!==d&&l(s,t))return s.r}let f=``,p=-1,m=0,h=!1;for(let e=0;e<u;e++){let n=t[e];if(n){if(typeof n!=`string`){if(n=t[e]=SR(n,!0),!n)continue;h=!0}p<0&&(f=n,p=e),m++}}if(m===0)return``;if(m===1)return e(f);if(h){if(d!==null&&l(d,t))return s=d,d.r;if(s!==null&&s!==d&&l(s,t))return s.r}let g=i.get(f);g===void 0&&(g=a.get(f),g!==void 0&&i.set(f,g));let _=null;if(g!==void 0)outer:for(let e=0;e<g.length;e++){let n=g[e];if(n.t!==m)continue;let r=n.a,i=1;for(let e=p+1;e<u;e++){let n=t[e];if(n&&n!==r[i++])continue outer}_=n;break}if(_===null){let s=f,c=[f];for(let e=p+1;e<u;e++){let n=t[e];n&&(s+=` `+n,c.push(n))}if(!n(s))return r(s);_={r:e(s),t:c.length,a0:c[0],a1:c[1],a2:c[2]??``,a:c,n:null},g===void 0&&i.set(f,g=[]),g.length>=256&&g.shift(),g.push(_),++o>1e3&&(o=0,a=i,i=new Map)}return s!==null&&s!==_&&(s.n=_),s=_,_.r},d=t=>Array.isArray(t)?u(t.slice(),!1):e(SR(t,!0));return function(t,n,r){let i=arguments.length;if((i|1)==3){let e=s;if(e!==null){let i=e.n;if(i!==null&&c(i,t,n,r))return s=i,i.r;if(e!==i&&c(e,t,n,r))return e.r}return u([t,n,r],!0)}if(i===1)return typeof t==`string`?e(t):d(t);let a=s;if(a!==null){let e=a.n;if(e!==null){let t=e.a,n=0,r=!0;for(let e=0;e<i;e++){let i=arguments[e];if(i){if(i!==t[n]){r=!1;break}n++}}if(r&&n===e.t)return s=e,e.r}if(a!==e){let e=a.a,t=0,n=!0;for(let r=0;r<i;r++){let i=arguments[r];if(i){if(i!==e[t]){n=!1;break}t++}}if(n&&t===a.t)return a.r}}let o=[];for(let e=0;e<i;e++)o.push(arguments[e]);return u(o,!0)}},ER=`{"theme":{"animate":[{"$v":"isAny"}],"aspect":["video"],"blur":[{"$v":"isTshirtSize"}],"breakpoint":[{"$v":"isTshirtSize"}],"color":[{"$v":"isAny"}],"container":[{"$v":"isTshirtSize"}],"drop-shadow":[{"$v":"isTshirtSize"}],"ease":["in","out","in-out"],"font":[{"$v":"isAnyNonArbitrary"}],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[{"$v":"isTshirtSize"}],"leading":["none","tight","snug","normal","relaxed","loose"],"perspective":["dramatic","near","normal","midrange","distant","none"],"radius":[{"$v":"isTshirtSize"}],"shadow":[{"$v":"isTshirtSize"}],"spacing":["px",{"$v":"isNumber"}],"text":[{"$v":"isTshirtSize"}],"text-shadow":[{"$v":"isTshirtSize"}],"tracking":["tighter","tight","normal","wide","wider","widest"]},"classGroups":{"aspect":[{"aspect":["auto","square",{"$v":"isFraction"},{"$v":"isArbitraryValue"},{"$v":"isArbitraryVariable"},{"$t":"aspect"}]}],"container":["container"],"container-type":[{"@container":["","normal","size",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"container-named":[{"$v":"isNamedContainerQuery"}],"columns":[{"columns":[{"$v":"isNumber"},{"$v":"isArbitraryValue"},{"$v":"isArbitraryVariable"},{"$t":"container"}]},"columns-auto"],"break-after":[{"break-after":["auto","avoid","all","avoid-page","page","left","right","column"]}],"break-before":[{"break-before":["auto","avoid","all","avoid-page","page","left","right","column"]}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],"box":[{"box":["border","content"]}],"display":["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],"sr":["sr-only","not-sr-only"],"float":[{"float":["right","left","none","start","end"]}],"clear":[{"clear":["left","right","both","none","start","end"]}],"isolation":["isolate","isolation-auto"],"object-fit":[{"object":["contain","cover","fill","none","scale-down"]}],"object-position":[{"object":["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"overflow":[{"overflow":["auto","hidden","clip","visible","scroll"]}],"overflow-x":[{"overflow-x":["auto","hidden","clip","visible","scroll"]}],"overflow-y":[{"overflow-y":["auto","hidden","clip","visible","scroll"]}],"overscroll":[{"overscroll":["auto","contain","none"]}],"overscroll-x":[{"overscroll-x":["auto","contain","none"]}],"overscroll-y":[{"overscroll-y":["auto","contain","none"]}],"position":["static","fixed","absolute","relative","sticky"],"inset":[{"inset":[{"$v":"isFraction"},"full","auto",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"inset-x":[{"inset-x":[{"$v":"isFraction"},"full","auto",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"inset-y":[{"inset-y":[{"$v":"isFraction"},"full","auto",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"start":[{"inset-s":[{"$v":"isFraction"},"full","auto",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}],"start":[{"$v":"isFraction"},"full","auto",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"end":[{"inset-e":[{"$v":"isFraction"},"full","auto",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}],"end":[{"$v":"isFraction"},"full","auto",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"inset-bs":[{"inset-bs":[{"$v":"isFraction"},"full","auto",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"inset-be":[{"inset-be":[{"$v":"isFraction"},"full","auto",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"top":[{"top":[{"$v":"isFraction"},"full","auto",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"right":[{"right":[{"$v":"isFraction"},"full","auto",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"bottom":[{"bottom":[{"$v":"isFraction"},"full","auto",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"left":[{"left":[{"$v":"isFraction"},"full","auto",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"visibility":["visible","invisible","collapse"],"z":[{"z":[{"$v":"isInteger"},"auto",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"basis":[{"basis":[{"$v":"isFraction"},"full","auto",{"$t":"container"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"flex-direction":[{"flex":["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{"flex":["nowrap","wrap","wrap-reverse"]}],"flex":[{"flex":[{"$v":"isNumber"},{"$v":"isFraction"},"auto","initial","none",{"$v":"isArbitraryValue"}]}],"grow":[{"grow":["",{"$v":"isNumber"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"shrink":[{"shrink":["",{"$v":"isNumber"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"order":[{"order":[{"$v":"isInteger"},"first","last","none",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"grid-cols":[{"grid-cols":[{"$v":"isInteger"},"none","subgrid",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"col-start-end":[{"col":["auto",{"span":["full",{"$v":"isInteger"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]},{"$v":"isInteger"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"col-start":[{"col-start":[{"$v":"isInteger"},"auto",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"col-end":[{"col-end":[{"$v":"isInteger"},"auto",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"grid-rows":[{"grid-rows":[{"$v":"isInteger"},"none","subgrid",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"row-start-end":[{"row":["auto",{"span":["full",{"$v":"isInteger"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]},{"$v":"isInteger"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"row-start":[{"row-start":[{"$v":"isInteger"},"auto",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"row-end":[{"row-end":[{"$v":"isInteger"},"auto",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]},{"auto-cols":[{"$t":"spacing"}]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]},{"auto-rows":[{"$t":"spacing"}]}],"gap":[{"gap":[{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"gap-x":[{"gap-x":[{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"gap-y":[{"gap-y":[{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"justify-content":[{"justify":["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe","normal"]}],"justify-items":[{"justify-items":["start","end","center","stretch","center-safe","end-safe","normal"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch","center-safe","end-safe"]}],"align-content":[{"content":["normal","start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"]}],"align-items":[{"items":["start","end","center","stretch","center-safe","end-safe",{"baseline":["","last"]}]}],"align-self":[{"self":["auto","start","end","center","stretch","center-safe","end-safe",{"baseline":["","last"]}]}],"place-content":[{"place-content":["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"]}],"place-items":[{"place-items":["start","end","center","stretch","center-safe","end-safe","baseline"]}],"place-self":[{"place-self":["auto","start","end","center","stretch","center-safe","end-safe"]}],"p":[{"p":[{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"px":[{"px":[{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"py":[{"py":[{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"ps":[{"ps":[{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"pe":[{"pe":[{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"pbs":[{"pbs":[{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"pbe":[{"pbe":[{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"pt":[{"pt":[{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"pr":[{"pr":[{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"pb":[{"pb":[{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"pl":[{"pl":[{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"m":[{"m":["auto",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"mx":[{"mx":["auto",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"my":[{"my":["auto",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"ms":[{"ms":["auto",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"me":[{"me":["auto",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"mbs":[{"mbs":["auto",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"mbe":[{"mbe":["auto",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"mt":[{"mt":["auto",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"mr":[{"mr":["auto",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"mb":[{"mb":["auto",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"ml":[{"ml":["auto",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"space-x":[{"space-x":[{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"space-y-reverse":["space-y-reverse"],"size":[{"size":[{"$v":"isFraction"},"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"inline-size":[{"inline":["auto",{"$v":"isFraction"},"screen","full","dvw","lvw","svw","min","max","fit",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]},{"inline":[{"$t":"container"}]}],"min-inline-size":[{"min-inline":["auto",{"$v":"isFraction"},"screen","full","dvw","lvw","svw","min","max","fit",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]},{"min-inline":[{"$t":"container"}]}],"max-inline-size":[{"max-inline":["none",{"$v":"isFraction"},"screen","full","dvw","lvw","svw","min","max","fit",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]},{"max-inline":[{"$t":"container"}]}],"block-size":[{"block":["auto",{"$v":"isFraction"},"screen","full","lh","dvh","lvh","svh","min","max","fit",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"min-block-size":[{"min-block":["auto",{"$v":"isFraction"},"screen","full","lh","dvh","lvh","svh","min","max","fit",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"max-block-size":[{"max-block":["none",{"$v":"isFraction"},"screen","full","lh","dvh","lvh","svh","min","max","fit",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"w":[{"w":[{"$t":"container"},"screen",{"$v":"isFraction"},"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"min-w":[{"min-w":[{"$t":"container"},"screen","none",{"$v":"isFraction"},"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"max-w":[{"max-w":[{"$t":"container"},"screen","none","prose",{"screen":[{"$t":"breakpoint"}]},{"$v":"isFraction"},"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"h":[{"h":["screen","lh",{"$v":"isFraction"},"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"min-h":[{"min-h":["screen","lh","none",{"$v":"isFraction"},"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"max-h":[{"max-h":["screen","lh",{"$v":"isFraction"},"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]},"max-h-none"],"font-size":[{"text":["base",{"$t":"text"},{"$v":"isArbitraryVariableLength"},{"$v":"isArbitraryLength"}]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{"font":[{"$t":"font-weight"},{"$v":"isArbitraryVariableWeight"},{"$v":"isArbitraryWeight"}]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",{"$v":"isPercent"},{"$v":"isArbitraryValue"}]}],"font-family":[{"font":[{"$v":"isArbitraryVariableFamilyName"},{"$v":"isArbitraryFamilyName"},{"$t":"font"}]}],"font-features":[{"font-features":[{"$v":"isArbitraryValue"}]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],"tracking":[{"tracking":[{"$t":"tracking"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"line-clamp":[{"line-clamp":[{"$v":"isNumber"},"none",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryNumber"}]}],"leading":[{"leading":[{"$t":"leading"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"list-image":[{"list-image":["none",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"list-style-position":[{"list":["inside","outside"]}],"list-style-type":[{"list":["disc","decimal","none",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"text-alignment":[{"text":["left","center","right","justify","start","end"]}],"placeholder-color":[{"placeholder":[{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"text-color":[{"text":[{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{"decoration":["solid","dashed","dotted","double","wavy"]}],"text-decoration-thickness":[{"decoration":[{"$v":"isNumber"},"from-font","auto",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryLength"}]}],"text-decoration-color":[{"decoration":[{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"underline-offset":[{"underline-offset":[{"$v":"isNumber"},"auto",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{"text":["wrap","nowrap","balance","pretty"]}],"indent":[{"indent":[{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"tab-size":[{"tab":[{"$v":"isInteger"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"vertical-align":[{"align":["baseline","top","middle","bottom","text-top","text-bottom","sub","super",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"whitespace":[{"whitespace":["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],"break":[{"break":["normal","words","all","keep"]}],"wrap":[{"wrap":["break-word","anywhere","normal"]}],"hyphens":[{"hyphens":["none","manual","auto"]}],"content":[{"content":["none",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"bg-attachment":[{"bg":["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{"bg":["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom",{"$v":"isArbitraryVariablePosition"},{"$v":"isArbitraryPosition"},{"position":[{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}]}],"bg-repeat":[{"bg":["no-repeat",{"repeat":["","x","y","space","round"]}]}],"bg-size":[{"bg":["auto","cover","contain",{"$v":"isArbitraryVariableSize"},{"$v":"isArbitrarySize"},{"size":[{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}]}],"bg-image":[{"bg":["none",{"linear":[{"to":["t","tr","r","br","b","bl","l","tl"]},{"$v":"isInteger"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}],"radial":["",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}],"conic":[{"$v":"isInteger"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]},{"$v":"isArbitraryVariableImage"},{"$v":"isArbitraryImage"}]},{"bg-gradient-to":["t","tr","r","br","b","bl","l","tl"]},"bg-conic"],"bg-color":[{"bg":[{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"gradient-from-pos":[{"from":[{"$v":"isPercent"},{"$v":"isArbitraryVariableLength"},{"$v":"isArbitraryLength"}]}],"gradient-via-pos":[{"via":[{"$v":"isPercent"},{"$v":"isArbitraryVariableLength"},{"$v":"isArbitraryLength"}]}],"gradient-to-pos":[{"to":[{"$v":"isPercent"},{"$v":"isArbitraryVariableLength"},{"$v":"isArbitraryLength"}]}],"gradient-from":[{"from":[{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"gradient-via":[{"via":[{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"gradient-to":[{"to":[{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"rounded":[{"rounded":["","none","full",{"$t":"radius"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"rounded-s":[{"rounded-s":["","none","full",{"$t":"radius"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"rounded-e":[{"rounded-e":["","none","full",{"$t":"radius"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"rounded-t":[{"rounded-t":["","none","full",{"$t":"radius"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"rounded-r":[{"rounded-r":["","none","full",{"$t":"radius"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"rounded-b":[{"rounded-b":["","none","full",{"$t":"radius"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"rounded-l":[{"rounded-l":["","none","full",{"$t":"radius"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"rounded-ss":[{"rounded-ss":["","none","full",{"$t":"radius"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"rounded-se":[{"rounded-se":["","none","full",{"$t":"radius"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"rounded-ee":[{"rounded-ee":["","none","full",{"$t":"radius"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"rounded-es":[{"rounded-es":["","none","full",{"$t":"radius"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"rounded-tl":[{"rounded-tl":["","none","full",{"$t":"radius"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"rounded-tr":[{"rounded-tr":["","none","full",{"$t":"radius"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"rounded-br":[{"rounded-br":["","none","full",{"$t":"radius"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"rounded-bl":[{"rounded-bl":["","none","full",{"$t":"radius"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"border-w":[{"border":["",{"$v":"isNumber"},{"$v":"isArbitraryVariableLength"},{"$v":"isArbitraryLength"}]}],"border-w-x":[{"border-x":["",{"$v":"isNumber"},{"$v":"isArbitraryVariableLength"},{"$v":"isArbitraryLength"}]}],"border-w-y":[{"border-y":["",{"$v":"isNumber"},{"$v":"isArbitraryVariableLength"},{"$v":"isArbitraryLength"}]}],"border-w-s":[{"border-s":["",{"$v":"isNumber"},{"$v":"isArbitraryVariableLength"},{"$v":"isArbitraryLength"}]}],"border-w-e":[{"border-e":["",{"$v":"isNumber"},{"$v":"isArbitraryVariableLength"},{"$v":"isArbitraryLength"}]}],"border-w-bs":[{"border-bs":["",{"$v":"isNumber"},{"$v":"isArbitraryVariableLength"},{"$v":"isArbitraryLength"}]}],"border-w-be":[{"border-be":["",{"$v":"isNumber"},{"$v":"isArbitraryVariableLength"},{"$v":"isArbitraryLength"}]}],"border-w-t":[{"border-t":["",{"$v":"isNumber"},{"$v":"isArbitraryVariableLength"},{"$v":"isArbitraryLength"}]}],"border-w-r":[{"border-r":["",{"$v":"isNumber"},{"$v":"isArbitraryVariableLength"},{"$v":"isArbitraryLength"}]}],"border-w-b":[{"border-b":["",{"$v":"isNumber"},{"$v":"isArbitraryVariableLength"},{"$v":"isArbitraryLength"}]}],"border-w-l":[{"border-l":["",{"$v":"isNumber"},{"$v":"isArbitraryVariableLength"},{"$v":"isArbitraryLength"}]}],"divide-x":[{"divide-x":["",{"$v":"isNumber"},{"$v":"isArbitraryVariableLength"},{"$v":"isArbitraryLength"}]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":["",{"$v":"isNumber"},{"$v":"isArbitraryVariableLength"},{"$v":"isArbitraryLength"}]}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{"border":["solid","dashed","dotted","double","hidden","none"]}],"divide-style":[{"divide":["solid","dashed","dotted","double","hidden","none"]}],"border-color":[{"border":[{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"border-color-x":[{"border-x":[{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"border-color-y":[{"border-y":[{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"border-color-s":[{"border-s":[{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"border-color-e":[{"border-e":[{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"border-color-bs":[{"border-bs":[{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"border-color-be":[{"border-be":[{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"border-color-t":[{"border-t":[{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"border-color-r":[{"border-r":[{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"border-color-b":[{"border-b":[{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"border-color-l":[{"border-l":[{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"divide-color":[{"divide":[{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"outline-style":[{"outline":["solid","dashed","dotted","double","none","hidden"]}],"outline-offset":[{"outline-offset":[{"$v":"isNumber"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"outline-w":[{"outline":["",{"$v":"isNumber"},{"$v":"isArbitraryVariableLength"},{"$v":"isArbitraryLength"}]}],"outline-color":[{"outline":[{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"shadow":[{"shadow":["","none",{"$t":"shadow"},{"$v":"isArbitraryVariableShadow"},{"$v":"isArbitraryShadow"}]},"shadow-inner"],"shadow-color":[{"shadow":[{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"inset-shadow":[{"inset-shadow":["none",{"$t":"inset-shadow"},{"$v":"isArbitraryVariableShadow"},{"$v":"isArbitraryShadow"}]}],"inset-shadow-color":[{"inset-shadow":[{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"ring-w":[{"ring":["",{"$v":"isNumber"},{"$v":"isArbitraryVariableLength"},{"$v":"isArbitraryLength"}]}],"ring-w-inset":["ring-inset"],"ring-color":[{"ring":[{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"ring-offset-w":[{"ring-offset":[{"$v":"isNumber"},{"$v":"isArbitraryLength"}]}],"ring-offset-color":[{"ring-offset":[{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"inset-ring-w":[{"inset-ring":["",{"$v":"isNumber"},{"$v":"isArbitraryVariableLength"},{"$v":"isArbitraryLength"}]}],"inset-ring-color":[{"inset-ring":[{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"text-shadow":[{"text-shadow":["none",{"$t":"text-shadow"},{"$v":"isArbitraryVariableShadow"},{"$v":"isArbitraryShadow"}]}],"text-shadow-color":[{"text-shadow":[{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"opacity":[{"opacity":[{"$v":"isNumber"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"mix-blend":[{"mix-blend":["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity","plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"]}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{"mask":["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[{"$v":"isNumber"}]}],"mask-image-linear-from-pos":[{"mask-linear-from":[{"$v":"isNumber"},{"$v":"isPercent"},{"$v":"isArbitraryVariablePosition"},{"$v":"isArbitraryPosition"}]}],"mask-image-linear-to-pos":[{"mask-linear-to":[{"$v":"isNumber"},{"$v":"isPercent"},{"$v":"isArbitraryVariablePosition"},{"$v":"isArbitraryPosition"}]}],"mask-image-linear-from-color":[{"mask-linear-from":[{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"mask-image-linear-to-color":[{"mask-linear-to":[{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"mask-image-t-from-pos":[{"mask-t-from":[{"$v":"isNumber"},{"$v":"isPercent"},{"$v":"isArbitraryVariablePosition"},{"$v":"isArbitraryPosition"}]}],"mask-image-t-to-pos":[{"mask-t-to":[{"$v":"isNumber"},{"$v":"isPercent"},{"$v":"isArbitraryVariablePosition"},{"$v":"isArbitraryPosition"}]}],"mask-image-t-from-color":[{"mask-t-from":[{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"mask-image-t-to-color":[{"mask-t-to":[{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"mask-image-r-from-pos":[{"mask-r-from":[{"$v":"isNumber"},{"$v":"isPercent"},{"$v":"isArbitraryVariablePosition"},{"$v":"isArbitraryPosition"}]}],"mask-image-r-to-pos":[{"mask-r-to":[{"$v":"isNumber"},{"$v":"isPercent"},{"$v":"isArbitraryVariablePosition"},{"$v":"isArbitraryPosition"}]}],"mask-image-r-from-color":[{"mask-r-from":[{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"mask-image-r-to-color":[{"mask-r-to":[{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"mask-image-b-from-pos":[{"mask-b-from":[{"$v":"isNumber"},{"$v":"isPercent"},{"$v":"isArbitraryVariablePosition"},{"$v":"isArbitraryPosition"}]}],"mask-image-b-to-pos":[{"mask-b-to":[{"$v":"isNumber"},{"$v":"isPercent"},{"$v":"isArbitraryVariablePosition"},{"$v":"isArbitraryPosition"}]}],"mask-image-b-from-color":[{"mask-b-from":[{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"mask-image-b-to-color":[{"mask-b-to":[{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"mask-image-l-from-pos":[{"mask-l-from":[{"$v":"isNumber"},{"$v":"isPercent"},{"$v":"isArbitraryVariablePosition"},{"$v":"isArbitraryPosition"}]}],"mask-image-l-to-pos":[{"mask-l-to":[{"$v":"isNumber"},{"$v":"isPercent"},{"$v":"isArbitraryVariablePosition"},{"$v":"isArbitraryPosition"}]}],"mask-image-l-from-color":[{"mask-l-from":[{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"mask-image-l-to-color":[{"mask-l-to":[{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"mask-image-x-from-pos":[{"mask-x-from":[{"$v":"isNumber"},{"$v":"isPercent"},{"$v":"isArbitraryVariablePosition"},{"$v":"isArbitraryPosition"}]}],"mask-image-x-to-pos":[{"mask-x-to":[{"$v":"isNumber"},{"$v":"isPercent"},{"$v":"isArbitraryVariablePosition"},{"$v":"isArbitraryPosition"}]}],"mask-image-x-from-color":[{"mask-x-from":[{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"mask-image-x-to-color":[{"mask-x-to":[{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"mask-image-y-from-pos":[{"mask-y-from":[{"$v":"isNumber"},{"$v":"isPercent"},{"$v":"isArbitraryVariablePosition"},{"$v":"isArbitraryPosition"}]}],"mask-image-y-to-pos":[{"mask-y-to":[{"$v":"isNumber"},{"$v":"isPercent"},{"$v":"isArbitraryVariablePosition"},{"$v":"isArbitraryPosition"}]}],"mask-image-y-from-color":[{"mask-y-from":[{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"mask-image-y-to-color":[{"mask-y-to":[{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"mask-image-radial":[{"mask-radial":[{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"mask-image-radial-from-pos":[{"mask-radial-from":[{"$v":"isNumber"},{"$v":"isPercent"},{"$v":"isArbitraryVariablePosition"},{"$v":"isArbitraryPosition"}]}],"mask-image-radial-to-pos":[{"mask-radial-to":[{"$v":"isNumber"},{"$v":"isPercent"},{"$v":"isArbitraryVariablePosition"},{"$v":"isArbitraryPosition"}]}],"mask-image-radial-from-color":[{"mask-radial-from":[{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"mask-image-radial-to-color":[{"mask-radial-to":[{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{"closest":["side","corner"],"farthest":["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"]}],"mask-image-conic-pos":[{"mask-conic":[{"$v":"isNumber"}]}],"mask-image-conic-from-pos":[{"mask-conic-from":[{"$v":"isNumber"},{"$v":"isPercent"},{"$v":"isArbitraryVariablePosition"},{"$v":"isArbitraryPosition"}]}],"mask-image-conic-to-pos":[{"mask-conic-to":[{"$v":"isNumber"},{"$v":"isPercent"},{"$v":"isArbitraryVariablePosition"},{"$v":"isArbitraryPosition"}]}],"mask-image-conic-from-color":[{"mask-conic-from":[{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"mask-image-conic-to-color":[{"mask-conic-to":[{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"mask-mode":[{"mask":["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{"mask":["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom",{"$v":"isArbitraryVariablePosition"},{"$v":"isArbitraryPosition"},{"position":[{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}]}],"mask-repeat":[{"mask":["no-repeat",{"repeat":["","x","y","space","round"]}]}],"mask-size":[{"mask":["auto","cover","contain",{"$v":"isArbitraryVariableSize"},{"$v":"isArbitrarySize"},{"size":[{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}]}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{"mask":["none",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"filter":[{"filter":["","none",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"blur":[{"blur":["","none",{"$t":"blur"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"brightness":[{"brightness":[{"$v":"isNumber"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"contrast":[{"contrast":[{"$v":"isNumber"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"drop-shadow":[{"drop-shadow":["","none",{"$t":"drop-shadow"},{"$v":"isArbitraryVariableShadow"},{"$v":"isArbitraryShadow"}]}],"drop-shadow-color":[{"drop-shadow":[{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"grayscale":[{"grayscale":["",{"$v":"isNumber"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"hue-rotate":[{"hue-rotate":[{"$v":"isNumber"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"invert":[{"invert":["",{"$v":"isNumber"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"saturate":[{"saturate":[{"$v":"isNumber"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"sepia":[{"sepia":["",{"$v":"isNumber"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"backdrop-filter":[{"backdrop-filter":["","none",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"backdrop-blur":[{"backdrop-blur":["","none",{"$t":"blur"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"backdrop-brightness":[{"backdrop-brightness":[{"$v":"isNumber"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"backdrop-contrast":[{"backdrop-contrast":[{"$v":"isNumber"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"backdrop-grayscale":[{"backdrop-grayscale":["",{"$v":"isNumber"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[{"$v":"isNumber"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"backdrop-invert":[{"backdrop-invert":["",{"$v":"isNumber"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"backdrop-opacity":[{"backdrop-opacity":[{"$v":"isNumber"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"backdrop-saturate":[{"backdrop-saturate":[{"$v":"isNumber"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"backdrop-sepia":[{"backdrop-sepia":["",{"$v":"isNumber"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"border-collapse":[{"border":["collapse","separate"]}],"border-spacing":[{"border-spacing":[{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"border-spacing-x":[{"border-spacing-x":[{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"border-spacing-y":[{"border-spacing-y":[{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"table-layout":[{"table":["auto","fixed"]}],"caption":[{"caption":["top","bottom"]}],"transition":[{"transition":["","all","colors","opacity","shadow","transform","none",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"transition-behavior":[{"transition":["normal","discrete"]}],"duration":[{"duration":[{"$v":"isNumber"},"initial",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"ease":[{"ease":["linear","initial",{"$t":"ease"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"delay":[{"delay":[{"$v":"isNumber"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"animate":[{"animate":["none",{"$t":"animate"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"backface":[{"backface":["hidden","visible"]}],"perspective":[{"perspective":[{"$t":"perspective"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"perspective-origin":[{"perspective-origin":["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"rotate":[{"rotate":["none",{"$v":"isNumber"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"rotate-x":[{"rotate-x":["none",{"$v":"isNumber"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"rotate-y":[{"rotate-y":["none",{"$v":"isNumber"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"rotate-z":[{"rotate-z":["none",{"$v":"isNumber"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"scale":[{"scale":["none",{"$v":"isNumber"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"scale-x":[{"scale-x":["none",{"$v":"isNumber"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"scale-y":[{"scale-y":["none",{"$v":"isNumber"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"scale-z":[{"scale-z":["none",{"$v":"isNumber"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"scale-3d":["scale-3d"],"skew":[{"skew":[{"$v":"isNumber"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"skew-x":[{"skew-x":[{"$v":"isNumber"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"skew-y":[{"skew-y":[{"$v":"isNumber"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"transform":[{"transform":[{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},"","none","gpu","cpu"]}],"transform-origin":[{"origin":["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"transform-style":[{"transform":["3d","flat"]}],"translate":[{"translate":[{"$v":"isFraction"},"full",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"translate-x":[{"translate-x":[{"$v":"isFraction"},"full",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"translate-y":[{"translate-y":[{"$v":"isFraction"},"full",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"translate-z":[{"translate-z":[{"$v":"isFraction"},"full",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"translate-none":["translate-none"],"zoom":[{"zoom":[{"$v":"isInteger"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"accent":[{"accent":[{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"appearance":[{"appearance":["none","auto"]}],"caret-color":[{"caret":[{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"color-scheme":[{"scheme":["normal","dark","light","light-dark","only-dark","only-light"]}],"cursor":[{"cursor":["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],"resize":[{"resize":["none","","y","x"]}],"scroll-behavior":[{"scroll":["auto","smooth"]}],"scrollbar-thumb-color":[{"scrollbar-thumb":[{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"scrollbar-track-color":[{"scrollbar-track":[{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"scrollbar-gutter":[{"scrollbar-gutter":["auto","stable","both"]}],"scrollbar-w":[{"scrollbar":["auto","thin","none"]}],"scroll-m":[{"scroll-m":[{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"scroll-mx":[{"scroll-mx":[{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"scroll-my":[{"scroll-my":[{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"scroll-ms":[{"scroll-ms":[{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"scroll-me":[{"scroll-me":[{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"scroll-mbs":[{"scroll-mbs":[{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"scroll-mbe":[{"scroll-mbe":[{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"scroll-mt":[{"scroll-mt":[{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"scroll-mr":[{"scroll-mr":[{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"scroll-mb":[{"scroll-mb":[{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"scroll-ml":[{"scroll-ml":[{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"scroll-p":[{"scroll-p":[{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"scroll-px":[{"scroll-px":[{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"scroll-py":[{"scroll-py":[{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"scroll-ps":[{"scroll-ps":[{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"scroll-pe":[{"scroll-pe":[{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"scroll-pbs":[{"scroll-pbs":[{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"scroll-pbe":[{"scroll-pbe":[{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"scroll-pt":[{"scroll-pt":[{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"scroll-pr":[{"scroll-pr":[{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"scroll-pb":[{"scroll-pb":[{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"scroll-pl":[{"scroll-pl":[{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"},{"$t":"spacing"}]}],"snap-align":[{"snap":["start","end","center","align-none"]}],"snap-stop":[{"snap":["normal","always"]}],"snap-type":[{"snap":["none","x","y","both"]}],"snap-strictness":[{"snap":["mandatory","proximity"]}],"touch":[{"touch":["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],"select":[{"select":["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"fill":[{"fill":["none",{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"stroke-w":[{"stroke":[{"$v":"isNumber"},{"$v":"isArbitraryVariableLength"},{"$v":"isArbitraryLength"},{"$v":"isArbitraryNumber"}]}],"stroke":[{"stroke":["none",{"$t":"color"},{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}],"contain":[{"contain":["none","content","strict",{"$v":"isArbitraryVariable"},{"$v":"isArbitraryValue"}]}],"contain-size":[{"contain":["size","inline-size"]}],"contain-layout":["contain-layout"],"contain-paint":["contain-paint"],"contain-style":["contain-style"]},"conflictingClassGroups":{"container-named":["container-type"],"overflow":["overflow-x","overflow-y"],"overscroll":["overscroll-x","overscroll-y"],"inset":["inset-x","inset-y","inset-bs","inset-be","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],"flex":["basis","grow","shrink"],"gap":["gap-x","gap-y"],"p":["px","py","ps","pe","pbs","pbe","pt","pr","pb","pl"],"px":["pr","pl"],"py":["pt","pb"],"m":["mx","my","ms","me","mbs","mbe","mt","mr","mb","ml"],"mx":["mr","ml"],"my":["mt","mb"],"size":["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],"rounded":["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-bs","border-w-be","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"translate":["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mbs","scroll-mbe","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pbs","scroll-pbe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],"touch":["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"],"contain":["contain-size","contain-layout","contain-paint","contain-style"],"contain-size":["contain"],"contain-layout":["contain"],"contain-paint":["contain"],"contain-style":["contain"]},"conflictingClassGroupModifiers":{"font-size":["leading"]},"orderSensitiveModifiers":["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"],"postfixLookupClassGroups":["container-type"]}`,DR=()=>JSON.parse(ER),OR=e=>`classGroups`in e&&`theme`in e&&`conflictingClassGroups`in e,kR=e=>e===void 0?{config:DR()}:typeof e==`function`?{config:e(DR())}:OR(e)?{config:e}:{config:iR(DR(),e),cacheSize:e.cacheSize},AR=e=>{let{config:t,cacheSize:n}=kR(e),{tables:r,validatorImpls:i,prefix:a}=hR(t);return xR(r,i,{cacheSize:n,prefix:a})},Q=(e=>{let t=null,n=()=>t??=AR(e);return TR(e=>n().mergeString(e),{seenBefore:e=>n().seenBefore(e),mergeUncached:e=>n().mergeUncached(e)})})({extend:{theme:{spacing:[...eL]}}});function jR(e,t){return typeof e==`function`?e(t):e}function MR(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}function NR(...e){return t=>{let n=!1,r=e.map(e=>{let r=MR(e,t);return!n&&typeof r==`function`&&(n=!0),r});if(n)return()=>{for(let t=0;t<r.length;t++){let n=r[t];typeof n==`function`?n():MR(e[t],null)}}}}function cee(...e){return G.useCallback(NR(...e),e)}function lee(e){let t=G.forwardRef((t,n)=>{let{children:r,...i}=t,a=null,o=!1,s=[];FR(r)&&typeof IR==`function`&&(r=IR(r._payload)),G.Children.forEach(r,e=>{if(mee(e)){o=!0;let t=e,n=`child`in t.props?t.props.child:t.props.children;FR(n)&&typeof IR==`function`&&(n=IR(n._payload)),a=dee(t,n),s.push(a?.props?.children)}else s.push(e)}),a?a=G.cloneElement(a,void 0,s):!o&&G.Children.count(r)===1&&G.isValidElement(r)&&(a=r);let c=a?pee(a):void 0,l=cee(n,c);if(!a){if(r||r===0)throw Error(o?vee(e):_ee(e));return r}let u=fee(i,a.props??{});return a.type!==G.Fragment&&(u.ref=n?l:c),G.cloneElement(a,u)});return t.displayName=`${e}.Slot`,t}var PR=lee(`Slot`),uee=Symbol.for(`radix.slottable`),dee=(e,t)=>{if(`child`in e.props){let t=e.props.child;return G.isValidElement(t)?G.cloneElement(t,void 0,e.props.children(t.props.children)):null}return G.isValidElement(t)?t:null};function fee(e,t){let n={...t};for(let r in t){let i=e[r],a=t[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(n[r]=i):r===`style`?n[r]={...i,...a}:r===`className`&&(n[r]=[i,a].filter(Boolean).join(` `))}return{...e,...n}}function pee(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function mee(e){return G.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===uee}var hee=Symbol.for(`react.lazy`);function FR(e){return typeof e==`object`&&!!e&&`$$typeof`in e&&e.$$typeof===hee&&`_payload`in e&&gee(e._payload)}function gee(e){return typeof e==`object`&&!!e&&`then`in e}var _ee=e=>`${e} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,vee=e=>`${e} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,IR=G.use,LR=(0,G.forwardRef)(function({asChild:e=!1,className:t,...n},r){let i=Q(`absolute h-px w-px overflow-hidden whitespace-nowrap border-0 p-0 [clip:rect(0,0,0,0)]`,t);return e?(0,Z.jsx)(PR,{...n,className:i,ref:r}):(0,Z.jsx)(`span`,{...n,className:i,ref:r})}),RR=Object.freeze({reduced:!1,squish:90,fast:120,normal:180,slow:280,springDuration:320,bounce:.3,stretch:.28,distance:4,stagger:24,blur:0,shake:3,steps:0,fuse:1,pressDepth:.5,pressScale:1,ease:`cubic-bezier(0.2, 0, 0, 1)`,easeExit:`cubic-bezier(0.4, 0, 1, 1)`}),zR=`(prefers-reduced-motion: reduce)`;function BR(e){let t=e.ownerDocument.defaultView;if(!t)return RR;let n=t.getComputedStyle(e),r=(e,t)=>{let r=n.getPropertyValue(e).trim(),i=Number.parseFloat(r);return Number.isFinite(i)?Math.max(0,i):t},i=(e,t)=>{let i=n.getPropertyValue(e).trim();return r(e,t)*(i.endsWith(`s`)&&!i.endsWith(`ms`)?1e3:1)},a=t.matchMedia?.(zR).matches??!1,o=(e,t)=>a?120:i(`--stipe-motion-${e}`,t),s=(e,t)=>a?0:r(`--stipe-motion-${e}`,t);return{reduced:a,squish:o(`squish`,RR.squish),fast:o(`fast`,RR.fast),normal:o(`normal`,RR.normal),slow:o(`slow`,RR.slow),springDuration:o(`spring-duration`,RR.springDuration),bounce:Math.min(1,s(`bounce`,RR.bounce)),stretch:s(`stretch`,RR.stretch),distance:s(`distance`,RR.distance),stagger:a?0:i(`--stipe-motion-stagger`,RR.stagger),blur:s(`blur`,RR.blur),shake:s(`shake`,RR.shake),steps:Math.floor(s(`steps`,RR.steps)),fuse:r(`--stipe-motion-fuse`,RR.fuse),pressDepth:a?0:r(`--stipe-press-depth`,RR.pressDepth),pressScale:a?1:r(`--stipe-press-scale`,RR.pressScale),ease:n.getPropertyValue(`--stipe-motion-ease`).trim()||RR.ease,easeExit:n.getPropertyValue(`--stipe-motion-ease-exit`).trim()||RR.easeExit}}function VR(e,t){let n=e.createElement(`div`);n.setAttribute(`style`,t??``);let r=new Map;for(let e of n.style)(e.startsWith(`--stipe-motion-`)||e.startsWith(`--stipe-press-`))&&r.set(e,n.style.getPropertyValue(e).trim());return r}function HR(e){let t=e.target;if(e.attributeName!==`style`||!(t instanceof Element))return!0;let n=t.ownerDocument,r=VR(n,e.oldValue),i=VR(n,t.getAttribute(`style`));return r.size!==i.size||[...i].some(([e,t])=>r.get(e)!==t)}function UR(e){let[t,n]=(0,G.useState)(()=>({...RR,reduced:!0}));return(0,G.useLayoutEffect)(()=>{let t=e.current,r=t?.ownerDocument.defaultView;if(!t||!r)return;let i=()=>{let e=BR(t);n(t=>JSON.stringify(t)===JSON.stringify(e)?t:e)};i();let a=new r.MutationObserver(e=>{e.some(HR)&&i()});for(let e=t;e;e=e.parentElement)a.observe(e,{attributes:!0,attributeFilter:[`data-theme`,`class`,`style`],attributeOldValue:!0});let o=r.matchMedia?.(zR);return o?.addEventListener(`change`,i),()=>{a.disconnect(),o?.removeEventListener(`change`,i)}},[e]),t}function WR(e,t){return e.reduced?0:Math.round(t*e.normal/RR.normal)}function GR(e,t){if(e.reduced)return 0;let n=t*e.bounce/RR.bounce;return Math.min(.9,Math.max(0,n))}function KR(e,t){return e.reduced?0:Math.round(t*e.springDuration/RR.springDuration)}function qR(e,t){return e.steps>0?`steps(${String(e.steps)}, end)`:t}function JR(e){return`animate`in e}var YR=globalThis;function XR(){return YR.matchMedia?.(zR).matches??!1}function ZR(e){let t=YR.matchMedia?.(zR);return t?.addEventListener(`change`,e),()=>{t?.removeEventListener(`change`,e)}}function QR(){return!0}function $R(){return(0,G.useSyncExternalStore)(ZR,XR,QR)}var ez=typeof window<`u`,tz=ez?window:null,nz=ez?document:null,rz={OBJECT:0,ATTRIBUTE:1,CSS:2,TRANSFORM:3,CSS_VAR:4},iz={NUMBER:0,UNIT:1,COLOR:2,COMPLEX:3},az={NONE:0,AUTO:1,FORCE:2},oz={replace:0,none:1,blend:2},sz=Symbol(),cz=Symbol(),lz=Symbol(),uz=Symbol(),dz=Symbol(),fz=1e-11,pz=0xe8d4a51000,mz=1e3,hz=[],gz=(()=>{let e=new Map;return e.set(`x`,`translateX`),e.set(`y`,`translateY`),e.set(`z`,`translateZ`),e})(),_z=[`perspective`,`translateX`,`translateY`,`translateZ`,`rotate`,`rotateX`,`rotateY`,`rotateZ`,`scale`,`scaleX`,`scaleY`,`scaleZ`,`skew`,`skewX`,`skewY`],vz=_z.reduce((e,t)=>({...e,[t]:t+`(`}),{}),yz=()=>{},bz=e=>e,xz=/\)\s*[-.\d]/,Sz=/(^#([\da-f]{3}){1,2}$)|(^#([\da-f]{4}){1,2}$)/i,Cz=/rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)/i,wz=/rgba\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*(-?\d+|-?\d*.\d+)\s*\)/i,Tz=/hsl\(\s*(-?\d+|-?\d*.\d+)\s*,\s*(-?\d+|-?\d*.\d+)%\s*,\s*(-?\d+|-?\d*.\d+)%\s*\)/i,Ez=/hsla\(\s*(-?\d+|-?\d*.\d+)\s*,\s*(-?\d+|-?\d*.\d+)%\s*,\s*(-?\d+|-?\d*.\d+)%\s*,\s*(-?\d+|-?\d*.\d+)\s*\)/i,Dz=/[-+]?\d*\.?\d+(?:e[-+]?\d)?/gi,Oz=/^([-+]?\d*\.?\d+(?:e[-+]?\d+)?)([a-z]+|%)$/i,kz=/([a-z])([A-Z])/g,Az=/var\(\s*(--[\w-]+)(?:\s*,\s*([^)]+))?\s*\)/,jz={id:null,keyframes:null,playbackEase:null,playbackRate:1,frameRate:240,loop:0,reversed:!1,alternate:!1,autoplay:!0,persist:!1,duration:mz,delay:0,loopDelay:0,ease:`out(2)`,composition:oz.replace,modifier:bz,onBegin:yz,onBeforeUpdate:yz,onUpdate:yz,onLoop:yz,onPause:yz,onComplete:yz,onRender:yz},Mz={current:null,root:nz},Nz={defaults:jz,precision:4,timeScale:1,tickThreshold:200,editor:null},Pz={version:`4.5.0`,engine:null};ez&&(tz.AnimeJS||=[],tz.AnimeJS.push(Pz));var Fz=e=>e.replace(kz,`$1-$2`).toLowerCase(),Iz=(e,t)=>e.indexOf(t)===0,Lz=Date.now,Rz=Array.isArray,zz=e=>e&&e.constructor===Object,Bz=e=>typeof e==`number`&&!isNaN(e),Vz=e=>typeof e==`string`,Hz=e=>typeof e==`function`,Uz=e=>e===void 0,Wz=e=>Uz(e)||e===null,Gz=e=>ez&&e instanceof SVGElement,Kz=e=>Sz.test(e),qz=e=>Iz(e,`rgb`),Jz=e=>Iz(e,`hsl`),Yz=e=>Kz(e)||(qz(e)||Jz(e))&&(e[e.length-1]===`)`||!xz.test(e)),Xz=e=>!Nz.defaults.hasOwnProperty(e),Zz=[`opacity`,`rotate`,`overflow`,`color`],Qz=(e,t)=>{if(Zz.includes(t))return!1;if(e.getAttribute(t)||t in e){if(t===`scale`){let t=e.parentNode;return t&&t.tagName===`filter`}return!0}},$z=Math.pow,eB=Math.sqrt,tB=Math.sin,nB=Math.cos,rB=Math.abs,iB=Math.exp,aB=Math.ceil,oB=Math.floor,sB=Math.asin,cB=Math.PI,lB=Math.round,uB=(e,t,n)=>e<t?t:e>n?n:e,dB=(e,t)=>{if(t<0)return e;if(!t)return lB(e);let n=10**t;return lB(e*n)/n},fB=(e,t,n)=>n===1?t:n===0?e:e+(t-e)*n,pB=e=>e===1/0?pz:e===-1/0?-pz:e,mB=e=>e<=1e-11?fz:pB(dB(e,11)),hB=e=>Rz(e)?[...e]:e,gB=(e,t)=>{let n={...e};for(let r in t){let i=e[r];n[r]=Uz(i)?t[r]:i}return n},_B=(e,t,n,r=`_prev`,i=`_next`)=>{let a=e._head,o=i;for(n&&(a=e._tail,o=r);a;){let e=a[o];t(a),a=e}},vB=(e,t,n=`_prev`,r=`_next`)=>{let i=t[n],a=t[r];i?i[r]=a:e._head=a,a?a[n]=i:e._tail=i,t[n]=null,t[r]=null},yB=(e,t,n,r=`_prev`,i=`_next`)=>{let a=e._tail;for(;a&&n&&n(a,t);)a=a[r];let o=a?a[i]:e._head;a?a[i]=t:e._head=t,o?o[r]=t:e._tail=t,t[r]=a,t[i]=o},bB=(e,t,n)=>{let r=e.style.transform;if(r){let i=e[uz],a=0,o=r.length,s;for(;a<o;){for(;a<o&&r.charCodeAt(a)===32;)a++;if(a>=o)break;let e=a;for(;a<o&&r.charCodeAt(a)!==40;)a++;if(a>=o)break;let t=r.substring(e,a),n=1,c=a+1,l=-1,u=-1;for(a++;a<o&&n>0;){let e=r.charCodeAt(a);e===40?n++:e===41?n--:e===44&&n===1&&(l===-1?l=a:u===-1&&(u=a)),a++}let d=a-1;t===`translate`||t===`translate3d`?(l===-1?i.translateX=r.substring(c,d).trim():(i.translateX=r.substring(c,l).trim(),u===-1?i.translateY=r.substring(l+1,d).trim():(i.translateY=r.substring(l+1,u).trim(),i.translateZ=r.substring(u+1,d).trim())),s=r.substring(c,d)):t===`scale`||t===`scale3d`?l===-1?i.scale=r.substring(c,d).trim():(i.scaleX=r.substring(c,l).trim(),u===-1?i.scaleY=r.substring(l+1,d).trim():(i.scaleY=r.substring(l+1,u).trim(),i.scaleZ=r.substring(u+1,d).trim())):i[t]=r.substring(c,d)}if(t===`translate3d`&&s)return n&&(n[t]=s),s;let c=i[t];if(!Uz(c))return n&&(n[t]=c),c}return t===`translate3d`?`0px, 0px, 0px`:t===`rotate3d`?`0, 0, 0, 0deg`:Iz(t,`scale`)?`1`:Iz(t,`rotate`)||Iz(t,`skew`)?`0deg`:`0px`},xB=e=>{let t=``;for(let n=0,r=_z.length;n<r;n++){let r=_z[n],i=e[r];if(i!==void 0){if(r===`translateX`){let r=e.translateY;if(r!==void 0){let a=e.translateZ;a===void 0?(t+=`translate(${i},${r}) `,n+=1):(t+=`translate3d(${i},${r},${a}) `,n+=2);continue}}if(r===`scaleX`&&e.scale===void 0){let r=e.scaleY;if(r!==void 0){let a=e.scaleZ;a===void 0?(t+=`scale(${i},${r}) `,n+=1):(t+=`scale3d(${i},${r},${a}) `,n+=2);continue}}t+=`${vz[r]}${i}) `}r===`rotateZ`&&e.rotate3d!==void 0&&(t+=`rotate3d(${e.rotate3d}) `)}return e.matrix!==void 0&&(t+=`matrix(${e.matrix}) `),e.matrix3d!==void 0&&(t+=`matrix3d(${e.matrix3d}) `),t},SB=[];function CB(e,t){if(!e)return null;let n=SB.length;outer:for(let r=0;r<n;r++){let n=SB[r];if(n.detect&&!n.detect(e))continue;let i=n.targetAdapters;for(let n=0,r=i.length;n<r;n++){let r=i[n];if(r.detect(e)){let n=r.props[t];if(n&&(!n.gate||n.gate(e)))return n;break outer}}}for(let r=0;r<n;r++){let n=SB[r];if(n.detect&&!n.detect(e))continue;let i=n.propertyResolvers;for(let n=0,r=i.length;n<r;n++){let r=i[n](e,t);if(r)return r}}return null}var wB=e=>{let t=Cz.exec(e)||wz.exec(e),n=Uz(t[4])?1:+t[4];return[+t[1],+t[2],+t[3],n]},TB=e=>{let t=e.length,n=t===4||t===5;return[+(`0x`+e[1]+e[n?1:2]),+(`0x`+e[n?2:3]+e[n?2:4]),+(`0x`+e[n?3:5]+e[n?3:6]),t===5||t===9?+((`0x`+e[n?4:7]+e[n?4:8])/255).toFixed(3):1]},EB=(e,t,n)=>(n<0&&(n+=1),n>1&&--n,n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e),DB=e=>{let t=Tz.exec(e)||Ez.exec(e),n=t[1]/360,r=t[2]/100,i=t[3]/100,a=Uz(t[4])?1:+t[4],o,s,c;if(r===0)o=s=c=i;else{let e=i<.5?i*(1+r):i+r-i*r,t=2*i-e;o=dB(EB(t,e,n+1/3)*255,0),s=dB(EB(t,e,n)*255,0),c=dB(EB(t,e,n-1/3)*255,0)}return[o,s,c,a]},OB=e=>qz(e)?wB(e):Kz(e)?TB(e):Jz(e)?DB(e):[0,0,0,1],kB=(e,t)=>Uz(e)?t:e,AB=(e,t)=>{let n=e.match(Az),r=t[cz]?t:document.documentElement,i=getComputedStyle(r)?.getPropertyValue(n[1]);return(!i||i.trim()===``)&&n[2]&&(i=n[2].trim()),i||0},jB=(e,t,n,r,i,a)=>{if(Hz(e)){if(!i){let i=e(t,n,r,a);return isNaN(+i)?i||0:+i}let o=()=>{let i=e(t,n,r,a);return isNaN(+i)?i||0:+i};return i.func=o,o()}if(Vz(e)&&Iz(e,`var(`)){if(!i)return AB(e,t);let n=()=>AB(e,t);return i.func=n,n()}return e},MB=(e,t)=>e[cz]?e[lz]&&Qz(e,t)?rz.ATTRIBUTE:_z.includes(t)||gz.get(t)?rz.TRANSFORM:Iz(t,`--`)?rz.CSS_VAR:t in e.style?rz.CSS:t in e?rz.OBJECT:rz.ATTRIBUTE:rz.OBJECT,NB=(e,t,n)=>{let r=e.style[t];r&&n&&(n[t]=r);let i=r||getComputedStyle(e[dz]||e).getPropertyValue(t);return i===`auto`?`0`:i},PB=(e,t,n,r)=>{let i=Uz(n)?MB(e,t):n,a=CB(e,t);if(a){let n=a.get(e);return n&&r&&(r[t]=n),n??0}if(i===rz.OBJECT){let n=e[t];return n&&r&&(r[t]=n),n||0}if(i===rz.ATTRIBUTE){let n=e.getAttribute(t);return n&&r&&(r[t]=n),n}return i===rz.TRANSFORM?bB(e,t,r):i===rz.CSS_VAR?NB(e,t,r).trimStart():NB(e,t,r)},FB=(e,t,n)=>n===`-`?e-t:n===`+`?e+t:e*t,IB=()=>({t:iz.NUMBER,n:0,u:null,o:null,d:null,s:null}),LB=(e,t)=>{if(t.t=iz.NUMBER,t.n=0,t.u=null,t.o=null,t.d=null,t.s=null,!e)return t;let n=+e;if(!isNaN(n))return t.n=n,t;let r=e;r[1]===`=`&&(t.o=r[0],r=r.slice(2));let i=!r.includes(` `)&&Oz.exec(r);if(i)return t.t=iz.UNIT,t.n=+i[1],t.u=i[2],t;if(t.o)return t.n=+r,t;if(Yz(r))return t.t=iz.COLOR,t.d=OB(r),t;{let e=r.match(Dz);return t.t=iz.COMPLEX,t.d=e?e.map(Number):[],t.s=r.split(Dz)||[],t}},RB=(e,t)=>(t.t=e._valueType,t.n=e._toNumber,t.u=e._unit,t.o=null,t.d=hB(e._toNumbers),t.s=hB(e._strings),t),zB=IB(),BB=(e,t,n)=>{let r=e._modifier,i=e._fromNumbers,a=e._toNumbers,o=e._strings,s=o[0];for(let c=0,l=a.length;c<l;c++){let l=r(dB(fB(i[c],a[c],t),n)),u=o[c+1];s+=`${u?l+u:l}`,e._numbers[c]=l}return s},VB=(e,t,n,r,i)=>{let a=e.parent,o=e.duration,s=e.completed,c=e.iterationDuration,l=e.iterationCount,u=e._currentIteration,d=e._loopDelay,f=e._reversed,p=e._alternate,m=e._hasChildren,h=e._delay,g=e._currentTime,_=h+c,v=t-h,y=uB(g,-h,o),b=uB(v,-h,o),x=v-g,S=b>0,C=b>=o,w=o<=fz,T=i===az.FORCE,E=0,D=v,O=0;if(l>1){let t=c+(C?0:d),n=~~(b/t);e._currentIteration=uB(n,0,l),C&&e._currentIteration--,E=e._currentIteration%2,D=b-n*t||0}let k=f^(p&&E),A=e._ease,j=C?k?0:o:k?c-D:D;A&&(j=c*A(j/c)||0);let M=(a?a.backwards:v<g)?!k:!!k;if(e._currentTime=v,e._iterationTime=j,e.backwards=M,S&&!e.began?(e.began=!0,!n&&!(a&&(M||!a.began))&&e.onBegin(e)):v<=0&&(e.began=!1),!n&&!m&&S&&e._currentIteration!==u&&e.onLoop(e),T||i===az.AUTO&&(t>=(a&&h>0?0:h)&&t<=_||t<=h&&y>h||t>=_&&y!==o)||j>=_&&y!==o||j<=h&&y>0&&!C||t<=y&&y===o&&s||C&&!s&&w){if(S&&(e.computeDeltaTime(y),n||e.onBeforeUpdate(e)),!m){let t=T||(M?x*-1:x)>=Nz.tickThreshold,i=dB(e._offset+(a?a._offset:0)+h+j,12),o=e._head,s,c,l,u,d=0;for(;o;){let e=o._composition,n=o._currentTime,a=o._changeDuration,f=o._absoluteStartTime+o._changeDuration,p=o._nextRep,m=o._prevRep,h=e!==oz.none,g=m?m._absoluteStartTime+m._changeDuration:0,_=m&&m.parent!==o.parent,v=!p||p._isOverridden?f:p.parent===o.parent?f+p._delay:p._absoluteStartTime<p._absoluteUpdateStartTime?p._absoluteStartTime:p._absoluteUpdateStartTime;if((t||(n!==a||i<=v||m&&!_&&(!p||p.parent!==o.parent))&&(n!==0||i>=o._absoluteStartTime||_&&!o._hasFromValue&&!m._isOverridden&&i>=g||p&&!p._isOverridden&&p.parent===o.parent&&p._currentTime!==0&&j<p._startTime))&&(!m||_||j>=o._startTime)&&(!h||!o._isOverridden&&(!o._isOverlapped||i<=f)&&(!p||p._isOverridden||i<=v)&&(!m||m._isOverridden||(_?i>=o._absoluteStartTime||!o._hasFromValue&&i>=g:i>=g+o._delay)))){let t=o._currentTime=uB(j-o._startTime,0,a),n=o._ease(t/o._updateDuration),i=o._modifier,f=o._valueType,p=o._tweenType,m=p===rz.OBJECT,g=f===iz.NUMBER,_=g&&m||n===0||n===1?-1:Nz.precision,v,y;if(g)v=y=i(dB(fB(o._fromNumber,o._toNumber,n),_));else if(f===iz.UNIT)y=i(dB(fB(o._fromNumber,o._toNumber,n),_)),v=`${y}${o._unit}`;else if(f===iz.COLOR){let e=o._numbers,t=o._fromNumbers,a=o._toNumbers,s=1-n,c=t[0],l=t[1],u=t[2],d=a[0],f=a[1],p=a[2];e[0]=i(Math.sqrt(c*c*s+d*d*n)),e[1]=i(Math.sqrt(l*l*s+f*f*n)),e[2]=i(Math.sqrt(u*u*s+p*p*n)),e[3]=i(fB(t[3],a[3],n)),(!o._setter||r)&&(v=`rgba(${dB(e[0],0)},${dB(e[1],0)},${dB(e[2],0)},${e[3]})`)}else f===iz.COMPLEX&&(v=BB(o,n,_));if(h&&(o._number=y),!r&&e!==oz.blend){let e=o.property;s=o.target,o._setter?o._setter(s,y,o):m?s[e]=v:p===rz.ATTRIBUTE?s.setAttribute(e,v):(c=s.style,p===rz.TRANSFORM?(s!==l&&(l=s,u=s[uz]),u[e]=v,d=1):p===rz.CSS?c[e]=v:p===rz.CSS_VAR&&c.setProperty(e,v)),S&&(O=1)}else o._value=v}else n&&m&&!_&&j<o._startTime&&(o._currentTime=0);d&&o._renderTransforms&&(c.transform=xB(u),d=0),o=o._next}!n&&O&&e.onRender(e)}!n&&S&&e.onUpdate(e)}return a&&w?!n&&(a.began&&!M&&v>0&&!s||M&&v<=1e-11&&s)&&(e.onComplete(e),e.completed=!M):S&&C?l===1/0?e._startTime+=e.duration:e._currentIteration>=l-1&&(e.paused=!0,!s&&!m&&(e.completed=!0,!n&&!(a&&(M||!a.began))&&(e.onComplete(e),e._resolve(e)))):e.completed=!1,O},HB=(e,t,n,r,i)=>{let a=e._currentIteration;if(VB(e,t,n,r,i),e._hasChildren){let o=e,s=o.backwards,c=r?t:o._iterationTime,l=Lz(),u=0,d=!0;if(!r&&o._currentIteration!==a){let e=o.iterationDuration;_B(o,t=>{if(!s)!t.completed&&!t.backwards&&t._currentTime<t.iterationDuration&&VB(t,e,n,1,az.FORCE),t.began=!1,t.completed=!1;else{let r=t.duration,i=t._offset+t._delay,a=i+r;!n&&r<=1e-11&&(!i||a===e)&&t.onComplete(t)}}),n||o.onLoop(o)}_B(o,e=>{let t=dB((c-e._offset)*e._speed,12);if(s&&t>e._delay+e.duration)return;let a=e._fps<o._fps?e.requestTick(l):i;u+=VB(e,t,n,r,a),!e.completed&&d&&(d=!1)},s),!n&&u&&o.onRender(o),(d||s)&&o._currentTime>=o.duration&&(o.paused=!0,o.completed||(o.completed=!0,n||(o.onComplete(o),o._resolve(o))))}},UB={},WB=(e,t,n)=>{if(n===rz.TRANSFORM)return gz.get(e)||e;if(n===rz.CSS||n===rz.ATTRIBUTE&&Gz(t)&&e in t.style){let t=UB[e];if(t)return t;{let t=e&&Fz(e);return UB[e]=t,t}}return e},GB=(e,t=!1)=>{if(e._hasChildren)_B(e,e=>GB(e,t),!0);else{let n=e;n.pause(),_B(n,e=>{let r=e.property,i=e.target,a=e._tweenType,o=e._inlineValue,s=Wz(o)||o===``;if(e._setter){if(!t&&!s){if(LB(o,zB),zB.d){let t=zB.d,n=e._numbers;for(let e=0,r=t.length;e<r;e++)n[e]=t[e]}else e._number=zB.n;e._setter(e.target,e._number,e)}}else if(a===rz.OBJECT)!t&&!s&&(i[r]=o);else if(i[cz]){if(a===rz.ATTRIBUTE)t||(s?i.removeAttribute(r):i.setAttribute(r,o));else{let t=i.style;if(a===rz.TRANSFORM){let n=i[uz];s?delete n[r]:n[r]=o,e._renderTransforms&&(Object.keys(n).length?t.transform=xB(n):t.removeProperty(`transform`))}else s?t.removeProperty(Fz(r)):t[r]=o}}i[cz]&&n._tail===e&&n.targets.forEach(e=>{e.getAttribute&&e.getAttribute(`style`)===``&&e.removeAttribute(`style`)})})}return e},KB=class{constructor(e=0){this.deltaTime=0,this._currentTime=e,this._lastTickTime=e,this._startTime=e,this._lastTime=e,this._frameDuration=mz/240,this._fps=240,this._speed=1,this._hasChildren=!1,this._head=null,this._tail=null}get fps(){return this._fps}set fps(e){let t=+e,n=t<1e-11?fz:t,r=mz/n;n>jz.frameRate&&(jz.frameRate=n),this._fps=n,this._frameDuration=r}get speed(){return this._speed}set speed(e){let t=+e;this._speed=t<1e-11?fz:t}requestTick(e){let t=this._frameDuration,n=e-this._lastTickTime,r=t*.25;return n+(r<4?r:4)<t?az.NONE:(this._lastTickTime=n>=t?e-n%t:e,az.AUTO)}computeDeltaTime(e){let t=e-this._lastTime;return this.deltaTime=t,this._lastTime=e,t}},qB={animation:null,update:yz},JB=e=>{let t=qB.animation;return t||(t={duration:fz,computeDeltaTime:yz,_offset:0,_delay:0,_head:null,_tail:null},qB.animation=t,qB.update=()=>{e.forEach(e=>{for(let t in e){let n=e[t],r=n._head;if(r){let e=r._valueType,t=e===iz.COMPLEX||e===iz.COLOR?hB(r._fromNumbers):null,i=r._fromNumber,a=n._tail;for(;a&&a!==r;){if(t)for(let e=0,n=a._numbers.length;e<n;e++)t[e]+=a._numbers[e];else i+=a._number;a=a._prevAdd}r._toNumber=i,r._toNumbers=t}}}),VB(t,1,1,0,az.FORCE)}),t},YB=ez?requestAnimationFrame:setImmediate,XB=ez?cancelAnimationFrame:clearImmediate,ZB=class extends KB{constructor(e){super(e),this.useDefaultMainLoop=!0,this.pauseOnDocumentHidden=!0,this.defaults=jz,this.paused=!0,this.reqId=0}update(){let e=this._currentTime=Lz();if(this.requestTick(e)){this.computeDeltaTime(e);let t=this._speed,n=this._fps,r=this._head;for(;r;){let i=r._next;r.paused?(vB(this,r),this._hasChildren=!!this._tail,r._running=!1,r.completed&&!r._cancelled&&r.cancel()):HB(r,(e-r._startTime)*r._speed*t,0,0,r._fps<n?r.requestTick(e):az.AUTO),r=i}qB.update()}}wake(){return this.useDefaultMainLoop&&!this.reqId&&(this.requestTick(Lz()),this.reqId=YB($B)),this}pause(){if(this.reqId)return this.paused=!0,eV()}resume(){if(this.paused)return this.paused=!1,_B(this,e=>e.resetTime()),this.wake()}get speed(){return this._speed*(Nz.timeScale===1?1:mz)}set speed(e){let t=e*Nz.timeScale;this._speed!==t&&(this._speed=t,_B(this,e=>e.speed=e._speed))}get timeUnit(){return Nz.timeScale===1?`ms`:`s`}set timeUnit(e){let t=.001,n=e===`s`,r=n?t:1;if(Nz.timeScale!==r){Nz.timeScale=r,Nz.tickThreshold=200*r;let e=n?t:mz;this.defaults.duration*=e,this._speed*=e}}get precision(){return Nz.precision}set precision(e){Nz.precision=e}},QB=(()=>{let e=new ZB(Lz());return ez&&(Pz.engine=e,nz.addEventListener(`visibilitychange`,()=>{e.pauseOnDocumentHidden&&(nz.hidden?e.pause():e.resume())})),e})(),$B=()=>{QB._head?(QB.reqId=YB($B),QB.update()):QB.reqId=0},eV=()=>(XB(QB.reqId),QB.reqId=0,QB),tV={_rep:new WeakMap,_add:new Map},nV=(e,t,n=`_rep`)=>{let r=tV[n],i=r.get(e);return i||(i={},r.set(e,i)),i[t]?i[t]:i[t]={_head:null,_tail:null}},rV=(e,t)=>e._isOverridden||e._absoluteStartTime>t._absoluteStartTime,iV=e=>{e._isOverlapped=1,e._isOverridden=1,e._changeDuration=fz,e._currentTime=fz},aV=(e,t)=>{let n=e._composition;if(n===oz.replace){let n=e._absoluteStartTime;yB(t,e,rV,`_prevRep`,`_nextRep`);let r=e._prevRep;if(r){let t=r.parent,i=r._absoluteEndTime;if(e.parent.id!==t.id&&t.iterationCount>1&&i+(t.duration-t.iterationDuration)>n){iV(r);let e=r._prevRep;for(;e&&e.parent.id===t.id;)iV(e),e=e._prevRep}let a=e._absoluteUpdateStartTime;if(i>a){let e=r._startTime,t=dB(a-(i-(e+r._updateDuration))-e,12);r._changeDuration=t,r._currentTime=t,r._isOverlapped=1,t<1e-11&&iV(r)}let o=e.parent.parent;if(!o||o!==t.parent){let e=!0;if(_B(t,t=>{t._isOverlapped||(e=!1)}),e){let e=t.parent;if(e){let n=!0;_B(e,e=>{e!==t&&_B(e,e=>{e._isOverlapped||(n=!1)})}),n&&e.cancel()}else t.cancel()}}}}else if(n===oz.blend){let t=nV(e.target,e.property,`_add`),n=JB(tV._add),r=t._head;r||(r={...e},r._composition=oz.replace,r._updateDuration=fz,r._startTime=0,r._numbers=hB(e._fromNumbers),r._number=0,r._next=null,r._prev=null,yB(t,r),yB(n,r));let i=e._toNumber;if(e._fromNumber=r._fromNumber-i,e._toNumber=0,e._numbers=hB(e._fromNumbers),e._number=0,r._fromNumber=i,e._toNumbers.length){let t=hB(e._toNumbers);t.forEach((t,n)=>{e._fromNumbers[n]=r._fromNumbers[n]-t,e._toNumbers[n]=0}),r._fromNumbers=t}yB(t,e,null,`_prevAdd`,`_nextAdd`)}return e},oV=e=>{let t=e._composition;if(t!==oz.none){let n=e.target,r=e.property,i=tV._rep.get(n)[r];if(vB(i,e,`_prevRep`,`_nextRep`),t===oz.blend){let t=tV._add,i=t.get(n);if(!i)return;let a=i[r],o=qB.animation;vB(a,e,`_prevAdd`,`_nextAdd`);let s=a._head;if(s&&s===a._tail){vB(a,s,`_prevAdd`,`_nextAdd`),vB(o,s);let e=!0;for(let t in i)if(i[t]._head){e=!1;break}e&&t.delete(n)}}}return e},sV=e=>(e.paused=!0,e.began=!1,e.completed=!1,e),cV=e=>e._cancelled?(e._hasChildren?_B(e,cV):_B(e,e=>{e._composition!==oz.none&&aV(e,nV(e.target,e.property))}),e._cancelled=0,e):e,lV=0,uV=(e,t)=>e._priority>t._priority,dV=class extends KB{constructor(e={},t=null,n=0){super(0),++lV;let{id:r,delay:i,duration:a,reversed:o,alternate:s,loop:c,loopDelay:l,autoplay:u,frameRate:d,playbackRate:f,priority:p,onComplete:m,onLoop:h,onPause:g,onBegin:_,onBeforeUpdate:v,onUpdate:y}=e;Mz.current&&Mz.current.register(this);let b=t?0:QB._lastTickTime,x=t?t.defaults:Nz.defaults,S=Hz(i)||Uz(i)?x.delay:+i,C=Hz(a)||Uz(a)?1/0:+a,w=kB(c,x.loop),T=kB(l,x.loopDelay),E=w===!0||w===1/0||w<0?1/0:w+1,D=0;t?D=n:(QB.reqId||QB.requestTick(Lz()),D=(QB._lastTickTime-QB._startTime)*Nz.timeScale),this.id=Uz(r)?lV:r,this.parent=t,this.duration=pB((C+T)*E-T)||1e-11,this.backwards=!1,this.paused=!0,this.began=!1,this.completed=!1,this.onBegin=_||x.onBegin,this.onBeforeUpdate=v||x.onBeforeUpdate,this.onUpdate=y||x.onUpdate,this.onLoop=h||x.onLoop,this.onPause=g||x.onPause,this.onComplete=m||x.onComplete,this.iterationDuration=C,this.iterationCount=E,this._autoplay=!t&&kB(u,x.autoplay),this._offset=D,this._delay=S,this._loopDelay=T,this._iterationTime=0,this._currentIteration=0,this._resolve=yz,this._running=!1,this._reversed=+kB(o,x.reversed),this._reverse=this._reversed,this._cancelled=0,this._alternate=kB(s,x.alternate),this._prev=null,this._next=null,this._lastTickTime=b,this._startTime=b,this._lastTime=b,this._fps=kB(d,x.frameRate),this._speed=kB(f,x.playbackRate),this._priority=+kB(p,1)}get cancelled(){return!!this._cancelled}set cancelled(e){e?this.cancel():this.reset(!0).play()}get currentTime(){return uB(dB(this._currentTime,Nz.precision),-this._delay,this.duration)}set currentTime(e){let t=this.paused;this.pause().seek(+e),t||this.resume()}get iterationCurrentTime(){return uB(dB(this._iterationTime,Nz.precision),0,this.iterationDuration)}set iterationCurrentTime(e){this.currentTime=this.iterationDuration*this._currentIteration+e}get progress(){return uB(dB(this._currentTime/this.duration,10),0,1)}set progress(e){this.currentTime=this.duration*e}get iterationProgress(){return uB(dB(this._iterationTime/this.iterationDuration,10),0,1)}set iterationProgress(e){let t=this.iterationDuration;this.currentTime=t*this._currentIteration+t*e}get currentIteration(){return this._currentIteration}set currentIteration(e){this.currentTime=this.iterationDuration*uB(+e,0,this.iterationCount-1)}get reversed(){return!!this._reversed}set reversed(e){e?this.reverse():this.play()}get speed(){return super.speed}set speed(e){super.speed=e,this.resetTime()}reset(e=!1){return cV(this),this._reversed&&!this._reverse&&(this.reversed=!1),this._iterationTime=this.iterationDuration,HB(this,0,1,~~e,az.FORCE),sV(this),this._hasChildren&&_B(this,sV),this}init(e=!1){this.fps=this._fps,this.speed=this._speed,!e&&this._hasChildren&&HB(this,this.duration,1,~~e,az.FORCE),this.reset(e);let t=this._autoplay;return t===!0?this.resume():t&&!Uz(t.linked)&&t.link(this),this}resetTime(){let e=1/(this._speed*QB._speed);return this._startTime=Lz()-(this._currentTime+this._delay)*e,this}pause(){return this.paused?this:(this.paused=!0,this.onPause(this),this)}resume(){return this.paused?(this.paused=!1,this.duration<=1e-11&&!this._hasChildren?HB(this,fz,0,0,az.FORCE):(this._running||=(yB(QB,this,uV),QB._hasChildren=!0,!0),this.resetTime(),this._startTime-=12,QB.wake()),this):this}restart(){return this.reset().resume()}seek(e,t=0,n=0){cV(this),this.completed=!1;let r=this.paused;return this.paused=!0,HB(this,e+this._delay,~~t,~~n,az.AUTO),r?this:this.resume()}alternate(){let e=this._reversed,t=this.iterationCount,n=this.iterationDuration,r=t===1/0?oB(pz/n):t;return this._reversed=+(this._alternate&&!(r%2)?e:!e),t===1/0?this.iterationProgress=this._reversed?1-this.iterationProgress:this.iterationProgress:this.seek(n*r-this._currentTime),this.resetTime(),this}play(){return this._reversed&&this.alternate(),this.resume()}reverse(){return this._reversed||this.alternate(),this.resume()}cancel(){return this._hasChildren?_B(this,e=>e.cancel(),!0):_B(this,oV),this._cancelled=1,this.pause()}stretch(e){let t=this.duration,n=mB(e);if(t===n)return this;let r=e/t,i=e<=fz;return this.duration=i?fz:n,this.iterationDuration=i?fz:mB(this.iterationDuration*r),this._offset*=r,this._delay*=r,this._loopDelay*=r,this}revert(){HB(this,0,1,0,az.AUTO);let e=this._autoplay;return e&&e.linked&&e.linked===this&&e.revert(),this.cancel()}complete(e=0){return this.seek(this.duration,e).cancel()}then(e=yz){let t=this.then,n=()=>{this.then=null,e(this),this.then=t,this._resolve=yz};return new Promise(e=>(this._resolve=()=>e(n()),this.completed&&this._resolve(),this))}};function fV(e){let t=Vz(e)?Mz.root.querySelectorAll(e):e;if(t instanceof NodeList||t instanceof HTMLCollection)return t}function pV(e){if(Wz(e))return[];if(!ez)return Rz(e)&&e.flat(1/0)||[e];if(Rz(e)){let t=e.flat(1/0),n=[];for(let e=0,r=t.length;e<r;e++){let r=t[e];if(!Wz(r)){let e=fV(r);if(e)for(let t=0,r=e.length;t<r;t++){let r=e[t];if(!Wz(r)){let e=!1;for(let t=0,i=n.length;t<i;t++)if(n[t]===r){e=!0;break}e||n.push(r)}}else{let e=!1;for(let t=0,i=n.length;t<i;t++)if(n[t]===r){e=!0;break}e||n.push(r)}}}return n}let t=fV(e);return t?Array.from(t):[e]}function mV(e){let t=pV(e),n=t.length;for(let e=0;e<n;e++){let n=t[e];if(!n[sz]){n[sz]=!0;let e=Gz(n);(n.nodeType||e)&&(n[cz]=!0,n[lz]=e,n[uz]={})}}return t}var hV={deg:1,rad:180/cB,turn:360},gV={},_V=(e,t,n,r=!1)=>{let i=t.u,a=t.n;if(t.t===iz.UNIT&&i===n)return t;let o=a+i+n,s=gV[o];if(!Uz(s)&&!r)t.n=s;else{let r;if(i in hV)r=a*hV[i]/hV[n];else{let t=e.cloneNode(),o=e.parentNode,s=o&&o!==nz?o:nz.body;s.appendChild(t);let c=t.style;c.width=100+i;let l=t.offsetWidth||100;c.width=100+n;let u=l/(t.offsetWidth||100);s.removeChild(t),r=u*a}t.n=r,gV[o]=r}return t.t,iz.UNIT,t.u=n,t},vV=e=>e,yV=(e=1.68)=>t=>$z(t,+e),bV={in:e=>t=>e(t),out:e=>t=>1-e(1-t),inOut:e=>t=>t<.5?e(t*2)/2:1-e(t*-2+2)/2,outIn:e=>t=>t<.5?(1-e(1-t*2))/2:(e(t*2-1)+1)/2},xV=cB/2,SV=cB*2,CV={"":yV,Quad:yV(2),Cubic:yV(3),Quart:yV(4),Quint:yV(5),Sine:e=>1-nB(e*xV),Circ:e=>1-eB(1-e*e),Expo:e=>e?$z(2,10*e-10):0,Bounce:e=>{let t,n=4;for(;e<((t=$z(2,--n))-1)/11;);return 1/$z(4,3-n)-7.5625*$z((t*3-2)/22-e,2)},Back:(e=1.7)=>t=>(+e+1)*t*t*t-+e*t*t,Elastic:(e=1,t=.3)=>{let n=uB(+e,1,10),r=uB(+t,fz,2),i=r/SV*sB(1/n),a=SV/r;return e=>e===0||e===1?e:-n*$z(2,-10*(1-e))*tB((1-e-i)*a)}},wV=(()=>{let e={linear:vV,none:vV};for(let t in bV)for(let n in CV){let r=CV[n],i=bV[t];e[t+n]=n===``||n===`Back`||n===`Elastic`?(e,t)=>i(r(e,t)):i(r)}return e})(),TV={linear:vV,none:vV},EV=e=>{if(TV[e])return TV[e];if(e.indexOf(`(`)<=-1){let t=bV[e]||e.includes(`Back`)||e.includes(`Elastic`)?wV[e]():wV[e];return t?TV[e]=t:vV}{let t=e.slice(0,-1).split(`(`),n=wV[t[0]];return n?TV[e]=n(...t[1].split(`,`)):vV}},DV=[`steps(`,`irregular(`,`linear(`,`cubicBezier(`],OV=e=>{if(Vz(e)){for(let t=0,n=DV.length;t<n;t++)if(Iz(e,DV[t]))return console.warn(`String syntax for \`ease: "${e}"\` has been removed from the core and replaced by importing and passing the easing function directly: \`ease: ${e}\``),vV}return Hz(e)?e:Vz(e)?EV(e):vV},kV=IB(),AV=IB(),jV={},MV={func:null},NV={func:null},PV=[null],FV=[null,null],IV={to:null},LV=0,RV=0,zV,BV,VV=(e,t)=>{let n={};if(Rz(e)){let t=[].concat(...e.map(e=>Object.keys(e))).filter(Xz);for(let r=0,i=t.length;r<i;r++){let i=t[r];n[i]=e.map(e=>{let t={};for(let n in e){let r=e[n];Xz(n)?n===i&&(t.to=r):t[n]=r}return t})}}else{let r=kB(t.duration,Nz.defaults.duration);Object.keys(e).map(t=>({o:parseFloat(t)/100,p:e[t]})).sort((e,t)=>e.o-t.o).forEach(e=>{let t=e.o,i=e.p;for(let e in i)if(Xz(e)){let a=n[e];a||=n[e]=[];let o=t*r,s=a.length,c=a[s-1],l={to:i[e]},u=0;for(let e=0;e<s;e++)u+=a[e].duration;s===1&&(l.from=c.to),i.ease&&(l.ease=i.ease),l.duration=o-(s?u:0),a.push(l)}return e});for(let e in n){let t=n[e],r;for(let e=0,n=t.length;e<n;e++){let n=t[e],i=n.ease;n.ease=r||void 0,r=i}t[0].duration||t.shift()}}return n},HV=class extends dV{constructor(e,t,n,r,i=!1,a=0,o){super(t,n,r),this._head,this._tail,++RV;let s=mV(e),c=s.length,l=t.keyframes,u=l?gB(VV(l,t),t):t,{id:d,delay:f,duration:p,ease:m,playbackEase:h,modifier:g,composition:_,onRender:v}=u,y=n?n.defaults:Nz.defaults,b=kB(m,y.ease),x=kB(h,y.playbackEase),S=x?OV(x):null,C=!Uz(b.ease),w=C?b.ease:kB(m,S?`linear`:y.ease),T=C?b.settlingDuration:kB(p,y.duration),E=kB(f,y.delay),D=g||y.modifier,O=Uz(_)&&c>=1e3?oz.none:Uz(_)?y.composition:_,k=this._offset+(n?n._offset:0);C&&(b.parent=this);let A=NaN,j=NaN,M=0,N=0;for(let e=0;e<c;e++){let t=s[e],r=a||e,c=o||s,l=NaN,d=NaN;for(let e in u)if(Xz(e)){let a=MB(t,e),o=CB(t,e),s=WB(e,t,a),f=u[e],p=Rz(f);if(i&&!p&&(FV[0]=f,FV[1]=f,f=FV),p){let e=f.length,t=!zz(f[0]);e===2&&t?(IV.to=f,PV[0]=IV,zV=PV):e>2&&t?(zV=[],f.forEach((e,t)=>{t?t===1?(FV[1]=e,zV.push(FV)):zV.push(e):FV[0]=e})):zV=f}else PV[0]=f,zV=PV;let m=null,h=null,g=NaN,_=0,v=0;for(let e=zV.length;v<e;v++){let i=zV[v];zz(i)?BV=i:(IV.to=i,BV=IV),MV.func=null,NV.func=null;let l=jB(kB(BV.composition,O),t,r,c,null,null),u=Bz(l)?l:oz[l];!m&&u!==oz.none&&(m=nV(t,s));let d=m?m._tail:null,f=n&&d&&d.parent.parent===n?d:h,p=jB(BV.to,t,r,c,MV,f),y;zz(p)&&!Uz(p.to)?(BV=p,y=p.to):y=p;let b=jB(BV.from,t,r,c,NV,f),x=BV.ease||w,S=jB(x,t,r,c,null,f),C=Hz(S)||Vz(S)?S:x,A=!Uz(C)&&!Uz(C.ease),j=A?C.ease:C,P=A?C.settlingDuration:jB(kB(BV.duration,e>1?jB(T,t,r,c,null,f)/e:T),t,r,c,null,f),F=jB(kB(BV.delay,v?0:E),t,r,c,null,f),I=BV.modifier||D,L=!Uz(b),R=!Uz(y),z=Rz(y),ee=z||L&&R,te=h?_:0,B=h?_+F:F,ne=dB(k+B,12),re=dB(k+te,12);!N&&(L||z)&&(N=1);let V=h;if(u!==oz.none){let e=m._head;for(;e&&e._absoluteStartTime<=ne;)if(e._isOverridden||(V=e),e=e._nextRep,e&&e._absoluteStartTime>=ne)for(;e;)iV(e),e=e._nextRep}if(ee){LB(z?jB(y[0],t,r,c,NV,f):b,kV),LB(z?jB(y[1],t,r,c,MV,f):y,AV);let e=PB(t,s,a,jV);kV.t===iz.NUMBER&&(V?V._valueType===iz.UNIT&&(kV.t=iz.UNIT,kV.u=V._unit):(LB(e,zB),zB.t===iz.UNIT&&(kV.t=iz.UNIT,kV.u=zB.u)))}else R?LB(y,AV):h?RB(h,AV):LB(n&&V&&V.parent.parent===n?V._value:PB(t,s,a,jV),AV),L?LB(b,kV):h?RB(h,kV):LB(n&&V&&V.parent.parent===n?V._value:PB(t,s,a,jV),kV);if(kV.o&&(kV.n=FB(V?V._toNumber:LB(PB(t,s,a,jV),zB).n,kV.n,kV.o)),AV.o&&(AV.n=FB(kV.n,AV.n,AV.o)),kV.t!==AV.t){if(kV.t===iz.COMPLEX||AV.t===iz.COMPLEX){let e=kV.t===iz.COMPLEX?kV:AV,t=kV.t===iz.COMPLEX?AV:kV;t.t=iz.COMPLEX,t.s=hB(e.s),t.d=e.d.map(()=>t.n)}else if(kV.t===iz.UNIT||AV.t===iz.UNIT){let e=kV.t===iz.UNIT?kV:AV,t=kV.t===iz.UNIT?AV:kV;t.t=iz.UNIT,t.u=e.u}else if(kV.t===iz.COLOR||AV.t===iz.COLOR){let e=kV.t===iz.COLOR?kV:AV,t=kV.t===iz.COLOR?AV:kV;t.t=iz.COLOR,t.d=e.d.map(()=>0)}}if(kV.u!==AV.u){let e=AV.u?kV:AV;e=_V(t,e,AV.u?AV.u:kV.u,!1)}if(AV.d&&kV.d&&AV.d.length!==kV.d.length){let e=kV.d.length>AV.d.length?kV:AV,t=e===kV?AV:kV;t.d=e.d.map((e,n)=>Uz(t.d[n])?0:t.d[n]),t.s=hB(e.s)}let H=dB(+P||1e-11,12),ie=jV[s];Wz(ie)||(jV[s]=null);let ae=o?o.set:null;_=dB(B+H,12);let oe=kV.d,se=AV.d,ce=AV.s,le={parent:this,id:LV++,property:s,target:t,_value:null,_toFunc:MV.func,_fromFunc:NV.func,_ease:OV(j),_fromNumbers:oe?hB(oe):hz,_toNumbers:se?hB(se):hz,_strings:ce?hB(ce):hz,_fromNumber:kV.n,_toNumber:AV.n,_numbers:oe?hB(oe):hz,_number:kV.n,_unit:AV.u,_modifier:I,_currentTime:0,_startTime:B,_delay:+F,_updateDuration:H,_changeDuration:H,_absoluteStartTime:ne,_absoluteUpdateStartTime:re,_absoluteEndTime:dB(k+_,12),_hasFromValue:L||z?1:0,_tweenType:a,_setter:ae,_valueType:AV.t,_composition:u,_isOverlapped:0,_isOverridden:0,_renderTransforms:0,_inlineValue:ie,_prevRep:null,_nextRep:null,_prevAdd:null,_nextAdd:null,_prev:null,_next:null};u!==oz.none&&aV(le,m);let ue=le._valueType;if(ue===iz.COMPLEX)le._value=BB(le,1,-1);else if(ue===iz.UNIT)le._value=`${I(le._toNumber)}${le._unit}`;else if(ue===iz.COLOR){let e=AV.d;le._value=`rgba(${dB(e[0],0)},${dB(e[1],0)},${dB(e[2],0)},${e[3]})`}else le._value=I(le._toNumber);isNaN(g)&&(g=le._startTime),h=le,M++,yB(this,le)}(isNaN(j)||g<j)&&(j=g),(isNaN(A)||_>A)&&(A=_),a===rz.TRANSFORM&&(l=M-v,d=M)}if(!isNaN(l)){let e=0;_B(this,t=>{e>=l&&e<d&&(t._renderTransforms=1,t._composition===oz.blend&&_B(qB.animation,e=>{e.id===t.id&&(e._renderTransforms=1)})),e++})}}c||console.warn(`No target found. Make sure the element you're trying to animate is accessible before creating your animation.`),j?(_B(this,e=>{e._startTime-e._delay||(e._delay-=j),e._startTime-=j}),A-=j):j=0,A||(A=fz,this.iterationCount=0),this.targets=s,this.id=Uz(d)?RV:d,this.duration=A===1e-11?fz:pB((A+this._loopDelay)*this.iterationCount-this._loopDelay)||1e-11,this.onRender=v||y.onRender,this._ease=S,this._delay=j,this.iterationDuration=A,!this._autoplay&&N&&this.onRender(this)}stretch(e){let t=this.duration;if(t===mB(e))return this;let n=e/t;return _B(this,e=>{e._updateDuration=mB(e._updateDuration*n),e._changeDuration=mB(e._changeDuration*n),e._currentTime*=n,e._delay*=n,e._startTime*=n,e._absoluteStartTime*=n,e._absoluteUpdateStartTime*=n,e._absoluteEndTime*=n}),super.stretch(e)}refresh(){return _B(this,e=>{let t=e._toFunc,n=e._fromFunc;(t||n)&&(n?(LB(n(),kV),kV.u!==e._unit&&e.target[cz]&&_V(e.target,kV,e._unit,!0),e._fromNumbers=hB(kV.d),e._fromNumber=kV.n):t&&(LB(PB(e.target,e.property,e._tweenType),zB),e._fromNumbers=hB(zB.d),e._fromNumber=zB.n),t&&(LB(t(),AV),e._toNumbers=hB(AV.d),e._strings=hB(AV.s),e._toNumber=AV.o?FB(e._fromNumber,AV.n,AV.o):AV.n))}),this.duration===1e-11&&this.restart(),this}revert(){return super.revert(),GB(this)}then(e){return super.then(e)}},UV=(e,t)=>Nz.editor?Nz.editor.addAnimation(e,t):new HV(e,t,null,0,!1).init(),WV=mz*10,GV=class{constructor(e={}){let t=!Uz(e.bounce)||!Uz(e.duration);this.timeStep=.02,this.restThreshold=5e-4,this.restDuration=200,this.maxDuration=6e4,this.maxRestSteps=this.restDuration/this.timeStep/mz,this.maxIterations=this.maxDuration/this.timeStep/mz,this.bn=uB(kB(e.bounce,.5),-1,1),this.pd=uB(kB(e.duration,628),10*Nz.timeScale,WV*Nz.timeScale),this.m=uB(kB(e.mass,1),1,WV),this.s=uB(kB(e.stiffness,100),fz,WV),this.d=uB(kB(e.damping,10),fz,WV),this.v=uB(kB(e.velocity,0),-WV,WV),this.w0=0,this.zeta=0,this.wd=0,this.b=0,this.completed=!1,this.solverDuration=0,this.settlingDuration=0,this.parent=null,this.onComplete=e.onComplete||yz,t&&this.calculateSDFromBD(),this.compute(),this.ease=e=>{let t=e*this.settlingDuration,n=this.completed,r=this.pd;return t>=r&&!n&&(this.completed=!0,this.onComplete(this.parent)),t<r&&n&&(this.completed=!1),e===0||e===1?e:this.solve(e*this.solverDuration)}}solve(e){let{zeta:t,w0:n,wd:r,b:i}=this,a=e;return a=t<1?iB(-a*t*n)*(1*nB(r*a)+i*tB(r*a)):t===1?(1+i*a)*iB(-a*n):((1+i)*iB((-t*n+r)*a)+(1-i)*iB((-t*n-r)*a))/2,1-a}calculateSDFromBD(){let e=Nz.timeScale===1?this.pd/mz:this.pd;this.m=1,this.v=0,this.s=$z(2*cB/e,2),this.d=this.bn>=0?(1-this.bn)*4*cB/e:4*cB/(e*(1+this.bn)),this.s=dB(uB(this.s,fz,WV),3),this.d=dB(uB(this.d,fz,300),3)}calculateBDFromSD(){let e=2*cB/eB(this.s);this.pd=e*(Nz.timeScale===1?mz:1),this.bn=this.d/(2*eB(this.s))<=1?1-this.d*e/(4*cB):4*cB/(this.d*e)-1,this.bn=dB(uB(this.bn,-1,1),3),this.pd=dB(uB(this.pd,10*Nz.timeScale,WV*Nz.timeScale),3)}compute(){let{maxRestSteps:e,maxIterations:t,restThreshold:n,timeStep:r,m:i,d:a,s:o,v:s}=this,c=this.w0=uB(eB(o/i),fz,mz),l=this.zeta=a/(2*eB(o*i));l<1?(this.wd=c*eB(1-l*l),this.b=(l*c+-s)/this.wd):l===1?(this.wd=0,this.b=-s+c):(this.wd=c*eB(l*l-1),this.b=(l*c+-s)/this.wd);let u=0,d=0,f=0;for(;d<=e&&f<=t;)rB(1-this.solve(u))<n?d++:d=0,this.solverDuration=u,u+=r,f++;this.settlingDuration=dB(this.solverDuration*mz,0)*Nz.timeScale}get bounce(){return this.bn}set bounce(e){this.bn=uB(kB(e,1),-1,1),this.calculateSDFromBD(),this.compute()}get duration(){return this.pd}set duration(e){this.pd=uB(kB(e,1),10*Nz.timeScale,WV*Nz.timeScale),this.calculateSDFromBD(),this.compute()}get stiffness(){return this.s}set stiffness(e){this.s=uB(kB(e,100),fz,WV),this.calculateBDFromSD(),this.compute()}get damping(){return this.d}set damping(e){this.d=uB(kB(e,10),fz,WV),this.calculateBDFromSD(),this.compute()}get mass(){return this.m}set mass(e){this.m=uB(kB(e,1),1,WV),this.compute()}get velocity(){return this.v}set velocity(e){this.v=uB(kB(e,0),-WV,WV),this.compute()}},KV=e=>new GV(e),qV=(e=10,t)=>{let n=t?aB:oB;return t=>n(uB(t,0,1)*e)*(1/e)},JV=s({animate:()=>UV,spring:()=>KV}),YV=(0,G.forwardRef)(function({id:e,transform:t},n){return(0,Z.jsxs)(`radialGradient`,{ref:n,id:e,gradientUnits:`userSpaceOnUse`,cx:`-1.2`,cy:`-1.6`,r:`5.6`,gradientTransform:t,children:[(0,Z.jsx)(`stop`,{offset:`0`,stopColor:`color-mix(in oklab, var(--color-white) calc(var(--depth) * 50%), currentColor)`}),(0,Z.jsx)(`stop`,{offset:`1`,stopColor:`currentColor`})]})});function XV({id:e}){return(0,Z.jsx)(`filter`,{id:e,x:`-50%`,y:`-50%`,width:`200%`,height:`200%`,children:(0,Z.jsx)(`feDropShadow`,{dx:`0`,dy:`1.5`,stdDeviation:`1`,floodColor:`currentColor`,style:{floodOpacity:`calc(var(--depth) * 0.6)`}})})}function ZV({id:e}){return(0,Z.jsxs)(`filter`,{id:e,x:`-10%`,y:`-10%`,width:`120%`,height:`120%`,colorInterpolationFilters:`sRGB`,children:[(0,Z.jsx)(`feGaussianBlur`,{in:`SourceAlpha`,stdDeviation:`0.3`,result:`soft-edge`}),(0,Z.jsx)(`feOffset`,{in:`soft-edge`,dx:`0.25`,dy:`0.45`,result:`lower-edge`}),(0,Z.jsx)(`feComposite`,{in:`SourceAlpha`,in2:`lower-edge`,operator:`out`,result:`inner-shadow`}),(0,Z.jsx)(`feFlood`,{floodColor:`var(--color-black)`,floodOpacity:`calc(var(--depth) * 0.28)`}),(0,Z.jsx)(`feComposite`,{in2:`inner-shadow`,operator:`in`,result:`shade`}),(0,Z.jsx)(`feOffset`,{in:`soft-edge`,dx:`-0.2`,dy:`-0.35`,result:`upper-edge`}),(0,Z.jsx)(`feComposite`,{in:`SourceAlpha`,in2:`upper-edge`,operator:`out`,result:`inner-highlight`}),(0,Z.jsx)(`feFlood`,{floodColor:`var(--color-white)`,floodOpacity:`calc(var(--depth) * 0.7)`}),(0,Z.jsx)(`feComposite`,{in2:`inner-highlight`,operator:`in`,result:`highlight`}),(0,Z.jsxs)(`feMerge`,{children:[(0,Z.jsx)(`feMergeNode`,{in:`SourceGraphic`}),(0,Z.jsx)(`feMergeNode`,{in:`shade`}),(0,Z.jsx)(`feMergeNode`,{in:`highlight`})]})]})}var QV=Object.freeze({alphaIntercept:-8,alphaSlope:18,blurStdDeviation:2});function $V({id:e,values:t=$I}){return(0,Z.jsxs)(`filter`,{id:e,x:`-50%`,y:`-50%`,width:`200%`,height:`200%`,children:[(0,Z.jsx)(`feGaussianBlur`,{in:`SourceGraphic`,stdDeviation:t.blurStdDeviation,result:`blur`}),(0,Z.jsx)(`feColorMatrix`,{in:`blur`,values:`1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 ${String(t.alphaSlope)} ${String(t.alphaIntercept)}`,result:`gooey`}),(0,Z.jsx)(`feComposite`,{in:`SourceGraphic`,in2:`gooey`,operator:`atop`})]})}function eH(e,t){let n=e.ownerDocument,r=!0,i=()=>{t(r&&!n.hidden)},a=globalThis,o=`IntersectionObserver`in globalThis&&a.IntersectionObserver?new a.IntersectionObserver(t=>{let n=t.find(t=>t.target===e);n&&(r=n.isIntersecting,i())}):void 0;return o?.observe(e),n.addEventListener(`visibilitychange`,i),i(),()=>{o?.disconnect(),n.removeEventListener(`visibilitychange`,i)}}function tH(e){let t=Math.max(0,Math.min(1,e));return t*t*(3-2*t)}function nH(e,t){let n=Math.max(0,Math.min(1,(t-(e-1)*.085)/.68));return Math.sin(n*Math.PI)**2}function rH(e,t,n){let r=n*Math.PI*2,i=t*2.1,a=Math.sin(r*2+i)*.15,o={rx:4*(1+a),ry:4/(1+a)};if(e===`line`){let e=7.5+4*Math.cos(r+(t===2?-.45:0));return{cx:(t-1)*e,cy:Math.sin(r+i)*.7,...o}}if(e===`square`){let e=4.7+2.7*Math.cos(r);return{cx:(t%2?1:-1)*e,cy:(t<2?-1:1)*e,...o}}if(e===`donut`){let e=tH(n/.66)*Math.PI*2,o=Math.min(e,t*Math.PI/8)-Math.PI/2,s=tH((n-.79)/.21),c=8+Math.sin(r*2+i)*.35*Math.sin(n*Math.PI);return{cx:Math.cos(o)*c*(1-s),cy:Math.sin(o)*c*(1-s)-8*s,rx:3.6*(1+a*Math.sin(n*Math.PI)),ry:3.6/(1+a*Math.sin(n*Math.PI))}}if(e===`bloom`){if(t===0){let e=[1,2,3,4].reduce((e,t)=>e+nH(t,n),0),t=Math.sqrt(49-e*4);return{cx:Math.sin(r)*.4,cy:Math.sin(r*2)*.4,rx:t*(1+a),ry:t/(1+a)}}let e=nH(t,n),i=(t-1)*Math.PI/2-Math.PI/4+Math.sin(r)*.22;return{cx:Math.cos(i)*14*e,cy:Math.sin(i)*14*e,rx:3.2*(1+a),ry:3.2/(1+a)}}return{cx:Math.sin(r+i)*6+Math.sin(r*3+i)*2.5,cy:Math.cos(r*2+i)*6,...o}}var iH={line:1700,square:1900,donut:3e3,wander:4600,bloom:2800},aH=2;function oH({variant:e,pace:t=`working`}){let n=`caps-loader-${(0,G.useId)().replaceAll(`:`,``)}`,r=(0,G.useRef)(null),i=(0,G.useRef)(null),a=UR(i),{reduced:o}=a,s=e===`donut`?16:e===`bloom`?5:e===`square`?4:3;return(0,G.useLayoutEffect)(()=>{if(!r.current||!i.current||o&&t===`idle`)return;let n=o?[UV(r.current,{opacity:[.55,1],duration:a.slow*10,ease:`inOutSine`,alternate:!0,loop:!0})]:[...r.current.querySelectorAll(`ellipse`)].map((n,r)=>UV(n,{keyframes:Array.from({length:48},(n,i)=>({...rH(e,r,(i+1)/48),duration:WR(a,iH[e]*(t===`idle`?aH:1))/48})),ease:`linear`,loop:!0})),s=eH(i.current,e=>{for(let t of n)e?t.resume():t.pause()});return()=>{s();for(let e of n)e.revert()}},[e,t,o,a]),(0,Z.jsxs)(`svg`,{ref:i,"aria-hidden":`true`,focusable:`false`,viewBox:e===`line`?`-20 -10 40 20`:`-20 -20 40 40`,children:[(0,Z.jsxs)(`defs`,{children:[(0,Z.jsx)($V,{id:n,values:QV}),(0,Z.jsx)(YV,{id:`${n}-surface`,transform:e===`line`?`matrix(3.4 0 0 1.4 0 0)`:`matrix(3 0 0 3 0 0)`}),(0,Z.jsx)(XV,{id:`${n}-shadow`}),(0,Z.jsx)(`mask`,{id:`${n}-mask`,maskUnits:`userSpaceOnUse`,x:`-20`,y:`-20`,width:`40`,height:`40`,style:{maskType:`alpha`},children:(0,Z.jsx)(`g`,{ref:r,fill:`currentColor`,filter:`url(#${n})`,children:Array.from({length:s},(t,n)=>(0,Z.jsx)(`ellipse`,{...rH(e,n,0)},n))})})]}),(0,Z.jsx)(`g`,{filter:`url(#${n}-shadow)`,children:(0,Z.jsx)(`rect`,{x:`-20`,y:`-20`,width:`40`,height:`40`,fill:`url(#${n}-surface)`,mask:`url(#${n}-mask)`})})]})}var sH={sm:`caps-loader-sm`,md:`caps-loader-md`,lg:`caps-loader-lg`,fill:`caps-loader-fill`},cH={neutral:`text-base-content`,accent:`text-accent`,primary:`text-primary`,success:`text-success`,current:`text-current`},lH=(0,G.forwardRef)(function({"aria-label":e,"aria-labelledby":t,className:n,decorative:r=!1,label:i=`Loading`,size:a=`md`,variant:o=`line`,pace:s=`working`,tone:c=`neutral`,...l},u){let d=`${(0,G.useId)()}-label`,f=!r&&e===void 0&&t===void 0;return(0,Z.jsxs)(`span`,{...l,"aria-label":r?void 0:e,"aria-hidden":r||void 0,"aria-labelledby":r?void 0:t??(e===void 0?d:void 0),className:Q(`caps-loader`,sH[a],cH[c],n),"data-variant":o,"data-pace":s,role:r?void 0:`status`,ref:u,children:[(0,Z.jsx)(oH,{variant:o,pace:s}),f?(0,Z.jsx)(LR,{id:d,children:i}):null]})}),uH=Object.freeze({ease:`linear`,duration:0});function dH(e,t){let n=KR(e,t.duration);return n<=0?uH:e.steps>0?{ease:qV(e.steps),duration:n}:{ease:KV({bounce:GR(e,t.bounce),duration:n}),duration:n}}function fH(e,t){let n=WR(e,t.duration);return{ease:e.steps>0?qV(e.steps):t.ease,duration:n}}var pH={dot:{y:-4,height:8,cy:0},pill:{y:-16,height:32,cy:0},bang:{y:-16,height:20,cy:12}};function mH({className:e,glyph:t,motion:n}){let r=`caps-status-${(0,G.useId)().replaceAll(`:`,``)}`,i=(0,G.useRef)(null),a=(0,G.useRef)(null),o=(0,G.useRef)(null),s=(0,G.useRef)(null),c=(0,G.useRef)(null),l=(0,G.useRef)(null),u=(0,G.useRef)(pH[t]).current,d=(0,G.useRef)(t===`dot`?1:4).current,f=(0,G.useRef)(+(t===`bang`)).current,p=(0,G.useRef)(t),m=UR(s),{reduced:h}=m;return(0,G.useLayoutEffect)(()=>{if(!i.current||!a.current||!c.current||!l.current)return;let e=pH[t],n=h||p.current===t;p.current=t;let r=BR(i.current),o=n?{duration:0}:dH(r,{bounce:.3,duration:360}),s=UV(i.current,{y:e.y,height:e.height,...o}),u=UV(a.current,{cy:e.cy,...n?{duration:0}:{delay:WR(r,35),...dH(r,{bounce:.3,duration:420})}}),d=UV(c.current,{gradientTransform:`matrix(1 0 0 ${t===`dot`?`1`:`4`} 0 0)`,...o}),f=UV(l.current,{opacity:+(t===`bang`),...n?uH:fH(r,{ease:`inOutSine`,duration:220})});return()=>{s.cancel(),u.cancel(),d.cancel(),f.cancel()}},[t,h]),(0,G.useLayoutEffect)(()=>{if(!o.current||!s.current||h||n===`none`)return;let e=n===`pulse`?UV(o.current,{opacity:[1,.45],...fH(m,{ease:`inOutSine`,duration:750}),alternate:!0,loop:!0}):UV(o.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}},...fH(m,{ease:`inOutSine`,duration:1e3}),loop:!0}),t=eH(s.current,t=>{t?e.resume():e.pause()});return()=>{t(),e.revert()}},[n,h,m]),(0,Z.jsxs)(`svg`,{ref:s,"aria-hidden":`true`,className:`caps-status-bead ${e??``}`,width:`8`,height:`8`,viewBox:`-4 -4 8 8`,focusable:`false`,children:[(0,Z.jsxs)(`defs`,{children:[(0,Z.jsx)($V,{id:r,values:QV}),(0,Z.jsx)(YV,{ref:c,id:`${r}-surface`,transform:`matrix(1 0 0 ${String(d)} 0 0)`}),(0,Z.jsxs)(`radialGradient`,{id:`${r}-drop-light`,gradientUnits:`userSpaceOnUse`,cx:`-1.2`,cy:`10.4`,r:`5.6`,children:[(0,Z.jsx)(`stop`,{offset:`0`,stopColor:`var(--color-white)`,style:{stopOpacity:`calc(var(--depth) * 0.5)`}}),(0,Z.jsx)(`stop`,{offset:`1`,stopColor:`var(--color-white)`,stopOpacity:`0`})]}),(0,Z.jsx)(XV,{id:`${r}-shadow`}),(0,Z.jsx)(`mask`,{id:`${r}-silhouette`,maskUnits:`userSpaceOnUse`,x:`-12`,y:`-24`,width:`24`,height:`48`,style:{maskType:`alpha`},children:(0,Z.jsxs)(`g`,{fill:`var(--color-white)`,filter:`url(#${r})`,children:[(0,Z.jsx)(`rect`,{ref:i,x:`-4`,y:u.y,width:`8`,height:u.height,rx:`4`}),(0,Z.jsx)(`circle`,{ref:a,cx:`0`,cy:u.cy,r:`4`})]})})]}),(0,Z.jsx)(`g`,{ref:o,filter:`url(#${r}-shadow)`,children:(0,Z.jsxs)(`g`,{mask:`url(#${r}-silhouette)`,children:[(0,Z.jsx)(`rect`,{x:`-12`,y:`-24`,width:`24`,height:`48`,fill:`url(#${r}-surface)`}),(0,Z.jsx)(`rect`,{ref:l,x:`-12`,y:`-24`,width:`24`,height:`48`,fill:`url(#${r}-drop-light)`,opacity:f})]})})]})}var hH=.28;function gH(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?hH: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 _H=7.25;function vH({className:e,glyph:t,progress:n}){let r=`caps-status-mark-${(0,G.useId)().replaceAll(`:`,``)}`,i=(0,G.useRef)(null),a=(0,G.useRef)(null),o=(0,G.useRef)(null),s=(0,G.useRef)(null),c=(0,G.useRef)(null),l=(0,G.useRef)(null),u=(0,G.useRef)(null),d=(0,G.useRef)(null),f=(0,G.useRef)(gH(t,n)).current,p=(0,G.useRef)(t),m=$R();(0,G.useLayoutEffect)(()=>{let e=i.current,r=a.current,c=o.current,f=s.current,h=l.current,g=u.current,_=d.current;if(!e||!r||!c||!f||!h||!g||!_)return;let v=gH(t,n),y=p.current;p.current=t;let b=BR(e),x=m||y===t&&t!==`arc`,S=x?m?{ease:b.ease,duration:b.fast}:uH:fH(b,{ease:`outQuad`,duration:160}),C=(t===`check`||t===`cross`)&&!x,w=fH(b,{ease:`inOutSine`,duration:220}),T=[UV(r,{opacity:v.dashes,...S}),UV(c,{opacity:v.track*.28,...S}),UV(f,{opacity:v.arc,"stroke-dasharray":`${String(v.sweep)} 1`,...x?m?uH:S:w}),UV(h,{r:v.disc*_H,...C?{delay:w.duration*.7,...dH(b,{bounce:.35,duration:360})}:m?uH:fH(b,{ease:`inCubic`,duration:140})}),UV(g,{"stroke-dashoffset":1-v.tick,...C&&v.tick>0?{delay:w.duration*.7+b.fast,...fH(b,{ease:`outCubic`,duration:240})}:uH}),UV(_,{"stroke-dashoffset":1-v.cross,...C&&v.cross>0?{delay:w.duration*.7+b.fast,...fH(b,{ease:`outCubic`,duration:240})}:uH})];return t===`cross`&&C&&b.shake>0&&T.push(UV(e,{translateX:[0,-b.shake,b.shake,-b.shake/2,0],delay:w.duration+b.fast,...fH(b,{ease:`linear`,duration:300})})),()=>{for(let e of T)e.cancel()}},[t,n,m]);let h=t===`arc`&&n===void 0&&!m;return(0,G.useLayoutEffect)(()=>{if(!h||!c.current||!i.current)return;let e=BR(i.current),t=UV(c.current,{rotate:[0,360],...fH(e,{ease:`linear`,duration:900}),loop:!0}),n=eH(i.current,e=>{e?t.resume():t.pause()});return()=>{n(),t.revert()}},[h]),(0,Z.jsxs)(`svg`,{ref:i,"aria-hidden":`true`,className:`caps-status-mark ${e??``}`,viewBox:`0 0 16 16`,focusable:`false`,children:[(0,Z.jsxs)(`defs`,{children:[(0,Z.jsx)(YV,{id:`${r}-surface`,transform:`matrix(1.6 0 0 1.6 8 8)`}),(0,Z.jsxs)(`mask`,{id:`${r}-knock`,maskUnits:`userSpaceOnUse`,x:`0`,y:`0`,width:`16`,height:`16`,children:[(0,Z.jsx)(`rect`,{width:`16`,height:`16`,fill:`var(--color-white)`}),(0,Z.jsx)(`path`,{ref:u,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-f.tick}),(0,Z.jsx)(`path`,{ref:d,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-f.cross})]})]}),(0,Z.jsx)(`circle`,{ref:a,cx:`8`,cy:`8`,r:`6.25`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeDasharray:`1.7 2.2`,opacity:f.dashes}),(0,Z.jsx)(`circle`,{ref:o,cx:`8`,cy:`8`,r:`6.25`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,opacity:f.track*.28}),(0,Z.jsx)(`g`,{ref:c,className:`caps-status-mark-spin`,children:(0,Z.jsx)(`circle`,{ref:s,cx:`8`,cy:`8`,r:`6.25`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,pathLength:1,strokeDasharray:`${String(f.sweep)} 1`,transform:`rotate(-90 8 8)`,opacity:f.arc})}),(0,Z.jsx)(`circle`,{ref:l,cx:`8`,cy:`8`,r:f.disc*_H,fill:`url(#${r}-surface)`,mask:`url(#${r}-knock)`})]})}var yH=new Set([`ring`,`arc`,`check`,`cross`]);function bH(e){return yH.has(e)}var xH={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`},SH=(0,G.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,Z.jsxs)(`span`,{...c,className:Q(`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:[bH(n)?(0,Z.jsx)(vH,{className:xH[i],glyph:n,progress:s}):(0,Z.jsx)(mH,{className:xH[i],glyph:n,motion:r}),t===void 0?null:(0,Z.jsx)(`span`,{children:t})]})}),CH=(0,G.createContext)(void 0),wH=(0,G.createContext)(null);function TH({container:e,children:t}){let n=(0,G.useContext)(wH),r=(0,G.useMemo)(()=>n===null?null:{...n,popover:e},[n,e]);return r===null?t:(0,Z.jsx)(wH.Provider,{value:r,children:t})}function EH(e){let t=(0,G.useContext)(wH);return t===null?Object.hasOwn(globalThis,`document`)?document.body:null:t[e]}function DH(e){let t=(0,G.useContext)(CH),n=(0,G.useRef)(e);n.current=e,(0,G.useEffect)(()=>t?.(()=>{n.current()}),[t])}var OH=`(max-width: 600px)`,kH=globalThis;function AH(e){let t=kH.matchMedia?.(OH);return t?.addEventListener(`change`,e),()=>{t?.removeEventListener(`change`,e)}}function jH(){return(0,G.useSyncExternalStore)(AH,()=>kH.matchMedia?.(OH).matches??!1,()=>!1)}function MH({className:e,...t}){let n=EH(`toast`),r=jH();return n?(0,WF.createPortal)((0,Z.jsx)(SI,{position:r?`top-center`:`top-right`,swipeDirections:r?[`top`]:[`right`,`top`],mobileOffset:{top:`max(8px, env(safe-area-inset-top))`,bottom:16,left:16,right:16},offset:16,gap:8,icons:{close:(0,Z.jsx)(QI,{"aria-hidden":`true`,size:12}),success:(0,Z.jsx)(SH,{glyph:`dot`,tone:`success`}),error:(0,Z.jsx)(SH,{glyph:`dot`,tone:`error`}),warning:(0,Z.jsx)(SH,{glyph:`dot`,tone:`warning`}),info:(0,Z.jsx)(SH,{glyph:`dot`,tone:`info`}),loading:(0,Z.jsx)(lH,{decorative:!0,size:`sm`,tone:`current`,variant:`wander`})},className:Q(`caps-toaster`,e),...t}),n):null}function NH(e){return/\.mp3$/iu.test(e)}var PH=Object.freeze({width:4,height:3}),FH=`prints-generation-notices`;function IH(e){sI.error(e,{id:`prints-playback-error`,toasterId:FH})}function LH(e){return/\.mp4$/iu.test(e)}async function RH(e,t){if(LH(e.name)){let n=document.createElement(`video`);return n.preload=`metadata`,n.muted=!0,await new Promise((e,r)=>{n.addEventListener(`loadedmetadata`,()=>{e()},{once:!0}),n.addEventListener(`error`,()=>{r(Error(`MP4 metadata could not be read`))},{once:!0}),n.src=t}),{file:e,url:t,width:n.videoWidth,height:n.videoHeight}}if(NH(e.name)){let n=new Audio;return n.preload=`metadata`,await new Promise((e,r)=>{n.addEventListener(`loadedmetadata`,()=>{e()},{once:!0}),n.addEventListener(`error`,()=>{r(Error(`MP3 metadata could not be read`))},{once:!0}),n.src=t}),{file:e,url:t,...PH}}let n=new Image;return n.src=t,await n.decode(),{file:e,url:t,width:n.naturalWidth,height:n.naturalHeight}}var zH=4096,BH=255,VH=new TextEncoder,HH=Ux(eS.pipe(Y(MS(1)),Y(FS(zH)),Y(hS(e=>!e.includes(`\0`)&&e.split(`/`).every(e=>e!==``&&e!==`.`&&e!==`..`&&VH.encode(e).byteLength<=BH),{description:`a relative folder inside the library`}))));function UH(e,t){return t===void 0?e:`${e}/${t}`}function WH(e,t){let n=`${e}/`;if(!t.startsWith(n))return;let r=t.slice(n.length).split(`/`).slice(0,-1).join(`/`);return HH(r)?r:void 0}function GH(e){if(e===void 0)return[];let t=e.split(`/`);return t.map((e,n)=>({name:e,folder:t.slice(0,n+1).join(`/`)}))}J({queue:aS(eS.pipe(Y(FS(zH)))).pipe(Y(MS(1))),offset:tS.pipe(Y(AS()),Y(DS(0)))});function KH(e){return!e.selectable&&e.atFolderRoot&&!e.loading&&!e.failed}var qH=eo({error:U()}),JH=U().min(1).max(4096),YH=mo([`not_granted`,`not_found`,`conflict`,`invalid`,`unavailable`]),XH=eo({moved:Qa(eo({from:JH,to:JH})),failed:Qa(eo({path:JH,error:YH}))}),ZH=eo({files:Qa(eo({path:JH,kind:mo([`image`,`video`,`audio`]).nullable(),model:U().nullable(),modelLabel:U().nullable(),durationSeconds:Ra().nullable(),favorite:Ha()}))}),QH=eo({paths:Qa(JH),next:JH.nullable()});async function $H(e,t,n,r){let i=await e.capabilities.require(iP).call(t,JSON.stringify(n)),a=r.safeParse(i);if(a.success)return a.data;let o=qH.safeParse(i);throw new X(o.success?`Prints refused ${t}: ${o.data.error}`:`Prints answered ${t} in an unexpected shape`,{code:`PROTOCOL`,retryable:!1})}function eU(e,t){return $H(e,`moveFiles`,{paths:[...t.paths],folder:t.folder,createFolder:t.createFolder??!1,name:t.name},XH)}async function tU(e,t){return(await $H(e,`describeFiles`,{paths:[...t]},ZH)).files}async function nU(e,t,n){await $H(e,`setFavorite`,{paths:[...t],favorite:n},eo({favorite:Ha(),count:Ra()}))}function rU(e,t,n){return $H(e,`listFavorites`,{after:t,limit:n},QH)}var iU=24,aU=256,oU=e=>e===null?null:e.kind===`folder`?e.path:`${e.kind}:${e.path}`,sU={all:e=>$N.of(e,`prints`,`gallery`),listings:e=>[...sU.all(e),`listing`],listing:(e,t)=>[...sU.listings(e),t],file:(e,t)=>[...sU.all(e),`file`,t],describedAll:e=>[...sU.all(e),`described`],described:(e,t)=>[...sU.describedAll(e),...t]};function cU(e,t){return t.modifiedAt-e.modifiedAt||(e.path<t.path?-1:+(e.path>t.path))}function lU(e){let t=new Map;for(let n of e)for(let e of n.entries)t.set(e.path,e);return[...t.values()].sort(cU)}var uU=/\.(avif|gif|jpe?g|png|svg|webp|mp4|mp3)$/i;function dU(e,t){let n=e?.context.get().computerId,r=t?.path??null,i={queue:r===null?[]:[r],offset:0,after:null};return Gw({queryKey:sU.listing(e,oU(t)),initialPageParam:i,enabled:!!(n&&r&&e.capabilities.has(TF)&&e.capabilities.has(LF)),queryFn:async({pageParam:r,signal:i})=>{if(!e||!n||!t)throw new X(`No Computer folder selected`,{code:`SELECTION_CHANGED`,retryable:!1});let a=()=>{if(i.throwIfAborted(),e.context.get().computerId!==n)throw new X(`Computer selection changed`,{code:`SELECTION_CHANGED`,retryable:!1})};if(t.kind===`favorites`){let n=[];a();let i=await rU(e,r.after,aU);return a(),{entries:i.paths.filter(e=>uU.test(e)).map(e=>({path:e,name:e.slice(e.lastIndexOf(`/`)+1),modifiedAt:0,size:0,...fU(t.path,e)})),folders:n,next:i.next===null?null:{queue:[],offset:0,after:i.next}}}let o=[],s=[],c=[...r.queue],l=r.offset;for(;o.length<aU&&c.length>0;){a();let n=c[0],r=await zF(e.capabilities,{path:n,limit:aU-o.length,offset:l});if(a(),r.nextOffset!==null&&r.nextOffset<=l)throw new X(`Directory pagination did not advance`,{code:`PROTOCOL`,retryable:!1});let i=r.path.replace(/\/$/,``);for(let e of r.entries)e.name.startsWith(`.`)||(e.type===`directory`?t.kind===`all`?c.push(`${i}/${e.name}`):s.push(e.name):e.type===`file`&&uU.test(e.name)&&o.push({...e,path:`${i}/${e.name}`,...fU(t.path,`${i}/${e.name}`)}));r.nextOffset===null?(c=c.slice(1),l=0):l=r.nextOffset}return{entries:o,folders:s,next:c.length===0?null:{queue:c,offset:l,after:null}}},getNextPageParam:e=>e.next})}function fU(e,t){let n=WH(e,t);return n===void 0?{}:{folder:n}}function pU(e,t,n){return{...nP(e,LF,[...sU.file(e,t.path),t.modifiedAt,t.size],async(n,r)=>{if(!e)throw new X(`Prints disconnected`,{code:`DISCONNECTED`,retryable:!0});let i=await RF(e.capabilities,{path:t.path},{signal:r});return new File([i],i.name,{type:i.type,lastModified:t.modifiedAt})}),enabled:!!(n&&e?.context.get().computerId&&e.capabilities.has(LF)),structuralSharing:!1}}function mU(e,t){let n=e?.app??null,r=ON(n),i=vC(),[a,o]=(0,G.useState)(()=>new Set),s=(0,G.useCallback)(e=>{if(!r)return;let t=`${r}:${e}`;o(e=>e.has(t)?e:new Set([...e,t]))},[r]),c=(0,G.useCallback)(e=>{s(e),i.resetQueries({queryKey:sU.file(n,e)})},[n,i,s]),l=dU(n,t),u=Xw(l),d=u.fetchNextPage;(0,G.useEffect)(()=>{l.enabled&&u.hasNextPage&&!u.isFetching&&!u.error&&d({cancelRefetch:!1})},[l.enabled,u.hasNextPage,u.isFetching,u.error,d]);let f=!u.hasNextPage||u.error!==null,p=(0,G.useMemo)(()=>l.enabled&&u.data&&f?lU(u.data.pages):[],[u.data,l.enabled,f]),m=`${r??``}|${oU(t)??``}`,[h,g]=(0,G.useState)({key:m,count:iU}),_=h.key===m?h.count:iU,v=(0,G.useMemo)(()=>p.slice(0,_),[p,_]),y=p.length>_,b=(0,G.useCallback)(e=>({files:e.flatMap((e,t)=>e.data?[{path:v[t].path,file:e.data}]:[]),failures:e.flatMap((e,t)=>e.isError?[v[t].name]:[]),loading:e.some(e=>e.isLoading)}),[v]),x=Vw({queries:v.map(e=>pU(n,e,!!(r&&a.has(`${r}:${e.path}`)))),combine:b});return(0,G.useEffect)(()=>{if(!n)return;let e=sU.all(n),t=sU.listings(n),a=!0;i.invalidateQueries({queryKey:e});let o=()=>{i.cancelQueries({queryKey:e})},s=n.context.subscribe(e=>{e.computerId!==r&&o()}),c=n.lifecycle.subscribe(e=>{(e===`disconnected`||e===`disposing`||e===`disposed`)&&o()}),l=n.capabilities.subscribe(()=>{queueMicrotask(()=>{!a||n.context.get().computerId!==r||i.resetQueries({queryKey:t})})});return()=>{a=!1,s(),c(),l(),o()}},[n,r,e,i]),{entries:v,folders:(0,G.useMemo)(()=>[...new Set(u.data?.pages.flatMap(e=>e.folders)??[])],[u.data]),loadFile:s,retryFile:c,files:x.files,failures:x.failures,error:u.error,loading:u.isFetching||!f||x.loading,hasNextPage:y,nextPageReady:y,refresh:()=>{u.refetch({cancelRefetch:!1})},loadMore:()=>{y&&g({key:m,count:_+iU})}}}function hU(e){return e.replace(/\s/gu,` `).replace(/ +/g,` `).trim()}function gU(e,t,n){let r=e.replace(/\/$/,``),i=t.lastIndexOf(`.`),a=i>0?t.slice(0,i):t,o=i>0?t.slice(i):``,s=`${r}/${t}`;for(let e=2;n(s);e+=1)s=`${r}/${a} ${String(e)}${o}`;return s}async function _U(e,t){let n=e.replace(/\/$/,``),r=new Set,i=0;for(;i!==null;){let e=await t(i);if(e.nextOffset!==null&&e.nextOffset<=i)throw Error(`Directory pagination did not advance`);for(let t of e.entries)r.add(`${n}/${t.name}`);i=e.nextOffset}return r}J({computerId:LS});var vU=eS.pipe(Y(FS(4096)),Y(hS(e=>e.startsWith(`/`)&&e!==`/`&&!e.includes(`\0`)&&!e.endsWith(`/`)&&!e.split(`/`).some(e=>e===`.`||e===`..`))));J({path:lS(vU)});var yU=function(e,t,n){if(t!=null){if(typeof t!=`object`&&typeof t!=`function`)throw TypeError(`Object expected.`);var r,i;if(n){if(!Symbol.asyncDispose)throw TypeError(`Symbol.asyncDispose is not defined.`);r=t[Symbol.asyncDispose]}if(r===void 0){if(!Symbol.dispose)throw TypeError(`Symbol.dispose is not defined.`);r=t[Symbol.dispose],n&&(i=r)}if(typeof r!=`function`)throw TypeError(`Object not disposable.`);i&&(r=function(){try{i.call(this)}catch(e){return Promise.reject(e)}}),e.stack.push({value:t,dispose:r,async:n})}else n&&e.stack.push({async:!0});return t},bU=(function(e){return function(t){function n(n){t.error=t.hasError?new e(n,t.error,`An error was suppressed during disposal.`):n,t.hasError=!0}var r,i=0;function a(){for(;r=t.stack.pop();)try{if(!r.async&&i===1)return i=0,t.stack.push(r),Promise.resolve().then(a);if(r.dispose){var e=r.dispose.call(r.value);if(r.async)return i|=2,Promise.resolve(e).then(a,function(e){return n(e),a()})}else i|=1}catch(e){n(e)}if(i===1)return t.hasError?Promise.reject(t.error):Promise.resolve();if(t.hasError)throw t.error}return a()}})(typeof SuppressedError==`function`?SuppressedError:function(e,t,n){var r=Error(n);return r.name=`SuppressedError`,r.error=e,r.suppressed=t,r}),xU=class extends X{stage;provider;constructor(e){super(e.message,{code:e.code,retryable:e.retryable,...e.need!==void 0&&{need:e.need}}),this.stage=e.stage??null,this.provider=e.provider}},SU=e=>eS.pipe(Y(MS(1)),Y(FS(e))),CU=J({requestId:SU(256),computerId:SU(256)}),wU=tS.pipe(Y(AS()),Y(hS(Number.isSafeInteger,{message:`Expected a safe integer`}))),TU=wU.pipe(Y(ES(0))),EU=wU.pipe(Y(DS(0))),DU=tS.pipe(Y(bS()),Y(DS(0))),OU=tS.pipe(Y(bS()),Y(ES(0))),kU=cS([`first-frame`,`last-frame`,`reference`]),AU=cS([`480p`,`720p`,`768p`,`1080p`,`4k`]),jU=cS([`16:9`,`4:3`,`1:1`,`3:4`,`9:16`,`21:9`,`9:21`]),MU=J({computerId:q(SU(256)),path:SU(4096),role:q(kU)}),NU=J({path:SU(4096),role:kU}),PU=J({computerId:SU(256),path:SU(4096)}),FU=J({defaultHeight:TU,defaultSteps:lS(EU),defaultWidth:TU,dimensions:cS([`none`,`own`]),guidance:lS(J({default:DU,max:OU,min:DU})).pipe(Yx),maxDimension:lS(TU),maxDimensionDocumented:nS,maxReferences:EU,maxSteps:lS(TU),referenceDimension:lS(TU),referenceField:lS(SU(256)),referenceFormat:cS([`png`,`webp`]),steps:cS([`steps`,`num_steps`,`fixed`]),transport:cS([`json`,`multipart`])}),IU=J({minSeconds:TU,maxSeconds:TU,defaultSeconds:TU,durations:aS(TU),provider:cS([`seedance`,`veo`,`minimax`]),formats:aS(J({resolution:AU,aspectRatio:jU,width:TU,height:TU})),defaultResolution:AU,defaultAspectRatio:jU,supportsAudio:nS,defaultGenerateAudio:lS(nS),referenceRoles:aS(kU),maxReferenceImages:EU,audioReferences:lS(J({max:TU,totalSeconds:TU})),referenceResolutions:aS(AU),prices:aS(J({resolution:AU,silentMilliunitsPerSecond:TU,audioMilliunitsPerSecond:TU}))}),LU=J({provider:Xx(`elevenlabs`),mode:cS([`speech`,`music`]),voices:aS(J({id:SU(64),label:SU(128)})),defaultVoiceId:lS(SU(64)),seconds:lS(J({min:TU,max:TU,default:TU})),milliunitsPerUnit:TU}),RU=J({operation:cS([`remove_background`,`upscale`]),source:J({formats:aS(cS([`png`,`jpeg`,`webp`])),maxBytes:TU,maxPixels:TU}),defaultMegapixels:lS(TU),milliunits:lS(TU),sizes:aS(J({megapixels:TU,milliunits:TU}))}),zU=aS(J({id:SU(256),input:FU,kind:cS([`image`,`video`,`audio`]),label:SU(512),maxPromptLength:TU,tier:cS([`draft`,`balanced`,`premium`,`max`]),outputFormats:aS(cS([`png`,`jpeg`,`webp`])).pipe(Y(FS(3))),sizes:lS(aS(eS.pipe(Y(vS(/^\d+x\d+$/u))))),video:lS(IU),audio:lS(LU),transform:lS(RU),billingUnit:cS([`image`,`video_second`,`audio_second`,`audio_character_block`])})),BU=J({[Symbol.dispose]:q(Zx),computerId:SU(256),models:zU,canGenerate:nS}),VU=J({model:SU(256),prompt:SU(32e3),width:q(TU.pipe(Y(OS(5040)))),height:q(TU.pipe(Y(OS(5040)))),voiceId:q(SU(64)),steps:q(TU),durationSeconds:q(TU),targetMegapixels:q(TU),resolution:q(AU),aspectRatio:q(jU),generateAudio:q(nS),references:q(aS(MU).pipe(Y(FS(16))))});J({model:SU(256),prompt:SU(2048),resolution:q(AU),aspectRatio:q(jU),durationSeconds:q(TU.pipe(Y(DS(4)),Y(OS(15)))),generateAudio:q(nS),references:q(aS(NU).pipe(Y(FS(4))))});var HU=[`admission`,`generation-authorization`,`settings`,`estimate`,`billing`,`operation`,`provider`,`normalization`,`artifact`,`destination-authorization`,`destination-write`],UU=J({destination:J({path:SU(4096)}),settings:Zx}),WU=J({[Symbol.dispose]:q(Zx),bytes:TU,costMilliunits:EU,destination:PU,format:cS([`png`,`jpeg`,`gif`,`webp`,`mp4`,`mp3`]),height:q(TU),model:SU(256),width:q(TU)});J({...WU.fields,format:Xx(`mp4`)});var GU=J({message:SU(512),stage:q(cS(HU)),provider:q($S),code:cS([`CANCELLED`,`CAPABILITY_DENIED`,`CAPABILITY_REVOKED`,`DAILY_LIMIT_REACHED`,`DISCONNECTED`,`HOST_FAILURE`,`IDENTITY`,`INSUFFICIENT_CREDIT`,`INVALID_ARGUMENT`,`MEDIA_PROVIDER_FAILURE`,`MEDIA_PROVIDER_FAILURE_UNCHARGED`,`PROTOCOL`,`SAFETY_FILTER_REFUSED`,`SETUP_REQUIRED`,`TIMEOUT`]),retryable:nS,need:q(GS)}),KU=sS([J({[Symbol.dispose]:q(Zx),kind:Xx(`succeeded`),result:WU}),J({[Symbol.dispose]:q(Zx),kind:Xx(`failed`),failure:GU})]),qU=FN({reference:LN(IN(Ka().transform(e=>qx(CU)(e)))),generate:LN(IN(Ka().transform(e=>{let t=qx(KU,{onExcessProperty:`error`})(e);return t.kind===`succeeded`?{kind:t.kind,result:{bytes:t.result.bytes,costMilliunits:t.result.costMilliunits,destination:t.result.destination,format:t.result.format,...t.result.height!==void 0&&{height:t.result.height},model:t.result.model,...t.result.width!==void 0&&{width:t.result.width}}}:{kind:t.kind,failure:t.failure}})))}),JU=PN(`media.generation`,5,Ro(()=>FN({describe:LN(IN(Ka().transform(e=>{let{computerId:t,canGenerate:n,models:r}=qx(BU,{onExcessProperty:`error`})(e);return{computerId:t,canGenerate:n,models:r}}))),quote:LN(IN(W({costMilliunits:Ra().int().nonnegative().max(2**53-1)}))).optional(),createAttempt:LN(qU),restoreAttempt:LN(qU),cancelAttempt:RN}))),YU=ro([W({shared:go(!1)}),W({shared:go(!0),url:xa(),showPrompt:Ha()})]);W({requestId:U().min(1).max(256),showPrompt:Ha()});var XU=PN(`media.share`,1,Ro(()=>FN({status:LN(IN(YU)),share:LN(IN(YU)),stop:LN(IN(YU))})));function ZU(e,t){try{return qx(e,{onExcessProperty:`error`})(t)}catch(e){throw new X(`The Media capability returned malformed data`,{cause:e,code:`PROTOCOL`,retryable:!1})}}function QU(e){return e instanceof X?e:new X(`The Media capability failed`,{cause:e,code:`HOST_FAILURE`,retryable:!0})}function $U(e){if(e?.aborted)throw new X(`Media generation was cancelled`,{code:`CANCELLED`,retryable:!1})}function eW(e){let t;try{t=qx(UU,{onExcessProperty:`error`})(e)}catch(e){throw new X(`Media generation input is invalid`,{cause:e,code:`INVALID_ARGUMENT`,retryable:!1})}let n;try{n=nW(qx(VU,{onExcessProperty:`error`})(t.settings))}catch(e){throw new X(`Media generation settings are invalid`,{cause:e,code:`INVALID_ARGUMENT`,retryable:!1})}let r={path:t.destination.path.trim()};if(r.path.length===0)throw new X(`Media generation destination is invalid`,{code:`INVALID_ARGUMENT`,retryable:!1});return Object.freeze({destination:Object.freeze(r),settings:n})}function tW(e){try{return nW(qx(VU,{onExcessProperty:`error`})(e))}catch(e){throw new X(`Media generation settings are invalid`,{cause:e,code:`INVALID_ARGUMENT`,retryable:!1})}}function nW(e){let t=(e,t)=>{let n=e.trim();if(n.length===0)throw Error(`${t} must not be blank`);return n},n={model:t(e.model,`model`),prompt:t(e.prompt,`prompt`)};return e.width!==void 0&&(n.width=e.width),e.height!==void 0&&(n.height=e.height),e.voiceId!==void 0&&(n.voiceId=t(e.voiceId,`voiceId`)),e.steps!==void 0&&(n.steps=e.steps),e.durationSeconds!==void 0&&(n.durationSeconds=e.durationSeconds),e.targetMegapixels!==void 0&&(n.targetMegapixels=e.targetMegapixels),e.resolution!==void 0&&(n.resolution=e.resolution),e.aspectRatio!==void 0&&(n.aspectRatio=e.aspectRatio),e.generateAudio!==void 0&&(n.generateAudio=e.generateAudio),e.references!==void 0&&(n.references=Object.freeze(e.references.map(e=>Object.freeze({...e,path:t(e.path,`reference`)})))),Object.freeze(n)}function rW(e){let t=ZU(zU,e),n=new Set;for(let e of t){if(n.has(e.id))throw new X(`The Media capability repeated a model`,{code:`PROTOCOL`,retryable:!1});n.add(e.id)}return Object.freeze(t.map(e=>Object.freeze(e)))}function iW(e,t,n,r){let i=ZU(WU,e);if(i.model!==t.settings.model||i.destination.computerId!==n||i.destination.path!==t.destination.path||i.width!==t.settings.width||i.height!==t.settings.height||!r&&t.settings.width===void 0!=(i.format===`mp3`))throw new X(`The Media capability returned an unrelated result`,{code:`PROTOCOL`,retryable:!1});return Object.freeze({bytes:i.bytes,costMilliunits:i.costMilliunits,destination:Object.freeze({...i.destination}),format:i.format,...i.height!==void 0&&{height:i.height},model:i.model,...i.width!==void 0&&{width:i.width}})}async function aW(e){try{let t=e.require(JU);{let e={stack:[],error:void 0,hasError:!1};try{let n=ZU(BU,yU(e,SM(await t.describe()),!1).value),r=n.computerId.trim();if(r.length===0)throw new X(`The Media capability returned no Computer`,{code:`PROTOCOL`,retryable:!1});let i=rW(n.models),a=t.quote?.bind(t),o=async e=>{let n=SM(e),a;try{{let t={stack:[],error:void 0,hasError:!1};try{let n=yU(t,SM(await e.reference()),!1),i=ZU(J({...CU.fields,[Symbol.dispose]:q(Zx)}),n.value);if(a={requestId:i.requestId,computerId:i.computerId},a.computerId!==r)throw new X(`Media attempt belongs to another Computer`,{code:`IDENTITY`,retryable:!1})}catch(e){t.error=e,t.hasError=!0}finally{bU(t)}}}catch(e){throw n[Symbol.dispose](),QU(e)}let o=!1;return{reference:Object.freeze(a),async generate(n,s={}){if(o)throw new X(`Media generation attempt is closed`,{code:`CAPABILITY_DENIED`,retryable:!1});$U(s.signal);let c=eW(n),l=s.signal,u,d,f=()=>(d??=t.cancelAttempt(a),d);try{let t=e.generate(c),n=l===void 0?await t:await Promise.race([t,new Promise((e,t)=>{u=()=>{f().then(()=>{t(new X(`Media generation was cancelled`,{code:`CANCELLED`,retryable:!1}))},t)},l.addEventListener(`abort`,u,{once:!0}),l.aborted&&u()})]);l?.aborted&&(await f(),$U(l)),$U(l);{let e={stack:[],error:void 0,hasError:!1};try{let t=ZU(KU,yU(e,SM(n),!1).value);if(t.kind===`failed`)throw new xU(t.failure);return iW(t.result,c,r,i.find(e=>e.id===c.settings.model)?.transform!=null)}catch(t){e.error=t,e.hasError=!0}finally{bU(e)}}}catch(e){throw l?.aborted&&(await f(),$U(l)),QU(e)}finally{u!==void 0&&l?.removeEventListener(`abort`,u)}},[Symbol.dispose](){o||(o=!0,n[Symbol.dispose]())}}};return Object.freeze({computerId:r,canGenerate:n.canGenerate,models:i,async quote(e){let t={stack:[],error:void 0,hasError:!1};try{let n=tW(e);if(a===void 0)return null;let r=yU(t,SM(await a(n)),!1);return Object.freeze({costMilliunits:r.value.costMilliunits})}catch(e){t.error=e,t.hasError=!0}finally{bU(t)}},async createAttempt(){return o(await t.createAttempt())},async restoreAttempt(e){let n=ZU(CU,e);if(n.computerId!==r)throw new X(`Select the original Computer to retry this generation`,{code:`IDENTITY`,retryable:!1});let i=await o(await t.restoreAttempt(n));if(i.reference.requestId!==n.requestId)throw i[Symbol.dispose](),new X(`Media restore changed the request identity`,{code:`PROTOCOL`,retryable:!1});return i}})}catch(t){e.error=t,e.hasError=!0}finally{bU(e)}}}catch(e){throw QU(e)}}function oW(e,t,n={}){console.error(`Prints operation failed`,JSON.stringify({operation:e,...n.requestId!==void 0&&{requestId:n.requestId},errorKind:t instanceof Error?`error`:`non-error`,errorName:t instanceof Error?t.name:null,stage:t instanceof xU?t.stage:null,provider:t instanceof xU?t.provider:void 0}),cg(t))}function sW(e,t){let[n,r]=(0,G.useState)([]),i=(0,G.useRef)(new Map),a=(0,G.useRef)(Promise.resolve()),[o,s]=(0,G.useState)(null),c=(0,G.useRef)(new Map),l=(0,G.useRef)(e);l.current=e;let u=(0,G.useRef)(t);u.current=t;let d=(e,t,n)=>{let a=i.current.get(e);a&&i.current.set(e,{...a,status:t,message:n}),r([...i.current.values()])},f=(0,G.useCallback)(async(e,t)=>{let n=()=>t.signal.aborted;if(n()){d(e.id,`cancelled`,`Cancelled before sending`),c.current.delete(e.id);return}let r=e.dimensions;if(!r)try{let t=await RH(e.file,e.previewUrl);r={width:t.width,height:t.height},e.dimensions=r;let n=i.current.get(e.id);n&&i.current.set(e.id,{...n,dimensions:r})}catch(t){oW(`decode-upload-image`,t),d(e.id,`error`,`Could not decode this image. No upload was sent.`),c.current.delete(e.id);return}try{if(n()){d(e.id,`cancelled`,`Cancelled before sending`);return}if(e.app.context.get().computerId!==e.computerId){d(e.id,`error`,`Computer changed. Select the original Computer and retry. No upload was sent.`);return}u.current({id:e.id,path:e.path,computerId:e.computerId,app:e.app,width:r.width,height:r.height}),d(e.id,`sending`,`Sending; awaiting Computer completion`),await UF(e.app.capabilities,{path:e.path,content:e.file.slice()},{signal:t.signal}),d(e.id,`complete`,`Written to Computer`);try{await l.current(e.path,e.app,e.computerId)}catch(t){oW(`refresh-upload-preview`,t),d(e.id,`complete`,`Written; fresh preview unavailable`)}}catch(t){n()||oW(`write-computer-upload`,t),d(e.id,n()?`cancelled`:`error`,n()?`Cancelled request; check Computer before retrying`:`Completion not confirmed; check Computer or retry`)}finally{c.current.delete(e.id)}},[]),p=e=>{let t=new AbortController;c.current.set(e.id,t),d(e.id,`queued`,`Queued`),a.current=a.current.then(()=>f(e,t))},m=(0,G.useCallback)(()=>{for(let e of c.current.values())e.abort()},[]);return(0,G.useEffect)(()=>()=>{m();for(let e of i.current.values())URL.revokeObjectURL(e.previewUrl)},[m]),{items:n,error:o,cancelAll:m,add(e,t,n,r=new Set){s(null);let a=[...i.current.values()].reduce((e,t)=>e+t.file.size,0);for(let o of e){if(!o.type.startsWith(`image/`)){s(`Only image files can be uploaded here`);continue}if(i.current.size>=8||a+o.size>67108864){s(`Upload queue limit: eight files and 64 MiB. Remove finished rows before adding more.`);break}let e=n.context.get().computerId;if(!e){s(`Select a Computer before uploading images.`);continue}let c=gU(t,hU(o.name),e=>r.has(e)||i.current.has(e)),l={computerId:e,id:c,file:o,previewUrl:URL.createObjectURL(o),app:n,path:c,status:`queued`,message:`Queued`};i.current.set(l.id,l),a+=o.size,p(l)}},cancel(e){c.current.get(e)?.abort()},retry(e){let t=n.find(t=>t.id===e);t&&!c.current.has(e)&&p(t)},remove(e){if(!c.current.has(e)){let t=i.current.get(e);t&&URL.revokeObjectURL(t.previewUrl),i.current.delete(e),r([...i.current.values()])}}}}function cW(e){return e.source.kind===`computer`?`${e.source.computerId}:${e.source.path}`:e.file.name}function lW(e){return e.connection.app.ui.openNavigation({computerId:e.computerId,path:e.path})}function uW(e){let[t,n]=(0,G.useState)(!1);return(0,G.useEffect)(()=>{if(n(!1),!e?.capabilities.has(rF))return;let t=!0;return e.capabilities.require(rF).role(oF).then(e=>{t&&n(e!==null)},e=>{oW(`files-editor-role`,e)}),()=>{t=!1}},[e]),t}function dW(e,t){let n=t.landingPath,r=ON(e?.app),i=(0,G.useRef)(new Set),a=(0,G.useRef)(0),o=(0,G.useRef)(e);o.current=e;let s=e?.app.capabilities.has(TF)===!0,c=e?.app.capabilities.has(LF)===!0,l=e?.app.capabilities.has(BF)===!0,u=mU(e,t.source),[d,f]=(0,G.useState)([]),[p,m]=(0,G.useState)([]),[h,g]=(0,G.useState)([]),[_,v]=(0,G.useState)([]);(0,G.useEffect)(()=>{v([])},[e]);let y=e=>{v(t=>t.some(t=>t.key===e.key)?t.map(t=>t.key===e.key?e:t):[...t,e])},[b,x]=(0,G.useState)(!1),S=(0,G.useMemo)(()=>[...u.error?[`Could not refresh the Media gallery`]:[],...u.failures],[u.error,u.failures]),C=(0,G.useRef)(new WeakMap),w=(0,G.useMemo)(()=>{if(!c||!s)return d.filter(e=>e.kind===`local`);let t=r?u.files.map(({file:t,path:n})=>({kind:`computer`,computerId:r,connection:e,file:t,path:n})):[],i=d.filter(t=>t.kind===`local`||t.computerId===r&&t.connection===e&&t.path.slice(0,t.path.lastIndexOf(`/`))===n?.replace(/\/$/,``));return[...t.filter(e=>!i.some(t=>t.kind===`computer`&&e.kind===`computer`&&t.path===e.path)),...i]},[e,r,n,u.files,d,c,s]),T=(0,G.useCallback)(()=>{a.current+=1;for(let e of i.current)e.abort();i.current.clear()},[]);(0,G.useEffect)(()=>{if(!e)return()=>{T()};let t=e.app.lifecycle.subscribe(e=>{(e===`disconnected`||e===`disposing`||e===`disposed`)&&T()});return()=>{t(),T()}},[e,T]),(0,G.useEffect)(()=>{if(e)return e.app.context.subscribe(e=>{e.computerId!==r&&T()})},[e,r,T]),(0,G.useEffect)(()=>{v([]),f(e=>e.filter(e=>e.kind===`local`))},[r]);let E=(0,G.useCallback)(async(e,t,n)=>{let r=n??t.app.context.get().computerId;if(!r){g([`The selected Computer is unavailable`]);return}if(o.current!==t){g([`Computer selection changed`]);return}if(t.app.context.get().computerId!==r){g([`Computer selection changed before the preview was loaded`]);return}let s=a.current,c=new AbortController;i.current.add(c);try{let n=await RF(t.app.capabilities,{path:e},{signal:c.signal});if(c.signal.aborted||s!==a.current)return;v(t=>t.map(t=>t.key===`${r}:${e}`?{...t,previewFile:n}:t)),f(i=>[...i.filter(t=>t.kind!==`computer`||t.path!==e||t.computerId!==r),{kind:`computer`,computerId:r,file:n,path:e,connection:t}])}catch(t){c.signal.aborted||(oW(`read-computer-file`,t),g([`Could not read ${e}`]),v(t=>t.map(t=>t.key===`${r}:${e}`?{...t,error:`Saved; preview unavailable. Retry loading it.`}:t)))}finally{i.current.delete(c)}},[]),D=(0,G.useCallback)(t=>{let n=d.find(n=>n.kind===`computer`&&n.connection===e&&n.computerId===r&&n.path===t);n?.kind===`computer`?E(t,n.connection,n.computerId):u.retryFile(t)},[d,e,r,E,u.retryFile]),O=(0,G.useRef)(new Set),k=(0,G.useRef)(new Set),A=(0,G.useRef)(new Map),j=(0,G.useRef)(new Map),M=(0,G.useCallback)(e=>{URL.revokeObjectURL(e),O.current.delete(e);let t=j.current.get(e);t&&A.current.delete(t),j.current.delete(e)},[]);(0,G.useEffect)(()=>{let e=!0,t=new Set,n=new Map,r=new Set,i=[...w].sort((e,t)=>cU({modifiedAt:e.file.lastModified,path:e.kind===`computer`?e.path:e.file.name},{modifiedAt:t.file.lastModified,path:t.kind===`computer`?t.path:t.file.name})).map(e=>{let t=A.current.get(e.file)??URL.createObjectURL(e.file);return A.current.set(e.file,t),j.current.set(t,e.file),O.current.add(t),{source:e,file:e.file,url:t}}),a=i.length;return g(S),x(a>0),a===0&&m([]),i.forEach(({file:o,url:s,source:c},l)=>{let u=C.current.get(o);u||(u=(async()=>{let e=URL.createObjectURL(o);try{let{width:t,height:n}=await RH(o,e);return{width:t,height:n}}finally{URL.revokeObjectURL(e)}})(),C.current.set(o,u)),u.then(r=>{e&&(n.set(l,{...r,file:o,url:s,source:c}),t.add(s),m(i.flatMap((e,t)=>{let r=n.get(t);return r?[r]:[]})),v(e=>e.map(e=>e.previewFile===o?{...e,resolved:!0,previewFile:void 0,error:void 0}:e)))}).catch(t=>{e&&(oW(`decode-gallery-image`,t),M(s),r.add(o.name),g([...S,...r]),c.kind===`computer`&&v(e=>e.map(e=>e.key===`${c.computerId}:${c.path}`?{...e,error:`Could not decode the saved image.`}:e)))}).finally(()=>{--a,e&&a===0&&(x(!1),m(i.flatMap((e,t)=>{let r=n.get(t);return r?[r]:[]})))})}),()=>{e=!1;for(let{url:e}of i)!t.has(e)&&!k.current.has(e)&&M(e)}},[w,S,M]),(0,G.useEffect)(()=>{let e=new Set(p.map(e=>e.url));for(let t of k.current)e.has(t)||M(t);k.current=e},[p,M]),(0,G.useEffect)(()=>{let e=O.current;return()=>{for(let t of e)URL.revokeObjectURL(t);e.clear()}},[]);let N=sW(async(e,t,n)=>{let r=o.current,i=r?.app===t&&t.context.get().computerId===n?r:null;i&&await E(e,i,n)},e=>{o.current?.app===e.app&&e.app.context.get().computerId===e.computerId&&y({key:`${e.computerId}:${e.path}`,path:e.path,computerId:e.computerId,width:e.width,height:e.height,uploadId:e.id})});return(0,G.useEffect)(()=>{let t=N.cancelAll,n=e?.app.lifecycle.subscribe(e=>{(e===`disposing`||e===`disconnected`||e===`disposed`)&&t()});return()=>{n?.(),t()}},[e,N.cancelAll]),{images:p,failed:h,loading:b,gallery:u,gallerySlots:_,canBrowse:s,canRead:c,canWrite:l,reserveSlot:y,addComputerFile:E,retryFile:D,uploads:N,uploadFiles:async i=>{if(!e||!l||n===null)return;let a=e,s=r,c=await t.ensureCreated();if(c){g([c]);return}if(o.current!==a||a.app.context.get().computerId!==s)return;let u;try{u=await _U(n,e=>zF(a.app.capabilities,{path:n,limit:500,offset:e}))}catch(e){oW(`list-upload-destination`,e),g([`Could not check the Computer folder. No upload was sent.`]);return}o.current===a&&a.app.context.get().computerId===s&&N.add(i,n,a.app,u)},failSlot:(e,t)=>{v(n=>n.map(n=>n.key===e?{...n,error:t}:n))},clearSlotError:e=>{v(t=>t.map(t=>t.key===e?{...t,error:void 0}:t))},removeSlot:e=>{v(t=>t.filter(t=>t.key!==e))}}}var fW=aP+18e4,pW=`4 generations are running. Wait for one to finish.`,mW=J({error:Xx(`generation_limit`),limit:jS,message:eS}),hW=class extends X{constructor(e){super(e,{code:`CONFLICT`,retryable:!0})}};function gW(e,t){return e.computerId===void 0||e.computerId===t}var _W=`@cf/black-forest-labs/flux-2-klein-4b`,vW=`Image creation is unavailable for this Computer right now.`,yW=`Didn’t finish`,bW={landscape:{height:768,width:1024},portrait:{height:1024,width:768},square:{height:1024,width:1024}},xW=[`landscape`,`portrait`,`square`];function SW(e){return e instanceof xU&&e.stage===`provider`&&e.provider!==void 0&&`reason`in e.provider&&e.provider.reason===`credits_exhausted`}function CW(e){return e.requestId===void 0?``:` Ref ${e.requestId.slice(-8)}.`}var wW={invalid_request:`the media service rejected the request (invalid_request)`,unauthorized:`the media service refused Fungi’s credentials (unauthorized)`,unavailable:`the media service is unavailable (unavailable)`,rate_limited:`the media service is busy (rate_limited)`,too_large:`the request was too large for the media service (too_large)`,unreachable:`Fungi couldn’t reach the media service (unreachable)`,invalid_response:`the media service sent an answer Fungi couldn’t read (invalid_response)`};function TW(e){if(e===void 0)return{cause:`the media service didn’t report why (internal error)`,next:`Retry, or pick another model.`,retryable:!1,unexplained:!0};if(e.category===`media_service`)return{cause:wW[e.failure],next:e.failure===`rate_limited`?`Retry in a minute.`:`Retry, or pick another model.`,retryable:e.failure===`rate_limited`,unexplained:!0};if(e.category===`result_download`)return{cause:`the finished file couldn’t be downloaded (HTTP ${String(e.status)})`,next:`Retry, or pick another model.`,retryable:!1};switch(e.reason){case`content_refused`:return{title:`Generation refused`,cause:`the provider refused the prompt (content policy)`,next:`Reword the prompt, then retry.`,retryable:!1};case`invalid_input`:return{cause:e.detail===void 0?`the provider rejected the input`:`the provider rejected the input (${e.detail})`,next:`Check the prompt and the reference image’s size and format.`,retryable:!1};case`rate_limited`:return{cause:`the provider is overloaded`,next:`Retry in a minute.`,retryable:!0};case`provider_unavailable`:return{cause:`the provider is down right now`,next:`Retry in a minute.`,retryable:!0};case`timeout`:return{title:`Still waiting`,cause:`the provider timed out`,next:`Retry to ask again.`,retryable:!0};case`spending_limit`:return{cause:`the provider’s daily allowance is used up`,next:`Try another model, or retry tomorrow.`,retryable:!1};case`credits_exhausted`:return{cause:`Cloudflare AI Gateway credits are used up`,next:`Choose a Workers AI model such as Flux.`,retryable:!1};case void 0:}return e.detail===void 0?e.category===`TimeoutError`||e.category===`AbortError`?{title:`Still waiting`,cause:`the provider timed out`,next:`Retry to ask again.`,retryable:!0}:{cause:e.code===null?`the provider failed without a reason (${e.category})`:`the provider failed with error ${String(e.code)} and gave no reason`,next:`Retry, or pick another model.`,retryable:!1,unexplained:!0}:{cause:`the provider said “${e.detail}”`,next:`Retry, or pick another model.`,retryable:!1}}function EW(e){if(!(e instanceof xU)||e.stage!==`provider`)return!1;if(e.code===`MEDIA_PROVIDER_FAILURE`||e.code===`MEDIA_PROVIDER_FAILURE_UNCHARGED`||e.code===`SAFETY_FILTER_REFUSED`)return!0;let t=e.provider;return t!==void 0&&(t.category===`result_download`||t.category===`media_service`||t.reason!==void 0||t.detail!==void 0)}function DW(e,t){let n=TW(e.code===`SAFETY_FILTER_REFUSED`?{category:`Error`,code:null,reason:`content_refused`}:e.provider),r=e.code===`MEDIA_PROVIDER_FAILURE_UNCHARGED`?` You weren’t charged.`:``;return{title:n.title??`Generation failed`,message:`${t.model??`The model`} stopped: ${n.cause}.${r} ${n.next}${n.unexplained===!0?CW(t):``}`,retryable:n.retryable}}var OW=Gx(J({code:cS(eC)}));function kW(e,t={}){if(e instanceof hW)return{title:`Too many generations`,message:e.message,retryable:!0};if(SW(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};if(EW(e))return DW(e,t);if(e instanceof xU&&e.stage!==`provider`)return{...lC(e),message:e.message};let n=t.model??`The model`;if(Ed(OW(e)))return{title:`Generation failed`,message:`${n} stopped: Prints hit an unexpected error (${e instanceof Error?e.name:`no error details`}). Retry, or pick another model.${CW(t)}`,retryable:!0};let r=`${n} stopped: the cause wasn’t reported (internal error).`;return lC(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:`${r} Retry, or pick another model.${CW(t)}`},MEDIA_PROVIDER_FAILURE_UNCHARGED:{title:`Generation failed`,message:`${r} You weren’t charged. Retry, or pick another model.${CW(t)}`},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:`Prints couldn’t reach the media service, and it didn’t say why. Try again.${CW(t)}`}})}function AW(e,t={}){let n=OW(e);return{reason:n._tag===`Some`?n.value.code:SW(e)?`INSUFFICIENT_CREDIT`:`UNKNOWN`,message:kW(e,t).message}}function jW(){return{destination:void 0,height:768,model:_W,prompt:``,references:[],steps:void 0,width:1024}}function MW(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 NW(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 MW(OM({count:4}),t,a)}function PW(e){return e?.kind===`audio`?e.audio?.mode===`music`?`Generate music`:`Generate speech`:e?.kind===`video`?`Generate video`:`Generate image`}function FW(e){return e.filter(e=>e.kind!==`audio`&&e.transform===null)}function IW(e){return e.filter(e=>e.kind===`audio`)}function LW(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 RW(e,t){return e?.kind===`audio`?PH:{width:t.width,height:t.height}}function zW(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 BW=(e,t)=>t===0?e:BW(t,e%t),VW=(e,t,n)=>n===void 0?`${String(e)} × ${String(t)} · ${YW(e,t)}`:`${String(e)} × ${String(t)} · ${String(n[0])}:${String(n[1])}`,HW=[[1,1],[4,3],[3,4],[3,2],[2,3],[16,9],[9,16],[21,9]],UW=16,WW=256,GW=4e6,KW=1048576;function qW(e,t,n,r){let i=Math.floor((e.input.maxDimension??4096)/UW)*UW,a=e=>Math.round(e/UW)*UW,o=e=>Math.min(i,Math.max(WW,e)),s=BW(t,n),c=t/s*UW,l=n/s*UW,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(KW/(c*l))));d=c*e,f=l*e}else{let e=t/n;d=u?e>=1?i:a(i*e):a(Math.sqrt(KW*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 JW(e){if(e.kind!==`image`||e.input.dimensions!==`own`)return[];let t=new Set,n=new Set;for(let e of xW){let{width:r,height:i}=bW[e],a=BW(r,i);n.add(`${String(r/a)}:${String(i/a)}`),t.add(`${String(r)}x${String(i)}`)}let r=[];for(let[i,a]of HW){let o=n.has(`${String(i)}:${String(a)}`)?[]:[{size:qW(e,i,a,!1),group:`Standard`}];e.input.maxDimensionDocumented&&o.push({size:qW(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:VW(e,n,[i,a]),width:e,height:n,group:s}))}}return r}function YW(e,t){let n=e/t,r=HW.find(([e,t])=>Math.abs(n/(e/t)-1)<=.02);if(r!==void 0)return`${String(r[0])}:${String(r[1])}`;let i=BW(e,t),a=e/i,o=t/i;return a<=21&&o<=21?`${String(a)}:${String(o)}`:`${n.toFixed(2)}:1`}function XW(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=HW.find(([e,r])=>Math.abs(t/n/(e/r)-1)<=.02);return i===void 0?qW(e,t,n,!1):qW(e,i[0],i[1],!1)}function ZW(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=BW(t,n),a=t/i,o=n/i;return a<=21&&o<=21?`${String(a)}:${String(o)}`:`${String(t)} × ${String(n)}`}function QW(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:VW(n,r),width:n,height:r,group:n*r>=GW?`Largest`:`Standard`}]}):[...xW.map(e=>({value:e,label:VW(bW[e].width,bW[e].height),...bW[e],group:`Standard`})),...e===void 0?[]:JW(e)]}function $W(e,t,n){return n?.kind===`video`&&t.kind===`video`||t.input.dimensions!==`none`&&Ld(Kx(lG(()=>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 eG(e){return e.label.split(` — `)[0]??e.label}function tG(e,t){return e.find(e=>e.id===t)}function nG(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 rG={"first-frame":`First frame`,"last-frame":`Last frame`,reference:`Reference`};function iG(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 aG(e){return e?.video?.referenceRoles??[]}function oG(e,t,n=!1){let r=aG(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 sG(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 cG(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=oG(e.references,t)),t.video?.supportsAudio===!0&&e.generateAudio!==void 0&&(r.generateAudio=e.generateAudio),{destination:{path:e.destination?.trim()??``},settings:r}}function lG(e){return J({model:eS,width:tS,height:tS,durationSeconds:Yx(uS(tS)),steps:Yx(uS(tS))}).check(hS(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 uG(e,t){let n=e.trim().length;return n>t.maxPromptLength?{length:n,excess:n-t.maxPromptLength}:null}function dG(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=uG(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=Kx(lG(()=>t))(e);if(Id(r))return Jg()(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 sG(oG(e.references,t),t,n?.resolution)}}var fG={remove_background:`Remove background`,upscale:`Upscale`};function pG(e,t){return e.find(e=>e.transform?.operation===t)}function mG(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 hG(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 gG(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:`${fG.upscale} to ${String(t)} MP`,references:[i],targetMegapixels:t}}return{model:e.id,prompt:fG[r.operation],references:[i]}}var _G=e=>{let t=e.lastIndexOf(`/`);return t<=0?`/`:e.slice(0,t)};function vG(e,t,n){let r=gG(e,t,n),i={model:e.id,prompt:r.prompt,references:r.references??[],width:t.width,height:t.height},a=NW(i,_G(t.path),e);return{input:{destination:{path:a},settings:r},draft:{...i,destination:a}}}var yG={readNotices:`member.readNotices`,dismissNotices:`member.dismissNotices`,listStyles:`member.listStyles`,saveStyle:`member.saveStyle`,deleteStyle:`member.deleteStyle`,readPrintStyle:`member.readPrintStyle`,listCharacters:`member.listCharacters`,saveCharacter:`member.saveCharacter`,deleteCharacter:`member.deleteCharacter`,readFolder:`member.readFolder`,selectFolder:`member.selectFolder`,rememberGeneration:`member.rememberGeneration`,failGeneration:`member.failGeneration`,forgetGeneration:`member.forgetGeneration`,completeGeneration:`member.completeGeneration`,listGenerations:`member.listGenerations`};function bG(e,t,n){return e.require(iP).call(t,n)}var xG=LS,SG=aS(LS.pipe(Y(FS(1024)))).pipe(Y(FS(200)));J({computerId:xG}),J({computerId:xG,keys:SG});var CG=qx(J({keys:SG}));async function wG(e,t){return CG(await bG(e,yG.readNotices,JSON.stringify({computerId:t})))}async function TG(e,t,n){return CG(await bG(e,yG.dismissNotices,JSON.stringify({computerId:t,keys:n})))}J({computerId:xG,path:vU});var EG=qx(J({path:vU,configured:nS}));async function DG(e,t){return EG(await bG(e,yG.readFolder,JSON.stringify({computerId:t})))}async function OG(e,t,n){return EG(await bG(e,yG.selectFolder,JSON.stringify({computerId:t,path:n})))}var kG=2048,AG=8e3,jG=[{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})),MG=eS.pipe(Y(MS(1)),Y(FS(64))),NG=eS.pipe(Y(MS(1)),Y(FS(AG))),PG=LS,FG=J({id:jS,name:MG,text:NG,builtIn:nS});J({computerId:PG,id:q(jS),name:MG,text:NG}),J({computerId:PG,id:jS}),J({computerId:PG,path:LS});var IG=J({styles:aS(FG).pipe(Y(FS(50+jG.length)))}),LG=J({style:lS(MG)});function RG(e,t){let n=t.trim();return e===void 0?n:`${e.trim()}\n\n${n}`}function zG(e){return e?.maxPromptLength??kG}function BG(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 VG=qx(IG);async function HG(e,t){return VG(await bG(e,yG.listStyles,JSON.stringify({computerId:t})))}async function UG(e,t,n){return VG(await bG(e,yG.saveStyle,JSON.stringify({computerId:t,id:n.id,name:n.name,text:n.text})))}async function WG(e,t,n){return VG(await bG(e,yG.deleteStyle,JSON.stringify({computerId:t,id:n})))}async function GG(e,t,n){return qx(LG)(await bG(e,yG.readPrintStyle,JSON.stringify({computerId:t,path:n})))}var KG=/(?<![\p{L}\p{N}_@-])@image(\d+)(?![\p{L}\p{N}_-])/giu,qG=e=>`image${String(e)}`;function JG(e){let t=[];for(let n of e.matchAll(KG)){let e=Number(n.at(1));t.includes(e)||t.push(e)}return t}var YG=(e,t)=>JSON.stringify([e.computerId??t,e.path]),XG={labels:new Map,next:1};function ZG(e,t,n){let r=JG(n).length>0;if(t.length===0)return e.labels.size===0&&(e.next===1||r)?e:r?{labels:new Map,next:e.next}:XG;let i=e.labels.size>0&&t.every(t=>!e.labels.has(t))?XG: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 QG(e,t){return t.map(t=>e.labels.get(t)??0)}function $G(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 eK(e,t,n){let r=[],i=e.replace(KG,(e,i)=>{let a=t.indexOf(Number(i)),o=a<0?void 0:n.at(a);if(o===void 0){let t=qG(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 tK(e,t){return e.replace(KG,(e,n)=>{let r=t(Number(n));return r===void 0||r<1?e:`@${qG(r)}`})}var nK=8,rK=eS.pipe(Y(MS(1)),Y(FS(32)),Y(vS(/^[\p{L}\p{N}_-]+$/u)),Y(vS(/^(?!image\d+$)/iu))),iK=eS.pipe(Y(FS(500))),aK=aS(J({path:LS.pipe(Y(FS(4096)))})).pipe(Y(FS(8))),oK=LS,sK=J({id:jS,name:rK,description:iK,references:aK});J({computerId:oK,id:q(jS),name:rK,description:iK,references:aK}),J({computerId:oK,id:jS});var cK=J({characters:aS(sK).pipe(Y(FS(50)))}),lK=(e,t)=>e.toLowerCase()===t.toLowerCase(),uK=/(?<![\p{L}\p{N}_@-])@([\p{L}\p{N}_-]+)/gu;function dK(e){let t=[];for(let n of e.matchAll(uK)){let e=n.at(1);e!==void 0&&!t.some(t=>lK(t,e))&&t.push(e)}return t}function fK(e,t){let n=[];return{prompt:e.replace(uK,(e,r)=>{let i=t.find(e=>lK(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 pK(e,t,n){let r=e.trim();return RG(t,fK(r,n).prompt).length-r.length}function mK(e,t){let n=dK(e),r=t.filter(e=>!n.some(t=>lK(t,e)));return r.length===0?e:`${r.map(e=>`@${e}`).join(` `)} ${e}`}function hK(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 gK(e){return{kind:`ready`,prompt:e,references:[],characters:[]}}function _K(e){let t=mK(e.prompt,e.names??[]),n=fK(t,e.saved),r=hK(e.references,n.characters,e.computerId),i=(e.wording??(e=>$G(e,void 0)))(r),a=eK(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:fK(a.prompt,e.saved).prompt,references:r,characters:n.characters}}function vK(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 yK(e,t,n){let r=n.toLowerCase(),i=e=>qG(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})),...bK(e,n).map(e=>({kind:`character`,character:e}))]}function bK(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,nK)}var xK=qx(cK);async function SK(e,t){return xK(await bG(e,yG.listCharacters,JSON.stringify({computerId:t})))}async function CK(e,t,n){return xK(await bG(e,yG.saveCharacter,JSON.stringify({computerId:t,id:n.id,name:n.name,description:n.description,references:n.references})))}async function wK(e,t,n){return xK(await bG(e,yG.deleteCharacter,JSON.stringify({computerId:t,id:n})))}var TK={models:e=>$N.of(e,`prints`,`models`),folder:e=>$N.of(e,`prints`,`folder`),dismissals:e=>$N.of(e,`prints`,`dismissals`),styles:e=>$N.of(e,`prints`,`styles`),printStyle:(e,t)=>$N.of(e,`prints`,`print-style`,t),characters:e=>$N.of(e,`prints`,`characters`)};function EK(e){return{...nP(e,JU,TK.models(e),async(t,n)=>{if(!e)throw Error(`Prints is disconnected`);let r=await aW(e.capabilities);return n.throwIfAborted(),r}),enabled:!!(e?.context.get().computerId&&e.capabilities.has(JU)),structuralSharing:!1}}function DK(e){let t=e?.context.get().computerId;return{...nP(e,iP,TK.folder(e),async(n,r)=>{if(!e||!t)throw Error(`No Computer selected`);let i=await DG(e.capabilities,t);if(r.throwIfAborted(),e.context.get().computerId!==t)throw new X(`Computer selection changed`,{code:`SELECTION_CHANGED`,retryable:!1});return i}),enabled:!!(t&&e.capabilities.has(iP))}}function OK(e){let t=e?.context.get().computerId;return{...nP(e,iP,TK.dismissals(e),async(n,r)=>{if(!e||!t)throw Error(`No Computer selected`);let i=await wG(e.capabilities,t);return r.throwIfAborted(),i}),enabled:!!(t&&e.capabilities.has(iP))}}function kK(e){let t=e?.context.get().computerId;return{...nP(e,iP,TK.styles(e),async(n,r)=>{if(!e||!t)throw Error(`No Computer selected`);let i=await HG(e.capabilities,t);return r.throwIfAborted(),i}),enabled:!!(t&&e.capabilities.has(iP))}}function AK(e,t){let n=e?.context.get().computerId;return{...nP(e,iP,TK.printStyle(e,t??``),async(r,i)=>{if(!e||!n||t===null)throw Error(`No print selected`);let a=await GG(e.capabilities,n,t);return i.throwIfAborted(),a}),enabled:!!(n&&t!==null&&e.capabilities.has(iP))}}function jK(e){let t=e?.context.get().computerId;return{...nP(e,iP,TK.characters(e),async(n,r)=>{if(!e||!t)throw Error(`No Computer selected`);let i=await SK(e.capabilities,t);return r.throwIfAborted(),i}),enabled:!!(t&&e.capabilities.has(iP))}}var MK=e=>eS.pipe(Y(MS(1)),Y(FS(e))),NK=tS.pipe(Y(AS()),Y(hS(Number.isSafeInteger,{message:`Expected a safe integer`}))),PK=NK.pipe(Y(ES(0))),FK=J({reference:CU,result:J({bytes:PK,costMilliunits:NK.pipe(Y(DS(0))),destination:J({computerId:MK(256),path:MK(4096)}),format:cS([`png`,`jpeg`,`gif`,`webp`,`mp4`,`mp3`]),height:q(PK),model:MK(256),width:q(PK)}),derivedFrom:q(MK(256)),references:q(aS(lS(MK(256))))}),IK=J({prompt:LS,references:jS.pipe(Y(DS(0)))}),LK=J({reason:cS([...eC,`UNKNOWN`]),message:LS.pipe(Y(FS(512)))}),RK=J({reference:CU,input:UU,typed:IK,style:q(MG),characters:q(aS(rK)),failure:q(LK)});J({record:RK}),J({reference:CU,failure:LK}),J({reference:CU}),J({after:lS(eS)});function zK(e){return{reference:e.reference,input:eW(e.input),typed:e.typed,style:e.style,characters:e.characters,failure:e.failure}}async function BK(e,t){let n=zK(qx(RK,{onExcessProperty:`error`})(t)),r=qx(sS([RK,mW]),{onExcessProperty:`error`})(await bG(e,yG.rememberGeneration,JSON.stringify({record:n})));if(`error`in r)throw new hW(r.message);let i=zK(r);if(JSON.stringify(i)!==JSON.stringify(n))throw new X(`Prints did not confirm the original generation command`,{code:`PROTOCOL`,retryable:!1});return i}async function VK(e,t,n){qx(RK,{onExcessProperty:`error`})(await bG(e,yG.failGeneration,JSON.stringify({reference:t,failure:n})))}async function HK(e,t){qx(J({removed:nS}))(await bG(e,yG.forgetGeneration,JSON.stringify({reference:t})))}async function UK(e,t=null){let n=qx(J({records:aS(RK),next:lS(eS)}),{onExcessProperty:`error`})(await bG(e,yG.listGenerations,JSON.stringify({after:t})));return{records:n.records.map(zK),next:n.next}}async function WK(e,t,n){let r=qx(FK,{onExcessProperty:`error`})({reference:t,result:n}),i=qx(J({printId:eS,computerId:eS}))(await bG(e,yG.completeGeneration,JSON.stringify(r)));if(i.printId!==t.requestId||i.computerId!==t.computerId)throw new X(`Prints did not confirm the saved generation`,{code:`PROTOCOL`,retryable:!1})}var GK=Gx(J({reference:CU}));function KK({connection:e,folder:t,effects:n,styles:r,characters:i}){let a=e?.app??null,o=ON(a),s=(0,G.useRef)(e);s.current=e;let c=(0,G.useRef)(n);c.current=n;let l=vC(),u=$N.of(a,`prints`,`generation`),d=[...u,`recovery`],f=Uw(EK(a)),p=f.isError?void 0:f.data,m=p?.models??[],h=a?.capabilities.has(JU)===!0,g=p?.canGenerate??!1,_=f.error?lC(f.error).message:p?.models.length===0?`The granted Media model registry is empty.`:null,v=Xw({queryKey:d,enabled:a!==null&&o!==null,initialPageParam:null,queryFn:async({pageParam:e,signal:t})=>{if(!a)throw new X(`Prints disconnected`,{code:`DISCONNECTED`,retryable:!0});if(a.context.get().computerId!==o)throw new X(`Computer selection changed`,{code:`SELECTION_CHANGED`,retryable:!1});let n=await UK(a.capabilities,e);return t.throwIfAborted(),n},getNextPageParam:e=>e.next}),y=(0,G.useMemo)(()=>Array.from(new Map(v.data?.pages.flatMap(e=>e.records).map(e=>[e.reference.requestId,e])??[]).values()),[v.data]),b=(0,G.useRef)(new Map),x=(0,G.useRef)(new Set),S=(0,G.useRef)(0),C=(0,G.useRef)(new Map),w=(0,G.useRef)(new Set),T=(0,G.useRef)(new Map),E=(0,G.useRef)(new Set),[,D]=(0,G.useState)(0),[O,k]=(0,G.useState)([]),[A,j]=(0,G.useState)(null),[M,N]=(0,G.useState)(null),P=e=>{j(e),c.current.notifyFailure(e.message)},F=e=>{N(e),c.current.notifyFailure(e)},I=(0,G.useRef)(null);(0,G.useEffect)(()=>{I.current!==v.error&&(I.current=v.error,v.error&&c.current.notifyFailure(lC(v.error).message))},[v.error]);let L=e=>s.current===e.connection&&e.connection.app.context.get().computerId===e.reference.computerId,R=(e,t,n)=>{l.setQueryData(e,e=>e&&{...e,pages:e.pages.map(e=>({...e,records:e.records.map(e=>e.reference.requestId===t?{...e,failure:n}:e)}))})},z=(e,t)=>{l.setQueryData(e,e=>e&&{...e,pages:e.pages.map(e=>({...e,records:e.records.filter(e=>e.reference.requestId!==t)}))})},ee=(e,t)=>{l.setQueryData(e,e=>!e||e.pages.some(e=>e.records.some(e=>e.reference.requestId===t.reference.requestId))?e:{...e,pages:e.pages.map((e,n)=>n===0?{...e,records:[t,...e.records]}:e)})},te=Jw({mutationKey:[...u,`run`],mutationFn:async e=>{e.controller.signal.throwIfAborted();let t=zK({reference:e.reference,input:e.input,typed:e.typed,style:e.style,characters:e.characters});await BK(e.connection.app.capabilities,t),R(e.recoveryKey,e.reference.requestId,void 0),e.controller.signal.throwIfAborted();let n=await e.session.restoreAttempt(e.reference),r;try{r=await n.generate(t.input,{signal:e.controller.signal})}finally{n[Symbol.dispose]()}return await WK(e.connection.app.capabilities,t.reference,r),{input:e.input,result:r}},onMutate:e=>{if(!L(e)||e.controller.signal.aborted)return;let t=tG(e.session.models,e.input.settings.model),n={key:`${e.reference.computerId}:${e.input.destination.path}`,computerId:e.reference.computerId,path:e.input.destination.path,...RW(t,e.draft),pendingLabel:zW(t)};t?.kind===`video`&&(n.startedAt=Date.now(),n.resumed=e.resumed===!0),c.current.reserve(n)},onSuccess:(e,t)=>{z(t.recoveryKey,t.reference.requestId),C.current.delete(t.reference.requestId),!(!L(t)||t.controller.signal.aborted)&&c.current.saved(e,t.connection)},onError:(e,n)=>{if(oW(`generate-media`,e,{requestId:n.reference.requestId}),n.controller.signal.aborted){if(w.current.delete(n.reference.requestId)){let e={reason:`CANCELLED`,message:`Stopped. Retry to run it again.`};VK(n.connection.app.capabilities,n.reference,e).catch(e=>{oW(`fail-generation`,e)}),ee(n.recoveryKey,zK({reference:n.reference,input:n.input,typed:n.typed,style:n.style,characters:n.characters,failure:e})),R(n.recoveryKey,n.reference.requestId,e)}c.current.release(`${n.reference.computerId}:${n.input.destination.path}`);return}if(e instanceof hW){C.current.delete(n.reference.requestId),c.current.release(`${n.reference.computerId}:${n.input.destination.path}`),L(n)&&c.current.notifyFailure(e.message);return}let r=tG(n.session.models,n.input.settings.model),i={model:r===void 0?void 0:eG(r),requestId:n.reference.requestId},a=AW(e,i);if(VK(n.connection.app.capabilities,n.reference,a).catch(e=>{oW(`fail-generation`,e)}),!L(n))return;R(n.recoveryKey,n.reference.requestId,a);let o=kW(e,i),s={requestId:n.reference.requestId,path:n.input.destination.path,mediaKind:r?.kind??null,message:o.message,action:o.action,prompt:n.typed.prompt};k(e=>[...e.filter(e=>e.requestId!==s.requestId),s]),t.recheck(),c.current.notifyFailure(o.message),c.current.failed(`${n.reference.computerId}:${n.input.destination.path}`,yW)},onSettled:(e,t,n)=>{b.current.get(n.reference.requestId)===n.controller&&b.current.delete(n.reference.requestId)}}),B=Jw({mutationKey:[...u,`discard`],mutationFn:async e=>{await HK(e.connection.app.capabilities,e.reference)},onSuccess:(e,t)=>{z(t.recoveryKey,t.reference.requestId),C.current.delete(t.reference.requestId),k(e=>e.filter(e=>e.requestId!==t.reference.requestId))},onError:(e,t)=>{L(t)&&F(lC(e).message)},onSettled:(e,t,n)=>{b.current.get(n.reference.requestId)===n.controller&&b.current.delete(n.reference.requestId)}}),ne=qw({filters:{mutationKey:u,status:`pending`},select:e=>jd(GK(e.state.variables))?.reference.requestId}),re=new Set(ne.filter(e=>e!==void 0)),V=Date.now(),H=new Set([...re,...[...T.current].filter(([,e])=>V-e<fW).map(([e])=>e)]),ie=H.size>=4;(0,G.useEffect)(()=>{x.current.clear(),j(null),N(null),C.current.clear(),w.current.clear(),T.current.clear();for(let e of E.current)clearTimeout(e);E.current.clear(),k([]);let e=$N.of(a,`prints`,`generation`,`recovery`),t=a?.capabilities.subscribe(()=>{queueMicrotask(()=>{l.resetQueries({queryKey:e,exact:!0})})}),n=()=>{S.current+=1;for(let e of b.current.values())e.abort();b.current.clear(),l.cancelQueries({queryKey:e})},r=a?.context.subscribe(e=>{e.computerId!==o&&n()}),i=a?.lifecycle.subscribe(e=>{(e===`disposing`||e===`disposed`||e===`disconnected`)&&n()});return()=>{r?.(),i?.(),t?.(),n();for(let e of E.current)clearTimeout(e);E.current.clear()}},[a,o,e,l]);let ae=e=>{k(t=>t.filter(t=>t.requestId!==e));let t=C.current.get(e);if(!t||b.current.has(e))return;C.current.delete(e);let n=new AbortController;b.current.set(e,n),B.mutate({...t,controller:n,recoveryKey:d})},oe=e=>{let t=e.reference.requestId;if(b.current.has(t))return!1;if(!L(e))return F(`Select the original Computer to retry this generation.`),!1;if(p?.computerId!==e.reference.computerId)return F(`Media access is unavailable for the original Computer.`),!1;if(!H.has(t)&&ie)return F(pW),!1;let n=new AbortController;return b.current.set(t,n),C.current.set(t,e),T.current.delete(t),k(e=>e.filter(e=>e.requestId!==t)),j(null),N(null),S.current+=1,te.mutate({...e,session:p,controller:n,ticket:S.current,recoveryKey:d}),!0};(0,G.useEffect)(()=>{if(!(!e||!p||!v.isSuccess))for(let t of y){let n=t.reference.requestId;x.current.has(n)||t.reference.computerId!==o||tG(p.models,t.input.settings.model)?.kind!==`video`||oe({connection:e,...t,resumed:!0,draft:LW(t.input)})&&x.current.add(n)}},[e,o,p,v.isSuccess,y]);let se=async(n,a=n.references.map((e,t)=>t+1))=>{if(!e?.app.capabilities.has(BF)||!g)return!1;if(t.path===null)return t.setEditing(!0),!1;if(ie)return c.current.notifyFailure(pW),!1;let l=tG(m,n.model);if(l===void 0)return P({kind:`error`,mediaKind:null,message:`Choose a model from the granted registry.`}),!1;let u=JG(n.prompt).length>0,d=l.kind===`audio`?gK(n.prompt):_K({prompt:n.prompt,saved:i,references:n.references,labels:a,wording:e=>$G(oG(e,l,u),l),computerId:o,model:{label:l.label,maxReferences:l.input.maxReferences}});if(d.kind===`refused`)return P({kind:`error`,mediaKind:l.kind,message:d.message}),!1;let f=dG({...n,references:oG(d.references,l,u)},l);if(f)return P({kind:`error`,mediaKind:l.kind,message:f}),!1;let _=l.kind===`audio`?void 0:n.style,v=_===void 0?void 0:r.find(e=>e.name===_);if(_!==void 0&&v===void 0)return P({kind:`error`,mediaKind:l.kind,message:`The "${_}" style no longer exists. Pick another or none.`}),!1;let y=d.characters.map(e=>e.name),b=RG(v?.text,d.prompt),x=BG(b,zG(l),v?.name,y);if(x!==void 0)return P({kind:`error`,mediaKind:l.kind,message:x}),!1;if(!h||!p)return j(null),!1;let C=e,w=C.app.context.get().computerId,T=S.current,E={...n,prompt:b,references:oG(d.references,l,u),destination:NW(n,t.landingPath??t.path,l)},D=cG(E,l),O;try{let e=await t.ensureCreated();if(e)return P({kind:`error`,mediaKind:l.kind,message:e}),!1;if(S.current!==T||s.current!==C||C.app.context.get().computerId!==w)return!1;let n=await p.createAttempt();O=n.reference,n[Symbol.dispose]()}catch(e){return S.current===T&&s.current===C&&C.app.context.get().computerId===w&&P({kind:`error`,mediaKind:l.kind,...kW(e)}),!1}return S.current!==T||s.current!==C||C.app.context.get().computerId!==w?!1:oe({connection:C,reference:O,input:D,draft:E,typed:{prompt:tK(n.prompt.trim(),e=>{let t=a.indexOf(e);return t<0?void 0:t+1}),references:n.references.length},style:v?.name,characters:y})},ce=async(t,n,r)=>{if(!e?.app.capabilities.has(BF)||!g||!p)return vW;if(ie)return pW;let i=pG(m,n);if(i===void 0)return`${fG[n]} is not available on this Computer.`;let a=hG(i,t);if(a!==void 0)return a;let o=e,c=o.app.context.get().computerId;if(t.computerId!==c)return`Select this print's Computer to edit it.`;let l=S.current,{input:u,draft:d}=vG(i,t,r),f;try{let e=await p.createAttempt();f=e.reference,e[Symbol.dispose]()}catch(e){return kW(e).message}return S.current!==l||s.current!==o||o.app.context.get().computerId!==c?`The selected Computer changed. Try again.`:(oe({connection:o,reference:f,input:u,draft:d,typed:{prompt:u.settings.prompt,references:1},characters:[]}),null)},le=te.variables;return{state:A??(re.size>0&&le?{kind:`pending`,draft:le.draft}:null)??(!e||!h||o===null?{kind:`unavailable`,reason:`Image creation is unavailable for this Computer right now.`}:_?{kind:`unavailable`,reason:_}:p?{kind:`ready`}:{kind:`loading`}),models:m,session:p,modelsLoading:f.isFetching,modelsError:_,canGenerate:g,mediaCapability:h,retryModels:()=>{f.refetch()},submit:se,operate:ce,atLimit:ie,stopPath:e=>{for(let[t,n]of C.current){let r=b.current.get(t);if(n.input.destination.path!==e||!r||!re.has(t))continue;w.current.add(t),T.current.set(t,Date.now());let i=setTimeout(()=>{E.current.delete(i),D(e=>e+1)},fW+1e3);E.current.add(i),r.abort()}},activeGenerations:re,pendingGenerations:y,recoveryError:M??(v.error?lC(v.error).message:null),reportRecoveryError:e=>{F(lC(e).message)},hasMore:v.hasNextPage,loadMore:()=>{v.isFetching||v.fetchNextPage()},resume:t=>{if(!e||p?.computerId!==t.reference.computerId){F(`Select the original Computer to retry this generation.`);return}oe({connection:e,...t,draft:LW(t.input)})},discard:t=>{if(!e||b.current.has(t.reference.requestId))return;C.current.delete(t.reference.requestId),k(e=>e.filter(e=>e.requestId!==t.reference.requestId));let n=new AbortController;b.current.set(t.reference.requestId,n),B.mutate({...t,connection:e,controller:n,draft:LW(t.input),recoveryKey:d})},failures:O.map(e=>({...e,key:`generation:${e.requestId}`,retry:C.current.has(e.requestId)?()=>{let t=C.current.get(e.requestId);t&&L(t)&&oe(t)}:void 0,dismiss:()=>{ae(e.requestId)}})),retryPath:e=>{for(let t of C.current.values())if(!(t.input.destination.path!==e||!L(t)))return oe(t);return!1},promptAt:e=>{for(let t of C.current.values())if(t.input.destination.path===e)return t.typed.prompt},dismissPath:e=>{for(let[t,n]of C.current)n.input.destination.path===e&&ae(t)}}}function qK({update:e,notify:t,unwatched:n}){return{link:r,unlink:i,propagate:a,checkDirty:o,shallowPropagate:s};function r(e,t,n){let r=t.depsTail;if(r!==void 0&&r.dep===e)return;let i=r===void 0?t.deps:r.nextDep;if(i!==void 0&&i.dep===e){i.version=n,t.depsTail=i;return}let a=e.subsTail;if(a!==void 0&&a.version===n&&a.sub===t)return;let o=t.depsTail=e.subsTail={version:n,dep:e,sub:t,prevDep:r,nextDep:i,prevSub:a,nextSub:void 0};i!==void 0&&(i.prevDep=o),r===void 0?t.deps=o:r.nextDep=o,a===void 0?e.subs=o:a.nextSub=o}function i(e,t=e.sub){let r=e.dep,i=e.prevDep,a=e.nextDep,o=e.nextSub,s=e.prevSub;return a===void 0?t.depsTail=i:a.prevDep=i,i===void 0?t.deps=a:i.nextDep=a,o===void 0?r.subsTail=s:o.prevSub=s,s===void 0?(r.subs=o)===void 0&&n(r):s.nextSub=o,a}function a(e){let n=e.nextSub,r;top:do{let i=e.sub,a=i.flags;if(a&60?a&12?a&4?!(a&48)&&c(e,i)?(i.flags=a|40,a&=1):a=0:i.flags=a&-9|32:a=0:i.flags=a|32,a&2&&t(i),a&1){let t=i.subs;if(t!==void 0){let i=(e=t).nextSub;i!==void 0&&(r={value:n,prev:r},n=i);continue}}if((e=n)!==void 0){n=e.nextSub;continue}for(;r!==void 0;)if(e=r.value,r=r.prev,e!==void 0){n=e.nextSub;continue top}break}while(!0)}function o(t,n){let r,i=0,a=!1;top:do{let o=t.dep,c=o.flags;if(n.flags&16)a=!0;else if((c&17)==17){if(e(o)){let e=o.subs;e.nextSub!==void 0&&s(e),a=!0}}else if((c&33)==33){(t.nextSub!==void 0||t.prevSub!==void 0)&&(r={value:t,prev:r}),t=o.deps,n=o,++i;continue}if(!a){let e=t.nextDep;if(e!==void 0){t=e;continue}}for(;i--;){let i=n.subs,o=i.nextSub!==void 0;if(o?(t=r.value,r=r.prev):t=i,a){if(e(n)){o&&s(i),n=t.sub;continue}a=!1}else n.flags&=-33;n=t.sub;let c=t.nextDep;if(c!==void 0){t=c;continue top}}return a}while(!0)}function s(e){do{let n=e.sub,r=n.flags;(r&48)==32&&(n.flags=r|16,(r&6)==2&&t(n))}while((e=e.nextSub)!==void 0)}function c(e,t){let n=t.depsTail;for(;n!==void 0;){if(n===e)return!0;n=n.prevDep}return!1}}function JK(e,t,n){let r=typeof e==`object`,i=r?e:void 0;return{next:(r?e.next:e)?.bind(i),error:(r?e.error:t)?.bind(i),complete:(r?e.complete:n)?.bind(i)}}var YK=[],XK=0,{link:ZK,unlink:QK,propagate:$K,checkDirty:eq,shallowPropagate:tq}=qK({update(e){return e._update()},notify(e){YK[rq++]=e,e.flags&=-3},unwatched(e){e.depsTail!==void 0&&(e.depsTail=void 0,e.flags=17,sq(e))}}),nq=0,rq=0,iq,aq=0;function oq(e){try{++aq,e()}finally{--aq||cq()}}function sq(e){let t=e.depsTail,n=t===void 0?e.deps:t.nextDep;for(;n!==void 0;)n=QK(n,e)}function cq(){if(!(aq>0)){for(;nq<rq;){let e=YK[nq];YK[nq++]=void 0,e.notify()}nq=0,rq=0}}function lq(e,t){let n=typeof e==`function`,r=e,i={_snapshot:n?void 0:e,subs:void 0,subsTail:void 0,deps:void 0,depsTail:void 0,flags:+!n,get(){return iq!==void 0&&ZK(i,iq,XK),i._snapshot},subscribe(e){let t=JK(e),n={current:!1},r=uq(()=>{i.get(),n.current?t.next?.(i._snapshot):n.current=!0});return{unsubscribe:()=>{r.stop()}}},_update(e){let a=iq,o=t?.compare??Object.is;if(n)iq=i,++XK,i.depsTail=void 0;else if(e===void 0)return!1;n&&(i.flags=5);try{let t=i._snapshot,a=typeof e==`function`?e(t):e===void 0&&n?r(t):e;return t===void 0||!o(t,a)?(i._snapshot=a,!0):!1}finally{iq=a,n&&(i.flags&=-5),sq(i)}}};return n?(i.flags=17,i.get=function(){let e=i.flags;if(e&16||e&32&&eq(i.deps,i)){if(i._update()){let e=i.subs;e!==void 0&&tq(e)}}else e&32&&(i.flags=e&-33);return iq!==void 0&&ZK(i,iq,XK),i._snapshot}):i.set=function(e){if(i._update(e)){let e=i.subs;e!==void 0&&($K(e),tq(e),cq())}},i}function uq(e){let t=()=>{let t=iq;iq=n,++XK,n.depsTail=void 0,n.flags=6;try{return e()}finally{iq=t,n.flags&=-5,sq(n)}},n={deps:void 0,depsTail:void 0,subs:void 0,subsTail:void 0,flags:6,notify(){let e=this.flags;e&16||e&32&&eq(this.deps,this)?t():this.flags=2},stop(){this.flags=0,this.depsTail=void 0,sq(this)}};return t(),n}var dq=class{constructor(e,t){this.atom=lq(e),this.get=this.get.bind(this),this.setState=this.setState.bind(this),this.subscribe=this.subscribe.bind(this),t&&(this.actions=t(this))}setState(e){this.atom.set(e)}get state(){return this.atom.get()}get(){return this.state}subscribe(e){return this.atom.subscribe(JK(e))}},fq=class{constructor(e){this.atom=lq(e)}get state(){return this.atom.get()}get(){return this.state}subscribe(e){return this.atom.subscribe(JK(e))}};function pq(e,t){return typeof e==`function`?new fq(e):t?new dq(e,t):new dq(e)}var mq=class{constructor(e,t){this.fn=e,this.options=t,this.lastExecutionTime=0,this.isPending=!1,this.maybeExecute=(...e)=>{let t=Date.now()-this.lastExecutionTime;if(this.options.leading&&t>=this.options.wait)this.execute(...e);else if(this.lastArgs=e,!this.timeoutId&&this.options.trailing){let e=this.options.wait-t;this.isPending=!0,this.timeoutId=setTimeout(()=>{this.lastArgs!==void 0&&this.execute(...this.lastArgs)},e)}},this.execute=(...e)=>{this.fn(...e),this.options.onExecute?.(e,this),this.lastExecutionTime=Date.now(),this.clearTimeout(),this.lastArgs=void 0,this.isPending=!1},this.flush=()=>{this.isPending&&this.lastArgs&&this.execute(...this.lastArgs)},this.cancel=()=>{this.clearTimeout(),this.lastArgs=void 0,this.isPending=!1},this.clearTimeout=()=>{this.timeoutId&&=(clearTimeout(this.timeoutId),void 0)},this.options.leading===void 0&&this.options.trailing===void 0&&(this.options.leading=!0,this.options.trailing=!0)}};function hq(e,t){return new mq(e,t).maybeExecute}var gq=class{#e=!0;#t;#n;#r;#i;#a;#o;#s;#c=0;#l=5;#u=!1;#d=!1;#f=null;#p=()=>{this.debugLog(`Connected to event bus`),this.#a=!0,this.#u=!1,this.debugLog(`Emitting queued events`,this.#i),this.#i.forEach(e=>this.emitEventToBus(e)),this.#i=[],this.stopConnectLoop(),this.#n().removeEventListener(`tanstack-connect-success`,this.#p)};#m=()=>{if(this.#c<this.#l){this.#c++,this.dispatchCustomEvent(`tanstack-connect`,{});return}this.#n().removeEventListener(`tanstack-connect`,this.#m),this.#d=!0,this.debugLog(`Max retries reached, giving up on connection`),this.stopConnectLoop()};#h=()=>{this.#u||(this.#u=!0,this.#n().addEventListener(`tanstack-connect-success`,this.#p),this.#m())};constructor({pluginId:e,debug:t=!1,enabled:n=!0,reconnectEveryMs:r=300}){this.#t=e,this.#e=n,this.#n=this.getGlobalTarget,this.#r=t,this.debugLog(` Initializing event subscription for plugin`,this.#t),this.#i=[],this.#a=!1,this.#d=!1,this.#o=null,this.#s=r}startConnectLoop(){this.#o!==null||this.#a||(this.debugLog(`Starting connect loop (every ${this.#s}ms)`),this.#o=setInterval(this.#m,this.#s))}stopConnectLoop(){this.#u=!1,this.#o!==null&&(clearInterval(this.#o),this.#o=null,this.#i=[],this.debugLog(`Stopped connect loop`))}debugLog(...e){this.#r&&console.log(`🌴 [tanstack-devtools:${this.#t}-plugin]`,...e)}getGlobalTarget(){if(typeof globalThis<`u`&&globalThis.__TANSTACK_EVENT_TARGET__)return this.debugLog(`Using global event target`),globalThis.__TANSTACK_EVENT_TARGET__;if(typeof window<`u`&&window.addEventListener!==void 0)return this.debugLog(`Using window as event target`),window;let e=typeof EventTarget<`u`?new EventTarget:void 0;return e===void 0||e.addEventListener===void 0?(this.debugLog(`No event mechanism available, running in non-web environment`),{addEventListener:()=>{},removeEventListener:()=>{},dispatchEvent:()=>!1}):(this.debugLog(`Using new EventTarget as fallback`),e)}getPluginId(){return this.#t}dispatchCustomEventShim(e,t){try{let n=new Event(e,{detail:t});this.#n().dispatchEvent(n)}catch{this.debugLog(`Failed to dispatch shim event`)}}dispatchCustomEvent(e,t){try{this.#n().dispatchEvent(new CustomEvent(e,{detail:t}))}catch{this.dispatchCustomEventShim(e,t)}}emitEventToBus(e){this.debugLog(`Emitting event to client bus`,e),this.dispatchCustomEvent(`tanstack-dispatch-event`,e)}createEventPayload(e,t){return{type:`${this.#t}:${e}`,payload:t,pluginId:this.#t}}emit(e,t){if(!this.#e){this.debugLog(`Event bus client is disabled, not emitting event`,e,t);return}if(this.#f&&(this.debugLog(`Emitting event to internal event target`,e,t),this.#f.dispatchEvent(new CustomEvent(`${this.#t}:${e}`,{detail:this.createEventPayload(e,t)}))),this.#d){this.debugLog(`Previously failed to connect, not emitting to bus`);return}if(!this.#a){this.debugLog(`Bus not available, will be pushed as soon as connected`),this.#i.push(this.createEventPayload(e,t)),typeof CustomEvent<`u`&&!this.#u&&(this.#h(),this.startConnectLoop());return}return this.emitEventToBus(this.createEventPayload(e,t))}on(e,t,n){let r=n?.withEventTarget??!1,i=`${this.#t}:${e}`;if(r&&(this.#f||=new EventTarget,this.#f.addEventListener(i,e=>{t(e.detail)})),!this.#e)return this.debugLog(`Event bus client is disabled, not registering event`,i),()=>{};let a=e=>{this.debugLog(`Received event from bus`,e.detail),t(e.detail)};return this.#n().addEventListener(i,a),this.debugLog(`Registered event to bus`,i),()=>{r&&this.#f?.removeEventListener(i,a),this.#n().removeEventListener(i,a)}}onAll(e){if(!this.#e)return this.debugLog(`Event bus client is disabled, not registering event`),()=>{};let t=t=>{let n=t.detail;e(n)};return this.#n().addEventListener(`tanstack-devtools-global`,t),()=>this.#n().removeEventListener(`tanstack-devtools-global`,t)}onAllPluginEvents(e){if(!this.#e)return this.debugLog(`Event bus client is disabled, not registering event`),()=>{};let t=t=>{let n=t.detail;this.#t&&n.pluginId!==this.#t||e(n)};return this.#n().addEventListener(`tanstack-devtools-global`,t),()=>this.#n().removeEventListener(`tanstack-devtools-global`,t)}},_q=new class extends gq{constructor(){super({pluginId:`form-devtools`,reconnectEveryMs:1e3})}};function vq(e,t){return typeof e==`function`?e(t):e}function yq(e,t){return Dq(t).reduce((e,t)=>{if(e===null)return null;if(e!==void 0)return e[t]},e)}function bq(e,t,n){let r=Dq(t);function i(e){if(!r.length)return vq(n,e);let t=r.shift();if(typeof t==`string`||typeof t==`number`&&!Array.isArray(e))return typeof e==`object`?(e===null&&(e={}),{...e,[t]:i(e[t])}):{[t]:i()};if(Array.isArray(e)&&typeof t==`number`){let n=e.slice(0,t);return[...n.length?n:Array(t),i(e[t]),...e.slice(t+1)]}return[...Array(t),i()]}return i(e)}function xq(e,t){let n=Dq(t);function r(e){if(!e)return;if(n.length===1){let t=n[0];if(Array.isArray(e)&&typeof t==`number`)return e.filter((e,n)=>n!==t);let{[t]:r,...i}=e;return i}let t=n.shift();if((typeof t==`string`||typeof t==`number`&&!Array.isArray(e))&&typeof e==`object`)return{...e,[t]:r(e[t])};if(typeof t==`number`&&Array.isArray(e)){if(t>=e.length)return e;let n=e.slice(0,t);return[...n.length?n:Array(t),r(e[t]),...e.slice(t+1)]}throw Error(`It seems we have created an infinite loop in deleteBy. `)}return r(e)}var Sq=46,Cq=91,wq=93,Tq=48,Eq=57;function Dq(e){if(Array.isArray(e))return[...e];if(typeof e!=`string`)throw Error(`Path must be a string.`);let t=e.length,n=[],r=+(t>0&&e.charCodeAt(0)===Cq),i=!0,a=-1;for(let o=r;o<=t;o++){let s=o<t?e.charCodeAt(o):-1;if(o===t||s===Sq||s===Cq||s===wq){let t=o-r;if(t>0){let a=i&&(t===1||e.charCodeAt(r)!==Tq),s=e.slice(r,o);if(a){let e=parseInt(s,10);t<=15||String(e)===s?n.push(e):n.push(s)}else n.push(s)}else a!==wq&&(a!==-1||s!==wq)&&(a!==s||s!==Sq&&s!==Cq)&&n.push(``);r=o+1,i=!0}else(s<Tq||s>Eq)&&(i=!1);a=s}return n.length||n.push(``),n}function Oq(e){return!(Array.isArray(e)&&e.length===0)}function kq(e,t){return t.validationLogic({form:t.form,group:t.group,validators:t.validators,event:{type:e,fieldName:t.fieldName,async:!1},runValidation:e=>e.validators.filter(Boolean).map(e=>({cause:e.cause,validate:e.fn}))})}function Aq(e,t){let{asyncDebounceMs:n}=t,{onBlurAsyncDebounceMs:r,onChangeAsyncDebounceMs:i,onDynamicAsyncDebounceMs:a}=t.validators||{},o=n??0;return t.validationLogic({form:t.form,group:t.group,validators:t.validators,event:{type:e,fieldName:t.fieldName,async:!0},runValidation:t=>t.validators.filter(Boolean).map(t=>{let n=t?.cause||e,s=o;switch(n){case`change`:s=i??o;break;case`blur`:s=r??o;break;case`dynamic`:s=a??o;break;case`submit`:s=0}return e===`submit`&&(s=0),{cause:n,validate:t.fn,debounceMs:s}})})}var jq=e=>!!e&&typeof e==`object`&&`fields`in e;function Mq(e,t){if(Object.is(e,t))return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!t)return!1;if(e instanceof Date&&t instanceof Date)return e.getTime()===t.getTime();if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(let[n,r]of e)if(!t.has(n)||!Object.is(r,t.get(n)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length||n.length===0&&!Array.isArray(e)&&!Array.isArray(t)&&(Object.getPrototypeOf(e)!==Object.prototype||Object.getPrototypeOf(t)!==Object.prototype))return!1;for(let i of n)if(!r.includes(i)||!Mq(e[i],t[i]))return!1;return!0}var Nq=({newFormValidatorError:e,isPreviousErrorFromFormValidator:t,previousErrorValue:n})=>e?{newErrorValue:e,newSource:`form`}:t?{newErrorValue:void 0,newSource:void 0}:n?{newErrorValue:n,newSource:`field`}:{newErrorValue:void 0,newSource:void 0},Pq=({formLevelError:e,fieldLevelError:t})=>t?{newErrorValue:t,newSource:`field`}:e?{newErrorValue:e,newSource:`form`}:{newErrorValue:void 0,newSource:void 0};function Fq(e,t){return e==null?t:{...e,...t}}for(var Iq=256,Lq=[],Rq;Iq--;)Lq[Iq]=(Iq+256).toString(16).substring(1);function zq(){let e=0,t,n=``;if(!Rq||Iq+16>256){for(Rq=Array(256),e=256;e--;)Rq[e]=256*Math.random()|0;e=0,Iq=0}for(;e<16;e++)t=Rq[Iq+e],n+=e===6?Lq[t&15|64]:e===8?Lq[t&63|128]:Lq[t],e&1&&e>1&&e<11&&(n+=`-`);return Iq++,n}var Bq=hq(e=>_q.emit(`form-state`,{id:e.formId,state:e.store.state}),{wait:300});function Vq(e){if(typeof e!=`object`||!e)return e;if(e instanceof Date)return new Date(e.getTime());if(Array.isArray(e)){let t=[];for(let n=0;n<e.length;n++)t[n]=Vq(e[n]);return t}if(e instanceof Map){let t=new Map;return e.forEach((e,n)=>{t.set(n,Vq(e))}),t}if(e instanceof Set){let t=new Set;return e.forEach(e=>{t.add(Vq(e))}),t}let t={};for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=Vq(e[n]));return t}function Hq(e,t){return t===e||t.startsWith(`${e}.`)||t.startsWith(`${e}[`)}var Uq=e=>{if(!e.validators)return e.runValidation({validators:[],form:e.form});let t=e.event.async,n=t?void 0:{fn:e.validators.onMount,cause:`mount`},r={fn:t?e.validators.onChangeAsync:e.validators.onChange,cause:`change`},i={fn:t?e.validators.onBlurAsync:e.validators.onBlur,cause:`blur`},a={fn:t?e.validators.onSubmitAsync:e.validators.onSubmit,cause:`submit`},o=t?void 0:{fn:()=>void 0,cause:`server`};switch(e.event.type){case`mount`:return e.runValidation({validators:[n],form:e.form});case`submit`:return e.runValidation({validators:[r,i,a,o],form:e.form});case`server`:return e.runValidation({validators:[],form:e.form});case`blur`:return e.runValidation({validators:[i,o],form:e.form});case`change`:return e.runValidation({validators:[r,o],form:e.form});default:throw Error(`Unknown validation event type: ${e.event.type}`)}};function Wq(e,t){let n=new Map;for(let r of e){let e=r.path??[],i=t,a=``;for(let t=0;t<e.length;t++){let n=e[t];if(n===void 0)continue;let r=typeof n==`object`?n.key:n,o=Number(r);a+=Array.isArray(i)&&!Number.isNaN(o)?`[${o}]`:(t>0?`.`:``)+String(r),i=typeof i==`object`&&i?i[r]:void 0}n.set(a,(n.get(a)??[]).concat(r))}return Object.fromEntries(n)}var Gq=(e,t)=>{let n=Wq(e,t);return{form:n,fields:n}},Kq={validate({value:e,validationSource:t},n){let r=n[`~standard`].validate(e);if(r instanceof Promise)throw Error(`async function passed to sync validator`);if(r.issues)return t===`field`?r.issues:Gq(r.issues,e)},async validateAsync({value:e,validationSource:t},n){let r=await n[`~standard`].validate(e);if(r.issues)return t===`field`?r.issues:Gq(r.issues,e)}},qq=e=>!!e&&`~standard`in e,Jq={isValidating:!1,isTouched:!1,isBlurred:!1,isDirty:!1,isPristine:!0,isValid:!0,isDefaultValue:!0,errors:[],errorMap:{},errorSourceMap:{},_arrayVersion:0,_pendingValidationsCount:0};function Yq(e){function t(t){let n=e.getFieldMeta(t)??Jq;e.setFieldMeta(t,{...n,_arrayVersion:(n._arrayVersion||0)+1})}function n(n,r,i){t(n);let a=s(n,r,`move`,i),c=Math.min(r,i),u=Math.max(r,i);for(let e=c;e<=u;e++)a.push(o(n,e));let d=Object.keys(e.fieldInfo).reduce((t,i)=>(i.startsWith(o(n,r))&&t.set(i,e.getFieldMeta(i)),t),new Map);l(a,r<i?`up`:`down`),Object.keys(e.fieldInfo).filter(e=>e.startsWith(o(n,i))).forEach(t=>{let a=t.replace(o(n,i),o(n,r)),s=d.get(a);s&&e.setFieldMeta(t,s)})}function r(e,n){t(e),l(s(e,n,`remove`),`up`)}function i(n,r,i){t(n),s(n,r,`swap`,i).forEach(t=>{if(!t.toString().startsWith(o(n,r)))return;let a=t.toString().replace(o(n,r),o(n,i)),[s,c]=[e.getFieldMeta(t),e.getFieldMeta(a)];s&&e.setFieldMeta(a,s),c&&e.setFieldMeta(t,c)})}function a(n,r){t(n);let i=s(n,r,`insert`);l(i,`down`),i.forEach(t=>{t.toString().startsWith(o(n,r))&&e.setFieldMeta(t,u())})}function o(e,t){return`${e}[${t}]`}function s(t,n,r,i){let a=[o(t,n)];switch(r){case`swap`:a.push(o(t,i));break;case`move`:{let[e,r]=[Math.min(n,i),Math.max(n,i)];for(let n=e;n<=r;n++)a.push(o(t,n));break}default:{let r=e.getFieldValue(t),i=Array.isArray(r)?r.length:0;for(let e=n+1;e<i;e++)a.push(o(t,e));break}}return Object.keys(e.fieldInfo).filter(e=>a.some(t=>e.startsWith(t)))}function c(e,t){return e.replace(/\[(\d+)\]/,(e,n)=>{let r=parseInt(n,10);return`[${t===`up`?r+1:Math.max(0,r-1)}]`})}function l(t,n){(n===`up`?t:[...t].reverse()).forEach(t=>{let r=c(t.toString(),n),i=e.getFieldMeta(r);i?e.setFieldMeta(t,i):e.setFieldMeta(t,u())})}let u=()=>Jq;return{bumpArrayVersion:t,handleArrayMove:n,handleArrayRemove:r,handleArraySwap:i,handleArrayInsert:a}}function Xq(e){return{values:e.values??{},errorMap:e.errorMap??{},fieldMetaBase:e.fieldMetaBase??{},formGroupStateBase:e.formGroupStateBase??{},isSubmitted:e.isSubmitted??!1,isSubmitting:e.isSubmitting??!1,isValidating:e.isValidating??!1,submissionAttempts:e.submissionAttempts??0,isSubmitSuccessful:e.isSubmitSuccessful??!1,validationMetaMap:e.validationMetaMap??{onChange:void 0,onBlur:void 0,onSubmit:void 0,onMount:void 0,onServer:void 0,onDynamic:void 0}}}var Zq=class{constructor(e){this.options={},this.fieldInfo={},this.formGroupApis=new Set,this.mount=()=>{let e=this.store.subscribe(()=>{Bq(this)}),t=_q.on(`request-form-state`,e=>{e.payload.id===this._formId&&_q.emit(`form-api`,{id:this._formId,state:this.store.state,options:this.options})}),n=_q.on(`request-form-reset`,e=>{e.payload.id===this._formId&&this.reset()}),r=_q.on(`request-form-force-submit`,e=>{e.payload.id===this._formId&&(this._devtoolsSubmissionOverride=!0,this.handleSubmit(),this._devtoolsSubmissionOverride=!1)}),i=()=>{r(),n(),t(),e.unsubscribe(),_q.emit(`form-unmounted`,{id:this._formId})};this.options.listeners?.onMount?.({formApi:this});let{onMount:a}=this.options.validators||{};return _q.emit(`form-api`,{id:this._formId,state:this.store.state,options:this.options}),a&&this.validateSync(`mount`),i},this.update=e=>{if(!e)return;let t=this.options;this.options=e;let n=e.defaultValues&&!Mq(e.defaultValues,t.defaultValues)&&!this.state.isTouched,r=!Mq(e.defaultState,t.defaultState)&&!this.state.isTouched;if(!(!n&&!r)){if(oq(()=>{this.baseStore.setState(()=>Xq(Object.assign({},this.state,r?e.defaultState:{},n?{values:e.defaultValues}:{})))}),n){let e=Yq(this);for(let t of Object.keys(this.fieldInfo))Array.isArray(this.getFieldValue(t))&&e.bumpArrayVersion(t)}_q.emit(`form-api`,{id:this._formId,state:this.store.state,options:this.options})}},this.reset=(e,t)=>{let{fieldMeta:n}=this.state,r=this.resetFieldMeta(n);e&&!t?.keepDefaultValues&&(this.options={...this.options,defaultValues:e}),this.baseStore.setState(()=>{let t=e??this.options.defaultValues??this.options.defaultState?.values;return e||Object.values(this.fieldInfo).forEach(e=>{e.instance&&e.instance.options.defaultValue!==void 0&&(t=bq(t,e.instance.name,e.instance.options.defaultValue))}),Xq({...this.options.defaultState,values:t,fieldMetaBase:r})})},this.validateAllFields=async e=>{let t=[];return oq(()=>{Object.values(this.fieldInfo).forEach(n=>{if(!n.instance)return;let r=n.instance;t.push(Promise.resolve().then(()=>r.validate(e,{skipFormValidation:!0,skipGroupValidation:!0}))),n.instance.store.state.meta.isTouched||n.instance.setMeta(e=>({...e,isTouched:!0}))})}),(await Promise.all(t)).flat()},this.validateArrayFieldsStartingFrom=async(e,t,n)=>{let r=this.getFieldValue(e),i=Array.isArray(r)?Math.max(r.length-1,0):null,a=[`${e}[${t}]`];for(let n=t+1;n<=(i??0);n++)a.push(`${e}[${n}]`);let o=Object.keys(this.fieldInfo).filter(e=>a.some(t=>e.startsWith(t))),s=[];return oq(()=>{o.forEach(e=>{s.push(Promise.resolve().then(()=>this.validateField(e,n)))})}),(await Promise.all(s)).flat()},this.validateField=(e,t)=>{let n=this.fieldInfo[e]?.instance;if(!n){let{hasErrored:n}=this.validateSync(t);return n&&!this.options.asyncAlways?this.getFieldMeta(e)?.errors??[]:this.validateAsync(t).then(()=>this.getFieldMeta(e)?.errors??[])}return n.store.state.meta.isTouched||n.setMeta(e=>({...e,isTouched:!0})),n.validate(t)},this.validateSync=(e,t)=>{let n=kq(e,{...this.options,form:this,group:t?.group,validationLogic:this.options.validationLogic||Uq}),r=!1,i={};return oq(()=>{for(let e of n){if(!e.validate)continue;let{formError:n,fieldErrors:a}=Qq(this.runValidator({validate:e.validate,value:{value:this.state.values,formApi:this,validationSource:`form`},type:`validate`})),o=$q(e.cause),s=new Set([...Object.keys(this.state.fieldMeta),...Object.keys(a||{})]);t?.filterFieldNames&&(s=new Set([...s].filter(t.filterFieldNames)));for(let e of s){if(this.baseStore.state.fieldMetaBase[e]===void 0&&!a?.[e])continue;let{errorMap:t,errorSourceMap:n}=this.getFieldMeta(e)??Jq,r=a?.[e],{newErrorValue:s,newSource:c}=Nq({newFormValidatorError:r,isPreviousErrorFromFormValidator:n?.[o]===`form`,previousErrorValue:t?.[o]});c===`form`&&(i[e]={...i[e],[o]:r}),t?.[o]!==s&&this.setFieldMeta(e,(e=Jq)=>({...e,errorMap:{...e.errorMap,[o]:s},errorSourceMap:{...e.errorSourceMap,[o]:c}}))}t?.dontUpdateFormErrorMap||this.state.errorMap?.[o]!==n&&this.baseStore.setState(e=>({...e,errorMap:{...e.errorMap,[o]:n}})),(n||a)&&(r=!0)}if(t?.dontUpdateFormErrorMap)return;let a=$q(`submit`);this.state.errorMap?.[a]&&e!==`submit`&&!r&&this.baseStore.setState(e=>({...e,errorMap:{...e.errorMap,[a]:void 0}}));let o=$q(`server`);this.state.errorMap?.[o]&&e!==`server`&&!r&&this.baseStore.setState(e=>({...e,errorMap:{...e.errorMap,[o]:void 0}}))}),{hasErrored:r,fieldsErrorMap:i}},this.validateAsync=async(e,t)=>{let n=Aq(e,{...this.options,form:this,group:t?.group,validationLogic:this.options.validationLogic||Uq});this.state.isFormValidating||this.baseStore.setState(e=>({...e,isFormValidating:!0}));let r=[],i;for(let e of n){if(!e.validate)continue;let n=$q(e.cause);this.state.validationMetaMap[n]?.lastAbortController.abort();let a=new AbortController;this.state.validationMetaMap[n]={lastAbortController:a},r.push(new Promise(async n=>{let r;try{r=await new Promise((t,n)=>{setTimeout(async()=>{if(a.signal.aborted)return t(void 0);try{t(await this.runValidator({validate:e.validate,value:{value:this.state.values,formApi:this,validationSource:`form`,signal:a.signal},type:`validateAsync`}))}catch(e){n(e)}},e.debounceMs)})}catch(e){r=e}let{formError:o,fieldErrors:s}=Qq(r);s&&(i=i?{...i,...s}:s);let c=$q(e.cause),l=new Set([...Object.keys(this.state.fieldMeta),...Object.keys(i||{})]),u=Array.from(l);t?.filterFieldNames&&(u=u.filter(t.filterFieldNames));for(let e of u){if(this.baseStore.state.fieldMetaBase[e]===void 0&&!i?.[e])continue;let{errorMap:t,errorSourceMap:n}=this.getFieldMeta(e)??Jq,r=i?.[e],{newErrorValue:a,newSource:o}=Nq({newFormValidatorError:r,isPreviousErrorFromFormValidator:n?.[c]===`form`,previousErrorValue:t?.[c]});t?.[c]!==a&&this.setFieldMeta(e,(e=Jq)=>({...e,errorMap:{...e.errorMap,[c]:a},errorSourceMap:{...e.errorSourceMap,[c]:o}}))}t?.dontUpdateFormErrorMap||this.baseStore.setState(e=>({...e,errorMap:{...e.errorMap,[c]:o}})),n(i?{fieldErrors:i,errorMapKey:c}:void 0)}))}let a=[],o={};if(r.length){a=await Promise.all(r);for(let e of a)if(e?.fieldErrors){let{errorMapKey:t}=e;for(let[n,r]of Object.entries(e.fieldErrors))o[n]={...o[n]||{},[t]:r}}}return this.baseStore.setState(e=>({...e,isFormValidating:!1})),o},this.validate=(e,t)=>{let{hasErrored:n,fieldsErrorMap:r}=this.validateSync(e,t);return n&&!this.options.asyncAlways?r:this.validateAsync(e,t)},this._handleSubmit=async e=>{this.baseStore.setState(e=>({...e,isSubmitted:!1,submissionAttempts:e.submissionAttempts+1,isSubmitSuccessful:!1})),oq(()=>{Object.values(this.fieldInfo).forEach(e=>{e.instance&&(e.instance.store.state.meta.isTouched||e.instance.setMeta(e=>({...e,isTouched:!0})))})});let t=e??this.options.onSubmitMeta;if(!this.state.canSubmit&&!this._devtoolsSubmissionOverride&&this.baseStore.state.submissionAttempts<=1){this.options.onSubmitInvalid?.({value:this.state.values,formApi:this,meta:t});return}this.baseStore.setState(e=>({...e,isSubmitting:!0}));let n=()=>{this.baseStore.setState(e=>({...e,isSubmitting:!1}))};if(await this.validateAllFields(`submit`),!this.state.isFieldsValid){n(),this.options.onSubmitInvalid?.({value:this.state.values,formApi:this,meta:t}),_q.emit(`form-submission`,{id:this._formId,submissionAttempt:this.state.submissionAttempts,successful:!1,stage:`validateAllFields`,errors:Object.values(this.state.fieldMeta).map(e=>e.errors).flat()});return}if(await this.validate(`submit`),!this.state.isValid){n(),this.options.onSubmitInvalid?.({value:this.state.values,formApi:this,meta:t}),_q.emit(`form-submission`,{id:this._formId,submissionAttempt:this.state.submissionAttempts,successful:!1,stage:`validate`,errors:this.state.errors});return}oq(()=>{Object.values(this.fieldInfo).forEach(e=>{e.instance?.triggerOnSubmitListener()})}),this.options.listeners?.onSubmit?.({formApi:this,meta:t});try{await this.options.onSubmit?.({value:this.state.values,formApi:this,meta:t}),oq(()=>{this.baseStore.setState(e=>({...e,isSubmitted:!0,isSubmitSuccessful:!0})),_q.emit(`form-submission`,{id:this._formId,submissionAttempt:this.state.submissionAttempts,successful:!0}),n()})}catch(e){throw this.baseStore.setState(e=>({...e,isSubmitSuccessful:!1})),_q.emit(`form-submission`,{id:this._formId,submissionAttempt:this.state.submissionAttempts,successful:!1,stage:`inflight`,onError:e}),n(),e}},this.getFieldValue=e=>yq(this.state.values,e),this.getFieldMeta=e=>this.state.fieldMeta[e],this.getFormGroupMeta=e=>this.formGroupMetaDerived.state[e],this.getFieldInfo=e=>this.fieldInfo[e]||={instance:null,validationMetaMap:{onChange:void 0,onBlur:void 0,onSubmit:void 0,onMount:void 0,onServer:void 0,onDynamic:void 0}},this.setFieldMeta=(e,t)=>{this.baseStore.setState(n=>({...n,fieldMetaBase:{...n.fieldMetaBase,[e]:vq(t,n.fieldMetaBase[e])}}))},this.resetFieldMeta=e=>Object.keys(e).reduce((e,t)=>{let n=t;return e[n]=Jq,e},{}),this.setFieldValue=(e,t,n)=>{let r=n?.dontUpdateMeta??!1,i=n?.dontRunListeners??!1,a=n?.dontValidate??!1;oq(()=>{r||this.setFieldMeta(e,e=>({...e,isTouched:!0,isDirty:!0,errorMap:{...e?.errorMap,onMount:void 0}})),this.baseStore.setState(n=>({...n,values:bq(n.values,e,t)}))}),i||this.getFieldInfo(e).instance?.triggerOnChangeListener(),a||this.validateField(e,`change`)},this.deleteField=e=>{let t=[...Object.keys(this.fieldInfo).filter(t=>{let n=e.toString();return t!==n&&t.startsWith(n)}),e];this.baseStore.setState(e=>{let n={...e};return t.forEach(e=>{n.values=xq(n.values,e),delete this.fieldInfo[e],delete n.fieldMetaBase[e]}),n})},this.pushFieldValue=(e,t,n)=>{this.setFieldValue(e,e=>[...Array.isArray(e)?e:[],t],n),Yq(this).bumpArrayVersion(e)},this.insertFieldValue=async(e,t,n,r)=>{this.setFieldValue(e,e=>[...e.slice(0,t),n,...e.slice(t)],Fq(r,{dontValidate:!0}));let i=r?.dontValidate??!1;i||await this.validateField(e,`change`),Yq(this).handleArrayInsert(e,t),i||await this.validateArrayFieldsStartingFrom(e,t,`change`)},this.replaceFieldValue=async(e,t,n,r)=>{this.setFieldValue(e,e=>e.map((e,r)=>r===t?n:e),Fq(r,{dontValidate:!0})),Yq(this).bumpArrayVersion(e),(r?.dontValidate??!1)||(await this.validateField(e,`change`),await this.validateArrayFieldsStartingFrom(e,t,`change`))},this.removeFieldValue=async(e,t,n)=>{let r=this.getFieldValue(e),i=Array.isArray(r)?Math.max(r.length-1,0):null;if(this.setFieldValue(e,e=>e.filter((e,n)=>n!==t),Fq(n,{dontValidate:!0})),Yq(this).handleArrayRemove(e,t),i!==null){let t=`${e}[${i}]`;this.deleteField(t)}(n?.dontValidate??!1)||(await this.validateField(e,`change`),await this.validateArrayFieldsStartingFrom(e,t,`change`))},this.swapFieldValues=(e,t,n,r)=>{this.setFieldValue(e,e=>{let r=e[t],i=e[n];return bq(bq(e,`${t}`,i),`${n}`,r)},Fq(r,{dontValidate:!0})),Yq(this).handleArraySwap(e,t,n),(r?.dontValidate??!1)||(this.validateField(e,`change`),this.validateField(`${e}[${t}]`,`change`),this.validateField(`${e}[${n}]`,`change`))},this.moveFieldValues=(e,t,n,r)=>{this.setFieldValue(e,e=>{let r=[...e];return r.splice(n,0,r.splice(t,1)[0]),r},Fq(r,{dontValidate:!0})),Yq(this).handleArrayMove(e,t,n),(r?.dontValidate??!1)||(this.validateField(e,`change`),this.validateField(`${e}[${t}]`,`change`),this.validateField(`${e}[${n}]`,`change`))},this.clearFieldValues=(e,t)=>{let n=this.getFieldValue(e),r=Array.isArray(n)?Math.max(n.length-1,0):null;if(this.setFieldValue(e,[],Fq(t,{dontValidate:!0})),Yq(this).bumpArrayVersion(e),r!==null)for(let t=0;t<=r;t++){let n=`${e}[${t}]`;this.deleteField(n)}(t?.dontValidate??!1)||this.validateField(e,`change`)},this.resetField=e=>{this.baseStore.setState(t=>{let n=this.getFieldInfo(e).instance?.options.defaultValue,r=yq(this.options.defaultValues,e),i=n??r;return{...t,fieldMetaBase:{...t.fieldMetaBase,[e]:Jq},values:i===void 0?t.values:bq(t.values,e,i)}})},this.setErrorMap=e=>{oq(()=>{Object.entries(e).forEach(([e,t])=>{let n=e;if(jq(t)){let{formError:e,fieldErrors:r}=Qq(t);for(let e of Object.keys(this.fieldInfo))this.getFieldMeta(e)&&this.setFieldMeta(e,t=>({...t,errorMap:{...t.errorMap,[n]:r?.[e]},errorSourceMap:{...t.errorSourceMap,[n]:`form`}}));this.baseStore.setState(t=>({...t,errorMap:{...t.errorMap,[n]:e}}))}else this.baseStore.setState(e=>({...e,errorMap:{...e.errorMap,[n]:t}}))})})},this.getAllErrors=()=>({form:{errors:this.state.errors,errorMap:this.state.errorMap},fields:Object.entries(this.state.fieldMeta).reduce((e,[t,n])=>(Object.keys(n).length&&n.errors.length&&(e[t]={errors:n.errors,errorMap:n.errorMap}),e),{})}),this.parseValuesWithSchema=e=>Kq.validate({value:this.state.values,validationSource:`form`},e),this.parseValuesWithSchemaAsync=e=>Kq.validateAsync({value:this.state.values,validationSource:`form`},e),this.timeoutIds={validations:{},listeners:{},formListeners:{}},this._formId=e?.formId??zq(),this._devtoolsSubmissionOverride=!1;let t=Xq({...e?.defaultState,values:e?.defaultValues??e?.defaultState?.values});if(e?.transform){t=e.transform({state:t}).state;for(let e of Object.keys(t.errorMap)){let n=t.errorMap[e];if(!(n===void 0||!jq(n)))for(let r of Object.keys(n.fields)){let i=n.fields[r];if(i===void 0)continue;let a=t.fieldMetaBase[r];t.fieldMetaBase[r]={isTouched:!1,isValidating:!1,isBlurred:!1,isDirty:!1,_arrayVersion:0,_pendingValidationsCount:0,...a??{},errorSourceMap:{...a?.errorSourceMap??{},onChange:`form`},errorMap:{...a?.errorMap??{},[e]:i}}}}}this.baseStore=pq(t);let n;this.fieldMetaDerived=pq(e=>{let t=this.baseStore.get(),r=0,i={};for(let a of Object.keys(t.fieldMetaBase)){let o=t.fieldMetaBase[a],s=n?.fieldMetaBase[a],c=e?.[a],l=yq(t.values,a),u=c?.errors;if(!s||o.errorMap!==s.errorMap){u=Object.values(o.errorMap??{}).filter(e=>e!==void 0);let e=this.getFieldInfo(a)?.instance;(!e||!e.options.disableErrorFlat)&&(u=u.flat(1))}let d=!Oq(u),f=!o.isDirty,p=Mq(l,this.getFieldInfo(a)?.instance?.options.defaultValue??yq(this.options.defaultValues,a));if(c&&c.isPristine===f&&c.isValid===d&&c.isDefaultValue===p&&c.errors===u&&o===s){i[a]=c,r++;continue}i[a]={...o,errors:u??[],isPristine:f,isValid:d,isDefaultValue:p}}return Object.keys(t.fieldMetaBase).length?e&&r===Object.keys(t.fieldMetaBase).length?e:(n=this.baseStore.get(),i):i}),this.formGroupMetaDerived=pq(e=>{let t=this.baseStore.get(),n=this.fieldMetaDerived.get(),r={};for(let i of this.formGroupApis){let a=i.name,o=t.formGroupStateBase[a]??{isSubmitted:!1,isSubmitting:!1,isValidating:!1,submissionAttempts:0,isSubmitSuccessful:!1},s=n[a],c=!1,l=!0,u=!1,d=!1,f=!0,p=!1;for(let e in n){if(e===a||!Hq(a,e))continue;let t=n[e];t&&(t.isValidating&&(c=!0),t.isValid||(l=!1),t.isTouched&&(u=!0),t.isBlurred&&(d=!0),t.isDefaultValue||(f=!1),t.isDirty&&(p=!0))}let m=!p,h=!!c||o.isValidating,g=s?.errorMap??{},_=s?.errorSourceMap??{},v=!!(g.onMount||Object.entries(n).some(([e,t])=>t&&e!==a&&Hq(a,e)&&t.errorMap.onMount)),y=e?.[a],b=y?.errors??[];(!y||y.__srcErrorMap!==g)&&(b=Object.values(g).reduce((e,t)=>{if(t===void 0)return e;if(t&&typeof t==`object`&&`fields`in t){let n=t.group;return n!==void 0&&e.push(n),e}return e.push(t),e},[]));let x=b.length===0,S=l&&x,C=i.options.canSubmitWhenInvalid??!1,w=o.submissionAttempts===0&&!u&&!v||!h&&!o.isSubmitting&&S||C;if(y&&y.errorMap===g&&y.errorSourceMap===_&&y.errors===b&&y.isFieldsValidating===c&&y.isFieldsValid===l&&y.isGroupValid===x&&y.isValid===S&&y.canSubmit===w&&y.isTouched===u&&y.isBlurred===d&&y.isPristine===m&&y.isDefaultValue===f&&y.isDirty===p&&y.isValidating===h&&y.isSubmitting===o.isSubmitting&&y.isSubmitted===o.isSubmitted&&y.submissionAttempts===o.submissionAttempts&&y.isSubmitSuccessful===o.isSubmitSuccessful){r[a]=y;continue}let T={...o,errorMap:g,errorSourceMap:_,_arrayVersion:s?._arrayVersion??0,isTouched:u,isBlurred:d,isDirty:p,isPristine:m,isDefaultValue:f,isValid:S,errors:b,isValidating:h,isFieldsValidating:c,isFieldsValid:l,isGroupValid:x,canSubmit:w};Object.defineProperty(T,"__srcErrorMap",{value:g,enumerable:!1,configurable:!0}),r[a]=T}return r});let r;this.store=pq(e=>{let t=this.baseStore.get(),n=this.fieldMetaDerived.get(),i=Object.values(n).filter(Boolean),a=i.some(e=>e.isValidating),o=i.every(e=>e.isValid),s=i.some(e=>e.isTouched),c=i.some(e=>e.isBlurred),l=i.every(e=>e.isDefaultValue),u=s&&t.errorMap?.onMount,d=i.some(e=>e.isDirty),f=!d,p=!!(t.errorMap?.onMount||i.some(e=>e?.errorMap?.onMount)),m=!!a,h=e?.errors??[];(!r||t.errorMap!==r.errorMap)&&(h=Object.values(t.errorMap).reduce((e,t)=>t===void 0?e:t&&jq(t)?(e.push(t.form),e):(e.push(t),e),[]));let g=h.length===0,_=o&&g,v=this.options.canSubmitWhenInvalid??!1,y=t.submissionAttempts===0&&!s&&!p||!m&&!t.isSubmitting&&_||v,b=t.errorMap;if(u&&(h=h.filter(e=>e!==t.errorMap.onMount),b=Object.assign(b,{onMount:void 0})),e&&r&&e.errorMap===b&&e.fieldMeta===this.fieldMetaDerived.state&&e.errors===h&&e.isFieldsValidating===a&&e.isFieldsValid===o&&e.isFormValid===g&&e.isValid===_&&e.canSubmit===y&&e.isTouched===s&&e.isBlurred===c&&e.isPristine===f&&e.isDefaultValue===l&&e.isDirty===d&&Mq(r,t))return e;let x={...t,errorMap:b,fieldMeta:this.fieldMetaDerived.state,errors:h,isFieldsValidating:a,isFieldsValid:o,isFormValid:g,isValid:_,canSubmit:y,isTouched:s,isBlurred:c,isPristine:f,isDefaultValue:l,isDirty:d};return r=this.baseStore.get(),x}),this.handleSubmit=this.handleSubmit.bind(this),this.update(e||{})}get state(){return this.store.state}get formId(){return this._formId}runValidator(e){return qq(e.validate)?Kq[e.type](e.value,e.validate):e.validate(e.value)}handleSubmit(e){return this._handleSubmit(e)}};function Qq(e){return e?jq(e)?{formError:Qq(e.form).formError,fieldErrors:e.fields}:{formError:e}:{formError:void 0}}function $q(e){switch(e){case`submit`:return`onSubmit`;case`blur`:return`onBlur`;case`mount`:return`onMount`;case`server`:return`onServer`;case`dynamic`:return`onDynamic`;default:return`onChange`}}var eJ=class e{constructor(t){this.options={},this.mount=()=>{this.options.defaultValue!==void 0&&!this.getMeta().isTouched&&this.form.setFieldValue(this.name,this.options.defaultValue,{dontUpdateMeta:!0});let e=this.getInfo();e.instance=this,this.update(this.options);let{onMount:t}=this.options.validators||{};if(t){let e=this.runValidator({validate:t,value:{value:this.state.value,fieldApi:this,validationSource:`field`},type:`validate`});e&&this.setMeta(t=>({...t,errorMap:{...t?.errorMap,onMount:e},errorSourceMap:{...t?.errorSourceMap,onMount:`field`}}))}return this.options.listeners?.onMount?.({value:this.state.value,fieldApi:this}),()=>{for(let[e,t]of Object.entries(this.timeoutIds.validations))t&&(clearTimeout(t),this.timeoutIds.validations[e]=null);for(let[e,t]of Object.entries(this.timeoutIds.listeners))t&&(clearTimeout(t),this.timeoutIds.listeners[e]=null);for(let[e,t]of Object.entries(this.timeoutIds.formListeners))t&&(clearTimeout(t),this.timeoutIds.formListeners[e]=null);let e=this.form.fieldInfo[this.name];if(e&&e.instance===this){for(let[t,n]of Object.entries(e.validationMetaMap))n?.lastAbortController.abort(),e.validationMetaMap[t]=void 0;this.form.baseStore.setState(e=>({...e,fieldMetaBase:{...e.fieldMetaBase,[this.name]:{...Jq,isTouched:e.fieldMetaBase[this.name]?.isTouched??Jq.isTouched,isBlurred:e.fieldMetaBase[this.name]?.isBlurred??Jq.isBlurred,isDirty:e.fieldMetaBase[this.name]?.isDirty??Jq.isDirty}}})),e.instance=null,this.options.listeners?.onUnmount?.({value:this.state.value,fieldApi:this}),this.form.options.listeners?.onFieldUnmount?.({formApi:this.form,fieldApi:this})}}},this.update=e=>{this.options=e,this.name=e.name,!this.state.meta.isTouched&&this.options.defaultValue!==void 0&&(Mq(this.form.getFieldValue(this.name),e.defaultValue)||this.form.setFieldValue(this.name,e.defaultValue,{dontUpdateMeta:!0,dontValidate:!0,dontRunListeners:!0})),this.form.getFieldMeta(this.name)||this.form.setFieldMeta(this.name,this.state.meta)},this.getValue=()=>this.form.getFieldValue(this.name),this.setValue=(e,t)=>{this.form.setFieldValue(this.name,e,Fq(t,{dontRunListeners:!0,dontValidate:!0})),t?.dontRunListeners||this.triggerOnChangeListener(),t?.dontValidate||this.validate(`change`)},this.getMeta=()=>this.store.state.meta,this.setMeta=e=>this.form.setFieldMeta(this.name,e),this.getInfo=()=>this.form.getFieldInfo(this.name),this.pushValue=(e,t)=>{this.form.pushFieldValue(this.name,e,Fq(t,{dontRunListeners:!0})),t?.dontRunListeners||this.triggerOnChangeListener()},this.insertValue=(e,t,n)=>{this.form.insertFieldValue(this.name,e,t,Fq(n,{dontRunListeners:!0})),n?.dontRunListeners||this.triggerOnChangeListener()},this.replaceValue=(e,t,n)=>{this.form.replaceFieldValue(this.name,e,t,Fq(n,{dontRunListeners:!0})),n?.dontRunListeners||this.triggerOnChangeListener()},this.removeValue=(e,t)=>{this.form.removeFieldValue(this.name,e,Fq(t,{dontRunListeners:!0})),t?.dontRunListeners||this.triggerOnChangeListener()},this.swapValues=(e,t,n)=>{this.form.swapFieldValues(this.name,e,t,Fq(n,{dontRunListeners:!0})),n?.dontRunListeners||this.triggerOnChangeListener()},this.moveValue=(e,t,n)=>{this.form.moveFieldValues(this.name,e,t,Fq(n,{dontRunListeners:!0})),n?.dontRunListeners||this.triggerOnChangeListener()},this.clearValues=e=>{this.form.clearFieldValues(this.name,Fq(e,{dontRunListeners:!0})),e?.dontRunListeners||this.triggerOnChangeListener()},this.getLinkedFields=t=>{let n=Object.values(this.form.fieldInfo),r=[];for(let i of n){if(!i.instance||!(i.instance instanceof e))continue;let{onChangeListenTo:n,onBlurListenTo:a}=i.instance.options.validators||{};t===`change`&&n?.includes(this.name)&&r.push(i.instance),t===`blur`&&a?.includes(this.name)&&r.push(i.instance)}return r},this.validateSync=(e,t)=>{let n=kq(e,{...this.options,form:this.form,fieldName:this.name,validationLogic:this.form.options.validationLogic||Uq}),r=this.getLinkedFields(e).reduce((t,n)=>{let r=kq(e,{...n.options,form:n.form,fieldName:n.name,validationLogic:n.form.options.validationLogic||Uq});return r.forEach(e=>{e.field=n}),t.concat(r)},[]),i=!1;oq(()=>{let e=(e,n)=>{let r=nJ(n.cause),a=n.validate?tJ(e.runValidator({validate:n.validate,value:{value:e.store.state.value,validationSource:`field`,fieldApi:e},type:`validate`})):void 0,o=t[r],{newErrorValue:s,newSource:c}=Pq({formLevelError:o,fieldLevelError:a});e.state.meta.errorMap?.[r]!==s&&e.setMeta(e=>({...e,errorMap:{...e.errorMap,[r]:s},errorSourceMap:{...e.errorSourceMap,[r]:c}})),s&&(i=!0)};for(let t of n)e(this,t);for(let t of r)t.validate&&e(t.field,t)});let a=nJ(`submit`);return this.state.meta.errorMap?.[a]&&e!==`submit`&&!i&&this.setMeta(e=>({...e,errorMap:{...e.errorMap,[a]:void 0},errorSourceMap:{...e.errorSourceMap,[a]:void 0}})),{hasErrored:i}},this.validateAsync=async(e,t)=>{let n=Aq(e,{...this.options,form:this.form,fieldName:this.name,validationLogic:this.form.options.validationLogic||Uq}),r=await t,i=this.getLinkedFields(e).reduce((t,n)=>{let r=Aq(e,{...n.options,form:n.form,fieldName:n.name,validationLogic:n.form.options.validationLogic||Uq});return r.forEach(e=>{e.field=n}),t.concat(r)},[]),a=[],o=[],s=n.some(e=>e.validate),c=Array.from(new Set(i.filter(e=>e.validate).map(e=>e.field)));oq(()=>{s&&this.startValidation();for(let e of c)e.startValidation()});let l=(e,t,n)=>{let i=nJ(t.cause),a=e.getInfo();a.validationMetaMap[i]?.lastAbortController.abort();let o=new AbortController;a.validationMetaMap[i]={lastAbortController:o},n.push(new Promise(async n=>{let a;try{a=await new Promise((n,r)=>{e.timeoutIds.validations[t.cause]&&(clearTimeout(e.timeoutIds.validations[t.cause]),e.endValidation()),e.timeoutIds.validations[t.cause]=setTimeout(async()=>{if(o.signal.aborted)return n(void 0);try{n(await this.runValidator({validate:t.validate,value:{value:e.store.state.value,fieldApi:e,signal:o.signal,validationSource:`field`},type:`validateAsync`}))}catch(e){r(e)}},t.debounceMs)})}catch(e){a=e}if(o.signal.aborted)return n(void 0);let s=tJ(a),c=r[e.name]?.[i],{newErrorValue:l,newSource:u}=Pq({formLevelError:c,fieldLevelError:s});if(e.getInfo().instance!==e)return n(void 0);e.setMeta(e=>({...e,errorMap:{...e?.errorMap,[i]:l},errorSourceMap:{...e.errorSourceMap,[i]:u}})),n(l)}))};for(let e of n)e.validate&&l(this,e,a);for(let e of i)e.validate&&l(e.field,e,o);let u=[];return(a.length||o.length)&&(u=await Promise.all(a),await Promise.all(o)),oq(()=>{s&&this.endValidation();for(let e of c)e.endValidation()}),u.filter(Boolean)},this.validate=(e,t)=>{if(!this.state.meta.isTouched)return[];let n=t?.skipGroupValidation?[]:Array.from(this.form.formGroupApis).filter(e=>this.name.startsWith(e.name)),r=(t?.skipFormValidation?{fieldsErrorMap:{}}:this.form.validateSync(e)).fieldsErrorMap[this.name]??{};if(!t?.skipFormValidation)for(let t of n){if(t.state.meta.submissionAttempts===0)continue;let{fieldsErrorMap:n}=this.form.validateSync(e,{group:t,dontUpdateFormErrorMap:!0,filterFieldNames:e=>Hq(t.name,e)});r={...r,...n[this.name]??{}}}let{hasErrored:i}=this.validateSync(e,r),a=new WeakMap;for(let t of n){let{hasErrored:n}=t.validateSync(e,{},{skipRelatedFieldValidation:!0});a.set(t,n)}if(i&&!this.options.asyncAlways){this.getInfo().validationMetaMap[nJ(e)]?.lastAbortController.abort();let t=[];for(let r of n)r.getInfo().validationMetaMap[nJ(e)]?.lastAbortController.abort(),t.push(r.state.meta.errors);return[...this.state.meta.errors,...t.flat()]}let o=t?.skipFormValidation?Promise.resolve({}):this.form.validateAsync(e),s=this.validateAsync(e,o),c=[];for(let t of n)a.get(t)&&!t.options.asyncAlways||c.push(t.validateAsync(e,o,{skipRelatedFieldValidation:!0}));return c.length===0?s:Promise.all([s,...c]).then(e=>e.flat())},this.handleChange=e=>{this.setValue(e)},this.handleBlur=()=>{this.state.meta.isTouched||this.setMeta(e=>({...e,isTouched:!0})),this.state.meta.isBlurred||this.setMeta(e=>({...e,isBlurred:!0})),this.validate(`blur`),this.triggerOnBlurListener()},this.setErrorMap=e=>{this.setMeta(t=>({...t,errorMap:{...t.errorMap,...e}}))},this.parseValueWithSchema=e=>Kq.validate({value:this.state.value,validationSource:`field`},e),this.parseValueWithSchemaAsync=e=>Kq.validateAsync({value:this.state.value,validationSource:`field`},e),this.triggerOnBlurListener=()=>{let e=this.form.options.listeners?.onBlurDebounceMs;e&&e>0?(this.timeoutIds.formListeners.blur&&clearTimeout(this.timeoutIds.formListeners.blur),this.timeoutIds.formListeners.blur=setTimeout(()=>{this.form.options.listeners?.onBlur?.({formApi:this.form,fieldApi:this})},e)):this.form.options.listeners?.onBlur?.({formApi:this.form,fieldApi:this});let t=this.options.listeners?.onBlurDebounceMs;t&&t>0?(this.timeoutIds.listeners.blur&&clearTimeout(this.timeoutIds.listeners.blur),this.timeoutIds.listeners.blur=setTimeout(()=>{this.options.listeners?.onBlur?.({value:this.state.value,fieldApi:this})},t)):this.options.listeners?.onBlur?.({value:this.state.value,fieldApi:this})},this.triggerOnChangeListener=()=>{let e=this.form.options.listeners?.onChangeDebounceMs;e&&e>0?(this.timeoutIds.formListeners.change&&clearTimeout(this.timeoutIds.formListeners.change),this.timeoutIds.formListeners.change=setTimeout(()=>{this.form.options.listeners?.onChange?.({formApi:this.form,fieldApi:this})},e)):this.form.options.listeners?.onChange?.({formApi:this.form,fieldApi:this});let t=this.options.listeners?.onChangeDebounceMs;t&&t>0?(this.timeoutIds.listeners.change&&clearTimeout(this.timeoutIds.listeners.change),this.timeoutIds.listeners.change=setTimeout(()=>{this.options.listeners?.onChange?.({value:this.state.value,fieldApi:this})},t)):this.options.listeners?.onChange?.({value:this.state.value,fieldApi:this});for(let e of this.form.formGroupApis)Hq(e.name,this.name)&&e.triggerOnChangeListener()},this.triggerOnSubmitListener=()=>{this.options.listeners?.onSubmit?.({value:this.state.value,fieldApi:this})},this.form=t.form,this.name=t.name,this.options=t,this.timeoutIds={validations:{},listeners:{},formListeners:{}},this.store=pq(e=>{this.form.store.get();let n=this.form.getFieldMeta(this.name)??{...Jq,...t.defaultMeta},r=this.form.getFieldValue(this.name);return!n.isTouched&&r===void 0&&this.options.defaultValue!==void 0&&!Mq(r,this.options.defaultValue)&&(r=this.options.defaultValue),e&&e.value===r&&e.meta===n?e:{value:r,meta:n}})}get state(){return this.store.state}runValidator(e){return qq(e.validate)?Kq[e.type](e.value,e.validate):e.validate(e.value)}startValidation(){this.setMeta(e=>{let t=e._pendingValidationsCount+1;return{...e,_pendingValidationsCount:t,isValidating:t>0&&!e.isValidating||e.isValidating}})}endValidation(){this.setMeta(e=>{let t=Math.max(0,e._pendingValidationsCount-1);return{...e,_pendingValidationsCount:t,isValidating:t===0&&e.isValidating?!1:e.isValidating}})}};function tJ(e){if(e)return e}function nJ(e){switch(e){case`submit`:return`onSubmit`;case`blur`:return`onBlur`;case`mount`:return`onMount`;case`server`:return`onServer`;case`dynamic`:return`onDynamic`;default:return`onChange`}}function rJ(e){return{isSubmitted:e.isSubmitted??!1,isSubmitting:e.isSubmitting??!1,isValidating:e.isValidating??!1,submissionAttempts:e.submissionAttempts??0,isSubmitSuccessful:e.isSubmitSuccessful??!1}}function iJ(e){return{...Jq,...e,errors:[],isPristine:!0,isValid:!0,isDefaultValue:!0,isFieldsValidating:!1,isFieldsValid:!0,isGroupValid:!0,canSubmit:!0,isSubmitting:!1,isSubmitted:!1,isValidating:!1,submissionAttempts:0,isSubmitSuccessful:!1}}var aJ=class e{constructor(t){this.options={},this.setFormGroupState=e=>{this.form.baseStore.setState(t=>{let n=t.formGroupStateBase[this.name]??rJ({});return{...t,formGroupStateBase:{...t.formGroupStateBase,[this.name]:e(n)}}})},this._lastDistributedFieldNames={},this.update=e=>{this.options=e,this.name=e.name,!this.state.meta.isTouched&&this.options.defaultValue!==void 0&&(Mq(this.form.getFieldValue(this.name),e.defaultValue)||this.form.setFieldValue(this.name,e.defaultValue,{dontUpdateMeta:!0,dontValidate:!0,dontRunListeners:!0})),this.form.getFieldMeta(this.name)||this.form.setFieldMeta(this.name,{...Jq,...this.options.defaultMeta})},this.mount=()=>{this.update(this.options),this.form.formGroupApis.add(this),this.fieldInfo.instance=this,this.form.baseStore.setState(e=>({...e,formGroupStateBase:{...e.formGroupStateBase,[this.name]:e.formGroupStateBase[this.name]??rJ({...this.options.defaultState})}}));let{onMount:e}=this.options.validators||{};if(e){let t=this.runValidator({validate:e,value:{value:this.state.value,groupApi:this,validationSource:`form`},type:`validate`}),n=t,r;sJ(t)&&(n=t.group,r=t.fields);let i=oJ(n);i&&this.setMeta(e=>({...e,errorMap:{...e.errorMap,onMount:i},errorSourceMap:{...e.errorSourceMap,onMount:`field`}})),this.distributeFieldErrors(`onMount`,r)}return this.options.listeners?.onMount?.({value:this.state.value,groupApi:this}),()=>{for(let[e,t]of Object.entries(this.timeoutIds.validations))t&&(clearTimeout(t),this.timeoutIds.validations[e]=null);for(let[e,t]of Object.entries(this.timeoutIds.listeners))t&&(clearTimeout(t),this.timeoutIds.listeners[e]=null);for(let[e,t]of Object.entries(this.timeoutIds.formListeners))t&&(clearTimeout(t),this.timeoutIds.formListeners[e]=null);if(this.fieldInfo.instance===this){for(let[e,t]of Object.entries(this.fieldInfo.validationMetaMap))t?.lastAbortController.abort(),this.fieldInfo.validationMetaMap[e]=void 0;this.form.formGroupApis.delete(this),this.form.baseStore.setState(e=>({...e,formGroupStateBase:{...e.formGroupStateBase,[this.name]:rJ({})}})),this.fieldInfo.instance=null,this.options.listeners?.onUnmount?.({value:this.state.value,groupApi:this})}}},this.setValue=(e,t)=>{this.form.setFieldValue(this.name,e,Fq(t,{dontRunListeners:!0,dontValidate:!0})),t?.dontRunListeners||this.triggerOnChangeListener(),t?.dontValidate||this.validate(`change`)},this.getMeta=()=>this.store.state.meta,this.setMeta=e=>this.form.setFieldMeta(this.name,e),this.getInfo=()=>this.fieldInfo,this.getRelatedFields=()=>{let e=Object.values(this.form.fieldInfo),t=[];for(let n of e)n.instance&&n.instance instanceof eJ&&n.instance.name.startsWith(this.name)&&t.push(n.instance);return t},this.getRelatedFieldMetasDerived=()=>{let e=Object.entries(this.form.fieldMetaDerived.state),t=[];for(let[n,r]of e)n!==this.name&&Hq(this.name,n)&&t.push({...r,name:n});return t},this.buildChildFieldName=e=>e===``?this.name:e.startsWith(`[`)?`${this.name}${e}`:`${this.name}.${e}`,this.distributeFieldErrors=(e,t)=>{let n=this._lastDistributedFieldNames[e]??new Set,r=new Set;if(t)for(let[e,n]of Object.entries(t))n!=null&&n!==!1&&r.add(this.buildChildFieldName(e));let i=new Set([...n,...r]),a=!1;for(let n of i){let r=n.startsWith(this.name+`[`)?n.slice(this.name.length):n.slice(this.name.length+1),i=t?.[r],o=this.form.getFieldMeta(n);if(!o&&!i)continue;let s=o?.errorMap[e],{newErrorValue:c,newSource:l}=Nq({newFormValidatorError:i,isPreviousErrorFromFormValidator:o?.errorSourceMap[e]===`form`,previousErrorValue:s});c&&(a=!0),(s!==c||o?.errorSourceMap[e]!==l)&&this.form.setFieldMeta(n,(t=Jq)=>({...t,errorMap:{...t.errorMap,[e]:c},errorSourceMap:{...t.errorSourceMap,[e]:l}}))}return this._lastDistributedFieldNames[e]=r,a},this.validateSync=(t,n,r={})=>{let i=kq(t,{...this.options,form:this.form,group:this,validationLogic:this.options.validationLogic||this.form.options.validationLogic||Uq}),a=(r.skipRelatedFieldValidation?[]:this.getRelatedFields()).reduce((e,n)=>{let r=kq(t,{...n.options,form:n.form,validationLogic:n.form.options.validationLogic||Uq});return r.forEach(e=>{e.field=n}),e.concat(r)},[]),o=!1;oq(()=>{let t=(t,r)=>{let i=lJ(r.cause),a=t===this,s;r.validate&&(s=t.runValidator({validate:r.validate,value:{value:t.store.state.value,validationSource:a?`form`:`field`,...t instanceof e?{groupApi:t}:{fieldApi:t}},type:`validate`}));let c=s,l;a&&sJ(s)&&(c=s.group,l=s.fields);let u=oJ(c),d=n[i],{newErrorValue:f,newSource:p}=Pq({formLevelError:d,fieldLevelError:u});t.state.meta.errorMap?.[i]!==f&&t.setMeta(e=>({...e,errorMap:{...e.errorMap,[i]:f},errorSourceMap:{...e.errorSourceMap,[i]:p}})),f&&(o=!0),a&&this.distributeFieldErrors(i,l)&&(o=!0)};for(let e of i)t(this,e);for(let e of a)e.validate&&t(e.field,e)});let s=lJ(`submit`);return this.state.meta.errorMap?.[s]&&t!==`submit`&&!o&&this.setMeta(e=>({...e,errorMap:{...e.errorMap,[s]:void 0},errorSourceMap:{...e.errorSourceMap,[s]:void 0}})),{hasErrored:o}},this.validateAsync=async(t,n,r={})=>{let i=Aq(t,{...this.options,form:this.form,group:this,validationLogic:this.options.validationLogic||this.form.options.validationLogic||Uq}),a=await n,o=r.skipRelatedFieldValidation?[]:this.getRelatedFields(),s=o.reduce((e,n)=>{let r=Aq(t,{...n.options,form:n.form,validationLogic:n.form.options.validationLogic||Uq});return r.forEach(e=>{e.field=n}),e.concat(r)},[]),c=[],l=[],u=i.some(e=>e.validate)||s.some(e=>e.validate);if(u){this.state.meta.isValidating||this.setMeta(e=>({...e,isValidating:!0}));for(let e of o)e.setMeta(e=>({...e,isValidating:!0}))}let d=(t,n,r)=>{let i=lJ(n.cause),o=t.getInfo();o.validationMetaMap[i]?.lastAbortController.abort();let s=new AbortController;o.validationMetaMap[i]={lastAbortController:s};let c=t===this;r.push(new Promise(async r=>{let o;try{o=await new Promise((r,i)=>{t.timeoutIds.validations[n.cause]&&clearTimeout(t.timeoutIds.validations[n.cause]),t.timeoutIds.validations[n.cause]=setTimeout(async()=>{if(s.signal.aborted)return r(void 0);try{r(await this.runValidator({validate:n.validate,value:{value:t.store.state.value,signal:s.signal,validationSource:c?`form`:`field`,...t instanceof e?{groupApi:t}:{fieldApi:t}},type:`validateAsync`}))}catch(e){i(e)}},n.debounceMs)})}catch(e){o=e}if(s.signal.aborted)return r(void 0);let l=o,u;c&&sJ(o)&&(l=o.group,u=o.fields);let d=oJ(l),f=a[t.name]?.[i],{newErrorValue:p,newSource:m}=Pq({formLevelError:f,fieldLevelError:d});if(t.getInfo().instance!==t)return r(void 0);t.setMeta(e=>({...e,errorMap:{...e?.errorMap,[i]:p},errorSourceMap:{...e.errorSourceMap,[i]:m}})),c&&this.distributeFieldErrors(i,u),r(p)}))};for(let e of i)e.validate&&d(this,e,c);for(let e of s)e.validate&&d(e.field,e,l);let f=[];if((c.length||l.length)&&(f=await Promise.all(c),await Promise.all(l)),u){this.setMeta(e=>({...e,isValidating:!1}));for(let e of o)e.setMeta(e=>({...e,isValidating:!1}))}return f.filter(Boolean)},this.validateAllFields=async e=>{let t=[];return oq(()=>{Object.values(this.getRelatedFields()).forEach(n=>{t.push(Promise.resolve().then(()=>n.validate(e,{skipFormValidation:!0,skipGroupValidation:!0}))),n.store.state.meta.isTouched||n.setMeta(e=>({...e,isTouched:!0}))})}),(await Promise.all(t)).flat()},this.validateArrayFieldsStartingFrom=(e,t,n)=>this.form.validateArrayFieldsStartingFrom(e,t,n),this.validateField=(e,t)=>this.form.validateField(e,t),this.getFieldValue=e=>this.form.getFieldValue(e),this.getFieldMeta=e=>this.form.getFieldMeta(e),this.setFieldMeta=(e,t)=>this.form.setFieldMeta(e,t),this.setFieldValue=(e,t)=>this.form.setFieldValue(e,t),this.deleteField=e=>this.form.deleteField(e),this.pushFieldValue=(e,t)=>this.form.pushFieldValue(e,t),this.insertFieldValue=(e,t,n)=>this.form.insertFieldValue(e,t,n),this.replaceFieldValue=(e,t,n)=>this.form.replaceFieldValue(e,t,n),this.swapFieldValues=(e,t,n)=>this.form.swapFieldValues(e,t,n),this.moveFieldValues=(e,t,n)=>this.form.moveFieldValues(e,t,n),this.clearFieldValues=e=>this.form.clearFieldValues(e),this.resetField=e=>this.form.resetField(e),this.removeFieldValue=(e,t)=>this.form.removeFieldValue(e,t),this.areRelatedFieldsValid=()=>Object.values(this.getRelatedFields()).every(e=>e.state.meta.isValid),this.validate=(e,t)=>{let{fieldsErrorMap:n}=t?.skipFormValidation?{fieldsErrorMap:{}}:this.form.validateSync(e,{dontUpdateFormErrorMap:!0,filterFieldNames:e=>Hq(this.name,e)}),{hasErrored:r}=this.validateSync(e,n[this.name]??{},{skipRelatedFieldValidation:t?.skipRelatedFieldValidation});if(r&&!this.options.asyncAlways)return this.getInfo().validationMetaMap[lJ(e)]?.lastAbortController.abort(),this.state.meta.errors;let i=t?.skipFormValidation?Promise.resolve({}):this.form.validateAsync(e,{dontUpdateFormErrorMap:!0,filterFieldNames:e=>Hq(this.name,e)});return this.validateAsync(e,i,{skipRelatedFieldValidation:t?.skipRelatedFieldValidation})},this.triggerOnChangeListener=()=>{let e=this.form.options.listeners?.onChangeGroupDebounceMs;e&&e>0?(this.timeoutIds.formListeners.change&&clearTimeout(this.timeoutIds.formListeners.change),this.timeoutIds.formListeners.change=setTimeout(()=>{this.form.options.listeners?.onChangeGroup?.({formApi:this.form,groupApi:this})},e)):this.form.options.listeners?.onChangeGroup?.({formApi:this.form,groupApi:this});let t=this.options.listeners?.onChangeDebounceMs;t&&t>0?(this.timeoutIds.listeners.change&&clearTimeout(this.timeoutIds.listeners.change),this.timeoutIds.listeners.change=setTimeout(()=>{this.options.listeners?.onChange?.({value:this.state.value,groupApi:this})},t)):this.options.listeners?.onChange?.({value:this.state.value,groupApi:this})},this.triggerOnSubmitListener=()=>{this.options.listeners?.onSubmit?.({value:this.state.value,groupApi:this})},this._handleSubmit=async e=>{this.setFormGroupState(e=>({...e,isSubmitted:!1,submissionAttempts:e.submissionAttempts+1,isSubmitSuccessful:!1})),oq(()=>{Object.values(this.getRelatedFields()).forEach(e=>{e.state.meta.isTouched||e.setMeta(e=>({...e,isTouched:!0}))})});let t=e??this.options.onSubmitMeta;this.setFormGroupState(e=>({...e,isSubmitting:!0}));let n=()=>{this.setFormGroupState(e=>({...e,isSubmitting:!1}))};if(await this.validateAllFields(`submit`),!this.areRelatedFieldsValid()){n(),this.options.onGroupSubmitInvalid?.({value:this.state.value,groupApi:this,meta:t});return}if(await this.validate(`submit`,{skipRelatedFieldValidation:!0}),!this.areRelatedFieldsValid()||!this.state.meta.isValid){n(),this.options.onGroupSubmitInvalid?.({value:this.state.value,groupApi:this,meta:t});return}oq(()=>{Object.values(this.getRelatedFields()).forEach(e=>{e.options.listeners?.onGroupSubmit?.({value:e.state.value,fieldApi:e})})}),this.options.listeners?.onSubmit?.({groupApi:this,value:this.state.value});try{await this.options.onGroupSubmit?.({value:this.state.value,groupApi:this,meta:t}),oq(()=>{this.setFormGroupState(e=>({...e,isSubmitted:!0,isSubmitSuccessful:!0})),n()})}catch(e){throw this.setFormGroupState(e=>({...e,isSubmitSuccessful:!1})),n(),e}},this.form=t.form,this.name=t.name,this.options=t,this.timeoutIds={validations:{},listeners:{},formListeners:{}},this.fieldInfo={instance:null,validationMetaMap:{onChange:void 0,onBlur:void 0,onSubmit:void 0,onMount:void 0,onServer:void 0,onDynamic:void 0}},this.store=pq(e=>{this.form.formGroupMetaDerived.get(),this.form.baseStore.get();let n=this.form.getFormGroupMeta(this.name)??iJ(t.defaultMeta),r=this.form.getFieldValue(this.name);return!n.isTouched&&r===void 0&&this.options.defaultValue!==void 0&&!Mq(r,this.options.defaultValue)&&(r=this.options.defaultValue),e&&e.value===r&&e.meta===n?e:{value:r,meta:n}}),this.handleSubmit=this.handleSubmit.bind(this)}get state(){return this.store.state}runValidator(e){if(qq(e.validate)){let t=Kq[e.type](e.value,e.validate);return e.type===`validate`?cJ(t):t.then(cJ)}return e.validate(e.value)}handleSubmit(e){return this._handleSubmit(e)}};function oJ(e){if(e)return e}function sJ(e){return!!e&&typeof e==`object`&&`fields`in e}function cJ(e){if(!e||typeof e!=`object`||!(`form`in e)&&!(`fields`in e))return e;let{form:t,fields:n,...r}=e;return{...r,group:t,fields:n}}function lJ(e){switch(e){case`submit`:return`onSubmit`;case`blur`:return`onBlur`;case`mount`:return`onMount`;case`server`:return`onServer`;case`dynamic`:return`onDynamic`;default:return`onChange`}}function uJ(e,t){if(!t)return;let n=Object.assign({},e,{state:Vq(e.state)});t(n),n.fieldInfo!==e.fieldInfo&&(e.fieldInfo=n.fieldInfo),n.options!==e.options&&(e.options=n.options);let r=Object.keys({values:null,validationMetaMap:null,fieldMetaBase:null,formGroupStateBase:null,isSubmitting:null,isSubmitted:null,isValidating:null,submissionAttempts:null,isSubmitSuccessful:null,_force_re_eval:null}).reduce((t,r)=>(e.state[r]!==n.state[r]&&(t[r]=n.state[r]),t),{});return oq(()=>{Object.keys(r).length&&e.baseStore.setState(e=>({...e,...r})),n.state.errorMap!==e.state.errorMap&&e.setErrorMap(n.state.errorMap)}),n}var dJ=o((e=>{var t=d();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,i=t.useState,a=t.useEffect,o=t.useLayoutEffect,s=t.useDebugValue;function c(e,t){var n=t(),r=i({inst:{value:n,getSnapshot:t}}),c=r[0].inst,u=r[1];return o(function(){c.value=n,c.getSnapshot=t,l(c)&&u({inst:c})},[e,n,t]),a(function(){return l(c)&&u({inst:c}),e(function(){l(c)&&u({inst:c})})},[e]),s(n),n}function l(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!r(e,n)}catch{return!0}}function u(e,t){return t()}var f=typeof window>`u`||window.document===void 0||window.document.createElement===void 0?u:c;e.useSyncExternalStore=t.useSyncExternalStore===void 0?f:t.useSyncExternalStore})),fJ=o(((e,t)=>{t.exports=dJ()})),pJ=o((e=>{var t=d(),n=fJ();function r(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var i=typeof Object.is==`function`?Object.is:r,a=n.useSyncExternalStore,o=t.useRef,s=t.useEffect,c=t.useMemo,l=t.useDebugValue;e.useSyncExternalStoreWithSelector=function(e,t,n,r,u){var d=o(null);if(d.current===null){var f={hasValue:!1,value:null};d.current=f}else f=d.current;d=c(function(){function e(e){if(!a){if(a=!0,o=e,e=r(e),u!==void 0&&f.hasValue){var t=f.value;if(u(t,e))return s=t}return s=e}if(t=s,i(o,e))return t;var n=r(e);return u!==void 0&&u(t,n)?(o=e,t):(o=e,s=n)}var a=!1,o,s,c=n===void 0?null:n;return[function(){return e(t())},c===null?void 0:function(){return e(c())}]},[t,n,r,u]);var p=a(e,d[0],d[1]);return s(function(){f.hasValue=!0,f.value=p},[p]),l(p),p}})),mJ=o(((e,t)=>{t.exports=pJ()}))();function hJ(e,t){return e===t}function gJ(e,t=e=>e,n){let r=n?.compare??hJ,i=(0,G.useCallback)(t=>{let{unsubscribe:n}=e.subscribe(t);return n},[e]),a=(0,G.useCallback)(()=>e.get(),[e]);return(0,mJ.useSyncExternalStoreWithSelector)(i,a,a,t,r)}var _J=typeof window<`u`?G.useLayoutEffect:G.useEffect;function vJ(e){let[t,n]=(0,G.useState)(()=>({form:e.form,name:e.name})),[r,i]=(0,G.useState)(()=>new eJ({...e})),a=r;(t.form!==e.form||t.name!==e.name)&&(a=new eJ({...e}),i(a),n({form:e.form,name:e.name}));let o=gJ(a.store,e.mode===`array`?e=>e.meta._arrayVersion||0:e=>e.value),s=gJ(a.store,e=>e.meta.isTouched),c=gJ(a.store,e=>e.meta.isBlurred),l=gJ(a.store,e=>e.meta.isDirty),u=gJ(a.store,e=>e.meta.errorMap),d=gJ(a.store,e=>e.meta.errorSourceMap),f=gJ(a.store,e=>e.meta.isValidating),p=(0,G.useMemo)(()=>({...a,get state(){return{value:e.mode===`array`?a.state.value:o,get meta(){return{...a.state.meta,isTouched:s,isBlurred:c,isDirty:l,errorMap:u,errorSourceMap:d,isValidating:f}}}}}),[a,e.mode,o,s,c,l,u,d,f]);return _J(a.mount,[a]),_J(()=>{a.update(e)}),p}var yJ=(({children:e,...t})=>{let n=vJ(t),r=(0,G.useMemo)(()=>vq(e,n),[e,n]);return(0,Z.jsx)(Z.Fragment,{children:r})});function bJ(){return(0,G.useState)(()=>zq())[0]}var xJ=G,SJ=`18.3.1`.split(`.`)[0]===`17`?bJ:xJ.useId;function CJ(e){let[t,n]=(0,G.useState)(()=>({form:e.form,name:e.name})),[r,i]=(0,G.useState)(()=>new aJ({...e}));(t.form!==e.form||t.name!==e.name)&&(i(new aJ({...e})),n({form:e.form,name:e.name}));let a=gJ(r.store,e=>e.value),o=gJ(r.store,e=>e.meta.isTouched),s=gJ(r.store,e=>e.meta.isBlurred),c=gJ(r.store,e=>e.meta.isDirty),l=gJ(r.store,e=>e.meta.errorMap),u=gJ(r.store,e=>e.meta.errorSourceMap),d=gJ(r.store,e=>e.meta.isValidating),f=gJ(r.store,e=>e.meta.isSubmitting),p=gJ(r.store,e=>e.meta.isSubmitted),m=gJ(r.store,e=>e.meta.submissionAttempts),h=gJ(r.store,e=>e.meta.isSubmitSuccessful),g=gJ(r.store,e=>e.meta.canSubmit),_=gJ(r.store,e=>e.meta.isValid),v=gJ(r.store,e=>e.meta.isFieldsValid),y=gJ(r.store,e=>e.meta.isFieldsValidating),b=gJ(r.store,e=>e.meta.isGroupValid),x=(0,G.useMemo)(()=>({...r,handleSubmit:((...e)=>r._handleSubmit(...e)),get state(){return{...r.state,value:a,get meta(){return{...r.state.meta,isTouched:o,isBlurred:s,isDirty:c,errorMap:l,errorSourceMap:u,isValidating:d,isSubmitting:f,isSubmitted:p,submissionAttempts:m,isSubmitSuccessful:h,canSubmit:g,isValid:_,isFieldsValid:v,isFieldsValidating:y,isGroupValid:b}}}}}),[r,a,o,s,c,l,u,d,f,p,m,h,g,_,v,y,b]);return _J(r.mount,[r]),_J(()=>{r.update(e)}),x}var wJ=(({children:e,...t})=>{let n=CJ(t),r=(0,G.useMemo)(()=>vq(e,n),[e,n]);return(0,Z.jsx)(Z.Fragment,{children:r})});function TJ({form:e,selector:t=e=>e,children:n}){let r=gJ(e.store,t);return(0,Z.jsx)(Z.Fragment,{children:vq(n,r)})}function EJ(e){let t=SJ(),[n,r]=(0,G.useState)(e?.formId),[i,a]=(0,G.useState)(()=>new Zq({...e,formId:e?.formId??t}));if(n!==e?.formId){let n=e?.formId??t;a(new Zq({...e,formId:n})),r(n)}let o=(0,G.useMemo)(()=>{let e={...i,handleSubmit:((...e)=>i._handleSubmit(...e)),get formId(){return i._formId},get state(){return i.store.state}};return e.Field=function(e){return(0,Z.jsx)(yJ,{...e,form:i})},e.FormGroup=function(e){return(0,Z.jsx)(wJ,{...e,form:i})},e.Subscribe=function(e){return(0,Z.jsx)(TJ,{form:i,selector:e.selector,children:e.children})},e},[i]);_J(i.mount,[]),_J(()=>{i.update(e)});let s=(0,G.useRef)(!1);return _J(()=>{s.current&&e?.transform&&uJ(i,e.transform)},[i,e?.transform]),_J(()=>{s.current=!0}),o}var DJ=`disabled:bg-base-200 disabled:text-base-content disabled:outline-1 disabled:outline-solid disabled:outline-base-content/25 aria-disabled:bg-base-200 aria-disabled:text-base-content aria-disabled:outline-1 aria-disabled:outline-solid aria-disabled:outline-base-content/25`,OJ=aL(`btn caps-button disabled:pointer-events-none`,{variants:{variant:{primary:`btn-primary caps-button-filled`,secondary:`btn-secondary caps-button-filled`,accent:`btn-accent caps-button-filled`,destructive:`btn-error caps-button-filled`,outline:`btn-outline ${DJ}`,ghost:`btn-ghost`,"ghost-destructive":`btn-ghost caps-button-ghost-destructive`,link:`btn-link ${DJ}`},size:{xs:`btn-xs`,sm:`btn-sm`,default:`btn-md`,lg:`btn-lg`,icon:`btn-square btn-md`,menubar:`caps-button-menubar`}},defaultVariants:{variant:`primary`,size:`default`}}),kJ=(0,G.forwardRef)(function({asChild:e=!1,children:t,className:n,disabled:r,loading:i=!1,result:a,resultLabel:o,onResultEnd:s,size:c=`default`,variant:l=`primary`,...u},d){let f=Q(OJ({size:c,variant:l}),n),p=(0,G.useRef)(a).current,m=(0,G.useRef)(null);return(0,G.useImperativeHandle)(d,()=>m.current),AJ(m,i,a),e?(0,Z.jsx)(PR,{...u,"aria-busy":i?!0:u[`aria-busy`],"aria-disabled":r===!0||i?!0:void 0,className:f,ref:m,children:t}):(0,Z.jsx)(`button`,{...u,"aria-busy":i?!0:u[`aria-busy`],className:f,disabled:r===!0||i,ref:m,type:u.type??`button`,children:a===void 0&&o===void 0?(0,Z.jsxs)(Z.Fragment,{children:[i?(0,Z.jsx)(lH,{decorative:!0,size:`sm`,tone:`current`,variant:`wander`}):null,t]}):(0,Z.jsx)(FJ,{label:o,loading:i,onResultEnd:s,result:a,settled:p,children:t})})});function AJ(e,t,n){let r=(0,G.useRef)(null),i=(0,G.useRef)(null),a=(0,G.useRef)(null);(0,G.useLayoutEffect)(()=>{let o=e.current;if(!o)return;let s=JSON.stringify([t,n??null,o.textContent]),c=s!==i.current;i.current=s;let l=a.current;if(!c&&l)return;let u=l?o.offsetWidth:r.current;l&&(a.current=null,l.cancel(),o.style.removeProperty(`overflow`),o.style.removeProperty(`white-space`));let d=o.offsetWidth;if(r.current=d>0?d:null,!c||u===null||d===0||Math.abs(u-d)<1||!JR(o))return;let f=BR(o);if(f.reduced)return;let p=o.animate([{width:`${String(u)}px`},{width:`${String(d)}px`}],{duration:f.normal,easing:qR(f,f.ease)});a.current=p,o.style.overflow=`clip`,o.style.whiteSpace=`nowrap`;let m=()=>{a.current===p&&(a.current=null,o.style.removeProperty(`overflow`),o.style.removeProperty(`white-space`))};p.onfinish=m,p.oncancel=m})}var jJ=1100;function MJ(e,t){let n=t.bounce/.3,r=1+.05*Math.min(1.4,.4+n),i=1-.02*Math.min(1.4,n);return e.animate([{transform:`scale(1)`},{transform:`scale(${String(r)})`,offset:.35},{transform:`scale(${String(i)})`,offset:.7},{transform:`scale(1)`}],{duration:t.springDuration,easing:qR(t,`ease-out`)})}function NJ(e,t){let n=t.shake;return e.animate([{transform:`none`},{transform:`translateX(${String(-n)}px)`},{transform:`translateX(${String(n)}px)`},{transform:`translateX(${String(-n*.6)}px)`},{transform:`translateX(${String(n*.3)}px)`},{transform:`none`}],{duration:t.slow*1.3,easing:qR(t,`linear`)})}function PJ(e,t,n){let r=n.distance+2,i=`blur(${String(n.blur)}px)`;return[e.animate([{opacity:1,transform:`none`,filter:`blur(0px)`},{opacity:0,transform:`translateY(${String(-r)}px)`,filter:i}],{duration:n.fast,easing:qR(n,n.ease)}),t.animate([{opacity:0,transform:`translateY(${String(r)}px)`,filter:i},{opacity:1,transform:`none`,filter:`blur(0px)`}],{duration:n.normal,easing:qR(n,n.ease),fill:`backwards`})]}function FJ({children:e,label:t,loading:n,onResultEnd:r,result:i,settled:a}){let o=(0,G.useRef)(null),s=$R(),[c,l]=(0,G.useState)(!1),[u,d]=(0,G.useState)(!1);c&&!u&&d(!0);let f=(0,G.useRef)(a),p=(0,G.useRef)(r);(0,G.useEffect)(()=>{p.current=r},[r]),(0,G.useLayoutEffect)(()=>{let e=f.current;if(f.current=i,i===e)return;if(i===`done`){l(!0);let e=setTimeout(()=>{p.current?p.current():l(!1)},jJ);return()=>{clearTimeout(e)}}l(!1);let t=o.current;if(i!==`failed`||!t||!JR(t))return;let n=BR(t);if(n.shake<=0)return;let r=NJ(t,n);return()=>{r.cancel()}},[i,s]);let m=(0,G.useRef)(c);return(0,G.useLayoutEffect)(()=>{let e=o.current;if(!e||m.current===c)return;m.current=c;let t=e.querySelector(`[data-face="label"]`),n=e.querySelector(`[data-face="result"]`);if(!t||!n||!JR(e)){c||d(!1);return}let r=BR(e),i=c?PJ(t,n,r):PJ(n,t,r);if(c||i[0]?.addEventListener(`finish`,()=>{d(!1)}),c&&!r.reduced){i.push(MJ(e.closest(`button`)??e,r));let t=n.querySelector(`path`);t&&i.push(t.animate([{strokeDashoffset:1},{strokeDashoffset:0}],{duration:r.normal*1.4,delay:r.fast/2,easing:qR(r,r.ease),fill:`backwards`}))}return()=>{for(let e of i)e.cancel()}},[c,s]),(0,Z.jsxs)(`span`,{ref:o,className:`caps-button-faces`,"data-showing":c?`result`:`label`,children:[(0,Z.jsxs)(`span`,{className:`caps-button-face`,"data-face":`label`,"aria-hidden":c?!0:void 0,children:[n||c?(0,Z.jsx)(lH,{decorative:!0,size:`sm`,tone:`current`,variant:`wander`}):null,e]}),u?(0,Z.jsxs)(`span`,{className:`caps-button-face`,"data-face":`result`,"aria-hidden":!c||void 0,children:[(0,Z.jsx)(`svg`,{className:`caps-button-check`,viewBox:`0 0 24 24`,"aria-hidden":`true`,focusable:`false`,children:(0,Z.jsx)(`path`,{d:`M4.5 12.5 9.5 17.5 19.5 6.5`,pathLength:1})}),t===void 0?e:t]}):null]})}var IJ={xs:`size-3`,sm:`size-[var(--stipe-icon-size-sm)]`,md:`size-[var(--stipe-icon-size-md)]`,lg:`size-[var(--stipe-icon-size-lg)]`},LJ=(0,G.forwardRef)(function({active:e=!1,icon:t,iconSize:n=`xs`,className:r,reveal:i=!1,size:a=`xs`,tone:o=`default`,variant:s=`ghost`,...c},l){let u=a===`responsive`;return(0,Z.jsx)(kJ,{...c,resultLabel:c.result===void 0?void 0:null,ref:l,size:u?`sm`:a,variant:s,className:Q(`caps-icon-button btn-circle`,u&&`caps-icon-button-responsive md:btn-xs`,e&&`text-accent`,i&&`scale-0 transition-transform group-hover:scale-100 focus-visible:scale-100`,o===`destructive`&&`hover:text-error`,r),children:(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:Q(`inline-flex shrink-0 [&>svg]:size-full [&>svg]:[stroke-width:var(--stipe-icon-stroke)]`,IJ[n]),children:t})})}),RJ=(0,G.forwardRef)(function({tone:e=`neutral`,size:t=`md`,pressed:n=!1,touch:r,className:i,...a},o){return(0,Z.jsx)(`kbd`,{...a,ref:o,className:Q(`caps-keycap`,i),"data-tone":e,"data-size":t,"data-pressed":n,"data-touch":r})}),zJ=(0,G.forwardRef)(function({label:e,shortcut:t,icon:n,readout:r,tone:i=`neutral`,density:a=`regular`,pressed:o,expanded:s,className:c,type:l=`button`,...u},d){let f=o??s;return(0,Z.jsxs)(`button`,{...u,ref:d,type:l,className:Q(`caps-keycap-button`,c),"data-tone":i,"data-density":a===`compact`?a:void 0,"aria-pressed":o,"aria-expanded":s,"aria-keyshortcuts":u[`aria-keyshortcuts`]??t,children:[f===void 0?null:(0,Z.jsx)(`span`,{className:`caps-keycap-led`,"data-lit":f,"aria-hidden":`true`}),n?(0,Z.jsx)(`span`,{className:`caps-keycap-button-icon`,"aria-hidden":`true`,children:n}):null,e===null?null:(0,Z.jsx)(`span`,{className:`caps-keycap-button-label`,children:e}),r,t?(0,Z.jsx)(RJ,{size:`sm`,tone:`neutral`,touch:`hide`,"aria-hidden":`true`,children:t}):null]})}),BJ={...G},VJ={};function HJ(e,t){let n=G.useRef(VJ);return n.current===VJ&&(n.current=e(t)),n}var UJ=BJ.useInsertionEffect,WJ=UJ&&UJ!==BJ.useLayoutEffect?UJ:e=>e();function GJ(e){let t=HJ(KJ).current;return t.next=e,WJ(t.effect),t.trampoline}function KJ(){let e={next:void 0,callback:qJ,trampoline:(...t)=>e.callback?.(...t),effect:()=>{e.callback=e.next}};return e}function qJ(){}function JJ(){}var YJ=Object.freeze([]),XJ=Object.freeze({});function ZJ(e){G.useEffect(e,YJ)}var QJ=0,$J=class e{static create(){return new e}currentId=QJ;start(e,t){this.clear(),this.currentId=setTimeout(()=>{this.currentId=QJ,t()},e)}isStarted(){return this.currentId!==QJ}clear=()=>{this.currentId!==QJ&&(clearTimeout(this.currentId),this.currentId=QJ)};disposeEffect=()=>this.clear};function eY(){let e=HJ($J.create).current;return ZJ(e.disposeEffect),e}function tY(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 nY=tY(`https://base-ui.com/production-error`,`Base UI`),rY=G.createContext(void 0);function iY(){let e=G.useContext(rY);if(e===void 0)throw Error(nY(53));return e}function aY(e,t,n,r){let i=HJ(sY).current;return cY(i,e,t,n,r)&&uY(i,[e,t,n,r]),i.callback}function oY(e){let t=HJ(sY).current;return lY(t,e)&&uY(t,e),t.callback}function sY(){return{callback:null,cleanup:null,refs:[]}}function cY(e,t,n,r,i){return e.refs[0]!==t||e.refs[1]!==n||e.refs[2]!==r||e.refs[3]!==i}function lY(e,t){return e.refs.length!==t.length||e.refs.some((e,n)=>e!==t[n])}function uY(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 dY=18;function fY(e){return dY>=e}function pY(e){if(!G.isValidElement(e))return null;let t=e,n=t.props;return(fY(19)?n?.ref:t.ref)??null}function mY(e,t){if(e&&!t)return e;if(!e&&t)return t;if(e||t)return{...e,...t}}function hY(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 gY(e,t){return typeof e==`function`?e(t):e}function _Y(e,t){return typeof e==`function`?e(t):e}var vY={};function yY(e,t,n,r,i){if(!n&&!r&&!i&&!e)return xY(t);let a=xY(e);return t&&(a=SY(a,t)),n&&(a=SY(a,n)),r&&(a=SY(a,r)),i&&(a=SY(a,i)),a}function bY(e){if(e.length===0)return vY;if(e.length===1)return xY(e[0]);let t=xY(e[0]);for(let n=1;n<e.length;n+=1)t=SY(t,e[n]);return t}function xY(e){return EY(e)?{...e(vY)}:CY(e)}function SY(e,t){return EY(t)?t(e):wY(e,t)}function CY(e){let t={...e};for(let e in t){let n=t[e];TY(e,n)&&(t[e]=OY(n))}return t}function wY(e,t){if(!t)return e;for(let n in t){let r=t[n];switch(n){case`style`:e[n]=mY(e.style,r);break;case`className`:e[n]=AY(e.className,r);break;default:e[n]=TY(n,r)?DY(e[n],r):r}}return e}function TY(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 EY(e){return typeof e==`function`}function DY(e,t){return t?e?(...n)=>{let r=n[0];if(jY(r)){let i=r;kY(i);let a=t(...n);return i.baseUIHandlerPrevented||e?.(...n),a}let i=t(...n);return e?.(...n),i}:OY(t):e}function OY(e){return e&&((...t)=>{let n=t[0];return jY(n)&&kY(n),e(...t)})}function kY(e){return e.preventBaseUIHandler=()=>{e.baseUIHandlerPrevented=!0},e}function AY(e,t){return t?e?t+` `+e:t:e}function jY(e){return typeof e==`object`&&!!e&&`nativeEvent`in e}function MY(e,t,n={}){let r=t.render;n.enabled!==!1&&(r=IY(r));let i=NY(t,n,r);if(n.enabled===!1)return null;let a=n.state??XJ;return LY(e,r,i,a)}function NY(e,t,n){let{className:r,style:i}=e,{state:a=XJ,ref:o,props:s,stateAttributesMapping:c,enabled:l=!0}=t,u=l?gY(r,a):void 0,d=l?_Y(i,a):void 0,f=l?hY(a,c):XJ,p=l&&s?PY(s):void 0,m=l?mY(f,p)??{}:XJ;return typeof document<`u`&&(l?m.ref=Array.isArray(o)?oY([m.ref,pY(n),...o]):aY(m.ref,pY(n),o):aY(null,null)),l?(u!==void 0&&(m.className=AY(m.className,u)),d!==void 0&&(m.style=mY(m.style,d)),m):XJ}function PY(e){return Array.isArray(e)?bY(e):yY(void 0,e)}var FY=Symbol.for(`react.lazy`);function IY(e){if(e?.$$typeof!==FY)return e;let t=G.Children.toArray(e)[0];return G.isValidElement(t)?t:e}function LY(e,t,n,r){if(t){if(typeof t==`function`)return t(n,r);let e=yY(n,t.props);return e.ref=n.ref,G.cloneElement(t,e)}return RY(e,n)}function RY(e,t){return e===`button`?(0,G.createElement)(`button`,{type:`button`,...t,key:t.key}):e===`img`?(0,G.createElement)(`img`,{alt:``,...t,key:t.key}):G.createElement(e,t)}function zY(e,t,n){if(!e)return 0;let r=getComputedStyle(e),i=`${t}${n===`x`?`Inline`:`Block`}`,a=parseFloat(r[`${i}Start`]);return n===`x`&&t===`margin`?a*2:a+parseFloat(r[`${i}End`])}var BY=`base-ui-disable-scrollbar`,VY={className:BY,getElement(e){return(0,Z.jsx)(`style`,{nonce:e,href:BY,precedence:`base-ui:low`,children:`.${BY}{scrollbar-width:none}.${BY}::-webkit-scrollbar{display:none}`})}};function HY(){let[,e]=G.useState({});return G.useCallback(()=>{e({})},[])}var UY=0;function WY(e,t=`mui`){let n=G.useRef(void 0),r=HY(),i=e??n.current;return G.useEffect(()=>{n.current??(UY+=1,n.current=`${t}-${UY}`,e??r())},[e,t,r]),i}var GY=BJ.useId;function KY(e,t){if(GY!==void 0){let n=GY();return e??(t?`${t}-${n}`:n)}return WY(e,t)}function qY(e){return KY(e,`base-ui`)}var JY=`data-has-overflow-x`,YY=`data-has-overflow-y`,XY=`data-overflow-x-start`,ZY=`data-overflow-x-end`,QY=`data-overflow-y-start`,$Y=`data-overflow-y-end`,eX=e=>t=>t?{[e]:``}:null,tX={hasOverflowX:eX(JY),hasOverflowY:eX(YY),overflowXStart:eX(XY),overflowXEnd:eX(ZY),overflowYStart:eX(QY),overflowYEnd:eX($Y),cornerHidden:()=>null};function nX(){return typeof window<`u`}function rX(e){return oX(e)?(e.nodeName||``).toLowerCase():`#document`}function iX(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function aX(e){return((oX(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function oX(e){return nX()?e instanceof Node||e instanceof iX(e).Node:!1}function sX(e){return nX()?e instanceof Element||e instanceof iX(e).Element:!1}function cX(e){return nX()?e instanceof HTMLElement||e instanceof iX(e).HTMLElement:!1}function lX(e){return!nX()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof iX(e).ShadowRoot}function uX(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=xX(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function dX(e){return/^(table|td|th)$/.test(rX(e))}function fX(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var pX=/transform|translate|scale|rotate|perspective|filter/,mX=/paint|layout|strict|content/,hX=e=>!!e&&e!==`none`,gX;function _X(e){let t=sX(e)?xX(e):e;return hX(t.transform)||hX(t.translate)||hX(t.scale)||hX(t.rotate)||hX(t.perspective)||!yX()&&(hX(t.backdropFilter)||hX(t.filter))||pX.test(t.willChange||``)||mX.test(t.contain||``)}function vX(e){let t=CX(e);for(;cX(t)&&!bX(t);){if(_X(t))return t;if(fX(t))return null;t=CX(t)}return null}function yX(){return gX??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),gX}function bX(e){return/^(html|body|#document)$/.test(rX(e))}function xX(e){return iX(e).getComputedStyle(e)}function SX(e){return sX(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function CX(e){if(rX(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||lX(e)&&e.host||aX(e);return lX(t)?t.host:t}function wX(e){let t=CX(e);return bX(t)?(e.ownerDocument||e).body:cX(t)&&uX(t)?t:wX(t)}function TX(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=wX(e),i=r===e.ownerDocument?.body,a=iX(r);if(i){let e=EX(a);return t.concat(a,a.visualViewport||[],uX(r)?r:[],e&&n?TX(e):[])}return t.concat(r,TX(r,[],n))}function EX(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function DX(){return typeof navigator>`u`?{userAgent:``,platform:``,maxTouchPoints:0}:{userAgent:navigator.userAgent,platform:navigator.platform??``,maxTouchPoints:navigator.maxTouchPoints??0}}var{userAgent:OX,platform:kX,maxTouchPoints:AX}=DX(),jX=OX.toLowerCase(),MX=kX.toLowerCase(),NX=/^i(os$|p)/.test(MX)||MX===`macintel`&&AX>1,PX=`android`,FX=MX===PX||jX.includes(PX),IX=!NX&&MX.startsWith(`mac`);MX.startsWith(`win`),!FX&&/^(linux|chrome os)/.test(MX);var LX=IX||NX,RX=typeof CSS<`u`&&!!CSS.supports?.(`-webkit-backdrop-filter:none`);!RX&&jX.includes(`firefox`),!RX&&jX.includes(`chrom`);var zX=LX,BX=/jsdom|happydom/.test(jX);function VX(e){let t=e.activeElement;for(;t?.shadowRoot?.activeElement!=null;)t=t.shadowRoot.activeElement;return t}function HX(e,t){if(!e||!t)return!1;let n=t.getRootNode?.();if(e.contains(t))return!0;if(n&&lX(n)){let n=t;for(;n;){if(e===n)return!0;n=n.parentNode||n.host}}return!1}function UX(e,t){let n=e;for(;n;){if(sX(n)&&n.matches(t))return n;n=n.assignedSlot??n.parentNode??(lX(n)?n.host:null)}return null}function WX(e){return`composedPath`in e?e.composedPath()[0]??e.target:e.target}var GX=`data-base-ui-focusable`,KX=`input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])`,qX=`ArrowLeft`,JX=`ArrowRight`,YX=`ArrowUp`,XX=`ArrowDown`,ZX=`data-starting-style`,QX=`data-ending-style`,$X={[ZX]:``},eZ={[QX]:``},tZ={transitionStatus(e){return e===`starting`?$X:e===`ending`?eZ:null}},nZ=`data-open`,rZ=`data-closed`,iZ=ZX,aZ=QX,oZ=`data-anchor-hidden`,sZ=`data-popup-open`,cZ=`data-pressed`,lZ={[sZ]:``},uZ={[sZ]:``,[cZ]:``},dZ={[nZ]:``},fZ={[rZ]:``},pZ={[oZ]:``},mZ={open(e){return e?lZ:null}},hZ={open(e){return e?uZ:null}},gZ={open(e){return e?dZ:fZ},anchorHidden(e){return e?pZ:null}},_Z={...gZ,...tZ},vZ=`data-trigger-disabled`;function yZ(e,t){if(!sX(e))return!1;let n=e;if(t.hasElement(n))return!n.hasAttribute(vZ);for(let[,e]of t.entries())if(HX(e,n))return!e.hasAttribute(vZ);return!1}function bZ(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 xZ(e){return e.matches(`html,body`)}function SZ(e){return cX(e)&&e.matches(`input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])`)}function CZ(e){return UX(e,`button,a[href],[role="button"],select,[tabindex]:not([tabindex="-1"]),${KX}`)!=null}function wZ(e){return e?e.getAttribute(`role`)===`combobox`&&SZ(e):!1}function TZ(e){if(!e||BX)return!0;try{return e.matches(`:focus-visible`)}catch{return!0}}function EZ(e){return e?e.hasAttribute(`data-base-ui-focusable`)?e:e.querySelector(`[data-base-ui-focusable]`)||e:null}function DZ(e,t,n=!0){return e.filter(e=>e.parentId===t).flatMap(t=>[...!n||t.context?.open?[t]:[],...DZ(e,t.id,n)])}function OZ(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 kZ(e){e.preventDefault(),e.stopPropagation()}function AZ(e){return`nativeEvent`in e}function jZ(e){return e.pointerType===``&&e.isTrusted?!0:FX&&e.pointerType?e.type===`click`&&e.buttons===1:e.detail===0&&!e.pointerType}function MZ(e){return BX?!1:!FX&&e.width===0&&e.height===0||e.type===`pointerdown`&&e.width===1&&e.height===1&&e.pressure===0&&e.detail===0&&e.pointerType===`mouse`&&(FX||e.buttons===0)||e.width<1&&e.height<1&&e.pressure===0&&e.detail===0&&e.pointerType===`touch`}function NZ(e,t){let n=[`mouse`,`pen`];return t||n.push(``,void 0),n.includes(e)}function PZ(e){let t=e.type;return t===`click`||t===`mousedown`||t===`keydown`||t===`keyup`}var FZ=Math.min,IZ=Math.max,LZ=Math.round,RZ=Math.floor,zZ=e=>({x:e,y:e}),BZ={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function VZ(e,t,n){return IZ(e,FZ(t,n))}function HZ(e,t){return typeof e==`function`?e(t):e}function UZ(e){return e.split(`-`)[0]}function WZ(e){return e.split(`-`)[1]}function GZ(e){return e===`x`?`y`:`x`}function KZ(e){return e===`y`?`height`:`width`}function qZ(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function JZ(e){return GZ(qZ(e))}function YZ(e,t,n){n===void 0&&(n=!1);let r=WZ(e),i=JZ(e),a=KZ(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=iQ(o)),[o,iQ(o)]}function XZ(e){let t=iQ(e);return[ZZ(e),t,ZZ(t)]}function ZZ(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var QZ=[`left`,`right`],$Z=[`right`,`left`],eQ=[`top`,`bottom`],tQ=[`bottom`,`top`];function nQ(e,t,n){switch(e){case`top`:case`bottom`:return n?t?$Z:QZ:t?QZ:$Z;case`left`:case`right`:return t?eQ:tQ;default:return[]}}function rQ(e,t,n,r){let i=WZ(e),a=nQ(UZ(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(ZZ)))),a}function iQ(e){let t=UZ(e);return BZ[t]+e.slice(t.length)}function aQ(e){return{top:e.top??0,right:e.right??0,bottom:e.bottom??0,left:e.left??0}}function oQ(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:aQ(e)}function sQ(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 cQ(e,t){return t<0||t>=e.length}function lQ(e,t){return fQ(e.current,{disabledIndices:t})}function uQ(e,t){return fQ(e.current,{decrement:!0,startingIndex:e.current.length,disabledIndices:t})}function dQ(e,t,n){let{decrement:r,loopFocus:i,allowEscape:a,disabledIndices:o,minIndex:s,maxIndex:c}=n,l=()=>fQ(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:cQ(e,u)?-1:u,wrapped:d}}function fQ(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&&pQ(e,a,r));return a}function pQ(e,t,n){if(typeof n==`function`?n(t):n?.includes(t)??!1)return!0;let r=e[t];return r?!hQ(r)||r.matches(`:disabled`)?!0:!n&&(r.hasAttribute(`disabled`)||r.getAttribute(`aria-disabled`)===`true`):!1}function mQ(e){return e.visibility===`hidden`||e.visibility===`collapse`}function hQ(e,t=e?xX(e):null){return!e||!e.isConnected||!t||mQ(t)?!1:typeof e.checkVisibility==`function`?e.checkVisibility():t.display!==`none`&&t.display!==`contents`}function gQ(e){return e?.ownerDocument||document}var _Q=`a[href],button,input,select,textarea,summary,details,iframe,object,embed,[tabindex],[contenteditable]:not([contenteditable="false"]),audio[controls],video[controls]`;function vQ(e){let t=e.assignedSlot;if(t)return t;if(e.parentElement)return e.parentElement;let n=e.getRootNode();return lX(n)?n.host:null}function yQ(e){for(let t of Array.from(e.children))if(rX(t)===`summary`)return t;return null}function bQ(e,t){let n=yQ(t);return!!n&&(e===n||HX(n,e))}function xQ(e){let t=e?rX(e):``;return e!=null&&e.matches(_Q)&&(t!==`summary`||e.parentElement!=null&&rX(e.parentElement)===`details`&&yQ(e.parentElement)===e)&&(t!==`details`||yQ(e)==null)&&(t!==`input`||e.type!==`hidden`)}function SQ(e){if(!xQ(e)||!e.isConnected||e.matches(`:disabled`))return!1;for(let t=e;t;t=vQ(t)){let n=t!==e,r=rX(t)===`slot`;if(t.hasAttribute(`inert`)||n&&rX(t)===`details`&&!t.open&&!bQ(e,t)||t.hasAttribute(`hidden`)||!r&&!CQ(t,n))return!1}return!0}function CQ(e,t){let n=xX(e);return t?n.display!==`none`:hQ(e,n)}function wQ(e){let t=e.tabIndex;if(t<0){let t=rX(e);if(t===`details`||t===`audio`||t===`video`||cX(e)&&e.isContentEditable)return 0}return t}function TQ(e){if(rX(e)!==`input`)return null;let t=e;return t.type===`radio`&&t.name!==``?t:null}function EQ(e,t){let n=TQ(e);if(!n)return!0;let r=t.find(e=>{let t=TQ(e);return t?.name===n.name&&t.form===n.form&&t.checked});return r?r===n:t.find(e=>{let t=TQ(e);return t?.name===n.name&&t.form===n.form})===n}function DQ(e){if(cX(e)&&rX(e)===`slot`){let t=e.assignedElements({flatten:!0});if(t.length>0)return t}return cX(e)&&e.shadowRoot?Array.from(e.shadowRoot.children):Array.from(e.children)}function OQ(e,t){DQ(e).forEach(e=>{xQ(e)&&t.push(e),OQ(e,t)})}function kQ(e,t,n){DQ(e).forEach(e=>{cX(e)&&e.matches(t)&&n.push(e),kQ(e,t,n)})}function AQ(e){return SQ(e)&&wQ(e)>=0}function jQ(e){let t=[];return OQ(e,t),t.filter(SQ)}function MQ(e){let t=jQ(e);return t.filter(e=>wQ(e)>=0&&EQ(e,t))}function NQ(e,t){let n=MQ(e),r=n.length;if(r===0)return;let i=VX(gQ(e)),a=n.indexOf(i);return n[a===-1?t===1?0:r-1:a+t]}function PQ(e){return NQ(gQ(e).body,1)||e}function FQ(e){return NQ(gQ(e).body,-1)||e}function IQ(e,t,n){if(!e)return null;let r=[];OQ(gQ(e).body,r);let i=r.indexOf(e);if(i===-1)return null;let a=r.filter(SQ);for(let e=1;e<r.length;e+=1){let o=r[(i+t*e+r.length)%r.length];if(!HX(n,o)&&AQ(o)&&EQ(o,a))return o}return r[i]}function LQ(e,t){let n=t||e.currentTarget,r=e.relatedTarget;return!r||!HX(n,r)}function RQ(e){MQ(e).forEach(e=>{e.dataset.tabindex=e.getAttribute(`tabindex`)||``,e.setAttribute(`tabindex`,`-1`)})}function zQ(e){let t=[];kQ(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 BQ=G.createContext(void 0),VQ={disableStyleElements:!1};function HQ(){return G.useContext(BQ)??VQ}var UQ=`--scroll-area-corner-height`,WQ=`--scroll-area-corner-width`,GQ=`data-orientation`,KQ={x:0,y:0},qQ={width:0,height:0},JQ={xStart:!1,xEnd:!1,yStart:!1,yEnd:!1},YQ={x:!0,y:!0,corner:!0},XQ=G.forwardRef(function(e,t){let{render:n,className:r,overflowEdgeThreshold:i,style:a,...o}=e,{xStart:s,xEnd:c,yStart:l,yEnd:u}=ZQ(i),d=qY(),f=eY(),p=eY(),{nonce:m,disableStyleElements:h}=HQ(),[g,_]=G.useState(!1),[v,y]=G.useState(!1),[b,x]=G.useState(!1),[S,C]=G.useState(!1),[w,T]=G.useState(!1),[E,D]=G.useState(qQ),[O,k]=G.useState(qQ),[A,j]=G.useState(JQ),[M,N]=G.useState(YQ),P=G.useRef(null),F=G.useRef(null),I=G.useRef(null),L=G.useRef(null),R=G.useRef(null),z=G.useRef(null),ee=G.useRef(null),te=G.useRef(null),B=G.useRef(0),ne=G.useRef(0),re=G.useRef(0),V=G.useRef(0),H=G.useRef(`vertical`),ie=G.useRef(KQ),ae=G.useRef(null);function oe(e){let t=e?x:y,n=e?f:p;t(!0),n.start(500,()=>{t(!1)})}let se=GJ(e=>{let t=e.x-ie.current.x,n=e.y-ie.current.y;ie.current=e,n!==0&&oe(!0),t!==0&&oe(!1)}),ce=GJ(()=>{let e=F.current;e&&ae.current===null&&(ae.current=e.style.scrollSnapType,e.style.scrollSnapType=`none`)}),le=GJ(e=>{if(e.button!==0||te.current!==null&&(H.current===`vertical`?R.current:z.current)?.hasPointerCapture(te.current))return;te.current=e.pointerId,B.current=e.clientY,ne.current=e.clientX,H.current=e.currentTarget.getAttribute(GQ);let t=F.current;t&&(re.current=t.scrollTop,V.current=t.scrollLeft,ce()),(H.current===`vertical`?R.current:z.current)?.setPointerCapture(e.pointerId)}),ue=GJ(e=>{if(e.pointerId!==te.current)return;te.current=null,(H.current===`vertical`?x:y)(!1),ae.current!==null&&(F.current&&(F.current.style.scrollSnapType=ae.current),ae.current=null);let t=H.current===`vertical`?R.current:z.current;t?.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId)}),de=GJ(e=>{if(e.pointerId!==te.current)return;if(e.buttons%2==0){ue(e);return}let t=F.current;if(!t)return;let n=H.current===`vertical`,r=n?R.current:z.current,i=n?I.current:L.current;if(!r||!i)return;let a=n?`y`:`x`,o=zY(i,`padding`,a),s=zY(r,`margin`,a),c=n?r.offsetHeight:r.offsetWidth,l=(n?i.offsetHeight:i.offsetWidth)-c-o-s,u=n?e.clientY-B.current:e.clientX-ne.current,d=l<=0?0:u/l,f=n?t.scrollHeight:t.scrollWidth,p=n?t.clientHeight:t.clientWidth,m=(n?re.current:V.current)+d*(f-p);n?t.scrollTop=m:t.scrollLeft=m,e.preventDefault(),oe(n)});function fe(e){C(e.pointerType===`touch`)}function pe(e){if(fe(e),e.pointerType!==`touch`){let t=HX(P.current,e.target);_(t)}}let me=G.useMemo(()=>({scrolling:v||b,hasOverflowX:!M.x,hasOverflowY:!M.y,overflowXStart:A.xStart,overflowXEnd:A.xEnd,overflowYStart:A.yStart,overflowYEnd:A.yEnd,cornerHidden:M.corner}),[v,b,M.x,M.y,M.corner,A]),he={role:`presentation`,onPointerEnter:pe,onPointerMove:pe,onPointerDown:fe,onPointerLeave(){_(!1)},style:{position:`relative`,[UQ]:`${E.height}px`,[WQ]:`${E.width}px`}},ge=MY(`div`,e,{state:me,ref:[t,P],props:[he,o],stateAttributesMapping:tX}),_e=G.useMemo(()=>({handlePointerDown:le,handlePointerMove:de,handlePointerUp:ue,handleScroll:se,disableViewportSnap:ce,cornerSize:E,setCornerSize:D,thumbSize:O,setThumbSize:k,hasMeasuredScrollbar:w,setHasMeasuredScrollbar:T,touchModality:S,cornerRef:ee,scrollingX:v,scrollingY:b,hovering:g,setHovering:_,viewportRef:F,scrollbarYRef:I,scrollbarXRef:L,thumbYRef:R,thumbXRef:z,rootId:d,hiddenState:M,setHiddenState:N,overflowEdges:A,setOverflowEdges:j,viewportState:me,overflowEdgeThreshold:{xStart:s,xEnd:c,yStart:l,yEnd:u}}),[le,de,ue,se,ce,E,O,w,S,v,b,g,d,M,A,me,s,c,l,u]);return(0,Z.jsxs)(rY.Provider,{value:_e,children:[!h&&VY.getElement(m),ge]})});function ZQ(e){let t=typeof e==`number`?{xStart:e,xEnd:e,yStart:e,yEnd:e}:e;return{xStart:Math.max(0,t?.xStart||0),xEnd:Math.max(0,t?.xEnd||0),yStart:Math.max(0,t?.yStart||0),yEnd:Math.max(0,t?.yEnd||0)}}var $=typeof document<`u`?G.useLayoutEffect:()=>{};function QQ(e,t=-(2**53-1),n=2**53-1){return Math.max(t,Math.min(e,n))}var $Q=G.createContext(void 0);function e$(){let e=G.useContext($Q);if(e===void 0)throw Error(nY(55));return e}var t$=G.createContext(void 0);function n$(){return G.useContext(t$)?.direction??`ltr`}function r$(e,t){if(t<=0)return 0;let n=QQ(e,0,t),r=n,i=t-n,a=r<=1,o=i<=1;return a&&o?r<=i?0:t:a?0:o?t:n}function i$(e,t){return e.getAnimations(t).filter(e=>{let t=e.effect?.getTiming();return t?.duration!==1/0&&t?.iterations!==1/0})}var a$=`--scroll-area-overflow-x-start`,o$=`--scroll-area-overflow-x-end`,s$=`--scroll-area-overflow-y-start`,c$=`--scroll-area-overflow-y-end`,l$=`--scroll-area-thumb-height`,u$=`--scroll-area-thumb-width`,d$=[a$,o$,s$,c$],f$=!1;function p$(){f$||RX||(typeof CSS<`u`&&`registerProperty`in CSS&&d$.forEach(e=>{try{CSS.registerProperty({name:e,syntax:`<length>`,inherits:!1,initialValue:`0px`})}catch{}}),f$=!0)}var m$=G.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,{viewportRef:o,scrollbarYRef:s,scrollbarXRef:c,thumbYRef:l,thumbXRef:u,cornerRef:d,cornerSize:f,setCornerSize:p,setThumbSize:m,rootId:h,setHiddenState:g,hiddenState:_,setHasMeasuredScrollbar:v,handleScroll:y,touchModality:b,setHovering:x,setOverflowEdges:S,overflowEdgeThreshold:C,viewportState:w}=iY(),T=n$(),E=G.useRef(!0),D=G.useRef([NaN,NaN,NaN,NaN]),O=eY(),k=eY(),A=GJ(()=>{let e=o.current,t=s.current,n=c.current,r=l.current,i=u.current,a=d.current;if(!e)return;let h=e.scrollHeight,_=e.scrollWidth,y=e.clientHeight,b=e.clientWidth,x=e.scrollTop,w=e.scrollLeft,E=D.current,O=Number.isNaN(E[0]);if(E[0]=y,E[1]=h,E[2]=b,E[3]=_,O&&v(!0),h===0||_===0)return;let k=h$(e),A=k.y,j=k.x,M=b/_,N=y/h,P=Math.max(0,_-b),F=Math.max(0,h-y),I=0,L=0;j||(I=r$(T===`rtl`?-w:w,P),L=P-I);let R=A?0:r$(x,F),z=A?0:F-R,ee=j?0:b,te=A?0:y,B=0,ne=0;!j&&!A&&(B=t?.offsetWidth||0,ne=n?.offsetHeight||0);let re=f.width===0&&f.height===0,V=re?B:0,H=re?ne:0,ie=zY(n,`padding`,`x`),ae=zY(t,`padding`,`y`),oe=zY(i,`margin`,`x`),se=zY(r,`margin`,`y`),ce=ee-ie-oe,le=te-ae-se,ue=n?Math.min(n.offsetWidth-V,ce):ce,de=t?Math.min(t.offsetHeight-H,le):le,fe=Math.max(16,ue*M),pe=Math.max(16,de*N);if(m(e=>g$(e,{width:fe,height:pe})),t&&r){let e=_$(r,l$,x,F,h,pe,t.offsetHeight-pe-ae-se);r.style.transform=`translate3d(0,${e}px,0)`}if(n&&i){let e=n.offsetWidth-fe-ie-oe,t=_$(i,u$,T===`rtl`?-w:w,P,_,fe,e);i.style.transform=`translate3d(${T===`rtl`?-t:t}px,0,0)`}let me=[I,L,R,z];d$.forEach((t,n)=>{e.style.setProperty(t,`${me[n]}px`)}),a&&p(e=>g$(e,{width:B,height:ne})),g(e=>g$(e,k));let he={xStart:!j&&I>C.xStart,xEnd:!j&&L>C.xEnd,yStart:!A&&R>C.yStart,yEnd:!A&&z>C.yEnd};S(e=>g$(e,he))});$(()=>{p$()},[]),$(()=>{queueMicrotask(A)},[A,_,T,C.xStart,C.xEnd,C.yStart,C.yEnd]),$(()=>{o.current?.matches(`:hover`)&&x(!0)},[o,x]),$(()=>{let e=o.current;if(typeof ResizeObserver>`u`||!e)return;let t=!1,n=new ResizeObserver(()=>{if(!t){t=!0;let n=D.current;if(n[0]===e.clientHeight&&n[1]===e.scrollHeight&&n[2]===e.clientWidth&&n[3]===e.scrollWidth)return}A()});return n.observe(e),k.start(0,()=>{let t=i$(e,{subtree:!0});t.length!==0&&Promise.allSettled(t.map(e=>e.finished.then(JJ))).then(A).catch(()=>{})}),()=>{n.disconnect(),k.clear()}},[A,o,k]);function j(){E.current=!1}let M={...h&&{"data-id":`${h}-viewport`},tabIndex:_.x&&_.y?-1:0,className:VY.className,style:{overflow:`scroll`},onScroll(){o.current&&(A(),(b||!E.current)&&y({x:o.current.scrollLeft,y:o.current.scrollTop}),O.start(100,()=>{E.current=!0}))},onWheel:j,onPointerMove:j,onPointerEnter:j,onKeyDown:j},N=MY(`div`,e,{ref:[t,o],state:w,props:[M,a],stateAttributesMapping:tX}),P=G.useMemo(()=>({computeThumbPosition:A}),[A]);return(0,Z.jsx)($Q.Provider,{value:P,children:N})});function h$(e){let t=e.clientHeight>=e.scrollHeight,n=e.clientWidth>=e.scrollWidth;return{y:t,x:n,corner:t||n}}function g$(e,t){for(let n in t)if(e[n]!==t[n])return t;return e}function _$(e,t,n,r,i,a,o){let s=QQ(n,0,r),c=n-s,l=Math.max(16,a*i/(i+Math.abs(c)));return e.style.setProperty(t,c?`${l}px`:``),(r?s/r*o:0)+(c>0?a-l:0)}function v$(e,t,n,r){return e.addEventListener(t,n,r),()=>{e.removeEventListener(t,n,r)}}var y$=G.createContext(void 0);function b$(){let e=G.useContext(y$);if(e===void 0)throw Error(nY(54));return e}var x$=G.forwardRef(function(e,t){let{render:n,className:r,orientation:i=`vertical`,keepMounted:a=!1,style:o,...s}=e,{hovering:c,scrollingX:l,scrollingY:u,hiddenState:d,scrollbarYRef:f,scrollbarXRef:p,viewportRef:m,thumbYRef:h,thumbXRef:g,handlePointerDown:_,handlePointerUp:v,handleScroll:y,disableViewportSnap:b,rootId:x,thumbSize:S,hasMeasuredScrollbar:C,viewportState:w}=iY(),T=i===`vertical`,E={...w,hovering:c,scrolling:T?u:l,orientation:i},D=n$(),O=!C&&!a,k=T?d.y:d.x,A=a||!k;G.useEffect(()=>{if(!A)return;let e=m.current,t=T?f.current:p.current;if(!t)return;function n(t){if(!e||t.ctrlKey)return;let n=!T,r=n?`scrollLeft`:`scrollTop`,i=n?t.deltaX:t.deltaY;if(i===0)return;let a=n?e.scrollWidth-e.clientWidth:e.scrollHeight-e.clientHeight,o=n&&D===`rtl`?-a:0,s=n&&D===`rtl`?0:a,c=e[r];c<=o&&i<0||c>=s&&i>0||(t.preventDefault(),e[r]=Math.min(s,Math.max(o,c+i)),y({x:e.scrollLeft,y:e.scrollTop}))}return v$(t,`wheel`,n,{passive:!1})},[D,y,T,p,f,A,m]);let j={...x&&{"data-id":`${x}-scrollbar`},"aria-hidden":!0,onPointerDown(e){if(e.button!==0)return;let t=WX(e.nativeEvent),n=T?h.current:g.current;if(n&&HX(n,t))return;let r=m.current;if(!r)return;let i=T?f.current:p.current;if(!n||!i)return;let a=T?`y`:`x`,o=zY(n,`margin`,a),s=zY(i,`padding`,a),c=T?n.offsetHeight:n.offsetWidth,l=i.getBoundingClientRect(),u=T?e.clientY-l.top-c/2-s+o/2:e.clientX-l.left-c/2-s+o/2,d=T?r.scrollHeight:r.scrollWidth,v=T?r.clientHeight:r.clientWidth,x=(T?i.offsetHeight:i.offsetWidth)-c-s-o;if(x<=0)return;let S=u/x,C=d-v;b(),T?r.scrollTop=S*C:r.scrollLeft=D===`rtl`?-(1-S)*C:S*C,y({x:r.scrollLeft,y:r.scrollTop}),_(e)},onMouseDown(e){e.preventDefault()},onPointerUp:v,onPointerCancel:v,style:{position:`absolute`,touchAction:`none`,WebkitUserSelect:`none`,userSelect:`none`,visibility:O?`hidden`:void 0,...T?{top:0,bottom:`var(${UQ})`,insetInlineEnd:0,[l$]:`${S.height}px`}:{insetInlineStart:0,insetInlineEnd:`var(${WQ})`,bottom:0,[u$]:`${S.width}px`}}},M=MY(`div`,e,{ref:[t,T?f:p],state:E,props:[j,s],stateAttributesMapping:tX});return A?(0,Z.jsx)(y$.Provider,{value:i,children:M}):null}),S$=G.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,{computeThumbPosition:o}=e$(),{hasMeasuredScrollbar:s,viewportState:c}=iY(),l=G.useRef(null),u=G.useRef(s);return $(()=>{if(typeof ResizeObserver>`u`)return;let e=!1,t=new ResizeObserver(()=>{!e&&(e=!0,!u.current)||o()});return l.current&&t.observe(l.current),()=>{t.disconnect()}},[o]),MY(`div`,e,{ref:[t,l],state:c,stateAttributesMapping:tX,props:[{role:`presentation`,style:{minWidth:`fit-content`}},a]})}),C$=G.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,{thumbYRef:o,thumbXRef:s,handlePointerDown:c,handlePointerMove:l,handlePointerUp:u,scrollingX:d,scrollingY:f,hasMeasuredScrollbar:p}=iY(),m=b$(),h=m===`vertical`;return MY(`div`,e,{ref:[t,h?o:s],state:{scrolling:h?f:d,orientation:m},props:[{onPointerDown:c,onPointerMove:l,onPointerUp:u,onPointerCancel:u,style:{visibility:p?void 0:`hidden`,...h?{height:`var(--scroll-area-thumb-height)`}:{width:`var(--scroll-area-thumb-width)`}}},a]})});function w$(e,t,n){let r=(Math.abs(t)-Math.abs(e))/Math.max(16,n);if(Math.abs(r)<.035)return null;let i=Math.min(.04,Math.abs(r)*.3),a=r>0,o=Math.sign(t||e);return{scaleY:1+(a?i:-i),scaleX:1+(a?-i/2:i/2),origin:(a?o>0:o<0)?`center top`:`center bottom`}}function T$(e,t,n){if(t<=0||Math.abs(n)<4)return null;let r=e<=0&&n<0,i=e>=t-1&&n>0;if(!r&&!i)return null;let a=Math.min(.06,Math.abs(n)/120*.06);return{scaleY:1-a,scaleX:1+a/2,origin:r?`center top`:`center bottom`}}var E$=(0,G.forwardRef)(function({className:e,size:t=`md`,depth:n=`shallow`,placement:r=`standalone`,...i},a){return(0,Z.jsx)(`div`,{...i,ref:a,"data-surface-size":t,"data-surface-depth":n,"data-surface-placement":r,className:Q(`caps-surface`,e)})}),D$=(0,G.forwardRef)(function({className:e,...t},n){return(0,Z.jsx)(`div`,{...t,ref:n,className:Q(`caps-screen`,e)})});(0,G.forwardRef)(function({children:e,className:t,depth:n=`deep`,fit:r=`content`,density:i=`normal`,...a},o){let s=r===`fill`;return(0,Z.jsx)(E$,{...a,className:Q(t,s&&`flex min-h-0 flex-1`),depth:n,ref:o,children:(0,Z.jsx)(`div`,{className:Q(`caps-display-gasket`,s&&`flex min-h-0 min-w-0 flex-1`),"data-display-density":i,children:(0,Z.jsx)(D$,{className:Q(s&&`flex min-h-0 min-w-0 flex-1 overflow-hidden`),children:e})})})}),(0,G.forwardRef)(function({className:e,icon:t,status:n,title:r,...i},a){return(0,Z.jsxs)(`header`,{...i,className:Q(`caps-screen-header`,e),ref:a,children:[t?(0,Z.jsx)(`span`,{className:`caps-screen-header-icon`,"aria-hidden":`true`,children:t}):null,(0,Z.jsx)(`span`,{className:`caps-screen-header-title`,children:r}),n?(0,Z.jsx)(`span`,{className:`caps-screen-header-status`,children:n}):null]})}),(0,G.forwardRef)(function({appearance:e,className:t,...n},r){return(0,Z.jsx)(`div`,{...n,className:Q(`caps-screen-cells`,t),"data-appearance":e===`compact`?e:void 0,ref:r})}),(0,G.forwardRef)(function({children:e,className:t,legend:n,readout:r,icon:i,appearance:a,wide:o=!1,...s},c){return(0,Z.jsxs)(`div`,{...s,className:Q(`caps-screen-cell`,t),"data-wide":o||void 0,"data-appearance":a===`compact`?a:void 0,ref:c,children:[i?(0,Z.jsx)(`span`,{className:`caps-screen-cell-icon`,children:i}):null,n?(0,Z.jsx)(`span`,{className:`caps-screen-cell-legend`,children:n}):null,r?(0,Z.jsx)(`span`,{className:`caps-screen-cell-readout`,children:r}):null,a===`compact`?(0,Z.jsx)(`div`,{className:`caps-screen-cell-controls`,children:e}):e]})});var O$=(0,G.forwardRef)(function({children:e,className:t,surface:n=!1,surfaceSize:r,surfaceDepth:i,screen:a=!1,...o},s){let c=(0,G.useRef)(null),l=(0,G.useRef)(null),u=$R();(0,G.useEffect)(()=>{let e=c.current,t=e?.querySelector(`.caps-scroll-viewport`);if(!t||!e)return;let n=null,r,i=t.scrollTop,a=performance.now(),o=0,s=e=>{let t=l.current;if(!e||u||!t)return;n?.cancel(),t.style.transformOrigin=e.origin;let r=BR(t),i=fH(r,{ease:`outQuad`,duration:45}),a=dH(r,{bounce:.18,duration:180});n=UV(t,{scaleY:[{to:e.scaleY,...i},{to:1,...a}],scaleX:[{to:e.scaleX,...i},{to:1,...a}]})},d=(e,t)=>{let n=w$(o,e,t);o=e,s(n)},f=e=>{if(e.ctrlKey||Math.abs(e.deltaX)>Math.abs(e.deltaY))return;let n=e.deltaMode===1?16:e.deltaMode===2?t.clientHeight:1,i=T$(t.scrollTop,t.scrollHeight-t.clientHeight,e.deltaY*n);i&&(clearTimeout(r),o=0,s(i))},p=()=>{let e=performance.now(),n=e-a,s=n>100?16:Math.max(16,n),c=t.scrollTop-i;n>100&&(o=0),d(c/s,s),i=t.scrollTop,a=e,clearTimeout(r),r=setTimeout(()=>{d(0,32)},64)};return t.addEventListener(`scroll`,p,{passive:!0}),e.addEventListener(`wheel`,f,{passive:!0}),()=>{clearTimeout(r),n?.cancel(),l.current&&(l.current.style.transform=`none`),t.removeEventListener(`scroll`,p),e.removeEventListener(`wheel`,f)}},[a,n,u]);let d=(0,Z.jsx)(m$,{render:a?(0,Z.jsx)(D$,{}):(0,Z.jsx)(`div`,{}),...o,ref:s,className:`caps-scroll-viewport`,children:(0,Z.jsx)(S$,{style:{minWidth:0},children:e})});return(0,Z.jsxs)(XQ,{render:n?(0,Z.jsx)(E$,{size:r??`md`,depth:i??`shallow`}):(0,Z.jsx)(`div`,{}),ref:c,className:Q(`caps-scroll-area`,t),children:[a?(0,Z.jsx)(`div`,{className:`caps-display-gasket caps-scroll-display`,children:d}):d,(0,Z.jsx)(E$,{size:`sm`,depth:`deep`,placement:`embedded`,className:`caps-scroll-track-surface`,children:(0,Z.jsx)(x$,{className:`caps-scroll-track`,children:(0,Z.jsx)(C$,{className:`caps-scroll-thumb`,children:(0,Z.jsx)(`span`,{className:`caps-scroll-thumb-surface`,ref:l})})})})]})}),k$=(0,G.forwardRef)(function({className:e,invalid:t,...n},r){return(0,Z.jsx)(`input`,{...n,"aria-invalid":t?!0:n[`aria-invalid`]===!1?void 0:n[`aria-invalid`],className:Q(`input caps-input w-full`,e),ref:r})});(0,G.forwardRef)(function({leading:e,className:t,...n},r){return(0,Z.jsxs)(`span`,{className:`caps-search-input`,"data-leading":e?`true`:void 0,children:[e?(0,Z.jsx)(`span`,{className:`caps-search-leading`,"aria-hidden":`true`,children:e}):null,(0,Z.jsx)(k$,{...n,type:`search`,className:t,ref:r})]})});function A$(e,t){sI.error(e,{id:t,toasterId:`prints-generation-notices`})}var j$=(0,G.forwardRef)(function({children:e,className:t,optional:n,required:r,...i},a){return(0,Z.jsxs)(`label`,{...i,className:Q(`label caps-label cursor-pointer justify-start gap-sm text-sm font-semibold text-base-content`,t),ref:a,children:[e,r?(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`text-error`,children:`*`}):null,n&&!r?(0,Z.jsx)(`span`,{className:`caps-label-optional`,children:`Optional`}):null]})}),M$=(0,G.forwardRef)(function({children:e,className:t,...n},r){return(0,Z.jsx)(`div`,{...n,className:Q(`caps-input-group join flex w-full items-stretch [&>*]:join-item [&>*:first-child]:rounded-e-none [&>*:last-child]:rounded-s-none [&>*:not(:first-child):not(:last-child)]:rounded-none [&>.btn]:shrink-0 [&>.input]:min-w-0 [&>.input]:flex-1 [&>.select]:min-w-0 [&>.select]:flex-1`,t),ref:r,children:G.Children.map(e,e=>(0,G.isValidElement)(e)?(0,G.cloneElement)(e,{className:Q(`join-item caps-input-group-control`,e.props.className)}):e)})}),N$=(0,G.forwardRef)(function({className:e,...t},n){return(0,Z.jsx)(`div`,{...t,className:Q(`join-item flex items-center border border-base-300 bg-base-200 px-md text-sm text-base-content`,e),ref:n})});function P$(e){let t=e.parentElement;if(!t||e.previousElementSibling===null)return 0;let n=getComputedStyle(t);if(!(n.display.includes(`grid`)||n.display.includes(`flex`)&&n.flexDirection.startsWith(`column`)))return 0;let r=Number.parseFloat(n.rowGap);return Number.isFinite(r)?r:0}(0,G.forwardRef)(function({show:e,appear:t=!1,children:n,className:r,...i},a){let o=(0,G.useRef)(null);(0,G.useImperativeHandle)(a,()=>o.current);let s=$R(),[c,l]=(0,G.useState)(e),u=(0,G.useRef)(!0);return e&&!c&&l(!0),(0,G.useLayoutEffect)(()=>{let n=o.current,r=u.current;if(u.current=!1,!n||r&&!t)return;if(!JR(n)){e||l(!1);return}let i=BR(n),a=`translateY(${String(i.distance)}px)`,c=qR(i,i.ease),d=n.getBoundingClientRect().height,f=P$(n),p=(e,t)=>{n.style.overflow=`clip`;let r=e=>({height:`${String(e)}px`,marginBlockStart:`${String(e===0?-f:0)}px`}),a=n.animate([r(e),r(t)],{duration:i.normal,easing:c}),o=()=>{n.style.removeProperty(`overflow`)};return a.addEventListener(`finish`,o),a.addEventListener(`cancel`,o),a};if(e){let e=[n.animate([{opacity:0,transform:a},{opacity:1,transform:`none`}],{duration:i.normal,easing:c})];return!s&&d>0&&e.push(p(0,d)),()=>{for(let t of e)t.cancel()}}let m=n.animate([{opacity:1,transform:`none`},{opacity:0,transform:a}],{duration:i.fast,easing:qR(i,i.easeExit),fill:`forwards`}),h=!s&&d>0?p(d,0):m;return h!==m&&h.effect?.updateTiming({fill:`forwards`}),h.addEventListener(`finish`,()=>{l(!1)}),()=>{m.cancel(),h.cancel()}},[e,t,s]),c?(0,Z.jsx)(`div`,{...i,ref:o,className:Q(`caps-presence`,r),"data-present":e,"aria-hidden":!e||void 0,children:n}):null});var yee=(0,G.forwardRef)(function({open:e,children:t,className:n,...r},i){return(0,Z.jsx)(`div`,{...r,ref:i,className:Q(`caps-collapse`,n),"data-open":e,"aria-hidden":!e||void 0,children:(0,Z.jsx)(`div`,{className:`caps-collapse-clip`,children:t})})});(0,G.forwardRef)(function({swapKey:e,anchor:t=`start`,children:n,className:r,...i},a){let o=(0,G.useRef)(null);(0,G.useImperativeHandle)(a,()=>o.current);let s=$R(),[c,l]=(0,G.useState)({key:e,content:n}),[u,d]=(0,G.useState)([]);c.key===e?c.content!==n&&l({key:e,content:n}):(d([...u.filter(t=>t.key!==e&&t.key!==c.key),c]),l({key:e,content:n}));let f=(0,G.useRef)(null);return(0,G.useLayoutEffect)(()=>{let e=o.current;if(!e||!(`ResizeObserver`in globalThis))return;f.current=e.getBoundingClientRect();let t=new ResizeObserver(()=>{e.getAnimations().length===0&&(f.current=e.getBoundingClientRect())});return t.observe(e),()=>{t.disconnect()}},[]),(0,G.useLayoutEffect)(()=>{let e=o.current;if(!e)return;let t=[...e.querySelectorAll(`:scope > [data-swap-leaving]`)],n=e.querySelector(`:scope > [data-swap-current]`);if(n===null||t.length===0)return;if(!JR(e)){d([]);return}let r=f.current,i=e.getBoundingClientRect(),a=BR(e),c=[n.animate([{opacity:0,filter:`blur(${String(a.blur)}px)`,transform:`translateY(${String(a.distance/2)}px)`},{opacity:1,filter:`blur(0px)`,transform:`none`}],{duration:a.normal,easing:qR(a,a.ease)})];for(let e of t){let t=e.animate([{opacity:1,filter:`blur(0px)`,transform:`none`},{opacity:0,filter:`blur(${String(a.blur)}px)`,transform:`translateY(${String(-a.distance/2)}px)`}],{duration:a.fast,easing:qR(a,a.easeExit),fill:`forwards`}),n=e.dataset.swapLeaving;t.onfinish=()=>{d(e=>e.filter(e=>e.key!==n))},c.push(t)}let l=r!==null&&(Math.abs(r.height-i.height)>.5||Math.abs(r.width-i.width)>.5);return!s&&l&&c.push(e.animate([{width:`${String(r.width)}px`,height:`${String(r.height)}px`},{width:`${String(i.width)}px`,height:`${String(i.height)}px`}],{duration:a.normal,easing:qR(a,a.ease)})),()=>{for(let e of c)e.cancel()}},[e,s]),(0,Z.jsx)(`div`,{...i,ref:o,className:Q(`caps-swap`,r),"data-anchor":t,children:[...u.map(e=>(0,Z.jsx)(`div`,{className:`caps-swap-layer`,"data-swap-leaving":e.key,"aria-hidden":`true`,children:e.content},e.key)),(0,Z.jsx)(`div`,{className:`caps-swap-layer`,"data-swap-current":``,children:n},e)]})});function F$({children:e,...t}){let[n,r]=(0,G.useState)(e);return e&&e!==n&&r(e),(0,Z.jsx)(yee,{...t,className:Q(`caps-field-error-reveal`,t.className),open:!!e,children:(0,Z.jsx)(`div`,{className:`caps-field-error`,role:`alert`,"aria-hidden":!e,children:n})})}function I$({children:e,divider:t=!0,error:n,layout:r=`end`,status:i,...a}){return(0,Z.jsxs)(`footer`,{...a,className:Q(`caps-form-footer`,a.className),"data-divider":t,"data-layout":r,children:[(0,Z.jsx)(F$,{children:n}),(0,Z.jsxs)(`div`,{className:`caps-form-footer-row`,children:[i?(0,Z.jsx)(`div`,{className:`caps-form-footer-status`,role:`status`,children:i}):null,(0,Z.jsx)(`div`,{className:`caps-form-footer-actions`,children:e})]})]})}var L$=(0,G.forwardRef)(function({busy:e=!1,children:t,className:n,layout:r,...i},a){return(0,Z.jsx)(`form`,{...i,"aria-busy":e||void 0,className:Q(`caps-form`,n),"data-layout":r,ref:a,children:(0,Z.jsx)(`fieldset`,{className:`caps-form-body`,disabled:e,children:t})})}),R$={2:`h2`,3:`h3`,4:`h4`},z$=(0,G.forwardRef)(function({children:e,className:t,description:n,layout:r,level:i=3,title:a,...o},s){let c=(0,G.useId)(),l=R$[i];return(0,Z.jsxs)(`section`,{...o,"aria-labelledby":`${c}-title`,className:Q(`caps-form-section`,t),"data-layout":r,ref:s,children:[(0,Z.jsxs)(`header`,{className:`caps-form-section-copy`,children:[(0,Z.jsx)(l,{className:`caps-form-section-title`,id:`${c}-title`,children:a}),n?(0,Z.jsx)(`p`,{className:`caps-form-section-description`,children:n}):null]}),(0,Z.jsx)(`div`,{className:`caps-form-section-fields`,children:e})]})}),B$=(0,G.forwardRef)(function({children:e,className:t,description:n,error:r,icon:i,layout:a,legend:o,legendTitle:s,...c},l){let u=(0,G.useId)(),d=[n?`${u}-description`:c[`aria-describedby`],r?`${u}-error`:null].filter(Boolean).join(` `)||void 0;return(0,Z.jsxs)(`fieldset`,{...c,"aria-describedby":d,"aria-invalid":r?!0:c[`aria-invalid`],className:Q(`caps-fieldset`,t),"data-layout":a,ref:l,children:[(0,Z.jsxs)(`legend`,{className:`caps-fieldset-legend`,title:s,children:[i?(0,Z.jsx)(`span`,{className:`caps-field-icon`,"aria-hidden":`true`,children:i}):null,o]}),n?(0,Z.jsx)(`p`,{className:`caps-fieldset-description`,id:`${u}-description`,children:n}):null,(0,Z.jsx)(`div`,{className:`caps-fieldset-fields`,children:e}),r===void 0?null:(0,Z.jsx)(F$,{id:`${u}-error`,children:r})]})});function V$(e){let t=[];return G.Children.forEach(e.props.children,e=>{(0,G.isValidElement)(e)&&e.type!==N$&&t.push(e)}),t[0]??null}var H$=(0,G.forwardRef)(function({children:e,className:t,description:n,error:r,icon:i,label:a,labelTitle:o,optional:s,orientation:c=`vertical`,readout:l=!1,required:u,...d},f){let p=(0,G.useId)(),m=(0,G.isValidElement)(e)?e:null,h=m?.type===M$,g=h?V$(m):m,_=g?.props.id??p,v=`${_}-description`,y=`${_}-error`,b=[g?.props[`aria-describedby`],n?v:null,r?y:null].filter(Boolean).join(` `)||void 0,x=u===!0||g?.props.required,S=r?!0:g?.props[`aria-invalid`],C=u===!0||g?.props[`aria-required`],w={id:_};x!==void 0&&(w.required=x),b!==void 0&&(w[`aria-describedby`]=b),S!==void 0&&(w[`aria-invalid`]=S),C!==void 0&&(w[`aria-required`]=C);let T=m&&g&&!l?h?(0,G.cloneElement)(m,void 0,G.Children.map(m.props.children,e=>e===g?(0,G.cloneElement)(g,w):e)):(0,G.cloneElement)(m,w):e,E=a?(0,Z.jsx)(j$,{htmlFor:l?void 0:_,title:o,className:c===`inline`?`font-normal`:void 0,...u===void 0?{}:{required:u},...s===void 0?{}:{optional:s},children:a}):null,D=a||n?(0,Z.jsxs)(`div`,{className:`caps-field-copy`,children:[E,n?(0,Z.jsx)(`p`,{className:`caps-field-description`,id:v,children:n}):null]}):null,O=i?(0,Z.jsxs)(`div`,{className:`caps-field-lead`,children:[(0,Z.jsx)(`span`,{className:`caps-field-icon`,"aria-hidden":`true`,children:i}),D]}):D;return(0,Z.jsxs)(`div`,{...d,className:Q(`caps-field`,t),"data-orientation":c,ref:f,children:[c===`horizontal`?(0,Z.jsxs)(`div`,{className:`caps-field-row`,children:[O,T]}):c===`inline`?(0,Z.jsxs)(`div`,{className:`caps-field-row`,children:[T,O]}):(0,Z.jsxs)(Z.Fragment,{children:[O,T]}),(0,Z.jsx)(F$,{id:y,children:r})]})});function U$(e){let t=String(e),n=t.indexOf(`.`);return n===-1?0:t.length-n-1}var W$=`M 9.86 38.14 A 20 20 0 1 1 38.14 38.14`,G$=6,K$=new Map([[`ArrowUp`,1],[`ArrowDown`,-1],[`PageUp`,10],[`PageDown`,-10]]),q$=(0,G.forwardRef)(function({className:e,decrementLabel:t=`Decrease`,defaultValue:n=null,disabled:r,incrementLabel:i=`Increase`,invalid:a,max:o,min:s,onBlur:c,onKeyDown:l,onValueChange:u,step:d=1,unit:f,value:p,wrap:m=!1,...h},g){let[_,v]=(0,G.useState)(n),[y,b]=(0,G.useState)(null),x=p===void 0?_:p,S=U$(d),C=e=>{let t=Number(e.toFixed(S));return s!==void 0&&t<s?s:o!==void 0&&t>o?o:t},w=e=>{let t=e===null?null:C(e);v(t),b(null),t!==x&&u?.(t)},T=()=>{if(y===null)return;let e=Number(y);w(y.trim()===``||!Number.isFinite(e)?null:e)},E=e=>{let t=(x??s??0)+e*d;if(m&&s!==void 0&&o!==void 0){if(t>o){w(s);return}if(t<s){w(o);return}}w(t)},D=s!==void 0&&x!==null&&x<=s,O=o!==void 0&&x!==null&&x>=o,k=r===!0,A=(0,G.useRef)(null),j=s!==void 0&&o!==void 0&&o>s?((x??s)-s)/(o-s):null,M=e=>{k||(e.currentTarget.setPointerCapture(e.pointerId),A.current={y:e.clientY,value:x??s??0})},N=e=>{if(!A.current)return;let t=Math.trunc((A.current.y-e.clientY)/G$),n=C(A.current.value+t*d);n!==x&&w(n)},P=()=>{A.current=null};return(0,Z.jsxs)(`span`,{className:Q(`caps-number-field`,e),"data-at-max":O||void 0,"data-at-min":D||void 0,"data-disabled":k||void 0,"data-wrap":m||void 0,children:[j===null?null:(0,Z.jsxs)(`svg`,{className:`caps-number-field-dial`,viewBox:`0 0 48 48`,"aria-hidden":`true`,focusable:`false`,onPointerDown:M,onPointerMove:N,onPointerUp:P,onPointerCancel:P,children:[(0,Z.jsx)(`path`,{className:`caps-number-field-dial-track`,d:W$,pathLength:100}),(0,Z.jsx)(`path`,{className:`caps-number-field-dial-level`,d:W$,pathLength:100,strokeDasharray:`${String(Math.max(.5,j*100))} 100`})]}),(0,Z.jsx)(kJ,{type:`button`,variant:`outline`,size:`icon`,className:`caps-number-field-decrement`,"aria-label":t,"aria-controls":h.id,tabIndex:-1,disabled:k||D&&!m,onClick:()=>{E(-1)},children:(0,Z.jsx)(GI,{"aria-hidden":`true`})}),(0,Z.jsxs)(`span`,{className:`caps-number-field-readout`,children:[(0,Z.jsx)(`input`,{...h,"aria-invalid":a?!0:h[`aria-invalid`]===!1?void 0:h[`aria-invalid`],className:`input caps-input caps-number-field-input`,disabled:r,inputMode:h.inputMode??(S>0?`decimal`:`numeric`),max:o,min:s,onBlur:e=>{T(),c?.(e)},onChange:e=>{b(e.target.value)},onKeyDown:e=>{if(l?.(e),e.defaultPrevented)return;let t=K$.get(e.key);t===void 0?e.key===`Home`&&s!==void 0?(e.preventDefault(),w(s)):e.key===`End`&&o!==void 0?(e.preventDefault(),w(o)):e.key===`Enter`&&T():(e.preventDefault(),E(t))},ref:g,step:d,type:`number`,value:y??(x===null?``:String(x))}),f?(0,Z.jsx)(`span`,{className:`caps-number-field-unit`,"aria-hidden":`true`,children:f}):null]}),(0,Z.jsx)(kJ,{type:`button`,variant:`outline`,size:`icon`,className:`caps-number-field-increment`,"aria-label":i,"aria-controls":h.id,tabIndex:-1,disabled:k||O&&!m,onClick:()=>{E(1)},children:(0,Z.jsx)(JI,{"aria-hidden":`true`})})]})}),J$=(0,G.forwardRef)(function({className:e,invalid:t,...n},r){return(0,Z.jsxs)(`span`,{className:`caps-select-shell`,children:[(0,Z.jsx)(`select`,{...n,"aria-invalid":t?!0:n[`aria-invalid`]===!1?void 0:n[`aria-invalid`],className:Q(`select select-bordered caps-select w-full`,t&&`select-error`,e),ref:r}),!n.multiple&&(!n.size||n.size<=1)?(0,Z.jsx)(jI,{className:`caps-select-chevron`,"aria-hidden":`true`}):null]})});function Y$({checked:e}){let t=`caps-switch-${(0,G.useId)().replaceAll(`:`,``)}`,n=(0,G.useRef)(null),r=(0,G.useRef)(null),i=(0,G.useRef)(e).current,a=(0,G.useRef)(e),o=$R();return(0,G.useLayoutEffect)(()=>{if(!n.current||!r.current)return;let t=o||a.current===e;a.current=e;let i=e?16:8,s=BR(n.current),c=dH(s,{bounce:.25,duration:440}),l=fH(s,{ease:`inOutSine`,duration:100}),u=UV(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=UV(r.current,{gradientTransform:e?`matrix(2 0 0 1 10 6)`:`matrix(1 0 0 1 6 6)`,...t?{duration:0}:{delay:l.duration,...c}});return()=>{u.cancel(),d.cancel()}},[e,o]),(0,Z.jsxs)(`svg`,{className:`caps-switch-visual`,width:`40`,height:`24`,viewBox:`0 0 20 12`,"aria-hidden":`true`,focusable:`false`,children:[(0,Z.jsxs)(`defs`,{children:[(0,Z.jsx)(YV,{ref:r,id:`${t}-surface`,transform:i?`matrix(2 0 0 1 10 6)`:`matrix(1 0 0 1 6 6)`}),(0,Z.jsx)(XV,{id:`${t}-shadow`}),(0,Z.jsx)(ZV,{id:`${t}-inset`}),(0,Z.jsx)(`clipPath`,{id:`${t}-track`,children:(0,Z.jsx)(`rect`,{x:`1`,y:`1`,width:`18`,height:`10`,rx:`5`})})]}),(0,Z.jsx)(`rect`,{className:`caps-switch-track`,filter:`url(#${t}-inset)`,x:`0.5`,y:`0.5`,width:`19`,height:`11`,rx:`5.5`}),(0,Z.jsx)(`g`,{clipPath:`url(#${t}-track)`,children:(0,Z.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 X$=(0,G.forwardRef)(function({className:e,checked:t,defaultChecked:n=!1,onChange:r,onCheckedChange:i,...a},o){let s=(0,G.useRef)(null),[c,l]=(0,G.useState)(n),u=t??c;return(0,G.useImperativeHandle)(o,()=>{if(!s.current)throw Error(`Switch input is not mounted`);return s.current},[]),(0,G.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,Z.jsxs)(`span`,{className:`caps-switch`,"data-checked":u,children:[(0,Z.jsx)(`input`,{...a,checked:u,className:Q(`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,Z.jsx)(Y$,{checked:u})]})}),Z$={2:`h2`,3:`h3`,4:`h4`};function Q$(e,t){let{reduced:n}=t,r=e&&!n,i=WR(t,600),[a,o]=(0,G.useState)(r);return(0,G.useEffect)(()=>{if(o(r),!r)return;let e=globalThis.setTimeout(()=>{o(!1)},i);return()=>{globalThis.clearTimeout(e)}},[r,i]),a}var $$=(0,Z.jsx)(lH,{decorative:!0,pace:`idle`,size:`md`,tone:`primary`,variant:`wander`}),e1=(0,G.forwardRef)(function({actions:e,secondaryAction:t,className:n,description:r,headingLevel:i=2,primaryAction:a,suggestions:o,thinking:s=!1,title:c,visual:l,renderVisual:u,variant:d=`plain`,...f},p){let m=(0,G.useId)(),h=(0,G.useRef)(null),g=UR(h),_=Q$(d===`speech`,g)&&!s,v=Z$[i],y=l??(d===`panel`?`blobs`:void 0),b=u?u({speaking:_,thinking:s}):y===`blobs`?$$:y,x=`${m}-reason`,S=(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(v,{ref:h,className:`empty-state-title`,id:f[`aria-labelledby`]?void 0:m,children:c}),(0,Z.jsx)(`p`,{children:r}),a?(0,Z.jsxs)(`div`,{className:`empty-state-primary`,children:[(0,Z.jsxs)(`div`,{className:`empty-state-action-row`,children:[(0,Z.jsx)(kJ,{"aria-describedby":a.disabled&&a.disabledReason?x:void 0,disabled:a.disabled,loading:a.pending===!0,onClick:a.onSelect,variant:`primary`,children:a.label}),t]}),a.disabled&&a.disabledReason?(0,Z.jsx)(`span`,{className:`empty-state-reason`,id:x,children:a.disabledReason}):null]}):null,o&&o.length>0?(0,Z.jsx)(`ul`,{"aria-label":`Try one of these`,className:`empty-state-suggestions`,children:o.map((e,t)=>(0,Z.jsx)(`li`,{children:(0,Z.jsx)(kJ,{disabled:e.disabled,loading:e.pending===!0,size:`sm`,variant:`outline`,onClick:e.onSelect,children:e.label})},`${String(t)}:${e.label}`))}):null,e?(0,Z.jsx)(`div`,{className:`empty-state-actions`,children:e}):null]});return(0,Z.jsxs)(`section`,{...f,"aria-labelledby":f[`aria-labelledby`]??m,className:Q(`empty-state`,d!==`plain`&&`empty-state-${d}`,n),ref:p,children:[b?(0,Z.jsx)(`div`,{"aria-hidden":`true`,className:`empty-state-visual`,children:b}):null,d===`speech`?(0,Z.jsx)(`div`,{className:`empty-state-bubble`,children:S}):S]})}),t1=8e3,n1=(0,G.forwardRef)(function({className:e,detail:t,framed:n=!0,icon:r,message:i,onRetry:a,size:o=`md`,slowAfterMs:s=t1,variant:c=`line`,...l},u){let[d,f]=(0,G.useState)(!1);return(0,G.useEffect)(()=>{if(f(!1),!Number.isFinite(s))return;let e=globalThis.setTimeout(()=>{f(!0)},s);return()=>{globalThis.clearTimeout(e)}},[s,i]),(0,Z.jsxs)(`div`,{...l,className:Q(`caps-loading-state`,e),"data-framed":n?void 0:`false`,"data-icon":r?``:void 0,"data-size":o,"data-slow":d||void 0,ref:u,role:`status`,children:[r?(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`caps-loading-state-icon`,children:r}):null,(0,Z.jsx)(lH,{decorative:!0,size:o,variant:c}),(0,Z.jsxs)(`span`,{className:`caps-loading-state-copy`,children:[(0,Z.jsx)(`span`,{children:i}),t?(0,Z.jsx)(`span`,{className:`caps-loading-state-detail`,children:t}):null,d?(0,Z.jsx)(`span`,{className:`caps-loading-state-detail`,children:`Still working…`}):null]}),d&&a?(0,Z.jsx)(kJ,{className:`caps-loading-state-retry`,size:`sm`,variant:`outline`,onClick:a,children:`Retry`}):null]})}),r1=`prints.composer.v1`,i1=160,a1=96,o1=24,s1=96,c1=.4,l1={maxHeight:i1,collapsed:!1};function u1(e,t){return Math.max(a1,Math.floor(Math.min(e*.7,t-200)))}function d1(e,t){return Math.round(Math.min(Math.max(e,a1),t))}var f1=Gx(zS(J({maxHeight:yS,collapsed:nS})));function p1(){try{return window.localStorage}catch(e){return e instanceof DOMException&&e.name===`SecurityError`||oW(`composer-storage-open`,e),null}}function m1(){let e=p1();if(e===null)return l1;try{let t=f1(e.getItem(r1));return Dd(t)?{maxHeight:Math.max(t.value.maxHeight,a1),collapsed:t.value.collapsed}:l1}catch(e){return oW(`composer-size-read`,e),l1}}function h1(e){let t=p1();if(t!==null)try{t.setItem(r1,JSON.stringify(e))}catch(e){oW(`composer-size-write`,e)}}function g1(){let[e,t]=(0,G.useState)(!1);return(0,G.useLayoutEffect)(()=>{let e=window.matchMedia(`(pointer: coarse)`),n=()=>{t(e.matches)};return n(),e.addEventListener(`change`,n),()=>{e.removeEventListener(`change`,n)}},[]),e}function _1(e){return e?.closest(`[data-app-pane]`)??null}function v1(e){let[t,n]=(0,G.useState)(l1),[r,i]=(0,G.useState)(u1(800,800)),[a,o]=(0,G.useState)(800),[s,c]=(0,G.useState)(!1),l=g1();(0,G.useLayoutEffect)(()=>{n(m1())},[]),(0,G.useLayoutEffect)(()=>{let t=()=>{let t=_1(e.current);i(u1(window.innerHeight,t?.clientHeight??window.innerHeight)),o(window.visualViewport?.height??window.innerHeight)};return t(),window.addEventListener(`resize`,t),window.visualViewport?.addEventListener(`resize`,t),()=>{window.removeEventListener(`resize`,t),window.visualViewport?.removeEventListener(`resize`,t)}},[e]);let u=d1(t.maxHeight,r),d=(0,G.useCallback)(e=>{n(e),h1(e)},[]),f=s&&l;return{cap:l?Math.max(a1,Math.round(a*c1)):u,coarse:l,collapsed:t.collapsed,fullscreen:f,min:a1,max:r,maxHeight:u,setMaxHeight:e=>{d({...t,maxHeight:d1(e,r)})},reset:()=>{d({...t,maxHeight:i1})},setCollapsed:e=>{d({...t,collapsed:e})},setFullscreen:c}}function y1({layout:e}){let[t,n]=(0,G.useState)(null);return e.coarse?null:(0,Z.jsx)(`div`,{"aria-label":`Resize prompt`,"aria-orientation":`horizontal`,"aria-valuemax":e.max,"aria-valuemin":e.min,"aria-valuenow":e.maxHeight,"aria-valuetext":`${String(e.maxHeight)} pixels`,className:`prints-composer-handle`,"data-composer-handle":!0,"data-dragging":t===null?void 0:``,onDoubleClick:e.reset,onKeyDown:t=>{let n=t.shiftKey?s1:o1,r=t.key===`ArrowUp`?e.maxHeight+n:t.key===`ArrowDown`?e.maxHeight-n:t.key===`Home`?e.min:t.key===`End`?e.max:null;t.key===`Enter`?(t.preventDefault(),e.reset()):r!==null&&(t.preventDefault(),e.setMaxHeight(r))},onPointerCancel:()=>{n(null)},onPointerDown:t=>{t.preventDefault(),t.currentTarget.setPointerCapture(t.pointerId),n({y:t.clientY,height:e.maxHeight})},onPointerMove:n=>{t!==null&&e.setMaxHeight(t.height+(t.y-n.clientY))},onPointerUp:()=>{n(null)},role:`separator`,tabIndex:0})}var b1=(0,G.createContext)(null),x1=(0,G.forwardRef)(function({children:e,defaultValue:t,onValueChange:n,value:r,...i},a){let[o,s]=(0,G.useState)(t),c=r??o,l=(0,G.useId)(),u=e=>{r===void 0&&s(e),n?.(e)},d=(e,t)=>`${l}-${e}-${encodeURIComponent(t)}`;return(0,Z.jsx)(b1.Provider,{value:{onValueChange:u,panelId:e=>d(`panel`,e),selectedValue:c,tabId:e=>d(`tab`,e)},children:(0,Z.jsx)(`div`,{...i,className:Q(`w-full`,i.className),ref:a,children:e})})});function S1(){let e=(0,G.useContext)(b1);if(!e)throw Error(`Tabs parts must be used inside <Tabs>`);return e}var C1=(0,G.forwardRef)(function({className:e,variant:t=`bordered`,...n},r){return(0,Z.jsx)(`div`,{...n,"aria-orientation":n[`aria-orientation`]??`horizontal`,className:Q(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`})}),w1=(0,G.forwardRef)(function({className:e,disabled:t,onClick:n,onKeyDown:r,value:i,...a},o){let s=S1(),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,Z.jsx)(`button`,{...a,"aria-controls":s.panelId(i),"aria-disabled":t?!0:void 0,"aria-selected":c,className:Q(`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,G.forwardRef)(function({children:e,className:t,forceMount:n=!1,value:r,...i},a){let o=S1(),s=o.selectedValue===r;return!s&&!n?null:(0,Z.jsx)(`div`,{...i,"aria-labelledby":o.tabId(r),className:Q(`mt-md focus-visible:outline-none`,t),hidden:!s,id:o.panelId(r),ref:a,role:`tabpanel`,tabIndex:0,children:e})});var T1=`prints-generation-notices`;function E1({count:e,total:t,canWrite:n,onToggleAll:r,onMove:i,onFavorite:a,onDone:o}){let s=t>0&&e===t;return(0,Z.jsxs)(`div`,{className:`prints-select-bar`,role:`toolbar`,"aria-label":`Selection`,children:[(0,Z.jsx)(`span`,{className:`prints-select-count`,"aria-live":`polite`,children:e===0?`Choose prints`:`${String(e)} selected`}),(0,Z.jsxs)(kJ,{size:`sm`,variant:`ghost`,className:`prints-select-all`,disabled:t===0,onClick:r,children:[(0,Z.jsx)(`span`,{className:`prints-select-wide`,children:s?`Clear selection`:`Select all in view`}),(0,Z.jsx)(`span`,{className:`prints-select-narrow`,children:s?`None`:`All`})]}),(0,Z.jsx)(`span`,{className:`prints-select-spacer`}),(0,Z.jsxs)(kJ,{size:`sm`,variant:`ghost`,"aria-label":`Favorite`,disabled:e===0||!n,onClick:a,children:[(0,Z.jsx)(zI,{"aria-hidden":!0,size:16}),(0,Z.jsx)(`span`,{className:`prints-select-wide`,children:`Favorite`})]}),(0,Z.jsxs)(kJ,{size:`sm`,disabled:e===0||!n,onClick:i,children:[(0,Z.jsx)(II,{"aria-hidden":!0,size:16}),(0,Z.jsxs)(`span`,{className:`prints-select-wide`,children:[`Move to… (`,e,`)`]}),(0,Z.jsxs)(`span`,{className:`prints-select-narrow`,children:[`Move (`,e,`)`]})]}),(0,Z.jsx)(LJ,{className:`prints-select-done`,"aria-label":`Done selecting`,title:`Done selecting`,icon:(0,Z.jsx)(QI,{}),size:`sm`,onClick:o})]})}function D1({view:e,lastFolder:t,onOpen:n,onFolders:r,subfolders:i,onOpenSubfolder:a}){return(0,Z.jsxs)(`div`,{className:`prints-library-bar`,children:[(0,Z.jsx)(zJ,{className:`prints-folders-button`,density:`compact`,label:null,"aria-label":`Folders`,title:`Folders`,icon:(0,Z.jsx)(LI,{size:16}),onClick:r}),(0,Z.jsx)(x1,{className:`prints-view-switch`,value:e.kind,onValueChange:e=>{n(e===`all`||e===`favorites`?{kind:e}:{kind:`folder`,folder:t})},children:(0,Z.jsxs)(C1,{variant:`segmented`,"aria-label":`View`,children:[(0,Z.jsx)(w1,{value:`folder`,children:`Folder`}),(0,Z.jsx)(w1,{value:`all`,children:`All`}),(0,Z.jsx)(w1,{value:`favorites`,children:`Favorites`})]})}),i.length>0?(0,Z.jsx)(`div`,{className:`prints-folder-chips`,role:`list`,"aria-label":`Folders`,children:i.map(e=>(0,Z.jsx)(zJ,{role:`listitem`,density:`compact`,className:`prints-folder-chip`,icon:(0,Z.jsx)(RI,{size:16}),label:e,onClick:()=>{a(e)}},e))}):null]})}var O1={conflict:`a file or folder with that name is already there`,not_found:`it is no longer in the library`,invalid:`a folder can't move into itself`,not_granted:`Prints isn't allowed to change this Computer`,unavailable:`the Computer didn't answer`};function k1(e,t,n,r){let{moved:i,failed:a}=n;if(a.length>0){let e=a[0];sI.error(`Couldn't move ${String(a.length)} ${a.length===1?`item`:`items`}: ${O1[e.error]}.`,{toasterId:T1,id:`prints-move-error`})}i.length!==0&&sI(`Moved ${String(i.length)} ${i.length===1?`item`:`items`}`,{toasterId:T1,duration:8e3,action:{label:`Undo`,onClick:()=>{let n=new Map;for(let{from:e,to:r}of i){let i=WH(t,e)??``;n.set(i,[...n.get(i)??[],r])}Promise.all([...n].map(([t,n])=>eU(e,{paths:n,folder:t===``?void 0:t}))).then(()=>{r()},e=>{oW(`prints-undo-move`,e),sI.error(`Couldn't undo that move.`,{toasterId:T1}),r()})}}})}var A1=24,j1=`prints-generation-notices`;function M1(e,t){let[n,r]=(0,G.useState)({entries:[],index:-1}),i=(e,t)=>e.kind===t.kind&&(e.kind!==`folder`||t.kind===`folder`&&e.folder===t.folder),a=n=>{r(t=>{let r=t.entries[t.index]??e;if(i(r,n))return t;let a=t.entries.slice(0,t.index+1),o=a.length===0?[e]:a;return{entries:[...o,n],index:o.length}}),t(n)},o=e=>{let i=n.index+e;if(i<0||i>=n.entries.length)return!1;let a=n.entries[i];return r({...n,index:i}),t(a),!0};return{open:a,canGoBack:n.index>0,canGoForward:n.index>=0&&n.index<n.entries.length-1,back:()=>o(-1),forward:()=>o(1)}}function N1({app:e,destination:t,view:n,setView:r,entries:i,canWrite:a}){let o=vC(),s=M1(n,r),[c,l]=(0,G.useState)(0),[u,d]=(0,G.useState)(),f=n.kind===`folder`?n.folder:void 0,p=n.kind===`folder`;(0,G.useEffect)(()=>{p&&d(f)},[p,f]);let[m,h]=(0,G.useState)(!1),[g,_]=(0,G.useState)(new Set),[v,y]=(0,G.useState)(null),[b,x]=(0,G.useState)(null),[S,C]=(0,G.useState)(new Map),w=e?.capabilities.has(iP)===!0,T=Vw({queries:(0,G.useMemo)(()=>{let e=i.map(e=>e.path),t=[];for(let n=0;n<e.length;n+=A1)t.push(e.slice(n,n+A1));return t},[i]).map(n=>({...nP(e,iP,sU.described(e,n),async(t,r)=>{if(!e)return[];let i=await tU(e,n);return r.throwIfAborted(),i}),enabled:w&&t!==null,retry:!1})),combine:e=>{let t=new Map;for(let n of e)for(let e of n.data??[])t.set(e.path,e);return t}}),E=(0,G.useCallback)(()=>{l(e=>e+1),_(new Set),o.invalidateQueries({queryKey:sU.listings(e)}),o.invalidateQueries({queryKey:sU.describedAll(e)})},[e,o]),D=(0,G.useCallback)(async(n,r,i={})=>{if(!(!e||t===null)){try{k1(e,t,await eU(e,{paths:n,folder:r,createFolder:i.create??!1,name:i.name}),E)}catch(e){oW(`prints-move-files`,e),sI.error(`Couldn't move those. Check the Computer and try again.`,{toasterId:j1,id:`prints-move-error`})}E()}},[e,t,E]),O=(0,G.useCallback)((t,r)=>{e&&(C(e=>{let n=new Map(e);for(let e of t)n.set(e,r);return n}),nU(e,t,r).then(()=>{o.invalidateQueries({queryKey:sU.describedAll(e)}),n.kind===`favorites`&&o.invalidateQueries({queryKey:sU.listings(e)})},e=>{oW(`prints-set-favorite`,e),sI.error(`Couldn't change that favorite.`,{toasterId:j1,id:`prints-favorite-error`}),C(e=>{let n=new Map(e);for(let e of t)n.delete(e);return n})}))},[e,o,n.kind]),k=(0,G.useCallback)(async(n,r)=>{if(!e||t===null)return`Choose a library folder first.`;let i=r.trim();if(!HH(i)||i.includes(`/`))return`Use a single name, without slashes.`;let a=n===void 0?i:`${n}/${i}`;if(!HH(a))return`That folder name is too long.`;try{await e.capabilities.require(BF).mkdir({path:UH(t,a)})}catch(e){return oW(`prints-new-folder`,e),`Couldn't create the folder. Check Computer write access.`}return E(),s.open({kind:`folder`,folder:a}),null},[e,t,s,E]),A=(0,G.useMemo)(()=>n.kind===`folder`?[{id:``,label:t?.split(`/`).at(-1)??`Library`},...GH(n.folder).map(({name:e,folder:t})=>({id:t,label:e}))].slice(-8):[{id:n.kind,label:n.kind===`all`?`All prints`:`Favorites`}],[t,n]),j=e=>S.get(e)??T.get(e)?.favorite??!1,M=e=>{if(t===null||!e.path.startsWith(`${t}/`))return e;let r=T.get(e.path),o=S.get(e.path)??r?.favorite??!1,s=i.find(t=>t.path===e.path),c={...e,badge:void 0,folderCaption:n.kind===`folder`?void 0:s?.folder,favorite:o,select:{active:m,checked:g.has(e.path),onToggle:()=>{_(t=>{let n=new Set(t);return n.has(e.path)?n.delete(e.path):n.add(e.path),n})}}};return!e.pending&&r!==void 0&&(c.badge=r.kind===null?{label:null,seconds:null}:{label:r.modelLabel??r.model,seconds:r.durationSeconds}),w&&(c.onToggleFavorite=()=>{O([e.path],!o)}),w&&a&&(c.onMove=()=>{y([e.path])}),c},N=n.kind===`all`?`All prints`:n.kind===`favorites`?`Favorites`:n.folder?.split(`/`).at(-1)??`Library`,P=n.kind===`folder`&&n.folder!==void 0?n.folder.split(`/`).slice(0,-1).join(`/`):null;return{title:N,up:P===null?void 0:()=>{s.open({kind:`folder`,folder:P===``?void 0:P})},lastFolder:u,history:s,version:c,refresh:E,crumbs:A,selecting:m,setSelecting:e=>{h(e),e||_(new Set)},selected:g,selectAll:e=>{_(new Set(e))},moving:v,setMoving:y,newFolder:b,setNewFolder:x,move:D,toggleFavorite:O,createFolder:k,enrich:M,isFavorite:j,folderOf:WH}}function P1(e,t){return{kind:`button`,id:`folder`,text:t.checking?`Checking…`:`prints`,icon:`folder`,title:e===null?`Choose where Prints saves images`:AE(`Save prints to ${e}`,1024),opens:`dialog`,expanded:t.editing}}var F1=`modulepreload`,I1=function(e,t){return new URL(e,t).href},L1={},R1=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=I1(t,n),t=s(t),t in L1)return;L1[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`:F1,r||(i.as=`script`),i.crossOrigin=``,i.href=t,a&&i.setAttribute(`nonce`,a),document.head.appendChild(i),r)return new Promise((e,n)=>{i.addEventListener(`load`,e),i.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})};function z1(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 B1(e){let t=new Map;for(let n of e.bindings)t.set(n.commandId,[...t.get(n.commandId)??[],z1(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 V1(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 H1(e,t,n,r){return e.map(e=>({entry:e,match:V1(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 U1=[`help`,`login`,`model`];function W1(e,t,n={}){if(!t.startsWith(`/`)||t.includes(`
85
+ `))return{kind:`none`};let r=t.search(/\s/u);if(r<0){let r=t.slice(1);return{kind:`commands`,query:r,items:H1(e.filter(e=>e.availability.status===`available`&&(r.length===0?e.category===(n.idleCategory??`Conversation`)||U1.includes(e.alias):e.category!==`Advanced`||e.alias.toLocaleLowerCase().startsWith(r.toLocaleLowerCase()))),e=>e.alias,r,e=>{let t=U1.indexOf(e.alias);return r.length===0&&t>=0?t-U1.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 G1=(0,G.forwardRef)(function({className:e,count:t,density:n=`row`,dismissAriaLabel:r,dismissLabel:i=`Dismiss`,message:a,onDismiss:o,onRetry:s,retryAriaLabel:c,retryLabel:l=`Retry`,role:u=`status`,...d},f){return(0,Z.jsxs)(`div`,{...d,className:Q(`caps-failure-line`,e),"data-density":n,ref:f,role:u,children:[(0,Z.jsx)(SH,{glyph:`dot`,tone:`error`}),(0,Z.jsxs)(`span`,{className:`caps-failure-line-copy`,children:[(0,Z.jsx)(`span`,{children:a}),t!==void 0&&t>1?(0,Z.jsxs)(`span`,{className:`caps-failure-line-count`,children:[`Failed `,t,` times`]}):null]}),s||o?(0,Z.jsxs)(`span`,{className:`caps-failure-line-actions`,children:[s?(0,Z.jsx)(kJ,{"aria-label":c,size:`sm`,variant:`outline`,onClick:s,children:l}):null,o?(0,Z.jsx)(kJ,{"aria-label":r,size:`sm`,variant:`ghost`,onClick:o,children:i}):null]}):null]})}),K1=G.createContext(void 0);function q1(e=!1){let t=G.useContext(K1);if(t===void 0&&!e)throw Error(nY(16));return t}function J1(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:G.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 Y1(e,t,{detail:n=0,pointerType:r=``}={}){e.dispatchEvent(new(iX(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 X1(e={}){let{disabled:t=!1,focusableWhenDisabled:n,tabIndex:r=0,native:i=!0,composite:a}=e,o=G.useRef(null),s=q1(!0),c=a??s!==void 0,{props:l}=J1({focusableWhenDisabled:n,disabled:t,composite:c,tabIndex:r,isNativeButton:i}),u=G.useCallback(()=>{let e=o.current;Z1(e)&&c&&t&&l.disabled===void 0&&e.disabled&&(e.disabled=!1)},[t,l.disabled,c]);return $(u,[u]),{getButtonProps:G.useCallback((e={})=>{let{onClick:n,onMouseDown:r,onKeyUp:a,onKeyDown:o,onPointerDown:s,...u}=e;return yY({onClick(e){if(t){e.preventDefault();return}n?.(e)},onMouseDown(e){t||r?.(e)},onKeyDown(e){if(t||(kY(e),o?.(e),e.baseUIHandlerPrevented))return;let n=e.target===e.currentTarget,r=e.currentTarget,a=Z1(r),s=!i&&Q1(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(),Y1(r,e));return}if(!l||i||!d&&!u){n&&s&&d&&e.preventDefault();return}e.defaultPrevented||(e.preventDefault(),u&&(e.preventBaseUIHandler(),Y1(r,e)))},onKeyUp(e){if(!t){if(kY(e),a?.(e),e.target===e.currentTarget&&i&&c&&Z1(e.currentTarget)&&e.key===` `){e.preventDefault();return}e.baseUIHandlerPrevented||e.target===e.currentTarget&&!i&&!c&&!e.defaultPrevented&&e.key===` `&&(e.preventBaseUIHandler(),Y1(e.currentTarget,e))}},onPointerDown(e){if(t){e.preventDefault();return}s?.(e)}},i?{type:`button`}:{role:`button`},l,u)},[t,l,c,i]),buttonRef:GJ(e=>{o.current=e,u()})}}function Z1(e){return cX(e)&&e.tagName===`BUTTON`}function Q1(e){return cX(e)&&e.tagName===`A`&&!!e.href}function $1(e,t,n,r){let i=!1,a=!1,o=r??XJ;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 e0(e,t,n){let r=n??XJ;return{reason:e,event:t??new Event(`base-ui`),...r}}var t0=`none`,n0=`trigger-press`,r0=`trigger-hover`,i0=`trigger-focus`,a0=`outside-press`,o0=`item-press`,s0=`close-press`,c0=`focus-out`,l0=`escape-key`,u0=`list-navigation`,d0=`keyboard`,f0=`pointer`,p0=`cancel-open`,m0=`sibling-open`,h0=`imperative-action`;function g0(e,t){return t!=null&&!NZ(t)?0:typeof e==`function`?e():e}function _0(e,t,n){let r=g0(e,n);return typeof r==`number`?r:r?.[t]}function v0(e){return typeof e==`function`?e():e}function y0(e,t){return t||e===`click`||e===`mousedown`}function b0(e){return e?.includes(`mouse`)&&e!==`mousedown`}function x0(...e){return()=>{for(let t=0;t<e.length;t+=1){let n=e[t];n&&n()}}}function S0(e){let t=HJ(C0,e).current;return t.next=e,$(t.effect),t}function C0(e){let t={current:e,next:e,effect:()=>{t.current=t.next}};return t}var w0=null;globalThis.requestAnimationFrame;var T0=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)}},E0=class e{static create(){return new e}static request(e){return T0.request(e)}static cancel(e){return T0.cancel(e)}currentId=w0;request(e){this.cancel(),this.currentId=T0.request(()=>{this.currentId=w0,e()})}cancel=()=>{this.currentId!==w0&&(T0.cancel(this.currentId),this.currentId=w0)};disposeEffect=()=>this.cancel};function D0(){let e=HJ(E0.create).current;return ZJ(e.disposeEffect),e}var O0={clipPath:`inset(50%)`,overflow:`hidden`,whiteSpace:`nowrap`,border:0,padding:0,width:1,height:1,margin:-1},k0={...O0,position:`fixed`,margin:0,top:0,left:0};({...O0});var A0=G.forwardRef(function(e,t){let[n,r]=G.useState();$(()=>{zX&&RX&&r(`button`)},[]);let i={tabIndex:0,role:n};return(0,Z.jsx)(`span`,{...e,ref:t,style:k0,"aria-hidden":!n||void 0,...i,"data-base-ui-focus-guard":``})});function j0(e){return`data-base-ui-${e}`}var M0=0;function N0(e,t={}){let{preventScroll:n=!1,sync:r=!1,shouldFocus:i}=t;cancelAnimationFrame(M0);function a(){i&&!i()||e?.focus({preventScroll:n})}if(r)return a(),JJ;let o=requestAnimationFrame(a);return M0=o,()=>{M0===o&&(cancelAnimationFrame(o),M0=0)}}var P0=`data-base-ui-inert`,F0=new WeakMap,I0=new WeakSet,L0=new WeakMap,R0=0;function z0(e){return e?lX(e)?e.host:z0(e.parentNode):null}var B0=(e,t)=>t.map(t=>{if(e.contains(t))return t;let n=z0(t);return e.contains(n)?n:null}).filter(e=>e!=null),V0=e=>{let t=new Set;return e.forEach(e=>{let n=e;for(;n&&!t.has(n);)t.add(n),n=n.parentNode}),t},H0=(e,t,n)=>{let r=[],i=e=>{!e||n.has(e)||Array.from(e.children).forEach(e=>{rX(e)!==`script`&&(t.has(e)?i(e):r.push(e))})};return i(e),r};function U0(e,t,n,{mark:r=!0}){let i=B0(t,e),a=r?H0(t,V0(i),new Set(i)):[],o=[],s=[];if(n){let e=B0(t,Array.from(t.querySelectorAll(`[aria-live]`))),n=i.concat(e);H0(t,V0(n),new Set(n)).forEach(e=>{let t=e.getAttribute(`aria-hidden`),n=t!==null&&t!==`false`,r=(F0.get(e)||0)+1;F0.set(e,r),o.push(e),r===1&&n&&I0.add(e),n||e.setAttribute(`aria-hidden`,`true`)})}return r&&a.forEach(e=>{let t=(L0.get(e)||0)+1;L0.set(e,t),s.push(e),t===1&&e.setAttribute(P0,``)}),R0+=1,()=>{o.forEach(e=>{let t=(F0.get(e)||0)-1;F0.set(e,t),t||(I0.has(e)||e.removeAttribute(`aria-hidden`),I0.delete(e))}),r&&s.forEach(e=>{let t=(L0.get(e)||0)-1;L0.set(e,t),t||e.removeAttribute(P0)}),--R0,R0||(F0=new WeakMap,I0=new WeakSet,L0=new WeakMap)}}function W0(e,t={}){let{ariaHidden:n=!1,mark:r=!0}=t,i=gQ(e[0]).body;return U0(e,i,n,{mark:r})}var G0={style:{transition:`none`}},K0=`data-base-ui-click-trigger`,q0={fallbackAxisSide:`none`},J0={fallbackAxisSide:`end`},Y0={clipPath:`inset(50%)`,position:`fixed`,top:0,left:0},X0=G.createContext(null),Z0=()=>G.useContext(X0),Q0=j0(`portal`);function $0(e={}){let{ref:t,container:n,componentProps:r=XJ,elementProps:i}=e,a=KY(),o=Z0()?.portalNode,[s,c]=G.useState(null),[l,u]=G.useState(null),d=GJ(e=>{e!==null&&u(e)}),f=G.useRef(null);$(()=>{if(n===null){f.current&&(f.current=null,u(null),c(null));return}let e=(n&&(oX(n)?n:n.current))??o??document.body;if(e==null){f.current&&(f.current=null,u(null),c(null));return}f.current!==e&&(f.current=e,u(null),c(e))},[n,o]);let p=MY(`div`,r,{ref:[t,d],props:[{id:a,[Q0]:``},i]}),m=s&&p?WF.createPortal(p,s):null;return{node:l,nodeId:G.isValidElement(p)?p.props.id:void 0,subtree:m}}var e2=G.forwardRef(function(e,t){let{render:n,className:r,style:i,children:a,container:o,portalOwnerRole:s,...c}=e,{node:l,nodeId:u,subtree:d}=$0({container:o,ref:t,componentProps:e,elementProps:c}),f=G.useRef(null),p=G.useRef(null),m=G.useRef(null),h=G.useRef(null),[g,_]=G.useState(null),v=G.useRef(!1),y=g?.modal,b=g?.open,x=!!g&&!g.modal&&g.open&&!!l;G.useEffect(()=>{if(!l||y)return;function e(e){l&&e.relatedTarget&&LQ(e)&&(e.type===`focusin`?v.current&&=(zQ(l),!1):(RQ(l),v.current=!0))}return x0(v$(l,`focusin`,e,!0),v$(l,`focusout`,e,!0))},[l,y]),$(()=>{!l||b!==!0||!v.current||(zQ(l),v.current=!1)},[b,l]);let S=G.useMemo(()=>({beforeOutsideRef:f,afterOutsideRef:p,beforeInsideRef:m,afterInsideRef:h,portalNode:l,setFocusManagerState:_}),[l]);return(0,Z.jsxs)(G.Fragment,{children:[d,(0,Z.jsxs)(X0.Provider,{value:S,children:[x&&l&&(0,Z.jsx)(A0,{"data-type":`outside`,ref:f,onFocus:e=>{LQ(e,l)?m.current?.focus():FQ(g?g.domReference:null)?.focus()}}),x&&l&&(0,Z.jsx)(`span`,{role:s,"aria-owns":u,style:Y0}),l&&WF.createPortal(a,l),x&&l&&(0,Z.jsx)(A0,{"data-type":`outside`,ref:p,onFocus:e=>{LQ(e,l)?h.current?.focus():(PQ(g?g.domReference:null)?.focus(),g?.closeOnFocusOut&&g?.onOpenChange(!1,$1(`focus-out`,e.nativeEvent)))}})]})]})});function t2(){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 n2=class{nodesRef={current:[]};events=t2();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)}},r2=G.createContext(null),i2=G.createContext(null),a2=()=>G.useContext(r2)?.id||null,o2=e=>{let t=G.useContext(i2);return e??t};function s2(e){let t=KY(),n=o2(e),r=a2();return $(()=>{if(!t)return;let e={id:t,parentId:r};return n?.addNode(e),()=>{n?.removeNode(e)}},[n,t,r]),t}function c2(e){let{children:t,id:n}=e,r=a2();return(0,Z.jsx)(r2.Provider,{value:G.useMemo(()=>({id:n,parentId:r}),[n,r]),children:t})}function l2(e){let{children:t,externalTree:n}=e,r=HJ(()=>n??new n2).current;return(0,Z.jsx)(i2.Provider,{value:r,children:t})}function u2(e){return e==null?e:`current`in e?e.current:e}function d2(e,t){let n=iX(WX(e));return e instanceof n.KeyboardEvent?`keyboard`:e instanceof n.FocusEvent?t||`keyboard`:`pointerType`in e?e.pointerType||(jZ(e)?`keyboard`:t||`mouse`):`touches`in e?`touch`:e instanceof n.MouseEvent?t||(e.detail===0?`keyboard`:`mouse`):``}var f2=20,p2=[];function m2(){p2=p2.filter(e=>e.deref()?.isConnected)}function h2(e){m2(),e&&rX(e)!==`body`&&(p2.push(new WeakRef(e)),p2.length>f2&&(p2=p2.slice(-20)))}function g2(){return m2(),p2[p2.length-1]?.deref()}function _2(e){return e?AQ(e)?e:MQ(e)[0]||e:null}function v2(e){if(e.hasAttribute(`tabindex`)&&!e.hasAttribute(`data-tabindex`)||!e.getAttribute(`role`)?.includes(`dialog`))return;let t=jQ(e).filter(e=>{let t=e.getAttribute(`data-tabindex`)||``;return AQ(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 y2(e){let{context:t,children:n,disabled:r=!1,initialFocus:i=!0,returnFocus:a=!0,explicitReturnFocus:o,restoreFocus:s=!1,modal:c=!0,closeOnFocusOut:l=!0,openInteractionType:u=``,nextFocusableElement:d,previousFocusableElement:f,beforeContentFocusGuardRef:p,externalTree:m,getInsideElements:h}=e,g=t.useState(`open`),_=t.useState(`domReferenceElement`),v=t.useState(`floatingElement`),{events:y,dataRef:b}=t.context,x=GJ(()=>b.current.floatingContext?.nodeId),S=i===!1,C=wZ(_)&&S,w=S0(i),T=S0(a),E=S0(o),D=S0(u),O=S0(g),k=o2(m),A=Z0(),j=G.useRef(!1),M=G.useRef(!1),N=G.useRef(!1),P=G.useRef(null),F=G.useRef(``),I=G.useRef(``),L=G.useRef(null),R=G.useRef(null),z=aY(L,p,A?.beforeInsideRef),ee=aY(R,A?.afterInsideRef),te=eY(),B=eY(),ne=D0(),re=A!=null,V=EZ(v),H=GJ((e=V)=>e?MQ(e):[]),ie=GJ(()=>h?.().filter(e=>e!=null)??[]);G.useEffect(()=>{if(r||!c)return;function e(e){e.key===`Tab`&&HX(V,VX(gQ(V)))&&H().length===0&&!C&&kZ(e)}return v$(gQ(V),`keydown`,e)},[r,V,c,C,H]),G.useEffect(()=>{if(r||!g)return;let e=gQ(V);function t(){N.current=!1}function n(e){let t=WX(e),n=ie(),r=HX(v,t)||HX(_,t)||HX(A?.portalNode,t)||n.some(e=>e===t||HX(e,t));N.current=!r,I.current=e.pointerType||`keyboard`,UX(t,`[data-base-ui-click-trigger]`)&&(M.current=!0,B.start(0,()=>{M.current=!1}))}function i(){I.current=`keyboard`}return x0(v$(e,`pointerdown`,n,!0),v$(e,`pointerup`,t,!0),v$(e,`pointercancel`,t,!0),v$(e,`keydown`,i,!0),t)},[r,v,_,V,g,A,B,ie]),G.useEffect(()=>{if(r||!l)return;let e=gQ(V);function n(){M.current=!0,B.start(0,()=>{M.current=!1})}function i(e){let t=WX(e);AQ(t)&&(P.current=t)}function a(n){let r=n.relatedTarget,i=n.currentTarget,a=WX(n);c&&r==null&&a!=null&&HX(v,a)&&h2(a),queueMicrotask(()=>{let o=x(),l=t.context.triggerElements,u=ie(),p=r?.hasAttribute(j0(`focus-guard`))&&[L.current,R.current,A?.beforeInsideRef.current,A?.afterInsideRef.current,A?.beforeOutsideRef.current,A?.afterOutsideRef.current,u2(f),u2(d)].includes(r),m=!(HX(_,r)||HX(v,r)||HX(r,v)||HX(A?.portalNode,r)||u.some(e=>e===r||HX(e,r))||l.hasMatchingElement(e=>HX(e,r))||p||k&&(DZ(k.nodesRef.current,o).find(e=>HX(e.context?.elements.floating,r)||HX(e.context?.elements.domReference,r))||OZ(k.nodesRef.current,o).find(e=>[e.context?.elements.floating,EZ(e.context?.elements.floating)].includes(r)||e.context?.elements.domReference===r)));if(i===_&&V&&v2(V),s&&i!==_&&!hQ(a)&&VX(e)===e.body){if(cX(V)&&(V.focus(),s===`popup`)){ne.request(()=>{V.focus()});return}let e=H(),t=P.current,n=(t&&e.includes(t)?t:null)||e[e.length-1]||V;cX(n)&&n.focus()}if(b.current.insideReactTree){b.current.insideReactTree=!1;return}(C||!c)&&r&&m&&!M.current&&(C||r!==g2())&&(j.current=!0,t.setOpen(!1,$1(c0,n)))})}function o(){N.current||(b.current.insideReactTree=!0,te.start(0,()=>{b.current.insideReactTree=!1}))}let u=cX(_)?_:null;if(!(!v&&!u))return x0(u&&v$(u,`focusout`,a),u&&v$(u,`pointerdown`,n),v&&v$(v,`focusin`,i),v&&v$(v,`focusout`,a),v&&A&&v$(v,`focusout`,o,!0))},[r,_,v,V,c,k,A,t,l,s,H,C,x,b,te,B,ne,d,f,ie]),G.useEffect(()=>{if(r||!v||!g)return;let e=Array.from(A?.portalNode?.querySelectorAll(`[${j0(`portal`)}]`)||[]),t=(k?OZ(k.nodesRef.current,x()):[]).find(e=>wZ(e.context?.elements.domReference||null))?.context?.elements.domReference,n=W0([v,...e,L.current,R.current,A?.beforeOutsideRef.current,A?.afterOutsideRef.current,...ie(),t,u2(f),u2(d),C?_:null].filter(e=>e!=null),{ariaHidden:c||C,mark:!1}),i=W0([v,...e].filter(e=>e!=null));return()=>{i(),n()}},[g,r,_,v,c,A,C,k,x,d,f,ie]),$(()=>{if(!g||r||!cX(V))return;F.current=``,I.current=``;let e=gQ(V),t=VX(e);queueMicrotask(()=>{let n=w.current,r=typeof n==`function`?n(D.current||``):n;if(r===void 0||r===!1||HX(V,t))return;let i=null,a=()=>(i??=H(V),i[0]||V),o;o=r===!0||r===null?a():u2(r),o||=a();let s=HX(V,VX(e)),c=b.current.openEvent,l=c?.type===`mousedown`&&jZ(c);N0(o,{sync:l,preventScroll:o===V,shouldFocus(){if(!O.current)return!1;if(s)return!0;let t=VX(e);return!(t!==o&&HX(V,t))}})})},[r,g,V,H,w,D,O,b]);let ae=G.useRef(null);$(()=>{if(r||!V){ae.current=null;return}ae.current&&=(ae.current.cancelled=!0,null);let e=gQ(V),t=VX(e),n=D.current==null;h2(t);function i(e){if(e.open||(F.current=d2(e.nativeEvent,I.current)),(e.reason===`focus-out`&&e.triggerElement?.hasAttribute(j0(`focus-guard`))||e.reason===`trigger-hover`&&e.nativeEvent.type===`mouseleave`)&&(j.current=!0),e.reason===`outside-press`){if(e.nested)j.current=!1;else if(jZ(e.nativeEvent)||MZ(e.nativeEvent))j.current=!1;else{let e=!1;gQ(V).createElement(`div`).focus({get preventScroll(){return e=!0,!1}}),e?j.current=!1:j.current=!0}}}y.on(`openchange`,i);function a(e){let r=T.current,i=typeof r==`function`?r(e):r;if(i===void 0||i===!1)return null;i===null&&(i=!0);let a=_?.isConnected?_:null,o=t?.isConnected&&rX(t)!==`body`?t:null,s=n?o||a:a||o;return s||=g2()||null,typeof i==`boolean`?s:u2(i)||s||null}return()=>{y.off(`openchange`,i);let t=VX(e),n=ie(),r=HX(v,t)||n.some(e=>e===t||HX(e,t))||k&&DZ(k.nodesRef.current,x(),!1).some(e=>HX(e.context?.elements.floating,t)),o=T.current,s=F.current,c=a(s),l={cancelled:!1};ae.current=l,queueMicrotask(()=>{ae.current===l&&(ae.current=null);let n=_2(c),i=E.current??typeof o!=`boolean`;if(!l.cancelled&&o&&!j.current&&cX(n)&&(!(!i&&n!==t&&t!==e.body)||r)){let e={preventScroll:!0};s===`keyboard`&&(e.focusVisible=!0),n.focus(e)}j.current=!1})}},[r,v,V,T,E,D,y,k,_,x,ie]),$(()=>{if(!RX||g||!v)return;let e=VX(gQ(v));!cX(e)||!SZ(e)||HX(v,e)&&e.blur()},[g,v]),$(()=>{if(!(r||!A))return A.setFocusManagerState({modal:c,closeOnFocusOut:l,open:g,onOpenChange:t.setOpen,domReference:_}),()=>{A.setFocusManagerState(null)}},[r,A,c,g,t,l,_]),$(()=>{if(!(r||!V))return v2(V),()=>{queueMicrotask(m2)}},[r,V]);let oe=!r&&(!c||!C)&&(re||c);return(0,Z.jsxs)(G.Fragment,{children:[oe&&(0,Z.jsx)(A0,{"data-type":`inside`,ref:z,onFocus:e=>{if(c){let e=H();N0(e[e.length-1])}else A?.portalNode&&(j.current=!1,LQ(e,A.portalNode)?PQ(_)?.focus():u2(f??A.beforeOutsideRef)?.focus())}}),n,oe&&(0,Z.jsx)(A0,{"data-type":`inside`,ref:ee,onFocus:e=>{c?N0(H()[0]):A?.portalNode&&(l&&(j.current=!0),LQ(e,A.portalNode)?FQ(_)?.focus():u2(d??A.afterOutsideRef)?.focus())}})]})}function b2(e,t={}){let{enabled:n=!0,event:r=`click`,toggle:i=!0,ignoreMouse:a=!1,stickIfOpen:o=!0,touchOpenDelay:s=0,reason:c=n0}=t,l=e.context.dataRef,u=G.useRef(void 0),d=D0(),f=eY(),p=G.useMemo(()=>{function t(t,n,r,i){let a=$1(c,n,r);t&&i===`touch`&&s>0?f.start(s,()=>{e.setOpen(!0,a)}):e.setOpen(t,a)}function n(t,n,r){let a=l.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){u.current=NZ(e.pointerType,!0)&&MZ(e.nativeEvent)?`virtual`:e.pointerType},onMouseDown(i){let o=u.current,s=i.nativeEvent,c=e.select(`open`);if(i.button!==0||r===`click`||NZ(o,!0)&&a)return;let l=n(c,i.currentTarget,e=>e===`click`||e===`mousedown`),f=WX(s),p=SZ(f);if(p||o===`virtual`){t(l,s,p?f:i.currentTarget,o);return}let m=i.currentTarget;d.request(()=>{t(l,s,m,o)})},onClick(i){if(r===`mousedown-only`)return;let o=u.current;if(r===`mousedown`&&o){u.current=void 0;return}NZ(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(){u.current=void 0}}},[l,r,a,c,e,o,i,d,f,s]);return G.useMemo(()=>n?{reference:p}:XJ,[n,p])}function x2(){return!1}function S2(e){return{escapeKey:typeof e==`boolean`?e:e?.escapeKey??!1,outsidePress:typeof e==`boolean`?e:e?.outsidePress??!0}}function C2(e,t={}){let{enabled:n=!0,escapeKey:r=!0,outsidePress:i=!0,outsidePressEvent:a=`sloppy`,referencePress:o=x2,bubbles:s,externalTree:c}=t,l=e.useState(`open`),u=e.useState(`floatingElement`),{dataRef:d,events:f}=e.context,p=o2(c),m=GJ(typeof i==`function`?i:()=>!1),h=typeof i==`function`?m:i,g=h!==!1,_=GJ(()=>a),{escapeKey:v,outsidePress:y}=S2(s),b=G.useRef(!1),x=G.useRef(!1),S=G.useRef(!1),C=G.useRef(!1),w=G.useRef(!1),T=G.useRef(``),E=G.useRef(null),D=eY(),O=eY(),k=eY(),A=GJ(()=>{O.clear(),d.current.insideReactTree=!1}),j=GJ(e=>{let t=d.current.floatingContext?.nodeId;return(p?DZ(p.nodesRef.current,t):[]).some(t=>t.context?.open&&!t.context.dataRef.current[e])}),M=GJ(t=>bZ(t,e.select(`floatingElement`))||bZ(t,e.select(`domReferenceElement`))),N=GJ(t=>{o()&&e.setOpen(!1,$1(n0,t.nativeEvent))}),P=GJ(t=>{if(!l||!n||!r||t.key!==`Escape`)return;let i=AZ(t)?t.nativeEvent:t;if(w.current||i.isComposing||!v&&j(`__escapeKeyBubbles`))return;let a=$1(l0,i);e.setOpen(!1,a),a.isCanceled||t.preventDefault(),!v&&!a.isPropagationAllowed&&t.stopPropagation()}),F=GJ(()=>{d.current.insideReactTree=!0,O.start(0,A)}),I=GJ(t=>{if(!l||!n||t.button!==0)return;let r=WX(t.nativeEvent);HX(e.select(`floatingElement`),r)&&(b.current||(b.current=!0,x.current=!1))}),L=GJ(e=>{!l||!n||(e.defaultPrevented||e.nativeEvent.defaultPrevented)&&b.current&&(x.current=!0)});G.useEffect(()=>{function e(e){e.open||(C.current=!1)}return f.on(`openchange`,e),()=>{f.off(`openchange`,e)}},[f]),G.useEffect(()=>A,[A]),G.useEffect(()=>{if(!l||!n)return l||(C.current=!1,w.current=!1,T.current=``,E.current=null),A;d.current.__escapeKeyBubbles=v,d.current.__outsidePressBubbles=y;let t=new $J,i=gQ(u);function a(){k.clear(),w.current=!0}function o(){w.current=!0,k.start(RX?5:0,()=>{w.current=!1})}function s(){S.current=!0,t.start(0,()=>{S.current=!1})}function c(){b.current=!1,x.current=!1}function f(){let e=T.current,t=e===`pen`||!e?`mouse`:e,n=_(),r=typeof n==`function`?n():n;return typeof r==`string`?r:r[t]}function m(e){let t=f();return t===`intentional`&&e.type!==`click`||t===`sloppy`&&e.type===`click`}function O(e){let t=d.current.floatingContext?.nodeId,n=p&&DZ(p.nodesRef.current,t).some(t=>bZ(e,t.context?.elements.floating));return M(e)||n}function N(n){if(m(n)){n.type!==`click`&&!M(n)&&(t.clear(),S.current=!1),A();return}if(d.current.insideReactTree){A();return}let r=WX(n),i=`[${j0(`inert`)}]`,a=sX(r)?r.getRootNode():null,o=Array.from((lX(a)?a:gQ(e.select(`floatingElement`))).querySelectorAll(i)),s=e.context.triggerElements;if(r&&(s.hasElement(r)||s.hasMatchingElement(e=>HX(e,r))))return;let c=sX(r)?r:null;for(;c&&!bX(c);){let e=CX(c);if(bX(e)||!sX(e))break;c=e}if(!(o.length&&sX(r)&&!xZ(r)&&!HX(r,e.select(`floatingElement`))&&o.every(e=>!HX(c,e)))){if(cX(r)&&!(`touches`in n)){let e=bX(r),t=xX(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(!O(n)){if(f()===`intentional`){if(n.detail!==0&&!jZ(n)&&!C.current)return;if(S.current){t.clear(),S.current=!1;return}}typeof h==`function`&&!h(n)||j(`__outsidePressBubbles`)||(e.setOpen(!1,$1(a0,n)),A())}}}function F(t){f()!==`sloppy`||t.pointerType===`touch`||!e.select(`open`)||!n||M(t)||N(t)}function I(t){if(f()!==`sloppy`||!e.select(`open`)||!n||M(t))return;let r=t.touches[0];r&&(E.current={startTime:Date.now(),startX:r.clientX,startY:r.clientY,dismissOnTouchEnd:!1,dismissOnMouseDown:!0},D.start(1e3,()=>{E.current&&(E.current.dismissOnTouchEnd=!1,E.current.dismissOnMouseDown=!1)}))}function L(e,t){let n=WX(e);if(!n)return;let r=v$(n,e.type,()=>{t(e),r()})}function R(e){T.current=`touch`,L(e,I)}function z(e){D.clear(),e.type===`pointerdown`&&(e.button===0&&(C.current=!0),T.current=e.pointerType),!(e.type===`mousedown`&&E.current&&!E.current.dismissOnMouseDown)&&L(e,e=>{e.type===`pointerdown`?F(e):N(e)})}function ee(e){if(e.type===`pointercancel`&&(C.current=!1),!b.current)return;let n=x.current;if(c(),f()===`intentional`){if(e.type===`pointercancel`){n&&s();return}if(!O(e)){if(n){s();return}typeof h==`function`&&!h(e)||(t.clear(),S.current=!0,A())}}}function te(e){if(f()!==`sloppy`||!E.current||M(e))return;let t=e.touches[0];if(!t)return;let n=Math.abs(t.clientX-E.current.startX),r=Math.abs(t.clientY-E.current.startY),i=Math.sqrt(n*n+r*r);i>5&&(E.current.dismissOnTouchEnd=!0),i>10&&(N(e),D.clear(),E.current=null)}function B(e){L(e,te)}function ne(e){f()!==`sloppy`||!E.current||M(e)||(E.current.dismissOnTouchEnd&&N(e),D.clear(),E.current=null)}function re(e){L(e,ne)}let V=x0(r&&x0(v$(i,`keydown`,P),v$(i,`compositionstart`,a),v$(i,`compositionend`,o)),g&&x0(v$(i,`click`,z,!0),v$(i,`pointerdown`,z,!0),v$(i,`pointerup`,ee,!0),v$(i,`pointercancel`,ee,!0),v$(i,`mousedown`,z,!0),v$(i,`mouseup`,ee,!0),v$(i,`touchstart`,R,{capture:!0,passive:!0}),v$(i,`touchmove`,B,{capture:!0,passive:!0}),v$(i,`touchend`,re,{capture:!0,passive:!0})));return()=>{V(),t.clear(),c(),S.current=!1}},[d,u,r,g,h,l,n,v,y,P,A,_,j,M,p,e,D,k]);let R=G.useMemo(()=>({onKeyDown:P,onPointerDown:N,onClick:N}),[P,N]),z=G.useMemo(()=>({onKeyDown:P,onPointerDown:L,onMouseDown:L,onClickCapture:F,onMouseDownCapture(e){F(),I(e)},onPointerDownCapture(e){F(),I(e)},onMouseUpCapture:F,onTouchEndCapture:F,onTouchMoveCapture:F}),[P,F,I,L]);return G.useMemo(()=>n?{reference:R,floating:z,trigger:R}:{},[n,R,z])}function w2(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),$(()=>{let e={open:s,floatingId:i,referenceElement:c,floatingElement:l};sX(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 T2(e,t=!1,n=!1,r=!1){let[i,a]=G.useState(e&&t?`idle`:void 0),[o,s]=G.useState(e&&!r);return e&&!o&&(s(!0),a(`starting`)),!e&&o&&i!==`ending`&&!n&&a(`ending`),!e&&!o&&i===`ending`&&a(void 0),$(()=>{if(!e&&o&&i!==`ending`&&n){let e=E0.request(()=>{a(`ending`)});return()=>{E0.cancel(e)}}},[e,o,i,n]),$(()=>{if(!e||t||i===void 0)return;let n=E0.request(()=>{a(void 0)});return()=>{E0.cancel(n)}},[t,e,i]),$(()=>{if(!e||!t)return;e&&o&&i!==`idle`&&a(`starting`);let n=E0.request(()=>{a(`idle`)});return()=>{E0.cancel(n)}},[t,e,o,i]),{mounted:o,setMounted:s,transitionStatus:i}}var E2=null;function D2(e){if(!E2){let e=[];E2=e,queueMicrotask(()=>{E2=null,WF.flushSync(()=>{for(let t of e)t()})})}E2.push(e)}function O2(e,t=!1,n=!1){let r=D0();return GJ((i,a=null)=>{r.cancel();let o=u2(e);if(o==null)return;let s=o,c=()=>{if(!n){WF.flushSync(i);return}D2(()=>{a?.aborted||i()})};if(typeof s.getAnimations!=`function`||globalThis.BASE_UI_ANIMATIONS_DISABLED){i();return}function l(){Promise.all(i$(s).map(e=>e.finished.then(JJ))).then(()=>{a?.aborted||c()},()=>{if(!a?.aborted){if(i$(s).some(e=>e.pending||e.playState!==`finished`)){l();return}c()}})}if(t){let e=ZX;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 k2(e){let{enabled:t=!0,open:n,ref:r,batch:i=!1,onComplete:a}=e,o=GJ(a),s=O2(r,n,i);G.useEffect(()=>{if(!t)return;let e=new AbortController;return s(o,e.signal),()=>{e.abort()}},[t,n,o,s])}function A2(e){let{open:t,ref:n,preventUnmountOnClose:r,setPreventUnmountOnClose:i,onUnmount:a,animateInitialOpen:o}=e,s=GJ(i),{mounted:c,setMounted:l,transitionStatus:u}=T2(t,!1,!1,o),d=!t&&r;$(()=>{t&&s(!1)},[t,s]);let f=G.useRef(c),p=G.useRef(!1),m=HY(),h=()=>{f.current=!1,l(!1),a()};$(()=>{f.current=c,p.current&&(p.current=!1,!t&&c&&h())});let g=GJ(()=>{if(f.current){if(t){p.current=!0,m();return}h()}});return k2({enabled:c&&!t&&!d,open:t,ref:n,onComplete(){t||g()}}),{mounted:c,transitionStatus:u,preventUnmountingOnClose:d,forceUnmount:g}}var j2={tabIndex:-1,[GX]:``};function M2(e){return t=>t!==`touch`||e.current}function N2(e,t=!1){let n=KY(),r=a2()!=null,i=HJ(()=>e(n,r)).current;return w2({popupStore:i,treatPopupAsFloatingElement:t,floatingRootContext:i.state.floatingRootContext,floatingId:n,nested:r,onOpenChange:i.setOpen}),i}function P2({handle:e,store:t}){return $(()=>e.attachStore(t),[e,t]),null}function F2(e){let t=e.context.triggerElements.size;e.select(`open`)&&e.state.triggerCount!==t&&e.set(`triggerCount`,t)}function I2(e,t){let n=G.useRef(null);return GJ(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),F2(a))}r!==null&&e!==void 0&&(n.current={store:t,id:e,element:r},t.context.triggerElements.add(e,r),F2(t))})}function L2(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 R2(e){let t=!1;return e.preventUnmountOnClose=()=>{t=!0},()=>t}function z2(e,t,n,r){let i=n.useState(`isMountedByTrigger`,e),a=I2(e,n),o=GJ(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=GJ(e=>{a(e),e&&o(e)});return $(()=>(s(t.current),()=>s(null)),[s,t,n,e]),$(()=>{if(i){let e={activeTriggerElement:t.current,...r};n.update(e)}},[i,n,t,...Object.values(r)]),{registerTrigger:s,isMountedByThisTrigger:i}}function B2(e,t={}){let{closeOnActiveTriggerUnmount:n=!1}=t,r=G.useRef(null),i=e.useState(`open`);$(()=>{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=$1(t0);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 V2(e,t,n,r){let{mounted:i,transitionStatus:a,forceUnmount:o}=A2({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 HJ(()=>(t.set(`mounted`,i),null)),t.useSyncedValues({mounted:i,transitionStatus:a}),{forceUnmount:o,transitionStatus:a}}function H2(e,t){e.useSyncedValues(t),$(()=>()=>{e.update({activeTriggerProps:XJ,inactiveTriggerProps:XJ,popupProps:XJ})},[e])}function U2(e,t){$(()=>{!t&&e.state.openMethod!==null&&e.set(`openMethod`,null)},[t,e]),$(()=>()=>{e.state.openMethod!==null&&e.set(`openMethod`,null)},[e])}var W2=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}},G2=[],K2=void 0;function q2(){return K2}function J2(e){G2.push(e)}function Y2(e){let t=(t,n)=>{let r=HJ(Z2).current,i;try{K2=r;for(let e of G2)e.before(r);i=e(t,n);for(let e of G2)e.after(r);r.didInitialize=!0}finally{K2=void 0}return i};return t.displayName=e.displayName||e.name,t}function X2(e){return G.forwardRef(Y2(e))}function Z2(){return{didInitialize:!1}}var Q2=fJ(),$2=fY(19)?n4:r4;function e4(e,t,n,r,i){return $2(e,t,n,r,i)}function t4(e,t,n,r,i){let a=G.useCallback(()=>t(e.getSnapshot(),n,r,i),[e,t,n,r,i]);return(0,Q2.useSyncExternalStore)(e.subscribe,a,a)}J2({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,Q2.useSyncExternalStore)(e.subscribe,e.getSnapshot,e.getSnapshot))}});function n4(e,t,n,r,i){let a=q2();if(!a)return t4(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 r4(e,t,n,r,i){return(0,mJ.useSyncExternalStoreWithSelector)(e.subscribe,e.getSnapshot,e.getSnapshot,e=>t(e,n,r,i))}var i4=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 e4(this,e,t,n,r)}},a4=class extends i4{constructor(e,t={},n){super(e),this.context=t,this.selectors=n}useSyncedValue(e,t){G.useDebugValue(e);let n=this;$(()=>{n.state[e]!==t&&n.set(e,t)},[n,e,t])}useSyncedValueWithCleanup(e,t){let n=this;$(()=>(n.state[e]!==t&&n.set(e,t),()=>{n.set(e,void 0)}),[n,e,t])}useSyncedValues(e){let t=this;$(()=>{t.update(e)},[t,...Object.values(e)])}useControlledProp(e,t){G.useDebugValue(e);let n=this,r=t!==void 0;$(()=>{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 G.useDebugValue(e),e4(this,this.selectors[e],t,n,r)}useContextCallback(e,t){G.useDebugValue(e);let n=GJ(t??JJ);this.context[e]=n}useStateSetter(e){let t=G.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)}})}},o4={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},s4=class extends a4{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:t2(),nested:n,triggerElements:i},o4),this.syncOnly=t}syncOpenEvent=(e,t)=>{(!e||!this.state.open||t!=null&&PZ(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 c4(e,t,n=!1){return{open:!1,openProp:void 0,mounted:!1,transitionStatus:void 0,floatingRootContext:new s4({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:XJ,inactiveTriggerProps:XJ,popupProps:XJ}}var l4=e=>e.triggerIdProp??e.activeTriggerId,u4=e=>e.openProp??e.open,d4=e=>(e.popupElement?.id??e.floatingId)||void 0;function f4(e,t){return t!==void 0&&u4(e)&&l4(e)===t}function p4(e,t){return f4(e,t)?!0:t!==void 0&&u4(e)&&l4(e)==null&&!e.openedWithoutTrigger&&e.triggerCount===1}var m4={open:u4,mounted:e=>e.mounted,transitionStatus:e=>u4(e)&&!e.mounted?`starting`:e.transitionStatus,floatingRootContext:e=>e.floatingRootContext,triggerCount:e=>e.triggerCount,preventUnmountingOnClose:e=>e.preventUnmountingOnClose,payload:e=>e.payload,activeTriggerId:l4,activeTriggerElement:e=>e.mounted?e.activeTriggerElement:null,popupId:d4,isTriggerActive:(e,t)=>t!==void 0&&l4(e)===t,isOpenedByTrigger:(e,t)=>f4(e,t),isMountedByTrigger:(e,t)=>t!==void 0&&l4(e)===t&&e.mounted,triggerProps:(e,t)=>t?e.activeTriggerProps:e.inactiveTriggerProps,triggerPopupId:(e,t)=>p4(e,t)?d4(e):void 0,popupProps:e=>e.popupProps,popupElement:e=>e.popupElement,positionerElement:e=>e.positionerElement};function h4(e){let t=G.useCallback(t=>e===void 0?JJ:e.subscribeStore(t),[e]),n=G.useCallback(()=>e===void 0?void 0:e.store,[e]);return(0,Q2.useSyncExternalStore)(t,n,()=>e?.serverStore)}var g4=IX&&RX;function _4(e,t={}){let{enabled:n=!0,delay:r}=t,{events:i,dataRef:a}=e.context,o=G.useRef(!1),s=G.useRef(null),c=G.useRef(!0),l=eY();G.useEffect(()=>{let t=e.select(`domReferenceElement`);if(!n)return;let r=iX(t);function i(){let t=e.select(`domReferenceElement`);!e.select(`open`)&&cX(t)&&t===VX(gQ(t))&&(o.current=!0,s.current=t)}function a(){c.current=!0}function l(){c.current=!1}return x0(v$(r,`blur`,i),g4&&v$(r,`keydown`,a,!0),g4&&v$(r,`pointerdown`,l,!0))},[e,n]),G.useEffect(()=>{if(!n)return;function t(t){if(t.reason===`trigger-press`||t.reason===`escape-key`){let t=e.select(`domReferenceElement`);sX(t)&&(s.current=t,o.current=!0)}}return i.on(`openchange`,t),()=>{i.off(`openchange`,t)}},[i,n,e]);let u=G.useMemo(()=>{function t(){o.current=!1,s.current=null}return{onMouseLeave(){t()},onFocus(n){let i=n.currentTarget;if(o.current){if(s.current===i)return;t()}let a=WX(n.nativeEvent);if(sX(a)){if(g4&&!n.relatedTarget){if(!c.current&&!SZ(a))return}else if(!TZ(a))return}let u=yZ(n.relatedTarget,e.context.triggerElements),{nativeEvent:d,currentTarget:f}=n;if(e.select(`open`)&&u||!r){e.setOpen(!0,$1(i0,d,f));return}l.start(r,()=>{o.current||e.setOpen(!0,$1(i0,d,f))})},onBlur(n){t();let r=n.relatedTarget,i=n.nativeEvent,o=sX(r)&&r.hasAttribute(j0(`focus-guard`))&&r.getAttribute(`data-type`)===`outside`;l.start(0,()=>{let t=e.select(`domReferenceElement`),n=VX(gQ(t));!r&&n===t||HX(a.current.floatingContext?.refs.floating.current,n)||HX(t,n)||o||yZ(r??n,e.context.triggerElements)||e.setOpen(!1,$1(i0,i))})}}},[a,r,e,l]);return G.useMemo(()=>n?{reference:u,trigger:u}:{},[n,u])}var v4=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},y4=new WeakMap;function b4(e){if(!e.performedPointerEventsMutation)return;let t=e.pointerEventsScopeElement;t&&y4.get(t)===e&&(e.pointerEventsScopeElement?.style.removeProperty(`pointer-events`),e.pointerEventsReferenceElement?.style.removeProperty(`pointer-events`),e.pointerEventsFloatingElement?.style.removeProperty(`pointer-events`),y4.delete(t)),e.performedPointerEventsMutation=!1,e.pointerEventsScopeElement=null,e.pointerEventsReferenceElement=null,e.pointerEventsFloatingElement=null}function x4(e,t){let{scopeElement:n,referenceElement:r,floatingElement:i}=t,a=y4.get(n);a&&a!==e&&b4(a),b4(e),e.performedPointerEventsMutation=!0,e.pointerEventsScopeElement=n,e.pointerEventsReferenceElement=r,e.pointerEventsFloatingElement=i,y4.set(n,e),n.style.pointerEvents=`none`,r.style.pointerEvents=`auto`,i.style.pointerEvents=`auto`}function S4(e){let t=e.context.dataRef.current,n=HJ(()=>t.hoverInteractionState??v4.create()).current;return t.hoverInteractionState||=n,ZJ(t.hoverInteractionState.disposeEffect),t.hoverInteractionState}function C4(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,l=o2(),u=a2(),d=S4(e),f=eY(),p=GJ(()=>y0(c.current.openEvent?.type,d.interactedInside)),m=GJ(()=>b0(c.current.openEvent?.type)),h=GJ(()=>{b4(d)});$(()=>{a||(d.pointerType=void 0,d.restTimeoutPending=!1,d.interactedInside=!1,h())},[a,d,h]),G.useEffect(()=>h,[h]),$(()=>{if(n&&a&&d.handleCloseOptions?.blockPointerEvents&&m()&&sX(s)&&o){let e=s,t=o,n=gQ(o),r=l?.nodesRef.current.find(e=>e.id===u)?.context?.elements.floating;r&&(r.style.pointerEvents=``);let i=d.pointerEventsScopeElement===t?null:d.pointerEventsScopeElement,a=r===t?null:r,c=d.handleCloseOptions?.getScope?.()??i??a??UX(e,`[data-rootownerid]`)??n.body;return x4(d,{scopeElement:c,referenceElement:e,floatingElement:t}),()=>{h()}}},[n,a,s,o,d,m,l,u,h]),G.useEffect(()=>{if(!n)return;function t(){return!!(l&&u&&DZ(l.nodesRef.current,u).length>0)}function a(t){let n=_0(r,`close`,d.pointerType),i=()=>{e.setOpen(!1,$1(r0,t)),l?.events.emit(`floating.closed`,t)};n?d.openChangeTimeout.start(n,i):(d.openChangeTimeout.clear(),i())}function s(e){let t=WX(e);if(!CZ(t)){d.interactedInside=!1;return}d.interactedInside=UX(t,`[aria-haspopup]`)!=null}function g(){d.openChangeTimeout.clear(),f.clear(),l?.events.off(`floating.closed`,v),h()}function _(n){if(t()&&l){l.events.on(`floating.closed`,v);return}if(yZ(n.relatedTarget,e.context.triggerElements))return;let r=c.current.floatingContext?.nodeId??i,o=n.relatedTarget;if(!(l&&r&&sX(o)&&DZ(l.nodesRef.current,r,!1).some(e=>HX(e.context?.elements.floating,o)))){if(d.handler){d.handler(n);return}h(),m()&&!p()&&a(n)}}function v(n){!l||!u||t()||f.start(0,()=>{l.events.off(`floating.closed`,v),e.setOpen(!1,$1(r0,n)),l.events.emit(`floating.closed`,n)})}let y=o;return x0(y&&v$(y,`mouseenter`,g),y&&v$(y,`mouseleave`,_),y&&v$(y,`pointerdown`,s,!0),()=>{l?.events.off(`floating.closed`,v)})},[n,o,e,c,r,i,m,p,h,d,l,u,f])}var w4={current:null};function T4(e,t={}){let{enabled:n=!0,delay:r=0,handleClose:i=null,mouseOnly:a=!1,restMs:o=0,move:s=!0,triggerElementRef:c=w4,externalTree:l,isActiveTrigger:u=!0,getHandleCloseContext:d,isClosing:f,shouldOpen:p,guardStaleOpen:m=!1}=t,{dataRef:h,events:g}=e.context,_=o2(l),v=S4(e),y=G.useRef(!1),b=S0(i),x=S0(r),S=S0(o),C=S0(n),w=S0(p),T=S0(f),E=GJ(()=>y0(h.current.openEvent?.type,v.interactedInside)),D=GJ(()=>w.current?.()!==!1),O=GJ((t,n,r)=>{let i=e.context.triggerElements;if(i.hasElement(n))return!t||!HX(t,n);if(!sX(r))return!1;let a=r;return i.hasMatchingElement(e=>HX(e,a))&&(!t||!HX(t,a))}),k=GJ(()=>{v.handler&&=(gQ(e.select(`domReferenceElement`)).removeEventListener(`mousemove`,v.handler),void 0)}),A=GJ(()=>{b4(v)});return u&&(v.handleCloseOptions=i?.__options),G.useEffect(()=>k,[k]),G.useEffect(()=>{if(!n)return;function e(e){e.open?y.current=!1:(y.current=e.reason===r0,k(),v.openChangeTimeout.clear(),v.restTimeout.clear(),v.blockMouseMove=!0,v.restTimeoutPending=!1)}return g.on(`openchange`,e),()=>{g.off(`openchange`,e)}},[n,g,v,k]),G.useEffect(()=>{if(!n)return;function t(t,n=!0){let r=_0(x.current,`close`,v.pointerType);r?v.openChangeTimeout.start(r,()=>{e.setOpen(!1,$1(r0,t)),_?.events.emit(`floating.closed`,t)}):n&&(v.openChangeTimeout.clear(),e.setOpen(!1,$1(r0,t)),_?.events.emit(`floating.closed`,t))}let r=c.current??(u?e.select(`domReferenceElement`):null);if(!sX(r))return;function i(t){if(v.openChangeTimeout.clear(),v.blockMouseMove=!1,a&&!NZ(v.pointerType))return;let n=v0(S.current),r=_0(x.current,`open`,v.pointerType),i=WX(t),o=t.currentTarget??null,s=e.select(`domReferenceElement`),c=o;if(sX(i)&&!e.context.triggerElements.hasElement(i)){for(let t of e.context.triggerElements.elements())if(HX(t,i)){c=t;break}}sX(o)&&sX(s)&&!e.context.triggerElements.hasElement(o)&&HX(o,s)&&(c=s);let l=c!=null&&O(s,c,i),u=e.select(`open`),d=T.current?.()??e.select(`transitionStatus`)===`ending`,f=!u&&d&&y.current,p=!l&&sX(c)&&sX(s)&&HX(s,c)&&f,m=n>0&&!r,h=l&&(u||f)||p,g=!u||l;if(h){D()&&e.setOpen(!0,$1(r0,t,c));return}m||(r?v.openChangeTimeout.start(r,()=>{g&&D()&&e.setOpen(!0,$1(r0,t,c))}):g&&D()&&e.setOpen(!0,$1(r0,t,c)))}function o(n){if(E()){A();return}k();let r=gQ(e.select(`domReferenceElement`));v.restTimeout.clear(),v.restTimeoutPending=!1;let i=h.current.floatingContext??d?.();if(!yZ(n.relatedTarget,e.context.triggerElements)){if(b.current&&i){e.select(`open`)||v.openChangeTimeout.clear();let a=c.current;v.handler=b.current({...i,tree:_,x:n.clientX,y:n.clientY,onClose(){A(),k(),C.current&&!E()&&a===e.select(`domReferenceElement`)&&t(n,!0)}}),r.addEventListener(`mousemove`,v.handler),v.handler(n);return}(v.pointerType!==`touch`||!HX(e.select(`floatingElement`),n.relatedTarget))&&t(n)}}function l(e){HX(r,e.relatedTarget)||(v.openChangeTimeout.clear(),v.restTimeout.clear(),v.restTimeoutPending=!1)}let f=m?v$(r,`mouseout`,l):void 0;return s?x0(v$(r,`mousemove`,i,{once:!0}),v$(r,`mouseenter`,i),v$(r,`mouseleave`,o),f):x0(v$(r,`mouseenter`,i),v$(r,`mouseleave`,o),f)},[k,A,h,x,e,n,b,v,u,O,E,a,s,S,c,_,C,d,T,D,m]),G.useMemo(()=>{if(!n)return;function t(e){v.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=O(i,r,t.target);if(a&&!NZ(v.pointerType))return;if(o&&s&&v.handleCloseOptions?.blockPointerEvents){let t=e.select(`floatingElement`);if(t){let e=v.handleCloseOptions?.getScope?.()??r.ownerDocument.body;x4(v,{scopeElement:e,referenceElement:r,floatingElement:t})}}let c=v0(S.current);if(o&&!s||c===0||!s&&v.restTimeoutPending&&t.movementX**2+t.movementY**2<2)return;v.restTimeout.clear();function l(){if(v.restTimeoutPending=!1,E())return;let t=e.select(`open`);!v.blockMouseMove&&(!t||s)&&D()&&e.setOpen(!0,$1(r0,n,r))}v.pointerType===`touch`?WF.flushSync(()=>{l()}):s&&o?l():(v.restTimeoutPending=!0,v.restTimeout.start(c,l))}}},[n,v,E,O,a,e,S,D])}function E4(e){return RX&&e.movementX===0&&e.movementY===0}function D4(e,t,n){switch(e){case`vertical`:return t;case`horizontal`:return n;default:return t||n}}function O4(e,t){return D4(t,e===`ArrowUp`||e===`ArrowDown`,e===`ArrowLeft`||e===`ArrowRight`)}function k4(e,t,n){return D4(t,e===`ArrowDown`,n?e===`ArrowLeft`:e===`ArrowRight`)||e===`Enter`||e===` `||e===``}function A4(e,t,n){return D4(t,n?e===qX:e===JX,e===XX)}function j4(e,t,n,r){return t===`both`||t===`horizontal`&&r?e===`Escape`:D4(t,n?e===JX:e===qX,e===YX)}function M4(e,t){let{listRef:n,activeIndex:r,onNavigate:i=()=>{},enabled:a=!0,selectedIndex:o=null,allowEscape:s=!1,loopFocus:c=!1,nested:l=!1,rtl:u=!1,virtual:d=!1,focusItemOnOpen:f=`auto`,focusItemOnHover:p=!0,openOnArrowKeyDown:m=!0,disabledIndices:h=void 0,orientation:g=`vertical`,triggerOrientation:_=g,parentOrientation:v,id:y,resetOnPointerLeave:b=!0,externalTree:x,nestedReturnFocusRef:S,grid:C}=t,w=C!=null,T=e.useState(`open`),E=e.useState(`floatingElement`),D=e.useState(`domReferenceElement`),O=e.context.dataRef,k=EZ(E),A=wZ(D),j=S0(k),M=a2(),N=o2(x),P=G.useRef(f),F=G.useRef(o??-1),I=G.useRef(null),L=G.useRef(!0),R=GJ(e=>{i(F.current===-1?null:F.current,e)}),z=G.useRef(!!E),ee=G.useRef(T),te=G.useRef(!1),B=G.useRef(!1),ne=G.useRef(null),re=S0(h),V=S0(T),H=S0(o),ie=S0(b),ae=D0(),oe=D0(),se=GJ(()=>{ae.cancel();function e(e){d||(ne.current=N0(e,{sync:te.current,preventScroll:!0}))}let t=n.current[F.current],r=B.current;t&&e(t),(te.current?e=>e():e=>ae.request(e))(()=>{let i=n.current[F.current]||t;i&&(t||e(i),pe&&(r||!L.current)&&i.scrollIntoView?.({block:`nearest`,inline:`nearest`}))})});$(()=>{O.current.orientation=g},[O,g]),$(()=>{T||(I.current=null),(!T||f!==`auto`)&&(P.current=f)},[T,f]),$(()=>{a&&(T&&E?(F.current=o??-1,P.current&&o!=null&&(B.current=!0,R())):z.current&&(F.current=-1,R()))},[a,T,E,o,R]),$(()=>{if(a){if(!T){te.current=!1;return}if(E){if(r==null){if(te.current=!1,H.current!=null)return;if(z.current&&(F.current=-1,se()),(!ee.current||!z.current)&&P.current&&(I.current!=null||P.current===!0&&I.current==null)){let e=0,t=()=>{n.current[0]==null?(e<2&&(e?e=>oe.request(e):queueMicrotask)(t),e+=1):(F.current=I.current==null||k4(I.current,_,u)||l?lQ(n):uQ(n),I.current=null,R())};t()}}else cQ(n.current,r)||(F.current=r,se(),B.current=!1)}}},[a,T,E,r,H,l,n,_,u,R,se,oe]),$(()=>{if(!a||E||!N||d||!z.current)return;let e=N.nodesRef.current,t=e.find(e=>e.id===M)?.context?.elements.floating,n=VX(gQ(D??t??null)),r=e.some(e=>e.context&&HX(e.context.elements.floating,n));t&&!r&&L.current&&t.focus({preventScroll:!0})},[a,E,D,N,M,d]),$(()=>{ee.current=T,z.current=!!E});let ce=r!=null,le=GJ(e=>{if(!V.current)return;let t=n.current.indexOf(e.currentTarget);t!==-1&&(F.current!==t||r!==t)&&(F.current=t,R(e))}),ue=GJ(()=>v??N?.nodesRef.current.find(e=>e.id===M)?.context?.dataRef?.current.orientation),de=GJ(()=>lQ(n,re.current)),fe=GJ(t=>{if(L.current=!1,te.current=!0,t.which===229||!V.current&&t.currentTarget===j.current)return;if(l&&j4(t.key,g,u,w)){O4(t.key,ue())||kZ(t),e.setOpen(!1,$1(u0,t.nativeEvent));let n=S?.current??D;cX(n)&&n.focus();return}r!=null&&r!==F.current&&!cQ(n.current,r)&&(F.current=r);let i=F.current,a=lQ(n,h),o=uQ(n,h);if(A||(t.key===`Home`&&(kZ(t),F.current=a,R(t)),t.key===`End`&&(kZ(t),F.current=o,R(t))),C!=null){let e=C(t,F.current,n,g,c,u,h,a,o);if(e!=null&&e!==F.current&&(F.current=e,R(t)),g===`both`)return}if(O4(t.key,g)){kZ(t);let e=VX(t.currentTarget.ownerDocument);if(T&&!d&&HX(t.currentTarget,e)&&!n.current.some(t=>t!=null&&HX(t,e))){F.current=k4(t.key,g,u)?a:o,R(t),r===F.current&&se();return}let{index:l,wrapped:f}=dQ(n.current,i,{decrement:!k4(t.key,g,u),loopFocus:c,allowEscape:s,disabledIndices:h,minIndex:a,maxIndex:o});f&&(te.current=!1),F.current=l,R(t)}}),pe=G.useMemo(()=>({onFocus(e){te.current=!0,le(e)},onClick({currentTarget:e}){d||e.focus({preventScroll:!0})},onMouseMove(e){E4(e)||(te.current=!0,B.current=!1,p&&le(e))},onPointerLeave(e){if(!V.current||!L.current||e.pointerType===`touch`)return;te.current=!0;let t=e.relatedTarget;if(!(!p||n.current.includes(t))&&ie.current&&(ne.current?.(),ne.current=null,F.current=-1,R(e),!d)){let e=j.current,t=VX(gQ(e));e&&HX(e,t)&&e.focus({preventScroll:!0})}}}),[le,V,j,p,n,R,ie,d]),me=G.useMemo(()=>d&&T&&ce&&{"aria-activedescendant":`${y}-${r}`},[d,T,ce,y,r]),he=G.useMemo(()=>({...A?{}:me,onKeyDown(t){if(t.key===`Tab`&&t.shiftKey&&T&&!d){let n=WX(t.nativeEvent);if(n&&!HX(j.current,n))return;kZ(t);let r=$1(c0,t.nativeEvent);e.setOpen(!1,r);let i=S?.current??D;!r.isCanceled&&cX(i)&&i.focus();return}fe(t)},onPointerMove(e){E4(e)||(L.current=!0)}}),[me,fe,j,A,e,T,d,D,S]),ge=G.useMemo(()=>{function t(t){e.setOpen(!0,$1(u0,t.nativeEvent,t.currentTarget))}function n(e){f===`auto`&&jZ(e.nativeEvent)&&(P.current=!d)}function r(e){P.current=f,f===`auto`&&MZ(e.nativeEvent)&&(P.current=!0)}return{onKeyDown(n){let r=e.select(`open`);L.current=!1;let i=n.key.startsWith(`Arrow`),a=A4(n.key,ue(),u),o=O4(n.key,r?g:_),s=(l?a:o)||n.key===`Enter`||n.key.trim()===``;if(d&&r&&(!l||SZ(n.currentTarget)))return fe(n);if(!(!r&&!m&&i)){if(s){let e=O4(n.key,ue());I.current=l&&e?null:n.key}if(l){a&&(kZ(n),r?(F.current=de(),R(n),d&&j.current?.focus()):t(n));return}o&&(H.current!=null&&(F.current=H.current),kZ(n),!r&&m?t(n):fe(n),r&&R(n))}},onFocus(t){t.target===t.currentTarget&&e.select(`open`)&&!d&&(F.current=-1,R(t))},onPointerDown:r,onPointerEnter:r,onMouseDown:n,onClick:n}},[fe,f,de,l,R,e,m,g,_,ue,u,H,d,j]),_e=G.useMemo(()=>({...me,...ge}),[me,ge]);return G.useMemo(()=>a?{reference:_e,floating:he,item:pe,trigger:ge}:{},[a,_e,he,ge,pe])}function N4(e,t){let{listRef:n,elementsRef:r,activeIndex:i,onMatch:a,disabledIndices:o,onTyping:s,enabled:c=!0,resetMs:l=750,selectedIndex:u=null}=t,d=GJ(s),f=e.useState(`open`),p=eY(),m=G.useRef(``),h=G.useRef(u??i??-1),g=G.useRef(null),_=GJ(e=>{function t(e){return r?.current[e]}function s(e){let n=t(e);return n&&!hQ(n)||n?.matches(`:disabled`)?!1:o==null||!pQ(YJ,e,o)}function c(e,t,n=0){if(e.length===0)return-1;let r=(n%e.length+e.length)%e.length,i=t.toLowerCase();for(let t=0;t<e.length;t+=1){let n=(r+t)%e.length;if(!(!e[n]?.toLowerCase().startsWith(i)||!s(n)))return n}return-1}let _=n.current;if(m.current.length>0&&e.key===` `&&(kZ(e),d?.(!0)),m.current.length>0&&m.current[0]!==` `&&c(_,m.current)===-1&&e.key!==` `&&d?.(!1),_==null||e.key.length!==1||e.ctrlKey||e.metaKey||e.altKey)return;f&&e.key!==` `&&(kZ(e),d?.(!0));let v=m.current===``;v&&(h.current=u??i??-1),_.every((e,t)=>e&&s(t)?e[0]?.toLowerCase()!==e[1]?.toLowerCase():!0)&&m.current===e.key&&(m.current=``,h.current=g.current),m.current+=e.key,p.start(l,()=>{m.current=``,h.current=g.current,d?.(!1)});let y=((v?u??i??-1:h.current)??0)+1,b=c(_,m.current,y);b===-1?e.key!==` `&&(m.current=``,d?.(!1)):(a?.(b,e),g.current=b)}),v=GJ(t=>{let n=t.relatedTarget,r=e.select(`domReferenceElement`),i=e.select(`floatingElement`);HX(r,n)||HX(i,n)||(p.clear(),m.current=``,h.current=g.current,d?.(!1))});$(()=>{!f&&u!==null||(p.clear(),g.current=null,m.current!==``&&(m.current=``,d?.(!1)))},[f,u,p,d]);let y=G.useMemo(()=>({onKeyDown:_,onBlur:v}),[_,v]);return G.useMemo(()=>c?{reference:y,floating:y}:{},[c,y])}var P4=.1,F4=P4*P4,I4=.5;function L4(e,t,n,r,i,a){return r>=t!=a>=t&&e<=(i-n)*(t-r)/(a-r)+n}function R4(e,t,n,r,i,a,o,s,c,l){let u=!1;return L4(e,t,n,r,i,a)&&(u=!u),L4(e,t,i,a,o,s)&&(u=!u),L4(e,t,o,s,c,l)&&(u=!u),L4(e,t,c,l,n,r)&&(u=!u),u}function z4(e,t,n){return e>=n.x&&e<=n.x+n.width&&t>=n.y&&t<=n.y+n.height}function B4(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 V4(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*F4;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=WX(r),g=r.type===`mouseleave`,_=HX(u,h),v=HX(a,h);if(_&&(l=!0,!g))return;if(v&&(l=!1,!g)){l=!0;return}if(g&&sX(r.relatedTarget)&&HX(u,r.relatedTarget))return;function y(){return!!(s&&DZ(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=B4(d,f,D,x.top+1,O,S.bottom-1);break;case`bottom`:j=B4(d,f,D,S.top+1,O,x.bottom-1);break;case`left`:j=B4(d,f,S.right-1,A,x.left+1,k);break;case`right`:j=B4(d,f,x.right-1,A,S.left+1,k)}if(j)return;if(l&&!z4(d,f,x)){b();return}if(!g&&p(d,f)){b();return}let M=!1;switch(c){case`top`:{let n=T?I4/2:I4*4,r=T||C?e+n:e-n,i=T?e-n:C?e+n:e-n,a=t+I4+1,o=C||T?S.bottom-I4:S.top,s=C?T?S.bottom-I4:S.top:S.bottom-I4;M=R4(d,f,r,a,i,a,S.left,o,S.right,s);break}case`bottom`:{let n=T?I4/2:I4*4,r=T||C?e+n:e-n,i=T?e-n:C?e+n:e-n,a=t-I4,o=C||T?S.top+I4:S.bottom,s=C?T?S.top+I4:S.bottom:S.top+I4;M=R4(d,f,r,a,i,a,S.left,o,S.right,s);break}case`left`:{let n=E?I4/2:I4*4,r=E||w?t+n:t-n,i=E?t-n:w?t+n:t-n,a=e+I4+1,o=w||E?S.right-I4:S.left,s=w?E?S.right-I4:S.left:S.right-I4;M=R4(d,f,o,S.top,s,S.bottom,a,r,a,i);break}case`right`:{let n=E?I4/2:I4*4,r=E||w?t+n:t-n,i=E?t-n:w?t+n:t-n,a=e-I4,o=w||E?S.left+I4:S.right,s=w?E?S.left+I4:S.right:S.left+I4;M=R4(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 H4(e,t,n){let{reference:r,floating:i}=e,a=qZ(t),o=JZ(t),s=KZ(o),c=UZ(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=WZ(t);return m&&(p[o]+=f*(m===`end`?1:-1)*(n&&l?-1:1)),p}async function U4(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}=HZ(t,e),p=oQ(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=sQ(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=sQ(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 W4=50,G4=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:U4},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=H4(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<W4&&(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}=H4(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},K4=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}=HZ(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=UZ(r),_=qZ(o),v=UZ(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[iQ(o)]:XZ(o)),x=p!==`none`;!d&&x&&b.push(...rQ(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=YZ(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`||_===qZ(t)||T.every(e=>qZ(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=qZ(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{}}}},q4=new Set([`left`,`top`]);async function J4(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=UZ(n),s=WZ(n),c=qZ(n)===`y`,l=q4.has(o)?-1:1,u=a&&c?-1:1,d=HZ(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 Y4=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 J4(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}}}}},X4=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}=HZ(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=qZ(i),p=GZ(f),m=u[p],h=u[f],g=(e,t)=>VZ(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}}}}}},Z4=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}=HZ(e,t),u={x:n,y:r},d=qZ(i),f=GZ(d),p=u[f],m=u[d],h=HZ(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=q4.has(UZ(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}}}},Q4=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}=HZ(e,t),c=await i.detectOverflow(t,s),l=UZ(n),u=WZ(n),d=qZ(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=FZ(p-c[m],g),y=FZ(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*IZ(c.left,c.right):S=p-2*IZ(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 $4(e){let t=xX(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=cX(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=LZ(n)!==a||LZ(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function e3(e){return sX(e)?e:e.contextElement}function t3(e){let t=e3(e);if(!cX(t))return zZ(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=$4(t),o=(a?LZ(n.width):n.width)/r,s=(a?LZ(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var n3=zZ(0);function r3(e){let t=iX(e);return!yX()||!t.visualViewport?n3:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function i3(e,t,n){return t===void 0&&(t=!1),!!n&&t&&n===iX(e)}function a3(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=e3(e),o=zZ(1);t&&(r?sX(r)&&(o=t3(r)):o=t3(e));let s=i3(a,n,r)?r3(a):zZ(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=iX(a),t=sX(r)?iX(r):r,n=e,i=EX(n);for(;i&&t!==n;){let e=t3(i),t=i.getBoundingClientRect(),r=xX(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=iX(i),i=EX(n)}}return sQ({width:u,height:d,x:c,y:l})}function o3(e,t){let n=SX(e).scrollLeft;return t?t.left+n:a3(aX(e)).left+n}function s3(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-o3(e,n),y:n.top+t.scrollTop}}function c3(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=aX(r),s=t?fX(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=zZ(1),u=zZ(0),d=cX(r);if((d||!a)&&((rX(r)!==`body`||uX(o))&&(c=SX(r)),d)){let e=a3(r);l=t3(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?s3(o,c):zZ(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 l3(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function u3(e){let t=SX(e),n=e.ownerDocument.body,r=IZ(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),i=IZ(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight),a=-t.scrollLeft+o3(e),o=-t.scrollTop;return xX(n).direction===`rtl`&&(a+=IZ(e.clientWidth,n.clientWidth)-r),{width:r,height:i,x:a,y:o}}var d3=25;function f3(e,t,n){n===void 0&&(n=`viewport`);let r=n===`layoutViewport`,i=iX(e),a=aX(e),o=i.visualViewport,s=a.clientWidth,c=a.clientHeight,l=0,u=0;if(o){let e=!yX()||t===`fixed`;r?e||(l=-o.offsetLeft,u=-o.offsetTop):(s=o.width,c=o.height,e&&(l=o.offsetLeft,u=o.offsetTop))}if(o3(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<=d3&&(s-=o)}return{width:s,height:c,x:l,y:u}}function p3(e,t){let n=a3(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=t3(e);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function m3(e,t,n){let r;if(t===`viewport`||t===`layoutViewport`)r=f3(e,n,t);else if(t===`document`)r=u3(aX(e));else if(sX(t))r=p3(t,n);else{let n=r3(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return sQ(r)}function h3(e,t){let n=t.get(e);if(n)return n;let r=TX(e,[],!1).filter(e=>sX(e)&&rX(e)!==`body`),i=null,a=xX(e).position===`fixed`,o=a?CX(e):e;for(;sX(o)&&!bX(o);){let e=xX(o),t=_X(o),n=i?i.position:a?`fixed`:``;!t&&(n===`fixed`||n===`absolute`&&e.position===`static`)?r=r.filter(e=>e!==o):i=e,o=CX(o)}return t.set(e,r),r}function g3(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?fX(t)?[]:h3(t,this._c):[].concat(n),r],o=m3(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=m3(t,a[e],i);s=IZ(n.top,s),c=FZ(n.right,c),l=FZ(n.bottom,l),u=IZ(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function _3(e){let{width:t,height:n}=$4(e);return{width:t,height:n}}function v3(e,t,n){let r=cX(t),i=aX(t),a=n===`fixed`,o=a3(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=zZ(0);if((r||!a)&&((rX(t)!==`body`||uX(i))&&(s=SX(t)),r)){let e=a3(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}!r&&i&&(c.x=o3(i));let l=i&&!r&&!a?s3(i,s):zZ(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 y3(e){return xX(e).position===`static`}function b3(e,t){if(!cX(e)||xX(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return aX(e)===n&&(n=n.ownerDocument.body),n}function x3(e,t){let n=iX(e);if(fX(e))return n;if(!cX(e)){let t=CX(e);for(;t&&!bX(t);){if(sX(t)&&!y3(t))return t;t=CX(t)}return n}let r=b3(e,t);for(;r&&dX(r)&&y3(r);)r=b3(r,t);return r&&bX(r)&&y3(r)&&!_X(r)?n:r||vX(e)||n}var S3=async function(e){let t=this.getOffsetParent||x3,n=this.getDimensions,r=await n(e.floating);return{reference:v3(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function C3(e){return xX(e).direction===`rtl`}var w3={convertOffsetParentRelativeRectToViewportRelativeRect:c3,getDocumentElement:aX,getClippingRect:g3,getOffsetParent:x3,getElementRects:S3,getClientRects:l3,getDimensions:_3,getScale:t3,isElement:sX,isRTL:C3};function T3(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function E3(e,t,n){let r=null,i,a=aX(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=RZ(d),h=RZ(a.clientWidth-(u+f)),g=RZ(a.clientHeight-(d+p)),_=RZ(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:IZ(0,FZ(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(!T3(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=iX(e),l=()=>s(n);return c.addEventListener(`resize`,l),s(!0),()=>{c.removeEventListener(`resize`,l),o()}}function D3(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=e3(e),u=i||a?[...l?TX(l):[],...t?TX(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n),a&&e.addEventListener(`resize`,n)});let d=l&&s?E3(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?a3(e):null;c&&g();function g(){let t=a3(e);h&&!T3(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 O3=Y4,k3=X4,A3=K4,j3=Q4,M3=Z4,N3=(e,t,n)=>{let r=new Map,i=n??{},a={...w3,...i.platform,_c:r};return G4(e,t,{...i,platform:a})},P3=typeof document<`u`?G.useLayoutEffect:function(){};function F3(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(!F3(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)&&!F3(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function I3(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function L3(e,t){let n=I3(e);return Math.round(t*n)/n}function R3(e){let t=G.useRef(e);return P3(()=>{t.current=e}),t}function z3(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:l}=e,[u,d]=G.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=G.useState(r);F3(f,r)||p(r);let[m,h]=G.useState(null),[g,_]=G.useState(null),v=G.useCallback(e=>{e!==S.current&&(S.current=e,h(e))},[]),y=G.useCallback(e=>{e!==C.current&&(C.current=e,_(e))},[]),b=a||m,x=o||g,S=G.useRef(null),C=G.useRef(null),w=G.useRef(u),T=c!=null,E=R3(c),D=R3(i),O=R3(l),k=G.useCallback(()=>{if(!S.current||!C.current)return;let e={placement:t,strategy:n,middleware:f};D.current&&(e.platform=D.current),N3(S.current,C.current,e).then(e=>{let t={...e,isPositioned:O.current!==!1};A.current&&!F3(w.current,t)&&(w.current=t,WF.flushSync(()=>{d(t)}))})},[f,t,n,D,O]);P3(()=>{l===!1&&w.current.isPositioned&&(w.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let A=G.useRef(!1);P3(()=>(A.current=!0,()=>{A.current=!1}),[]),P3(()=>{if(b&&(S.current=b),x&&(C.current=x),b&&x){if(E.current)return E.current(b,x,k);k()}},[b,x,k,E,T]);let j=G.useMemo(()=>({reference:S,floating:C,setReference:v,setFloating:y}),[v,y]),M=G.useMemo(()=>({reference:b,floating:x}),[b,x]),N=G.useMemo(()=>{let e={position:n,left:0,top:0};if(!M.floating)return e;let t=L3(M.floating,u.x),r=L3(M.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...I3(M.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,M.floating,u.x,u.y]);return G.useMemo(()=>({...u,update:k,refs:j,elements:M,floatingStyles:N}),[u,k,j,M,N])}var B3=(e,t)=>{let n=O3(e);return{name:n.name,fn:n.fn,options:[e,t]}},V3=(e,t)=>{let n=k3(e);return{name:n.name,fn:n.fn,options:[e,t]}},H3=(e,t)=>({fn:M3(e).fn,options:[e,t]}),U3=(e,t)=>{let n=A3(e);return{name:n.name,fn:n.fn,options:[e,t]}},W3=(e,t)=>{let n=j3(e);return{name:n.name,fn:n.fn,options:[e,t]}},G3=new Set([`ArrowUp`,`ArrowDown`,`ArrowLeft`,`ArrowRight`,`Home`,`End`]);function K3(e){return fY(19)?e:e?`true`:void 0}var q3=G.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,Z.jsx)(`div`,{ref:t,role:`presentation`,"data-base-ui-inert":``,...r,style:{position:`fixed`,inset:0,userSelect:`none`,WebkitUserSelect:`none`,clipPath:i}})}),J3={},Y3={},X3=``;function Z3(e,t){return uX(e)?e:t}function Q3(e,t,n){return/hidden|clip/.test(e.getComputedStyle(Z3(t,n)).overflowY)}function $3(e){if(typeof document>`u`)return!1;let t=gQ(e);return iX(t).innerWidth-t.documentElement.clientWidth>0}function e6(e){if(!(typeof CSS<`u`&&CSS.supports&&CSS.supports(`scrollbar-gutter`,`stable`))||typeof document>`u`)return!1;let t=gQ(e),n=t.documentElement,r=t.body,i=Z3(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 t6(e){let t=gQ(e),n=t.documentElement,r=t.body,i=Z3(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 n6(e){let t=gQ(e),n=t.documentElement,r=t.body,i=iX(n),a=0,o=0,s=!1,c=E0.create();if(RX&&(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,J3={scrollbarGutter:n.style.scrollbarGutter,overflowY:n.style.overflowY,overflowX:n.style.overflowX},X3=n.style.scrollBehavior,Y3={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=Z3(n,r);if(s=e6(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,J3),Object.assign(r.style,Y3),s||(n.scrollTop=a,n.scrollLeft=o,n.removeAttribute(`data-base-ui-scroll-locked`),n.style.scrollBehavior=X3)}function d(){u(),c.request(l)}l();let f=v$(i,`resize`,d);return()=>{c.cancel(),u(),typeof i.removeEventListener==`function`&&f()}}var r6=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=gQ(e),n=t.documentElement,r=t.body,i=iX(n);if(Q3(i,n,r)){let t=new i.MutationObserver(()=>{Q3(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=NX||!$3(e);this.restore=a?t6(e):n6(e)}};function i6(e=!0,t=null){$(()=>{if(e)return r6.acquire(t)},[e,t])}function a6(e){let t=G.useRef(``),n=G.useCallback(n=>{n.defaultPrevented||(t.current=n.pointerType,e(n,n.pointerType))},[e]);return{onClick:G.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 o6(e,t){let n=G.useRef(e),r=GJ(t);$(()=>{n.current!==e&&r(n.current),n.current=e},[e,r])}function s6(e,t){let{onClick:n,onPointerDown:r}=a6(GJ((n,r)=>{(typeof e==`function`?e():e)||t(r||(NX?`touch`:``))}));return G.useMemo(()=>({onClick:n,onPointerDown:r}),[n,r])}function c6(e){let[t,n]=G.useState(null),r=s6(e,n);return o6(e,t=>{t&&!e&&n(null)}),G.useMemo(()=>({openMethod:t,triggerProps:r}),[t,r])}var l6=VN({keyCode:UN(229)});function u6(e){return e.nativeEvent.isComposing||Se(l6,e.nativeEvent).success}function d6(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:qR(t,t.easeExit),fill:`backwards`})}function f6(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:qR(t,t.ease),fill:`backwards`})}function p6(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:qR(t,t.ease),fill:`backwards`})}function m6(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:qR(t,`ease-out`)})}var h6=(0,G.forwardRef)(function({state:e,onStop:t,stopLabel:n=`Stop`,iconSize:r=20,onClick:i,disabled:a,className:o,tone:s=`primary`,"aria-label":c,...l},u){let d=(0,G.useRef)(null);(0,G.useImperativeHandle)(u,()=>d.current);let f=(0,G.useRef)(e);(0,G.useLayoutEffect)(()=>{let t=d.current,n=f.current;if(f.current=e,!t||n===e||!JR(t))return;let r=t.querySelector(`[data-glyph="arrow"]`),i=t.querySelector(`[data-glyph="busy"]`);if(!r||!i)return;let a=BR(t),o=[];return e===`busy`?o.push(d6(r,a),p6(i,a,1)):n===`busy`&&o.push(p6(i,a,0),f6(r,a)),n===`empty`&&e===`ready`&&!a.reduced&&o.push(m6(t,a)),()=>{for(let e of o)e.cancel()}},[e]);let p=e===`busy`,m=p&&t!==void 0;return(0,Z.jsx)(zJ,{...l,ref:d,className:Q(`caps-send-action`,o),tone:s,"aria-busy":p?!0:void 0,"aria-label":m?n:c,"data-send-state":e,disabled:a===!0||e===`empty`||p&&!m,onClick:m?t:i,label:null,icon:(0,Z.jsxs)(`span`,{className:`caps-send-glyph`,"data-state":e,children:[(0,Z.jsx)(`span`,{"data-glyph":`arrow`,children:(0,Z.jsx)(OI,{"aria-hidden":`true`,size:r})}),(0,Z.jsx)(`span`,{"data-glyph":`busy`,children:t===void 0?(0,Z.jsx)(lH,{decorative:!0,size:`sm`}):(0,Z.jsx)(XI,{"aria-hidden":`true`,fill:`currentColor`,size:Math.round(r*.7)})})]})})}),g6=new Intl.NumberFormat(`en-US`,{style:`currency`,currency:`USD`,minimumFractionDigits:2,maximumFractionDigits:2}),_6=new Intl.NumberFormat(`en-US`,{style:`currency`,currency:`USD`,minimumFractionDigits:2,maximumFractionDigits:5});function v6(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?_6.format(e):g6.format(e)}var y6=(0,G.forwardRef)(function({className:e,label:t,...n},r){return(0,Z.jsx)(zJ,{...n,ref:r,className:Q(`parakeet-composer-model-key`,e),label:t,readout:(0,Z.jsx)(jI,{"aria-hidden":`true`,className:`size-[var(--stipe-icon-size-sm)] shrink-0`})})}),b6=(0,G.forwardRef)(function({className:e,...t},n){return(0,Z.jsx)(`div`,{...t,ref:n,className:Q(`caps-popover-anchor`,e)})}),x6=(0,G.forwardRef)(function({className:e,open:t,side:n=`top`,...r},i){return t?(0,Z.jsx)(`div`,{...r,ref:i,className:Q(`caps-popover`,e),"data-side":n}):null}),S6=(0,G.forwardRef)(function({active:e,className:t,onMouseDown:n,...r},i){return(0,Z.jsx)(`div`,{role:`option`,"aria-selected":e,...r,ref:i,className:Q(`caps-popover-option`,t),"data-active":e,onMouseDown:e=>{e.preventDefault(),n?.(e)}})});function C6({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,G.useId)(),f=(0,G.useRef)(null),p=(0,G.useRef)(null),m=(0,G.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,G.useEffect)(()=>{g&&p.current?.focus()},[g]),(0,G.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,G.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,Z.jsxs)(b6,{...u,ref:f,className:Q(`caps-status-tray`,l),"data-placement":o,"data-align":s,children:[h?(0,Z.jsxs)(x6,{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,Z.jsxs)(`div`,{className:`caps-status-tray-head`,children:[h.tone?(0,Z.jsx)(SH,{size:`compact`,tone:h.tone,glyph:h.glyph??`dot`}):null,(0,Z.jsx)(`span`,{id:`${d}-title`,className:`caps-status-tray-title`,children:h.title??h.label}),h.actions,(0,Z.jsx)(LJ,{"aria-label":`Close tray`,icon:(0,Z.jsx)(QI,{"aria-hidden":`true`}),onClick:_})]}),(0,Z.jsx)(`div`,{className:`caps-status-tray-body`,children:h.content})]}):null,o===`host`?null:(0,Z.jsxs)(`div`,{className:`caps-status-tray-row`,children:[r,(0,Z.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,Z.jsxs)(Z.Fragment,{children:[e.tone?(0,Z.jsx)(SH,{size:`compact`,glyph:e.glyph??`dot`,motion:e.motion??`none`,tone:e.tone}):null,(0,Z.jsx)(`span`,{className:`caps-status-tray-label`,children:e.label}),e.count!==void 0&&e.count>0?(0,Z.jsx)(`span`,{className:`caps-status-tray-count`,children:e.count}):null]})};return(0,Z.jsxs)(G.Fragment,{children:[a?a(r):(0,Z.jsx)(`button`,{...r}),e.after]},e.id)})}),i]})]})}function w6({children:e,className:t,...n}){return(0,Z.jsx)(`div`,{...n,className:Q(`caps-status-tray-list`,t),children:e})}function T6({icon:e,primary:t,secondary:n,actions:r,className:i,...a}){return(0,Z.jsxs)(`div`,{...a,className:Q(`caps-status-tray-item`,i),children:[e?(0,Z.jsx)(`span`,{className:`caps-status-tray-icon`,children:e}):null,(0,Z.jsxs)(`span`,{className:`caps-status-tray-text`,children:[(0,Z.jsx)(`span`,{className:`caps-status-tray-primary`,children:t}),n?(0,Z.jsx)(`span`,{className:`caps-status-tray-secondary`,children:n}):null]}),r?(0,Z.jsx)(`span`,{className:`caps-status-tray-actions`,children:r}):null]})}function E6({children:e=`All caught up.`,title:t}){return(0,Z.jsxs)(`div`,{className:`caps-status-tray-note`,children:[t?(0,Z.jsx)(`strong`,{className:`caps-status-tray-note-title`,children:t}):null,(0,Z.jsx)(`p`,{children:e})]})}var D6=(0,G.forwardRef)(function({className:e,invalid:t,...n},r){return(0,Z.jsx)(`textarea`,{...n,"aria-invalid":t?!0:n[`aria-invalid`]===!1?void 0:n[`aria-invalid`],className:Q(`textarea textarea-bordered w-full`,t&&`textarea-error`,e),ref:r})});function O6(e,t){return`${e}-${String(t)}`}function k6(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 A6(e){return{role:`combobox`,"aria-autocomplete":`list`,"aria-expanded":e.open,"aria-controls":e.open?e.listId:void 0,"aria-activedescendant":e.open?O6(e.listId,e.selected):void 0}}function j6({open:e,rows:t,selected:n,listId:r,label:i,kind:a,hint:o,empty:s,onHighlight:c,onChoose:l}){return(0,Z.jsx)(x6,{open:e,side:`top`,"data-parakeet-slash":``,children:(0,Z.jsxs)(`div`,{className:`parakeet-slash-menu`,"data-kind":a,children:[o===void 0?null:(0,Z.jsx)(`p`,{className:`parakeet-slash-hint`,children:o}),t.length===0?s===void 0?null:(0,Z.jsx)(`p`,{className:`parakeet-slash-hint`,children:s}):(0,Z.jsx)(`div`,{id:r,role:`listbox`,"aria-label":i,children:t.map((e,t)=>(0,Z.jsxs)(S6,{id:O6(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,Z.jsx)(`span`,{"aria-hidden":`true`,className:`parakeet-slash-media`,children:e.media}),(0,Z.jsx)(`span`,{className:`parakeet-slash-label`,children:e.label}),(0,Z.jsx)(`span`,{className:`parakeet-slash-detail`,children:e.detail}),e.keys===void 0||e.keys.length===0?null:(0,Z.jsx)(`kbd`,{className:`parakeet-slash-keys`,children:e.keys})]},e.key))})]})})}var M6={unchecked:`M3.25 5.9 L5.1 7.9 L8.8 3.8`,checked:`M3.25 5.9 L5.1 7.9 L8.8 3.8`,mixed:`M3.4 6 L6 6 L8.6 6`},N6={blurStdDeviation:.22,alphaSlope:18,alphaIntercept:-8};function P6({state:e}){let t=`caps-checkbox-${(0,G.useId)().replaceAll(`:`,``)}`,n=(0,G.useRef)(null),r=(0,G.useRef)(e).current,i=(0,G.useRef)(e),a=$R();return(0,G.useLayoutEffect)(()=>{if(!n.current)return;let t=e!==`unchecked`,r=i.current!==`unchecked`,o=a||i.current===e;i.current=e;let s=BR(n.current),c=fH(s,{ease:`inCubic`,duration:160}),l=UV(n.current,{d:{to:M6[e],...o?uH:fH(s,{ease:`outCubic`,duration:200})},"stroke-dashoffset":{to:+!t,...o?uH:t?fH(s,{ease:`inOutSine`,duration:260}):c},"stroke-width":o?{to:t?2.4:0,duration:0}:t&&!r?[{to:2.2,...fH(s,{ease:`outCubic`,duration:65})},{to:2.4,delay:WR(s,120),...dH(s,{bounce:.35,duration:220})}]:{to:t?2.4:0,...c}});return()=>{l.cancel()}},[e,a]),(0,Z.jsxs)(`svg`,{className:`caps-checkbox-visual`,width:`24`,height:`24`,viewBox:`0 0 12 12`,"aria-hidden":`true`,focusable:`false`,children:[(0,Z.jsxs)(`defs`,{children:[(0,Z.jsx)(YV,{id:`${t}-surface`,transform:`matrix(1 0 0 1 6 6)`}),(0,Z.jsx)(XV,{id:`${t}-shadow`}),(0,Z.jsx)(ZV,{id:`${t}-inset`}),(0,Z.jsx)($V,{id:`${t}-goo`,values:N6}),(0,Z.jsxs)(`filter`,{id:`${t}-relief`,x:`-25%`,y:`-25%`,width:`150%`,height:`150%`,colorInterpolationFilters:`sRGB`,children:[(0,Z.jsx)(`feGaussianBlur`,{in:`SourceAlpha`,stdDeviation:`0.28`,result:`relief`}),(0,Z.jsx)(`feSpecularLighting`,{in:`relief`,surfaceScale:`1.2`,specularConstant:`0.55`,specularExponent:`18`,lightingColor:`color-mix(in srgb, var(--color-white) calc(var(--depth) * 100%), var(--color-black))`,result:`light`,children:(0,Z.jsx)(`feDistantLight`,{azimuth:`225`,elevation:`55`})}),(0,Z.jsx)(`feComposite`,{in:`light`,in2:`SourceAlpha`,operator:`in`,result:`clipped-light`}),(0,Z.jsx)(`feBlend`,{in:`SourceGraphic`,in2:`clipped-light`,mode:`screen`})]}),(0,Z.jsx)(`mask`,{id:`${t}-contour`,maskUnits:`userSpaceOnUse`,x:`0`,y:`0`,width:`12`,height:`12`,style:{maskType:`alpha`},children:(0,Z.jsx)(`path`,{ref:n,d:M6[r],fill:`none`,stroke:`var(--color-white)`,strokeWidth:r===`unchecked`?0:2.4,pathLength:`1`,strokeDasharray:`1`,strokeDashoffset:+(r===`unchecked`),strokeLinecap:`round`,strokeLinejoin:`round`,filter:e===`mixed`?void 0:`url(#${t}-goo)`})}),(0,Z.jsx)(`clipPath`,{id:`${t}-well`,children:(0,Z.jsx)(`rect`,{x:`1`,y:`1`,width:`10`,height:`10`,rx:`2.5`})})]}),(0,Z.jsx)(`rect`,{className:`caps-checkbox-track`,x:`0.5`,y:`0.5`,width:`11`,height:`11`,rx:`3`,filter:`url(#${t}-inset)`}),(0,Z.jsx)(`g`,{clipPath:`url(#${t}-well)`,children:(0,Z.jsx)(`g`,{filter:`url(#${t}-shadow)`,children:(0,Z.jsx)(`g`,{filter:`url(#${t}-relief)`,children:(0,Z.jsx)(`g`,{mask:`url(#${t}-contour)`,children:(0,Z.jsx)(`rect`,{x:`0`,y:`0`,width:`12`,height:`12`,fill:`url(#${t}-surface)`})})})})})]})}var F6=(0,G.forwardRef)(function({className:e,appearance:t,indicator:n,invalid:r,indeterminate:i=!1,checked:a,defaultChecked:o=!1,onChange:s,...c},l){let u=(0,G.useRef)(null),[d,f]=(0,G.useState)(o),p=a??d,m=i?`mixed`:p?`checked`:`unchecked`;return(0,G.useImperativeHandle)(l,()=>{if(!u.current)throw Error(`Checkbox input is not mounted`);return u.current},[]),(0,G.useLayoutEffect)(()=>{u.current&&(u.current.indeterminate=i)},[i]),(0,G.useEffect)(()=>{let e=u.current?.form;if(!e||a!==void 0)return;let t=e=>{queueMicrotask(()=>{!e.defaultPrevented&&u.current&&f(o)})};return e.addEventListener(`reset`,t),()=>{e.removeEventListener(`reset`,t)}},[a,o,c.form]),(0,Z.jsxs)(`span`,{className:`caps-checkbox`,"data-appearance":t===`compact`?t:void 0,"data-state":m,"data-custom-indicator":n!==void 0||void 0,children:[(0,Z.jsx)(`input`,{...c,checked:p,"aria-checked":i?`mixed`:p,"aria-invalid":r?!0:c[`aria-invalid`]===!1?void 0:c[`aria-invalid`],className:Q(`caps-checkbox-input`,e),onChange:e=>{a===void 0&&f(e.target.checked),s?.(e),e.currentTarget.indeterminate=i},ref:u,type:`checkbox`}),n===void 0?(0,Z.jsx)(P6,{state:m}):n]})}),I6=`data-glide-stand-in`;function L6(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 R6(e){return{transform:`translate(${String(e.x)}px, ${String(e.y)}px)`,width:`${String(e.width)}px`,height:`${String(e.height)}px`}}function z6(e){let t=(0,G.useRef)(null);return(0,G.useCallback)(n=>{t.current?.(),t.current=n?B6(n,e):null},[e])}function B6(e,t){if(!JR(e))return()=>void 0;let n=e.ownerDocument,r=e.querySelector(t),i=r?L6(e,r):null,a=null,o=null,s=new Set,c=()=>{for(let e of s)e.removeAttribute(I6);s.clear(),a&&(a.hidden=!0),o=null},l=()=>{if(a)return a;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`),a=t,t},u=(t,n)=>{let r=BR(e),u=L6(e,t),d=o&&a?L6(e,a):i;if(i=u,o?.cancel(),c(),r.reduced||d===null||Math.abs(d.y-u.y)<1&&Math.abs(d.x-u.x)<1)return;t.setAttribute(I6,`measure`);let f=getComputedStyle(t),p=f.backgroundColor,m=f.borderRadius;for(let e of[t,n])e&&(e.setAttribute(I6,``),s.add(e));let h=l();h.hidden=!1,h.style.backgroundColor=p,h.style.borderRadius=m;let g=h.animate([R6(d),R6(u)],{duration:r.normal,easing:qR(r,r.ease),fill:`forwards`});o=g,g.addEventListener(`finish`,()=>{o===g&&c()})},d=()=>{let n=e.querySelector(t);if(n===r)return;let i=r;r=n,n&&u(n,i)},f=new MutationObserver(d);return f.observe(e,{subtree:!0,attributes:!0,attributeFilter:[`data-highlighted`,`data-active`,`data-navigation`,`aria-selected`]}),e.addEventListener(`pointerover`,d),e.addEventListener(`pointerout`,d),()=>{f.disconnect(),e.removeEventListener(`pointerover`,d),e.removeEventListener(`pointerout`,d),o?.cancel(),c(),a?.remove()}}function V6({controlled:e,default:t,name:n,state:r=`value`}){let{current:i}=G.useRef(e!==void 0),[a,o]=G.useState(()=>t);return[i&&e!==void 0?e:a,G.useCallback(e=>{i||o(e)},[])]}var H6=aL(`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`}}),U6=(0,G.forwardRef)(function({className:e,density:t,featured:n=!1,state:r,variant:i,...a},o){return(0,Z.jsx)(`div`,{...a,className:Q(H6({density:t,variant:i}),n&&`caps-card-featured`,e),"data-state":r,ref:o})});(0,G.forwardRef)(function({className:e,density:t,variant:n,width:r=`default`,...i},a){return(0,Z.jsx)(`main`,{className:`caps-centered-card-stage`,children:(0,Z.jsx)(U6,{...i,className:Q(`caps-centered-card`,r===`wide`&&`caps-centered-card-wide`,e),ref:a,variant:n??`surface`,...t?{density:t}:{}})})}),(0,G.forwardRef)(function({alignment:e=`start`,className:t,...n},r){return(0,Z.jsx)(`div`,{...n,className:Q(`caps-card-header`,e===`center`&&`caps-card-header-centered`,t),ref:r})}),(0,G.forwardRef)(function({className:e,level:t=3,...n},r){return(0,Z.jsx)(t===2?`h2`:`h3`,{...n,className:Q(`caps-card-title`,e),ref:r})}),(0,G.forwardRef)(function({className:e,...t},n){return(0,Z.jsx)(`p`,{...t,className:Q(`caps-card-description`,e),ref:n})}),(0,G.forwardRef)(function({className:e,...t},n){return(0,Z.jsx)(`div`,{...t,className:Q(`caps-card-content`,e),ref:n})}),(0,G.forwardRef)(function({className:e,...t},n){return(0,Z.jsx)(`div`,{...t,className:Q(`caps-card-footer`,e),ref:n})});var W6=(0,G.forwardRef)(function({action:e,attachments:t,className:n,input:r,toolbar:i,...a},o){return(0,Z.jsxs)(`div`,{...a,ref:o,className:Q(`caps-composer`,n),children:[t===void 0?null:(0,Z.jsx)(`div`,{className:`caps-composer-attachments`,children:t}),(0,Z.jsx)(`div`,{className:`caps-composer-input`,children:r}),i===void 0&&e===void 0?null:(0,Z.jsxs)(`div`,{className:`caps-composer-bar`,children:[(0,Z.jsx)(`div`,{className:`caps-composer-toolbar`,children:i}),e]})]})});function G6({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 K6({attachments:e,action:t,children:n,className:r,input:i,menu:a,row:o,...s}){return(0,Z.jsxs)(b6,{className:`parakeet-composer-anchor`,children:[a,(0,Z.jsxs)(U6,{...s,className:Q(`parakeet-composer-shell`,r),children:[(0,Z.jsx)(W6,{action:t,attachments:e,input:i,toolbar:o===void 0?void 0:(0,Z.jsx)(C6,{className:`parakeet-composer-row`,align:`start`,items:o.items,openId:o.openId,onOpenChange:o.onOpenChange,renderTrigger:({children:e,...t})=>(0,Z.jsx)(zJ,{...t,label:e,expanded:t[`aria-expanded`]===!0}),leading:o.controls,trailing:(0,Z.jsxs)(`span`,{className:`parakeet-composer-trailing`,children:[o.status,o.readout==null?null:(0,Z.jsx)(`span`,{className:`parakeet-composer-readout`,children:o.readout}),(0,Z.jsx)(`span`,{className:`parakeet-composer-action`,children:o.action})]})})}),n]})]})}var q6=G.createContext(void 0);function J6(e){let t=G.useContext(q6);if(t===void 0&&!e)throw Error(nY(33));return t}var Y6=G.createContext(void 0);function X6(e){let t=G.useContext(Y6);if(t===void 0&&!e)throw Error(nY(36));return t}var Z6=G.createContext(void 0);function Q6(e=!0){let t=G.useContext(Z6);if(t===void 0&&!e)throw Error(nY(25));return t}var $6=G.createContext(null);function e8(e=`root`){let t=G.useContext($6),n=G.useContext(Y6);return t===null||n===void 0?null:(e===`submenu-trigger`?n.virtualFocus||n.parentVirtualFocus:n.virtualFocus)?t:null}var t8={visible:!0,ref:null};function n8(){return t8}function r8(e,t,n=`root`){let r=e8(n),i=((n===`submenu-trigger`?r?.useSubmenuTrigger:r?.useItem)??n8)({label:e.label,children:e.children,render:e.render}),a=aY(t,i.ref);return{visible:i.visible,ref:a,props:i.props}}var i8=G.createContext(void 0);function a8(){let e=G.useContext(i8);if(e===void 0)throw Error(nY(30));return e}function o8(e){e.preventDefault()}function s8(e){let{closeOnClick:t,highlighted:n,id:r,nodeId:i,store:a,typingRef:o,itemRef:s,itemMetadata:c}=e,l=X6(),u=Q6(!0),d=c.type===`submenu-trigger`,f=d?l.parentVirtualFocus:l.virtualFocus,p=(d&&l.parent.type===`menu`?l.parent.store:l.store).useState(`webkitAriaSelected`,n),{events:m}=a.useState(`floatingTreeRoot`),h=a.useState(`open`),g=u!==void 0,_=!f&&h&&n?0:-1;return G.useMemo(()=>({id:r,role:`menuitem`,tabIndex:_,"aria-selected":p,onMouseDown:f?o8:void 0,onKeyDown(e){e.key===` `&&o?.current&&e.preventDefault()},onMouseMove(e){i&&m.emit(`itemhover`,{nodeId:i,target:e.currentTarget})},onClick(e){t&&m.emit(`close`,{domEvent:e.nativeEvent,reason:o0})},onMouseUp(e){if(u){let t=u.initialCursorPointRef.current;if(u.initialCursorPointRef.current=null,g&&t&&Math.abs(e.clientX-t.x)<=1&&Math.abs(e.clientY-t.y)<=1||g&&!IX&&e.button===2)return}s.current&&a.context.allowMouseUpTriggerRef.current&&(!g||e.button===2)&&c.type===`regular-item`&&Y1(s.current,e,{detail:1,pointerType:`mouse`})}}),[t,_,r,m,i,a.context.allowMouseUpTriggerRef,o,s,u,g,c.type,p,f])}var c8={type:`regular-item`};function l8(e){let{closeOnClick:t,disabled:n,highlighted:r,id:i,store:a,typingRef:o=a.context.typingRef,nativeButton:s,itemMetadata:c,nodeId:l}=e,u=G.useRef(null),{getButtonProps:d,buttonRef:f}=X1({disabled:n,focusableWhenDisabled:!0,native:s,composite:!0}),p=s8({closeOnClick:t,highlighted:r,id:i,nodeId:l,store:a,typingRef:o,itemRef:u,itemMetadata:c}),m=G.useCallback(e=>yY(p,{onMouseEnter(e){c.type===`submenu-trigger`&&c.setActive(e.nativeEvent)}},e,d),[p,d,c]),h=aY(u,f);return G.useMemo(()=>({getItemProps:m,itemRef:h}),[m,h])}var u8=G.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},nextIndexRef:{current:0}});function d8(){return G.useContext(u8)}function f8(e={}){let{guess:t,label:n,metadata:r,textRef:i,index:a}=e,{register:o,unregister:s,subscribeMapChange:c,nextIndexRef:l}=d8(),u=G.useRef(-1),[d,f]=G.useState(a==null&&t?()=>{if(u.current===-1){let e=l.current;l.current+=1,u.current=e}return u.current}:-1),p=a??d,m=G.useRef(null),h=G.useCallback(e=>{let t=m.current;t&&s(t),m.current=e,e&&o(e,{metadata:r??null,index:a??null,label:n,textRef:i})},[a,o,s,r,n,i]);return $(()=>{if(a==null)return c(e=>{let t=m.current?e.get(m.current)?.index:null;t!=null&&f(t)})},[a,c]),{ref:h,index:p}}var p8=`data-checked`,m8=`data-unchecked`,h8={checked(e){return e?{[p8]:``}:{[m8]:``}},...tZ},g8=G.forwardRef(function(e,t){let{render:n,className:r,id:i,label:a,nativeButton:o=!1,disabled:s=!1,closeOnClick:c=!1,checked:l=!1,onCheckedChange:u,style:d,...f}=e,{store:p}=X6(),m=f8({guess:!0,label:a}),h=qY(i),g=p.useState(`disabled`),_=p.useState(`isActive`,m.index),v=p.useState(`floatingNodeId`),y=p.useState(`itemProps`),b=s||g,{getItemProps:x,itemRef:S}=l8({closeOnClick:c,disabled:b,highlighted:_,id:h,store:p,nativeButton:o,nodeId:v,itemMetadata:c8}),C=G.useMemo(()=>({disabled:b,highlighted:_,checked:l}),[b,_,l]);function w(e){let t=$1(o0,e.nativeEvent,void 0,{preventUnmountOnClose:JJ});u?.(!l,t)}let T=MY(`div`,e,{state:C,stateAttributesMapping:h8,props:[y,{role:`menuitemcheckbox`,"aria-checked":l,onClick:w},f,x],ref:[S,t,m.ref]});return(0,Z.jsx)(i8.Provider,{value:C,children:T})}),_8=G.forwardRef(function(e,t){let{checked:n,defaultChecked:r,onCheckedChange:i,...a}=e,[o,s]=V6({controlled:n,default:r??!1,name:`MenuCheckboxItem`,state:`checked`}),c=r8(e,t);function l(e,t){i?.(e,t),t.isCanceled||s(e)}return c.visible?(0,Z.jsx)(g8,{...a,checked:o,onCheckedChange:l,ref:c.ref}):null}),v8=G.forwardRef(function(e,t){let{render:n,className:r,style:i,keepMounted:a=!1,...o}=e,s=a8(),c=G.useRef(null),{transitionStatus:l,mounted:u,setMounted:d}=T2(s.checked);return k2({batch:!0,enabled:!s.checked,open:s.checked,ref:c,onComplete(){s.checked||d(!1)}}),MY(`span`,e,{state:{checked:s.checked,disabled:s.disabled,highlighted:s.highlighted,transitionStatus:l},ref:[t,c],stateAttributesMapping:h8,props:{"aria-hidden":!0,...o},enabled:a||u})}),y8=G.createContext(void 0);function b8(){let e=G.useContext(y8);if(e===void 0)throw Error(nY(31));return e}var x8=G.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,[o,s]=G.useState(void 0),c=MY(`div`,e,{ref:t,props:{role:`group`,"aria-labelledby":o,...a}});return(0,Z.jsx)(y8.Provider,{value:s,children:c})}),S8=G.forwardRef(function(e,t){let n=e8()?.Group??x8;return(0,Z.jsx)(n,{...e,ref:t})}),C8=G.forwardRef(function(e,t){let{render:n,className:r,style:i,id:a,...o}=e,s=qY(a),c=b8();return $(()=>(c(s),()=>{c(e=>e===s?void 0:e)}),[c,s]),MY(`div`,e,{ref:t,props:{id:s,"aria-hidden":!0,...o}})}),w8=G.forwardRef(function(e,t){let{render:n,className:r,id:i,label:a,nativeButton:o=!1,disabled:s=!1,closeOnClick:c=!0,style:l,...u}=e,{store:d}=X6(),f=f8({guess:!0,label:a}),p=qY(i),m=d.useState(`disabled`),h=d.useState(`isActive`,f.index),g=d.useState(`floatingNodeId`),_=d.useState(`itemProps`),v=s||m,{getItemProps:y,itemRef:b}=l8({closeOnClick:c,disabled:v,highlighted:h,id:p,store:d,nativeButton:o,nodeId:g,itemMetadata:c8});return MY(`div`,e,{state:{disabled:v,highlighted:h},props:[_,u,y],ref:[b,t,f.ref]})}),T8=G.forwardRef(function(e,t){let n=r8(e,t);return n.visible?(0,Z.jsx)(w8,{...e,ref:n.ref}):null}),E8=G.createContext(void 0);function D8(e){let t=G.useContext(E8);if(t===void 0&&!e)throw Error(nY(69));return t}function O8(e){return e===`starting`?G0:XJ}var k8=G.createContext(void 0);function A8(){return G.useContext(k8)}function j8(e,t){let n=IY(e.render);if(G.isValidElement(n)){let e=n.props;if(Object.hasOwn(e,`id`))return e.id??``}return e.id??t}function M8(e,t,n){let r=j8(e,t),i=r===t?void 0:r;return[r,G.useCallback(e=>n?.(e?i:void 0),[i,n])]}function N8(e,t,n){let r=IY(e.render),i=G.isValidElement(r)?r.props:void 0,a=e[`aria-label`]??i?.[`aria-label`],o=e[`aria-labelledby`]??i?.[`aria-labelledby`];return o==null&&!a&&(o=t?t.id||void 0:n||void 0),o}var P8=G.forwardRef(function(e,t){let{render:n,className:r,style:i,finalFocus:a,id:o,initialFocus:s,...c}=e,{store:l,defaultFloatingId:u,setRenderedFloatingId:d,virtualFocus:f,orientation:p}=X6(),m=A8(),{side:h,align:g}=J6(),_=D8(!0)!=null,v=l.useState(`open`),y=l.useState(`transitionStatus`),b=l.useState(`popupProps`),x=l.useState(`mounted`),S=l.useState(`instantType`),C=l.useState(`activeTriggerElement`),w=l.useState(`parent`),T=l.useState(`lastOpenChangeReason`),E=l.useState(`rootId`),D=l.useState(`floatingRootContext`),O=l.useState(`floatingTreeRoot`),k=l.useState(`closeDelay`),A=l.useState(`hoverEnabled`),j=l.useState(`disabled`),M=l.useState(`openMethod`),N=l.useState(`activeTriggerId`),P=l.useState(`listElement`),[F,I]=M8(e,u,d),L=N8(e,C,N),R=w.type===`menu`?m:void 0,z=w.type===`context-menu`,ee=s??w.type!==`menu`;s===void 0&&P&&w.type!==`menu`&&(ee=()=>l.state.activeIndex===null&&P),k2({open:v,ref:l.context.popupRef,onComplete(){v&&l.context.onOpenChangeComplete?.(!0)}}),G.useEffect(()=>{function e(e){l.setOpen(!1,$1(e.reason,e.domEvent))}return O.events.on(`close`,e),()=>{O.events.off(`close`,e)}},[O.events,l]),C4(D,{enabled:A&&!j&&!z&&w.type!==`menubar`,closeDelay:k});let te=l.useStateSetter(`popupElement`),{parentVirtualFocusRef:B,handleFocus:ne}=(G.useContext($6)?.useParentHandoff??I8)(l,w,v,f),re=MY(`div`,e,{state:{transitionStatus:y,side:h,align:g,open:v,nested:w.type===`menu`,instant:S},ref:[t,l.context.popupRef,te,I],stateAttributesMapping:_Z,props:[b,{id:F,...P?{role:`presentation`}:{role:`menu`,"aria-orientation":p===`horizontal`?`horizontal`:void 0,"aria-labelledby":L},onKeyDown(e){R?.onPopupKeyDown?.(e),_&&G3.has(e.key)&&e.stopPropagation()},onFocus:ne},O8(y),c,{"data-rootownerid":E}]}),V=w.type===void 0||z;(C||w.type===`menubar`&&T!==`outside-press`)&&(V=!0);let H=R?.getReturnElement??B;return(0,Z.jsx)(y2,{context:D,openInteractionType:M,modal:z,disabled:!x,returnFocus:a??H??V,explicitReturnFocus:a===void 0&&H?!1:void 0,initialFocus:ee,restoreFocus:!0,getInsideElements:w.type===void 0?()=>[l.context.beforeTriggerFocusGuardRef.current]:void 0,externalTree:w.type===`menubar`?void 0:O,previousFocusableElement:C,nextFocusableElement:w.type===void 0?l.context.triggerFocusTargetRef:void 0,beforeContentFocusGuardRef:l.context.beforeContentFocusGuardRef,children:re})}),F8={parentVirtualFocusRef:void 0,handleFocus:void 0};function I8(){return F8}var L8=G.forwardRef(function(e,t){let n=e8()?.Popup??P8;return(0,Z.jsx)(n,{...e,ref:t})}),R8=G.createContext(void 0);function z8(){let e=G.useContext(R8);if(e===void 0)throw Error(nY(32));return e}var B8=G.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e,{store:i,parent:a}=X6();if(!(i.useState(`mounted`)||n))return null;let o=a.type===`menu`||a.type===`menubar`?`group`:void 0;return(0,Z.jsx)(R8.Provider,{value:n,children:(0,Z.jsx)(e2,{ref:t,...r,portalOwnerRole:o})})});function V8(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`),[l,u]=G.useState(null),d=G.useRef(null),f=o2(n),p=G.useMemo(()=>({reference:i,floating:a,domReference:o}),[i,a,o]),m=z3({...e,elements:{...p,...l&&{reference:l}}}),h=G.useCallback(e=>{let t=sX(e)?{getBoundingClientRect:()=>e.getBoundingClientRect(),getClientRects:()=>e.getClientRects(),contextElement:e}:e;u(t),m.refs.setReference(t)},[m.refs]),g=G.useMemo(()=>({...m.refs,setPositionReference:h,domReference:d}),[m.refs,h]),_=G.useMemo(()=>({...m.elements,domReference:o}),[m.elements,o]),v=G.useMemo(()=>({...m,dataRef:r.context.dataRef,open:s,onOpenChange:r.setOpen,events:r.context.events,floatingId:c,refs:g,elements:_,nodeId:t,rootStore:r}),[m,g,_,t,r,s,c]);return $(()=>{o&&(d.current=o)},[o]),$(()=>{r.context.dataRef.current.floatingContext=v;let e=f?.nodesRef.current.find(e=>e.id===t);e&&(e.context=v)}),G.useMemo(()=>({...m,context:v,refs:g,elements:_,rootStore:r}),[m,g,_,v,r])}var H8=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}=HZ(e,t)||{};if(l==null)return{};let d=oQ(u),f={x:n,y:r},p=JZ(i),m=KZ(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=VZ(D,k,O),j=!c.arrow&&WZ(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}}}),U8=(e,t)=>{let{name:n,fn:r}=H8(e);return{name:n,fn:r,options:[e,t]}},W8={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}}}},G8={sideX:`left`,sideY:`top`},K8=`--available-width`,q8=`--available-height`,J8=`--anchor-width`,Y8=`--anchor-height`,X8=`--transform-origin`,Z8=K8,Q8=q8;function $8(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 e5(e,t,n){let{rects:r,placement:i}=e;return{side:$8(t,UZ(i),n),align:WZ(i)||`center`,anchor:{width:r.reference.width,height:r.reference.height},positioner:{width:r.floating.width,height:r.floating.height}}}function t5(e){return n5(e,V8)}function n5(e,t){let{anchor:n,positionMethod:r=`absolute`,side:i=`bottom`,sideOffset:a=0,align:o=`center`,alignOffset:s=0,collisionBoundary:c,collisionPadding:l=5,sticky:u=!1,arrowPadding:d=5,disableAnchorTracking:f=!1,inline:p,keepMounted:m=!1,floatingRootContext:h,mounted:g,collisionAvoidance:_,shift:v,nodeId:y,adaptiveOrigin:b,lazyFlip:x=!1,externalTree:S}=e,C=_.side||`flip`,w=_.align||`flip`,T=_.fallbackAxisSide||`end`,E=v?.crossAxis??!1,D=v?.rootBoundary,O=typeof n==`function`?n:void 0,k=GJ(O),A=O?k:n,j=S0(n),M=S0(g),N=n$()===`rtl`,[P,F]=G.useState(null);!g&&P!==null&&F(null);let I=x===`placement`,L=P?UZ(P):null,R=P&&I?WZ(P)||`center`:null,z=L||{top:`top`,right:`right`,bottom:`bottom`,left:`left`,"inline-end":N?`left`:`right`,"inline-start":N?`right`:`left`}[i],ee=R||o,te=ee===`center`?z:`${z}-${ee}`,B=l;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 ne=+(i===`bottom`),re=+(i===`top`),V=+(i===`right`),H=+(i===`left`),ie={boundary:c===`clipping-ancestors`?`clippingAncestors`:c,padding:B},ae=G.useRef(null),oe=S0(a),se=S0(s),ce=typeof a==`function`?0:a,le=typeof s==`function`?0:s,ue=[];p&&ue.push(p),ue.push(B3(e=>{let t=e5(e,i,N),n=typeof oe.current==`function`?oe.current(t):oe.current,r=typeof se.current==`function`?se.current(t):se.current;return{mainAxis:n,crossAxis:r,alignmentAxis:r}},[ce,le,N,i]));let de=w===`none`&&C!==`shift`,fe=!de&&(u||E||C===`shift`),pe=C===`none`?null:U3({...ie,padding:{top:B.top+1+ne,right:B.right+1+H,bottom:B.bottom+1+re,left:B.left+1+V},mainAxis:!E&&C===`flip`,crossAxis:w===`flip`&&`alignment`,fallbackAxisSideDirection:T}),me=de?null:V3({...ie,rootBoundary:D,mainAxis:w!==`none`,crossAxis:fe,limiter:u||E?void 0:H3(e=>{if(!ae.current)return{};let{width:t,height:n}=ae.current.getBoundingClientRect(),r=qZ(UZ(e.placement)),i=r===`y`?t:n,a=r===`y`?B.left+B.right:B.top+B.bottom;return{offset:i/2+a/2}})},[ie,u,E,D,B,w]);C===`shift`||w===`shift`||ee===`center`?ue.push(me,pe):ue.push(pe,me),ue.push(W3({...ie,apply({elements:{floating:e},availableWidth:t,availableHeight:n,rects:r}){if(!M.current)return;let i=e.style;i.setProperty(Z8,`${t}px`),i.setProperty(Q8,`${n}px`);let a=iX(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(J8,`${u}px`),i.setProperty(Y8,`${d}px`)}}),U8(e=>({element:ae.current||gQ(e.elements.floating).createElement(`div`),padding:ae.current?d:0}),[d]),{name:`transformOrigin`,fn(e){let{elements:{floating:t},middlewareData:n,placement:r,platform:o,rects:s,y:c}=e,l=UZ(r),u=WZ(r),d=qZ(l)===`y`,f=ae.current,p=typeof a==`function`?a(e5(e,i,N)):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 fe&&d&&Math.abs(n.shift?.y||0)>p&&(h=`${s.reference.y+s.reference.height/2-c}px`),t.style.setProperty(X8,d?`${m} ${h}`:`${h} ${m}`),{}}},W8,b),$(()=>{!g&&h&&h.update({referenceElement:null,floatingElement:null,domReferenceElement:null,positionReference:null})},[g,h]);let he=G.useMemo(()=>({ancestorScroll:!f,elementResize:!f&&typeof ResizeObserver<`u`,layoutShift:!f&&typeof IntersectionObserver<`u`}),[f]),{refs:ge,elements:_e,x:ve,y:ye,middlewareData:be,update:xe,placement:Se,context:Ce,isPositioned:we,floatingStyles:Te}=t({rootContext:h,open:m?g:void 0,placement:te,middleware:ue,strategy:r,whileElementsMounted:m?void 0:(...e)=>D3(...e,he),nodeId:y,externalTree:S}),{sideX:Ee,sideY:De}=be.adaptiveOrigin||G8,Oe=we?r:`fixed`,ke=G.useMemo(()=>{let e;return e=we?b?{position:Oe,[Ee]:ve,[De]:ye}:{...Te,position:Oe}:{position:Oe,top:0,left:0},e[Z8]=`100vw`,e[Q8]=`100vh`,we||(e.opacity=0),e},[b,Oe,Ee,ve,De,ye,Te,we]),Ae=G.useRef(null);$(()=>{if(!g)return;let e=j.current,t=typeof e==`function`?e():e,n=(r5(t)?t.current:t)||null;n!==Ae.current&&(ge.setPositionReference(n),Ae.current=n)},[g,ge,A,j]),G.useEffect(()=>{if(!g)return;let e=j.current;typeof e!=`function`&&r5(e)&&e.current!==Ae.current&&(ge.setPositionReference(e.current),Ae.current=e.current)},[g,ge,A,j]),G.useEffect(()=>{if(m&&g&&_e.reference&&_e.floating)return D3(_e.reference,_e.floating,xe,he)},[m,g,_e,xe,he]);let je=UZ(Se),Me=$8(i,je,N),Ne=WZ(Se)||`center`,Pe=!!be.hide?.referenceHidden;$(()=>{x&&g&&we&&(je!==z||I&&Ne!==ee)&&F(Se)},[x,I,g,we,Se,je,Ne,z,ee]);let Fe=G.useMemo(()=>({position:`absolute`,top:be.arrow?.y,left:be.arrow?.x}),[be.arrow]),Ie=be.arrow?.centerOffset!==0;return G.useMemo(()=>({positionerStyles:ke,arrowStyles:Fe,arrowRef:ae,arrowUncentered:Ie,side:Me,align:Ne,physicalSide:je,anchorHidden:Pe,refs:ge,context:Ce,isPositioned:we,update:xe}),[ke,Fe,ae,Ie,Me,Ne,je,Pe,ge,Ce,we,xe])}function r5(e){return e!=null&&`current`in e}function i5(e){let{children:t,elementsRef:n,labelsRef:r,onMapChange:i}=e,a=GJ(i),[,o]=G.useState(0),s=HJ(o5).current,c=HJ(a5).current,l=G.useRef(0),u=G.useRef(!0),d=G.useRef(null),f=G.useRef(null),p=GJ(()=>{u.current||(u.current=!0,o(e=>e+1))}),m=GJ((e,t)=>{c.set(e,t),p()}),h=GJ(e=>{c.delete(e),p()}),g=GJ(e=>{let t=new Map;return n.current.length=0,r&&(r.current.length=0),e.forEach(e=>{t.set(e.element,{...e.registration.metadata??{},index:e.index}),n.current[e.index]=e.element,r&&(r.current[e.index]=e.registration.label===void 0?e.registration.textRef?.current?.textContent??e.element.textContent:e.registration.label)}),l.current=n.current.length,t});function _(e){if(f.current?.disconnect(),f.current=null,typeof MutationObserver!=`function`||e.length<2)return;let t=new MutationObserver(n=>{if(!l5(n))return;let r=null;for(let n of e)if(n.isConnected){if(r&&u5(r,n)>0){t.disconnect(),p();return}r=n}});f.current=t;let n=new Set;for(let t=1;t<e.length;t+=1){let r=c5(e[t-1],e[t]);r&&n.add(r)}n.forEach(e=>t.observe(e,{childList:!0}))}let v=GJ(()=>{let[e,t]=s5(c),n=g(e),r=d.current,i=!r||r.length!==e.length||e.some((e,t)=>{let n=r[t];return e.index!==n.index||e.element!==n.element||e.registration.index!==n.registration.index||e.registration.metadata!==n.registration.metadata});_(t),d.current=e,u.current=!1,i&&(s.forEach(e=>e(n)),a(n))});$(()=>(!u.current&&d.current&&g(d.current),()=>{n.current=[],r&&(r.current=[])}),[n,r,g]),$(()=>{u.current&&v()}),$(()=>()=>{f.current?.disconnect(),u.current=!0},[]);let y=GJ(e=>(s.add(e),()=>{s.delete(e)})),b=G.useMemo(()=>({register:m,unregister:h,subscribeMapChange:y,nextIndexRef:l}),[m,h,y,l]);return(0,Z.jsx)(u8.Provider,{value:b,children:t})}function a5(){return new Map}function o5(){return new Set}function s5(e){let t=new Set,n=[],r=[];e.forEach((e,i)=>{if(!i.isConnected)return;let a=e.index,o={index:a??-1,element:i,registration:e};a===null?r.push(o):a>=0&&(t.add(a),n.push(o))});let i=0;return r.sort((e,t)=>u5(e.element,t.element)),r.forEach(e=>{for(;t.has(i);)i+=1;e.index=i,n.push(e),i+=1}),t.size>0&&n.sort((e,t)=>e.index-t.index),[n,r.map(e=>e.element)]}function c5(e,t){let n=e.parentElement;for(;n&&!n.contains(t);)n=n.parentElement;return n}function l5(e){for(let t of e)for(let e=0;e<t.removedNodes.length;e+=1)if(t.removedNodes[e].isConnected)return!0;return!1}function u5(e,t){return e.nextElementSibling===t?-1:t.nextElementSibling===e?1:e.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1}function d5(e){let{store:t,domReference:n,positionerElement:r,open:i}=e,a=G.useRef(null),o=G.useRef(null),s=O2(r);$(()=>{i||(o.current?.abort(),o.current=null,t.state.instantType===`trigger-change`&&t.set(`instantType`,void 0))},[i,t]),$(()=>{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 f5(e,t,{styles:n,transitionStatus:r,props:i,refs:a,hidden:o,inert:s=!1}){let c={...n};return s&&(c.pointerEvents=`none`),MY(`div`,e,{state:t,ref:a,props:[{role:`presentation`,hidden:o,style:c},O8(r),i],stateAttributesMapping:gZ})}var p5=20;function m5(e,t,n,r){let[i,a]=G.useState(!1);$(()=>{if(!e||!t||n==null){a(!1);return}let r=gQ(n).documentElement.clientWidth,i=n.offsetWidth;a(r>0&&i>0&&i>=r-p5)},[e,t,n]),i6(e&&(!t||i),r)}var h5=G.forwardRef(function(e,t){let{anchor:n,positionMethod:r=`absolute`,className:i,render:a,side:o,align:s,sideOffset:c=0,alignOffset:l=0,collisionBoundary:u=`clipping-ancestors`,collisionPadding:d=5,arrowPadding:f=5,sticky:p=!1,disableAnchorTracking:m=!1,collisionAvoidance:h=q0,style:g,..._}=e,{store:v,virtualFocus:y,syncHighlightedItem:b}=X6(),x=z8(),S=Q6(!0),C=v.useState(`parent`),w=v.useState(`floatingRootContext`),T=v.useState(`floatingTreeRoot`),E=v.useState(`mounted`),D=v.useState(`open`),O=v.useState(`modal`),k=v.useState(`openMethod`),A=v.useState(`activeTriggerElement`),j=v.useState(`transitionStatus`),M=v.useState(`positionerElement`),N=v.useState(`instantType`),P=v.useState(`adaptiveOrigin`),F=v.useState(`lastOpenChangeReason`),I=v.useState(`floatingNodeId`),L=v.useState(`floatingParentNodeId`),R=w.useState(`domReferenceElement`),z=n,ee=c,te=l,B=s,ne=h;C.type===`context-menu`&&(z=n??C.context?.anchor,B??=`start`,!o&&B!==`center`&&(te=e.alignOffset??2,ee=e.sideOffset??-5));let re=o,V=B;C.type===`menu`?(re??=`inline-end`,V??=`start`,ne=e.collisionAvoidance??J0):C.type===`menubar`&&(re??=C.context.orientation===`vertical`?`inline-end`:`bottom`,V??=`start`);let H=C.type===`context-menu`,ie=t5({anchor:z,floatingRootContext:w,positionMethod:S?`fixed`:r,mounted:E,side:re,sideOffset:ee,align:V,alignOffset:te,arrowPadding:H?0:f,collisionBoundary:u,collisionPadding:d,sticky:p,nodeId:I,keepMounted:x,disableAnchorTracking:m,collisionAvoidance:ne,shift:H?{crossAxis:!(`side`in ne&&ne.side===`flip`),rootBoundary:`layoutViewport`}:void 0,externalTree:T,adaptiveOrigin:P,lazyFlip:y?`placement`:!1});G.useEffect(()=>{function e(e){e.open&&(e.parentNodeId===I&&v.set(`hoverEnabled`,!1),e.nodeId!==I&&e.parentNodeId===v.select(`floatingParentNodeId`)&&v.setOpen(!1,$1(m0)))}return T.events.on(`menuopenchange`,e),()=>{T.events.off(`menuopenchange`,e)}},[v,T.events,I]),G.useEffect(()=>{if(v.select(`floatingParentNodeId`)==null)return;function e(e){if(e.open||e.nodeId!==v.select(`floatingParentNodeId`))return;let t=e.reason??`sibling-open`;v.setOpen(!1,$1(t))}return T.events.on(`menuopenchange`,e),()=>{T.events.off(`menuopenchange`,e)}},[T.events,v]);let ae=eY();G.useEffect(()=>{D||ae.clear()},[D,ae]),G.useEffect(()=>{function e(e){if(!(!D||e.nodeId!==v.select(`floatingParentNodeId`))){if(e.target&&A&&A!==e.target){let e=v.select(`closeDelay`);e>0?ae.isStarted()||ae.start(e,()=>{v.setOpen(!1,$1(m0))}):v.setOpen(!1,$1(m0))}else ae.clear()}}return T.events.on(`itemhover`,e),()=>{T.events.off(`itemhover`,e)}},[T.events,D,A,v,ae]),G.useEffect(()=>{let e={open:D,nodeId:I,parentNodeId:L,reason:v.select(`lastOpenChangeReason`)};T.events.emit(`menuopenchange`,e)},[T.events,D,v,I,L]),d5({store:v,domReference:R,positionerElement:M,open:D});let oe={open:D,side:ie.side,align:ie.align,anchorHidden:ie.anchorHidden,nested:C.type===`menu`,instant:N},se=C.type===`menubar`&&C.context.modal;m5(D&&(se||O&&F!==`trigger-hover`),k===`touch`,M,A);let ce=f5(e,oe,{styles:ie.positionerStyles,transitionStatus:j,props:_,refs:[t,v.useStateSetter(`positionerElement`)],hidden:!E,inert:!D}),le=E&&C.type!==`menu`&&(C.type!==`menubar`&&O&&F!==`trigger-hover`||C.type===`menubar`&&C.context.modal),ue=null;return C.type===`menubar`?ue=C.context.contentElement:C.type===void 0&&(ue=A),(0,Z.jsxs)(q6.Provider,{value:ie,children:[le&&(0,Z.jsx)(q3,{ref:C.type===`context-menu`||C.type===`nested-context-menu`?C.context.internalBackdropRef:null,inert:K3(!D),cutout:ue}),(0,Z.jsx)(c2,{id:I,children:(0,Z.jsx)(i5,{elementsRef:v.context.itemDomElements,labelsRef:v.context.itemLabels,onMapChange:b,children:ce})})]})}),g5=G.createContext(null);function _5(e){let t=G.useContext(g5);if(t===null&&!e)throw Error(nY(5));return t}function v5(e){return e==null?t0:e.type.startsWith(`key`)?d0:e.type.startsWith(`mouse`)||e.type.startsWith(`pointer`)?f0:t0}var y5={...m4,disabled:e=>e.parent.type===`menubar`&&e.parent.context.disabled||e.disabled,modal:e=>(e.parent.type===void 0||e.parent.type===`context-menu`)&&(e.modal??!0),openMethod:e=>e.openMethod,keyboardOpen:e=>e.keyboardOpen,allowMouseEnter:e=>e.allowMouseEnter,highlightItemOnHover:e=>e.highlightItemOnHover,parent:e=>e.parent,rootId:e=>e.parent.type===`menu`?e.parent.store.select(`rootId`):e.parent.type===void 0?e.rootId:e.parent.context.rootId,activeIndex:e=>e.activeIndex,listElement:e=>e.listElement,triggerControlsId:(e,t)=>{let n=m4.triggerPopupId(e,t);return n?e.listElement?.id||n:void 0},filterTriggerProps:e=>e.filterTriggerProps,inputProps:e=>e.inputProps,webkitAriaSelected:(e,t)=>RX&&e.inputFocused&&t?!0:void 0,highlightedItemId:e=>e.highlightedItem?.id||void 0,isActive:(e,t)=>e.activeIndex===t,hoverEnabled:e=>e.hoverEnabled,instantType:e=>e.instantType===`trigger-change`&&!m4.open(e)?void 0:e.instantType,lastOpenChangeReason:e=>e.openChangeReason,floatingTreeRoot:e=>e.parent.type===`menu`?e.parent.store.select(`floatingTreeRoot`):e.floatingTreeRoot,floatingNodeId:e=>e.floatingNodeId,floatingParentNodeId:e=>e.floatingParentNodeId,itemProps:e=>e.itemProps,closeDelay:e=>e.closeDelay,adaptiveOrigin:e=>e.adaptiveOrigin,keyboardEventRelay:e=>{if(e.keyboardEventRelay)return e.keyboardEventRelay;if(e.parent.type===`menu`)return e.parent.store.select(`keyboardEventRelay`)}},b5=class extends a4{constructor(e,t,n=!1){let r=new W2,i=S5(r,t,n,e);super(i,x5(r),y5),this.observe(`parent`,e=>{e.type===`menu`?this.context.allowMouseUpTriggerRef=e.store.context.allowMouseUpTriggerRef:e.type!==void 0&&(this.context.allowMouseUpTriggerRef=e.context.allowMouseUpTriggerRef)})}subscribeToParentMenu(){let e=this.state.parent;if(e.type!==`menu`)return;let t=e.store.select(`rootId`),n=e.store.select(`floatingTreeRoot`),r=e.store.select(`keyboardEventRelay`);return e.store.subscribe(()=>{let i=e.store.select(`rootId`),a=e.store.select(`floatingTreeRoot`),o=e.store.select(`keyboardEventRelay`);(t!==i||n!==a||r!==o)&&(t=i,n=a,r=o,this.notifyAll())})}setOpen(e,t){this.state.floatingRootContext.context.events.emit(`setOpen`,{open:e,eventDetails:t})}setActiveIndex(e,t,n){if(this.state.activeIndex!==e){let r=(e===null?void 0:this.context.itemDomElements.current[e])===this.context.reportedItem;this.context.highlightReason=r?`none`:t,this.context.highlightEvent=r?void 0:n}this.set(`activeIndex`,e)}highlightItem(e,t,n){let r=this.context.itemDomElements.current.indexOf(e);r>-1&&this.setActiveIndex(r,t,n)}};function x5(e){return{positionerRef:G.createRef(),popupRef:G.createRef(),typingRef:{current:!1},itemDomElements:{current:[]},itemLabels:{current:[]},highlightReason:`none`,highlightEvent:void 0,reportedItem:void 0,allowMouseUpTriggerRef:{current:!1},virtualFocusRef:void 0,triggerFocusTargetRef:G.createRef(),beforeTriggerFocusGuardRef:G.createRef(),beforeContentFocusGuardRef:G.createRef(),onOpenChangeComplete:void 0,triggerElements:e}}function S5(e,t,n=!1,r){return{...c4(e,t,n),disabled:!1,modal:!0,openMethod:null,keyboardOpen:!1,allowMouseEnter:!1,highlightItemOnHover:!0,parent:{type:void 0},rootId:void 0,activeIndex:null,listElement:null,filterTriggerProps:XJ,inputProps:XJ,inputFocused:!1,highlightedItem:void 0,hoverEnabled:!0,instantType:void 0,openChangeReason:null,floatingTreeRoot:new n2,floatingNodeId:void 0,floatingParentNodeId:null,itemProps:XJ,keyboardEventRelay:void 0,closeDelay:0,adaptiveOrigin:void 0,...r}}var C5=G.createContext(null);function w5(e,t){return(e===`trigger-press`||e===`item-press`)&&t?.detail===0}function T5(e,t){return e===`list-navigation`||w5(e,t)}var E5=Y2(function(e){let{children:t,open:n,onOpenChange:r,onOpenChangeComplete:i,onItemHighlighted:a,defaultOpen:o=!1,disabled:s=!1,modal:c,loopFocus:l=!0,orientation:u=`vertical`,actionsRef:d,closeParentOnEsc:f=!1,handle:p,triggerId:m,defaultTriggerId:h=null,highlightItemOnHover:g=!0,isSubmenu:_=!1,virtualFocus:v=!1,virtualFocusRef:y,allowEscape:b=!0,resetOnPointerLeave:x=!0}=e,S=Q6(!0),C=X6(!0),w=_5(!0),T=C?.store,E=C?.virtualFocus??!1,D=G.useMemo(()=>_&&T?{type:`menu`,store:T}:w?{type:`menubar`,context:w}:S&&!T?{type:`context-menu`,context:S}:{type:void 0},[S,T,w,_]),O=qY(),k=qY(),[A,j]=G.useState(void 0),M=(A??k)||void 0,N=a2(),P=D.type===`menu`?D.store:void 0,F=(n??o)&&P?.state.transitionStatus===`starting`,I=HJ(()=>F?P?.state.instantType:void 0).current,L=HJ(()=>{let e=new b5({open:o,openProp:n,activeTriggerId:h,triggerIdProp:m,parent:D,disabled:s,highlightItemOnHover:g,modal:D.type===void 0?c:void 0,rootId:O,instantType:I},M,N!=null);return e.context.virtualFocusRef=y,e}).current;L.useControlledProp(`openProp`,n),L.useControlledProp(`triggerIdProp`,m),L.useContextCallback(`onOpenChangeComplete`,i);let R=L.useState(`floatingTreeRoot`),z=s2(R),ee=L.useState(`open`),te=L.useState(`activeTriggerElement`),B=L.useState(`positionerElement`),ne=L.useState(`hoverEnabled`),re=L.useState(`disabled`),V=L.useState(`lastOpenChangeReason`),H=L.useState(`parent`),ie=L.useState(`activeIndex`),ae=L.useState(`keyboardOpen`),oe=L.useState(`payload`),se=L.useState(`floatingParentNodeId`),ce=G.useRef(null),le=G.useRef(H.type!==`context-menu`),ue=eY(),de=G.useRef(!0),fe=eY(),pe=se!=null,{openMethod:me,triggerProps:he}=c6(ee);L.useSyncedValues({disabled:s,highlightItemOnHover:g,modal:H.type===void 0?c:void 0,openMethod:me,rootId:O}),B2(L);let{forceUnmount:ge,transitionStatus:_e}=V2(ee,L,()=>{L.set(`allowMouseEnter`,!1)},F),ve=O2(L.context.popupRef);G.useEffect(()=>{if(I===void 0)return;let e=()=>{L.state.instantType===I&&L.set(`instantType`,void 0)};if(!ee){e();return}if(_e!==void 0)return;if(L.context.popupRef.current==null){e();return}let t=new AbortController;return ve(e,t.signal),()=>{t.abort()}},[I,ee,_e,ve,L]),$(()=>{S&&!C?L.update({parent:{type:`context-menu`,context:S},floatingNodeId:z,floatingParentNodeId:N}):(C||!L.select(`activeTriggerElement`))&&L.update({floatingNodeId:z,floatingParentNodeId:N})},[S,C,z,N,te,L]),G.useEffect(()=>{if(ee||(ce.current=null),H.type===`context-menu`){if(!ee){ue.clear(),le.current=!1;return}ue.start(500,()=>{le.current=!0})}},[ue,ee,H.type]),$(()=>{!ee&&!ne&&L.set(`hoverEnabled`,!0)},[ee,ne,L]);let ye=GJ((e,t)=>{let n=t.reason;if(!e&&!L.select(`open`)||ee===e&&t.trigger===te&&V===n)return;let i=R2(t);if(!e&&t.trigger==null&&(t.trigger=te??void 0),r?.(e,t),t.isCanceled)return;L.state.floatingRootContext.dispatchOpenChange(e,t);let a=t.event;if(e===!1&&n!==`item-press`&&a?.type===`click`&&a.pointerType===`touch`&&!de.current)return;e&&n===`trigger-focus`?(de.current=!1,fe.start(300,()=>{de.current=!0})):(de.current=!0,fe.clear());let o=!e&&(n===`escape-key`||n==null);ce.current=t.event;let s=L2(L.state,e,t.trigger,i());s.openChangeReason=n,s.keyboardOpen=e&&T5(n,a),s.instantType=H.type===`menubar`&&(n===`trigger-focus`||n===`focus-out`||n===`trigger-hover`||n===`list-navigation`||n===`sibling-open`)?`group`:w5(n,a)?`click`:o?`dismiss`:void 0,L.update(s)}),be=w2({popupStore:L,floatingRootContext:L.state.floatingRootContext,floatingId:M,nested:N!=null,onOpenChange:ye}),xe=be.context.events;$(()=>{let e=({open:e,eventDetails:t})=>ye(e,t);return xe.on(`setOpen`,e),()=>{xe?.off(`setOpen`,e)}},[xe,ye]),$(()=>L.subscribeToParentMenu(),[L]);let Se=G.useCallback(()=>{L.setOpen(!1,$1(h0))},[L]);G.useImperativeHandle(d,()=>({unmount:ge,close:Se}),[ge,Se]);let Ce;H.type===`context-menu`&&(Ce=H.context),G.useImperativeHandle(Ce?.positionerRef,()=>B,[B]),G.useImperativeHandle(Ce?.actionsRef,()=>({setOpen:ye}),[ye]);let we=C2(be,{enabled:!re,bubbles:{escapeKey:f&&H.type===`menu`},outsidePress(){return H.type!==`context-menu`||ce.current?.type===`contextmenu`||le.current},externalTree:pe?R:void 0}),Te=n$(),Ee=M4(be,{enabled:!re,listRef:L.context.itemDomElements,activeIndex:ie,virtual:v,nested:H.type===`menubar`||!v&&H.type!==void 0,parentOrientation:H.type===`menubar`?H.context.orientation:void 0,loopFocus:l,focusItemOnOpen:v?ae:void 0,allowEscape:v&&l&&b,orientation:u,triggerOrientation:v?`vertical`:u,rtl:Te===`rtl`,disabledIndices:YJ,onNavigate(e,t){L.setActiveIndex(e,v5(t),t?.nativeEvent)},openOnArrowKeyDown:H.type!==`context-menu`&&!(v&&_),externalTree:!v&&pe?R:void 0,nestedReturnFocusRef:P?.context.virtualFocusRef,focusItemOnHover:g,resetOnPointerLeave:x}),De=G.useCallback(e=>{L.context.typingRef.current=e},[L]),Oe=N4(be,{enabled:!re&&!v,listRef:L.context.itemLabels,elementsRef:L.context.itemDomElements,activeIndex:ie,resetMs:500,onMatch:(e,t)=>{ee&&e!==ie&&L.setActiveIndex(e,d0,t.nativeEvent)},onTyping:De}),ke=GJ(a),Ae=G.useRef(-1),je=GJ(()=>{let e=L.state.activeIndex,t=e===null?void 0:L.context.itemDomElements.current[e]??void 0;if(t?.isConnected===!1)return;let n=t===void 0?-1:e;if(Ae.current===n&&L.context.reportedItem===t)return;Ae.current=n,L.context.reportedItem=t,v&&L.set(`highlightedItem`,t);let{highlightReason:r,highlightEvent:i}=L.context;L.context.highlightReason=t0,L.context.highlightEvent=void 0,a&&ke(t,e0(r,i,{label:t===void 0?void 0:L.context.itemLabels.current[n]??void 0}))});$(()=>{je()},[ie,je]);let Me=G.useMemo(()=>{if(!v)return Ee.reference;if(!Ee.trigger)return XJ;let{onFocus:e,...t}=Ee.trigger;return t},[v,Ee.reference,Ee.trigger]);L.useSyncedValue(`inputProps`,v?Ee.reference??XJ:XJ);let Ne=G.useMemo(()=>{let e=yY(Oe.reference,Me,we.reference,{onMouseMove(){L.set(`allowMouseEnter`,!0)}},he);return e[`aria-haspopup`]=`menu`,e[`aria-expanded`]=ee,e},[L,Oe.reference,Me,we.reference,he,ee]),Pe=G.useMemo(()=>{let e=yY(Ee.trigger,we.trigger,he);return e[`aria-haspopup`]=`menu`,e[`aria-expanded`]=!1,e},[Ee.trigger,we.trigger,he]);HJ(()=>(L.update({inactiveTriggerProps:Pe}),null)),H2(L,{floatingRootContext:be,activeTriggerProps:Ne,inactiveTriggerProps:Pe,popupProps:G.useMemo(()=>yY(j2,{onMouseMove(){L.set(`allowMouseEnter`,!0),H.type===`menu`&&L.set(`hoverEnabled`,!1)},onClick(){L.select(`hoverEnabled`)&&L.set(`hoverEnabled`,!1)},onKeyDown(e){let t=L.select(`keyboardEventRelay`);t&&!e.isPropagationStopped()&&t(e)}},Oe.floating,Ee.floating,we.floating),[H.type,L,Oe.floating,Ee.floating,we.floating]),itemProps:Ee.item??XJ});let Fe=G.useMemo(()=>({store:L,parent:D,orientation:u,loopFocus:l,allowEscape:b,defaultFloatingId:k,setRenderedFloatingId:j,virtualFocus:v,parentVirtualFocus:E,syncHighlightedItem:je}),[L,D,u,l,b,k,v,E,je]),Ie=typeof t==`function`?t({payload:oe}):t,Le=(0,Z.jsxs)(Y6.Provider,{value:Fe,children:[p&&(0,Z.jsx)(P2,{handle:p,store:L}),Ie]});return(H.type===void 0||H.type===`context-menu`)&&(Le=(0,Z.jsx)(l2,{externalTree:R,children:Le})),Le});function D5(e){let t=G.useContext(C5);if(t===null)return(0,Z.jsx)(E5,{...e});let n=t.Root;return(0,Z.jsx)(C5.Provider,{value:null,children:(0,Z.jsx)(n,{...t.options,...e})})}var O5=5;function k5(e,t){let n=A5(t);return e.clientX>=n.left-O5&&e.clientX<=n.right+O5&&e.clientY>=n.top-O5&&e.clientY<=n.bottom+O5}function A5(e){let t=e.getBoundingClientRect(),n=iX(e);if(BX)return t;let r=n.getComputedStyle(e,`::before`),i=n.getComputedStyle(e,`::after`);if(r.content===`none`&&i.content===`none`)return t;let a=parseFloat(r.width)||0,o=parseFloat(r.height)||0,s=parseFloat(i.width)||0,c=parseFloat(i.height)||0,l=Math.max(t.width,a,s),u=Math.max(t.height,o,c),d=l-t.width,f=u-t.height;return{left:t.left-d/2,right:t.right+d/2,top:t.top-f/2,bottom:t.bottom+f/2}}function j5(e={}){let{highlightItemOnHover:t,highlightedIndex:n,onHighlightedIndexChange:r}=q1(),{ref:i,index:a}=f8(e),o=n===a,s=G.useRef(null),c=aY(i,s);return{compositeProps:{tabIndex:o?0:-1,onFocus(){r(a)},onMouseMove(){let e=s.current;if(!t||!e)return;let n=e.hasAttribute(`disabled`)||e.ariaDisabled===`true`;!o&&!n&&e.focus()}},compositeRef:c,index:a}}function M5(e){let{render:t,className:n,style:r,state:i=XJ,props:a=YJ,refs:o=YJ,metadata:s,stateAttributesMapping:c,tag:l=`div`,...u}=e,{compositeProps:d,compositeRef:f}=j5({metadata:s});return MY(l,e,{state:i,ref:[f,...o],props:[d,...a,u],stateAttributesMapping:c})}function N5(e){if(cX(e)&&e.hasAttribute(`data-rootownerid`))return e.getAttribute(`data-rootownerid`);if(!bX(e))return N5(CX(e))}function P5(e,t){function n(n,r,i){let a=n.currentTarget;WF.flushSync(()=>{e.setOpen(!1,$1(c0,n.nativeEvent,a))}),IQ(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&&LQ(t,r)?e.context.beforeContentFocusGuardRef.current?.focus():n(t,1,r)}return{handlePreFocusGuardFocus:r,handleFocusTargetFocus:i}}function F5(e){let{enabled:t=!0,mouseDownAction:n,open:r}=e,i=G.useRef(!1);return G.useMemo(()=>t?{onMouseDown:e=>{(n===`open`&&!r||n===`close`&&r)&&(i.current=!0,gQ(e.currentTarget).addEventListener(`click`,()=>{i.current=!1},{once:!0}))},onClick:e=>{i.current&&(i.current=!1,e.preventBaseUIHandler())}}:XJ,[t,n,r])}var I5=X2(function(e,t){let{render:n,className:r,style:i,disabled:a=!1,nativeButton:o=!0,id:s,openOnHover:c,delay:l=100,closeDelay:u=0,handle:d,payload:f,...p}=e,m=X6(!0),h=h4(d)??m?.store;if(!h)throw Error(nY(85));let g=qY(s),_=h.useState(`isTriggerActive`,g),v=h.useState(`floatingRootContext`),y=h.useState(`isOpenedByTrigger`,g),b=h.useState(`triggerControlsId`,g),x=G.useRef(null),S=R5(),C=q1(!0),w=o2(),T=G.useMemo(()=>w??new n2,[w]),{registerTrigger:E,isMountedByThisTrigger:D}=z2(g,x,h,{payload:f,closeDelay:u,parent:S,floatingTreeRoot:T,floatingNodeId:s2(T),floatingParentNodeId:a2(),keyboardEventRelay:C?.relayKeyboardEvent}),O=S.type===`menubar`,k=h.useState(`disabled`),A=a||k||O&&S.context.disabled,{getButtonProps:j,buttonRef:M}=X1({disabled:A,native:o});G.useEffect(()=>{!y&&S.type===void 0&&(h.context.allowMouseUpTriggerRef.current=!1)},[h,y,S.type]);let N=G.useRef(null),P=eY(),F=GJ(e=>{if(!N.current)return;P.clear(),h.context.allowMouseUpTriggerRef.current=!1;let t=e.target;HX(N.current,t)||HX(h.select(`positionerElement`),t)||t===N.current||(t==null||N5(t)!==h.select(`rootId`))&&(k5(e,N.current)||T.events.emit(`close`,{domEvent:e,reason:p0}))});G.useEffect(()=>{let e=gQ(N.current);if(y&&h.select(`lastOpenChangeReason`)===`trigger-hover`)return e.addEventListener(`mouseup`,F,{once:!0}),()=>{e.removeEventListener(`mouseup`,F)}},[y,F,h]);let I=O&&S.context.hasSubmenuOpen,L=T4(v,{enabled:(c??I)&&!A&&(!O||I&&!D),handleClose:V4({blockPointerEvents:!O}),mouseOnly:!0,move:!1,restMs:S.type===void 0?l:void 0,delay:{close:u},triggerElementRef:x,externalTree:T,isActiveTrigger:_,isClosing:()=>h.select(`transitionStatus`)===`ending`}),R=L5(y,h.select(`lastOpenChangeReason`)),z=b2(v,{enabled:!A,event:y&&O?`click`:`mousedown`,toggle:!0,ignoreMouse:!1,stickIfOpen:S.type===void 0&&R}),ee=_4(v,{enabled:!A&&I}),te=F5({open:y,enabled:O,mouseDownAction:`open`}),B=G.useMemo(()=>yY(ee.reference,z.reference),[ee.reference,z.reference]),ne=h.useState(`triggerProps`,D),re=h.useState(`filterTriggerProps`),{handlePreFocusGuardFocus:V,handleFocusTargetFocus:H}=P5(h,x),ie={disabled:A,open:y},ae=[N,t,M,E,x],oe=[B,L??XJ,ne,{"aria-haspopup":`menu`,"aria-controls":b,id:g,onMouseDown:e=>{h.select(`open`)||(P.start(200,()=>{h.context.allowMouseUpTriggerRef.current=!0}),gQ(e.currentTarget).addEventListener(`mouseup`,F,{once:!0}))}},re,O?{role:`menuitem`}:{},te,p,j],se=MY(`button`,e,{enabled:!O,stateAttributesMapping:hZ,state:ie,ref:ae,props:oe});return O?(0,Z.jsx)(M5,{tag:`button`,render:n,className:r,style:i,state:ie,refs:ae,props:oe,stateAttributesMapping:hZ}):y?(0,Z.jsxs)(G.Fragment,{children:[(0,Z.jsx)(A0,{ref:h.context.beforeTriggerFocusGuardRef,onFocus:V},`${g}-pre-focus-guard`),(0,Z.jsx)(G.Fragment,{children:se},g),(0,Z.jsx)(A0,{ref:h.context.triggerFocusTargetRef,onFocus:H},`${g}-post-focus-guard`)]}):(0,Z.jsx)(G.Fragment,{children:se},g)});function L5(e,t){let n=eY(),[r,i]=G.useState(!1);return $(()=>{e&&t===`trigger-hover`?(i(!0),n.start(500,()=>{i(!1)})):e||(n.clear(),i(!1))},[e,t,n]),r}function R5(){let e=_5(!0);return G.useMemo(()=>e?{type:`menubar`,context:e}:{type:void 0},[e])}var z5=G.forwardRef(function(e,t){let{className:n,render:r,orientation:i=`horizontal`,style:a,...o}=e;return MY(`div`,e,{state:{orientation:i},ref:t,props:[{role:`separator`,"aria-orientation":i},o]})}),B5=(0,G.createContext)(null);function V5({actionsRef:e,children:t,interactionOwner:n=`local`,onOpenChange:r,...i}){let a=(0,G.useRef)(null),o=e??a;return DH(()=>o.current?.close()),(0,Z.jsx)(B5.Provider,{value:{actionsRef:o,interactionOwner:n},children:(0,Z.jsx)(D5,{...i,actionsRef:o,onOpenChange:(e,t)=>{if(n===`host`&&!e&&t.reason===`escape-key`){t.cancel(),t.allowPropagation();return}r?.(e,t)},children:t})})}function H5(){let e=(0,G.useContext)(B5);if(!e)throw Error(`DropdownMenu parts must be used inside <DropdownMenu>`);return e}var U5=(0,G.forwardRef)(function({className:e,render:t,type:n=`button`,...r},i){return(0,Z.jsx)(I5,{...r,className:t=>Q(`btn caps-dropdown-trigger`,jR(e,t)),ref:i,render:t,type:n})}),W5=(0,G.forwardRef)(function({container:e,...t},n){let r=EH(`popover`);return e==null&&r===null?null:(0,Z.jsx)(B8,{...t,container:e??r,ref:n})}),G5=(0,G.forwardRef)(function({className:e,collisionBoundary:t,...n},r){let i=EH(`popover`);return(0,Z.jsx)(h5,{...n,className:t=>Q(`z-(--stipe-layer-popover)`,jR(e,t)),collisionBoundary:t??(i&&i!==document.body?i:void 0),ref:r})}),K5=(0,G.forwardRef)(function({className:e,finalFocus:t,...n},r){let{interactionOwner:i}=H5(),a=(0,G.useRef)(null);(0,G.useImperativeHandle)(r,()=>a.current);let o=z6(`.caps-dropdown-item[data-highlighted]`),s=(0,G.useCallback)(e=>{a.current=e,o(e)},[o]);return(0,Z.jsx)(L8,{...n,className:t=>Q(`caps-dropdown-popup min-w-40 rounded-box border border-base-300 bg-base-100 p-xs shadow-lg outline-none`,jR(e,t)),finalFocus:i===`host`?!1:t??!0,ref:s})}),q5=(0,G.forwardRef)(function({align:e=`end`,alignOffset:t,children:n,container:r,keepMounted:i,side:a=`bottom`,sideOffset:o=4,...s},c){return(0,Z.jsx)(W5,{container:r,keepMounted:i,children:(0,Z.jsx)(G5,{align:e,alignOffset:t,side:a,sideOffset:o,children:(0,Z.jsx)(K5,{...s,ref:c,children:n})})})}),J5=`caps-dropdown-item flex min-h-2xl w-full items-center gap-sm rounded-field px-md py-xs text-left text-sm outline-none transition-colors hover:bg-base-200 focus-visible:bg-base-200 aria-[current=page]:bg-base-200 aria-[current=page]:font-semibold disabled:cursor-not-allowed disabled:text-base-content/40 data-disabled:cursor-not-allowed data-disabled:text-base-content/40`,Y5=(0,G.forwardRef)(function({className:e,onClick:t,onSelect:n,variant:r=`default`,...i},a){return(0,Z.jsx)(T8,{...i,className:t=>Q(J5,r===`destructive`&&`text-error hover:bg-error hover:text-error-content focus-visible:bg-error focus-visible:text-error-content`,jR(e,t)),onClick:e=>{t?.(e),e.defaultPrevented||n?.(e)},ref:a})}),X5=(0,G.forwardRef)(function({children:e,className:t,onClick:n,onSelect:r,...i},a){return(0,Z.jsxs)(_8,{...i,className:e=>Q(J5,jR(t,e)),onClick:e=>{n?.(e),e.defaultPrevented||r?.(e)},ref:a,children:[(0,Z.jsx)(`span`,{className:`min-w-0 flex-1`,children:e}),(0,Z.jsx)(v8,{"aria-hidden":`true`,className:`shrink-0`,children:`✓`})]})}),Z5=(0,G.forwardRef)(function({className:e,...t},n){return(0,Z.jsx)(z5,{...t,className:t=>Q(`my-xs h-px bg-base-300`,jR(e,t)),ref:n})}),Q5=S8,$5=(0,G.forwardRef)(function({className:e,...t},n){return(0,Z.jsx)(C8,{...t,className:t=>Q(`px-md pb-xs pt-sm text-xs font-semibold text-base-content/60`,jR(e,t)),ref:n})});function e7(e){return e?.closest(`[data-app-pane="media"]`)??e}function t7(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 n7(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 r7(e,t=64){let n=await new OfflineAudioContext(1,1,44100).decodeAudioData(e);return{peaks:n7(Array.from({length:n.numberOfChannels},(e,t)=>n.getChannelData(t)),t),durationSeconds:n.duration}}var i7=new Map;async function a7(e,t){let n=await fetch(e);if(!n.ok)throw Error(`audio responded ${String(n.status)}`);return r7(await n.arrayBuffer(),t)}function o7(e,t){let n=`${String(t)}:${e}`,r=i7.get(n);if(r!==void 0)return r;let i=a7(e,t).catch(e=>{throw i7.delete(n),e});return i7.set(n,i),i}function s7(e,t=64){let[n,r]=(0,G.useState)({status:`loading`});return(0,G.useEffect)(()=>{if(e===``){r({status:`failed`});return}let n=!0;return r({status:`loading`}),o7(e,t).then(e=>{n&&r({status:`ready`,...e})},e=>{oW(`decode-audio-waveform`,e),n&&r({status:`failed`})}),()=>{n=!1}},[e,t]),n}var c7={voice:`Voice`,sfx:`Sound effects`,music:`Music`};function l7(e){return e.audio.mode===`speech`?`voice`:`music`}function u7(e){return e.flatMap(e=>e.audio===null?[]:[{id:e.id,label:e.label,audio:e.audio}])}function d7(e){return e.audio===null?null:e.audio.mode===`speech`?`voice`:`music`}function f7(e){let t=new Set(e.map(l7));return[`voice`,`sfx`,`music`].filter(e=>t.has(e))}function p7(e,t){return e.filter(e=>l7(e)===t)}function m7({modes:e,value:t,onChange:n,disabled:r=!1}){return(0,Z.jsx)(x1,{className:`prints-audio-modes`,value:t,onValueChange:t=>{let r=e.find(e=>e===t);r!==void 0&&n(r)},children:(0,Z.jsx)(C1,{"aria-label":`Audio type`,className:`prints-audio-modes-list`,variant:`segmented`,children:e.map(e=>(0,Z.jsx)(w1,{"data-audio-mode":e,disabled:r,value:e,children:c7[e]},e))})})}function h7({label:e,name:t,options:n,value:r,disabled:i,onChange:a,icon:o,compact:s=!1}){let[c,l]=(0,G.useState)(null);return(0,Z.jsx)(`span`,{className:`contents`,ref:l,children:(0,Z.jsxs)(V5,{children:[(0,Z.jsx)(U5,{"aria-label":t,disabled:i||n.length===0,render:(t,n)=>(0,Z.jsx)(zJ,{...t,className:Q(`parakeet-composer-model-key`,s&&`prints-audio-key-compact`),expanded:n.open,icon:o,label:e,readout:(0,Z.jsx)(jI,{"aria-hidden":`true`,className:`size-[var(--stipe-icon-size-sm)] shrink-0`})})}),(0,Z.jsx)(q5,{align:`start`,"aria-label":t,container:e7(c),side:`top`,children:n.map(e=>(0,Z.jsx)(X5,{checked:e.value===r,closeOnClick:!0,onSelect:()=>{a(e.value)},children:e.label},String(e.value)))})]})})}function g7({models:e,value:t,onChange:n,disabled:r=!1}){let i=e.find(e=>e.id===t);return(0,Z.jsx)(h7,{disabled:r,label:i===void 0?`Model`:eG(i),name:`Generation model`,onChange:n,options:e.map(e=>({value:e.id,label:e.label})),value:t})}function _7({voices:e,value:t,onChange:n,disabled:r=!1}){let i=e.find(e=>e.id===t);return(0,Z.jsx)(h7,{disabled:r,compact:!0,icon:(0,Z.jsx)(WI,{}),label:i?.label??`Voice`,name:`Voice`,onChange:n,options:e.map(e=>({value:e.id,label:e.label})),value:t})}var v7=[10,15,30,60,90,120,180,300,600];function y7(e){let t=v7.filter(t=>t>=e.min&&t<=e.max);return[...new Set([...t,e.default])].sort((e,t)=>e-t)}function b7({seconds:e,value:t,onChange:n,disabled:r=!1}){return(0,Z.jsx)(h7,{disabled:r,compact:!0,icon:(0,Z.jsx)(NI,{}),label:t7(t),name:`Length`,onChange:n,options:y7(e).map(e=>({value:e,label:t7(e)})),value:t})}var x7=1e5;function S7(e){return!Number.isFinite(e)||e<=0?null:v6(e/x7)}var C7={draft:`Draft`,balanced:`Balanced`,premium:`Premium`,max:`Max`};function w7(e){if(e.kind!==`video`||e.video===null)return C7[e.tier];let t=Math.min(...e.video.prices.map(e=>e.silentMilliunitsPerSecond)),n=Number.isFinite(t)?S7(t):null;return n===null?`Video`:`Video · from ${n}/s`}var T7=[{kind:`image`,label:`Images`},{kind:`video`,label:`Video`}];function E7(e){let t=()=>{e.scrollHeight-e.scrollTop-e.clientHeight>1?e.setAttribute(`data-more`,``):e.removeAttribute(`data-more`)};t();let n=requestAnimationFrame(t);return e.addEventListener(`scroll`,t,{passive:!0}),()=>{cancelAnimationFrame(n),e.removeEventListener(`scroll`,t)}}function D7({compact:e=!1,disabled:t,emptyLabel:n,models:r,onChange:i,value:a}){let o=r.find(e=>e.id===a),[s,c]=(0,G.useState)(null);(0,G.useEffect)(()=>{if(s!==null)return E7(s)},[s]);let[l,u]=(0,G.useState)(null);return(0,Z.jsx)(`span`,{className:`contents`,ref:u,children:(0,Z.jsxs)(V5,{children:[(0,Z.jsx)(U5,{"aria-label":`Generation model`,"data-generation-model":a,disabled:t||r.length===0,render:(t,r)=>{let i=o===void 0?n:eG(o);return e?(0,Z.jsx)(zJ,{...t,className:`parakeet-composer-model-key`,expanded:r.open,icon:(0,Z.jsx)(PI,{}),label:null,readout:(0,Z.jsx)(jI,{"aria-hidden":`true`,className:`size-[var(--stipe-icon-size-sm)] shrink-0`}),title:i}):(0,Z.jsx)(y6,{...t,expanded:r.open,label:i})}}),(0,Z.jsx)(q5,{ref:c,"data-generation-model-menu":!0,container:e7(l),side:`top`,align:`start`,"aria-label":`Generation models`,children:T7.map((e,t)=>{let n=r.filter(t=>t.kind===e.kind);return n.length===0?null:(0,Z.jsxs)(Q5,{children:[t>0?(0,Z.jsx)(Z5,{}):null,(0,Z.jsx)($5,{children:e.label}),n.map(e=>(0,Z.jsx)(X5,{"data-generation-model-option":e.id,checked:e.id===a,closeOnClick:!0,onSelect:()=>{i(e.id)},children:(0,Z.jsxs)(`span`,{className:`prints-model-row flex items-baseline gap-lg`,children:[(0,Z.jsx)(`span`,{className:`min-w-0 flex-1`,children:eG(e)}),(0,Z.jsx)(`span`,{className:`prints-model-detail`,children:w7(e)})]})},e.id))]},e.kind)})})]})})}var O7={kind:`folder`,folder:void 0};function k7(e){let t=ON(e),n=(0,G.useRef)(e);n.current=e;let r=vC(),i=Uw(DK(e)),a=Xw(dU(e,i.data?.configured?{kind:`folder`,path:i.data.path}:null)),o=`${t??``}:${i.data?.path??``}`,[s,c]=(0,G.useState)({scope:o,view:O7}),l=s.scope===o?s.view:O7,u=e=>{c({scope:o,view:e})},[d,f]=(0,G.useState)(null),p=n=>n?.app===e&&n.computerId===t,m=Jw({mutationKey:TK.folder(e),mutationFn:async({owner:e,id:t,path:r,create:i})=>{let a=()=>{if(n.current!==e||e.context.get().computerId!==t)throw new X(`Computer selection changed`,{code:`SELECTION_CHANGED`,retryable:!1})};return a(),i&&await e.capabilities.require(BF).mkdir({path:r}),a(),await zF(e.capabilities,{path:r,limit:1,offset:0}),a(),OG(e.capabilities,t,r)},onSuccess:(e,t)=>{t.owner===n.current&&t.owner.context.get().computerId===t.id&&f(null)},onSettled:(e,t,n)=>Promise.all([r.invalidateQueries({queryKey:n.queryKey,exact:!0}),r.invalidateQueries({queryKey:sU.listing(n.owner,n.path),exact:!0})])}),h=m.variables?.owner===e&&m.variables.id===t,g=i.isFetching||h&&m.isPending,_=async(n,r)=>{if(!e||!t||g)return`Computer selection changed. Try again.`;let i=n.trim();if(!Ux(vU)(i))return`Enter an absolute Computer folder, such as /media.`;try{return await m.mutateAsync({owner:e,id:t,path:i,create:r,queryKey:TK.folder(e)}),null}catch{return`Could not use this folder. Check its location and your Computer permissions.`}},v=i.isError||a.isError,y=v||!i.data?.configured?null:i.data.path,b=y===null?null:l.kind===`folder`?UH(y,l.folder):y,x=y===null?null:l.kind===`folder`?{kind:`folder`,path:b??y}:{kind:l.kind,path:y};return{view:l,setView:u,destination:y,landingPath:b??(v?null:i.data?.path??null),source:x,path:v?null:i.data?.path??null,computerId:t,available:e?.capabilities.has(iP)===!0,writable:e?.capabilities.has(BF)===!0,busy:g,error:v?`Your media folder is unavailable. Choose or create a folder.`:null,editing:p(d),setEditing:n=>{f(n?{app:e,computerId:t}:null)},choose:_,ensureCreated:async()=>i.data?i.data.configured?null:_(i.data.path,!0):`Your Prints library is still loading.`,recheck:()=>{r.invalidateQueries({queryKey:sU.listing(e,i.data?.path??null),exact:!0}),r.invalidateQueries({queryKey:TK.folder(e),exact:!0})}}}var A7={error:0,warning:1,info:2};function j7(e,t){let n=t.generating+t.uploading>0;if(n)return{busy:n,tone:void 0,label:[t.generating?`Creating ${String(t.generating)}`:``,t.uploading?`Uploading ${String(t.uploading)}`:``].filter(Boolean).join(` · `)};let r=[...e].sort((e,t)=>Number(t.blocking??!1)-Number(e.blocking??!1)||A7[e.tone]-A7[t.tone]).at(0);return r?{busy:n,tone:r.tone===`info`?`neutral`:r.tone,label:r.short+(e.length>1?` +${String(e.length-1)}`:``)}:null}function M7(e,t,n){let r=j7(e,t);if(!r)return null;let i={kind:`button`,id:`activity`,text:`Activity`,count:e.length+t.generating+t.uploading,busy:r.busy,title:AE(`Activity: ${r.label}`,1024),opens:`dialog`,expanded:n};return r.tone===void 0?i:{...i,tone:r.tone}}var N7={image:`Image`,video:`Video`,audio:`Audio`,media:`Media`};function P7({connected:e,mediaCapability:t,modelsError:n,retryModels:r,modelsLoading:i,models:a,canGenerate:o,mediaSetupMissing:s,canWrite:c,generationErrors:l,recoveryError:u,pendingGenerations:d,activeGenerations:f,atGenerationLimit:p,gallerySlots:m,computerId:h,failed:g,uploadError:_,uploads:v,permissions:y,resume:b,discard:x,retryUpload:S}){let C=[];if(e)h===null?C.push({key:`no-computer`,group:`Setup`,tone:`info`,blocking:!0,short:`Choose a Computer`,title:`No Computer selected`,detail:`Choose a Computer for this window, or create one in Grove.`}):t?n===null?!i&&!o&&!s&&C.push({key:`approval`,group:`Setup`,tone:`warning`,blocking:!0,short:`Generation not enabled`,title:`Media generation isn’t enabled`,detail:`Turn it on in this App’s Team permissions. Images already generated can still be saved.`,actions:[{label:`Permissions`,run:()=>{y()}}]}):C.push({key:`models:${n}`,group:`Setup`,tone:`warning`,blocking:!0,short:`Models unavailable`,title:`Couldn’t load image models`,detail:n,actions:[{label:`Retry`,run:r}]}):C.push({key:`no-media`,group:`Setup`,tone:`info`,blocking:!0,short:`Image creation off`,title:`Image creation is off for this Computer`,detail:`You can still browse and upload images.`});else{let e=lC(new X(`Prints disconnected`,{code:`DISCONNECTED`,retryable:!0}));C.push({key:`disconnected`,group:`Setup`,tone:`warning`,blocking:!0,short:e.title,title:e.title,detail:e.message})}e&&h!==null&&!c&&C.push({key:`read-only`,group:`Setup`,tone:`info`,blocking:!0,short:`Read-only`,title:`Read-only Computer`,detail:`Uploads and new prints are off.`});for(let e of l){let t=`${N7[e.mediaKind??`media`]} failed`;C.push({key:e.key,group:`Images`,tone:`error`,short:t,title:`${t}: ${e.message}`,detail:e.prompt,blocking:e.dismiss!==void 0,actions:[...e.billing?[{label:`Open Billing`,run:e.billing}]:e.retry?[{label:`Retry`,run:e.retry}]:[],...e.dismiss?[{label:`Dismiss`,run:e.dismiss}]:[]]})}p&&C.push({key:`generation-limit`,group:`Images`,tone:`info`,short:`At the limit`,title:`At the limit`,detail:pW,blocking:!0}),u!==null&&C.push({key:`recovery:${u}`,group:`Images`,tone:`error`,short:`Retry blocked`,title:u});for(let e of d){if(f.has(e.reference.requestId)||m.some(t=>t.computerId===e.reference.computerId&&t.path===e.input.destination.path))continue;let t=`${N7[tG(a,e.input.settings.model)?.kind??`media`]} failed`;C.push({key:`unfinished:${e.reference.requestId}`,group:`Images`,tone:`error`,blocking:!0,short:t,title:`${t}: ${e.failure?.message??`Stopped when Prints closed. Retry to run it again.`}`,detail:e.reference.computerId===h?e.typed.prompt:`${e.typed.prompt} · select the original Computer to retry`,actions:[...e.reference.computerId===h?[{label:`Retry`,run:()=>{b(e)}}]:[],{label:`Dismiss`,run:()=>{x(e)}}]})}g.length>0&&C.push({key:`files:${g.join(`|`)}`,group:`Images`,tone:`error`,short:`Couldn’t open images`,title:`Couldn’t open some images`,detail:g.join(`, `)}),_!==null&&C.push({key:`uploads:${_}`,group:`Uploads`,tone:`error`,short:`Upload failed`,title:`Couldn’t add images`,detail:_});for(let e of v)(e.status===`error`||e.status===`cancelled`)&&C.push({key:`upload:${e.id}:${e.status}`,group:`Uploads`,tone:e.status===`error`?`error`:`info`,short:`Upload failed`,title:`${e.file.name} wasn’t saved`,detail:e.message,actions:[{label:`Retry`,run:()=>{S(e.id)}}]});return C}function F7(e,t){let n=Uw(OK(e)),r=Jw(rP({queryKey:TK.dismissals(e),mutationFn:({owner:e,id:t,keys:n})=>TG(e.capabilities,t,n),apply:(e,t)=>({keys:[...new Set([...e.keys,...t.keys])].slice(-200)})})),i=n=>{e&&t&&n.length>0&&r.mutate({owner:e,id:t,keys:n})};return{error:r.variables?.owner===e&&r.variables.id===t&&r.isError?`Could not dismiss activity. Please try again.`:n.isError?`Could not load dismissed activity. Notices may reappear.`:null,visible:e=>e.filter(e=>(e.blocking??!1)||!n.data?.keys.includes(e.key)),dismiss:e=>{i([e])},dismissAll:e=>{i(e.filter(e=>!e.blocking).map(e=>e.key).slice(-200))}}}var I7=0,L7=1,R7=2,z7=0,B7=1;function V7(e,t,n){let r=e.list,i;for(;r;){if(r.index===n)return!1;if(t>r.high)break;i=r,r=r.next}return i||(e.list={index:n,high:t,next:r}),i&&(i.next={index:n,high:t,next:i.next}),!0}function H7(e,t){let n=e.list;if(n.index===t)return n.next===null?z7:(e.list=n.next,B7);let r=n;for(n=n.next;n!==null;){if(n.index===t)return r.next=n.next,B7;r=n,n=n.next}}var U7={low:0,max:0,high:0,C:R7,P:void 0,R:void 0,L:void 0,list:void 0};U7.P=U7,U7.L=U7,U7.R=U7;function W7(e){let t=e.high;e.max=e.L===U7&&e.R===U7?t:e.L===U7?Math.max(e.R.max,t):e.R===U7?Math.max(e.L.max,t):Math.max(Math.max(e.L.max,e.R.max),t)}function G7(e){let t=e;for(;t.P!==U7;)W7(t.P),t=t.P}function K7(e,t){if(t.R===U7)return;let n=t.R;t.R=n.L,n.L!==U7&&(n.L.P=t),n.P=t.P,t.P===U7?e.root=n:t===t.P.L?t.P.L=n:t.P.R=n,n.L=t,t.P=n,W7(t),W7(n)}function q7(e,t){if(t.L===U7)return;let n=t.L;t.L=n.R,n.R!==U7&&(n.R.P=t),n.P=t.P,t.P===U7?e.root=n:t===t.P.R?t.P.R=n:t.P.L=n,n.R=t,t.P=n,W7(t),W7(n)}function J7(e,t,n){t.P===U7?e.root=n:t===t.P.L?t.P.L=n:t.P.R=n,n.P=t.P}function Y7(e,t){let n;for(;t!==U7&&t.C===L7;)t===t.P.L?(n=t.P.R,n.C===I7&&(n.C=L7,t.P.C=I7,K7(e,t.P),n=t.P.R),n.L.C===L7&&n.R.C===L7?(n.C=I7,t=t.P):(n.R.C===L7&&(n.L.C=L7,n.C=I7,q7(e,n),n=t.P.R),n.C=t.P.C,t.P.C=L7,n.R.C=L7,K7(e,t.P),t=e.root)):(n=t.P.L,n.C===I7&&(n.C=L7,t.P.C=I7,q7(e,t.P),n=t.P.L),n.R.C===L7&&n.L.C===L7?(n.C=I7,t=t.P):(n.L.C===L7&&(n.R.C=L7,n.C=I7,K7(e,n),n=t.P.L),n.C=t.P.C,t.P.C=L7,n.L.C=L7,q7(e,t.P),t=e.root));t.C=L7}function X7(e){for(;e.L!==U7;)e=e.L;return e}function Z7(e,t){let n;for(;t.P.C===I7;)t.P===t.P.P.L?(n=t.P.P.R,n.C===I7?(t.P.C=L7,n.C=L7,t.P.P.C=I7,t=t.P.P):(t===t.P.R&&(t=t.P,K7(e,t)),t.P.C=L7,t.P.P.C=I7,q7(e,t.P.P))):(n=t.P.P.L,n.C===I7?(t.P.C=L7,n.C=L7,t.P.P.C=I7,t=t.P.P):(t===t.P.L&&(t=t.P,q7(e,t)),t.P.C=L7,t.P.P.C=I7,K7(e,t.P.P)));e.root.C=L7}function Q7(){let e={root:U7,size:0},t={};return{insert(n,r,i){let a=e.root,o=U7;for(;a!==U7&&(o=a,n!==o.low);)a=n<a.low?a.L:a.R;if(n===o.low&&o!==U7){if(!V7(o,r,i))return;o.high=Math.max(o.high,r),W7(o),G7(o),t[i]=o,e.size++;return}let s={low:n,high:r,max:r,C:I7,P:o,L:U7,R:U7,list:{index:i,high:r,next:null}};o===U7?e.root=s:(s.low<o.low?o.L=s:o.R=s,G7(s)),Z7(e,s),t[i]=s,e.size++},remove(n){let r=t[n];if(r===void 0)return;delete t[n];let i=H7(r,n);if(i===void 0)return;if(i===B7){r.high=r.list.high,W7(r),G7(r),e.size--;return}let a=r,o=a.C,s;r.L===U7?(s=r.R,J7(e,r,r.R)):r.R===U7?(s=r.L,J7(e,r,r.L)):(a=X7(r.R),o=a.C,s=a.R,a.P===r?s.P=a:(J7(e,a,a.R),a.R=r.R,a.R.P=a),J7(e,r,a),a.L=r.L,a.L.P=a,a.C=r.C),W7(s),G7(s),o===L7&&Y7(e,s),e.size--},search(t,n,r){let i=[e.root];for(;i.length!==0;){let e=i.pop();if(!(e===U7||t>e.max)&&(e.L!==U7&&i.push(e.L),e.R!==U7&&i.push(e.R),e.low<=n&&e.high>=t)){let n=e.list;for(;n!==null;)n.high>=t&&r(n.index,e.low),n=n.next}}},get size(){return e.size}}}var $7=e=>{let t=G.useRef(e);return G.useEffect(()=>{t.current=e}),t},e9=(e,t)=>{let n=t||t9,r,i;return function(){return r&&n(arguments,r)?i:i=e.apply(null,r=arguments)}},t9=(e,t)=>e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3],n9=class{constructor(){this.set=void 0,this.get=void 0;let e,t;this.get=n=>n===e?t:void 0,this.set=(n,r)=>{e=n,t=r}}},r9=e=>{try{return new e}catch{let e={};return{set(t,n){e[t]=n},get(t){return e[t]}}}},i9=e=>{let t=e.length,n=r9(e[0]),r,i,a,o,s=t===1;return t<3?{g:e=>(r=n.get(e[0]))===void 0||s?r:r.get(e[1]),s:(t,a)=>(s?n.set(t[0],a):(r=n.get(t[0]))===void 0?(i=r9(e[1]),i.set(t[1],a),n.set(t[0],i)):r.set(t[1],a),a)}:{g:e=>{for(o=n,a=0;a<t;a++)if((o=o.get(e[a]))===void 0)return;return o},s:(r,s)=>{for(o=n,a=0;a<t-1;a++)(i=o.get(r[a]))===void 0?(i=r9(e[a+1]),o.set(r[a],i),o=i):o=i;return o.set(r[t-1],s),s}}},a9=(e,t)=>{let n,{g:r,s:i}=i9(e);return function(){return(n=r(arguments))===void 0?i(arguments,t.apply(null,arguments)):n}},o9=new WeakMap;function s9(){let e=G.useState(c9)[1];return G.useRef(()=>e({})).current}var c9={},l9=G.createElement;function u9(e){let{positioner:t,resizeObserver:n,items:r,as:i=`div`,id:a,className:o,style:s,role:c=`grid`,tabIndex:l=0,containerRef:u,itemAs:d=`div`,itemStyle:f,itemHeightEstimate:p=300,itemKey:m=g9,overscanBy:h=2,scrollTop:g,isScrolling:_,height:v,render:y,onRender:b}=e,x=0,S,C=s9(),w=v9(t,n),T=r.length,{columnWidth:E,columnCount:D,range:O,estimateHeight:k,size:A,shortestColumn:j}=t,M=A(),N=j(),P=[],F=c===`list`?`listitem`:c===`grid`?`gridcell`:void 0,I=$7(b);h=v*h;let L=g+h,R=N<L&&M<T;if(O(Math.max(0,g-h/2),L,(e,t,n)=>{let i=r[e],a=m(i,e),o={top:n,left:t,width:E,writingMode:`horizontal-tb`,position:`absolute`};P.push(l9(d,{key:a,ref:w(e),role:F,style:typeof f==`object`&&f?Object.assign({},o,f):o},f9(y,e,i,E))),S===void 0?(x=e,S=e):(x=Math.min(x,e),S=Math.max(S,e))}),R){let e=Math.min(T-M,Math.ceil((g+h-N)/p*D)),t=M,n=_9(E);for(;t<M+e;t++){let e=r[t],i=m(e,t);P.push(l9(d,{key:i,ref:w(t),role:F,style:typeof f==`object`?Object.assign({},n,f):n},f9(y,t,e,E)))}}G.useEffect(()=>{typeof I.current==`function`&&S!==void 0&&I.current(x,S,r),d9=`1`},[x,S,r,I]),G.useEffect(()=>{R&&C()},[R,t]);let z=p9(_,k(T,p));return l9(i,{ref:u,key:d9,id:a,role:c,className:o,tabIndex:l,style:typeof s==`object`?h9(z,s):z,children:P})}var d9=`0`,f9=a9([n9,{},WeakMap,n9],(e,t,n,r)=>l9(e,{index:t,data:n,width:r})),p9=e9((e,t)=>({position:`relative`,width:`100%`,maxWidth:`100%`,height:Math.ceil(t),maxHeight:Math.ceil(t),willChange:e?`contents`:void 0,pointerEvents:e?`none`:void 0})),m9=(e,t)=>e[0]===t[0]&&e[1]===t[1],h9=e9((e,t)=>Object.assign({},e,t),m9);function g9(e,t){return t}var _9=e9(e=>({width:e,zIndex:-1e3,visibility:`hidden`,position:`absolute`,writingMode:`horizontal-tb`}),(e,t)=>e[0]===t[0]),v9=e9((e,t)=>n=>r=>{r!==null&&(t&&(t.observe(r),o9.set(r,n)),e.get(n)===void 0&&e.set(n,r.offsetHeight))},m9),y9=function(e,t,n,r){n===void 0&&(n=0),r===void 0&&(r=n);let i=Q7(),a=Array(e),o=[],s=Array(e);for(let t=0;t<e;t++)a[t]=0,s[t]=[];return{columnCount:e,columnWidth:t,set:function(e,c){c===void 0&&(c=0);let l=0;for(let e=1;e<a.length;e++)a[e]<a[l]&&(l=e);let u=a[l]||0;a[l]=u+c+r,s[l].push(e),o[e]={left:l*(t+n),top:u,height:c,column:l},i.insert(u,u+c,e)},get:e=>o[e],update:t=>{let n=Array(e),c=0,l=0;for(;c<t.length-1;c++){let e=t[c],r=o[e];r.height=t[++c],i.remove(e),i.insert(r.top,r.top+r.height,e),n[r.column]=n[r.column]===void 0?e:Math.min(e,n[r.column])}for(c=0;c<n.length;c++){if(n[c]===void 0)continue;let e=s[c],t=b9(e,n[c]),u=s[c][t],d=o[u];for(a[c]=d.top+d.height+r,l=t+1;l<e.length;l++){let t=e[l],n=o[t];n.top=a[c],a[c]=n.top+n.height+r,i.remove(t),i.insert(n.top,n.top+n.height,t)}}},range:(e,t,n)=>i.search(e,t,(e,t)=>n(e,o[e].left,t)),estimateHeight:(t,n)=>{let r=Math.max(0,Math.max.apply(null,a));return t===i.size?r:r+Math.ceil((t-i.size)/e)*n},shortestColumn:()=>a.length>1?Math.min.apply(null,a):a[0]||0,size(){return i.size},all(){return o}}},b9=(e,t)=>{let n=0,r=e.length-1;for(;n<=r;){let i=n+r>>>1,a=e[i];if(a===t)return i;a<=t?n=i+1:r=i-1}return-1},x9={queued:`Waiting to start`,generating:`Generating`,refining:`Refining`,done:void 0,failed:void 0},S9=(0,G.forwardRef)(function({status:e,children:t,aspectRatio:n,label:r,indicator:i,failure:a,className:o,style:s,...c},l){let u=(0,G.useRef)(null);(0,G.useImperativeHandle)(l,()=>u.current);let d=(0,G.useRef)(e),[f,p]=(0,G.useState)(!1),[m,h]=(0,G.useState)(e);m!==e&&(h(e),p(e===`done`)),(0,G.useLayoutEffect)(()=>{let t=u.current,n=d.current;if(d.current=e,!t||n===e)return;if(!JR(t)){p(!1);return}let r=BR(t),i=qR(r,r.ease),a=[],o=t.querySelector(`:scope > [data-layer="media"]`),s=t.querySelector(`:scope > [data-layer="placeholder"]`),c=t.querySelector(`:scope > [data-layer="failure"]`);if(e===`done`&&o){let e=o.animate(r.reduced?[{opacity:0},{opacity:1}]:[{opacity:0,filter:`blur(10px)`,transform:`scale(1.03)`},{opacity:1,filter:`blur(0px)`,transform:`none`}],{duration:r.reduced?r.fast:r.slow*2,easing:i,fill:`backwards`});e.addEventListener(`finish`,()=>{p(!1)}),a.push(e),s&&a.push(s.animate([{opacity:1},{opacity:0}],{duration:r.reduced?r.fast:r.slow,easing:i,fill:`forwards`}))}return e===`failed`&&c&&a.push(c.animate([{opacity:0,transform:`translateY(${String(r.distance)}px)`},{opacity:1,transform:`none`}],{duration:r.normal,easing:i})),n===`failed`&&s&&a.push(s.animate([{opacity:.4},{opacity:1}],{duration:r.normal,easing:i})),()=>{for(let e of a)e.cancel()}},[e]);let g=e===`queued`||e===`generating`||e===`refining`,_=r??x9[e],v=e===`done`||e===`refining`;return(0,Z.jsxs)(`div`,{...c,ref:u,className:Q(`caps-generation-frame`,o),"data-status":e,"data-aspect":n===void 0?void 0:``,"aria-busy":g,style:n===void 0?s:{aspectRatio:n,...s},children:[e===`done`&&!f?null:(0,Z.jsxs)(`div`,{className:Q(`caps-generation-placeholder`,e===`queued`&&`skeleton`),"data-layer":`placeholder`,role:e===`done`?void 0:`status`,"aria-hidden":e===`done`||void 0,children:[e===`generating`||e===`refining`||e===`done`?i??(0,Z.jsx)(lH,{decorative:!0,size:`lg`,variant:`bloom`}):null,_===void 0?null:(0,Z.jsx)(LR,{children:_})]}),v?(0,Z.jsx)(`div`,{className:`caps-generation-media`,"data-layer":`media`,children:t}):null,e===`failed`&&a!==void 0?(0,Z.jsx)(`div`,{className:`caps-generation-failure`,"data-layer":`failure`,role:`alert`,children:a}):null]})}),C9=null;function w9(e,t){let n=(0,G.useRef)(null),r=(0,G.useRef)(t);r.current=t;let[i,a]=(0,G.useState)(!1),[o,s]=(0,G.useState)(0);(0,G.useEffect)(()=>()=>{let e=n.current;e!==null&&(e.pause(),C9===e&&(C9=null),n.current=null)},[e]),(0,G.useEffect)(()=>{if(!i)return;let e=0,t=()=>{let r=n.current;r!==null&&r.duration>0&&s(Math.min(1,r.currentTime/r.duration)),e=requestAnimationFrame(t)};return e=requestAnimationFrame(t),()=>{cancelAnimationFrame(e)}},[i]);let c=(0,G.useCallback)(()=>{if(n.current!==null)return n.current;let t=new Audio(e);return t.preload=`auto`,t.addEventListener(`ended`,()=>{a(!1),s(0),C9===t&&(C9=null)}),t.addEventListener(`pause`,()=>{a(!1)}),t.addEventListener(`error`,()=>{a(!1),r.current(`This audio could not be played.`)}),n.current=t,t},[e]);return{playing:i,progress:o,toggle:(0,G.useCallback)(()=>{let e=c();if(!e.paused){e.pause();return}C9!==null&&C9!==e&&C9.pause(),C9=e,a(!0),e.play().catch(e=>{oW(`play-audio`,e),a(!1),r.current(`This audio could not be played.`)})},[c]),seek:(0,G.useCallback)(e=>{let t=c();Number.isFinite(t.duration)&&t.duration>0&&(t.currentTime=Math.min(1,Math.max(0,e))*t.duration,s(Math.min(1,Math.max(0,e))))},[c])}}function T9({url:e,progress:t=0,bars:n=64,className:r}){let i=s7(e,n),a=i.status===`ready`?i.peaks:null;return(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:Q(`prints-waveform`,r),"data-waveform":i.status,children:Array.from({length:n},(e,r)=>(0,Z.jsx)(`span`,{className:`prints-waveform-bar`,"data-played":r/n<t?``:void 0,style:{height:`max(2px, ${String((a?.[r]??0)*100)}%)`}},r))})}var E9=(0,G.createContext)(null);function D9(){let e=(0,G.useContext)(E9);if(e===null)throw Error(`An audio tile part must sit inside an AudioTileScope`);return e}function O9({url:e,children:t}){let n=w9(e,IH);return(0,Z.jsx)(E9.Provider,{value:n,children:t})}function k9({url:e}){let{progress:t}=D9();return(0,Z.jsx)(`span`,{className:`prints-audio-tile`,children:(0,Z.jsx)(T9,{progress:t,url:e})})}function A9({title:e}){let t=D9();return(0,Z.jsx)(LJ,{"aria-label":`${t.playing?`Pause`:`Play`} ${e}`,className:`prints-audio-tile-play`,icon:t.playing?(0,Z.jsx)(KI,{}):(0,Z.jsx)(qI,{}),iconSize:`sm`,size:`sm`,variant:`accent`,onClick:t.toggle})}var j9=8,M9=320,N9=4,P9=640,F9=656;function bee(e,t){return e<=0||!Number.isFinite(t)||t<=0?0:e===1?1:e<=N9?t<P9?1:e===2||t<F9?2:3:t>=1280?4:t>=F9?3:2}function I9({item:e}){return NH(e.path)?(0,Z.jsx)(k9,{url:e.url}):LH(e.path)?(0,Z.jsx)(`video`,{"aria-label":e.path,className:`block h-full w-full object-cover`,"data-media-thumb":!0,loop:!0,muted:!0,playsInline:!0,src:e.url}):(0,Z.jsx)(`img`,{alt:e.path,className:`block h-full w-full object-cover`,"data-media-thumb":!0,src:e.url})}var L9=(0,G.memo)(function({item:e}){let t=(0,G.useRef)(null);(0,G.useEffect)(()=>{e.onVisible?.()},[e.onVisible]);let[n,r]=(0,G.useState)(e.pending===!0&&!e.onVisible);return e.pending&&!e.onVisible&&!n&&r(!0),(0,G.useLayoutEffect)(()=>{let r=t.current;if(!r||e.pending||n)return;let i=window.matchMedia(`(prefers-reduced-motion: reduce)`);if(i.matches)return;let a=!0,o,s,c=()=>o?.();return R1(async()=>{let{animate:e,spring:t}=await Promise.resolve().then(()=>JV);return{animate:e,spring:t}},void 0,import.meta.url).then(({animate:e,spring:t})=>{if(!a)return;let n=e(r,{opacity:{from:0,to:1,duration:160,ease:`outQuad`},translateY:{from:6,to:0,ease:t({bounce:.16,duration:320})},scale:{from:.985,to:1,ease:t({bounce:.16,duration:320})}});o=()=>{n.complete()},s=()=>{n.revert()}}),i.addEventListener(`change`,c),()=>{a=!1,i.removeEventListener(`change`,c),s?.()}},[e.key,e.pending,n]),(0,Z.jsxs)(`div`,{ref:t,className:`prints-gallery-tile`,"data-referenced":e.referenced?!0:void 0,children:[e.error?(0,Z.jsx)(`div`,{className:`block h-full w-full overflow-hidden bg-base-200`,"data-media-failed":!0,title:e.path,children:(0,Z.jsx)(S9,{status:`failed`,failure:(0,Z.jsxs)(`div`,{className:`flex max-w-full flex-col items-center gap-xs`,children:[e.prompt?(0,Z.jsx)(`p`,{className:`m-0 max-w-full truncate px-md text-xs text-(--stipe-fg-muted)`,children:e.prompt}):null,(0,Z.jsx)(G1,{density:`tile`,message:e.error,onRetry:e.onRetry,onDismiss:e.onDismiss})]})})}):(0,Z.jsx)(`button`,{className:`block h-full w-full overflow-hidden bg-base-200 p-0 text-left`,"data-media-thumb-wrap":!0,type:`button`,disabled:e.pending,"aria-pressed":e.select?.active?e.select.checked:void 0,onClick:()=>{e.select?.active?e.select.onToggle():e.onOpen(e.path)},onKeyDown:t=>{t.key.toLowerCase()===`i`&&!t.ctrlKey&&!t.metaKey&&!t.altKey&&e.onInfo&&(t.preventDefault(),e.onInfo())},title:e.path,children:(0,Z.jsx)(`div`,{className:`caps-item block! h-full w-full overflow-hidden rounded-none! border-0! bg-transparent! shadow-none! z-auto! -outline-offset-2!`,"data-selected":e.selected??!1,children:e.pending||n?(0,Z.jsx)(S9,{"data-media-pending":e.pending?`true`:void 0,indicator:(0,Z.jsx)(`div`,{className:`prints-pending-loader`,"data-run":e.pending&&(e.prompt||e.onStop)?``:void 0,children:(0,Z.jsx)(lH,{decorative:!0,size:`fill`,tone:`accent`,variant:`bloom`})}),label:e.pendingLabel??`Preparing image…`,status:e.pending?`generating`:`done`,children:e.pending?null:(0,Z.jsx)(I9,{item:e})}):(0,Z.jsx)(I9,{item:e})})}),e.pending&&!e.error&&(e.prompt||e.onStop)?(0,Z.jsxs)(`div`,{className:`prints-tile-run`,"data-media-run":!0,children:[e.prompt?(0,Z.jsx)(`p`,{className:`prints-tile-caption`,"data-media-caption":!0,children:e.prompt}):null,e.onStop?(0,Z.jsx)(LJ,{"aria-label":`Stop`,title:`Stop`,size:`sm`,variant:`outline`,iconSize:`sm`,className:`prints-tile-stop`,onClick:e.onStop,icon:(0,Z.jsx)(XI,{fill:`currentColor`})}):null]}):null,!e.pending&&!e.error?(0,Z.jsx)(Cee,{item:e}):null,(0,Z.jsxs)(`div`,{className:`prints-gallery-tools`,children:[!e.pending&&!e.error?(0,Z.jsx)(wee,{item:e}):null,!e.pending&&e.onInfo?(0,Z.jsx)(LJ,{className:`prints-gallery-secondary`,"aria-label":`Image info: ${e.path}`,title:`Image info (I)`,"aria-keyshortcuts":`I`,onClick:e.onInfo,icon:(0,Z.jsx)(HI,{})}):null,!e.pending&&e.onToggleReference?(0,Z.jsx)(LJ,{className:`prints-gallery-reference prints-gallery-secondary`,"aria-label":`${e.referenced?`Remove reference`:`Add reference`}: ${e.path}`,title:e.referenced?`Remove reference`:`Add reference`,"aria-pressed":e.referenced??!1,disabled:e.referenceDisabled,onClick:e.onToggleReference,icon:e.referenced?(0,Z.jsx)(AI,{}):(0,Z.jsx)(BI,{})}):null]})]})}),xee=(0,G.memo)(function({item:e}){return NH(e.path)?(0,Z.jsx)(O9,{url:e.url,children:(0,Z.jsx)(L9,{item:e})}):(0,Z.jsx)(L9,{item:e})}),See=e=>`${String(e)}s`;function Cee({item:e}){let{select:t}=e;return(0,Z.jsxs)(Z.Fragment,{children:[NH(e.path)&&e.url!==``?(0,Z.jsx)(A9,{title:e.path}):null,(0,Z.jsx)(`div`,{className:`prints-tile-mark`,"data-checked":t?.active?t.checked:void 0,"data-favorite":e.favorite?!0:void 0,children:t?.active?(0,Z.jsx)(F6,{appearance:`compact`,"aria-label":`Select ${e.path}`,checked:t.checked,onChange:t.onToggle}):e.onToggleFavorite?(0,Z.jsx)(LJ,{"aria-label":`${e.favorite?`Unfavorite`:`Favorite`}: ${e.path}`,"aria-pressed":e.favorite??!1,className:`prints-tile-heart`,icon:(0,Z.jsx)(zI,{fill:e.favorite?`currentColor`:`none`}),onClick:e.onToggleFavorite,title:e.favorite?`Remove from favorites`:`Favorite`}):null}),e.badge?(0,Z.jsx)(`div`,{className:`prints-tile-badge`,"data-media-badge":!0,children:e.badge.label===null?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(ZI,{"aria-hidden":!0,size:12}),(0,Z.jsx)(`span`,{children:`Upload`})]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`span`,{className:`prints-tile-badge-model`,children:e.badge.label}),e.badge.seconds===null?null:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(NI,{"aria-hidden":!0,size:12}),(0,Z.jsx)(`span`,{children:See(e.badge.seconds)})]})]})}):null,e.folderCaption?(0,Z.jsx)(`div`,{className:`prints-tile-folder`,title:e.folderCaption,children:e.folderCaption}):null]})}function wee({item:e}){return!e.onMove||e.select?.active?null:(0,Z.jsxs)(V5,{children:[(0,Z.jsx)(U5,{render:(0,Z.jsx)(LJ,{"aria-label":`More actions: ${e.path}`,title:`More actions`,icon:(0,Z.jsx)(FI,{})})}),(0,Z.jsxs)(q5,{children:[(0,Z.jsxs)(Y5,{onSelect:e.onMove,children:[(0,Z.jsx)(II,{"aria-hidden":!0,size:16}),` Move to…`]}),e.onToggleFavorite?(0,Z.jsxs)(Y5,{onSelect:e.onToggleFavorite,children:[(0,Z.jsx)(zI,{"aria-hidden":!0,size:16}),` `,e.favorite?`Remove from favorites`:`Favorite`]}):null,e.onInfo?(0,Z.jsxs)(Y5,{onSelect:e.onInfo,children:[(0,Z.jsx)(HI,{"aria-hidden":!0,size:16}),` Image info`]}):null,e.onToggleReference?(0,Z.jsxs)(Y5,{disabled:e.referenceDisabled,onSelect:e.onToggleReference,children:[e.referenced?(0,Z.jsx)(AI,{"aria-hidden":!0,size:16}):(0,Z.jsx)(BI,{"aria-hidden":!0,size:16}),` `,e.referenced?`Remove reference`:`Add reference`]}):null]})]})}var Tee=(0,G.memo)(function({children:e,style:t,...n}){return(0,Z.jsx)(`div`,{"data-media-grid":!0,...n,style:t,children:e})});function Eee(e,t){let[n,r]=(0,G.useState)({height:0,width:0});return(0,G.useEffect)(()=>{let t=e.current;if(!t)return;let n=()=>{r(e=>{let n={height:t.clientHeight,width:t.clientWidth};return n.width===e.width&&n.height===e.height?e:n})};n();let i=new ResizeObserver(n);return i.observe(t),window.addEventListener(`resize`,n),()=>{i.disconnect(),window.removeEventListener(`resize`,n)}},[e,t]),n}function Dee(e){let[t,n]=(0,G.useState)(0),[r,i]=(0,G.useState)(!1);return(0,G.useEffect)(()=>{let t=e.current;if(!t)return;let r=null,a=()=>{n(t.scrollTop),i(!0),r!==null&&clearTimeout(r),r=setTimeout(()=>{i(!1)},150)};return t.addEventListener(`scroll`,a,{passive:!0}),()=>{t.removeEventListener(`scroll`,a),r!==null&&clearTimeout(r)}},[e]),{isScrolling:r,scrollTop:t}}function R9(e,t){let n=t.height>0?t.width/t.height:1;return Math.round(e/n)}function z9(e,t,n,r){let i=Math.floor((t-(n-1)*j9)/n),a=e.length===1?e[0]:void 0;if(!a||r<=0)return i;let o=a.height>0?a.width/a.height:1;return Math.max(1,Math.min(i,Math.floor(r*o)))}function Oee(e,t,n){let r=e.some(e=>e.select!==void 0),i=Math.max(1,bee(e.length,t),r&&e.length>=2?2:1),a=t-16,o=n-16;return(0,G.useMemo)(()=>{let t=z9(e,a,i,o),n=y9(i,t,j9);return t>0&&e.forEach((e,r)=>{n.set(r,R9(t,e))}),n},[e,a,i,o])}var kee=132,Aee=(0,G.memo)(function({data:e,width:t}){let n=R9(t,e);return(0,Z.jsx)(`div`,{"data-media-tile":e.key,"data-short":n<kee?``:void 0,style:{height:n,width:t},children:(0,Z.jsx)(xee,{item:e})})});function B9(e,t){let n=Array.from(e.querySelectorAll(`[data-media-tile]`)).find(e=>e.dataset.mediaTile===t)?.querySelector(`[data-media-thumb-wrap]`);return!n||n.disabled?!1:(n.focus({preventScroll:!0}),!0)}function jee(e,t,n){let r=e.ownerDocument;(r.activeElement!==r.body||B9(e,t))&&n()}function Mee(e,t,n){let r=n.top+t.getBoundingClientRect().top-e.getBoundingClientRect().top+e.scrollTop;return(r<e.scrollTop||r+n.height>e.scrollTop+e.clientHeight)&&e.scrollTo({top:r,behavior:`instant`}),r}var Nee=(0,G.memo)(function({items:e,scrollRef:t,focus:n}){let r=Eee(t,e.length),i=r.width||M9,a=e.length===1&&r.height>0,o=i-16,s=r.height-16,c=Oee(e,i,r.height),{isScrolling:l,scrollTop:u}=Dee(t),d=(0,G.useRef)(new Set),f=(0,G.useRef)(null),p=(0,G.useRef)(null);(0,G.useEffect)(()=>{if(!n)return;let a=f.current===n.requestId;if(a&&p.current===i)return;let o=t.current,s=e.findIndex(e=>e.key===n.key),l=c.get(s);if(!o||!l||r.height===0)return;let u=o.querySelector(`[data-media-grid]`);if(!u)return;let d=Mee(o,u,l);if(a){jee(o,n.key,()=>{p.current=i});return}B9(o,n.key)?(f.current=n.requestId,p.current=i,n.onFocus()):o.scrollTo({top:d,behavior:`instant`})},[n,e,r.height,t,u,c,i]),(0,G.useEffect)(()=>{let n=t.current;if(!n||r.width===0||r.height===0)return;let i=e.findIndex(e=>e.pending&&!e.onVisible&&!d.current.has(e.key));if(d.current=new Set(e.map(e=>e.key)),i<0)return;let a=c.get(i),o=n.querySelector(`[data-media-grid]`);if(!a||!o)return;let s=o.getBoundingClientRect().top-n.getBoundingClientRect().top+n.scrollTop,l=i===0?0:s+a.top,u=l+a.height;l>=n.scrollTop&&u<=n.scrollTop+n.clientHeight||n.scrollTo({top:Math.max(0,l-j9),behavior:window.matchMedia(`(prefers-reduced-motion: reduce)`).matches?`instant`:`smooth`})},[e,r.width,r.height,t,c]);let m=(0,G.useCallback)(({data:e,width:t})=>(0,Z.jsx)(Aee,{data:e,width:t}),[]),h=u9({as:Tee,height:r.height,isScrolling:l,itemKey:e=>e.key,items:e,overscanBy:2,positioner:c,render:m,scrollTop:u});return(0,Z.jsx)(`div`,{"data-media-sole":a?``:void 0,style:{boxSizing:`border-box`,padding:j9,...a?{display:`flex`,alignItems:`center`,justifyContent:`center`,minHeight:r.height}:void 0},children:(0,Z.jsx)(`div`,{style:{width:a?z9(e,o,1,s):`100%`},children:h})})});function Pee({items:e,scrollRef:t,focus:n}){return(0,Z.jsx)(`section`,{"data-media-mosaic":!0,children:(0,Z.jsx)(Nee,{items:e,scrollRef:t,focus:n})})}function Fee(e,t,n){let r=new Map(e.map(e=>[e.key,e])),i=new Set(t.map(e=>e.key));return[...[...t].reverse().filter(e=>!e.resolved||r.has(e.key)).map(e=>{let t=r.get(e.key);return t&&e.resolved?t:n(e)}),...e.filter(e=>!i.has(e.key))]}var V9=`prints-prompt-counter`;function Iee({busy:e,disabled:t,disabledReason:n,draft:r,label:i,onGenerate:a,promptOver:o}){return(0,Z.jsx)(h6,{"aria-describedby":o?V9:void 0,"aria-label":i,className:`prints-generate`,"data-generation-submit":!0,disabled:t||o,onClick:a,state:G6({draft:r,busy:e}),title:(t||o)&&n?n:i})}function H9({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 Lee=.8;function Ree(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 zee({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,G.useRef)(null),x=(0,G.useRef)(y),[S,C]=(0,G.useState)([]),[w,T]=(0,G.useState)(-1),[E,D]=(0,G.useState)(!1),O=(0,G.useRef)(!1),k=(0,G.useRef)(!1);x.current=y,(0,G.useLayoutEffect)(()=>{if(E||i||!k.current)return;k.current=!1;let e=b.current;e&&e.ownerDocument.activeElement===e.ownerDocument.body&&e.focus({preventScroll:!0})},[i,E]),(0,G.useLayoutEffect)(()=>{let t=b.current;!t||e?.value!==y||(t.setSelectionRange(e.caret,e.caret),t.focus({preventScroll:!0}))},[e,y]);let{cap:A,collapsed:j,fullscreen:M}=t;(0,G.useLayoutEffect)(()=>{let e=b.current;if(!e)return;if(M){e.style.height=``,n(!1);return}e.style.height=`auto`;let t=e.scrollHeight;e.style.height=`${String(j?Ree(e):Math.min(t,A))}px`,n(!j&&t>A+1),j&&(e.scrollTop=0),j&&t>e.clientHeight+1?e.setAttribute(`data-clipped`,``):e.removeAttribute(`data-clipped`)},[y,A,j,M,n]),(0,G.useLayoutEffect)(()=>{let e=b.current;!e||!M||(e.setSelectionRange(e.value.length,e.value.length),e.scrollTop=e.scrollHeight)},[M]);let N=(0,G.useCallback)(async()=>{let e=x.current.trim();if(!(!e||i||O.current)){if(a!==void 0&&e.length+o>a){r(H9({addedLength:o,length:e.length+o,maxLength:a}));return}k.current=b.current===b.current?.ownerDocument.activeElement,O.current=!0,D(!0);try{if(!await m())return;C(t=>t.at(-1)===e?t:[...t,e].slice(-20)),T(-1)}finally{O.current=!1,D(!1)}}},[i,a,r,m,o]),P=y.trim().length,F=P>0?P+o:0,I=a!==void 0&&F>a,L=a!==void 0&&F>=Math.floor(a*Lee);return(0,Z.jsxs)(`div`,{className:`relative min-w-0 flex-1`,children:[(0,Z.jsx)(D6,{"aria-invalid":I?!0:void 0,"aria-label":`Prompt`,className:`w-full`,"data-generation-prompt":!0,"data-counting":L?``:void 0,...A6(s),disabled:i===!0||E,onChange:e=>{u(e.currentTarget.value),l(e.currentTarget.selectionStart),T(-1)},onScroll:e=>{j&&(e.currentTarget.scrollTop=0)},onSelect:e=>{l(e.currentTarget.selectionStart)},onKeyDown:e=>{if(u6(e))return;let t=k6(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(),N();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:M?void 0:A},rows:1,value:y}),L?(0,Z.jsxs)(`p`,{className:`prints-prompt-counter ${I?`text-error`:`text-dim`}`,"data-prompt-counter":!0,id:V9,role:`status`,title:I?H9({addedLength:o,length:F,maxLength:a}):void 0,children:[`${String(F)} / ${String(a)}`,I?(0,Z.jsxs)(`span`,{className:`sr-only`,children:[` `,H9({addedLength:o,length:F,maxLength:a})]}):null]}):null]})}function Bee({index:e,listId:t,matches:n,onHighlight:r,onPick:i}){return(0,Z.jsx)(j6,{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 Vee(e,t){let[n,r]=(0,G.useState)(0),i=t.startsWith(`/`),a=(0,G.useMemo)(()=>{if(!i)return[];let n=W1(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,G.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 Hee({images:e,index:t,listId:n,matches:r,onHighlight:i,onPick:a}){return(0,Z.jsx)(j6,{open:!0,rows:r.map(t=>{if(t.kind===`reference`)return{key:qG(t.reference.number),label:`@${qG(t.reference.number)}`,detail:t.reference.name,media:(0,Z.jsx)(`span`,{className:`prints-character-thumb mask mask-squircle`,children:t.reference.url?(0,Z.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,Z.jsx)(`span`,{className:`prints-character-thumb mask mask-squircle`,children:i?(0,Z.jsx)(`img`,{src:i.url,alt:``}):null})}}),selected:t,listId:n,label:`References and characters`,kind:`characters`,onHighlight:i,onChoose:a})}var Uee=e=>e.kind===`reference`?qG(e.reference.number):e.character.name;function U9(e,t,n,r){return dK(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 W9({tokens:e}){return e.length===0?null:(0,Z.jsx)(`ul`,{className:`prints-mention-tokens`,"aria-label":`Mentioned in the prompt`,children:e.map(e=>(0,Z.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,Z.jsx)(`span`,{className:`prints-mention-thumb mask mask-squircle`,children:e.url?(0,Z.jsx)(`img`,{src:e.url,alt:``}):null}),(0,Z.jsx)(`span`,{children:e.label}),e.valid?null:(0,Z.jsx)(`span`,{children:` · not attached`})]},e.key))})}function Wee(e,t,n){let[r,i]=(0,G.useState)(0),[a,o]=(0,G.useState)(0),[s,c]=(0,G.useState)(null),[l,u]=(0,G.useState)(null),d=s===n?null:vK(n,r),f=d?yK(e,t,d.query):[];return(0,G.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=Uee(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 Gee(e,t,n){let[r,i]=(0,G.useState)(XG),a=e.map(e=>YG(e,n)),o=ZG(r,a,t);return o!==r&&i(o),QG(o,a)}var Kee=400;function qee(e){let{draft:t,model:n}=e;if(n===void 0||t.prompt.trim()===``)return null;let r=JG(t.prompt).length>0,i=n.kind===`audio`?gK(t.prompt):_K({prompt:t.prompt,saved:e.characters,references:t.references,labels:e.labels,wording:e=>$G(oG(e,n,r),n),computerId:e.computerId,model:{label:n.label,maxReferences:n.input.maxReferences}});if(i.kind===`refused`)return null;let a=oG(i.references,n,r),o={...t,prompt:RG(n.kind===`audio`?void 0:e.styleText,i.prompt),references:a};return dG(o,n)!==void 0||n.video!==null&&!n.video.formats.some(e=>e.width===o.width&&e.height===o.height)?null:cG(o,n).settings}function Jee(e,t){let n=e===null?null:JSON.stringify(e),r=(0,G.useRef)(e);r.current=e;let[i,a]=(0,G.useState)({key:n,settings:e});return(0,G.useEffect)(()=>{let e=setTimeout(()=>{a({key:n,settings:r.current})},t);return()=>{clearTimeout(e)}},[n,t]),i}function Yee(e,t){return Ww({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 G9(e,t){let n=t===null?null:JSON.stringify(t),r=Jee(t,Kee),i=Uw(Yee(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:S7(i.data.costMilliunits)}}function Xee(e,t){let n=G9(e,t);return n.state===`ready`?n.price:null}function Zee(e){let t=vC(),n=Uw(jK(e)),r=n=>({mutationFn:t=>{let r=e?.context.get().computerId;if(!e||!r)throw Error(`No Computer selected`);return n(e,r,t)},onSuccess:n=>{t.setQueryData(TK.characters(e),n)}}),i=Jw(r((e,t,n)=>CK(e.capabilities,t,n))),a=Jw(r((e,t,n)=>wK(e.capabilities,t,n)));return{characters:n.data?.characters??[],error:n.error?lC(n.error).message:null,busy:i.isPending||a.isPending,save:(e,t)=>{i.mutate(e,{onError:()=>{A$(`The character could not be saved. Try again.`,`prints-character-save`)},onSuccess:t})},remove:(e,t)=>{a.mutate(e,{onSuccess:t,onError:()=>{A$(`The character could not be deleted. Try again.`,`prints-character-delete`)}})}}}var K9=J({destination:Yx(lS(eS)),height:Yx(jS),model:Yx(eS),prompt:Yx(eS),references:Yx(aS(J({computerId:Yx(eS),path:eS,role:Yx(cS([`first-frame`,`last-frame`,`reference`]))}))),generateAudio:Yx(lS(nS)),steps:Yx(lS(jS)),style:Yx(lS(eS)),width:Yx(jS)}),Qee=fo(U(),Jo()).parse(structuredClone(WS(K9,{onExcessProperty:`error`}).schema)),q9=(e,t,n,r)=>({id:e,title:t,category:`Image generation`,description:n,projections:{agent:{}},action:r===void 0?{presentation:{type:`action`}}:{inputSchema:r,presentation:{type:`action`}}}),$ee=q9(`inspect-generation-draft`,`Inspect image draft`,`Read the current Prints image form and available models`),ete=q9(`set-generation-draft`,`Edit image draft`,`Set selected Prints image form fields; this does not generate an image`,Qee),J9=q9(`submit-generation-draft`,`Generate image`,`Submit the current Prints image form using the same action as the Send button`);function tte(e,t){let n=!1,r=new Set,i=(t,i)=>{e.commands.register(t,i).then(e=>{n?e():r.add(e)},()=>void 0)};return i($ee,()=>{if(n)return;let e=t.readDraft();return{draft:{destination:e.destination??null,height:e.height,model:e.model,prompt:e.prompt,generateAudio:e.generateAudio??null,references:e.references.map(e=>{let t={path:e.path,role:e.role??null};return e.computerId===void 0?t:{...t,computerId:e.computerId}}),steps:e.steps??null,style:e.style??null,width:e.width},models:t.readModels().map(e=>({id:e.id,label:e.label,defaultHeight:e.input.defaultHeight,defaultWidth:e.input.defaultWidth,maxReferences:e.input.maxReferences}))}}),i(ete,({arguments:e})=>{if(n)return;let r=qx(K9,{onExcessProperty:`error`})(e);t.setDraft(r)}),i(J9,async()=>{if(!n)return{accepted:await t.submit()}}),()=>{if(!n){n=!0;for(let e of r)e();r.clear()}}}function nte(e){return[{id:`clear-prompt`,title:`Clear prompt`,category:`Prompt`,description:`Remove the current prompt`,projections:{slash:{aliases:[`clear`],order:0},palette:{}},handler:()=>{e().clear()}},...xW.map((t,n)=>({id:`size-${t}`,title:`Use ${t} size`,category:`Prompt`,description:`Use ${String(bW[t].width)} × ${String(bW[t].height)}`,projections:{slash:{aliases:[t],order:n+1},palette:{}},handler:()=>{e().useSize(t)}})),{id:`choose-style`,title:`Choose style`,category:`Prompt`,description:`Pick, create or edit a saved style`,projections:{slash:{aliases:[`style`],order:4},palette:{}},handler:()=>{e().openStyles()}},{id:`no-style`,title:`Use no style`,category:`Prompt`,description:`Send the prompt without a style`,projections:{slash:{aliases:[`nostyle`],order:5},palette:{}},handler:()=>{e().clearStyle()}}]}function rte(e,t){let n=(0,G.useRef)(e);n.current=e;let r=AN(t,{sourceId:`media-prompt`,namespace:`media`},(0,G.useCallback)(()=>nte(()=>n.current),[])),i=(0,G.useSyncExternalStore)(r.subscribe,r.snapshot,r.snapshot);return{items:(0,G.useMemo)(()=>B1(i).map(e=>({id:e.commandId,command:e.command,slash:e.alias,title:e.title,description:e.description})),[i]),run:e=>{r.execute(e,{origin:`slash`})}}}function ite(e){let t=vC(),n=Uw(kK(e)),r=n=>({mutationFn:t=>{let r=e?.context.get().computerId;if(!e||!r)throw Error(`No Computer selected`);return n(e,r,t)},onSuccess:n=>{t.setQueryData(TK.styles(e),n)}}),i=Jw(r((e,t,n)=>UG(e.capabilities,t,n))),a=Jw(r((e,t,n)=>WG(e.capabilities,t,n)));return{styles:n.data?.styles??[],error:n.error?lC(n.error).message:null,busy:i.isPending||a.isPending,save:(e,t)=>{i.mutate(e,{onError:()=>{A$(`The style could not be saved. Try again.`,`prints-style-save`)},onSuccess:n=>{t(n.styles.find(t=>t.name===e.name))}})},remove:(e,t)=>{a.mutate(e,{onSuccess:t,onError:()=>{A$(`The style could not be deleted. Try again.`,`prints-style-delete`)}})}}}function Y9(e){let t=e.filter(e=>e.kind===`video`&&e.video!==null&&e.video.prices.length>0&&e.input.maxReferences>=1&&e.video.referenceRoles.includes(`first-frame`));return t.find(e=>e.video?.provider===`seedance`)??t.at(0)}function ate(e,t,n){let r=e.video;if(r===null)return;let i=Math.log(t/n),a=e=>Math.abs(Math.log(e.width/e.height)-i);return r.formats.filter(e=>e.resolution===r.defaultResolution).reduce((e,t)=>e===void 0||a(t)<a(e)?t:e,void 0)}function ote(e,t){let{lineage:n,printPath:r,models:i,current:a}=t,o=e===`animate`?Y9(i):void 0;if(e===`animate`&&o===void 0)return{kind:`refused`,message:`No video model on this Computer takes a first frame.`};let s=tG(i,n.model),c=s?.transform!=null;if(c&&e===`reuse`)return{kind:`refused`,message:`This print was an image edit, so there is no prompt to reuse. Remix or animate it instead.`};let l=o??(c?void 0:s)??tG(i,a.model);if(l===void 0)return{kind:`refused`,message:`Choose a model from the granted registry.`};let u=o===void 0&&s===void 0?`This print was made with ${n.model}, which is no longer available. Loaded it with ${eG(l)} instead.`:null,d=c?[]:n.references.slice(0,n.typed.references),f=e===`animate`?{path:r,role:`first-frame`}:{path:r},p=[f,...d.filter(e=>!gW(e,t.printComputerId)||e.path!==r)];if(e!==`reuse`&&l.input.maxReferences===0)return{kind:`refused`,message:`${l.label} does not take reference images.`};let m=e===`reuse`?d:e===`remix`?p:[f],h=nG(a,l),g={width:n.width??h.width,height:n.height??h.height},_=o===void 0?$W(g,l,void 0):ate(l,g.width,g.height)??h,v=o===void 0&&l.input.steps!==`fixed`&&n.steps!==null&&l.id===n.model?n.steps:h.steps,y=n.style!==null&&t.styles.includes(n.style)?n.style:void 0;return{kind:`draft`,notice:u,draft:{...h,destination:void 0,prompt:tK(c?``:n.typed.prompt,e=>{let t=d.at(e-1),n=t===void 0?-1:m.findIndex(e=>e.path===t.path&&e.computerId===t.computerId);return n<0?void 0:n+1}),references:m,steps:v,style:y,width:_.width,height:_.height}}}function ste({id:e,styles:t,selected:n,disabled:r,onSelect:i}){let a=n===void 0||t.some(e=>e.name===n);return(0,Z.jsxs)(J$,{id:e,"aria-label":`Prompt style`,"data-generation-style":!0,className:`select-sm`,disabled:r,onChange:e=>{i(e.currentTarget.value||void 0)},value:n??``,children:[(0,Z.jsx)(`option`,{value:``,children:`No style`}),a?null:(0,Z.jsx)(`option`,{value:n,children:n}),t.map(e=>(0,Z.jsx)(`option`,{value:e.name,children:e.name},e.id))]})}function X9({active:e,children:t}){let[n,r]=(0,G.useState)(e);return e&&!n&&r(!0),n?(0,Z.jsx)(G.Suspense,{fallback:null,children:t}):null}var cte=(0,G.lazy)(async()=>({default:(await R1(()=>import(`./prints-activity-tray-Dzuo0oQf.js`),__vite__mapDeps([0,1,2,3]),import.meta.url)).PrintsActivityTray})),lte=(0,G.lazy)(async()=>({default:(await R1(()=>import(`./prompt-styles-dialog-BZhT0MLL.js`),__vite__mapDeps([4,5]),import.meta.url)).PromptStylesDialog})),ute=(0,G.lazy)(async()=>({default:(await R1(()=>import(`./prompt-character-controls-CYM-yAvH.js`),__vite__mapDeps([6,5]),import.meta.url)).PromptCharactersDialog})),dte=(0,G.lazy)(async()=>({default:(await R1(()=>import(`./reference-lightbox-BhAciijE.js`),__vite__mapDeps([7,8,5]),import.meta.url)).ReferenceLightbox})),fte=(0,G.lazy)(async()=>({default:(await R1(()=>import(`./library-dialogs-CDgHHvX1.js`),__vite__mapDeps([9,5]),import.meta.url)).MoveDialog})),pte=(0,G.lazy)(async()=>({default:(await R1(()=>import(`./library-dialogs-CDgHHvX1.js`),__vite__mapDeps([9,5]),import.meta.url)).NewFolderDialog})),mte=(0,G.lazy)(async()=>({default:(await R1(()=>import(`./library-folders-dialog-sN7pQ-iH.js`),__vite__mapDeps([10,5,11,12]),import.meta.url)).LibraryFoldersDialog})),hte=(0,G.lazy)(async()=>({default:(await R1(()=>import(`./library-rail-pQsc3ZAQ.js`),__vite__mapDeps([11,12]),import.meta.url)).LibraryRail})),gte=(0,G.lazy)(async()=>({default:(await R1(()=>import(`./print-viewer-1AxfZFoO.js`),__vite__mapDeps([13,8,5]),import.meta.url)).PrintViewer})),_te=(0,G.lazy)(async()=>({default:(await R1(()=>import(`./prints-folder-dialog-2uX7-Mza.js`),__vite__mapDeps([14,5,2,3]),import.meta.url)).PrintsFolderDialog})),vte=(0,G.lazy)(async()=>({default:(await R1(()=>import(`./print-info-drawer-XZdc15CI.js`),__vite__mapDeps([15,3,12,1]),import.meta.url)).PrintInfoDrawer})),yte=[`a mushroom knight`,`moss on a keyboard`,`a tiny house made of mushrooms`];function Z9(e){sI.error(e,{id:`prints-generation-error`,toasterId:`prints-generation-notices`})}function bte(e){let t=(0,G.useRef)(!1),n=EJ({defaultValues:jW(),onSubmit:async({value:n})=>{t.current=await e.current(n)}}),r=(0,G.useCallback)(async()=>(t.current=!1,await n.handleSubmit(),t.current),[n]);return Object.assign(n,{submitCurrent:r})}function xte(e){let t=[...new Set(e.map(e=>e.group))];return t.length<2?[{group:void 0,choices:e}]:t.map(t=>({group:t,choices:e.filter(e=>e.group===t)}))}function Ste({form:e,selected:t,stylePicker:n,sizeChoices:r,sizeMode:i,onCustomSize:a,match:o,onEditStyles:s,onEditCharacters:c}){let l=t?.input.dimensions===`none`,u=t!==void 0&&t.sizes!==null,d=t?.video??null;return(0,Z.jsxs)(`div`,{className:`prints-settings`,children:[(0,Z.jsx)(H$,{label:`Style`,orientation:`horizontal`,children:n}),(0,Z.jsx)(H$,{label:`Size`,orientation:`horizontal`,children:(0,Z.jsx)(J$,{"aria-label":`Generation size`,"data-generation-size":!0,className:`select-sm`,disabled:l,title:l?`This model chooses the output size.`:void 0,onChange:t=>{let n=t.currentTarget.value;o.onChange(n===`match`),a(n===`custom`);let i=r.find(e=>e.value===n);i&&(e.setFieldValue(`width`,i.width),e.setFieldValue(`height`,i.height))},value:l?`provider`:i,children:l?(0,Z.jsx)(`option`,{value:`provider`,children:`Model default`}):(0,Z.jsxs)(Z.Fragment,{children:[o.offered?(0,Z.jsx)(`option`,{value:`match`,disabled:o.size===void 0,children:o.size===void 0?`Match first reference: attach an image first`:`Match first reference · ${VW(o.size.width,o.size.height)}`}):null,u&&i!==`match`&&!r.some(e=>e.value===i)?(0,Z.jsx)(`option`,{value:i,disabled:!0,children:`Choose a supported resolution`}):null,xte(r).map(({group:e,choices:t})=>e===void 0?t.map(e=>(0,Z.jsx)(`option`,{value:e.value,children:e.label},e.value)):(0,Z.jsx)(`optgroup`,{label:e,children:t.map(e=>(0,Z.jsx)(`option`,{value:e.value,children:e.label},e.value))},e)),u?null:(0,Z.jsx)(`option`,{value:`custom`,children:`Custom size`})]})})}),!l&&!u&&i===`custom`?(0,Z.jsxs)(`div`,{className:`prints-custom-size`,children:[(0,Z.jsx)(e.Field,{name:`width`,children:e=>(0,Z.jsx)(H$,{label:`Width`,children:(0,Z.jsx)(k$,{"aria-label":`Generation width`,"data-generation-width":!0,max:4096,min:1,onChange:t=>{e.handleChange(Number(t.currentTarget.value)||1)},type:`number`,value:e.state.value})})}),(0,Z.jsx)(e.Field,{name:`height`,children:e=>(0,Z.jsx)(H$,{label:`Height`,children:(0,Z.jsx)(k$,{"aria-label":`Generation height`,"data-generation-height":!0,max:4096,min:1,onChange:t=>{e.handleChange(Number(t.currentTarget.value)||1)},type:`number`,value:e.state.value})})})]}):null,d?(0,Z.jsx)(e.Field,{name:`durationSeconds`,children:e=>(0,Z.jsx)(H$,{label:`Length`,orientation:`horizontal`,children:(0,Z.jsx)(J$,{"aria-label":`Video length in seconds`,className:`select-sm`,"data-generation-duration":!0,onChange:t=>{let n=t.currentTarget.value;e.handleChange(d.durations.find(e=>String(e)===n))},value:e.state.value===void 0?``:String(e.state.value),children:d.durations.map(e=>(0,Z.jsxs)(`option`,{value:String(e),children:[e,` seconds`]},e))})})}):null,d?.supportsAudio?(0,Z.jsx)(e.Field,{name:`generateAudio`,children:e=>d.defaultGenerateAudio===null?(0,Z.jsx)(H$,{label:`Sound`,orientation:`horizontal`,children:(0,Z.jsxs)(J$,{"aria-label":`Video sound`,className:`select-sm`,"data-generation-audio":!0,onChange:t=>{let n=t.currentTarget.value;e.handleChange(n===``?void 0:n===`on`)},value:e.state.value===void 0?``:e.state.value?`on`:`off`,children:[(0,Z.jsx)(`option`,{value:``,children:`Model default`}),(0,Z.jsx)(`option`,{value:`on`,children:`On`}),(0,Z.jsx)(`option`,{value:`off`,children:`Off`})]})}):(0,Z.jsx)(H$,{label:`Sound`,orientation:`horizontal`,children:(0,Z.jsx)(X$,{"aria-label":`Video sound`,checked:e.state.value??!0,"data-generation-audio":!0,onCheckedChange:e.handleChange})})}):null,t&&t.input.steps!==`fixed`?(0,Z.jsx)(e.Field,{name:`steps`,children:e=>(0,Z.jsx)(H$,{label:`Steps`,optional:!0,orientation:`horizontal`,children:(0,Z.jsx)(k$,{"aria-label":`Generation steps`,className:`input-sm`,"data-generation-steps":!0,max:t.input.maxSteps??void 0,min:1,onChange:t=>{e.handleChange(t.currentTarget.value===``?void 0:Number(t.currentTarget.value))},type:`number`,value:e.state.value??``})})}):null,(0,Z.jsxs)(`div`,{className:`prints-settings-library`,children:[(0,Z.jsx)(kJ,{size:`xs`,variant:`ghost`,type:`button`,onClick:()=>{s()},children:`Edit styles…`}),(0,Z.jsx)(kJ,{size:`xs`,variant:`ghost`,type:`button`,onClick:()=>{c()},children:`Characters…`})]})]})}function Q9(e){return e.detail===void 0?e.title:e.group===`Images`?e.detail:`${e.title}. ${e.detail}`}function Cte({actions:e,guidance:t,commandApp:n,form:r,models:i,modelsLoading:a,mediaCapability:o,submitting:s,generateLimitReason:c,values:l,computerId:u,mediaDirectory:d,referenceImages:f,referenceLabels:p,price:m,characters:h,characterDialog:g,onSubmit:_,styleControls:v,addedLength:y}){let b=tG(i,l.model),x=!o||a||i.length===0,S=x&&t?.group===`Setup`&&t.blocking===!0?t:void 0,C=l.prompt.trim().length,w=b!==void 0&&C>0&&C+y>b.maxPromptLength,T=aG(b),E=b?.video??null,D=JG(l.prompt).length>0,O=oG(l.references,b,D),k=b?.input.maxReferences??0,A=l.references.length>k,j=(0,G.useRef)(null),M=(0,G.useId)(),N=v1(j),[P,F]=(0,G.useState)(!1),I=w?C+y:0,L=b!==void 0&&w?H9({addedLength:y,length:I,maxLength:b.maxPromptLength}):void 0,[R,z]=(0,G.useState)(!1),[ee,te]=(0,G.useState)(!1),B=l.references.find(e=>u!==null&&gW(e,u)),ne=f.find(e=>e.path===B?.path),re=ne===void 0?void 0:XW(b,ne.width,ne.height),V=r.setFieldValue,H=(0,G.useRef)({width:l.width,height:l.height});H.current={width:l.width,height:l.height},(0,G.useEffect)(()=>{if(ee){if(re===void 0){te(!1),sI(`Size kept at ${String(H.current.width)} × ${String(H.current.height)}; Match first reference turned off`,{toasterId:`prints-generation-notices`});return}V(`width`,re.width),V(`height`,re.height)}},[ee,re?.width,re?.height,V]);let[ie,ae]=(0,G.useState)(!1),oe=b!==void 0&&b.sizes!==null,se=QW(b),ce=ee?`match`:oe?`${String(l.width)}x${String(l.height)}`:R?`custom`:se.find(e=>e.width===l.width&&e.height===l.height)?.value??`custom`,[le,ue]=(0,G.useState)(!1),de=rte({clear:()=>{r.setFieldValue(`prompt`,``)},useSize:e=>{z(!1),te(!1),r.setFieldValue(`width`,bW[e].width),r.setFieldValue(`height`,bW[e].height),r.setFieldValue(`prompt`,``)},openStyles:()=>{r.setFieldValue(`prompt`,``),ue(!0)},clearStyle:()=>{r.setFieldValue(`style`,void 0),r.setFieldValue(`prompt`,``)}},n),[fe,pe]=(0,G.useState)(!1),me=l.references.map((e,t)=>({number:p[t]??t+1,name:e.path.split(`/`).at(-1)??e.path,url:u!==null&&gW(e,u)?f.find(t=>t.path===e.path)?.url:void 0})),he=Wee(h,me,l.prompt),ge=U9(l.prompt,h,me,f),_e=Vee(de.items,l.prompt),ve=(0,G.useId)(),ye=`${ve}-commands`,be=`${ve}-characters`,xe=fK(l.prompt,h).characters,Se=e=>{let t=_e.slashMatches.at(e);t&&(_e.resetSlash(),de.run(t.command))},Ce=v({open:le,onOpenChange:ue}),we=[l.style,ee?`Match · ${YW(l.width,l.height)}`:ZW(b,l.width,l.height),E&&l.durationSeconds!==void 0?`${String(l.durationSeconds)}s`:void 0,E?.supportsAudio&&l.generateAudio===!1?`silent`:void 0].filter(e=>e!=null),Te=(0,Z.jsx)(Ste,{form:r,selected:b,stylePicker:Ce.picker,sizeChoices:se,sizeMode:ce,onCustomSize:z,match:{offered:b?.kind===`image`&&b.input.dimensions===`own`,size:re,onChange:te},onEditStyles:()=>{ae(!1),ue(!0)},onEditCharacters:()=>{ae(!1),pe(!0)}}),Ee=e=>{let t=r.store.state.fieldMeta,n=nG(l,e),i=$W(l,e,b);r.setFieldValue(`model`,e.id),(e.input.dimensions===`none`||e.sizes!==null)&&z(!1),r.setFieldValue(`width`,i.width),r.setFieldValue(`height`,i.height),r.setFieldValue(`durationSeconds`,n.durationSeconds),r.setFieldValue(`voiceId`,n.voiceId),r.setFieldValue(`generateAudio`,n.generateAudio),e.kind===`audio`&&r.setFieldValue(`references`,[]),(e.input.steps===`fixed`||!t.steps?.isTouched)&&r.setFieldValue(`steps`,n.steps)},De=b?.kind===`audio`,[Oe,ke]=(0,G.useState)(null),Ae=(0,G.useRef)(null),je=De?0:l.references.length,Me=u7(IW(i)),Ne=(0,G.useRef)(null);b!==void 0&&b.kind!==`audio`&&(Ne.current=b.id);let Pe=()=>{let e=De?tG(i,Ne.current??``)??tG(i,`@cf/black-forest-labs/flux-2-klein-4b`)??FW(i).at(0):tG(i,Me.at(0)?.id??``);e&&Ee(e)},Fe=b===void 0?null:d7(b),Ie=Fe===null?[]:p7(Me,Fe),Le=b?.audio==null||Fe===null?null:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(m7,{disabled:s,modes:f7(Me),value:Fe,onChange:e=>{let t=tG(i,p7(Me,e).at(0)?.id??``);t&&Ee(t)}}),Ie.length>1?(0,Z.jsx)(g7,{disabled:s,models:Ie,value:b.id,onChange:e=>{let t=tG(i,e);t&&Ee(t)}}):null,b.audio.mode===`speech`?(0,Z.jsx)(_7,{disabled:s,voices:b.audio.voices,value:l.voiceId??b.audio.defaultVoiceId??``,onChange:e=>{r.setFieldValue(`voiceId`,e)}}):null,b.audio.seconds===null?null:(0,Z.jsx)(b7,{disabled:s,seconds:b.audio.seconds,value:l.durationSeconds??b.audio.seconds.default,onChange:e=>{r.setFieldValue(`durationSeconds`,e)}})]}),Re=e=>JSON.stringify([e.computerId??u,e.path]),ze=e=>u!==null&&gW(e,u)?f.find(t=>t.path===e.path):void 0,Be=e=>{let t=O[e]?.role;return t===void 0?`@${qG(p[e]??e+1)}`:rG[t]},Ve=l.references.flatMap((e,t)=>{let n=ze(e);return n===void 0?[]:[{key:Re(e),label:Be(t),name:e.path.split(`/`).at(-1)??e.path,url:n.url}]}),He=Ve.findIndex(e=>e.key===Oe);return(0,Z.jsxs)(K6,{"aria-label":De?`Audio generation`:`Image generation`,"data-generation-form":!0,"data-composer-collapsed":N.collapsed?``:void 0,"data-composer-fullscreen":N.fullscreen?``:void 0,attachments:!De&&l.references.length>0?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{ref:Ae,className:`prints-reference-tray`,"aria-label":`Image references`,"data-over-limit":A?``:void 0,title:`${String(l.references.length)} / ${String(k)} references`,children:l.references.map((e,t)=>{let n=ze(e),i=O[t]?.role,a=iG(T,O,t);return(0,Z.jsxs)(`div`,{className:`prints-reference-tile`,"data-reference-chip":!0,title:e.computerId===void 0?e.path:`${e.computerId}:${e.path}`,children:[n?(0,Z.jsx)(`button`,{type:`button`,className:`prints-reference-face prints-reference-open mask mask-squircle`,"aria-label":`Enlarge ${Be(t)}: ${e.path.split(`/`).at(-1)??e.path}`,"aria-haspopup":`dialog`,"data-reference-key":Re(e),onClick:()=>{ke(Re(e))},children:(0,Z.jsx)(`img`,{src:n.url,alt:e.path.split(`/`).at(-1)})}):(0,Z.jsx)(`div`,{className:`prints-reference-face mask mask-squircle`,children:(0,Z.jsx)(`span`,{children:qG(p[t]??t+1)})}),(0,Z.jsx)(`span`,{className:`prints-reference-label`,"data-reference-label":!0,children:qG(p[t]??t+1)}),i===void 0?null:a===void 0?(0,Z.jsx)(`span`,{className:`prints-reference-role`,"data-reference-role":i,children:rG[i]}):(0,Z.jsx)(kJ,{size:`xs`,variant:`ghost`,type:`button`,className:`prints-reference-role`,"data-reference-role":i,"aria-label":`Reference ${String(t+1)}: ${rG[i]}. Use as ${rG[a]}`,title:`Use as ${rG[a]}`,onClick:()=>{r.setFieldValue(`references`,O.map((e,n)=>n===t?{...e,role:a}:e))},children:rG[i]}),(0,Z.jsx)(LJ,{icon:(0,Z.jsx)(QI,{}),className:`prints-reference-remove`,"aria-label":`Remove reference ${String(t+1)}`,onClick:()=>{r.setFieldValue(`references`,l.references.filter((e,n)=>n!==t))}})]},Re(e))})}),(0,Z.jsx)(X9,{active:He>=0,children:(0,Z.jsx)(dte,{slides:Ve,index:He<0?null:He,onIndexChange:e=>{ke(Ve[e]?.key??null)},onClose:()=>{ke(null)},returnFocusTo:e=>[...Ae.current?.querySelectorAll(`[data-reference-key]`)??[]].find(t=>t.dataset.referenceKey===e)??null})})]}):void 0,input:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`form`,{"aria-busy":s,onSubmit:e=>{e.preventDefault(),_()},children:(0,Z.jsx)(r.Field,{name:`prompt`,children:e=>(0,Z.jsxs)(`div`,{className:`prints-prompt`,"data-guidance-placeholder":S?``:void 0,id:M,ref:j,children:[_e.slashOpen?(0,Z.jsx)(Bee,{index:_e.slashIndex,listId:ye,matches:_e.slashMatches,onHighlight:_e.highlightSlash,onPick:Se}):null,!_e.slashOpen&&he.matches.length>0?(0,Z.jsx)(Hee,{images:f,index:he.index,listId:be,matches:he.matches,onHighlight:he.highlight,onPick:t=>{let n=he.complete(t);n!==null&&e.handleChange(n)}}):null,(0,Z.jsx)(zee,{caretRequest:he.caretRequest,layout:N,onOver:Z9,onOverflow:F,menu:_e.slashOpen?{open:_e.slashMatches.length>0,listId:ye,selected:_e.slashIndex}:{open:he.matches.length>0,listId:be,selected:he.index},mentionCount:_e.slashOpen?0:he.matches.length,onCaret:he.setCaret,onMentionDismiss:he.dismiss,onMentionMove:he.move,onMentionPick:()=>{let t=he.complete(he.index);t!==null&&e.handleChange(t)},disabled:x||s,maxLength:b?.maxPromptLength,addedLength:y,onChange:t=>{e.handleChange(t)},onSend:_,onSlashMove:_e.moveSlash,onSlashPick:()=>{Se(_e.slashIndex)},placeholder:S?Q9(S):b?.audio?.mode===`speech`?`What should it say?`:b?.audio?.mode===`music`?`Describe the music`:`What are we making?`,slashCount:_e.slashMatches.length,value:e.state.value}),xe.length>0||ge.length>0?(0,Z.jsxs)(`div`,{className:`prints-composer-notes`,children:[(0,Z.jsx)(W9,{tokens:ge}),xe.length>0?(0,Z.jsx)(`span`,{className:`prints-reference-count`,"data-generation-characters":!0,children:`Characters: ${xe.map(e=>e.name).join(`, `)}`}):null]}):null]})})}),t&&!S?(0,Z.jsxs)(`div`,{className:`prints-composer-guidance`,role:`status`,"data-composer-guidance":!0,children:[(0,Z.jsx)(`span`,{children:Q9(t)}),t.actions?.map(e=>(0,Z.jsx)(kJ,{variant:`ghost`,size:`xs`,onClick:e.run,children:e.label},e.label))]}):null]}),row:{controls:(0,Z.jsxs)(Z.Fragment,{children:[N.fullscreen?null:(0,Z.jsx)(zJ,{"aria-controls":M,"aria-expanded":!N.collapsed,"aria-label":N.collapsed?`Expand composer`:`Collapse composer`,"data-composer-collapse":!0,icon:N.collapsed?(0,Z.jsx)(MI,{}):(0,Z.jsx)(jI,{}),label:null,onClick:()=>{N.setCollapsed(!N.collapsed)},onMouseDown:e=>{e.preventDefault()},title:N.collapsed?`Expand composer`:`Collapse composer`}),N.collapsed&&je>0?(0,Z.jsxs)(`span`,{"aria-label":`${String(je)} ${je===1?`reference`:`references`} attached`,className:`prints-composer-count`,"data-composer-count":!0,role:`img`,title:`${String(je)} ${je===1?`reference`:`references`} attached`,children:[(0,Z.jsx)(VI,{"aria-hidden":`true`}),je]}):null,N.coarse&&P&&!N.collapsed?(0,Z.jsx)(zJ,{"aria-label":`Open full-screen editor`,"data-composer-expand":!0,icon:(0,Z.jsx)(UI,{}),label:null,onClick:()=>{N.setFullscreen(!0),j.current?.querySelector(`textarea`)?.focus()},title:`Open full-screen editor`}):null,S?S.actions?.map(e=>(0,Z.jsx)(kJ,{variant:`ghost`,size:`xs`,onClick:e.run,children:e.label},e.label)):null,De?null:e,Me.length>0?(0,Z.jsx)(zJ,{"aria-label":`Audio`,"data-generation-audio-key":!0,icon:(0,Z.jsx)(kI,{}),label:null,pressed:De,tone:De?`accent`:`neutral`,title:De?`Back to pictures`:`Make audio`,disabled:a||!o,onClick:Pe}):null,De?Le:(0,Z.jsx)(r.Field,{name:`model`,children:e=>(0,Z.jsx)(D7,{compact:N.coarse,models:FW(i),emptyLabel:u===null?`Choose a Computer`:a?`Loading models…`:`Models unavailable`,disabled:a||!o,onChange:e=>{let t=tG(i,e);t&&Ee(t)},value:e.state.value})}),u&&d?(0,Z.jsx)(`span`,{className:`sr-only`,"data-generation-computer":!0,title:`Where new prints are saved`,children:`Saved in your Prints folder`}):null]}),action:(0,Z.jsxs)(`span`,{className:`prints-generate-action`,children:[m===null?null:(0,Z.jsx)(`span`,{className:`prints-generate-price`,"data-generation-price":!0,title:`Estimated price`,children:m.startsWith(`<`)?m:`≈ ${m}`}),(0,Z.jsx)(Iee,{busy:s,draft:l.prompt,disabled:!o||a||i.length===0||s||c!==void 0,disabledReason:c??L,label:PW(b),onGenerate:()=>{_()},promptOver:w})]}),items:De?[]:[{id:`settings`,accessibleLabel:`Generation settings`,title:`Settings`,label:(0,Z.jsxs)(`span`,{className:`prints-settings-chip`,children:[(0,Z.jsx)(YI,{"aria-hidden":`true`,className:`size-[var(--stipe-icon-size-sm)]`}),(0,Z.jsx)(`span`,{className:`prints-settings-chip-text`,children:we.length>0?we.join(` · `):`Settings`})]}),content:Te}],openId:ie?`settings`:null,onOpenChange:e=>{ae(e===`settings`)}},children:[(0,Z.jsx)(y1,{layout:N}),(0,Z.jsxs)(`div`,{className:`prints-composer-editor-bar`,"data-composer-editor-bar":!0,children:[(0,Z.jsx)(`span`,{children:`Prompt`}),(0,Z.jsx)(zJ,{"data-composer-done":!0,label:`Done`,onClick:()=>{N.setFullscreen(!1),j.current?.querySelector(`textarea`)?.focus()}})]}),Ce.dialog,g({open:fe,onOpenChange:pe})]})}function wte({connection:e}){let t=(0,G.useRef)(null),n=(0,G.useRef)(e);n.current=e;let r=k7(e?.app??null),i=DN(e?.app??null)?.setup?.media===`missing`,[a,o]=(0,G.useState)(!1),[s,c]=(0,G.useState)(!1),l=()=>{let t=e?.app;t&&(o(!0),c(!1),t.ui.openSetup(`media`).then(e=>{o(!1),c(e===`unavailable`)},e=>{o(!1),c(!0),oW(`open-media-setup`,e)}))},u=s?(0,Z.jsxs)(Z.Fragment,{children:[`Image setup couldn’t open.`,` `,(0,Z.jsx)(`a`,{href:`https://github.com/fungi-computer/oyster#deploy-to-cloudflare`,target:`_blank`,rel:`noreferrer`,children:`Open the image setup guide`}),`.`]}):`Image generation isn’t set up yet.`,[d,f]=(0,G.useState)(!1),[p,m]=(0,G.useState)(),h=F7(e?.app??null,r.computerId),[g,_]=(0,G.useState)(null),[v,y]=(0,G.useState)(null),[b,x]=(0,G.useState)(),S=(0,G.useRef)(0);(0,G.useEffect)(()=>{_(null),y(null),x(void 0)},[e,r.computerId,r.path]);let C=r.path,w=dW(e,r),{gallery:T,images:E,failed:D,loading:O,gallerySlots:k,canBrowse:A,canRead:j,canWrite:M,reserveSlot:N,failSlot:P,clearSlotError:F,removeSlot:I,addComputerFile:L,retryFile:R,uploads:z,uploadFiles:ee}=w,te=e!==null&&r.destination!==null&&A&&j,B=N1({app:e?.app??null,destination:r.destination,view:r.view,setView:r.setView,entries:T.entries,canWrite:M}),[ne,re]=(0,G.useState)(!1),V=B.selecting||T.entries.length>0||w.gallery.folders.length>0,H=KH({selectable:V,atFolderRoot:r.view.kind===`folder`&&!B.up,loading:O||T.loading,failed:!!T.error});jN(te?e.app.window.navigation:null,{canGoBack:B.history.canGoBack,canGoForward:B.history.canGoForward,crumbs:B.crumbs,primary:V?[{id:`select`,label:`Select`,variant:`outline`}]:[],onAction:e=>{e===`select`&&B.setSelecting(!B.selecting)},onBack:B.history.back,onForward:B.history.forward,onCrumb:e=>{B.history.open(e===`all`||e===`favorites`?{kind:e}:{kind:`folder`,folder:e===``?void 0:e})}});let[ie,ae]=(0,G.useState)(Date.now),oe=k.some(e=>e.startedAt!==void 0&&!e.resolved&&!e.error);(0,G.useEffect)(()=>{if(!oe)return;let e=setInterval(()=>{ae(Date.now())},1e3);return()=>{clearInterval(e)}},[oe]);let se=eF(e,(e,t,n)=>(T.refresh(),L(e,t,n)));(0,G.useLayoutEffect)(()=>{x(void 0),se.target&&(_(null),y(null))},[se.target]),(0,G.useEffect)(()=>{se.error&&A$(`Could not open this print. It may no longer be available on this Computer.`,`prints-navigation-error`)},[se.error]);let ce=T.entries.some(e=>e.path===se.target?.path);(0,G.useEffect)(()=>{se.target&&!ce&&T.nextPageReady&&T.loadMore()},[se.target,ce,T.nextPageReady,T.loadMore]);let le=E.find(e=>e.source.kind===`computer`&&e.source.computerId===se.target?.computerId&&e.source.path===se.target.path),ue=ite(e?.app??null),de=Zee(e?.app??null),[fe,pe]=(0,G.useState)(new Set),me=KK({connection:e,folder:r,styles:ue.styles,characters:de.characters,effects:{reserve:e=>{pe(t=>{if(!t.has(e.key))return t;let n=new Set(t);return n.delete(e.key),n}),N(e)},failed:P,release:I,notifyFailure:Z9,saved:({result:e},t)=>{pe(t=>new Set(t).add(`${e.destination.computerId}:${e.destination.path}`)),j?L(e.destination.path,t,e.destination.computerId):P(`${e.destination.computerId}:${e.destination.path}`,`Image saved, but this App cannot read its preview.`)}}}),{state:he,models:ge,modelsLoading:_e,modelsError:ve,canGenerate:ye,mediaCapability:be,pendingGenerations:xe,activeGenerations:Se,recoveryError:Ce}=me,we=(0,G.useRef)(ge),Te=(0,G.useRef)(me);Te.current=me;let Ee=(0,G.useRef)(null),De=(0,G.useRef)(null),Oe=(0,G.useRef)(0),[ke,Ae]=(0,G.useState)(null),je=(0,G.useRef)([]),Me=(0,G.useRef)(e=>me.submit(e,je.current));Me.current=async e=>{let t=await me.submit(e,je.current);return t&&Ae(null),t};let Ne=bte(Me),Pe=e=>{Ne.setFieldValue(`model`,e.model),Ne.setFieldValue(`width`,e.width),Ne.setFieldValue(`height`,e.height),Ne.setFieldValue(`steps`,e.steps),Ne.setFieldValue(`durationSeconds`,e.durationSeconds),Ne.setFieldValue(`generateAudio`,e.generateAudio),Ne.setFieldValue(`prompt`,e.prompt),Ne.setFieldValue(`references`,e.references),Ne.setFieldValue(`style`,e.style),Ne.setFieldValue(`destination`,void 0)},Fe=(0,G.useRef)(Ne);Fe.current=Ne;let Ie=gJ(Ne.store,e=>e.values),Le=Gee(Ie.references,Ie.prompt,r.computerId);je.current=Le;let Re=Xee(me.session,qee({draft:Ie,model:tG(me.models,Ie.model),styleText:ue.styles.find(e=>e.name===Ie.style)?.text,characters:de.characters,labels:Le,computerId:r.computerId})),ze=gJ(Ne.store,e=>e.isSubmitting),Be=e?.app;(0,G.useEffect)(()=>{if(Be)return tte(Be,{readDraft:()=>Fe.current.store.state.values,readModels:()=>we.current,setDraft:e=>{let t=Fe.current;if(e.model!==void 0){let n=tG(we.current,e.model);if(!n)throw Error(`Choose a model from the granted registry.`);let r=nG(t.store.state.values,n),i=tG(we.current,t.store.state.values.model),a=$W(t.store.state.values,n,i);t.setFieldValue(`model`,r.model),t.setFieldValue(`width`,a.width),t.setFieldValue(`height`,a.height),t.setFieldValue(`steps`,r.steps),t.setFieldValue(`durationSeconds`,r.durationSeconds),t.setFieldValue(`generateAudio`,r.generateAudio)}e.generateAudio!==void 0&&t.setFieldValue(`generateAudio`,e.generateAudio??void 0),e.destination!==void 0&&t.setFieldValue(`destination`,e.destination??void 0),e.height!==void 0&&t.setFieldValue(`height`,e.height),e.prompt!==void 0&&t.setFieldValue(`prompt`,e.prompt),e.references!==void 0&&t.setFieldValue(`references`,e.references),e.steps!==void 0&&t.setFieldValue(`steps`,e.steps??void 0),e.style!==void 0&&t.setFieldValue(`style`,e.style??void 0),e.width!==void 0&&t.setFieldValue(`width`,e.width)},submit:()=>Fe.current.store.state.isSubmitting||Te.current.atLimit?Promise.resolve(!1):Fe.current.submitCurrent()})},[Be]),(0,G.useEffect)(()=>{we.current=ge},[ge]),(0,G.useEffect)(()=>{if(ge.length===0||ve)return;let e=ge.find(e=>e.id===`@cf/black-forest-labs/flux-2-klein-4b`)??FW(ge).at(0)??ge[0];if(!Ne.store.state.fieldMeta.model?.isTouched){let t=nG(Ne.store.state.values,e);Ne.setFieldValue(`model`,t.model),Ne.store.state.fieldMeta.width?.isTouched||Ne.setFieldValue(`width`,t.width),Ne.store.state.fieldMeta.height?.isTouched||Ne.setFieldValue(`height`,t.height),Ne.store.state.fieldMeta.steps?.isTouched||Ne.setFieldValue(`steps`,t.steps)}},[Ne,ve,ge]);let Ve=tG(ge,Ie.model),He=Ie.references,Ue=Ve?.input.maxReferences??0,We=(0,G.useRef)({addComputerFile:L,retryPath:me.retryPath,uploads:z});We.current={addComputerFile:L,retryPath:me.retryPath,uploads:z};let Ge=le?cW(le):null,Ke=(0,G.useMemo)(()=>E.map(e=>({key:cW(e),selected:cW(e)===Ge,path:e.source.kind===`computer`?e.source.path:e.file.name,referenced:He.some(t=>e.source.kind===`computer`&&gW(t,e.source.computerId)&&t.path===e.source.path),referenceDisabled:He.length>=Ue&&!He.some(t=>e.source.kind===`computer`&&gW(t,e.source.computerId)&&t.path===e.source.path),onToggleReference:e.source.kind===`computer`&&Ue>0&&!NH(e.source.path)?()=>{if(e.source.kind!==`computer`)return;let t=e.source.path,n=e.source.computerId,r=He.some(e=>gW(e,n)&&e.path===t);Ne.setFieldValue(`references`,r?He.filter(e=>!gW(e,n)||e.path!==t):[...He,{path:t}])}:void 0,onInfo:()=>{_(e)},url:e.url,width:e.width,height:e.height,onOpen:()=>{_(null),y(cW(e))}})),[E,He,Ue,Ne,Ge]),qe=(0,G.useMemo)(()=>{let e=r.computerId;if(!e)return Ke;let t=new Map(Ke.map(e=>[e.key,e])),n=T.entries.map(n=>{let r=`${e}:${n.path}`;return{...t.get(r)??{key:r,path:n.path,width:1,height:1,url:``,pending:!0,pendingLabel:`Loading print…`,onOpen:()=>void 0,onVisible:()=>{T.loadFile(n.path)},error:D.includes(n.name)?`Could not load this print.`:void 0},onRetry:()=>{R(n.path)}}}),i=new Set(n.map(e=>e.key));return[...n,...Ke.filter(e=>!i.has(e.key)&&e.key!==Ge)]},[Ke,T.entries,T.loadFile,R,D,r.computerId,Ge]),Je=te&&!(r.view.kind===`folder`&&!B.up)?r.view.kind===`all`?{title:`No prints yet`,description:`Prints in any folder of the library appear here.`}:r.view.kind===`favorites`?{title:`No favorites yet`,description:`Tap the heart on a print to keep it here for your whole Team.`}:{title:`Nothing in ${B.title} yet`,description:`New prints you make here land in it. You can also drop in images or move prints from another folder.`}:null,Ye=[...Se].sort().join(`|`),Xe=k.filter(e=>e.error!==void 0).length,Ze=(0,G.useMemo)(()=>xe.filter(e=>e.reference.computerId===r.computerId&&!Ye.split(`|`).includes(e.reference.requestId)&&!k.some(t=>t.computerId===e.reference.computerId&&t.path===e.input.destination.path)).map(e=>({key:`${e.reference.computerId}:${e.input.destination.path}`,path:e.input.destination.path,width:1024,height:1280,url:``,pending:!0,error:e.failure===void 0?`Stopped when Prints closed. Retry to run it again.`:yW,prompt:e.typed.prompt,onOpen:()=>void 0,onRetry:()=>{Te.current.resume(e)},onDismiss:()=>{Te.current.discard(e)}})),[xe,r.computerId,Ye,k]),Qe=(0,G.useMemo)(()=>[...Ze,...Fee(qe,k,e=>{let t=z.items.find(t=>t.id===e.uploadId),r=e.error??(t?.status===`error`||t?.status===`cancelled`?t.message:void 0);return{key:e.key,path:e.path,width:e.width,height:r===void 0?e.height:Math.max(e.height,e.width*1.25),url:``,pending:!0,error:r,prompt:xe.find(t=>t.reference.computerId===e.computerId&&t.input.destination.path===e.path)?.typed.prompt??me.promptAt(e.path),pendingLabel:t?.status===`complete`||fe.has(e.key)?`Loading preview…`:e.uploadId?`Uploading image…`:e.startedAt===void 0?e.pendingLabel:zW(ge.find(e=>e.kind===`video`),ie-e.startedAt,e.resumed),onOpen:()=>void 0,onStop:r===void 0&&e.uploadId===void 0?()=>{Te.current.stopPath(e.path)}:void 0,onRetry:r&&(j||t&&t.status!==`complete`)?()=>{if(F(e.key),t&&t.status!==`complete`){We.current.uploads.retry(t.id);return}!e.uploadId&&We.current.retryPath(e.path)||n.current&&We.current.addComputerFile(e.path,n.current,e.computerId)}:void 0,onDismiss:r?()=>{I(e.key),e.uploadId&&We.current.uploads.remove(e.uploadId)}:void 0}})],[Ze,xe,Xe,me.promptAt,fe,qe,k,z.items,j,ge,ie]),$e=!i&&be&&ye&&M&&C!==null&&he.kind===`ready`&&!_e&&ge.length>0,et=z.items.filter(e=>e.computerId===r.computerId),tt=()=>{e&&e.app.ui.openTeamBilling().catch(t=>{oW(`open-team-billing`,t),n.current===e&&me.reportRecoveryError(t)})},nt=[...he.kind===`error`&&ve===null?[{key:`generation:draft`,mediaKind:he.mediaKind,message:he.message,billing:he.action===`billing`?tt:void 0}]:[],...me.failures.map(e=>({key:e.key,mediaKind:e.mediaKind,message:e.message,billing:e.action===`billing`?tt:void 0,prompt:e.prompt,retry:e.retry,dismiss:()=>{for(let t of k)t.path===e.path&&I(t.key);e.dismiss()}}))],rt=P7({connected:e!==null,mediaCapability:be,modelsError:ve,retryModels:me.retryModels,modelsLoading:_e,models:ge,canGenerate:ye,mediaSetupMissing:i,canWrite:M,generationErrors:nt,recoveryError:Ce,pendingGenerations:xe,activeGenerations:Se,atGenerationLimit:me.atLimit,gallerySlots:k,computerId:r.computerId,failed:D,uploadError:z.error,uploads:et,permissions:()=>{e?.app.ui.requestAppPermissions({}).catch(e=>{me.reportRecoveryError(e)})},resume:e=>{me.resume(e)},discard:e=>{me.discard(e)},retryUpload:e=>{z.retry(e)}});h.error&&rt.push({key:`dismissal-storage`,group:`Setup`,tone:`warning`,blocking:!0,short:`Activity not saved`,title:`Activity not saved`,detail:h.error});let it=h.visible(rt),at={generating:Se.size,uploading:et.filter(e=>e.status===`sending`||e.status===`queued`).length},ot={items:et.filter(e=>e.status===`sending`||e.status===`queued`).map(e=>({id:e.id,name:e.file.name,preview:{kind:`image`,url:e.previewUrl},progress:null,progressLabel:``,statusLabel:e.message,actions:{cancel:{label:`Cancel`,accessibleLabel:`Cancel ${e.file.name}`}}})),onCancel:e=>{z.cancel(e)},onRetry:e=>{z.retry(e)},onRemove:e=>{z.remove(e)}},st=new Set([...T.entries.map(e=>`${r.computerId??``}:${e.path}`),...E.map(e=>e.source.kind===`computer`?`${e.source.computerId}:${e.source.path}`:e.file.name)]).size,ct=M7(it,at,d);kN(e?.app,[...r.available?[P1(r.landingPath??r.path,{checking:r.busy&&r.path===null,editing:r.editing})]:[],...ct===null?[]:[ct],...A?[{kind:`text`,id:`prints`,text:`${String(st)} ${st===1?`print`:`prints`}`}]:[]],e=>e.itemId===`activity`?(m(e.anchor?.start),f(e=>!e),!0):e.itemId!==`folder`||!r.available?!1:(r.setEditing(!0),!0),t=>{oW(`prints.status.report`,t),e?.app.ui.showToast({message:`Prints couldn't update its status bar.`,tone:`error`}).catch(e=>{oW(`prints.status.toast`,e)})});let lt=E.flatMap(e=>e.source.kind===`computer`?[{path:e.source.path,url:e.url,width:e.width,height:e.height}]:[]),ut=e=>{y(null),S.current+=1,x({key:e,requestId:`viewer-close-${String(S.current)}`,onFocus:()=>void 0})},dt=(t,n,i)=>(0,Z.jsx)(G.Suspense,{fallback:null,children:(0,Z.jsx)(vte,{image:t,app:e?.app??null,referenceImages:lt,models:ge,canAnimate:Y9(ge)!==void 0,operations:{session:me.session,atLimit:me.atLimit,onRun:async(e,n)=>{if(t.source.kind!==`computer`)return;let r=await me.operate({computerId:t.source.computerId,path:t.source.path,width:t.width,height:t.height},e,n);if(r!==null){Z9(r);return}_(null),v!==null&&ut(cW(t))}},download:i,library:te&&t.source.kind===`computer`&&r.destination!==null&&t.source.path.startsWith(`${r.destination}/`)?(()=>{let e=t.source.path,n=B.isFavorite(e);return{favorite:n,onToggleFavorite:()=>{B.toggleFavorite([e],!n)},onMove:M?()=>{B.setMoving([e])}:void 0}})():void 0,onIterate:(e,n)=>{if(t.source.kind!==`computer`)return null;let r=ote(e,{lineage:n,printComputerId:t.source.computerId,printPath:t.source.path,models:ge,styles:ue.styles.map(e=>e.name),current:Ne.store.state.values});return r.kind===`refused`?r.message:(Pe(r.draft),Ae(r.notice===null?null:{model:r.draft.model,message:r.notice}),_(null),v!==null&&ut(cW(t)),null)},onClose:n},t.url)}),ft={label:`Upload images`,onSelect:()=>De.current?.click(),disabled:!M||C===null,disabledReason:`Choose a writable Computer and folder to upload images.`},pt=!i&&Je===null&&r.computerId!==null&&r.available&&C===null,mt={label:`Choose folder`,onSelect:()=>{r.setEditing(!0)}},ht=(0,Z.jsx)(kJ,{variant:`ghost`,loading:a,onClick:l,children:`Set up image generation`});return(0,Z.jsxs)(`main`,{ref:t,className:`h-full w-full flex flex-col overflow-hidden`,"data-app-pane":`media`,"data-generation-state":he.kind,"data-computer-capability":A?`connected`:`absent`,onPaste:e=>{let t=Array.from(e.clipboardData.files);t.length&&M&&(e.preventDefault(),ee(t.map(e=>(Oe.current+=1,new File([e],`paste-${String(Oe.current)}-${hU(e.name)}`,{type:e.type,lastModified:e.lastModified})))))},children:[(0,Z.jsx)(MH,{id:`prints-generation-notices`}),(0,Z.jsxs)(`div`,{className:`prints-library`,"data-library":te||void 0,children:[te&&r.destination?(0,Z.jsx)(G.Suspense,{fallback:(0,Z.jsx)(`nav`,{className:`prints-rail`,"aria-label":`Library`,"aria-busy":`true`}),children:(0,Z.jsx)(hte,{app:e.app,root:r.destination,view:r.view,onView:B.history.open,canWrite:M,version:B.version,onNewFolder:e=>{B.setNewFolder({parent:e})},onDrop:(e,t)=>{B.move(e,t)},onRename:(e,t)=>{B.move([e],B.folderOf(r.destination??``,e),{name:t})},onMoveRows:B.setMoving})}):null,(0,Z.jsxs)(`div`,{className:`prints-library-main`,"data-selecting":B.selecting||void 0,children:[te?(0,Z.jsxs)(Z.Fragment,{children:[H?null:(0,Z.jsx)(D1,{view:r.view,lastFolder:B.lastFolder,onOpen:B.history.open,onFolders:()=>{re(!0)},subfolders:r.view.kind===`folder`?w.gallery.folders:[],onOpenSubfolder:e=>{B.history.open({kind:`folder`,folder:r.view.kind===`folder`&&r.view.folder?`${r.view.folder}/${e}`:e})}}),B.selecting?(0,Z.jsx)(E1,{count:B.selected.size,total:T.entries.length,canWrite:M,onToggleAll:()=>{B.selectAll(B.selected.size===T.entries.length?[]:T.entries.map(e=>e.path))},onMove:()=>{B.setMoving([...B.selected])},onFavorite:()=>{B.toggleFavorite([...B.selected],!0)},onDone:()=>{B.setSelecting(!1)}}):null]}):null,(0,Z.jsxs)(`div`,{className:`prints-gallery-region`,children:[(0,Z.jsx)(O$,{screen:!0,ref:Ee,className:`prints-gallery-scroll flex-1 min-h-0`,"data-media-scroll":!0,"aria-busy":O||T.loading,onDragOver:e=>{e.preventDefault()},onDrop:e=>{e.preventDefault();let t=Array.from(e.dataTransfer.files);t.length&&M&&ee(t)},children:(0,Z.jsxs)(`div`,{className:`prints-gallery-content`,children:[Qe.length>0?(0,Z.jsx)(Pee,{items:te?Qe.map(B.enrich):Qe,scrollRef:Ee,focus:v===null?b??(le&&se.target?{key:`${se.target.computerId}:${se.target.path}`,requestId:se.target.requestId,onFocus:()=>{_(null),y(cW(le))}}:void 0):void 0}):O||T.loading?(0,Z.jsx)(n1,{"data-media-loading":!0,framed:!1,message:`Loading prints…`,detail:`Your library is on its way.`,variant:`wander`}):(0,Z.jsx)(e1,{"aria-live":`polite`,"data-absence":!0,"data-media-empty":!0,role:`status`,variant:`speech`,className:`prints-invitation`,visual:`blobs`,title:i?`Make and collect images`:Je?.title??`Make your first print`,description:i?`Upload images to start your collection. Open any image to view or download it.`:Je===null?r.computerId===null?`Your images will appear here.`:pt?`Choose where Prints saves, then describe something.`:`Describe something and it lands here, or drop in images from your Computer.`:Je.description,primaryAction:i?ft:pt?mt:void 0,actions:pt?void 0:i?(0,Z.jsxs)(`div`,{className:`prints-image-setup`,children:[(0,Z.jsx)(`span`,{children:u}),ht]}):(0,Z.jsx)(kJ,{variant:`ghost`,size:`sm`,disabled:!M||C===null,onClick:()=>De.current?.click(),children:`Upload images`}),suggestions:i||pt?void 0:yte.map(e=>({label:e,disabled:!$e,onSelect:()=>{Ne.setFieldValue(`prompt`,e),t.current?.querySelector(`[data-generation-prompt]`)?.focus()}}))}),T.hasNextPage&&(0,Z.jsx)(kJ,{variant:`ghost`,disabled:T.loading,onClick:T.loadMore,children:T.loading?`Loading images…`:`Load more images`})]})}),g&&(g.source.kind===`local`||g.source.connection===e&&g.source.computerId===r.computerId)?dt(g,()=>{_(null)}):null]})]})]}),te&&r.destination?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(X9,{active:B.moving!==null,children:(0,Z.jsx)(fte,{app:e.app,root:r.destination,from:r.view.kind===`folder`?{folder:r.view.folder}:null,canWrite:M,count:B.moving?.length??0,open:B.moving!==null,version:B.version,onClose:()=>{B.setMoving(null)},onMove:(e,t)=>{let n=B.moving??[];B.setMoving(null),B.setSelecting(!1),B.move(n,e,{create:t})}})}),(0,Z.jsx)(X9,{active:B.newFolder!==null,children:(0,Z.jsx)(pte,{parent:B.newFolder?.parent,open:B.newFolder!==null,onClose:()=>{B.setNewFolder(null)},onCreate:e=>B.createFolder(B.newFolder?.parent,e)})}),(0,Z.jsx)(X9,{active:ne,children:(0,Z.jsx)(mte,{open:ne,onOpenChange:re,app:e.app,root:r.destination,view:r.view,onView:e=>{B.history.open(e),re(!1)},canWrite:M,version:B.version,onNewFolder:e=>{re(!1),B.setNewFolder({parent:e})},onMoveRows:B.setMoving})})]}):null,v===null?null:(0,Z.jsx)(G.Suspense,{fallback:null,children:(0,Z.jsx)(gte,{items:Qe,images:E,viewerKey:v,app:e?.app??null,onNavigate:y,onClose:ut,renderInfo:(e,t)=>dt(e,t,null)})}),i&&Qe.length>0?(0,Z.jsxs)(`div`,{className:`prints-library-actions`,children:[(0,Z.jsx)(kJ,{size:`sm`,onClick:ft.onSelect,disabled:ft.disabled,children:`Upload images`}),ht,s?(0,Z.jsx)(`div`,{className:`prints-image-setup`,children:u}):null]}):null,(0,Z.jsxs)(`div`,{className:`prints-composer-dock`,children:[(0,Z.jsx)(`section`,{"aria-label":`Computer uploads`,className:`prints-uploads`,children:(0,Z.jsx)(`input`,{ref:De,type:`file`,disabled:!M||C===null,accept:`image/*`,multiple:!0,hidden:!0,"aria-label":`Choose images to upload`,onChange:e=>{ee(Array.from(e.currentTarget.files??[])),e.currentTarget.value=``}})}),i?null:(0,Z.jsx)(Cte,{addedLength:Ve?.kind===`audio`?0:pK(Ie.prompt,ue.styles.find(e=>e.name===Ie.style)?.text,de.characters),styleControls:e=>({picker:(0,Z.jsx)(ste,{styles:ue.styles,selected:Ie.style,disabled:!be||_e||ze,onSelect:e=>{Ne.setFieldValue(`style`,e)}}),dialog:(0,Z.jsx)(X9,{active:e.open,children:(0,Z.jsx)(lte,{open:e.open,onOpenChange:e.onOpenChange,styles:ue.styles,selected:Ie.style,busy:ue.busy,error:ue.error,onSelect:e=>{Ne.setFieldValue(`style`,e)},onSave:ue.save,onDelete:(e,t)=>{ue.remove(e.id,t)}})})}),characters:de.characters,characterDialog:e=>(0,Z.jsx)(X9,{active:e.open,children:(0,Z.jsx)(ute,{open:e.open,onOpenChange:e.onOpenChange,characters:de.characters,images:lt,busy:de.busy,error:de.error,canUpload:M&&C!==null,onUpload:()=>De.current?.click(),onSave:de.save,onDelete:(e,t)=>{de.remove(e.id,t)}})}),guidance:it.find(e=>e.blocking&&e.group===`Setup`)??(ke!==null&&ke.model===Ie.model?{key:`iteration-model`,group:`Images`,tone:`warning`,short:`Model changed`,title:`Model changed`,detail:ke.message,actions:[{label:`Dismiss`,run:()=>{Ae(null)}}]}:void 0),commandApp:Be,actions:(0,Z.jsx)(zJ,{"aria-label":`Upload images`,title:M?`Upload images to Computer`:`Connect a writable Computer to upload`,icon:(0,Z.jsx)(ZI,{}),label:null,className:`prints-upload-key`,disabled:!M||C===null,onClick:()=>De.current?.click()}),form:Ne,mediaCapability:be&&ye&&M&&C!==null,models:ge,modelsLoading:_e,onSubmit:Ne.submitCurrent,submitting:ze,generateLimitReason:me.atLimit?pW:void 0,values:Ie,computerId:r.computerId,mediaDirectory:C,referenceImages:lt,referenceLabels:Le,price:Re}),ct===null?null:(0,Z.jsx)(X9,{active:d,children:(0,Z.jsx)(cte,{notices:it,uploads:ot,open:d,inset:p,onOpenChange:f,onDismiss:h.dismiss,onDismissAll:()=>{h.dismissAll(rt)},onLoadMore:me.hasMore?me.loadMore:void 0})})]}),r.editing?(0,Z.jsx)(G.Suspense,{fallback:null,children:(0,Z.jsx)(_te,{folder:r})}):null]})}var $9=document.getElementById(`media-root`);if(!$9)throw Error(`Media root is missing`);wN($9,{name:`Prints`,queryClient:tP()},({app:e})=>(0,G.createElement)(wte,{connection:e?{app:e}:null}));export{N2 as $,qI as $n,M_ as $r,cX as $t,s6 as A,d as Ai,UH as An,nS as Ar,L$ as At,m4 as B,lH as Bn,dS as Br,E$ as Bt,F6 as C,no as Ci,cW as Cn,Uw as Cr,x1 as Ct,E6 as D,eo as Di,XU as Dn,X as Dr,J$ as Dt,w6 as E,Ra as Ei,oW as En,gC as Er,X$ as Et,V4 as F,DH as Fn,eS as Fr,N$ as Ft,j2 as G,UR as Gn,Hx as Gr,mZ as Gt,Y2 as H,XV as Hn,pS as Hr,gZ as Ht,T4 as I,EH as In,J as Ir,A$ as It,M2 as J,jR as Jn,L_ as Jr,nZ as Jt,P2 as K,LR as Kn,z_ as Kr,rZ as Kt,C4 as L,SH as Ln,VS as Lr,k$ as Lt,q3 as M,l as Mi,NH as Mn,Qx as Mr,z$ as Mt,K3 as N,IH as Nn,lS as Nr,q$ as Nt,T6 as O,U as Oi,vU as On,lC as Or,H$ as Ot,G3 as P,TH as Pn,iS as Pr,M$ as Pt,H2 as Q,YI as Qn,P_ as Qr,WX as Qt,h4 as R,fH as Rn,$x as Rr,O$ as Rt,z6 as S,fa as Si,pW as Sn,Jw as Sr,R1 as St,C6 as T,Qa as Ti,uW as Tn,vC as Tr,w1 as Tt,X2 as U,YV as Un,Ux as Ur,_Z as Ut,a4 as V,ZV as Vn,Gx as Vr,$ as Vt,W2 as W,UV as Wn,hS as Wr,hZ as Wt,B2 as X,QI as Xn,F_ as Xr,tZ as Xt,L2 as Y,aL as Yn,j_ as Yr,iZ as Yt,V2 as Z,ZI as Zn,B_ as Zr,HX as Zt,f5 as _,La as _i,gG as _n,iP as _r,r0 as _t,w9 as a,kd as ai,zJ as an,RI as ar,y2 as at,O8 as b,No as bi,tG as bn,ON as br,X1 as bt,c7 as c,Nd as ci,EJ as cn,PI as cr,s2 as ct,V5 as d,Za as di,Mq as dn,jI as dr,J0 as dt,V_ as ei,qY as en,KI as er,U2 as et,q5 as f,Va as fi,AK as fn,AI as fr,A0 as ft,m5 as g,Co as gi,hG as gn,RF as gr,h0 as gt,P5 as h,ho as hi,pG as hn,TF as hr,c0 as ht,T9 as i,Oy as ii,GJ as in,zI as ir,b2 as it,i6 as j,o as ji,LH as jn,yS as jr,I$ as jt,u6 as k,nr as ki,HH as kn,aS as kr,B$ as kt,t7 as l,Od as li,vJ as ln,NI as lr,e2 as lt,U5 as m,po as mi,fG as mn,sI as mr,l0 as mt,W9 as n,qy as ni,nY as nn,HI as nr,k2 as nt,S9 as o,Md as oi,LJ as on,II as or,c2 as ot,Y5 as p,To as pi,rK as pn,DI as pr,s0 as pt,R2 as q,Q as qn,I_ as qr,aZ as qt,U9 as r,Ky as ri,$J as rn,BI as rr,C2 as rt,S7 as s,Dd as si,kJ as sn,FI as sr,l2 as st,G9 as t,Gy as ti,MY as tn,UI as tr,z2 as tt,s7 as u,Ad as ui,gJ as un,MI as ur,K0 as ut,d5 as v,$a as vi,mG as vn,nP as vr,n0 as vt,D6 as w,mo as wi,lW as wn,Vw as wr,C1 as wt,D8 as x,ma as xi,eG as xn,eT as xr,G1 as xt,t5 as y,yo as yi,gW as yn,$N as yr,$1 as yt,c4 as z,dH as zn,sS as zr,D$ as zt};