@fungi.computer/prints 0.20.25 → 0.20.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/{arrow-right-OARGllYn.js → arrow-right-Cy8xAvFU.js} +1 -1
- package/dist/assets/{data-list-BKnOm38M.js → data-list-CH05Kqw_.js} +1 -1
- package/dist/assets/{dialog-BZ61MAZB.js → dialog-CweIwVtU.js} +1 -1
- package/dist/assets/{images-DQ4iT8XG.js → images-DUuen-gA.js} +1 -1
- package/dist/assets/index-Ccy_AgSm.css +2 -0
- package/dist/assets/index-zjWjCUt7.js +85 -0
- package/dist/assets/{library-dialogs-CMyC51Mx.js → library-dialogs-Csei16Ij.js} +2 -2
- package/dist/assets/library-folders-dialog-BJNQFVME.js +1 -0
- package/dist/assets/{library-rail-CwaMUE8m.js → library-rail-Bv6CJHTX.js} +1 -1
- package/dist/assets/{print-download-button-Cb8rlgOl.js → print-download-button-D2HRFcBm.js} +1 -1
- package/dist/assets/{print-info-drawer-C3j6eKaQ.js → print-info-drawer-ClagKCnR.js} +2 -2
- package/dist/assets/{print-viewer-Cu6ATcQJ.js → print-viewer-BN9Xq85Y.js} +2 -2
- package/dist/assets/{prints-activity-tray-CuwXtIBN.js → prints-activity-tray-B_d8CifY.js} +1 -1
- package/dist/assets/{prints-folder-dialog-CY6IWH42.js → prints-folder-dialog-B4dKHnjl.js} +1 -1
- package/dist/assets/{prompt-character-controls-CPUNyX8u.js → prompt-character-controls-CG5JFMgW.js} +1 -1
- package/dist/assets/{prompt-styles-dialog-Bn9o2wRf.js → prompt-styles-dialog-DqdIT7bt.js} +1 -1
- package/dist/assets/{reference-lightbox-scBjj8tk.js → reference-lightbox-CLpNtWiA.js} +1 -1
- package/dist/assets/{rotate-ccw-DH8lePtF.js → rotate-ccw-C9yz_p_u.js} +1 -1
- package/dist/assets/{upload-queue-hWBGHaYu.js → upload-queue-BMYIWvD0.js} +1 -1
- package/dist/index.html +2 -2
- package/package.json +4 -4
- package/dist/assets/index-BNKONPP9.js +0 -85
- package/dist/assets/index-CBqoCdZU.css +0 -2
- package/dist/assets/library-folders-dialog-BbcwRIZr.js +0 -1
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./prints-activity-tray-B_d8CifY.js","./data-list-CH05Kqw_.js","./upload-queue-BMYIWvD0.js","./rotate-ccw-C9yz_p_u.js","./prompt-styles-dialog-DqdIT7bt.js","./dialog-CweIwVtU.js","./prompt-character-controls-CG5JFMgW.js","./reference-lightbox-CLpNtWiA.js","./arrow-right-Cy8xAvFU.js","./library-dialogs-Csei16Ij.js","./library-folders-dialog-BJNQFVME.js","./library-rail-Bv6CJHTX.js","./images-DUuen-gA.js","./print-viewer-BN9Xq85Y.js","./prints-folder-dialog-B4dKHnjl.js","./print-info-drawer-ClagKCnR.js"])))=>i.map(i=>d[i]);
|
|
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
|
+
`).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
|
+
`))}},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(`
|
|
5
|
+
if (${n}.issues.length) {
|
|
6
|
+
if (${o} in input) {
|
|
7
|
+
payload.issues = payload.issues.concat(${n}.issues.map(iss => ({
|
|
8
|
+
...iss,
|
|
9
|
+
path: iss.path ? [${o}, ...iss.path] : [${o}]
|
|
10
|
+
})));
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
if (${n}.value === undefined) {
|
|
15
|
+
if (${o} in input) {
|
|
16
|
+
newResult[${o}] = undefined;
|
|
17
|
+
}
|
|
18
|
+
} else {
|
|
19
|
+
newResult[${o}] = ${n}.value;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
`):c?t.write(`
|
|
23
|
+
if (${n}.issues.length) {
|
|
24
|
+
payload.issues = payload.issues.concat(${n}.issues.map(iss => ({
|
|
25
|
+
...iss,
|
|
26
|
+
path: iss.path ? [${o}, ...iss.path] : [${o}]
|
|
27
|
+
})));
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
if (${n}.value === undefined) {
|
|
31
|
+
if (${o} in input) {
|
|
32
|
+
newResult[${o}] = undefined;
|
|
33
|
+
}
|
|
34
|
+
} else {
|
|
35
|
+
newResult[${o}] = ${n}.value;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
`):t.write(`
|
|
39
|
+
const ${n}_present = ${o} in input;
|
|
40
|
+
if (${n}.issues.length) {
|
|
41
|
+
payload.issues = payload.issues.concat(${n}.issues.map(iss => ({
|
|
42
|
+
...iss,
|
|
43
|
+
path: iss.path ? [${o}, ...iss.path] : [${o}]
|
|
44
|
+
})));
|
|
45
|
+
}
|
|
46
|
+
if (!${n}_present && !${n}.issues.length) {
|
|
47
|
+
payload.issues.push({
|
|
48
|
+
code: "invalid_type",
|
|
49
|
+
expected: "nonoptional",
|
|
50
|
+
input: undefined,
|
|
51
|
+
path: [${o}]
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
if (${n}_present) {
|
|
56
|
+
if (${n}.value === undefined) {
|
|
57
|
+
newResult[${o}] = undefined;
|
|
58
|
+
} else {
|
|
59
|
+
newResult[${o}] = ${n}.value;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
`)}t.write(`payload.value = newResult;`),t.write(`return payload;`);let s=t.compile();return(t,n)=>s(e,t,n)},a,o=j,s=!g.jitless,c=s&&M.value,l=t.catchall,u;e._zod.parse=(d,f)=>{u??=r.value;let p=d.value;return o(p)?s&&c&&f?.async===!1&&f.jitless!==!0?(a||=i(t.shape),d=a(d,f),l?_n([],p,d,f,u,e):d):n(d,f):(d.issues.push({expected:`object`,code:`invalid_type`,input:p,inst:e}),d)}});function bn(e,t,n,r){for(let n of e)if(n.issues.length===0)return t.value=n.value,t;let i=e.filter(e=>!ae(e));return i.length===1?(t.value=i[0].value,i[0]):(t.issues.push({code:`invalid_union`,input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>le(e,r,_())))}),t)}var xn=p(`$ZodUnion`,(e,t)=>{At.init(e,t),T(e._zod,`optin`,()=>t.options.some(e=>e._zod.optin===`optional`)?`optional`:void 0),T(e._zod,`optout`,()=>t.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),T(e._zod,`values`,()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),T(e._zod,`pattern`,()=>{if(t.options.every(e=>e._zod.pattern)){let e=t.options.map(e=>e._zod.pattern);return RegExp(`^(${e.map(e=>S(e.source)).join(`|`)})$`)}});let n=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(r,i)=>{if(n)return n(r,i);let a=!1,o=[];for(let e of t.options){let t=e._zod.run({value:r.value,issues:[]},i);if(t instanceof Promise)o.push(t),a=!0;else{if(t.issues.length===0)return t;o.push(t)}}return a?Promise.all(o).then(t=>bn(t,r,e,i)):bn(o,r,e,i)}}),Sn=p(`$ZodDiscriminatedUnion`,(e,t)=>{t.inclusive=!1,xn.init(e,t);let n=e._zod.parse;T(e._zod,`propValues`,()=>{let e={};for(let n of t.options){let r=n._zod.propValues;if(!r||Object.keys(r).length===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(n)}"`);for(let[t,n]of Object.entries(r)){e[t]||(e[t]=new Set);for(let r of n)e[t].add(r)}}return e});let r=b(()=>{let e=t.options,n=new Map;for(let r of e){let e=r._zod.propValues?.[t.discriminator];if(!e||e.size===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(r)}"`);for(let t of e){if(n.has(t))throw Error(`Duplicate discriminator value "${String(t)}"`);n.set(t,r)}}return n});e._zod.parse=(i,a)=>{let o=i.value;if(!j(o))return i.issues.push({code:`invalid_type`,expected:`object`,input:o,inst:e}),i;let s=r.value.get(o?.[t.discriminator]);return s?s._zod.run(i,a):t.unionFallback||a.direction===`backward`?n(i,a):(i.issues.push({code:`invalid_union`,errors:[],note:`No matching discriminator`,discriminator:t.discriminator,options:Array.from(r.value.keys()),input:o,path:[t.discriminator],inst:e}),i)}}),Cn=p(`$ZodIntersection`,(e,t)=>{At.init(e,t),e._zod.parse=(e,n)=>{let r=e.value,i=t.left._zod.run({value:r,issues:[]},n),a=t.right._zod.run({value:r,issues:[]},n);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([t,n])=>Tn(e,t,n)):Tn(e,i,a)}});function wn(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(N(e)&&N(t)){let n=Object.keys(t),r=Object.keys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};for(let n of r){let r=wn(e[n],t[n]);if(!r.valid)return{valid:!1,mergeErrorPath:[n,...r.mergeErrorPath]};i[n]=r.data}return{valid:!0,data:i}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let n=[];for(let r=0;r<e.length;r++){let i=e[r],a=t[r],o=wn(i,a);if(!o.valid)return{valid:!1,mergeErrorPath:[r,...o.mergeErrorPath]};n.push(o.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function Tn(e,t,n){let r=new Map,i;for(let n of t.issues)if(n.code===`unrecognized_keys`){i??=n;for(let e of n.keys)r.has(e)||r.set(e,{}),r.get(e).l=!0}else e.issues.push(n);for(let t of n.issues)if(t.code===`unrecognized_keys`)for(let e of t.keys)r.has(e)||r.set(e,{}),r.get(e).r=!0;else e.issues.push(t);let a=[...r].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(a.length&&i&&e.issues.push({...i,keys:a}),ae(e))return e;let o=wn(t.value,n.value);if(!o.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(o.mergeErrorPath)}`);return e.value=o.data,e}var En=p(`$ZodTuple`,(e,t)=>{At.init(e,t);let n=t.items;e._zod.parse=(r,i)=>{let a=r.value;if(!Array.isArray(a))return r.issues.push({input:a,inst:e,expected:`tuple`,code:`invalid_type`}),r;r.value=[];let o=[],s=Dn(n,`optin`),c=Dn(n,`optout`);if(!t.rest){if(a.length<s)return r.issues.push({code:`too_small`,minimum:s,inclusive:!0,input:a,inst:e,origin:`array`}),r;a.length>n.length&&r.issues.push({code:`too_big`,maximum:n.length,inclusive:!0,input:a,inst:e,origin:`array`})}let l=Array(n.length);for(let e=0;e<n.length;e++){let t=n[e]._zod.run({value:a[e],issues:[]},i);t instanceof Promise?o.push(t.then(t=>{l[e]=t})):l[e]=t}if(t.rest){let e=n.length-1,s=a.slice(n.length);for(let n of s){e++;let a=t.rest._zod.run({value:n,issues:[]},i);a instanceof Promise?o.push(a.then(t=>On(t,r,e))):On(a,r,e)}}return o.length?Promise.all(o).then(()=>kn(l,r,n,a,c)):kn(l,r,n,a,c)}});function Dn(e,t){for(let n=e.length-1;n>=0;n--)if(e[n]._zod[t]!==`optional`)return n+1;return 0}function On(e,t,n){e.issues.length&&t.issues.push(...se(n,e.issues)),t.value[n]=e.value}function kn(e,t,n,r,i){for(let a=0;a<n.length;a++){let n=e[a],o=a<r.length;if(n.issues.length){if(!o&&a>=i){t.value.length=a;break}t.issues.push(...se(a,n.issues))}t.value[a]=n.value}for(let e=t.value.length-1;e>=r.length&&n[e]._zod.optout===`optional`&&t.value[e]===void 0;e--)t.value.length=e;return t}var An=p(`$ZodRecord`,(e,t)=>{At.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!N(i))return n.issues.push({expected:`record`,code:`invalid_type`,input:i,inst:e}),n;let a=[],o=t.keyType._zod.values;if(o){n.value={};let s=new Set;for(let c of o)if(typeof c==`string`||typeof c==`number`||typeof c==`symbol`){s.add(typeof c==`number`?c.toString():c);let o=t.keyType._zod.run({value:c,issues:[]},r);if(o instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(o.issues.length){n.issues.push({code:`invalid_key`,origin:`record`,issues:o.issues.map(e=>le(e,r,_())),input:c,path:[c],inst:e});continue}let l=o.value,u=t.valueType._zod.run({value:i[c],issues:[]},r);u instanceof Promise?a.push(u.then(e=>{e.issues.length&&n.issues.push(...se(c,e.issues)),n.value[l]=e.value})):(u.issues.length&&n.issues.push(...se(c,u.issues)),n.value[l]=u.value)}let c;for(let e in i)s.has(e)||(c??=[],c.push(e));c&&c.length>0&&n.issues.push({code:`unrecognized_keys`,input:i,inst:e,keys:c})}else{n.value={};for(let o of Reflect.ownKeys(i)){if(o===`__proto__`||!Object.prototype.propertyIsEnumerable.call(i,o))continue;let s=t.keyType._zod.run({value:o,issues:[]},r);if(s instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(typeof o==`string`&&ot.test(o)&&s.issues.length){let e=t.keyType._zod.run({value:Number(o),issues:[]},r);if(e instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);e.issues.length===0&&(s=e)}if(s.issues.length){t.mode===`loose`?n.value[o]=i[o]:n.issues.push({code:`invalid_key`,origin:`record`,issues:s.issues.map(e=>le(e,r,_())),input:o,path:[o],inst:e});continue}let c=t.valueType._zod.run({value:i[o],issues:[]},r);c instanceof Promise?a.push(c.then(e=>{e.issues.length&&n.issues.push(...se(o,e.issues)),n.value[s.value]=e.value})):(c.issues.length&&n.issues.push(...se(o,c.issues)),n.value[s.value]=c.value)}}return a.length?Promise.all(a).then(()=>n):n}}),jn=p(`$ZodEnum`,(e,t)=>{At.init(e,t);let n=v(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=RegExp(`^(${n.filter(e=>F.has(typeof e)).map(e=>typeof e==`string`?I(e):e.toString()).join(`|`)})$`),e._zod.parse=(t,i)=>{let a=t.value;return r.has(a)||t.issues.push({code:`invalid_value`,values:n,input:a,inst:e}),t}}),Mn=p(`$ZodLiteral`,(e,t)=>{if(At.init(e,t),t.values.length===0)throw Error(`Cannot create literal schema with no valid values`);let n=new Set(t.values);e._zod.values=n,e._zod.pattern=RegExp(`^(${t.values.map(e=>typeof e==`string`?I(e):e?I(e.toString()):String(e)).join(`|`)})$`),e._zod.parse=(r,i)=>{let a=r.value;return n.has(a)||r.issues.push({code:`invalid_value`,values:t.values,input:a,inst:e}),r}}),Nn=p(`$ZodTransform`,(e,t)=>{At.init(e,t),e._zod.optin=`optional`,e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new h(e.constructor.name);let i=t.transform(n.value,n);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then(e=>(n.value=e,n.fallback=!0,n));if(i instanceof Promise)throw new m;return n.value=i,n.fallback=!0,n}});function Pn(e,t){return t===void 0&&(e.issues.length||e.fallback)?{issues:[],value:void 0}:e}var Fn=p(`$ZodOptional`,(e,t)=>{At.init(e,t),e._zod.optin=`optional`,e._zod.optout=`optional`,T(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),T(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${S(e.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if(t.innerType._zod.optin===`optional`){let r=e.value,i=t.innerType._zod.run(e,n);return i instanceof Promise?i.then(e=>Pn(e,r)):Pn(i,r)}return e.value===void 0?e:t.innerType._zod.run(e,n)}}),In=p(`$ZodExactOptional`,(e,t)=>{Fn.init(e,t),T(e._zod,`values`,()=>t.innerType._zod.values),T(e._zod,`pattern`,()=>t.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),Ln=p(`$ZodNullable`,(e,t)=>{At.init(e,t),T(e._zod,`optin`,()=>t.innerType._zod.optin),T(e._zod,`optout`,()=>t.innerType._zod.optout),T(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${S(e.source)}|null)$`):void 0}),T(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(e,n)=>e.value===null?e:t.innerType._zod.run(e,n)}),Rn=p(`$ZodDefault`,(e,t)=>{At.init(e,t),e._zod.optin=`optional`,T(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);if(e.value===void 0)return e.value=t.defaultValue,e;let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(e=>zn(e,t)):zn(r,t)}});function zn(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var Bn=p(`$ZodPrefault`,(e,t)=>{At.init(e,t),e._zod.optin=`optional`,T(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>(n.direction===`backward`||e.value===void 0&&(e.value=t.defaultValue),t.innerType._zod.run(e,n))}),Vn=p(`$ZodNonOptional`,(e,t)=>{At.init(e,t),T(e._zod,`values`,()=>{let e=t.innerType._zod.values;return e?new Set([...e].filter(e=>e!==void 0)):void 0}),e._zod.parse=(n,r)=>{let i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(t=>Hn(t,e)):Hn(i,e)}});function Hn(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:`invalid_type`,expected:`nonoptional`,input:e.value,inst:t}),e}var Un=p(`$ZodCatch`,(e,t)=>{At.init(e,t),e._zod.optin=`optional`,T(e._zod,`optout`,()=>t.innerType._zod.optout),T(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(r=>(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>le(e,n,_()))},input:e.value}),e.issues=[],e.fallback=!0),e)):(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>le(e,n,_()))},input:e.value}),e.issues=[],e.fallback=!0),e)}}),Wn=p(`$ZodPipe`,(e,t)=>{At.init(e,t),T(e._zod,`values`,()=>t.in._zod.values),T(e._zod,`optin`,()=>t.in._zod.optin),T(e._zod,`optout`,()=>t.out._zod.optout),T(e._zod,`propValues`,()=>t.in._zod.propValues),e._zod.parse=(e,n)=>{if(n.direction===`backward`){let r=t.out._zod.run(e,n);return r instanceof Promise?r.then(e=>Gn(e,t.in,n)):Gn(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>Gn(e,t.out,n)):Gn(r,t.out,n)}});function Gn(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues,fallback:e.fallback},n)}var Kn=p(`$ZodReadonly`,(e,t)=>{At.init(e,t),T(e._zod,`propValues`,()=>t.innerType._zod.propValues),T(e._zod,`values`,()=>t.innerType._zod.values),T(e._zod,`optin`,()=>t.innerType?._zod?.optin),T(e._zod,`optout`,()=>t.innerType?._zod?.optout),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(qn):qn(r)}});function qn(e){return e.value=Object.freeze(e.value),e}var Jn=p(`$ZodFunction`,(e,t)=>(At.init(e,t),e._def=t,e._zod.def=t,e.implement=t=>{if(typeof t!=`function`)throw Error(`implement() must be called with a function`);return function(...n){let r=e._def.input?ve(e._def.input,n):n,i=Reflect.apply(t,this,r);return e._def.output?ve(e._def.output,i):i}},e.implementAsync=t=>{if(typeof t!=`function`)throw Error(`implementAsync() must be called with a function`);return async function(...n){let r=e._def.input?await be(e._def.input,n):n,i=await Reflect.apply(t,this,r);return e._def.output?await be(e._def.output,i):i}},e._zod.parse=(t,n)=>typeof t.value==`function`?(t.value=e._def.output&&e._def.output._zod.def.type===`promise`?e.implementAsync(t.value):e.implement(t.value),t):(t.issues.push({code:`invalid_type`,expected:`function`,input:t.value,inst:e}),t),e.input=(...t)=>{let n=e.constructor;return Array.isArray(t[0])?new n({type:`function`,input:new En({type:`tuple`,items:t[0],rest:t[1]}),output:e._def.output}):new n({type:`function`,input:t[0],output:e._def.output})},e.output=t=>{let n=e.constructor;return new n({type:`function`,input:e._def.input,output:t})},e)),Yn=p(`$ZodPromise`,(e,t)=>{At.init(e,t),e._zod.parse=(e,n)=>Promise.resolve(e.value).then(e=>t.innerType._zod.run({value:e,issues:[]},n))}),Xn=p(`$ZodLazy`,(e,t)=>{At.init(e,t),T(e._zod,`innerType`,()=>{let e=t;return e._cachedInner||=t.getter(),e._cachedInner}),T(e._zod,`pattern`,()=>e._zod.innerType?._zod?.pattern),T(e._zod,`propValues`,()=>e._zod.innerType?._zod?.propValues),T(e._zod,`optin`,()=>e._zod.innerType?._zod?.optin??void 0),T(e._zod,`optout`,()=>e._zod.innerType?._zod?.optout??void 0),e._zod.parse=(t,n)=>e._zod.innerType._zod.run(t,n)}),Zn=p(`$ZodCustom`,(e,t)=>{dt.init(e,t),At.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{let r=n.value,i=t.fn(r);if(i instanceof Promise)return i.then(t=>Qn(t,n,r,e));Qn(i,n,r,e)}});function Qn(e,t,n,r){if(!e){let e={code:`custom`,input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(e.params=r._zod.def.params),t.issues.push(de(e))}}var $n,er=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let n=t[0];return this._map.set(e,n),n&&typeof n==`object`&&`id`in n&&this._idmap.set(n.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);return t&&typeof t==`object`&&`id`in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let n={...this.get(t)??{}};delete n.id;let r={...n,...this._map.get(e)};return Object.keys(r).length?r:void 0}return this._map.get(e)}has(e){return this._map.has(e)}};function tr(){return new er}($n=globalThis).__zod_globalRegistry??($n.__zod_globalRegistry=tr());var nr=globalThis.__zod_globalRegistry;function rr(e,t){return new e({type:`string`,...R(t)})}function ir(e,t){return new e({type:`string`,format:`email`,check:`string_format`,abort:!1,...R(t)})}function ar(e,t){return new e({type:`string`,format:`guid`,check:`string_format`,abort:!1,...R(t)})}function or(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,...R(t)})}function sr(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v4`,...R(t)})}function cr(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v6`,...R(t)})}function lr(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v7`,...R(t)})}function ur(e,t){return new e({type:`string`,format:`url`,check:`string_format`,abort:!1,...R(t)})}function dr(e,t){return new e({type:`string`,format:`emoji`,check:`string_format`,abort:!1,...R(t)})}function fr(e,t){return new e({type:`string`,format:`nanoid`,check:`string_format`,abort:!1,...R(t)})}function pr(e,t){return new e({type:`string`,format:`cuid`,check:`string_format`,abort:!1,...R(t)})}function mr(e,t){return new e({type:`string`,format:`cuid2`,check:`string_format`,abort:!1,...R(t)})}function hr(e,t){return new e({type:`string`,format:`ulid`,check:`string_format`,abort:!1,...R(t)})}function gr(e,t){return new e({type:`string`,format:`xid`,check:`string_format`,abort:!1,...R(t)})}function _r(e,t){return new e({type:`string`,format:`ksuid`,check:`string_format`,abort:!1,...R(t)})}function vr(e,t){return new e({type:`string`,format:`ipv4`,check:`string_format`,abort:!1,...R(t)})}function yr(e,t){return new e({type:`string`,format:`ipv6`,check:`string_format`,abort:!1,...R(t)})}function br(e,t){return new e({type:`string`,format:`cidrv4`,check:`string_format`,abort:!1,...R(t)})}function xr(e,t){return new e({type:`string`,format:`cidrv6`,check:`string_format`,abort:!1,...R(t)})}function Sr(e,t){return new e({type:`string`,format:`base64`,check:`string_format`,abort:!1,...R(t)})}function Cr(e,t){return new e({type:`string`,format:`base64url`,check:`string_format`,abort:!1,...R(t)})}function wr(e,t){return new e({type:`string`,format:`e164`,check:`string_format`,abort:!1,...R(t)})}function Tr(e,t){return new e({type:`string`,format:`jwt`,check:`string_format`,abort:!1,...R(t)})}function Er(e,t){return new e({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null,...R(t)})}function Dr(e,t){return new e({type:`string`,format:`date`,check:`string_format`,...R(t)})}function Or(e,t){return new e({type:`string`,format:`time`,check:`string_format`,precision:null,...R(t)})}function kr(e,t){return new e({type:`string`,format:`duration`,check:`string_format`,...R(t)})}function Ar(e,t){return new e({type:`number`,checks:[],...R(t)})}function jr(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`safeint`,...R(t)})}function Mr(e,t){return new e({type:`boolean`,...R(t)})}function Nr(e,t){return new e({type:`null`,...R(t)})}function Pr(e){return new e({type:`unknown`})}function Fr(e,t){return new e({type:`never`,...R(t)})}function Ir(e,t){return new e({type:`void`,...R(t)})}function Lr(e,t){return new pt({check:`less_than`,...R(t),value:e,inclusive:!1})}function Rr(e,t){return new pt({check:`less_than`,...R(t),value:e,inclusive:!0})}function zr(e,t){return new mt({check:`greater_than`,...R(t),value:e,inclusive:!1})}function Br(e,t){return new mt({check:`greater_than`,...R(t),value:e,inclusive:!0})}function Vr(e,t){return new ht({check:`multiple_of`,...R(t),value:e})}function Hr(e,t){return new _t({check:`max_length`,...R(t),maximum:e})}function Ur(e,t){return new vt({check:`min_length`,...R(t),minimum:e})}function Wr(e,t){return new yt({check:`length_equals`,...R(t),length:e})}function Gr(e,t){return new xt({check:`string_format`,format:`regex`,...R(t),pattern:e})}function Kr(e){return new St({check:`string_format`,format:`lowercase`,...R(e)})}function qr(e){return new Ct({check:`string_format`,format:`uppercase`,...R(e)})}function Jr(e,t){return new wt({check:`string_format`,format:`includes`,...R(t),includes:e})}function Yr(e,t){return new Tt({check:`string_format`,format:`starts_with`,...R(t),prefix:e})}function Xr(e,t){return new Et({check:`string_format`,format:`ends_with`,...R(t),suffix:e})}function Zr(e){return new Dt({check:`overwrite`,tx:e})}function Qr(e){return Zr(t=>t.normalize(e))}function $r(){return Zr(e=>e.trim())}function ei(){return Zr(e=>e.toLowerCase())}function ti(){return Zr(e=>e.toUpperCase())}function ni(){return Zr(e=>k(e))}function ri(e,t,n){return new e({type:`array`,element:t,...R(n)})}function ii(e,t,n){let r=R(n);return r.abort??=!0,new e({type:`custom`,check:`custom`,fn:t,...r})}function ai(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,...R(n)})}function oi(e,t){let n=si(t=>(t.addIssue=e=>{if(typeof e==`string`)t.issues.push(de(e,t.value,n._zod.def));else{let r=e;r.fatal&&(r.continue=!1),r.code??=`custom`,r.input??=t.value,r.inst??=n,r.continue??=!n._zod.def.abort,t.issues.push(de(r))}},e(t.value,t)),t);return n}function si(e,t){let n=new dt({check:`custom`,...R(t)});return n._zod.check=e,n}function ci(e){let t=e?.target??`draft-2020-12`;return t===`draft-4`&&(t=`draft-04`),t===`draft-7`&&(t=`draft-07`),{processors:e.processors??{},metadataRegistry:e?.metadata??nr,target:t,unrepresentable:e?.unrepresentable??`throw`,override:e?.override??(()=>{}),io:e?.io??`output`,counter:0,seen:new Map,cycles:e?.cycles??`ref`,reused:e?.reused??`inline`,external:e?.external??void 0}}function li(e,t,n={path:[],schemaPath:[]}){var r;let i=e._zod.def,a=t.seen.get(e);if(a)return a.count++,n.schemaPath.includes(e)&&(a.cycle=n.path),a.schema;let o={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,o);let s=e._zod.toJSONSchema?.();if(s)o.schema=s;else{let r={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,o.schema,r);else{let n=o.schema,a=t.processors[i.type];if(!a)throw Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);a(e,t,n,r)}let a=e._zod.parent;a&&(o.ref||=a,li(a,t,r),t.seen.get(a).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&Object.assign(o.schema,c),t.io===`input`&&fi(e)&&(delete o.schema.examples,delete o.schema.default),t.io===`input`&&`_prefault`in o.schema&&((r=o.schema).default??(r.default=o.schema._prefault)),delete o.schema._prefault,t.seen.get(e).schema}function ui(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=new Map;for(let t of e.seen.entries()){let n=e.metadataRegistry.get(t[0])?.id;if(n){let e=r.get(n);if(e&&e!==t[0])throw Error(`Duplicate schema id "${n}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(n,t[0])}}let i=t=>{let r=e.target===`draft-2020-12`?`$defs`:`definitions`;if(e.external){let n=e.external.registry.get(t[0])?.id,i=e.external.uri??(e=>e);if(n)return{ref:i(n)};let a=t[1].defId??t[1].schema.id??`schema${e.counter++}`;return t[1].defId=a,{defId:a,ref:`${i(`__shared`)}#/${r}/${a}`}}if(t[1]===n)return{ref:`#`};let i=`#/${r}/`,a=t[1].schema.id??`__schema${e.counter++}`;return{defId:a,ref:i+a}},a=e=>{if(e[1].schema.$ref)return;let t=e[1],{ref:n,defId:r}=i(e);t.def={...t.schema},r&&(t.defId=r);let a=t.schema;for(let e in a)delete a[e];a.$ref=n};if(e.cycles===`throw`)for(let t of e.seen.entries()){let e=t[1];if(e.cycle)throw Error(`Cycle detected: #/${e.cycle?.join(`/`)}/<root>
|
|
64
|
+
|
|
65
|
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let n of e.seen.entries()){let r=n[1];if(t===n[0]){a(n);continue}if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}if(e.metadataRegistry.get(n[0])?.id){a(n);continue}if(r.cycle){a(n);continue}if(r.count>1&&e.reused===`ref`){a(n);continue}}}function di(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=t=>{let n=e.seen.get(t);if(n.ref===null)return;let i=n.def??n.schema,a={...i},o=n.ref;if(n.ref=null,o){r(o);let n=e.seen.get(o),s=n.schema;if(s.$ref&&(e.target===`draft-07`||e.target===`draft-04`||e.target===`openapi-3.0`)?(i.allOf=i.allOf??[],i.allOf.push(s)):Object.assign(i,s),Object.assign(i,a),t._zod.parent===o)for(let e in i)e!==`$ref`&&e!==`allOf`&&(e in a||delete i[e]);if(s.$ref&&n.def)for(let e in i)e!==`$ref`&&e!==`allOf`&&e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}let s=t._zod.parent;if(s&&s!==o){r(s);let t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)e!==`$ref`&&e!==`allOf`&&e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};for(let t of[...e.seen.entries()].reverse())r(t[0]);let i={};if(e.target===`draft-2020-12`?i.$schema=`https://json-schema.org/draft/2020-12/schema`:e.target===`draft-07`?i.$schema=`http://json-schema.org/draft-07/schema#`:e.target===`draft-04`?i.$schema=`http://json-schema.org/draft-04/schema#`:e.target,e.external?.uri){let n=e.external.registry.get(t)?.id;if(!n)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}Object.assign(i,n.def??n.schema);let a=e.metadataRegistry.get(t)?.id;a!==void 0&&i.id===a&&delete i.id;let o=e.external?.defs??{};for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,o[e.defId]=e.def)}e.external||Object.keys(o).length>0&&(e.target===`draft-2020-12`?i.$defs=o:i.definitions=o);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,"~standard",{value:{...t[`~standard`],jsonSchema:{input:mi(t,`input`,e.processors),output:mi(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function fi(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;if(r.type===`transform`)return!0;if(r.type===`array`)return fi(r.element,n);if(r.type===`set`)return fi(r.valueType,n);if(r.type===`lazy`)return fi(r.getter(),n);if(r.type===`promise`||r.type===`optional`||r.type===`nonoptional`||r.type===`nullable`||r.type===`readonly`||r.type==="default"||r.type===`prefault`)return fi(r.innerType,n);if(r.type===`intersection`)return fi(r.left,n)||fi(r.right,n);if(r.type===`record`||r.type===`map`)return fi(r.keyType,n)||fi(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:fi(r.in,n)||fi(r.out,n);if(r.type===`object`){for(let e in r.shape)if(fi(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(fi(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(fi(e,n))return!0;return!!(r.rest&&fi(r.rest,n))}return!1}var pi=(e,t={})=>n=>{let r=ci({...n,processors:t});return li(e,r),ui(r,e),di(r,e)},mi=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=ci({...i??{},target:a,io:t,processors:n});return li(e,o),ui(o,e),di(o,e)},hi={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},gi=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l}=e._zod.bag;if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=hi[s]??s,i.format===``&&delete i.format,s===`time`&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c];e.length===1?i.pattern=e[0].source:e.length>1&&(i.allOf=[...e.map(e=>({...t.target===`draft-07`||t.target===`draft-04`||t.target===`openapi-3.0`?{type:`string`}:{},pattern:e.source}))])}},_i=(e,t,n,r)=>{let i=n,{minimum:a,maximum:o,format:s,multipleOf:c,exclusiveMaximum:l,exclusiveMinimum:u}=e._zod.bag;i.type=typeof s==`string`&&s.includes(`int`)?`integer`:`number`;let d=typeof u==`number`&&u>=(a??-1/0),f=typeof l==`number`&&l<=(o??1/0),p=t.target===`draft-04`||t.target===`openapi-3.0`;d?p?(i.minimum=u,i.exclusiveMinimum=!0):i.exclusiveMinimum=u:typeof a==`number`&&(i.minimum=a),f?p?(i.maximum=l,i.exclusiveMaximum=!0):i.exclusiveMaximum=l:typeof o==`number`&&(i.maximum=o),typeof c==`number`&&(i.multipleOf=c)},vi=(e,t,n,r)=>{n.type=`boolean`},yi=(e,t,n,r)=>{t.target===`openapi-3.0`?(n.type=`string`,n.nullable=!0,n.enum=[null]):n.type=`null`},bi=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Void cannot be represented in JSON Schema`)},xi=(e,t,n,r)=>{n.not={}},Si=(e,t,n,r)=>{let i=e._zod.def,a=v(i.entries);a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a},Ci=(e,t,n,r)=>{let i=e._zod.def,a=[];for(let e of i.values)if(e===void 0){if(t.unrepresentable===`throw`)throw Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof e==`bigint`){if(t.unrepresentable===`throw`)throw Error(`BigInt literals cannot be represented in JSON Schema`);a.push(Number(e))}else a.push(e);if(a.length!==0){if(a.length===1){let e=a[0];n.type=e===null?`null`:typeof e,t.target===`draft-04`||t.target===`openapi-3.0`?n.enum=[e]:n.const=e}else a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),a.every(e=>typeof e==`boolean`)&&(n.type=`boolean`),a.every(e=>e===null)&&(n.type=`null`),n.enum=a}},wi=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Custom types cannot be represented in JSON Schema`)},Ti=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Function types cannot be represented in JSON Schema`)},Ei=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Transforms cannot be represented in JSON Schema`)},Di=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=e._zod.bag;typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=li(a.element,t,{...r,path:[...r.path,`items`]})},Oi=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`,i.properties={};let o=a.shape;for(let e in o)i.properties[e]=li(o[e],t,{...r,path:[...r.path,`properties`,e]});let s=new Set(Object.keys(o)),c=new Set([...s].filter(e=>{let n=a.shape[e]._zod;return t.io===`input`?n.optin===void 0:n.optout===void 0}));c.size>0&&(i.required=Array.from(c)),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=li(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},ki=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>li(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},Ai=(e,t,n,r)=>{let i=e._zod.def,a=li(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=li(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1;n.allOf=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]]},ji=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`array`;let o=t.target===`draft-2020-12`?`prefixItems`:`items`,s=t.target===`draft-2020-12`||t.target===`openapi-3.0`?`items`:`additionalItems`,c=a.items.map((e,n)=>li(e,t,{...r,path:[...r.path,o,n]})),l=a.rest?li(a.rest,t,{...r,path:[...r.path,s,...t.target===`openapi-3.0`?[a.items.length]:[]]}):null;t.target===`draft-2020-12`?(i.prefixItems=c,l&&(i.items=l)):t.target===`openapi-3.0`?(i.items={anyOf:c},l&&i.items.anyOf.push(l),i.minItems=c.length,l||(i.maxItems=c.length)):(i.items=c,l&&(i.additionalItems=l));let{minimum:u,maximum:d}=e._zod.bag;typeof u==`number`&&(i.minItems=u),typeof d==`number`&&(i.maxItems=d)},Mi=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`;let o=a.keyType,s=o._zod.bag?.patterns;if(a.mode===`loose`&&s&&s.size>0){let e=li(a.valueType,t,{...r,path:[...r.path,`patternProperties`,`*`]});i.patternProperties={};for(let t of s)i.patternProperties[t.source]=e}else(t.target===`draft-07`||t.target===`draft-2020-12`)&&(i.propertyNames=li(a.keyType,t,{...r,path:[...r.path,`propertyNames`]})),i.additionalProperties=li(a.valueType,t,{...r,path:[...r.path,`additionalProperties`]});let c=o._zod.values;if(c){let e=[...c].filter(e=>typeof e==`string`||typeof e==`number`);e.length>0&&(i.required=e)}},Ni=(e,t,n,r)=>{let i=e._zod.def,a=li(i.innerType,t,r),o=t.seen.get(e);t.target===`openapi-3.0`?(o.ref=i.innerType,n.nullable=!0):n.anyOf=[a,{type:`null`}]},Pi=(e,t,n,r)=>{let i=e._zod.def;li(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Fi=(e,t,n,r)=>{let i=e._zod.def;li(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.default=JSON.parse(JSON.stringify(i.defaultValue))},Ii=(e,t,n,r)=>{let i=e._zod.def;li(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,t.io===`input`&&(n._prefault=JSON.parse(JSON.stringify(i.defaultValue)))},Li=(e,t,n,r)=>{let i=e._zod.def;li(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{throw Error(`Dynamic catch values are not supported in JSON Schema`)}n.default=o},Ri=(e,t,n,r)=>{let i=e._zod.def,a=i.in._zod.traits.has(`$ZodTransform`),o=t.io===`input`?a?i.out:i.in:i.out;li(o,t,r);let s=t.seen.get(e);s.ref=o},zi=(e,t,n,r)=>{let i=e._zod.def;li(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},Bi=(e,t,n,r)=>{let i=e._zod.def;li(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Vi=(e,t,n,r)=>{let i=e._zod.def;li(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Hi=(e,t,n,r)=>{let i=e._zod.innerType;li(i,t,r);let a=t.seen.get(e);a.ref=i},Ui=p(`ZodISODateTime`,(e,t)=>{Wt.init(e,t),ha.init(e,t)});function Wi(e){return Er(Ui,e)}var Gi=p(`ZodISODate`,(e,t)=>{Gt.init(e,t),ha.init(e,t)});function Ki(e){return Dr(Gi,e)}var qi=p(`ZodISOTime`,(e,t)=>{Kt.init(e,t),ha.init(e,t)});function Ji(e){return Or(qi,e)}var Yi=p(`ZodISODuration`,(e,t)=>{qt.init(e,t),ha.init(e,t)});function Xi(e){return kr(Yi,e)}var Zi=p(`ZodError`,(e,t)=>{pe.init(e,t),e.name=`ZodError`,Object.defineProperties(e,{format:{value:t=>ge(e,t)},flatten:{value:t=>he(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,y,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,y,2)}},isEmpty:{get(){return e.issues.length===0}}})},{Parent:Error}),Qi=_e(Zi),$i=ye(Zi),ea=xe(Zi),ta=Ce(Zi),na=Te(Zi),ra=Ee(Zi),ia=De(Zi),aa=Oe(Zi),oa=ke(Zi),sa=Ae(Zi),ca=je(Zi),la=Me(Zi),ua=new WeakMap;function da(e,t,n){let r=Object.getPrototypeOf(e),i=ua.get(r);if(i||(i=new Set,ua.set(r,i)),!i.has(t)){i.add(t);for(let e in n){let t=n[e];Object.defineProperty(r,e,{configurable:!0,enumerable:!1,get(){let n=t.bind(this);return Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:n}),n},set(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:t})}})}}}var fa=p(`ZodType`,(e,t)=>(At.init(e,t),Object.assign(e[`~standard`],{jsonSchema:{input:mi(e,`input`),output:mi(e,`output`)}}),e.toJSONSchema=pi(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(t,n)=>Qi(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>ea(e,t,n),e.parseAsync=async(t,n)=>$i(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>ta(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>na(e,t,n),e.decode=(t,n)=>ra(e,t,n),e.encodeAsync=async(t,n)=>ia(e,t,n),e.decodeAsync=async(t,n)=>aa(e,t,n),e.safeEncode=(t,n)=>oa(e,t,n),e.safeDecode=(t,n)=>sa(e,t,n),e.safeEncodeAsync=async(t,n)=>ca(e,t,n),e.safeDecodeAsync=async(t,n)=>la(e,t,n),da(e,`ZodType`,{check(...e){let t=this.def;return this.clone(D(t,{checks:[...t.checks??[],...e.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return L(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(Go(e,t))},superRefine(e,t){return this.check(Ko(e,t))},overwrite(e){return this.check(Zr(e))},optional(){return bo(this)},exactOptional(){return So(this)},nullable(){return wo(this)},nullish(){return bo(wo(this))},nonoptional(e){return Ao(this,e)},array(){return Qa(this)},or(e){return ro([this,e])},and(e){return so(this,e)},transform(e){return Po(this,vo(e))},default(e){return Eo(this,e)},prefault(e){return Oo(this,e)},catch(e){return Mo(this,e)},pipe(e){return Po(this,e)},readonly(){return Io(this)},describe(e){let t=this.clone();return nr.add(t,{description:e}),t},meta(...e){if(e.length===0)return nr.get(this);let t=this.clone();return nr.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e){return e(this)}}),Object.defineProperty(e,"description",{get(){return nr.get(e)?.description},configurable:!0}),e)),pa=p(`_ZodString`,(e,t)=>{jt.init(e,t),fa.init(e,t),e._zod.processJSONSchema=(t,n,r)=>gi(e,t,n,r);let n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,da(e,`_ZodString`,{regex(...e){return this.check(Gr(...e))},includes(...e){return this.check(Jr(...e))},startsWith(...e){return this.check(Yr(...e))},endsWith(...e){return this.check(Xr(...e))},min(...e){return this.check(Ur(...e))},max(...e){return this.check(Hr(...e))},length(...e){return this.check(Wr(...e))},nonempty(...e){return this.check(Ur(1,...e))},lowercase(e){return this.check(Kr(e))},uppercase(e){return this.check(qr(e))},trim(){return this.check($r())},normalize(...e){return this.check(Qr(...e))},toLowerCase(){return this.check(ei())},toUpperCase(){return this.check(ti())},slugify(){return this.check(ni())}})}),ma=p(`ZodString`,(e,t)=>{jt.init(e,t),pa.init(e,t),e.email=t=>e.check(ir(ga,t)),e.url=t=>e.check(ur(ba,t)),e.jwt=t=>e.check(Tr(Ia,t)),e.emoji=t=>e.check(dr(Sa,t)),e.guid=t=>e.check(ar(_a,t)),e.uuid=t=>e.check(or(va,t)),e.uuidv4=t=>e.check(sr(va,t)),e.uuidv6=t=>e.check(cr(va,t)),e.uuidv7=t=>e.check(lr(va,t)),e.nanoid=t=>e.check(fr(Ca,t)),e.guid=t=>e.check(ar(_a,t)),e.cuid=t=>e.check(pr(wa,t)),e.cuid2=t=>e.check(mr(Ta,t)),e.ulid=t=>e.check(hr(Ea,t)),e.base64=t=>e.check(Sr(Na,t)),e.base64url=t=>e.check(Cr(Pa,t)),e.xid=t=>e.check(gr(Da,t)),e.ksuid=t=>e.check(_r(Oa,t)),e.ipv4=t=>e.check(vr(ka,t)),e.ipv6=t=>e.check(yr(Aa,t)),e.cidrv4=t=>e.check(br(ja,t)),e.cidrv6=t=>e.check(xr(Ma,t)),e.e164=t=>e.check(wr(Fa,t)),e.datetime=t=>e.check(Wi(t)),e.date=t=>e.check(Ki(t)),e.time=t=>e.check(Ji(t)),e.duration=t=>e.check(Xi(t))});function U(e){return rr(ma,e)}var ha=p(`ZodStringFormat`,(e,t)=>{Mt.init(e,t),pa.init(e,t)}),ga=p(`ZodEmail`,(e,t)=>{Ft.init(e,t),ha.init(e,t)}),_a=p(`ZodGUID`,(e,t)=>{Nt.init(e,t),ha.init(e,t)}),va=p(`ZodUUID`,(e,t)=>{Pt.init(e,t),ha.init(e,t)});function ya(e){return or(va,e)}var ba=p(`ZodURL`,(e,t)=>{It.init(e,t),ha.init(e,t)});function xa(e){return ur(ba,e)}var Sa=p(`ZodEmoji`,(e,t)=>{Lt.init(e,t),ha.init(e,t)}),Ca=p(`ZodNanoID`,(e,t)=>{Rt.init(e,t),ha.init(e,t)}),wa=p(`ZodCUID`,(e,t)=>{zt.init(e,t),ha.init(e,t)}),Ta=p(`ZodCUID2`,(e,t)=>{Bt.init(e,t),ha.init(e,t)}),Ea=p(`ZodULID`,(e,t)=>{Vt.init(e,t),ha.init(e,t)}),Da=p(`ZodXID`,(e,t)=>{Ht.init(e,t),ha.init(e,t)}),Oa=p(`ZodKSUID`,(e,t)=>{Ut.init(e,t),ha.init(e,t)}),ka=p(`ZodIPv4`,(e,t)=>{Jt.init(e,t),ha.init(e,t)}),Aa=p(`ZodIPv6`,(e,t)=>{Yt.init(e,t),ha.init(e,t)}),ja=p(`ZodCIDRv4`,(e,t)=>{Xt.init(e,t),ha.init(e,t)}),Ma=p(`ZodCIDRv6`,(e,t)=>{Zt.init(e,t),ha.init(e,t)}),Na=p(`ZodBase64`,(e,t)=>{$t.init(e,t),ha.init(e,t)}),Pa=p(`ZodBase64URL`,(e,t)=>{tn.init(e,t),ha.init(e,t)}),Fa=p(`ZodE164`,(e,t)=>{nn.init(e,t),ha.init(e,t)}),Ia=p(`ZodJWT`,(e,t)=>{an.init(e,t),ha.init(e,t)}),La=p(`ZodNumber`,(e,t)=>{on.init(e,t),fa.init(e,t),e._zod.processJSONSchema=(t,n,r)=>_i(e,t,n,r),da(e,`ZodNumber`,{gt(e,t){return this.check(zr(e,t))},gte(e,t){return this.check(Br(e,t))},min(e,t){return this.check(Br(e,t))},lt(e,t){return this.check(Lr(e,t))},lte(e,t){return this.check(Rr(e,t))},max(e,t){return this.check(Rr(e,t))},int(e){return this.check(Ba(e))},safe(e){return this.check(Ba(e))},positive(e){return this.check(zr(0,e))},nonnegative(e){return this.check(Br(0,e))},negative(e){return this.check(Lr(0,e))},nonpositive(e){return this.check(Rr(0,e))},multipleOf(e,t){return this.check(Vr(e,t))},step(e,t){return this.check(Vr(e,t))},finite(){return this}});let n=e._zod.bag;e.minValue=Math.max(n.minimum??-1/0,n.exclusiveMinimum??-1/0)??null,e.maxValue=Math.min(n.maximum??1/0,n.exclusiveMaximum??1/0)??null,e.isInt=(n.format??``).includes(`int`)||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function Ra(e){return Ar(La,e)}var za=p(`ZodNumberFormat`,(e,t)=>{sn.init(e,t),La.init(e,t)});function Ba(e){return jr(za,e)}var Va=p(`ZodBoolean`,(e,t)=>{cn.init(e,t),fa.init(e,t),e._zod.processJSONSchema=(t,n,r)=>vi(e,t,n,r)});function Ha(e){return Mr(Va,e)}var Ua=p(`ZodNull`,(e,t)=>{ln.init(e,t),fa.init(e,t),e._zod.processJSONSchema=(t,n,r)=>yi(e,t,n,r)});function Wa(e){return Nr(Ua,e)}var Ga=p(`ZodUnknown`,(e,t)=>{un.init(e,t),fa.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function Ka(){return Pr(Ga)}var qa=p(`ZodNever`,(e,t)=>{dn.init(e,t),fa.init(e,t),e._zod.processJSONSchema=(t,n,r)=>xi(e,t,n,r)});function Ja(e){return Fr(qa,e)}var Ya=p(`ZodVoid`,(e,t)=>{fn.init(e,t),fa.init(e,t),e._zod.processJSONSchema=(t,n,r)=>bi(e,t,n,r)});function Xa(e){return Ir(Ya,e)}var Za=p(`ZodArray`,(e,t)=>{mn.init(e,t),fa.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Di(e,t,n,r),e.element=t.element,da(e,`ZodArray`,{min(e,t){return this.check(Ur(e,t))},nonempty(e){return this.check(Ur(1,e))},max(e,t){return this.check(Hr(e,t))},length(e,t){return this.check(Wr(e,t))},unwrap(){return this.element}})});function Qa(e,t){return ri(Za,e,t)}var $a=p(`ZodObject`,(e,t)=>{yn.init(e,t),fa.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Oi(e,t,n,r),T(e,`shape`,()=>t.shape),da(e,`ZodObject`,{keyof(){return mo(Object.keys(this._zod.def.shape))},catchall(e){return this.clone({...this._zod.def,catchall:e})},passthrough(){return this.clone({...this._zod.def,catchall:Ka()})},loose(){return this.clone({...this._zod.def,catchall:Ka()})},strict(){return this.clone({...this._zod.def,catchall:Ja()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(e){return ne(this,e)},safeExtend(e){return re(this,e)},merge(e){return V(this,e)},pick(e){return te(this,e)},omit(e){return B(this,e)},partial(...e){return H(yo,this,e[0])},required(...e){return ie(ko,this,e[0])}})});function eo(e,t){return new $a({type:`object`,shape:e??{},...R(t)})}function W(e,t){return new $a({type:`object`,shape:e,catchall:Ja(),...R(t)})}function to(e,t){return new $a({type:`object`,shape:e,catchall:Ka(),...R(t)})}var no=p(`ZodUnion`,(e,t)=>{xn.init(e,t),fa.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ki(e,t,n,r),e.options=t.options});function ro(e,t){return new no({type:`union`,options:e,...R(t)})}var io=p(`ZodDiscriminatedUnion`,(e,t)=>{no.init(e,t),Sn.init(e,t)});function ao(e,t,n){return new io({type:`union`,options:t,discriminator:e,...R(n)})}var oo=p(`ZodIntersection`,(e,t)=>{Cn.init(e,t),fa.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ai(e,t,n,r)});function so(e,t){return new oo({type:`intersection`,left:e,right:t})}var co=p(`ZodTuple`,(e,t)=>{En.init(e,t),fa.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ji(e,t,n,r),e.rest=t=>e.clone({...e._zod.def,rest:t})});function lo(e,t,n){let r=t instanceof At;return new co({type:`tuple`,items:e,rest:r?t:null,...R(r?n:t)})}var uo=p(`ZodRecord`,(e,t)=>{An.init(e,t),fa.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Mi(e,t,n,r),e.keyType=t.keyType,e.valueType=t.valueType});function fo(e,t,n){return!t||!t._zod?new uo({type:`record`,keyType:U(),valueType:e,...R(t)}):new uo({type:`record`,keyType:e,valueType:t,...R(n)})}var po=p(`ZodEnum`,(e,t)=>{jn.init(e,t),fa.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Si(e,t,n,r),e.enum=t.entries,e.options=Object.values(t.entries);let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let i={};for(let r of e)if(n.has(r))i[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new po({...t,checks:[],...R(r),entries:i})},e.exclude=(e,r)=>{let i={...t.entries};for(let t of e)if(n.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new po({...t,checks:[],...R(r),entries:i})}});function mo(e,t){return new po({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...R(t)})}var ho=p(`ZodLiteral`,(e,t)=>{Mn.init(e,t),fa.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ci(e,t,n,r),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function go(e,t){return new ho({type:`literal`,values:Array.isArray(e)?e:[e],...R(t)})}var _o=p(`ZodTransform`,(e,t)=>{Nn.init(e,t),fa.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ei(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new h(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(de(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,t.input??=n.value,t.inst??=e,n.issues.push(de(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n.fallback=!0,n)):(n.value=i,n.fallback=!0,n)}});function vo(e){return new _o({type:`transform`,transform:e})}var yo=p(`ZodOptional`,(e,t)=>{Fn.init(e,t),fa.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Vi(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function bo(e){return new yo({type:`optional`,innerType:e})}var xo=p(`ZodExactOptional`,(e,t)=>{In.init(e,t),fa.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Vi(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function So(e){return new xo({type:`optional`,innerType:e})}var Co=p(`ZodNullable`,(e,t)=>{Ln.init(e,t),fa.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ni(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function wo(e){return new Co({type:`nullable`,innerType:e})}var To=p(`ZodDefault`,(e,t)=>{Rn.init(e,t),fa.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Fi(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Eo(e,t){return new To({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():P(t)}})}var Do=p(`ZodPrefault`,(e,t)=>{Bn.init(e,t),fa.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ii(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Oo(e,t){return new Do({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():P(t)}})}var ko=p(`ZodNonOptional`,(e,t)=>{Vn.init(e,t),fa.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Pi(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Ao(e,t){return new ko({type:`nonoptional`,innerType:e,...R(t)})}var jo=p(`ZodCatch`,(e,t)=>{Un.init(e,t),fa.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Li(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Mo(e,t){return new jo({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:()=>t})}var No=p(`ZodPipe`,(e,t)=>{Wn.init(e,t),fa.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ri(e,t,n,r),e.in=t.in,e.out=t.out});function Po(e,t){return new No({type:`pipe`,in:e,out:t})}var Fo=p(`ZodReadonly`,(e,t)=>{Kn.init(e,t),fa.init(e,t),e._zod.processJSONSchema=(t,n,r)=>zi(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Io(e){return new Fo({type:`readonly`,innerType:e})}var Lo=p(`ZodLazy`,(e,t)=>{Xn.init(e,t),fa.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Hi(e,t,n,r),e.unwrap=()=>e._zod.def.getter()});function Ro(e){return new Lo({type:`lazy`,getter:e})}var zo=p(`ZodPromise`,(e,t)=>{Yn.init(e,t),fa.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Bi(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Bo(e){return new zo({type:`promise`,innerType:e})}var Vo=p(`ZodFunction`,(e,t)=>{Jn.init(e,t),fa.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ti(e,t,n,r)});function Ho(e){return new Vo({type:`function`,input:Array.isArray(e?.input)?lo(e?.input):e?.input??Qa(Ka()),output:e?.output??Ka()})}var Uo=p(`ZodCustom`,(e,t)=>{Zn.init(e,t),fa.init(e,t),e._zod.processJSONSchema=(t,n,r)=>wi(e,t,n,r)});function Wo(e,t){return ii(Uo,e??(()=>!0),t)}function Go(e,t={}){return ai(Uo,e,t)}function Ko(e,t){return oi(e,t)}function qo(e,t={}){let n=new Uo({type:`custom`,check:`custom`,fn:t=>t instanceof e,abort:!0,...R(t)});return n._zod.bag.Class=e,n._zod.check=t=>{t.value instanceof e||t.issues.push({code:`invalid_type`,expected:e.name,input:t.value,inst:n,path:[...n._zod.def.path??[]]})},n}function Jo(e){let t=Ro(()=>ro([U(e),Ra(),Ha(),Wa(),Qa(t),fo(U(),t)]));return t}var G=l(d(),1),Yo=Jo(),Xo=Ro(()=>ao(`status`,[eo({status:go(`available`)}).strict(),eo({status:go(`unavailable`),reason:U()}).strict()])),Zo=Yo,Qo=Ro(()=>fo(U(),Zo)),$o=e=>Zo.parse(e),es=Ro(()=>eo({code:U().min(1).max(160),message:U().min(1).max(512),details:Zo.optional()}).strict()),ts=e=>es.parse(e),ns=Qo,rs=Ro(()=>U().refine(e=>e.trim().length>0)),is=Xo,as=Ro(()=>ro([eo({type:go(`action`)}).strict(),eo({type:go(`custom`),data:Qo}).strict(),eo({type:go(`choice`),options:Qa(eo({value:Zo,label:rs,description:rs.optional()}))}).strict(),eo({type:go(`form`),submitLabel:rs.optional()}).strict(),eo({type:go(`confirmation`),message:rs,confirmLabel:rs.optional(),cancelLabel:rs.optional()}).strict()])),os=Ro(()=>eo({inputSchema:ns.optional(),outputSchema:ns.optional(),presentation:as.optional()}).strict()),ss=Ro(()=>Ra().int().refine(e=>Number.isSafeInteger(e))),cs=Ro(()=>eo({hint:rs.pipe(U().max(120)),words:Qa(eo({word:U().regex(/^\S{1,64}$/u),description:rs.pipe(U().max(512)).optional(),arguments:Qo}).strict()).max(32).optional(),text:eo({field:rs.pipe(U().max(120)),arguments:Qo,requestIdField:rs.pipe(U().max(120)).optional()}).strict().optional()}).strict().refine(e=>e.words!==void 0||e.text!==void 0,`slash arguments need words or text`)),ls=Ro(()=>eo({order:ss.optional()}).strict()),us=Ro(()=>eo({bindings:eo({order:ss.optional(),values:Qa(rs).max(16)}).strict().optional(),agent:eo({keybind:rs.optional(),order:ss.optional()}).strict().optional(),help:ls.optional(),menu:ls.optional(),palette:ls.optional(),slash:eo({aliases:Qa(rs).max(16),consumesDraft:Ha().optional(),order:ss.optional(),arguments:cs.optional()}).strict().optional()}).strict()),ds=Ro(()=>eo({id:rs.refine(e=>!e.includes(`:`)),title:rs,category:rs,description:rs.optional(),projections:us.optional(),action:os.optional(),availability:is.optional()}).strict()),fs=e=>ds.parse(e),ps=Ro(()=>eo({inputSchema:ns.optional(),outputSchema:ns.optional()}).strict()),ms=U().min(1).brand();Ro(()=>eo({commandId:ms,command:eo({namespace:U(),id:U()}).strict(),sourceId:U(),scope:U().optional(),title:U(),category:U(),description:U().optional(),order:Ra(),availability:Xo,action:ps.optional(),keybind:U().optional()}).strict());var hs=8192,gs=rs.pipe(U().max(hs)),_s=rs.pipe(U().max(60)),vs=xa({protocol:/^https?$/u}),ys=eo({label:gs,value:gs}).strict(),bs={summary:gs.optional(),facts:Qa(ys).max(4).optional(),body:gs.optional(),bodyLabel:gs.optional(),details:Qa(ys).max(24).optional()};ao(`type`,[eo({type:go(`choice`),message:_s,...bs,current:gs.optional(),collapsedGroup:gs.optional(),options:Qa(eo({value:gs,label:gs,description:gs.optional(),group:gs.optional(),destructive:go(!0).optional()}).strict()).min(1).max(256)}).strict(),eo({type:go(`text`),message:_s,...bs,placeholder:gs.optional(),secret:Ha().optional()}).strict(),eo({type:go(`confirmation`),message:_s,...bs,confirmLabel:gs.optional(),cancelLabel:gs.optional(),destructive:go(!0).optional()}).strict(),eo({type:go(`decision`),message:_s,...bs,options:Qa(eo({value:gs,label:gs,description:gs.optional(),destructive:go(!0).optional()}).strict()).min(1).max(8).refine(e=>new Set(e.map(e=>e.value)).size===e.length,`Decision option values must be unique`),multiple:Ha().optional(),other:eo({label:gs,placeholder:gs.optional(),maxLength:Ra().int().min(1).max(hs),blank:gs.optional()}).strict().optional(),escape:gs.optional()}).strict().refine(e=>[e.escape,e.other?.blank].every(t=>t===void 0||e.options.some(e=>e.value===t)),`A decision's escape and blank answers must be offered options`)]),Ro(()=>ao(`type`,[eo({type:go(`info`),message:gs,links:Qa(eo({url:vs,label:gs.optional()}).strict()).max(16).optional()}).strict(),eo({type:go(`progress`),message:gs}).strict(),eo({type:go(`handoff`),url:vs,code:gs.optional(),message:gs.optional()}).strict(),eo({type:go(`success`),message:gs}).strict()]));var xs=class extends Error{code;details;constructor(e,t,n){super(t),this.code=e,this.details=n,this.name=`WhistleActionError`}},Ss=class extends Error{constructor(){super(`Whistle runtime is closed`),this.name=`WhistleClosedError`}};function Cs(){let e=!1,t=nc,n=[],r=[],i=!1,a=[],o=new Set,s=()=>{for(let e of o)e()};return Object.freeze({close:()=>{e||(e=!0,n=[],a=[],r=[],t=nc,s(),o.clear())},contribute:t=>{if(Ms(t),e)throw new Ss;Ns(t,n),Ps(t,n);let r=Symbol(`whistle-contribution`);js(t)||(n=[...n,{contribution:Fs(t),generation:r}],i=!0,s());let a=!0;return ec(o=>{if(!a||e)return;let c={...t,commands:o};Ms(c);let l=n.findIndex(e=>e.generation===r),u=n.filter(e=>e.generation!==r);Ns(c,u),Ps(c,u);let d=Fs(c);if(js(c)){if(l<0)return;n=u}else n=l<0?[...n,{contribution:d,generation:r}]:n.map(e=>e.generation===r?{contribution:d,generation:r}:e);i=!0,s()},()=>{a&&(a=!1,n.find(e=>e.generation===r)!==void 0&&(n=n.filter(e=>e.generation!==r),i=!0,s()))})},execute:async(t,r)=>{if(t.namespace.trim().length===0||t.id.trim().length===0)return{status:`invalid`};if(e)return{status:`closed`};let i=As(t,n);if(i===void 0)return{status:`missing`};let o;try{let e=ic(i);if(e.status===`unavailable`)return e;let n=a.at(-1)?.presenter;r.interaction===void 0&&n!==void 0&&ws.has(r.origin)&&(o=n({commandId:ks(t.namespace,t.id),title:i.title}));let s={...r,signal:r.signal??new AbortController().signal};o!==void 0&&(s.interaction=o.interaction,s.signal=AbortSignal.any([s.signal,o.interaction.signal]));let c=await i.handler(s);return o?.settle({status:`handled`}),c===void 0?{status:`handled`}:{status:`handled`,result:c}}catch(e){let t=oc(e instanceof Error?e:Error(`Command handler threw a non-Error value`));return o?.settle(o.interaction.signal.aborted?{status:`cancelled`}:{status:`failed`,message:t.message}),{status:`failed`,error:t}}},present:t=>{let n={presenter:t};return e||(a=[...a,n]),()=>{a=a.filter(e=>e!==n)}},snapshot:()=>{if(e)return nc;let a=n.flatMap(e=>e.contribution.commands.map(ic));return(i||a.some((e,t)=>!ac(e,r[t])))&&(t=sc(n,a),r=a,i=!1),t},subscribe:t=>e?()=>void 0:(o.add(t),()=>{o.delete(t)})})}var ws=new Set([`browser`,`keyboard`,`menu`,`palette`,`slash`,`terminal`]),Ts=16,Es=32,Ds=64,Os=256;function ks(e,t){return ms.parse(`${e}:${t}`)}function As(e,t){for(let n of t)if(n.contribution.namespace===e.namespace){for(let t of n.contribution.commands)if(t.id===e.id)return t}}function js(e){return e.commands.length===0}function Ms(e){Qs(e.sourceId,`source ID`),Qs(e.namespace,`namespace`),e.scope!==void 0&&Qs(e.scope,`scope`);for(let t of e.commands)qs(t)}function Ns(e,t){t.find(t=>t.contribution.namespace===e.namespace&&t.contribution.sourceId!==e.sourceId)!==void 0&&tc(`Namespace is already owned by another source`);let n=new Set,r=new Set;for(let i of t){let t=i.contribution.scope===e.scope;for(let e of i.contribution.commands)if(n.add(ks(i.contribution.namespace,e.id)),t)for(let t of e.projections?.slash?.aliases??[])r.add(t)}for(let t of e.commands){let i=ks(e.namespace,t.id);n.has(i)&&tc(`Canonical command ID is already registered`),n.add(i);for(let e of t.projections?.slash?.aliases??[])r.has(e)&&tc(`Slash alias is already registered`),r.add(e)}}function Ps(e,t){t.length>=Ds&&tc(`Live contribution capacity exceeded`),t.reduce((e,t)=>e+t.contribution.commands.length,0)+e.commands.length>Os&&tc(`Live command capacity exceeded`)}function Fs(e){let t={sourceId:e.sourceId,namespace:e.namespace,commands:e.commands.map(Is)};return e.scope===void 0?t:{...t,scope:e.scope}}function Is(e){let t={id:e.id,title:e.title,category:e.category,handler:e.handler};return e.description!==void 0&&(t.description=e.description),e.action!==void 0&&(t.action=Ls(e.action)),e.availability!==void 0&&(t.availability=e.availability),e.projections!==void 0&&(t.projections=Vs(e.projections)),t}function Ls(e){let t={};return e.inputSchema!==void 0&&(t.inputSchema=Rs(e.inputSchema)),e.outputSchema!==void 0&&(t.outputSchema=Rs(e.outputSchema)),e.presentation!==void 0&&(t.presentation=Bs(e.presentation)),Object.freeze(t)}function Rs(e){return Object.freeze(Object.fromEntries(Object.entries(e).map(([e,t])=>[e,zs(t)])))}function zs(e){return Array.isArray(e)?Object.freeze(e.map(zs)):e!==null&&e instanceof Object?Object.freeze(Object.fromEntries(Object.entries(e).map(([e,t])=>[e,zs(t)]))):e}function Bs(e){switch(e.type){case`action`:return Object.freeze({type:`action`});case`custom`:return Object.freeze({type:`custom`,data:Rs(e.data)});case`choice`:return Object.freeze({type:`choice`,options:Object.freeze(e.options.map(e=>Object.freeze({...e,value:zs(e.value)})))});case`form`:return Object.freeze({...e});case`confirmation`:return Object.freeze({...e})}}function Vs(e){let t={};return e.bindings!==void 0&&(t.bindings=Hs(e.bindings)),e.agent!==void 0&&(t.agent=Us(e.agent)),e.help!==void 0&&(t.help=Ws(e.help.order)),e.menu!==void 0&&(t.menu=Ws(e.menu.order)),e.palette!==void 0&&(t.palette=Ws(e.palette.order)),e.slash!==void 0&&(t.slash=Gs(e.slash)),t}function Hs(e){let t={values:[...e.values]};return e.order!==void 0&&(t.order=e.order),t}function Us(e){let t={};return e.keybind!==void 0&&(t.keybind=e.keybind),e.order!==void 0&&(t.order=e.order),t}function Ws(e){let t={};return e!==void 0&&(t.order=e),t}function Gs(e){let t={aliases:[...e.aliases]};return e.order!==void 0&&(t.order=e.order),e.consumesDraft!==void 0&&(t.consumesDraft=e.consumesDraft),e.arguments!==void 0&&(t.arguments=Ks(e.arguments)),t}function Ks(e){let t={hint:e.hint};return e.words!==void 0&&(t.words=Object.freeze(e.words.map(e=>Object.freeze({...e,arguments:Rs(e.arguments)})))),e.text!==void 0&&(t.text=Object.freeze({...e.text,arguments:Rs(e.text.arguments)})),Object.freeze(t)}function qs(e){Qs(e.id,`command ID`,!0),Qs(e.title,`title`),Qs(e.category,`category`),Js(e.action),Ys(e.projections)}function Js(e){if(e?.presentation!==void 0)switch(e.presentation.type){case`action`:case`custom`:return;case`choice`:for(let t of e.presentation.options)Qs(t.label,`choice label`),t.description!==void 0&&Qs(t.description,`choice description`);return;case`form`:e.presentation.submitLabel!==void 0&&Qs(e.presentation.submitLabel,`submit label`);return;case`confirmation`:Qs(e.presentation.message,`confirmation message`),e.presentation.confirmLabel!==void 0&&Qs(e.presentation.confirmLabel,`confirmation label`),e.presentation.cancelLabel!==void 0&&Qs(e.presentation.cancelLabel,`cancellation label`)}}function Ys(e){if(e!==void 0){for(let t of[e.bindings,e.palette,e.slash,e.help,e.menu,e.agent])t!==void 0&&$s(t.order);if(e.bindings!==void 0&&Zs(e.bindings.values,`binding`),e.slash!==void 0){Zs(e.slash.aliases,`slash alias`);for(let t of e.slash.aliases)/\s/u.test(t)&&tc(`slash alias must not contain whitespace`);Xs(e.slash.arguments)}e.agent?.keybind!==void 0&&Qs(e.agent.keybind,`agent keybind`)}}function Xs(e){if(e===void 0)return;Qs(e.hint,`argument hint`),e.words===void 0&&e.text===void 0&&tc(`slash arguments need words or text`);let t=new Set;for(let n of e.words??[])Qs(n.word,`argument word`),/\s/u.test(n.word)&&tc(`argument word must not contain whitespace`),t.has(n.word)&&tc(`argument word is repeated`),t.add(n.word),n.description!==void 0&&Qs(n.description,`argument word description`);t.size>Es&&tc(`argument word count exceeds 32`),e.text!==void 0&&(Qs(e.text.field,`argument text field`),e.text.requestIdField!==void 0&&Qs(e.text.requestIdField,`request id field`))}function Zs(e,t){e.length>Ts&&tc(`${t} count exceeds 16`);for(let n of e)Qs(n,t)}function Qs(e,t,n=!1){e.trim().length===0&&tc(`${t} must not be blank`),n&&e.includes(`:`)&&tc(`${t} must not contain a colon`)}function $s(e){e!==void 0&&!Number.isSafeInteger(e)&&tc(`order must be a safe integer`)}function ec(e=()=>void 0,t=()=>void 0){return Object.freeze({update:e,dispose:t})}function tc(e){throw Error(e)}var nc=Object.freeze({bindings:Object.freeze([]),palette:Object.freeze([]),slash:Object.freeze([]),help:Object.freeze([]),menu:Object.freeze([]),agent:Object.freeze([])}),rc=Object.freeze({status:`available`});function ic(e){let t=e.availability?.()??rc;return t.status===`available`?rc:Object.freeze({status:`unavailable`,reason:t.reason})}function ac(e,t){return e.status===`available`?t?.status===`available`:t?.status===`unavailable`&&e.reason===t.reason}function oc(e){if(e instanceof xs){let t={code:e.code,message:e.message};return Object.freeze(e.details===void 0?t:{...t,details:zs(e.details)})}return Object.freeze({code:`command_failed`,message:e.message})}function sc(e,t){let n=[],r=[],i=[],a=[],o=[],s=[],c=0;for(let l of e){let e=l.contribution;for(let l of e.commands){let u=l.projections,d=t[c++]??rc;if(u?.bindings!==void 0)for(let t of u.bindings.values)n.push({...mc(e,l,u.bindings.order,d),binding:t});if(u?.palette!==void 0&&r.push({...mc(e,l,u.palette.order,d)}),u?.slash!==void 0)for(let t of u.slash.aliases){let n={...mc(e,l,u.slash.order,d),alias:t};u.slash.consumesDraft!==void 0&&(n={...n,consumesDraft:u.slash.consumesDraft}),u.slash.arguments!==void 0&&(n={...n,arguments:u.slash.arguments}),i.push(n)}u?.help!==void 0&&a.push({...mc(e,l,u.help.order,d)}),u?.menu!==void 0&&o.push({...mc(e,l,u.menu.order,d)}),u?.agent!==void 0&&s.push(gc(e,l,u.agent,d))}}return dc(n),fc(i),uc(r),uc(a),uc(o),uc(s),Object.freeze({bindings:pc(n),palette:pc(r),slash:pc(i),help:pc(a),menu:pc(o),agent:pc(s)})}var cc=new TextEncoder;function lc(e,t){let n=cc.encode(e),r=cc.encode(t),i=Math.min(n.length,r.length);for(let e=0;e<i;e+=1){let t=n[e]??0,i=r[e]??0;if(t!==i)return t<i?-1:1}return n.length<r.length?-1:+(n.length>r.length)}function uc(e){e.sort((e,t)=>e.order-t.order||lc(e.commandId,t.commandId))}function dc(e){e.sort((e,t)=>e.order-t.order||lc(e.commandId,t.commandId)||lc(e.binding,t.binding))}function fc(e){e.sort((e,t)=>e.order-t.order||lc(e.commandId,t.commandId)||lc(e.alias,t.alias))}function pc(e){return Object.freeze(e.map(e=>Object.freeze(e)))}function mc(e,t,n,r){let i=hc(e,t,n,r);return e.scope===void 0?i:{...i,scope:e.scope}}function hc(e,t,n,r){let i={commandId:ks(e.namespace,t.id),command:Object.freeze({namespace:e.namespace,id:t.id}),sourceId:e.sourceId,title:t.title,category:t.category,order:n??0,availability:r},a=t.description===void 0?i:{...i,description:t.description};return t.action===void 0?a:{...a,action:t.action}}function gc(e,t,n,r){let i=mc(e,t,n.order,r),a=i.action===void 0?i:{...i,action:K(i.action)};return n.keybind===void 0?a:{...a,keybind:n.keybind}}function K(e){let t={};return e.inputSchema!==void 0&&(t.inputSchema=e.inputSchema),e.outputSchema!==void 0&&(t.outputSchema=e.outputSchema),Object.freeze(t)}var _c=new WeakMap;function vc(e,t){let n=!1,r=[];for(let i of t){let{availability:t,handler:a,...o}=i,s=a,c=t===void 0?o:{...o,availability:t()},l=_c.get(e)??new Map;_c.set(e,l);let u=l.get(i.id),d=()=>e.register(c,async({arguments:e,origin:t,signal:n})=>{let r=await s(e===void 0?{origin:t,signal:n}:{arguments:e,origin:t,signal:n});return r===void 0?void 0:$o(r)}),f=(u?u.then(d):d()).then(e=>{n?e():r.push(e)},e=>{console.warn(`App command ${i.id} was not registered`,e)});l.set(i.id,f),f.finally(()=>{l.get(i.id)===f&&l.delete(i.id)})}return()=>{if(!n){n=!0;for(let e of r.splice(0))e()}}}var yc=(e,t)=>{switch(t.length){case 0:return e;case 1:return t[0](e);case 2:return t[1](t[0](e));case 3:return t[2](t[1](t[0](e)));case 4:return t[3](t[2](t[1](t[0](e))));case 5:return t[4](t[3](t[2](t[1](t[0](e)))));case 6:return t[5](t[4](t[3](t[2](t[1](t[0](e))))));case 7:return t[6](t[5](t[4](t[3](t[2](t[1](t[0](e)))))));case 8:return t[7](t[6](t[5](t[4](t[3](t[2](t[1](t[0](e))))))));case 9:return t[8](t[7](t[6](t[5](t[4](t[3](t[2](t[1](t[0](e)))))))));default:{let n=e;for(let e=0,r=t.length;e<r;e++)n=t[e](n);return n}}},bc={pipe(){return yc(this,arguments)}},xc=function(){function e(){}return e.prototype=bc,e}(),Sc=function(e,t){if(typeof e==`function`)return function(){return e(arguments)?t.apply(this,arguments):e=>t(e,...arguments)};switch(e){case 0:case 1:throw RangeError(`Invalid arity ${e}`);case 2:return function(e,n){return arguments.length>=2?t(e,n):function(n){return t(n,e)}};case 3:return function(e,n,r){return arguments.length>=3?t(e,n,r):function(r){return t(r,e,n)}};default:return function(){if(arguments.length>=e)return t.apply(this,arguments);let n=arguments;return function(e){return t(e,...n)}}}},Cc=e=>e,wc=e=>()=>e,Tc=wc(!0),Ec=wc(null),Dc=wc(void 0),Oc=Dc;function kc(e,t,n,r,i,a,o,s,c){switch(arguments.length){case 1:return e;case 2:return function(){return t(e.apply(this,arguments))};case 3:return function(){return n(t(e.apply(this,arguments)))};case 4:return function(){return r(n(t(e.apply(this,arguments))))};case 5:return function(){return i(r(n(t(e.apply(this,arguments)))))};case 6:return function(){return a(i(r(n(t(e.apply(this,arguments))))))};case 7:return function(){return o(a(i(r(n(t(e.apply(this,arguments)))))))};case 8:return function(){return s(o(a(i(r(n(t(e.apply(this,arguments))))))))};case 9:return function(){return c(s(o(a(i(r(n(t(e.apply(this,arguments)))))))))}}}function Ac(e){let t=new WeakMap;return n=>{let r=t.get(n);if(r!==void 0)return r;let i=e(n);return t.set(n,i),i}}function jc(e){let t=new WeakMap;return n=>{let r=t.get(n);if(r!==void 0)return r;let i=e(n);return t.set(n,i),i!==n&&t.set(i,i),i}}var Mc=e=>{let t=new Set(Reflect.ownKeys(e));if(e.constructor===Object)return t;e instanceof Error&&t.delete(`stack`);let n=Object.getPrototypeOf(e),r=n;for(;r!==null&&r!==Object.prototype;){let e=Reflect.ownKeys(r);for(let n=0;n<e.length;n++)t.add(e[n]);r=Object.getPrototypeOf(r)}return t.has(`constructor`)&&typeof e.constructor==`function`&&n===e.constructor.prototype&&t.delete(`constructor`),t},Nc=new WeakSet,Pc=e=>new Uint8Array(e.buffer,e.byteOffset,e.byteLength),Fc=0,Ic=()=>{Fc++};function Lc(e){return typeof e==`string`}function Rc(e){return typeof e==`number`}function zc(e){return typeof e==`boolean`}function Bc(e){return typeof e==`symbol`}function Vc(e){return Lc(e)||Rc(e)||Bc(e)}function Hc(e){return typeof e==`function`}function Uc(e){return e===void 0}function Wc(e){return e!=null}function Gc(e){return!0}function Kc(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function qc(e){return typeof e==`object`&&!!e||Hc(e)}var Jc=Sc(2,(e,t)=>qc(e)&&t in e),Yc=`~effect/Hash`,Xc=e=>{switch(typeof e){case`number`:return nl(e);case`bigint`:return rl(e.toString(10));case`string`:return rl(e);case`function`:case`object`:if(e===null)break;if(e instanceof Date)return Number.isNaN(e.getTime())?rl(`Invalid Date`):rl(e.toISOString());if(e instanceof RegExp)return rl(e.toString());{if(Nc.has(e))return Zc(e);let t=fl.get(e);if(t!==void 0)return t;if(pl.has(e))return Ic(),rl(`[Circular]`);pl.add(e);let n=Fc,r;try{r=`~effect/Hash`in e?e[Yc]():typeof e==`function`?Zc(e):e instanceof DataView?sl(Pc(e)):Array.isArray(e)||ArrayBuffer.isView(e)?sl(e):e instanceof Map?cl(e):e instanceof Set?ul(e):al(e)}finally{pl.delete(e)}return n===Fc&&fl.set(e,r),r}}return el(Qc(rl(String(e))))},Zc=e=>(dl.has(e)||dl.set(e,el(Math.random()*4294967296|0)),dl.get(e)),Qc=e=>(e^=e>>>16,e=Math.imul(e,2246822507),e^=e>>>13,e=Math.imul(e,3266489909),e^e>>>16),$c=Sc(2,(e,t)=>Qc(Math.imul(e,2654435761)+Math.imul(t,2246822507))),el=e=>e&3221225471|e>>>1&1073741824,tl=new DataView(new ArrayBuffer(8)),nl=e=>{let t=e|0;return t===e?el(t):(tl.setFloat64(0,e===e?e:NaN),el($c(tl.getInt32(0),tl.getInt32(4))))},rl=e=>{let t=5381,n=e.length;for(;n;)t=t*33^e.charCodeAt(--n);return el(t)},il=(e,t)=>{let n=12289;for(let r of t)n^=$c(Xc(r),Xc(e[r]));return el(n)},al=e=>il(e,Mc(e)),ol=(e,t)=>n=>{let r=e;for(let e of n)r^=t(e);return el(r)},sl=e=>{let t=6151;for(let n of e)t=$c(t,Xc(n));return el(t)},cl=ol(rl(`Map`),([e,t])=>$c(Xc(e),Xc(t))),ll=rl(`Set`),ul=ol(ll,e=>$c(ll,Xc(e))),dl=new WeakMap,fl=new WeakMap,pl=new WeakSet,ml=`~effect/Equal`;function hl(){return arguments.length===1?e=>gl(e,arguments[0]):gl(arguments[0],arguments[1])}function gl(e,t){if(e===t)return!0;if(e==null||t==null)return!1;let n=typeof e;return n===typeof t?n===`number`&&e!==e&&t!==t?!0:n!==`object`&&n!==`function`||Nc.has(e)||Nc.has(t)?!1:_l(e,t):!1}function _l(e,t){let n=yl.length;for(let r=n;r-->0;)if(yl[r]===e&&bl[r]===t)return!0;if(n)return vl(e,t);let r=xl.get(e);r||xl.set(e,r=new WeakMap);let i=r.get(t);return i===void 0&&r.set(t,i=vl(e,t)),i}function vl(e,t){yl.push(e),bl.push(t);try{return Sl(e,t)}finally{yl.pop(),bl.pop()}}var yl=[],bl=[],xl=new WeakMap;function Sl(e,t){if(Xc(e)!==Xc(t))return!1;if(e instanceof Date){if(!(t instanceof Date))return!1;let n=e.getTime(),r=t.getTime();return n===r||Number.isNaN(n)&&Number.isNaN(r)}if(e instanceof RegExp)return t instanceof RegExp&&e.toString()===t.toString();let n=kl(e);if(n!==kl(t)||typeof e==`function`&&!n)return!1;if(n)return e[ml](t);if(Array.isArray(e))return!Array.isArray(t)||e.length!==t.length?!1:Cl(e,t);if(ArrayBuffer.isView(e)){let n=e instanceof DataView;return!ArrayBuffer.isView(t)||e.byteLength!==t.byteLength||n!==t instanceof DataView?!1:n?wl(Pc(e),Pc(t)):wl(e,t)}return e instanceof Map?!(t instanceof Map)||e.size!==t.size?!1:El(e,t,Dl,Ol):e instanceof Set?!(t instanceof Set)||e.size!==t.size?!1:El(e,t,Xc,gl):Tl(e,t)}function Cl(e,t){for(let n=0;n<e.length;n++)if(!gl(e[n],t[n]))return!1;return!0}function wl(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function Tl(e,t){let n=Mc(e),r=Mc(t);if(n.size!==r.size)return!1;for(let i of n)if(!r.has(i)||!gl(e[i],t[i]))return!1;return!0}function El(e,t,n,r){let i=new Map,a=0;for(let e of t){let t=n(e),r=i.get(t);r?r.push(e):i.set(t,[e]),a++}outer:for(let t of e){let e=i.get(n(t));if(e){for(let n=0;n<e.length;n++)if(r(t,e[n])){e[n]=e[e.length-1],e.pop(),a--;continue outer}}return!1}return a===0}var Dl=e=>Xc(e[0]),Ol=(e,t)=>gl(e[0],t[0])&&gl(e[1],t[1]),kl=e=>Jc(e,ml),Al=e=>e.length>0;function jl(e,t,n){t===`__proto__`?Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0}):e[t]=n}function Ml(e,t){for(let n of Reflect.ownKeys(t))Object.prototype.propertyIsEnumerable.call(t,n)&&jl(e,n,t[n])}var Nl=Symbol.for(`~effect/Redactable`),Pl=e=>Jc(e,Nl);function Fl(e){return Pl(e)?Il(e):e}function Il(e){return e[Nl](globalThis[`~effect/Fiber/currentFiber`]?.context??zl)}var Ll=`~effect/Fiber/currentFiber`,Rl=new Map,zl={"~effect/Context":{},base:Rl,depth:0,mapUnsafe:Rl,pipe(){return yc(this,arguments)}};function Bl(e,t){let n=t?.space??0,r=new WeakSet,i=n?typeof n==`number`?` `.repeat(n):n:``,a=e=>i.repeat(e),o=(e,t)=>{let n=e?.constructor;return n&&n!==Object.prototype.constructor&&n.name?`${n.name}(${t})`:t},s=e=>{try{return Reflect.ownKeys(e)}catch{return[`[ownKeys threw]`]}};function c(e,t=0){try{return l(e,t)}catch{return(typeof e==`object`&&e||typeof e==`function`)&&r.delete(e),`[inspection threw]`}}function l(e,n=0){if(typeof e==`string`)return JSON.stringify(e);if(typeof e==`number`||e==null||typeof e==`boolean`||typeof e==`symbol`)return String(e);if(typeof e==`bigint`)return String(e)+`n`;if(typeof e==`object`||typeof e==`function`){if(r.has(e))return Vl;r.add(e);let l;if(Nl in e)l=c(Il(e),n);else if(Array.isArray(e))l=!i||e.length<=1?`[${e.map(e=>c(e,n)).join(`,`)}]`:`[\n${a(n+1)}${e.map(e=>c(e,n+1)).join(`,
|
|
66
|
+
`+a(n+1))}\n${a(n)}]`;else if(e instanceof Date)l=Wl(e);else if(!t?.ignoreToString&&Jc(e,`toString`)&&typeof e.toString==`function`&&e.toString!==Object.prototype.toString&&e.toString!==Array.prototype.toString){let t=Gl(e);l=e instanceof Error&&e.cause!==void 0?`${t} (cause: ${c(e.cause,n)})`:t}else if(Symbol.iterator in e)l=`${e.constructor.name}(${c(Array.from(e),n)})`;else{let t=s(e);if(!i||t.length<=1){let r=`{${t.map(t=>`${Hl(t)}:${c(Kl(e,t),n)}`).join(`,`)}}`;l=o(e,r)}else{let r=`{\n${t.map(t=>`${a(n+1)}${Hl(t)}: ${c(Kl(e,t),n+1)}`).join(`,
|
|
67
|
+
`)}\n${a(n)}}`;l=o(e,r)}}return r.delete(e),l}return String(e)}return c(e,0)}var Vl=`[Circular]`;function Hl(e){return typeof e==`string`?JSON.stringify(e):String(e)}function Ul(e){return e.map(e=>`[${Hl(e)}]`).join(``)}function Wl(e){try{return e.toISOString()}catch{return`Invalid Date`}}function Gl(e){try{let t=e.toString();return typeof t==`string`?t:String(t)}catch{return`[toString threw]`}}function Kl(e,t){try{return e[t]}catch{return`[property access threw]`}}function ql(e,t){let n=[];return JSON.stringify(e,function(e,t){let r=Object.getOwnPropertyDescriptor(this,e)?.value,i=Jc(r,Nl)?Fl(r):Fl(t);if(typeof i==`bigint`)return Bl(i);if(typeof i!=`object`||!i)return i;let a=i instanceof Error&&!Jc(i,`toJSON`)?{...i,name:i.name,message:i.message}:i;for(;n.length>0&&n[n.length-1]!==this;)n.pop();if(n.includes(i))return;if(n.push(i),a!==i&&n.push(a),!Jl(a)||Yl(a))return a;let o=new Proxy(a,{get(e,t){let n=Reflect.get(e,t,e);return Object.getOwnPropertyDescriptor(e,t)?.get===void 0?n:Fl(n)}});return n.push(o),o},t?.space)??`null`}function Jl(e){for(let t of Object.getOwnPropertyNames(e))if(Object.getOwnPropertyDescriptor(e,t)?.get!==void 0)return!0;return!1}function Yl(e){for(let t of[Number.prototype.valueOf,Boolean.prototype.valueOf,String.prototype.valueOf])try{return Reflect.apply(t,e,[]),!0}catch{}return!1}var Xl=Symbol.for(`nodejs.util.inspect.custom`),Zl=e=>{try{return e=Fl(e),Jc(e,`toJSON`)&&Hc(e.toJSON)&&e.toJSON.length===0?e.toJSON():Array.isArray(e)?e.map(Zl):e}catch{return`[toJSON threw]`}},Ql={toJSON(){return Zl(this)},[Xl](){return this.toJSON()},toString(){return Bl(this.toJSON())}},$l=(()=>{let e=Object.getOwnPropertyDescriptor(Error,`stackTraceLimit`);return e===void 0?Object.isExtensible(Error):Object.hasOwn(e,`writable`)?e.writable===!0:e.set!==void 0})(),eu=()=>Error.stackTraceLimit,tu=e=>{$l&&(Error.stackTraceLimit=e)},nu=class{constructor(e){this.value=e,this.done=!1}next(e){return this.done?(this.value=e,this):(this.done=!0,{value:this.value,done:!1})}},ru=(()=>{let e=`~effect/Utils/internal`,t={[e]:e=>e()},n={[e]:e=>{try{return e()}finally{}}};return eu()!==0&&t[e](()=>Error().stack)?.includes(e)===!0?t[e]:n[e]})(),iu=`~effect/Effect`,au=`~effect/Exit`,ou={_A:Cc,_E:Cc,_R:Cc},su=`${iu}/identifier`,cu=`${iu}/args`,lu=`${iu}/evaluate`,uu=`${iu}/successCont`,du=`${iu}/failureCont`,fu=`${iu}/ensureCont`,pu=Symbol.for(`effect/Effect/Yield`),mu={pipe(){return yc(this,arguments)},toJSON(){return{...this}},toString(){return Bl(this.toJSON(),{ignoreToString:!0,space:2})},[Xl](){return this.toJSON()}},hu={[iu]:ou,...mu,[Symbol.iterator](){return new nu(this)},toJSON(){return{_id:`Effect`,op:this[su],...cu in this?{args:this[cu]}:void 0}}},gu=e=>Jc(e,au),_u=`~effect/Cause`,vu=`~effect/Cause/Reason`,yu=e=>Jc(e,_u),bu=class{constructor(e){this[_u]=_u,this.reasons=e}pipe(){return yc(this,arguments)}toJSON(){return{_id:`Cause`,failures:this.reasons.map(e=>e.toJSON())}}toString(){return`Cause(${Bl(this.reasons)})`}[Xl](){return this.toJSON()}[ml](e){return yu(e)&&this.reasons.length===e.reasons.length&&this.reasons.every((t,n)=>hl(t,e.reasons[n]))}[Yc](){return sl(this.reasons)}},xu=new WeakMap,Su=class{[vu];annotations;_tag;constructor(e,t,n){if(this[vu]=vu,this._tag=e,t!==Cu&&typeof n==`object`&&n&&t.size>0){let e=xu.get(n);e&&(t=new Map([...e,...t])),xu.set(n,t)}this.annotations=t}annotate(e,t){if(e.mapUnsafe.size===0)return this;let n=new Map(this.annotations);e.mapUnsafe.forEach((e,r)=>{t?.overwrite!==!0&&n.has(r)||n.set(r,e)});let r=Object.assign(Object.create(Object.getPrototypeOf(this)),this);return r.annotations=n,r}pipe(){return yc(this,arguments)}toString(){return Bl(this)}[Xl](){return this.toString()}},Cu=new Map,wu=class extends Su{constructor(e,t=Cu){super(`Fail`,t,e),this.error=e}toString(){return`Fail(${Bl(this.error)})`}toJSON(){return{_tag:`Fail`,error:this.error}}[ml](e){return Mu(e)&&hl(this.error,e.error)&&hl(this.annotations,e.annotations)}[Yc](){return $c(rl(this._tag))($c(Xc(this.error))(Xc(this.annotations)))}},Tu=e=>new bu(e),Eu=(e,t)=>{let n=new Map,r=[];for(let i of e.concat(t)){let e=Xc(i),t=n.get(e);if(t===void 0)n.set(e,[i]);else if(t.some(e=>hl(e,i)))continue;else t.push(i);r.push(i)}return r},Du=Sc(2,(e,t)=>{if(e.reasons.length===0)return t;if(t.reasons.length===0)return e;let n=new bu(Eu(e.reasons,t.reasons));return hl(e,n)?e:n}),Ou=e=>new bu([new wu(e)]),ku=class extends Su{constructor(e,t=Cu){super(`Die`,t,e),this.defect=e}toString(){return`Die(${Bl(this.defect)})`}toJSON(){return{_tag:`Die`,defect:this.defect}}[ml](e){return Nu(e)&&hl(this.defect,e.defect)&&hl(this.annotations,e.annotations)}[Yc](){return $c(rl(this._tag))($c(Xc(this.defect))(Xc(this.annotations)))}},Au=e=>new bu([new ku(e)]),ju=Sc(e=>yu(e[0]),(e,t,n)=>t.mapUnsafe.size===0?e:new bu(e.reasons.map(e=>e.annotate(t,n)))),Mu=e=>e._tag===`Fail`,Nu=e=>e._tag===`Die`,Pu=e=>e._tag===`Interrupt`;function Fu(e){return Wu(`Effect.evaluate: Not implemented`)}var Iu=e=>({...hu,[su]:e.op,[lu]:e[lu]??Fu,[uu]:e[uu],[du]:e[du],[fu]:e[fu]}),Lu=e=>{let t=Iu(e),n=function(e){this[cu]=e};return n.prototype=t,function(e){return new n(e)}},Ru=e=>{let t={[au]:au,_tag:e.op,get[e.prop](){return this[cu]},...Iu(e),toString(){return`${e.op}(${Bl(this[cu])})`},toJSON(){return{_id:`Exit`,_tag:e.op,[e.prop]:this[cu]}},[ml](e){return gu(e)&&e._tag===this._tag&&hl(this[cu],e[cu])},[Yc](){return $c(rl(e.op),Xc(this[cu]))}},n=function(e){this[cu]=e};return n.prototype=t,function(e){return new n(e)}},zu=Ru({op:`Success`,prop:`value`,[lu](e){let t=e.getCont(uu);return t?t[uu](this[cu],e,this):e.yieldWith(this)}}),Bu={key:`effect/Cause/StackTrace`},Vu={key:`effect/Cause/InterruptorStackTrace`},Hu=Ru({op:`Failure`,prop:`cause`,[lu](e){let t=this[cu],n=!1;e.cache.stackFrame&&(t=ju(t,{mapUnsafe:new Map([[Bu.key,e.cache.stackFrame]])}),n=!0);let r=e.getCont(du),i=e._interruptedCause;if(i&&e.interruptible){let a=!1;for(;r&&e.interruptible;)a||=su in r,r=e.getCont(du);a&&(t=Tu(t.reasons.filter(e=>e._tag!==`Fail`))),t=Du(t,i),n=!0}return r?r[du](t,e,n?void 0:this):e.yieldWith(n?Hu(t):this)}}),Uu=e=>Hu(Ou(e)),Wu=e=>Hu(Au(e)),Gu=Lu({op:`WithFiber`,[lu](e){return this[cu](e)}}),Ku=function(){class e extends globalThis.Error{}let t=Iu({op:`YieldableError`,[lu](){return Uu(this)}});return delete t.toString,Object.assign(e.prototype,t),e}(),qu=function(){let e=Symbol.for(`effect/Data/Error/plainArgs`);return class extends Ku{constructor(t){super(t?.message,t?.cause?{cause:t.cause}:void 0),t&&(Ml(this,t),Object.defineProperty(this,e,{value:t,enumerable:!1}))}toJSON(){return{...this[e],...this}}}}(),Ju=e=>{class t extends qu{_tag=e}return t.prototype.name=e,t};Ju(`NoSuchElementError`);var Yu=`~effect/Option`,Xu={[Yu]:{_A:e=>e},...mu,[Symbol.iterator](){return new nu(this)}},Zu=Object.defineProperty(Object.assign(Object.create(Xu),{_tag:`Some`,_op:`Some`,[ml](e){return ed(e)&&nd(e)&&hl(this.value,e.value)},[Yc](){return $c(Xc(this._tag))(Xc(this.value))},toString(){return`some(${Bl(this.value)})`},toJSON(){return{_id:`Option`,_tag:this._tag,value:Zl(this.value)}}}),"valueOrUndefined",{get(){return this.value}}),Qu=Xc(`None`),$u=Object.assign(Object.create(Xu),{_tag:`None`,_op:`None`,valueOrUndefined:void 0,[ml](e){return ed(e)&&td(e)},[Yc](){return Qu},toString(){return`none()`},toJSON(){return{_id:`Option`,_tag:this._tag}}}),ed=e=>Jc(e,Yu),td=e=>e._tag===`None`,nd=e=>e._tag===`Some`,rd=Object.create($u),id=function(e){this.value=e};id.prototype=Zu;var ad=e=>new id(e),od=`~effect/Result`,sd={[od]:{_A:e=>e,_E:e=>e},...mu,[Symbol.iterator](){return new nu(this)}},cd=Object.assign(Object.create(sd),{_tag:`Success`,_op:`Success`,[ml](e){return ud(e)&&fd(e)&&hl(this.success,e.success)},[Yc](){return $c(Xc(this._tag))(Xc(this.success))},toString(){return`success(${Bl(this.success)})`},toJSON(){return{_id:`Result`,_tag:this._tag,value:Zl(this.success)}}}),ld=Object.assign(Object.create(sd),{_tag:`Failure`,_op:`Failure`,[ml](e){return ud(e)&&dd(e)&&hl(this.failure,e.failure)},[Yc](){return $c(Xc(this._tag))(Xc(this.failure))},toString(){return`failure(${Bl(this.failure)})`},toJSON(){return{_id:`Result`,_tag:this._tag,failure:Zl(this.failure)}}}),ud=e=>Jc(e,od),dd=e=>e._tag===`Failure`,fd=e=>e._tag===`Success`,pd=function(e){this.failure=e};pd.prototype=ld;var md=e=>new pd(e),hd=function(e){this.success=e};hd.prototype=cd;var gd=e=>new hd(e);function _d(e){return(t,n)=>t===n?0:e(t,n)}var vd=_d((e,t)=>e<t?-1:1),yd=_d((e,t)=>globalThis.Number.isNaN(e)&&globalThis.Number.isNaN(t)?0:globalThis.Number.isNaN(e)?-1:globalThis.Number.isNaN(t)?1:e<t?-1:1),bd=e=>Sc(2,(t,n)=>e(t,n)===-1),xd=e=>Sc(2,(t,n)=>e(t,n)===1),Sd=e=>Sc(2,(t,n)=>e(t,n)!==1),Cd=e=>Sc(2,(t,n)=>e(t,n)!==-1),wd=()=>rd,Td=ad,Ed=td,Dd=nd,Od=Sc(2,(e,{onNone:t,onSome:n})=>Ed(e)?t():n(e.value)),kd=Sc(2,(e,t)=>Ed(e)?t():e.value),Ad=Sc(2,(e,t)=>Ed(e)?t():e),jd=kd(Ec),Md=kd(Dc),Nd=Sc(2,(e,t)=>Ed(e)?wd():Td(t(e.value))),Pd=gd,Fd=md,Id=dd,Ld=fd,Rd=Sc(2,(e,t)=>Id(e)?Fd(t(e.failure)):e),zd=Sc(2,(e,{onFailure:t,onSuccess:n})=>Id(e)?t(e.failure):n(e.success)),Bd=globalThis.Array,Vd=Sc(2,(e,t)=>[...e,t]);Bd.isArray;var Hd=Al,Ud=Al,Wd=()=>[],Gd=Sc(2,(e,t)=>e.map(t)),Kd=`~effect/BigDecimal`,eee={[Kd]:Kd,[Yc](){let e=ef(this);return $c(rl(String(e.value)),nl(e.scale))},[ml](e){return qd(e)&&of(this,e)===0},toString(){return`BigDecimal(${cf(this)})`},toJSON(){return{_id:`BigDecimal`,value:String(this.value),scale:this.scale}},[Xl](){return this.toJSON()},pipe(){return yc(this,arguments)}},qd=e=>Jc(e,Kd),Jd=(e,t)=>{if(!Number.isSafeInteger(t))throw RangeError(`Scale must be a safe integer, got ${t}`);let n=Object.create(eee);return n.value=e,n.scale=t,n},Yd=(e,t)=>{let n=Jd(e,t);return n.normalized=n,n},Xd=BigInt(0),Zd=BigInt(1),Qd=BigInt(10),$d=Yd(Xd,0),ef=e=>{if(e.normalized===void 0){if(e.value===Xd)e.normalized=$d;else{let t=`${e.value}`,n=t.length;for(;t[n-1]===`0`;)n--;e.normalized=Yd(BigInt(t.slice(0,n)),e.scale-(t.length-n))}}return e.normalized},tf=100,nf=[Zd],rf=(e,t)=>e===t?0:e<t?-1:1,af=(e,t)=>{let n=`${e.value<Xd?-e.value:e.value}`,r=`${t.value<Xd?-t.value:t.value}`,i=BigInt(n.length-r.length)-BigInt(e.scale)+BigInt(t.scale);if(i!==Xd)return i<Xd?-1:1;let a=Math.max(n.length,r.length);return vd(n.padEnd(a,`0`),r.padEnd(a,`0`))},of=(e,t)=>{if(e.scale===t.scale)return rf(e.value,t.value);let n=sf(e),r=sf(t);if(n!==r)return n<r?-1:1;if(n===0)return 0;let i=e.scale-t.scale,a=Math.abs(i);if(a>tf)return n===-1?af(t,e):af(e,t);let o=nf[a]??=Qd**BigInt(a);return i>0?rf(e.value,t.value*o):rf(e.value*o,t.value)},sf=e=>e.value===Xd?0:e.value<Xd?-1:1,cf=e=>{let t=ef(e);if(Math.abs(t.scale)>=16)return lf(t);let n=t.value<Xd,r=`${n?-t.value:t.value}`,i=t.scale>0?r.padStart(t.scale+1,`0`):r.padEnd(r.length-t.scale,`0`),a=i.length-t.scale,o=t.scale>0?`${i.slice(0,a)}.${i.slice(a)}`:i;return n?`-${o}`:o},lf=e=>{if(uf(e))return`0e+0`;let t=ef(e),n=`${t.value}`,r=t.value<Xd?2:1,i=n.slice(0,r),a=n.slice(r),o=a.length-t.scale;return`${i}${a===``?``:`.${a}`}e${o>=0?`+`:``}${o}`},uf=e=>e.value===Xd,df=e=>Iu({op:e.label,[lu]:e.evaluate}),ff=`~effect/Context/Service`,pf=function(){function e(){}let t=e;Object.setPrototypeOf(t,mf);let n=(e,n)=>(t.key=e,n?.defaultValue&&(t[gf]=gf,t.defaultValue=n.defaultValue),n?.make&&(t.make=n.make),n?.fiberCached&&hf.add(e),t);return arguments.length>0?n(arguments[0],arguments[1]):n},mf={[ff]:ff,...df({label:`Service`,evaluate(e){return zu(If(e.context,this))}}),toJSON(){return{_id:`Service`,key:this.key}},of(e){return e},context(e){return Mf(this,e)},use(e){return Gu(t=>e(If(t.context,this)))},useSync(e){return Gu(t=>zu(e(If(t.context,this))))}},hf=new Set,gf=`~effect/Context/Reference`,_f=`~effect/Context`,vf=8,yf=8,bf=(e,t,n,r)=>{let i=Object.create(Ef);return i.cacheRoot=e??i,i.base=t,i.overlay=n,i.depth=r,i._flat=void 0,i.baseHits=0,i},xf=(e,t)=>{t&&(xf(e,t.parent),e.set(t.key,t.value))},Sf=e=>{if(e._flat)return e._flat;if(!e.overlay)return e._flat=e.base;let t=new Map(e.base);return xf(t,e.overlay),e._flat=t},Cf=Symbol(),wf=(e,t)=>{let n=e;for(let e=n.overlay;e;e=e.parent)if(e.key===t)return e.value;let r=n.base.get(t);return r===void 0&&!n.base.has(t)?Cf:(n.overlay&&++n.baseHits>=n.base.size&&n.baseHits>=yf&&(n.base=Sf(n),n.overlay=void 0,n.depth=0),r)},Tf=e=>bf(void 0,e,void 0,0),Ef={get mapUnsafe(){return Sf(this)},...mu,[_f]:{_Services:e=>e},toJSON(){return{_id:`Context`,services:Array.from(this.mapUnsafe).map(([e,t])=>({key:e,value:t}))}},[ml](e){if(!Of(e))return!1;let t=this.mapUnsafe,n=e.mapUnsafe;if(t.size!==n.size)return!1;for(let[e,r]of t)if(!n.has(e)||!hl(r,n.get(e)))return!1;return!0},[Yc](){return nl(this.mapUnsafe.size)}},Df=(e,t)=>e.cacheRoot===t.cacheRoot,Of=e=>Jc(e,_f),kf=e=>!!e[gf],Af=()=>jf,jf=Tf(new Map),Mf=(e,t)=>Tf(new Map([[e.key,t]])),Nf=Sc(3,(e,t,n)=>Pf(e,t.key,n)),Pf=(e,t,n)=>{let r=e,i=hf.has(t)?void 0:r.cacheRoot;if(r.depth>=vf){let e=new Map(r.mapUnsafe);return e.set(t,n),bf(i,e,void 0,0)}return bf(i,r.base,{key:t,value:n,parent:r.overlay},r.depth+1)},Ff=(e,t)=>{let n=wf(e,t);return n===Cf?void 0:n},If=Sc(2,(e,t)=>{let n=wf(e,t.key);if(n===Cf){if(kf(t))return Rf(t);throw zf(t)}return n}),Lf=`~effect/Context/defaultValue`,Rf=e=>Lf in e?e[Lf]:e[Lf]=e.defaultValue(),zf=e=>{let t=Error(`Service not found${e.key?`: ${String(e.key)}`:``}`);if(t.stack){let e=t.stack.split(`
|
|
68
|
+
`);e.splice(1,3),t.stack=e.join(`
|
|
69
|
+
`)}return t},Bf=pf,Vf=`~effect/Duration`,Hf=BigInt(0),Uf=BigInt(1),Wf=BigInt(2),Gf=BigInt(10),Kf=BigInt(1e3),qf=e=>BigInt(e<0?Math.ceil(e-.5):Math.floor(e+.5)),Jf=e=>qf(e*1e6),Yf=(e,t)=>{let n=e.indexOf(`.`);if(n===-1)return BigInt(e)*t;let r=e[0]===`-`,i=e.slice(n+1),a=Gf**BigInt(i.length),o=(BigInt(e.slice(+!!r,n))*a+BigInt(i))*t,s=o/a+(o%a*Wf>=a?Uf:Hf);return r?-s:s},Xf=/^(-?\d+(?:\.\d+)?)\s+(nanos?|micros?|millis?|seconds?|minutes?|hours?|days?|weeks?)$/,Zf=e=>{switch(typeof e){case`number`:return lp(e);case`bigint`:return cp(e);case`string`:{if(e===`Infinity`)return op;if(e===`-Infinity`)return sp;let t=Xf.exec(e);if(!t)break;let[n,r,i]=t;if(i===`nano`||i===`nanos`)return cp(Yf(r,Uf));if(i===`micro`||i===`micros`)return cp(Yf(r,Kf));let a=Number(r);switch(i){case`milli`:case`millis`:return lp(a);case`second`:case`seconds`:return up(a);case`minute`:case`minutes`:return dp(a);case`hour`:case`hours`:return fp(a);case`day`:case`days`:return pp(a);case`week`:case`weeks`:return mp(a)}break}case`object`:{if(e===null)break;if(Vf in e)return e;if(Array.isArray(e))return e.length!==2||!e.every(Rc)?Qf(e):Number.isNaN(e[0])||Number.isNaN(e[1])?ap:e[0]===-1/0||e[1]===-1/0?sp:e[0]===1/0||e[1]===1/0?op:rp(qf(e[0]*1e9+e[1]));let t=e,n=0;return t.weeks&&(n+=t.weeks*6048e5),t.days&&(n+=t.days*864e5),t.hours&&(n+=t.hours*36e5),t.minutes&&(n+=t.minutes*6e4),t.seconds&&(n+=t.seconds*1e3),t.milliseconds&&(n+=t.milliseconds),!t.microseconds&&!t.nanoseconds?rp(n):rp(qf(n*1e6+(t.microseconds??0)*1e3+(t.nanoseconds??0)))}}return Qf(e)},Qf=e=>{throw Error(`Invalid Input: ${e}`)},$f={_tag:`Millis`,millis:0},ep={_tag:`Infinity`},tp={_tag:`NegativeInfinity`},np={[Vf]:Vf,[Yc](){switch(this.value._tag){case`Millis`:{let e=this.value.millis*1e6;return Number.isFinite(e)?Xc(qf(e)):nl(this.value.millis)}case`Nanos`:return Xc(this.value.nanos);default:return al(this.value)}},[ml](e){return ip(e)&&vp(this,e)},toString(){switch(this.value._tag){case`Infinity`:return`Infinity`;case`NegativeInfinity`:return`-Infinity`;case`Nanos`:return`${this.value.nanos} nanos`;case`Millis`:return`${this.value.millis} millis`}},toJSON(){switch(this.value._tag){case`Millis`:return{_id:`Duration`,_tag:`Millis`,millis:this.value.millis};case`Nanos`:return{_id:`Duration`,_tag:`Nanos`,nanos:String(this.value.nanos)};case`Infinity`:return{_id:`Duration`,_tag:`Infinity`};case`NegativeInfinity`:return{_id:`Duration`,_tag:`NegativeInfinity`}}},[Xl](){return this.toJSON()},pipe(){return yc(this,arguments)}},rp=e=>{let t=Object.create(np);return t.value=typeof e==`number`?isNaN(e)||e===0||Object.is(e,-0)?$f:Number.isFinite(e)?Number.isInteger(e)?{_tag:`Millis`,millis:e}:{_tag:`Nanos`,nanos:Jf(e)}:e>0?ep:tp:e===Hf?$f:{_tag:`Nanos`,nanos:e},t},ip=e=>Jc(e,Vf),ap=rp(0),op=rp(1/0),sp=rp(-1/0),cp=e=>rp(e),lp=e=>rp(e),up=e=>rp(e*1e3),dp=e=>rp(e*6e4),fp=e=>rp(e*36e5),pp=e=>rp(e*864e5),mp=e=>rp(e*6048e5),hp=e=>{let t=Zf(e);switch(t.value._tag){case`Infinity`:case`NegativeInfinity`:throw Error(`Cannot convert infinite duration to nanos`);case`Nanos`:return t.value.nanos;case`Millis`:return Jf(t.value.millis)}},gp=Sc(3,(e,t,n)=>e.value._tag===`Infinity`||e.value._tag===`NegativeInfinity`||t.value._tag===`Infinity`||t.value._tag===`NegativeInfinity`?n.onInfinity(e,t):e.value._tag===`Millis`?t.value._tag===`Millis`?n.onMillis(e.value.millis,t.value.millis):n.onNanos(hp(e),t.value.nanos):n.onNanos(e.value.nanos,hp(t))),_p=(e,t)=>gp(e,t,{onMillis:(e,t)=>e===t,onNanos:(e,t)=>e===t,onInfinity:(e,t)=>e.value._tag===t.value._tag}),vp=Sc(2,(e,t)=>_p(e,t)),yp=Bf(`effect/Scheduler`,{fiberCached:!0,defaultValue:()=>new wp}),bp=e=>{let t=!1;return Promise.resolve().then(()=>{t||e()}),()=>{t=!0}},xp=`setImmediate`in globalThis?e=>{let t=globalThis.setImmediate(e);return()=>globalThis.clearImmediate(t)}:e=>{let t=setTimeout(e,0);return()=>clearTimeout(t)},Sp=e=>{try{return xp(e)}catch{return bp(e)}},Cp=class{buckets=[];scheduleTask(e,t){let n=this.buckets,r=n.length,i,a=0;for(;a<r&&!(n[a][0]>t);a++)i=n[a];i&&i[0]===t?i[1].push(e):a===r?n.push([t,[e]]):n.splice(a,0,[t,[e]])}drain(){let e=this.buckets;return this.buckets=[],e}},wp=class{executionMode;setImmediate;constructor(e=`async`,t){this.executionMode=e,this.setImmediate=t??(e===`sync`?bp:Sp)}shouldYield(e){return e.currentOpCount>=e.cache.maxOpsBeforeYield}makeDispatcher(){return new Tp(this.setImmediate)}},Tp=class{tasks=new Cp;running=void 0;setImmediate;constructor(e=Sp){this.setImmediate=e}scheduleTask(e,t){this.tasks.scheduleTask(e,t),this.running===void 0&&(this.running=this.setImmediate(this.afterScheduled))}afterScheduled=()=>{this.running=void 0,this.runTasks()};runTasks(){let e=this.tasks.drain();for(let t=0;t<e.length;t++){let n=e[t][1];for(let e=0;e<n.length;e++)n[e]()}}flush(){for(;this.tasks.buckets.length>0;)this.running!==void 0&&(this.running(),this.running=void 0),this.runTasks()}},Ep=Bf(`effect/Scheduler/MaxOpsBeforeYield`,{fiberCached:!0,defaultValue:()=>2048}),Dp=Bf(`effect/Scheduler/PreventSchedulerYield`,{fiberCached:!0,defaultValue:()=>!1}),Op=Ju,kp=`~effect/encoding/EncodingError`,Ap=class extends Op(`EncodingError`){[kp]=kp},jp=`effect/Tracer/ParentSpan`;pf()(jp,{fiberCached:!0});var Mp=`effect/Tracer`,Np=`effect/Metric/FiberRuntimeMetrics`,Pp=Bf(`effect/References/CurrentStackFrame`,{fiberCached:!0,defaultValue:Dc}),Fp=Bf(`effect/References/TracerEnabled`,{fiberCached:!0,defaultValue:Tc}),Ip=Bf(`effect/References/CurrentLogLevel`,{fiberCached:!0,defaultValue:()=>`Info`}),Lp=Bf(`effect/References/MinimumLogLevel`,{fiberCached:!0,defaultValue:()=>`Info`}),Rp=class extends Su{constructor(e,t=Cu){super(`Interrupt`,t,`Interrupted`),this.fiberId=e}toString(){return`Interrupt(${this.fiberId})`}toJSON(){return{_tag:`Interrupt`,fiberId:this.fiberId}}[ml](e){return Pu(e)&&this.fiberId===e.fiberId&&this.annotations===e.annotations}[Yc](){return $c(rl(`${this._tag}:${this.fiberId}`))(Zc(this.annotations))}},zp=e=>new bu([new Rp(e)]),Bp=e=>{for(let t=0;t<e.reasons.length;t++){let n=e.reasons[t];if(n._tag===`Fail`)return Pd(n.error)}return Fd(e)},Vp=e=>e.reasons.some(Pu),Hp=Sc(2,(e,t)=>{let n=!1,r=e.reasons.map(e=>Mu(e)?(n=!0,new wu(t(e.error),e.annotations)):e);return n?Tu(r):e}),Up=(e,t)=>{let n=[],r=[];if(e.reasons.length===0)return n;let i=eu();i!==0&&tu(1);try{for(let i of e.reasons){if(i._tag===`Interrupt`){r.push(i);continue}n.push(Wp(i._tag===`Die`?i.defect:i.error,i.annotations,t))}if(n.length===0){let e=Error(`The fiber was interrupted by:`);e.name=`InterruptCause`,e.stack=Yp(e,r);let i=new globalThis.Error(`All fibers interrupted without error`,{cause:e});i.name=`InterruptError`,i.stack=`${i.name}: ${i.message}`,n.push(Wp(i,r[0].annotations,t))}}finally{i!==0&&tu(i)}return n},Wp=(e,t,n)=>{let r=typeof e,i;if(e&&r===`object`){if(i=new globalThis.Error(Gp(e),{cause:e.cause?Wp(e.cause):void 0}),typeof e.name==`string`&&(i.name=e.name),typeof e.stack==`string`)i.stack=qp(e.stack,i,t);else{let e=`${i.name}: ${i.message}`;i.stack=t?Jp(e,t):e}n?.includeCauseInStack&&(i.stack=Qp(i));for(let t of Object.keys(e))t in i||(i[t]=e[t])}else{i=new globalThis.Error(e?r===`string`?e:ql(e):`Unknown error: ${e}`);let n=`${i.name}: ${i.message}`;i.stack=t?Jp(n,t):n}return i},Gp=e=>{if(typeof e.message==`string`)return e.message;if(typeof e.toString==`function`&&e.toString!==Object.prototype.toString&&e.toString!==Array.prototype.toString)try{return e.toString()}catch{}return ql(e)},Kp=/\((.*)\)/g,qp=(e,t,n)=>{let r=`${t.name}: ${t.message}`,i=(e.startsWith(r)?e.slice(r.length):e).split(`
|
|
70
|
+
`),a=[r];for(let e=1;e<i.length&&!/Generator\.next|~effect\/(?:Effect|Utils)/.test(i[e]);e++)a.push(i[e]);return n?Jp(a.join(`
|
|
71
|
+
`),n):a.join(`
|
|
72
|
+
`)},Jp=(e,t)=>{let n=t?.get(Bu.key);return n&&(e=`${e}\n${Xp(n)}`),e},Yp=(e,t)=>{let n=[`${e.name}: ${e.message}`];for(let e of t){let t=e.fiberId===void 0?`unknown`:`#${e.fiberId}`,r=e.annotations.get(Vu.key);n.push(` at fiber (${t})`),r&&n.push(Xp(r))}return n.join(`
|
|
73
|
+
`)},Xp=e=>{let t=[],n=e,r=0;for(;n&&r<10;){let e=n.stack();if(e){let r=e.matchAll(Kp),i=!1;for(let[,e]of r)i=!0,t.push(` at ${n.name} (${e})`);i||t.push(` at ${n.name} (${e.replace(/^at /,``)})`)}else t.push(` at ${n.name}`);n=n.parent,r++}return t.join(`
|
|
74
|
+
`)},Zp=e=>Up(e).map(Qp).join(`
|
|
75
|
+
`),Qp=e=>e.cause?`${e.stack} {\n${$p(e.cause,` `)}\n}`:e.stack,$p=(e,t)=>{let n=e.stack.split(`
|
|
76
|
+
`),r=`${t}[cause]: ${n[0]}`;for(let e=1,i=n.length;e<i;e++)r+=`\n${t}${n[e]}`;return e.cause&&(r+=` {\n${$p(e.cause,`${t} `)}\n${t}}`),r},em=`~effect/Fiber`,tm={_A:Cc,_E:Cc},nm={id:0},rm=(()=>{try{return globalThis.process?.getBuiltinModule?.(`node:async_hooks`)?.AsyncResource}catch{return}})(),im=()=>rm===void 0?void 0:new rm(`effect/Fiber`),am=()=>globalThis[Ll],om=class{constructor(e,t=!0){this.setContext(e),this.id=++nm.id,this.currentOpCount=0,this.interruptible=t,this._stack=[],this._observers=void 0,this._exit=void 0,this._children=void 0,this._interruptedCause=void 0,this._yielded=void 0,this._running=!1,this._deferredInterrupt=!1,this._parent=void 0,this._asyncContext=void 0,this.cache.runtimeMetrics?.recordFiberStart(this.context)}get[em](){return tm}get currentDispatcher(){return this._dispatcher??=this.cache.scheduler.makeDispatcher()}getRef(e){return If(this.context,e)}addObserver(e){return this._exit?(e(this._exit),Oc):(this._observers===void 0?this._observers=[e]:this._observers.push(e),()=>this.removeObserver(e))}removeObserver(e){if(this._exit||this._observers===void 0)return;let t=this._observers.indexOf(e);t>=0&&this._observers.splice(t,1)}interruptUnsafe(e,t){if(this._exit)return;let n=zp(e);this.cache.stackFrame&&(n=ju(n,Mf(Bu,this.cache.stackFrame))),t&&(n=ju(n,t)),this._interruptedCause=this._interruptedCause?Du(this._interruptedCause,n):n,this.interruptible&&(this._running?this._deferredInterrupt=!0:this.evaluate(hm(this._interruptedCause)))}pollUnsafe(){return this._exit}evaluate(e){if(this._exit)return;if(this._asyncContext!==void 0){let t=this._asyncContext;return this._asyncContext=void 0,t.runInAsyncScope(this.evaluate,this,e)}if(this._yielded!==void 0){let e=this._yielded;this._yielded=void 0,e()}let t=this.runLoop(e);if(t===pu){this._asyncContext=im();return}let n=um.interruptChildren&&um.interruptChildren(this);if(n!==void 0)return this.evaluate(Vm(n,()=>t));if(this._exit=t,this.cache.runtimeMetrics?.recordFiberEnd(this.context,this._exit),this._parent&&=(this._parent._children?.delete(this),void 0),this._observers!==void 0){let e=this._observers;this._observers=void 0;for(let n=0;n<e.length;n++)e[n](t)}this._stack.length=0,this._children=void 0,this.context=Af()}runLoop(e){let t=globalThis[Ll];globalThis[Ll]=this;let n=this._running;this._running=!0;let r=!1,i=e;this.currentOpCount=0;try{for(;;)try{this._deferredInterrupt&&(this._deferredInterrupt=!1,i=hm(this._interruptedCause)),this.currentOpCount++;let e=this.cache;if(!r&&!e.preventYield&&e.scheduler.shouldYield(this)){r=!0;let e=i;i=Vm(bm,()=>e)}if(i=e.tracerContext?e.tracerContext(i,this):i[lu](this),i===pu){let e=this._yielded;if(au in e)return this._deferredInterrupt=!1,this._yielded=void 0,e;if(this._deferredInterrupt){this._yielded=void 0,e();continue}return pu}}catch(e){if(!Jc(i,lu))return Wu(`Fiber.runLoop: Not a valid effect: ${String(i)}`);i=Wu(e)}}finally{this._running=n,globalThis[Ll]=t}}getCont(e){if(this._deferredInterrupt)return this._deferredInterrupt=!1,cm;for(;;){let t=this._stack.pop();if(!t)return;let n=t[fu];if(n!==void 0){let r=n.call(t,this);if(r)return r[e]=r,r}if(t[e])return t}}succeedWith(e){if(!(++this.currentOpCount&lm-1))return zu(e);let t=this.getCont(uu);return t?t[uu](e,this):this.yieldWith(zu(e))}yieldWith(e){return this._yielded=e,pu}children(){return this._children??=new Set}pipe(){return yc(this,arguments)}setContext(e){let t=this.context;if(this.context=e,t!==void 0&&Df(t,e))return;let n=e.cacheRoot,r=n._fiberCache??=sm(e);this.cache?.scheduler!==r.scheduler&&(this._dispatcher=void 0),this.cache=r}get currentSpanLocal(){let e=this.cache.span;return e?._tag===`Span`?e:void 0}},sm=e=>{let t=Ff(e,Mp);return{scheduler:If(e,yp),tracer:t,tracerContext:t?t.context:void 0,tracerEnabled:If(e,Fp),span:Ff(e,jp),logLevel:If(e,Ip),minimumLogLevel:If(e,Lp),stackFrame:If(e,Pp),runtimeMetrics:Ff(e,Np),maxOpsBeforeYield:If(e,Ep),preventYield:If(e,Dp)}},cm={[uu](e,t){return hm(t._interruptedCause)},[du](e,t){return hm(t._interruptedCause)}},lm=32,um={interruptChildren:void 0},dm=e=>{if(!e.cache.stackFrame)return;let t=new Map;return t.set(Vu.key,e.cache.stackFrame),Tf(t)},fm=e=>Om(t=>{let n=e[Symbol.iterator](),r=[],i;function a(){let e=n.next();for(;!e.done;){if(e.value._exit){r.push(e.value._exit),e=n.next();continue}i=e.value.addObserver(e=>{r.push(e),a()});return}t(mm(r))}return a(),_m(()=>i?.())}),pm=e=>Gu(t=>{let n=dm(t),r=Wd();for(let i of e)i.interruptUnsafe(t.id,n),r.push(i);return Bm(fm(r))}),mm=zu,hm=Hu,gm=Uu,_m=Lu({op:`Sync`,[lu](e){let t=this[cu](),n=e.getCont(uu);return n?n[uu](t,e):e.yieldWith(zu(t))}}),vm=Lu({op:`Suspend`,[lu](e){return this[cu]()}}),ym=zd({onFailure:gm,onSuccess:mm}),bm=Lu({op:`Yield`,[lu](e){let t=!1;return e.currentDispatcher.scheduleTask(()=>{t||e.evaluate(Jm)},this[cu]??0),e.yieldWith(()=>{t=!0})}})(0),xm=e=>vm(()=>hm(e())),Sm=e=>Wu(e),Cm=e=>vm(()=>gm(e())),wm=mm(void 0),Tm=e=>{let t=typeof e==`function`?e:e.try,n=typeof e==`function`?e=>new vh(e,`An error occurred in Effect.try`):e.catch;return vm(()=>{try{return mm(t())}catch(e){return gm(n(e))}})},Em=function(){let e=Iu({op:`Async`,[lu](e){let t=!1,n=!1,r=this.withSignal?new AbortController:void 0,i=this.register.call(e.cache.scheduler,r=>{t||(t=!0,n?e.evaluate(r):n=r)},r?.signal);return n===!1?(n=!0,e._yielded=()=>{t=!0},r===void 0&&i===void 0||e._stack.push(Dm(()=>(t=!0,r?.abort(),i??Jm))),pu):n}}),t=function(e,t){this.register=e,this.withSignal=t};return t.prototype=e,function(e,n){return new t(e,n)}}(),Dm=Lu({op:`AsyncFinalizer`,[fu](e){e.interruptible&&(e.interruptible=!1,e._stack.push(oh))},[du](e,t){return Vp(e)?Vm(ih(Hu(e),this[cu]()),()=>hm(e)):hm(e)}}),Om=e=>Em(e,e.length>=2),km=(e,t)=>Object.defineProperty(t,"length",{value:e,configurable:!0}),Am=(e,...t)=>km(e.length,t.length===0?function(){return jm(()=>e.apply(this,arguments))}:function(){let n=jm(()=>e.apply(this,arguments));for(let e of t)n=e(n,...arguments);return n}),jm=e=>{try{let t=e(),n;for(;;){let r=t.next(n);if(r.done)return mm(r.value);let i=r.value;if(i&&i._tag===`Success`){n=i.value;continue}if(i&&i._tag===`Failure`)return r.value;{let n=!0;return vm(()=>n?(n=!1,Vm(r.value,e=>Mm(t,e))):vm(()=>Mm(e())))}}}catch(e){return Sm(e)}},Mm=function(){let e=Iu({op:`Iterator`,[uu](e,t){let n=this.iterator;for(;;){let r=n.next(e);if(r.done)return mm(r.value);if(!Hm(r.value))return t._stack.push(this),r.value;if(r.value._tag===`Failure`)return r.value;e=r.value.value}},[lu](e){return this[uu](this.initial,e)}}),t=function(e,t){this.iterator=e,this.initial=t};return t.prototype=e,function(e,n){return new t(e,n)}}(),Nm=function(e){return e._stack.push(this),this[cu]},Pm=Iu({op:`OnSuccess`,[lu]:Nm}),Fm=function(e,t,n){this[cu]=e,this[uu]=t,this.payload=n};Fm.prototype=Pm;var Im=function(){return this.payload},Lm=(()=>{let e=`~effect/Effect/stackProbe`;return{[e]:function(){return Error().stack}}[e]()?.includes(`[as `+e+`]`)===!0})(),Rm=function(e,t){let n=this.payload;return t.succeedWith(Lm?n(e):ru(()=>n(e)))},zm=function(e){let t=this.payload;return t(e)},Bm=e=>new Fm(e,Im,Jm),Vm=Sc(2,(e,t)=>new Fm(e,zm,t)),Hm=e=>e[au]!==void 0,Um=Sc(2,(e,t)=>Hm(e)?e._tag===`Success`?t(e.value):e:Vm(e,t)),Wm=Sc(2,(e,t)=>new Fm(e,Rm,t)),Gm=Sc(2,(e,t)=>Hm(e)?Ym(e,t):Wm(e,t)),Km=Sc(2,(e,t)=>Hm(e)?Xm(e,t):tee(e,t)),qm=e=>e._tag===`Success`,Jm=zu(void 0),Ym=Sc(2,(e,t)=>e._tag===`Success`?zu(t(e.value)):e),Xm=Sc(2,(e,t)=>{if(e._tag===`Success`)return e;let n=Bp(e.cause);return Id(n)?e:Uu(t(n.success))}),Zm=Sc(2,(e,t)=>new $m(e,t.length===1?t:e=>t(e))),Qm=Iu({op:`OnFailure`,[lu]:Nm}),$m=function(e,t){this[cu]=e,this[du]=t};$m.prototype=Qm;var eh=Sc(3,(e,t,n)=>Zm(e,e=>{let r=t(e);return Id(r)?hm(r.failure):n(r.success,e)})),th=Sc(2,(e,t)=>eh(e,Bp,e=>t(e))),tee=Sc(2,(e,t)=>th(e,e=>Cm(()=>t(e)))),nee=function(e,t){let n=this.payload;return t.succeedWith(Lm?n.onSuccess(e):ru(()=>n.onSuccess(e)))},ree=((e,t)=>{let n=Iu({op:e,[lu]:Nm,[uu]:nee,[du]:t}),r=function(e,t){this[cu]=e,this.payload=t};return r.prototype=n,r})(`Match`,function(e,t){let n=e.reasons.find(Mu);if(n===void 0)return hm(e);let r=this.payload;return t.succeedWith(Lm?r.onFailure(n.error):ru(()=>r.onFailure(n.error)))}),iee=Sc(2,(e,t)=>new ree(e,t)),nh=e=>Hm(e)?zu(e):rh(e),rh=Lu({op:`Exit`,[lu](e){return e._stack.push(this),this[cu]},[uu](e,t,n){return t.succeedWith(n??zu(e))},[du](e,t,n){return t.succeedWith(n??Hu(e))}}),ih=(e,t)=>qm(e)?t:Zm(t,t=>hm(Du(e.cause,t))),ah=e=>Gu(t=>t.interruptible?(t.interruptible=!1,t._stack.push(oh),e):e),oh=Lu({op:`SetInterruptible`,[fu](e){if(e.interruptible=this[cu],e._interruptedCause&&e.interruptible)return()=>hm(e._interruptedCause)}})(!0),sh=e=>e===`unbounded`?1/0:Math.max(1,e??1),ch=()=>e=>{let t=e.onItem,n=e.step,r=(e,t,r,a,o)=>Vm(nh(o),o=>n(e,t[r],o,r)??i(e,t,r+1,a)??wm),i=(e,i,a=0,o=i.length)=>{for(;a<o;a++){let s=i[a],c=t(e,s,a);if(!Hm(c))return r(e,i,a,o,c);let l=n(e,s,c,a);if(l)return l._tag===`Failure`?l:void 0}};return i},lh=e=>{let t=e.onItem,n=e.step;return(e,r,i)=>{let a=0,o=i.end??r.length,s=i.concurrency,c=!1,l,u,d,f,p,m=e=>{let t=Wu(e);return f=t,c=!0,u&&u.size>0?Vm(ah(pm(Array.from(u))),()=>f??t):t},h=()=>{let i=!1;for(;!f&&a<o;a++){let o=r[a],g=p??t(e,o,a);if(Hm(g)){if(f=n(e,o,g,a),f)break}else if(l){p=void 0;let t=dh(l,g,!0,!0,`inherit`);if(t._exit){if(f=n(e,o,t._exit,a),f)break;continue}u.add(t);let r=a;if(t.addObserver(a=>{u.delete(t);try{if(f){if(a._tag===`Failure`){let e=a.cause.reasons.filter(e=>e._tag!==`Interrupt`);if(e.length>0){let t=Tu(e);f=Hu(f._tag===`Failure`?Du(f.cause,t):t)}}}else{let t=n(e,o,a,r);t&&(f=t,h())}if(i){let e=h();e&&d(e)}else c&&u.size===0&&d(f??wm)}catch(e){d(m(e))}}),u.size<s)continue;i=!0,a++;return}else return Om(e=>{l=am(),u=new Set,p=g,d=e;let t;try{t=h()}catch(t){return e(m(t))}return t?e(t):vm(()=>(f??=Jm,Vm(u?pm(u):wm,()=>f?._tag===`Failure`?f:wm)))})}if(c=!0,f){if(u&&u.size>0){let e=dm(l);u.forEach(t=>t.interruptUnsafe(l.id,e));return}if(d||f._tag===`Failure`)return f}else if(d){if(u)u.size===0&&d(wm);else return Jm}};return h()}},uh=()=>e=>lh(e),dh=(e,t,n=!1,r=!1,i=!1)=>{let a=e,o=i===`inherit`?a.interruptible:!i,s=new om(a.context,o);return r||(a.children().add(s),s._parent=a),n?s.evaluate(t):(s._asyncContext=im(),a.currentDispatcher.scheduleTask(()=>s.evaluate(t),0)),s},fh=e=>(t,n)=>{let r=new om(n?.scheduler?Nf(e,yp,n.scheduler):e,n?.uninterruptible!==!0);if(r.evaluate(t),r._exit)return r;if(n?.signal){if(n.signal.aborted)r.interruptUnsafe();else{let e=()=>r.interruptUnsafe();n.signal.addEventListener(`abort`,e,{once:!0}),r.addObserver(()=>n.signal.removeEventListener(`abort`,e))}}return n?.onFiberStart&&n.onFiberStart(r),r},ph=fh(Af()),mh=(e=>{let t=fh(e);return e=>{if(Hm(e))return e;let n=new wp(`sync`),r=t(e,{scheduler:n});return r._dispatcher?.flush(),r._exit??Wu(new gh(r))}})(Af());Ju(`TimeoutError`),Ju(`IllegalArgumentError`),Ju(`ExceededCapacityError`);var hh=`~effect/Cause/AsyncFiberError`,gh=class extends Ju(`AsyncFiberError`){[hh]=hh;constructor(e){super({message:`An asynchronous Effect was executed with Effect.runSync`,fiber:e})}},_h=`~effect/Cause/UnknownError`,vh=class extends Ju(`UnknownError`){[_h]=_h;constructor(e,t){super({message:t,cause:e})}},yh={bold:`1`,red:`31`,green:`32`,yellow:`33`,blue:`34`,cyan:`36`,white:`37`,gray:`90`,black:`30`,bgBrightRed:`101`};yh.gray,yh.blue,yh.green,yh.yellow,yh.red,yh.bgBrightRed,yh.black;var bh=Mu,xh=Au,Sh=Hp,Ch=Zp;pf()(`effect/Cause/StackTrace`),pf()(`effect/Cause/InterruptorStackTrace`);var wh=zu,Th=Hu,Eh=Uu,Dh=Jm,Oh=qm,kh=`~effect/DateTime`,Ah=`~effect/DateTime/TimeZone`,jh={[kh]:kh,pipe(){return yc(this,arguments)},[Xl](){return this.toString()},toJSON(){return Nh(this).toJSON()}};({...jh}),{...jh};var Mh={[Ah]:Ah,[Xl](){return this.toString()}};({...Mh}),{...Mh};var Nh=e=>new Date(e.epochMilliseconds);globalThis.String;var Ph=e=>e.trim(),Fh=mm,Ih=vm,Lh=gm,Rh=xm,zh=Sm,Bh=Tm,Vh=ym,Hh=Vm,Uh=nh,Wh=Zm,Gh=iee,Kh=ph,qh=mh;pf()(`effect/Effect/Transaction`);var Jh=Gm,Yh=Km,Xh=Um,Zh=Am;pf()(`effect/DateTime/CurrentTimeZone`);var Qh=e=>eg(typeof e==`string`?tg.encode(e):e),$h=e=>{let t=ng(e),n=t.length;if(n%4!=0)return Fd(new Ap({kind:`Decode`,module:`Base64`,input:t,message:`Length must be a multiple of 4, but is ${n}`}));let r=t.indexOf(`=`);if(r!==-1&&(r<n-2||r===n-2&&t[n-1]!==`=`))return Fd(new Ap({kind:`Decode`,module:`Base64`,input:t,message:`Found a '=' character, but it is not at the end`}));try{let e=t.endsWith(`==`)?2:+!!t.endsWith(`=`),r=new Uint8Array(n/4*3-e);for(let e=0,i=0;e<n;e+=4,i+=3){let n=ag(t.charCodeAt(e))<<18|ag(t.charCodeAt(e+1))<<12|ag(t.charCodeAt(e+2))<<6|ag(t.charCodeAt(e+3));r[i]=n>>16,r[i+1]=n>>8&255,r[i+2]=n&255}return Pd(r)}catch(e){return Fd(new Ap({kind:`Decode`,module:`Base64`,input:t,message:e instanceof Error?e.message:`Invalid input`}))}},eg=e=>{let t=e.length,n=``,r;for(r=2;r<t;r+=3)n+=rg[e[r-2]>>2],n+=rg[(e[r-2]&3)<<4|e[r-1]>>4],n+=rg[(e[r-1]&15)<<2|e[r]>>6],n+=rg[e[r]&63];return r===t+1&&(n+=rg[e[r-2]>>2],n+=rg[(e[r-2]&3)<<4],n+=`==`),r===t&&(n+=rg[e[r-2]>>2],n+=rg[(e[r-2]&3)<<4|e[r-1]>>4],n+=rg[(e[r-1]&15)<<2],n+=`=`),n},tg=new TextEncoder,ng=e=>e.replace(/[\n\r]/g,``),rg=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`,ig=new Uint8Array(123).fill(255);for(let e=0;e<64;e++)ig[rg.charCodeAt(e)]=e;ig[61]=0;var ag=e=>{if(e>=ig.length||ig[e]===255)throw TypeError(`Invalid character ${String.fromCharCode(e)}`);return ig[e]};Op(`CookiesError`),{...Ql},{...Ql};var og=new WeakMap,sg=`~effect/Redacted`,cg=e=>Jc(e,sg),lg=(e,t)=>{let n=Object.create(ug);return t?.label&&(n.label=t.label),og.set(n,e),n},ug={[sg]:{_A:e=>e},label:void 0,...mu,toJSON(){return this.toString()},toString(){return`<redacted${Lc(this.label)?`:`+this.label:``}>`},[Yc](){return Xc(og.get(this))},[ml](e){return cg(e)&&hl(og.get(this),og.get(e))}};({...mu});function dg(e){return e.checks?e.checks[e.checks.length-1].annotations:e.annotations}function fg(e){return t=>dg(t)?.[e]}var pg=`~structural`,mg=`~identifier`,hg=`~sentinels`,gg=`~constructor`,_g=[`title`,`description`,`default`,`examples`,`readOnly`,`writeOnly`,`format`,`contentEncoding`,`contentMediaType`,`contentSchema`],vg=fg(`identifier`),yg=fg(mg),bg=fg(`title`),xg=fg(`description`),Sg=Ac(e=>{let t=dg(e)?.identifier;return typeof t==`string`?t:e.getExpected(Sg)}),Cg=new Set([hg,pg,`representation`,`arbitraryConstraint`,`toJsonSchema`,`toCode`,`toEquivalence`,`toFormatter`,`toCodec`,`toCodecJson`,`toCodecStringTree`,`toCodecIso`,`toCodecArbitrary`]),wg=Symbol(),Tg=wh,Eg=Tg(wg),Dg=Tg(wg),Og=e=>e===wg?wd():Td(e),kg=e=>e._tag===`None`?Eg:Tg(e.value),Ag=`~effect/SchemaIssue/Issue`;function jg(e){return Jc(e,Ag)&&e[Ag]===Ag}function Mg(e){return Object.hasOwn(e,`input`)}var Ng=class{[Ag]=Ag;constructor(e,t){t?.reportInput===!0&&e!==wg&&(this.input=e)}},Pg=class extends Ng{_tag=`Filter`;filter;issue;constructor(e,t,n,r){super(n,r),this.filter=e,this.issue=t}},Fg=class extends Ng{_tag=`Encoding`;ast;issue;constructor(e,t,n,r){super(n,r),this.ast=e,this.issue=t}},Ig=class extends Ng{_tag=`Pointer`;path;issue;constructor(e,t){super(),this.path=e,this.issue=t}},Lg=class extends Ng{_tag=`MissingKey`;annotations;constructor(e){super(),this.annotations=e}},Rg=class extends Ng{_tag=`UnexpectedKey`;ast;constructor(e,t,n){super(t,n),this.ast=e}},zg=class extends Ng{_tag=`Composite`;ast;issues;constructor(e,t,n,r){super(n,r),this.ast=e,this.issues=t}},Bg=class extends Ng{_tag=`InvalidType`;ast;constructor(e,t,n){super(t,n),this.ast=e}},Vg=class extends Ng{_tag=`InvalidValue`;annotations;constructor(e,t,n){super(t,n),this.annotations=e}},Hg=class extends Ng{_tag=`AnyOf`;ast;issues;constructor(e,t,n,r){super(n,r),this.ast=e,this.issues=t}},Ug=class extends Ng{_tag=`OneOf`;ast;successes;constructor(e,t,n,r){super(n,r),this.ast=e,this.successes=t}};function Wg(e,t,n){if(jg(e))return e;if(typeof e==`string`)return new Vg({message:e},t,n);let r=typeof e.issue==`string`?new Vg({message:e.issue},t,n):e.issue;return new Ig(e.path,r)}function Gg(e,t,n){if(e!==void 0)return typeof e==`boolean`?e?void 0:new Vg(void 0,t,n):Wg(e,t,n)}function Kg(e,t,n,r){return Array.isArray(t)?Ud(t)?t.length===1?Wg(t[0],n,r):new zg(e,Gd(t,e=>Wg(e,n,r)),n,r):void 0:Gg(t,n,r)}var qg=e=>{let t=i_(e);if(t!==void 0)return t;switch(e._tag){case`InvalidType`:return Qg(Sg(e.ast),e);case`InvalidValue`:{let t=Zg(e);if(t!==void 0)return Qg(t,e);let n=Xg(e);return n===void 0?`Expected a valid value`:`Invalid data ${n}`}case`MissingKey`:return`Missing key`;case`UnexpectedKey`:{let t=Xg(e);return t===void 0?`Expected no excess property`:`Unexpected key with value ${t}`}case`Forbidden`:return`Forbidden operation`;case`OneOf`:{let t=Xg(e);return t===void 0?`Expected exactly one member to match`:`Expected exactly one member to match the input ${t}`}}},Jg=e=>i_(e.issue)??i_(e);function Yg(e){return t=>({issues:$g(t,[],e?.leafHook??qg,e?.checkHook??Jg)})}function Xg(e){return Mg(e)?Bl(e.input):void 0}function Zg(e){let t=e.annotations?.expected;return typeof t==`string`?t:void 0}function Qg(e,t){let n=Xg(t);return n===void 0?`Expected ${e}`:`Expected ${e}, got ${n}`}function $g(e,t,n,r){switch(e._tag){case`Filter`:{let i=r(e);if(i!==void 0)return[{path:t,message:i}];if(e.issue._tag!==`InvalidValue`)return $g(e.issue,t,n,r);let a=Zg(e.issue);return[{path:t,message:a===void 0?Qg(e_(e.filter),e):Qg(a,e.issue)}]}case`Encoding`:return $g(e.issue,t,n,r);case`Pointer`:return $g(e.issue,[...t,...e.path],n,r);case`Composite`:return e.issues.flatMap(e=>$g(e,t,n,r));case`AnyOf`:return e.issues.length===0?[{path:t,message:i_(e)??Qg(Sg(e.ast),e)}]:e.issues.flatMap(e=>$g(e,t,n,r));default:return[{path:t,message:n(e)}]}}function e_(e){let t=e.annotations?.expected;if(typeof t==`string`)return t;switch(e._tag){case`Filter`:return`<filter>`;case`FilterGroup`:return e.checks.map(e=>e_(e)).join(` & `)}}function t_(){return e=>r_(e,``)}var n_=t_();function r_(e,t){let n;switch(e._tag){case`Filter`:{let r=Jg(e);if(r!==void 0)n=r;else{if(e.issue._tag!==`InvalidValue`)return r_(e.issue,t);let r=Zg(e.issue);n=r===void 0?Qg(e_(e.filter),e):Qg(r,e.issue)}break}case`Encoding`:return r_(e.issue,t);case`Pointer`:return r_(e.issue,t+Ul(e.path));case`Composite`:case`AnyOf`:if(e._tag===`Composite`||e.issues.length>0)return e.issues.map(e=>r_(e,t)).join(`
|
|
77
|
+
`);n=i_(e)??Qg(Sg(e.ast),e);break;default:n=qg(e)}return t?`${n}\n at ${t}`:n}function i_(e){if(e._tag===`Pointer`)return;if(e._tag===`Encoding`)return i_(e.issue);let t=(e._tag===`Filter`?e.filter.annotations:`annotations`in e?e.annotations:e.ast.annotations)?.[e._tag===`MissingKey`?`messageMissingKey`:e._tag===`UnexpectedKey`?`messageUnexpectedKey`:`message`];if(typeof t==`string`)return t}function a_(e){let t;for(let n of e.reasons){if(!bh(n)||!jg(n.error))return;t??=n.error}return t}function o_(e,t){let n=a_(e);if(n===void 0)throw Error(t,{cause:e});return n}var s_=e=>Object.assign(Object.create(bc),e),c_=s_({_tag:`Passthrough`});function l_(){return c_}function u_(e){return s_({_tag:`Transform`,transform:e})}function d_(e){return s_({_tag:`TransformEffect`,transform:e})}function f_(){return u_(globalThis.String)}function p_(){return u_(globalThis.Number)}function m_(){return u_(Ph)}function h_(e){return d_((t,n)=>Bh({try:()=>JSON.parse(t,e?.reviver),catch:()=>new Vg({expected:`a valid JSON string`},t,n)}))}function g_(e){return d_((t,n)=>Bh({try:()=>{let n=JSON.stringify(t,e?.replacer,e?.space);if(n===void 0)throw TypeError(`Value cannot be represented as JSON`);return n},catch:()=>new Vg({expected:`a JSON-serializable value`},t,n)}))}function __(){return u_(Qh)}function v_(){return d_((e,t)=>Yh(Vh($h(e)),()=>new Vg({expected:`a valid Base64 string`},e,t)))}var y_=class extends xc{_tag=`Middleware`;decode;encode;constructor(e,t){super(),this.decode=e,this.encode=t}flip(){return new y_(this.encode,this.decode)}},b_=`~effect/SchemaTransformation/Transformation`,x_=class extends xc{[b_]=b_;_tag=`Transformation`;decode;encode;constructor(e,t){super(),this.decode=e,this.encode=t}flip(){return new x_(this.encode,this.decode)}};function S_(e){return Jc(e,b_)&&e[b_]===b_}var C_=e=>S_(e)?e:new x_(e.decode,e.encode);function w_(){return new x_(m_(),l_())}var T_=new x_(l_(),l_());function E_(){return T_}var D_=new x_(p_(),f_()),O_=new x_(v_(),__());function k_(e){return new x_(h_(e??{}),g_(e))}function A_(e){return t=>t._tag===e}var j_=A_(`Declaration`),M_=A_(`Null`),N_=A_(`Undefined`),P_=A_(`Never`),F_=A_(`String`),I_=A_(`Number`),L_=A_(`Boolean`),R_=A_(`Literal`),z_=A_(`UniqueSymbol`),B_=A_(`Arrays`),V_=A_(`Objects`),H_=A_(`Union`),U_=A_(`Suspend`),W_=class{to;transformation;constructor(e,t){this.to=e,this.transformation=t}},G_={},K_=class{isOptional;isMutable;constructorDefault;annotations;constructor(e,t,n=void 0,r=void 0){this.isOptional=e,this.isMutable=t,this.constructorDefault=n,this.annotations=r}},q_=`~effect/Schema`,J_=class{[q_]=q_;annotations;checks;encoding;context;constructor(e=void 0,t=void 0,n=void 0,r=void 0){this.annotations=e,this.checks=t,this.encoding=n,this.context=r}toString(){return`<${this._tag}>`}},Y_=class extends J_{_tag=`Declaration`;typeParameters;run;encodingChecks;encodingRun;constructor(e,t,n,r,i,a,o,s){super(n,r,i,a),this.typeParameters=e,this.run=t,this.encodingChecks=o,this.encodingRun=s}getParser(){let e;return(t,n)=>t===wg?Eg:(e??=this.run(this.typeParameters))(t,this,n)}_rebuild(e,t,n,r,i){let a=hy(this.typeParameters,e);return a===this.typeParameters&&t===this.checks&&n===this.encodingChecks&&r===this.run&&i===this.encodingRun?this:new Y_(a,r,this.annotations,t,void 0,this.context,n,i)}recur(e){return this._rebuild(e,this.checks,this.encodingChecks,this.run,this.encodingRun)}flip(e){return this._rebuild(e,this.encodingChecks,this.checks,this.encodingRun??this.run,this.run)}getExpected(){let e=this.annotations?.expected;return typeof e==`string`?e:`<Declaration>`}},X_=new class extends J_{_tag=`Null`;getParser(){return Ny(this,null)}getExpected(){return`null`}},Z_=class extends J_{_tag=`Undefined`;getParser(){return Ny(this,void 0)}toCodecJson(){return ry(this,[Q_])}getExpected(){return`undefined`}},Q_=new W_(X_,new x_(u_(()=>void 0),u_(()=>null))),$_=new Z_,ev=new class extends J_{_tag=`Unknown`;getParser(){return Py(this,Gc)}getExpected(){return`unknown`}},tv=class extends J_{_tag=`Literal`;literal;constructor(e,t,n,r,i){if(super(t,n,r,i),typeof e==`number`&&!globalThis.Number.isFinite(e))throw Error(`A numeric literal must be finite, got ${Bl(e)}`);this.literal=e}getParser(){return Ny(this,this.literal)}matchPart(e,t){return e===globalThis.String(this.literal)?this.literal:void 0}toCodecJson(){return typeof this.literal==`bigint`?nv(this):this}toCodecStringTree(){return typeof this.literal==`string`?this:nv(this)}getExpected(){return typeof this.literal==`string`?JSON.stringify(this.literal):globalThis.String(this.literal)}};function nv(e){let t=globalThis.String(e.literal);return ry(e,[new W_(new tv(t),new x_(u_(()=>e.literal),u_(()=>t)))])}var rv=new class extends J_{_tag=`String`;getParser(){return Py(this,Lc)}matchPart(e,t){let n=this.checks;return n&&!t.disableChecks&&Wy(n,e,void 0,this,t)?void 0:e}getExpected(){return`string`}},iv=class extends J_{_tag=`Number`;getParser(){return Py(this,Rc)}matchKey(e,t){return this._match(zy,e,t)}matchPart(e,t){return this._match(Ry,e,t)}_match(e,t,n){if(!e.test(t))return;let r=globalThis.Number(t);return n.disableChecks||!this.checks?r:Wy(this.checks,r,void 0,this,n)?void 0:r}toCodecJson(){return this.checks&&(av(this.checks,`effect/schema/isFinite`)||av(this.checks,`effect/schema/isInt`))?this:ry(this,[Qv])}toCodecStringTree(){return this.toCodecJson()===this?ry(this,[Hy]):ry(this,[Uy])}getExpected(){return`number`}};function av(e,t){return e.some(e=>e.annotations?.representation?.id===t||e._tag===`FilterGroup`&&av(e.checks,t))}var ov=new iv,sv=new class extends J_{_tag=`Boolean`;getParser(){return Py(this,zc)}getExpected(){return`boolean`}},cv=class extends J_{_tag=`Arrays`;isMutable;elements;rest;encodingChecks;constructor(e,t,n,r,i,a,o,s){super(r,i,a,o),this.isMutable=e,this.elements=t,this.rest=n,this.encodingChecks=s;let c=!1;for(let e=0;e<t.length;e++)if(Cy(t[e]))c=!0;else if(c)throw Error(`A required element cannot follow an optional element. ts(1257)`);if(c&&n.length>1)throw Error(`A required element cannot follow an optional element. ts(1257)`);for(let e=1;e<n.length;e++)if(Cy(n[e]))throw Error(`An optional element cannot follow a rest element. ts(1266)`)}getParser(e,t=e){let n=this,r,i,a=n.elements.length,o=Math.max(0,n.rest.length-1);function s(e,t){return t<a?r[t]:t>=e?i[t-e+1]:i[0]}let c=e=>{let{input:t,len:r,options:i}=e;if(n.rest.length===0&&r>a)for(let o=a;o<r;o++){let r=new Rg(n,t[o],i),a=new Ig([o],r);if(i.errors===`all`)e.issues?e.issues.push(a):e.issues=[a];else return Lh(new zg(n,[a],t,i))}return e.issues?Lh(new zg(n,e.issues,t,i)):Tg(e.output)},l=(e,t)=>{let r=e.length,i={ast:n,getParser:s,input:e,len:r,tailThreshold:Math.max(a,r-o),output:new globalThis.Array(r),issues:void 0,options:t},u=n.rest.length===0?a:Math.max(r,a+o),d=t.concurrency===void 0?1:sh(t.concurrency),f=d===1?dv(i,e,0,u):fv(i,e,{concurrency:d,end:u});if(!f)return c(i);if(Hm(f))return Xh(f,()=>c(i));let p=!0;return Ih(()=>p?(p=!1,Hh(f,()=>c(i))):l(e,t))};return(e,a)=>{if(e===wg)return Eg;try{return Array.isArray(e)?(r||(r=n.elements.map(e=>({ast:e,parser:t(e)})),i=n.rest.map(e=>({ast:e,parser:t(e)}))),l(e,a)):Lh(new Bg(n,e,a))}catch(e){return zh(e)}}}_rebuild(e,t,n){let r=hy(this.elements,e),i=hy(this.rest,e);return r===this.elements&&i===this.rest&&t===this.checks&&n===this.encodingChecks?this:new cv(this.isMutable,r,i,this.annotations,t,void 0,this.context,n)}recur(e){return this._rebuild(e,this.checks,this.encodingChecks)}flip(e){return this._rebuild(e,this.encodingChecks,this.checks)}getExpected(){return`array`}};function lv(e,t,n,r){if(n._tag===`Failure`)return pv(e,e.ast,r,n);let i=n===Dg?t:n[cu];if(i!==wg)e.output[r]=i;else{let t=e.getParser(e.tailThreshold,r);if(Cy(t.ast))return;let n=new Ig([r],new Lg(t.ast.context?.annotations));if(e.options.errors===`all`)e.issues?e.issues.push(n):e.issues=[n];else return Eh(new zg(e.ast,[n],e.input,e.options))}}var uv={onItem(e,t,n){let r=n<e.len?t:wg;return e.getParser(e.tailThreshold,n).parser(r,e.options)},step:lv},dv=ch()(uv),fv=uh()(uv),pv=(e,t,n,r)=>{if(r.cause.reasons.length===0)return r;let i=a_(r.cause);if(i===void 0)return Th(Sh(r.cause,r=>new zg(t,[new Ig([n],r)],e.input,e.options)));let a=new Ig([n],i);if(e.options.errors===`all`)e.issues?e.issues.push(a):e.issues=[a];else return Eh(new zg(t,[a],e.input,e.options))},mv=`[+-]?\\d*\\.?\\d+(?:[Ee][+-]?\\d+)?`;function hv(e,t,n=G_){let r,i;function a(t){switch(t._tag){case`String`:case`TemplateLiteral`:return(r??=Object.keys(e)).filter(e=>t.matchPart(e,n)!==void 0);case`Number`:return(r??=Object.keys(e)).filter(e=>t.matchKey(e,n)!==void 0);case`Symbol`:return(i??=Object.getOwnPropertySymbols(e)).filter(r=>Object.prototype.propertyIsEnumerable.call(e,r)&&t.matchKey(r,n)!==void 0);case`Union`:return[...new Set(t.types.flatMap(a))];default:return[]}}return a(Fy(ky(t)))}var gv=class{name;type;constructor(e,t){this.name=e,this.type=t}};function _v(e){switch(e._tag){case`String`:case`Number`:case`Symbol`:case`TemplateLiteral`:return!0;case`Union`:return e.types.every(_v);default:return!1}}function vv(e){let t=ay(e);switch(t._tag){case`String`:case`Number`:case`Symbol`:case`TemplateLiteral`:return!0;case`Union`:return t.types.every(vv);default:return!1}}function yv(e){return _v(e)&&vv(e)}var bv=class{parameter;type;constructor(e,t){if(!yv(e))throw Error(`Invalid index signature parameter ${e._tag}`);if(this.parameter=e,this.type=t,Cy(t)&&!My(t))throw Error("Cannot use `Schema.optionalKey` with index signatures, use `Schema.optional` instead.")}},xv=class extends J_{_tag=`Objects`;propertySignatures;indexSignatures;encodingChecks;constructor(e,t,n,r,i,a,o){super(n,r,i,a),this.propertySignatures=e,this.indexSignatures=t,this.encodingChecks=o}getParser(e,t=e){let n=this,r=n.propertySignatures.length,i=n.indexSignatures.length;if(!r&&!i)return Py(n,Wc);let a,o,s=()=>(a||(a=n.propertySignatures.map(e=>({parser:t(e.type),name:e.name,type:e.type})),o=i?n.indexSignatures.map(n=>({is:n,parserKey:e(Fy(n.parameter)),parserValue:t(n.type)})):void 0),a),c=()=>{let e=new Set(n.propertySignatures.map(e=>typeof e.name==`number`?globalThis.String(e.name):e.name)),t=(t,i,a,o,s)=>{if(s._tag===`Failure`)return pv(t,n,i,s)??Dh;let c=s===Dg?o:s[cu];if(a!==wg&&c!==wg){if(r&&(e.has(i)||e.has(typeof a==`number`?globalThis.String(a):a)))return Dh;jl(t.out,a,c)}return Dh},c=(e,r,i,a)=>{if(!a){let t=i.parserKey(r,e.options);if(!Hm(t))return Hh(Uh(t),t=>c(e,r,i,t));a=t}if(a._tag===`Failure`)return pv(e,n,r,a)??Dh;let o=a===Dg?r:a[cu],s=e.input[r],l=i.parserValue(s,e.options);return Hm(l)?t(e,r,o,s,l):Hh(Uh(l),n=>t(e,r,o,s,n))},l=(e,n,r)=>{let i=e.input[n],a=r.parserValue(i,e.options);return Hm(a)?t(e,n,n,i,a):Hh(Uh(a),r=>t(e,n,n,i,r))},u=i?uh()({onItem:(e,[t,n])=>n.is.parameter===rv?l(e,t,n):c(e,t,n),step:(e,t,n)=>n._tag===`Failure`?n:void 0}):void 0;return Zh(function*(t,d){if(t===wg)return wg;if(!(typeof t==`object`&&t&&!Array.isArray(t)))return yield*Lh(new Bg(n,t,d));s();let f=t,p={},m={ast:n,input:f,out:p,issues:void 0,options:d},h=d.errors===`all`,g=d.onExcessProperty===`error`,_=d.concurrency===void 0?1:sh(d.concurrency),v=i&&g?n.indexSignatures.map(e=>hv(f,e.parameter,d)):void 0;if(g){let r=v?new Set(e):e;if(v)for(let e of v)for(let t of e)r.add(t);let i=Reflect.ownKeys(f);for(let e=0;e<i.length;e++){let a=i[e];if(!r.has(a)&&Object.prototype.propertyIsEnumerable.call(f,a)){let e=new Rg(n,f[a],d),r=new Ig([a],e);if(h){m.issues?m.issues.push(r):m.issues=[r];continue}return yield*Lh(new zg(n,[r],t,d))}}}if(r){let e=_===1?wv(m,a):Tv(m,a,{concurrency:_});e&&(yield*e)}if(i&&_===1)for(let e=0;e<i;e++){let t=o[e],n=t.is.parameter===rv?l:c,r=v?.[e]??(t.is.parameter===rv?Object.keys(f):hv(f,t.is.parameter,d));for(let e=0;e<r.length;e++){let i=n(m,r[e],t);if(!Hm(i))yield*i;else if(i._tag===`Failure`)return yield*i}}else if(u){let e=Wd();for(let t=0;t<i;t++){let n=o[t],r=v?.[t]??(n.is.parameter===rv?Object.keys(f):hv(f,n.is.parameter,d));for(let t=0;t<r.length;t++)e.push([r[t],n])}let t=u(m,e,{concurrency:_});t&&(yield*t)}return m.issues?yield*Lh(new zg(n,m.issues,t,d)):p})};if(i)return c();let l,u=(e,t,n)=>{let r=a[t];return Hh(Uh(n),n=>{let i=Sv(e,r,n);if(i)return i;let o=()=>Tg(e.out),s=wv(e,a.slice(t+1));return s?Xh(s,o):o()})};return(e,t)=>{if(e===wg)return Eg;if(t.errors===`all`||t.onExcessProperty!==void 0||t.concurrency!==void 0&&sh(t.concurrency)!==1)return(l??=c())(e,t);if(!(typeof e==`object`&&e&&!Array.isArray(e)))return Lh(new Bg(n,e,t));let r=s(),i=e,a={},o={ast:n,input:i,out:a,issues:void 0,options:t};try{for(let e=0;e<r.length;e++){let n=r[e],s=n.name,c=Iv(i,s),l=c?i[s]:wg,d=n.parser(l,t);if(!Hm(d))return u(o,e,d);if(d===Dg){c&&jl(a,s,l);continue}let f=Sv(o,n,d);if(f)return f}}catch(e){return zh(e)}return Tg(a)}}_rebuild(e,t,n,r){let i=hy(this.propertySignatures,t=>{let n=e(t.type);return n===t.type?t:new gv(t.name,n)}),a=hy(this.indexSignatures,n=>{let r=t(n.parameter),i=e(n.type);return r===n.parameter&&i===n.type?n:new bv(r,i)});return i===this.propertySignatures&&a===this.indexSignatures&&n===this.checks&&r===this.encodingChecks?this:new xv(i,a,this.annotations,n,void 0,this.context,r)}flip(e){return this._rebuild(e,e,this.encodingChecks,this.checks)}recur(e,t=e){return this._rebuild(e,t,this.checks,this.encodingChecks)}getExpected(){return this.propertySignatures.length===0&&this.indexSignatures.length===0?`object | array`:`object`}};function Sv(e,t,n){if(n._tag===`Failure`)return pv(e,e.ast,t.name,n);if(n===Dg)return;let r=n[cu];if(r!==wg){jl(e.out,t.name,r);return}if(delete e.out[t.name],!Cy(t.type)){let n=new Ig([t.name],new Lg(t.type.context?.annotations));if(e.options.errors===`all`){e.issues?e.issues.push(n):e.issues=[n];return}return Eh(new zg(e.ast,[n],e.input,e.options))}}var Cv={onItem(e,t){if(!Iv(e.input,t.name))return t.parser(wg,e.options);let n=e.input[t.name];return jl(e.out,t.name,n),t.parser(n,e.options)},step:Sv},wv=ch()(Cv),Tv=uh()(Cv);function Ev(e,t){return e?t?[...e,...t]:e:t}function Dv(e,t,n){return new xv(Reflect.ownKeys(e).map(t=>new gv(t,e[t].ast)),[],n,t)}function Ov(e){return e.ast}function kv(e,t,n){return new Rv(e.map(Ov),t,void 0,n)}var Av=jc(e=>{for(;;){if(U_(e))return ev;let t=e.encoding;if(!t)return e.recur?.(Av,Cc)??e;if(t.some(e=>e.transformation._tag===`Middleware`&&e.transformation.decode!==Cc))return ev;e=t[t.length-1].to}});function jv(e){switch(e._tag){case`Null`:return[`null`];case`Undefined`:return[`undefined`];case`String`:case`TemplateLiteral`:return[`string`];case`Number`:return[`number`];case`Boolean`:return[`boolean`];case`Symbol`:case`UniqueSymbol`:return[`symbol`];case`BigInt`:return[`bigint`];case`Arrays`:return[`array`];case`ObjectKeyword`:return[`object`,`array`,`function`];case`Objects`:return e.propertySignatures.length||e.indexSignatures.length?[`object`]:[`string`,`number`,`boolean`,`symbol`,`bigint`,`object`,`array`,`function`];case`Enum`:return Array.from(new Set(e.enums.map(([,e])=>typeof e)));case`Literal`:return[typeof e.literal];case`Union`:return Array.from(new Set(e.types.flatMap(jv)));default:return[`null`,`undefined`,`string`,`number`,`boolean`,`symbol`,`bigint`,`object`,`array`,`function`]}}function Mv(e){switch(e._tag){default:return[];case`Declaration`:{let t=e.annotations?.[hg];return Array.isArray(t)?t:[]}case`Objects`:return e.propertySignatures.flatMap(e=>{let t=e.type;if(!Cy(t)){if(R_(t))return[{key:e.name,literal:t.literal}];if(z_(t))return[{key:e.name,literal:t.symbol}]}return[]});case`Arrays`:return e.elements.flatMap((e,t)=>{if(!Cy(e)){if(R_(e))return[{key:t,literal:e.literal}];if(z_(e))return[{key:t,literal:e.symbol}]}return[]});case`Union`:{if(e.types.length===0)return[];let t=e.types.map(e=>Mv(Av(e)));return t[0].filter(e=>t.every(t=>t.some(t=>t.key===e.key&&t.literal===e.literal)))}case`Suspend`:return Mv(e.thunk())}}var Nv=new WeakMap,Pv=Object.freeze([]),Fv=e=>e===null?`null`:Array.isArray(e)?`array`:typeof e,Iv=(e,t)=>t===`__proto__`?Object.hasOwn(e,t):t in e;function Lv(e){let t=Nv.get(e);if(t)return t;let n,r=0,i,a,o=!0,s=[];for(let t=0;t<e.length;t++){let c=e[t],l=Av(c);if(P_(l))continue;if(R_(l)||z_(l)){a??=new Map;let e=R_(l)?l.literal:l.symbol;s[t]=e;let n=a.get(e);n||a.set(e,n=[]),n.push(t)}else o=!1;let u=Mv(l);if(u.length){n??=new Map,r++;for(let{key:e,literal:r}of u){let i=n.get(e);i||n.set(e,i=[new Map,new Set]),i[1].add(t);let a=i[0].get(r);a||i[0].set(r,a=new Set),a.add(t)}}else{i??={};let e=jv(l);for(let n of e)(i[n]??=[]).push(t)}}let c={},l=e=>c[e]??=Object.freeze(i?.[e]??Pv);if(o&&a)a.forEach(Object.freeze),t=e=>a.get(e)??Pv;else if(n?.size===1&&!i){let[r,[i]]=n.entries().next().value,a=new Map;for(let[e,t]of i)a.set(e,Object.freeze(Array.from(t)));let o=Object.freeze(e.map((e,t)=>t));t=(e,t)=>{if(qc(e)){let n=Iv(e,r)?e[r]:void 0;if(n!==void 0)return a.get(n)??Pv;if(t)return o}return Pv}}else if(n){let e;for(let t of n)(!e||t[1][0].size>e[1][0].size)&&t[1][1].size===r&&(e=t);t=(t,r)=>{let a=Fv(t);if(!qc(t))return l(a);let o=new Set(i?.[a]),s;if(e){let[n,[i]]=e,c=Iv(t,n),u=c?t[n]:void 0;if(c&&(!r||u!==void 0)){let e=i.get(u);if(!e)return l(a);for(let t of e)o.add(t);s=n}}if(s===void 0)for(let[e,[i,a]]of n){let n=Iv(t,e),s=n?t[e]:void 0;if(n&&(!r||s!==void 0)){let e=i.get(s);if(e)for(let t of e)o.add(t)}else if(r)for(let e of a)o.add(e)}for(let[e,[i,a]]of n){if(e===s)continue;let n=Iv(t,e),c=n?t[e]:void 0;if(n&&(!r||c!==void 0)){let e=i.get(c);for(let t of o)a.has(t)&&!e?.has(t)&&o.delete(t)}}return Array.from(o).sort((e,t)=>e-t)}}else t=e=>{let t=l(Fv(e));return a?t.filter(t=>s[t]===void 0||s[t]===e):t};return Nv.set(e,t),t}var Rv=class extends J_{_tag=`Union`;types;options;encodingChecks;constructor(e,t,n,r,i,a,o){super(n,r,i,a),this.types=e,this.options=t,this.encodingChecks=o}getParser(e,t){let n=this,r=t!==void 0,i=[],a=t=>i[t]??=e(n.types[t]),o;return(e,t)=>{if(e===wg)return Eg;let i=(o??=Lv(n.types))(e,r);if(i.length===0)return Lh(new Hg(n,[],e,t));if(i.length===1){let r=a(i[0])(e,t);return r._tag===`Success`?r:Hm(r)?zv(n,r.cause,e,t):Bv(n,r,e,t)}return Vv(n,a,i,e,t)}}_rebuild(e,t,n){let r=hy(this.types,e);return r===this.types&&t===this.checks&&n===this.encodingChecks?this:new Rv(r,this.options,this.annotations,t,void 0,this.context,n)}recur(e){return this._rebuild(e,this.checks,this.encodingChecks)}flip(e){return this._rebuild(e,this.encodingChecks,this.checks)}matchPart(e,t){for(let n of this.types){let r=n.matchPart(e,t);if(r!==void 0)return r}}getExpected(e){let t=this.annotations?.expected;if(typeof t==`string`)return t;if(this.types.length===0)return`never`;let n=this.types.map(t=>{let n=ky(t);switch(n._tag){case`Arrays`:{let t=n.elements.filter(R_);if(t.length>0)return`${Gv(n.isMutable)}[ ${t.map(t=>e(t)+Kv(t.context?.isOptional)).join(`, `)}, ... ]`;break}case`Objects`:{let t=n.propertySignatures.filter(e=>R_(e.type));if(t.length>0)return`{ ${t.map(t=>`${Gv(t.type.context?.isMutable)}${Hl(t.name)}${Kv(t.type.context?.isOptional)}: ${e(t.type)}`).join(`, `)}, ... }`;break}}return e(n)});return Array.from(new Set(n)).join(` | `)}};function zv(e,t,n,r){let i=a_(t);return i?Eh(new Hg(e,[i],n,r)):Th(t)}function Bv(e,t,n,r){return Wh(t,t=>zv(e,t,n,r))}function Vv(e,t,n,r,i){let a={ast:e,parser:t,input:r,out:void 0,successes:e.options?.mode===`oneOf`?[]:void 0,issues:void 0,options:i},o=Uv(a,n);if(!o)return a.out?a.out:Lh(new Hg(e,a.issues??[],r,i));if(Hm(o))return Hv(o,a);let s=!0;return Ih(()=>s?(s=!1,Hv(o,a)):Vv(e,t,n,r,i))}function Hv(e,t){return Xh(e,e=>t.out===Dg?Fh(t.input):t.out?t.out:Lh(new Hg(t.ast,t.issues??[],t.input,t.options)))}var Uv=ch()({onItem(e,t){return e.parser(t)(e.input,e.options)},step(e,t,n){if(n._tag===`Failure`){let t=a_(n.cause);if(t===void 0)return n;e.issues?e.issues.push(t):e.issues=[t]}else{if(e.out&&e.successes)return e.successes.push(e.ast.types[t]),Eh(new Ug(e.ast,e.successes,e.input,e.options));if(e.out=n,e.successes)e.successes.push(e.ast.types[t]);else return Dh}}}),Wv=new Rv([new tv(`Infinity`),new tv(`-Infinity`),new tv(`NaN`)]);function Gv(e){return e?``:`readonly `}function Kv(e){return e?`?`:``}var qv=class extends xc{_tag=`Filter`;run;annotations;aborted;constructor(e,t=void 0,n=!1){super(),this.run=e,this.annotations=t,this.aborted=n}annotate(e){return new qv(this.run,{...this.annotations,...e},this.aborted)}abort(){return new qv(this.run,this.annotations,!0)}and(e,t){return new Jv([this,e],t)}},Jv=class extends xc{_tag=`FilterGroup`;checks;annotations;constructor(e,t=void 0){super(),this.checks=e,this.annotations=t}annotate(e){return new Jv(this.checks,{...this.annotations,...e})}and(e,t){return new Jv([this,e],t)}};function Yv(e,t,n=!1){return new qv((t,n,r)=>Kg(n,e(t,n,r),t,r),t,n)}function Xv(e){return Yv(e=>globalThis.Number.isFinite(e),{expected:`a finite number`,representation:{id:`effect/schema/isFinite`,payload:null},toJsonSchema:()=>({type:`number`}),toCode:()=>({runtime:`Schema.isFinite()`}),arbitraryConstraint:{number:`finite`},...e})}var Zv=cy(ov,[Xv()]),Qv=new W_(new Rv([Zv,Wv]),new x_(p_(),u_(e=>globalThis.Number.isFinite(e)?e:globalThis.String(e))));function $v(e,t){let n=new globalThis.RegExp(e),r={source:n.source,flags:n.flags};return Yv(e=>(n.lastIndex=0,n.test(e)),{expected:`a string matching the RegExp ${r.source}`,representation:{id:`effect/schema/isPattern`,payload:r},toJsonSchema:()=>[{},!0],arbitraryConstraint:{patterns:[r]},...t})}var ey=new WeakMap;function ty(e,t){let n=Object.assign(Object.create(Object.getPrototypeOf(e)),e,t);return Reflect.ownKeys(t).every(e=>e===`context`||e===`encoding`)&&ey.set(n,ny(e)),n}function ny(e){let t=ey.get(e);if(t!==void 0)return t;if(e.encoding===void 0)return e;let n=Object.assign(Object.create(Object.getPrototypeOf(e)),e,{encoding:void 0});return ey.set(e,n),n}function ry(e,t){return e.encoding===t?e:ty(e,{encoding:t})}function iy(e,t){if(e.context===t)return e;let n=ny(e);return n.context===t&&n.encoding===e.encoding?n:ty(e,{context:t})}function ay(e){return e.encoding?ay(e.encoding[e.encoding.length-1].to):e}function oy(e,t){if(e.checks){let n=e.checks[e.checks.length-1];return sy(e,Vd(e.checks.slice(0,-1),n.annotate(t)))}return ty(e,{annotations:{...e.annotations,...t}})}function sy(e,t){if(e._tag===`Suspend`&&t)throw Error(`Cannot add checks to Suspend`);return e.checks===t?e:ty(e,{checks:t})}function cy(e,t){return sy(e,Ev(e.checks,t))}function ly(e,t){let n=t(e.to);return n===e.to?e:new W_(n,e.transformation)}function uy(e,t){let n=e,r=n[n.length-1],i=ly(r,t);return i===r?e:Vd(e.slice(0,e.length-1),i)}function dy(e){return t=>t.encoding?ry(t,uy(t.encoding,e)):t}function fy(e,t){return dy(e=>iy(e,t))(e)}function py(e,t){function n(r){if(r.encoding){let e=r.encoding[r.encoding.length-1];return t?.stopAt?.(e)?r:ry(r,uy(r.encoding,n))}return e(r)}return jc(n)}function my(e,t,n){let r=new W_(e,t);return ry(n,n.encoding?[...n.encoding,r]:[r])}function hy(e,t){let n;for(let r=0;r<e.length;r++){let i=e[r],a=t(i);if(n)n[r]=a;else if(a!==i){n=Array(e.length);for(let t=0;t<r;t++)n[t]=e[t];n[r]=a}}return n??e}function gy(e,t){return iy(e,e.context?new K_(e.context.isOptional,e.context.isMutable,e.context.constructorDefault,{...e.context.annotations,...t}):new K_(!1,!1,void 0,t))}var _y=jc(e=>vy(iy(e,e.context?e.context.isOptional===!1?new K_(!0,e.context.isMutable,e.context.constructorDefault,e.context.annotations):e.context:new K_(!0,!1)))),vy=dy(_y),yy=Ac(e=>_y(new Rv([e,$_])));function by(e,t,n){return my(e,n,t)}function xy(e){let t=[],n=[];function r(e){switch(e._tag){case`Literal`:Vc(e.literal)&&!t.includes(e.literal)&&t.push(e.literal);return;case`UniqueSymbol`:t.includes(e.symbol)||t.push(e.symbol);return;case`Never`:return;case`Union`:for(let t=0;t<e.types.length;t++)r(e.types[t]);return;default:n.push(e)}}return r(e),{literals:t,parameters:n}}function Sy(e,t){let{literals:n,parameters:r}=xy(e);return new xv(n.map(e=>new gv(e,t)),r.map(e=>new bv(e,t)))}function Cy(e){return e.context?.isOptional??!1}function wy(e){return e.context?.isMutable??!1}function Ty(e){return e.annotations?.[`~structural`]===!0||e._tag===`FilterGroup`&&e.checks.every(Ty)}function Ey(e){function t(e){return Ty(e)?[e]:e._tag===`FilterGroup`?e.checks.flatMap(t):[]}let n=e.flatMap(t);return Hd(n)?n:void 0}function Dy(e){let t=!0;function n(e){return t=t&&!e.encoding&&!U_(e),t&&`recur`in e&&e.recur(n),e}return`recur`in e&&e.recur(n),t}var Oy=jc(e=>{let t=ny(e);if(t!==e){let n=Oy(t);return n===t&&e.encoding===void 0?e:iy(n,e.context)}let n=`recur`in e?e.recur(Oy):e;if(`encodingChecks`in n&&n.encodingChecks){let t=Dy(e)?n.encodingChecks:B_(n)||V_(n)||j_(n)&&n.typeParameters.length>0?Ey(n.encodingChecks):void 0;return ty(n,{encodingChecks:void 0,checks:Ev(n.checks,t)})}return n}),ky=jc(e=>Oy(jy(e)));function Ay(e,t){let n=t,r=n.length,i=n[r-1],a=[new W_(jy(ry(e,void 0)),n[0].transformation.flip())];for(let e=1;e<r;e++)a.unshift(new W_(jy(n[e-1].to),n[e].transformation.flip()));let o=jy(i.to);return o.encoding?ry(o,[...o.encoding,...a]):ry(o,a)}var jy=Ac(e=>{if(e.encoding)return Ay(e,e.encoding);let t=ny(e);if(t!==e){let n=jy(t);return n===t?e:iy(n,e.context)}return`flip`in e?e.flip(jy):`recur`in e?e.recur(jy):e});function My(e){switch(e._tag){case`Undefined`:return!0;case`Union`:return e.types.some(My);default:return!1}}function Ny(e,t){let n=t===0?Dg:Tg(t);return(r,i)=>r===wg?Eg:r===t?n:Lh(new Bg(e,r,i))}function Py(e,t){return(n,r)=>n===wg?Eg:t(n)?Dg:Lh(new Bg(e,n,r))}var Fy=py(e=>{switch(e._tag){default:return e;case`Number`:return e.toCodecStringTree();case`Union`:return e.recur(Fy)}}),Iy=py(e=>{switch(e._tag){default:return e;case`Symbol`:case`UniqueSymbol`:return e.toCodecStringTree();case`Union`:return e.recur(Iy)}}),Ly=`[\\s\\S]*?`,Ry=new globalThis.RegExp(`^${mv}$`),zy=new globalThis.RegExp(`^(?:${mv}|Infinity|-Infinity|NaN)$`);function By(e){return $v(Ry,{expected:`a string representing a finite number`,representation:{id:`effect/schema/isStringFinite`,payload:null},toJsonSchema:()=>({pattern:Ry.source}),...e})}var Vy=cy(rv,[By()]),Hy=new W_(Vy,D_),Uy=new W_(new Rv([Vy,Wv]),D_);function Wy(e,t,n,r,i){for(let a=0;a<e.length;a++){let o=e[a];if(o._tag===`FilterGroup`){if(n=Wy(o.checks,t,n,r,i),n&&(i.errors!==`all`||n[n.length-1].filter.aborted))return n}else{let e=o.run(t,r,i);if(e){let r=new Pg(o,e,t,i);if(n?n.push(r):n=[r],i.errors!==`all`||o.aborted)return n}}}return n}function Gy(e){if(!j_(e))return;let t=e.annotations?.[gg];return Hc(t)?t(e.typeParameters):void 0}var Ky=dg,qy=bg,Jy=xg;function Yy(e){return e===null||typeof e==`string`||typeof e==`boolean`||typeof e==`number`&&globalThis.Number.isFinite(e)}function Xy(e){return e===void 0||typeof e==`string`}function Zy(e,t){let n=new WeakMap,r=[];outer:for(;;){if(typeof e!=`object`||!e){if(!t(e))return!1}else{let t=e,i=n.get(t);if(i===!1)return!1;if(i===void 0){let e=Array.isArray(t);if(!e){let e=Object.getPrototypeOf(t);if(e!==null&&e!==Object.prototype&&Object.getPrototypeOf(e)!==null)return!1}n.set(t,!1),r.push({value:t,keys:e?t.length:Object.keys(t),index:0})}}for(;r.length>0;){let t=r[r.length-1],i=t.keys;if(typeof i==`number`){if(t.index<i){e=t.value[t.index++];continue outer}}else if(t.index<i.length){e=t.value[i[t.index++]];continue outer}n.set(t.value,!0),r.pop()}return!0}}function Qy(e){return Zy(e,Yy)}var $y=new Y_([],()=>(e,t,n)=>Qy(e)?Dg:Lh(new Bg(t,e,n)),{representation:{id:`effect/schema/Json`,payload:null},expected:`JSON value`,toCodecJson:()=>void 0,toCodecStringTree:()=>rb}),eb=new W_($y,E_()),tb=new W_(new Rv([new cv(!1,[],[$y]),new xv([],[new bv(rv,$y)])]),E_());function nb(e){return Zy(e,Xy)}var rb=new W_(new Y_([],()=>(e,t,n)=>nb(e)?Dg:Lh(new Bg(t,e,n)),{expected:`StringTree`,toCodecStringTree:()=>void 0}),E_()),ib=(e,t,n)=>e===Dg?n(t):Xh(e,n);function ab(e){if(e._tag===`Middleware`)return(t,n,r)=>ob(t===Dg?e.decode(Tg(Og(n)),r):e.decode(Jh(t,Og),r));let t=e.decode;switch(t._tag){case`Passthrough`:return(e,t)=>e===Dg?Tg(t):e;case`Transform`:{let e=e=>e===wg?Eg:Tg(t.transform(e));return(t,n)=>ib(t,n,e)}case`TransformOptional`:{let e=e=>kg(t.transform(Og(e)));return(t,n)=>ib(t,n,e)}case`TransformEffect`:return(e,n,r)=>ib(e,n,e=>e===wg?Eg:t.transform(e,r));case`TransformOptionalEffect`:return(e,n,r)=>ib(e,n,e=>ob(t.transform(Og(e),r)))}}var ob=e=>Xh(e,kg),sb=(e,t,n,r)=>Wh(r,r=>Rh(()=>Sh(r,r=>new Fg(e,r,t,n))));function cb(e,t){let n=ab(e.link.transformation),r;return(i,a)=>{if(i===wg)return Eg;if(e.isConstructed(i))return Dg;let o=(r??=t(e.link.to))(i,a);return n(o,i,a)}}function lb(e,t){let n=e.context.constructorDefault;return(r,i)=>{if(r!==wg&&r!==void 0)return t(r,i);let a=n;if(Hm(a)&&a._tag===`Success`){let e=t(a[cu],i);return e===Dg?a:e}return Xh(sb(e,r,i,a),e=>{let n=t(e,i);return n===Dg?Tg(e):n})}}function ub(e,t){let n=t(e);return e.context?.constructorDefault===void 0?n:lb(e,n)}function db(e,t,n,r,i){if(e._tag===`Declaration`)for(let n of e.typeParameters)t(n);let a=n?Gy(e):void 0,o=a?cb(a,t):r??e.getParser(t,n),s=e.checks,c=e.encoding,l=c?.map(e=>ab(e.transformation)),u=e.encodingChecks;if(!c&&!s&&!u)return o;let d,f=(t,n)=>{let r=o(t,n);if(u&&!n.disableChecks){if(Hm(r)){if(r._tag===`Success`){let i=r===Dg?t:r[cu];if(t!==wg&&i!==wg){let i=Wy(u,t,void 0,e,n);i&&(r=Lh(new zg(e,i,t,n)))}}}else r=Hh(r,r=>{if(t!==wg&&r!==wg){let r=Wy(u,t,void 0,e,n);if(r)return Lh(new zg(e,r,t,n))}return Fh(r)})}if(s&&!n.disableChecks){if(Hm(r)){if(r._tag===`Success`){let i=r===Dg?t:r[cu];if(i===wg)return r;let a=Wy(s,i,void 0,e,n);a&&(r=Lh(new zg(e,a,i,n)))}}else r=Hh(r,t=>{if(t!==wg){let r=Wy(s,t,void 0,e,n);if(r)return Lh(new zg(e,r,t,n))}return Fh(t)})}return r},p=i===void 0?f:i(f);return c?(n,r)=>{let i=d??=c.map(e=>t(e.to)),a=n,o=i[i.length-1](n,r);for(let e=c.length-1;e>=0;e--)if(o=l[e](o,a,r),e!==0){let t=i[e-1];o._tag===`Success`?(a=o[cu],o=t(a,r)):o=Xh(o,e=>{let n=t(e,r);return n===Dg?Tg(e):n})}if(o._tag===`Success`){let e=o[cu],t=p(e,r);return t===Dg?o:t}return o=sb(e,n,r,o),Xh(o,e=>{let t=p(e,r);return t===Dg?Tg(e):t})}:p}var fb=Symbol(),pb=new WeakMap,mb=e=>vb(e).parser,hb=e=>vb(e).makeEffect,gb=e=>ub(e,hb),_b=class{ast;constructor(e){this.ast=e}get decodeEffect(){return this.cachedDecodeEffect??=db(this.ast,mb)}get parser(){return this.decodeEffect}get makeEffect(){return this.cachedMakeEffect??=db(this.ast,hb,gb)}};function vb(e){let t=pb.get(e);if(t!==void 0)return t;let n=new _b(e);return pb.set(e,n),n}function yb(e){let t=e.ast,n;return(e,r)=>(n??=Mb(zb,Oy(t)))(e,r?.disableChecks?r?.parseOptions?{...r.parseOptions,disableChecks:!0}:{disableChecks:!0}:r?.parseOptions)}function bb(e){let t=yb(e);return(e,n)=>{let r=qh(t(e,n));return Oh(r)?Td(r.value):(o_(r.cause,`Option adapter can only return none for schema issues`),wd())}}function xb(e){return Lb(Oy(e.ast))}function Sb(e){return wb(e.ast)}function Cb(e){{let t=Nb(Ab(e));return e=>{let n=t(e,G_);return Oh(n)?!0:(o_(n.cause,`Type guard adapter can only return false for schema issues`),!1)}}}function wb(e){let t=Oy(e),n=e=>(n=Cb(t),n(e));return e=>n(e)}function Tb(e,t){let n=Ab(e.ast);return t===void 0?n:(e,r)=>n(e,Ob(t,r))}function Eb(e,t){return Pb(Tb(e,t))}function Db(e,t){return Fb(Tb(e,t))}var Ob=(e,t)=>t?{...e,...t}:e,kb=e=>e===wg?Lh(new Vg):Fh(e);function Ab(e){return Mb(Rb,e)}function jb(e,t){return e===Dg?Fh(t):Hm(e)?e[cu]===wg?kb(wg):e:Xh(e,kb)}function Mb(e,t){let n;return(r,i)=>{let a=(n??=e(t))(r,i??G_);return a===Dg?Fh(r):Hm(a)?a[cu]===wg?kb(wg):a:Xh(a,kb)}}function Nb(e){return(t,n)=>qh(e(t,n))}function Pb(e){let t=Nb(e);return(e,n)=>{let r=t(e,n);return Oh(r)?Td(r.value):(o_(r.cause,`Option adapter can only return none for schema issues`),wd())}}function Fb(e){let t=Nb(e);return(e,n)=>{let r=t(e,n);return Oh(r)?Pd(r.value):Fd(o_(r.cause,`Result adapter can only return schema issues`))}}function Ib(e,t){let n=qh(e);if(Oh(n))return n.value;let r=o_(n.cause,t);throw Error(`Schema validation failed`,{cause:r})}function Lb(e){let t,n;return(r,i)=>{t??=vb(e);let a=i?.disableChecks?i.parseOptions?{...i.parseOptions,disableChecks:!0}:{disableChecks:!0}:i?.parseOptions??G_,o=t.make;if(o!==void 0&&r!==wg){let e;try{e=o(r,a)}catch(e){throw o_(xh(e),`Constructor adapter can only throw schema issues`),e}if(e!==fb&&e!==wg)return e}return Ib(jb((n??=t.makeEffect)(r,a),r),`Constructor adapter can only throw schema issues`)}}var Rb=e=>vb(e).parser,zb=e=>vb(e).makeEffect,Bb=`~effect/Schema/Schema`,Vb=Symbol(),Hb={[Bb]:Bb,get make(){let e=xb(this);return Object.defineProperty(this,"make",{value:e,enumerable:!0}),e},get makeEffect(){let e=yb(this);return Object.defineProperty(this,"makeEffect",{value:e,enumerable:!0}),e},get makeOption(){let e=bb(this);return Object.defineProperty(this,"makeOption",{value:e,enumerable:!0}),e},pipe(){return yc(this,arguments)},annotate(e){return this.rebuild(oy(this.ast,e))},annotateKey(e){return this.rebuild(gy(this.ast,e))},check(...e){return this.rebuild(cy(this.ast,e))},rebuild(e){return Ub(e,this[Vb])}};function Ub(e,t){function n(){}let r=Object.setPrototypeOf(n,Hb);return t&&(Object.hasOwn(t,`name`)||Object.hasOwn(t,`length`)||Object.hasOwn(t,`__proto__`))?Object.defineProperties(r,Object.getOwnPropertyDescriptors({...t})):Object.assign(r,t),r[Vb]=t,r.ast=e,r}function Wb(e){return e.replace(/~/g,`~0`).replace(/\//g,`~1`)}function Gb(e){return e.replace(/~1/g,`/`).replace(/~0/g,`~`)}function Kb(e){return encodeURI(Wb(e)).replace(/#/g,`%23`)}function qb(e){if(e.length===0||e===`#`)return``;if(!e.startsWith(`#`))return;let t=e.slice(1);try{if(encodeURI(t).replace(/%25/g,`%`).replace(/#/g,`%23`)!==t)return;let e=decodeURIComponent(t);return e.startsWith(`/`)&&!/~(?:[^01]|$)/.test(e)?e:void 0}catch{return}}function Jb(e,t){return n(e,!1,!0);function n(e,r,i=!1){if(!Kc(e))return e;let a=r||!i&&Qb(e.$id),o={};for(let t of Object.keys(e)){let r=e[t],i=r;switch(t){case`$defs`:case`properties`:case`patternProperties`:case`dependentSchemas`:i=Zb(r,e=>n(e,a))??r;break;case`allOf`:case`anyOf`:case`oneOf`:case`prefixItems`:i=Array.isArray(r)?r.map(e=>n(e,a)):r;break;case`not`:case`additionalProperties`:case`propertyNames`:case`unevaluatedProperties`:case`items`:case`contains`:case`unevaluatedItems`:case`if`:case`then`:case`else`:case`contentSchema`:i=n(r,a)}jl(o,t,i)}return t(o,a),o}}function Yb(e,t){return Jb(e,e=>{Xb(e,t)})}function Xb(e,t){typeof e.$ref==`string`&&jl(e,`$ref`,t(e.$ref,`$ref`)),typeof e.$dynamicRef==`string`&&jl(e,`$dynamicRef`,t(e.$dynamicRef,`$dynamicRef`))}function Zb(e,t){if(!Kc(e))return;let n={};for(let r of Object.keys(e))jl(n,r,t(e[r],r));return n}function Qb(e){return typeof e==`string`&&e.length>0&&e[0]!==`#`}var $b=[`$anchor`,`$defs`,`$dynamicAnchor`,`$dynamicRef`,`$vocabulary`,`contentSchema`,`dependentRequired`,`dependentSchemas`,`maxContains`,`minContains`,`prefixItems`,`unevaluatedItems`,`unevaluatedProperties`];[...$b],[...$b];var ex=py(e=>{let t=ax(e,ex),n=e.context;return t===e||n===void 0?t:fy(t,tx(n))});function tx(e){return e.constructorDefault===void 0?e:new K_(e.isOptional,e.isMutable,void 0,e.annotations)}function nx(e){if(e.propertySignatures.some(e=>typeof e.name!=`string`))throw new globalThis.Error(`Objects property names must be strings`,{cause:e})}function rx(e){return t=>{let n=[...t].sort((t,n)=>e(ky(t))-e(ky(n)));return n.some((e,n)=>e!==t[n])?n:t}}var ix=rx(e=>{switch(e._tag){case`BigInt`:case`Symbol`:case`UniqueSymbol`:return 0;default:return 1}});function ax(e,t){switch(e._tag){case`Declaration`:{let n=e.annotations?.toCodecJson??e.annotations?.toCodec;if(!Hc(n))return ry(e,[eb]);let r=n(e.typeParameters.map(e=>Ub(ky(e))));return r===void 0?e:ry(e,[ly(r,t)])}case`Unknown`:return ry(e,[eb]);case`ObjectKeyword`:return ry(e,[tb]);case`Undefined`:case`Void`:case`Literal`:case`Number`:return e.toCodecJson();case`UniqueSymbol`:case`Symbol`:case`BigInt`:return e.toCodecStringTree();case`Objects`:return nx(e),e.recur(t,Iy);case`Union`:{let n=ix(e.types);return n===e.types?e.recur(t):new Rv(n,e.options,e.annotations,e.checks,e.encoding,e.context,e.encodingChecks).recur(t)}case`Arrays`:case`Suspend`:return e.recur(t)}return e}globalThis.RegExp;var ox=e=>e.replace(/[/\\^$*+?.()|[\]{}]/g,`\\$&`);function sx(e,t){return t.length>0&&(e+=`\n at ${Ul(t)}`),Error(e)}function cx(e){return`#/$defs/${Kb(e)}`}var lx=new Set([...Cg,mg,..._g]);function ux(e,t){if(e===void 0)return;let n={},r=e.title;typeof r==`string`&&(n.title=r);let i=e.description,a=e.expected;typeof i==`string`?n.description=i:t?.generateDescriptions===!0&&typeof a==`string`&&(n.description=a);let o=e.default;Qy(o)&&(n.default=o);let s=e.examples;Array.isArray(s)&&Qy(s)&&(n.examples=s);let c=e.readOnly;typeof c==`boolean`&&(n.readOnly=c);let l=e.writeOnly;typeof l==`boolean`&&(n.writeOnly=l);let u=e.format;typeof u==`string`&&(n.format=u);let d=e.contentEncoding;typeof d==`string`&&(n.contentEncoding=d);let f=e.contentMediaType;typeof f==`string`&&(n.contentMediaType=f);let p=e.contentSchema;if(Qy(p)&&(n.contentSchema=p),t?.includeAnnotationKey!==void 0)for(let[r,i]of Object.entries(e))lx.has(r)||!t.includeAnnotationKey(r)||Qy(i)&&jl(n,r,i);return Object.keys(n).length===0?void 0:n}function dx(e){let t=e.type===`number`||e.type===`integer`?e.type:void 0,n=e;if(t!==void 0&&(n={...e},delete n.type),Array.isArray(n.allOf)){let e=[],r=!1;for(let i of n.allOf){let n=dx(i);n.type!==void 0&&(r=!0,(t===void 0||n.type===`integer`)&&(t=n.type)),Object.keys(n.schema).length>0&&e.push(n.schema)}if(r){let{allOf:t,...r}=n;n=e.length===0?r:{...r,allOf:e}}}return{type:t,schema:n}}function fx(e){if(!Array.isArray(e.anyOf)||e.anyOf.length!==2||e.anyOf[0]?.type!==`number`)return!1;let t=e.anyOf[1];return t?.type===`string`&&Array.isArray(t.enum)&&t.enum.length===3&&t.enum.includes(`NaN`)&&t.enum.includes(`Infinity`)&&t.enum.includes(`-Infinity`)}var px=`|type|format|pattern|multipleOf|minimum|maximum|exclusiveMinimum|exclusiveMaximum|minLength|maxLength|minItems|maxItems|uniqueItems|minProperties|maxProperties|propertyNames|`;function mx(e,t){return Object.keys(e).every(e=>t.includes(`|${e}|`))}function hx(e,t){return typeof e.$ref!=`string`&&t.every(t=>!Object.hasOwn(e,t))}var gx=`|title|description|default|examples|readOnly|writeOnly|`,_x=px+gx;function vx(e,t,n){if(Object.keys(e).length===0)return t;let r=Object.keys(t);if(r.length===0)return e;let i=e.type===`number`||e.type===`integer`?e.type:void 0,a=fx(e);if(i!==void 0||a){let r=dx(t);if(r.type!==void 0){let t=i===`integer`||r.type===`integer`?`integer`:`number`,o={...e,type:t};a&&delete o.anyOf;let s=Object.keys(r.schema);return s.length===0?o:mx(r.schema,gx)&&hx(o,s)?{...o,...r.schema}:vx(o,r.schema,n)}}if(n&&hx(e,r))return{...e,...t};let o=Array.isArray(t.allOf)&&r.length===1?t.allOf:[t];return Array.isArray(e.allOf)?{...e,allOf:[...e.allOf,...o]}:typeof e.$ref==`string`?{allOf:[e,...o]}:{...e,allOf:o}}function yx(e,t=new Set){return typeof e==`boolean`?e:t.has(e)?!0:(t.add(e),e.every(e=>yx(e,t)))}function bx(e){return Array.isArray(e)}function xx(e,t,n,r){let i=new Map,a=new Map,o=new WeakMap,s=new Map,c=new Map,l=Object.keys(n);for(let e of l)m(e,[`references`,e]);let u=Gd(e,(e,n)=>v(e,t[n],[]));for(let[e,t]of s.values())if(!yx(e))for(let e of t)Array.isArray(e.oneOf)&&(e.anyOf=e.oneOf,delete e.oneOf);for(let e of l){let t=n[e],r=g(t);if(r===void 0)continue;let o=i.get(e)[0],s=c.get(r),l=s?.find(e=>hl(i.get(e)[0],o));l===void 0?s===void 0?c.set(r,[e]):s.push(e):a.set(e,l)}let d=Gd(u,h),f={};for(let e of l)a.has(e)||jl(f,e,h(i.get(e)[0]));return{dialect:`draft-2020-12`,schemas:d,definitions:f};function p(e){return Array.isArray(e.oneOf)&&s.get(e.oneOf)?.[1].push(e),e}function m(e,t){if(!Object.hasOwn(n,e))throw sx(`Invalid reference ${e}`,[...t,`$ref`]);let r=i.get(e);if(r!==void 0)return r;let a=[{},[]];return i.set(e,a),a[0]=v(n[e],[`references`,e],a[1]),a}function h(e){return Yb(e,e=>{let t=qb(e);if(t===void 0){if(/^#(?:\/|%2f)/i.test(e))throw Error(`Invalid JSON Pointer URI fragment ${JSON.stringify(e)}`);return e}if(!t.startsWith(`/$defs/`))return e;let n=t.indexOf(`/`,7),r=a.get(Gb(t.slice(7,n<0?void 0:n)));return r===void 0?e:e.replace(/^#(?:\/|%2f).*?(?:\/|%2f).*?(?=\/|%2f|$)/i,cx(r))})}function g(e){if(e._tag===`Reference`)return;let t=e.checks.length===0?e.annotations:e.checks[e.checks.length-1].annotations;return typeof t?.identifier!=`string`&&typeof t?.[`~identifier`]==`string`?t[mg]:void 0}function _(e,t,n,i){let a=e.annotations,o=a?.toJsonSchema;if(o!==void 0){let s=o({type:t,schemas:e.representation?.schemas?.map((e,t)=>v(e,[...n,`representation`,`schemas`,t],i))??[]}),c=bx(s);c&&i.push(!1);let l=c?s[0]:s,u=ux(a,r),d=u===void 0?l:{...l,...u},f=u===void 0?px:_x;return[d,e._tag===`Filter`&&mx(d,f)&&(u===void 0||mx(u,gx))?!0:void 0]}if(e._tag===`Filter`){i.push(!1);return}let s=e.checks.flatMap((e,r)=>{let a=_(e,t,[...n,`checks`,r],i);return a===void 0?[]:[a[0]]});if(s.length===0)return;let c=ux(a,r),l={allOf:s};return[c===void 0?l:{...l,...c}]}function v(e,t,n){if(e._tag===`Reference`)return n.push(m(e.$ref,t)[1]),{$ref:cx(e.$ref)};let i=o.get(e);if(i!==void 0)return n.push(i[1]),i[0];let a=[];n.push(a);let s=y(e,t,a),c=ux(e.annotations,r);c!==void 0&&(s={...s,...c});for(let n=0;n<e.checks.length;n++){let r=typeof s.type==`string`&&Sx(s.type)?s.type:void 0,i=_(e.checks[n],r,[...t,`checks`,n],a);i!==void 0&&(s=vx(s,...i))}return o.set(e,[s,a]),p(s)}function y(e,t,n){switch(e._tag){case`Any`:case`Unknown`:return{};case`ObjectKeyword`:return{anyOf:[{type:`object`},{type:`array`}]};case`Void`:case`Undefined`:case`Null`:return{type:`null`};case`BigInt`:return{type:`string`,allOf:[{pattern:`^-?\\d+$`}]};case`Symbol`:return{type:`string`,allOf:[{pattern:`^Symbol\\(([\\s\\S]*)\\)$`}]};case`UniqueSymbol`:return globalThis.Symbol.keyFor(e.symbol)===void 0?{not:{}}:{type:`string`,enum:[globalThis.String(e.symbol)]};case`Declaration`:return n.push(!1),{};case`Suspend`:return v(e.thunk,[...t,`thunk`],n);case`Never`:return{not:{}};case`String`:return{type:`string`};case`Number`:return{anyOf:[{type:`number`},{type:`string`,enum:[`NaN`,`Infinity`,`-Infinity`]}]};case`Boolean`:return{type:`boolean`};case`Literal`:{let t=e.literal;return typeof t==`bigint`?{type:`string`,enum:[globalThis.String(t)]}:{type:typeof t,enum:[t]}}case`Enum`:{let n=e.enums.map(([e,n],r)=>{if(typeof n==`number`&&!globalThis.Number.isFinite(n))throw sx(`Invalid numeric enum value ${globalThis.String(n)}`,[...t,`enums`,r,1]);return{type:typeof n,enum:[n],title:e}});return n.length===0?{not:{}}:{anyOf:n}}case`TemplateLiteral`:return{type:`string`,pattern:`^${e.parts.map(wx).join(``)}$`};case`Arrays`:{if(e.rest.length>1)throw sx(`Invalid schema representation document`,[...t,`rest`]);let i={type:`array`},a=e.elements.length,o=e.elements.map((e,i)=>{e.isOptional&&a--;let o=v(e.type,[...t,`elements`,i,`type`],n),s=ux(e.annotations,r);return s===void 0?o:p(vx(o,s))});if(o.length>0?(i.prefixItems=o,i.maxItems=e.elements.length,a>0&&(i.minItems=a)):i.items=!1,e.rest.length===1){delete i.maxItems;let r=v(e.rest[0],[...t,`rest`,0],n);Object.keys(r).length>0?i.items=r:delete i.items}return i}case`Objects`:{if(e.propertySignatures.length===0&&e.indexSignatures.length===0)return{not:{type:`null`}};let i={type:`object`},a={},o=[];for(let i=0;i<e.propertySignatures.length;i++){let s=e.propertySignatures[i];if(typeof s.name!=`string`)throw sx(`Invalid schema representation document`,[...t,`propertySignatures`,i,`name`]);let c=s.name,l=v(s.type,[...t,`propertySignatures`,i,`type`],n),u=ux(s.annotations,r);jl(a,c,u===void 0?l:p(vx(l,u))),s.isOptional||o.push(c)}e.propertySignatures.length>0&&(i.properties=a),o.length>0&&(i.required=o);let s={},c=[],l=[],u=!1;for(let r=0;r<e.indexSignatures.length;r++){let i=e.indexSignatures[r],a=v(i.type,[...t,`indexSignatures`,r,`type`],n);hl(a,{not:{}})&&(a=!1),l.push(a);let o=b(i.parameter,[...t,`indexSignatures`,r,`parameter`],new Set);if(o===void 0){u=!0,n.push(!1);continue}if(o.length===0)c.push(a);else for(let e of o){let t=s[e];jl(s,e,t===void 0?a:t===!1||a===!1?!1:p(vx(t,a)))}}let d=Object.keys(s).length>0;if(d&&(i.patternProperties=s),u&&r?.onExcessProperty===`error`){let r=[];e.propertySignatures.length>0&&r.push({enum:Object.keys(a)});for(let i=0;i<e.indexSignatures.length;i++)r.push(v(e.indexSignatures[i].parameter,[...t,`indexSignatures`,i,`parameter`],n));i.propertyNames=r.length===1?r[0]:{anyOf:r},i.additionalProperties=l.length===1?l[0]:{anyOf:l},c.length>0&&(i.allOf=c.map(e=>({type:`object`,additionalProperties:e})))}else c.length===0?i.additionalProperties=u||r?.onExcessProperty!==`error`:c.length===1&&e.propertySignatures.length===0&&!d?i.additionalProperties=c[0]:c.length>0&&(i.allOf=c.map(e=>({type:`object`,additionalProperties:e})));return typeof i.additionalProperties==`object`&&i.additionalProperties!==null&&Object.keys(i.additionalProperties).length===0&&delete i.additionalProperties,i}case`Union`:{let r=[],i=e.types.map((e,n)=>v(e,[...t,`types`,n],r));if(n.push(r),i.length===0)return{not:{}};let a=e.options?.mode??`anyOf`;if(a===`anyOf`&&i.length>1){let e=Cx(i);if(e!==void 0)return e}return a===`oneOf`&&s.set(i,[r,[]]),{[a]:i}}}}function b(e,t,r){switch(e._tag){case`Reference`:{if(!Object.hasOwn(n,e.$ref))throw sx(`Invalid reference ${e.$ref}`,[...t,`$ref`]);if(m(e.$ref,t),r.has(e.$ref))return;let i=new Set(r).add(e.$ref);return b(n[e.$ref],[`references`,e.$ref],i)}case`String`:{if(e.checks.length===0)return[];if(e.checks.length!==1||e.checks[0]._tag!==`Filter`||e.checks[0].annotations?.toJsonSchema===void 0)return;let n=[],r=v(e,t,n);return yx(n)&&r.type===`string`&&typeof r.pattern==`string`&&mx(r,`|type|pattern|title|description|default|examples|readOnly|writeOnly|`)?[r.pattern]:void 0}case`TemplateLiteral`:return e.checks.length===0?[`^${e.parts.map(wx).join(``)}$`]:void 0;case`Union`:{if(e.types.length===0||e.checks.length>0||e.options?.mode===`oneOf`)return;let n=[];for(let i=0;i<e.types.length;i++){let a=b(e.types[i],[...t,`types`,i],r);if(a===void 0)return;if(a.length===0)return[];n.push(...a)}return n}default:throw sx(`Invalid schema representation document`,t)}}}function Sx(e){return e===`string`||e===`number`||e===`boolean`||e===`array`||e===`object`||e===`null`||e===`integer`}function Cx(e){let t,n=[];for(let r of e){if(Object.keys(r).length!==2||r.type===void 0||!Array.isArray(r.enum)||r.enum.length===0)return;if(t===void 0)t=r.type;else if(r.type!==t)return;for(let e of r.enum){if(n.includes(e))return;n.push(e)}}return{type:t,enum:n}}function wx(e){switch(e._tag){case`Literal`:return ox(globalThis.String(e.literal));case`String`:return Ly;case`Number`:return mv;case`TemplateLiteral`:return e.parts.map(wx).join(``);case`Union`:return`(?:${e.types.map(wx).join(`|`)})`;default:throw sx(`Invalid schema representation document`,[])}}function Tx(e,t){let n=xx([e.representation],[[`representation`]],e.references,t);return{dialect:n.dialect,schema:n.schemas[0],definitions:n.definitions}}var Ex=({identifier:e})=>e;function Dx(e){return e===void 0?void 0:{annotations:e}}function Ox(e,t){let{references:n,representations:r}=kx([e],t);return{representation:r[0],references:n}}function kx(e,t){let n={},r=new Map,i=new Set,a=new Map,o=new Set;for(let t of e)f(t);let s=t?.referencePolicy??Ex;for(let e of a.values())for(let t of e.values()){let e=s({ast:t.ast,occurrences:t.occurrences,identifier:t.identifier});e===void 0?t.isRecursive&&(t.reference=c(`${t.ast._tag}_`,t,``)):t.reference=c(e,t,e===t.identifier||!e.endsWith(`_`)?`_`:``)}return{representations:Gd(e,e=>m(e)),references:n};function c(e,t,n=`_`){let i=e,a=0;for(;r.has(i);){if(r.get(i)===t)return i;i=`${e}${n}${++a}`}return r.set(i,t),i}function l(e,t,n){let r=t.fallback;return r===void 0?n===t.identifier?e:oy(e,{identifier:n}):yg(e)===r?e:oy(e,{[mg]:r})}function u(e,t){if(!Object.hasOwn(n,e)&&!i.has(e)){i.add(e);let r=h(t);i.delete(e),jl(n,e,r)}return{_tag:`Reference`,$ref:e}}function d(e){let t=ay(e),n=ny(t),r=vg(t),i=r===void 0?(t===e?void 0:vg(e))??yg(t):void 0;i!==void 0&&(r=`${i}Encoded`);let o=a.get(n);o===void 0&&(o=new Map,a.set(n,o));let s=o.get(r);return s===void 0&&(s={ast:n,identifier:r,fallback:i,occurrences:0,isRecursive:!1,reference:void 0},o.set(r,s)),s}function f(e){let t=d(e),n=t.ast;if(t.occurrences++,o.has(t)){t.isRecursive=!0;return}if(!(t.occurrences>1)){switch(o.add(t),p(n.checks),n._tag){case`Declaration`:case`Arrays`:case`Objects`:case`Union`:n.recur(e=>(f(e),e));break;case`TemplateLiteral`:n.parts.forEach(f);break;case`Suspend`:f(n.thunk())}o.delete(t)}}function p(e){e?.forEach(e=>{e.annotations?.representation?.schemas?.forEach(e=>f(Oy(e))),e._tag===`FilterGroup`&&p(e.checks)})}function m(e){let t=d(e),n=t.ast,r=t.reference;return r===void 0?h(n):u(r,t.identifier===void 0?n:l(n,t,r))}function h(e){let t=g(e.checks);switch(e._tag){case`Declaration`:return{_tag:`Declaration`,typeParameters:e.typeParameters.map(e=>m(e)),checks:t,...v(e.annotations)};case`Null`:case`Undefined`:case`Void`:case`Never`:case`Unknown`:case`Any`:case`String`:case`Boolean`:case`Number`:case`BigInt`:case`Symbol`:case`ObjectKeyword`:return{_tag:e._tag,checks:t,...Dx(e.annotations)};case`Literal`:return{_tag:`Literal`,literal:e.literal,checks:t,...Dx(e.annotations)};case`UniqueSymbol`:return{_tag:`UniqueSymbol`,symbol:e.symbol,checks:t,...Dx(e.annotations)};case`Enum`:return{_tag:`Enum`,enums:e.enums,checks:t,...Dx(e.annotations)};case`TemplateLiteral`:return{_tag:`TemplateLiteral`,parts:e.parts.map(e=>m(e)),checks:t,...Dx(e.annotations)};case`Arrays`:return{_tag:`Arrays`,elements:e.elements.map(e=>{let t=ay(e),n=t.context?.annotations;return{isOptional:Cy(t),type:m(e),...Dx(n)}}),rest:e.rest.map(e=>m(e)),checks:t,...Dx(e.annotations)};case`Objects`:return{_tag:`Objects`,propertySignatures:e.propertySignatures.map(e=>{let t=ay(e.type),n=t.context?.annotations;return{name:e.name,type:m(e.type),isOptional:Cy(t),isMutable:wy(t),...Dx(n)}}),indexSignatures:e.indexSignatures.map(e=>({parameter:m(e.parameter),type:m(e.type)})),checks:t,...Dx(e.annotations)};case`Union`:return{_tag:`Union`,types:e.types.map(e=>m(e)),...e.options===void 0?{}:{options:e.options},checks:t,...Dx(e.annotations)};case`Suspend`:return{_tag:`Suspend`,checks:[],thunk:m(e.thunk()),...Dx(e.annotations)}}}function g(e){return e?.map(_)??[]}function _(e){switch(e._tag){case`Filter`:return{_tag:`Filter`,aborted:e.aborted,...y(e.annotations)};case`FilterGroup`:return{_tag:`FilterGroup`,checks:Gd(e.checks,_),...y(e.annotations)}}}function v(e){if(e===void 0)return;let{representation:t,...n}=e;return{...t===void 0?void 0:{representation:t},...Object.keys(n).length===0?void 0:{annotations:n}}}function y(e){if(e===void 0)return;let{representation:t,...n}=e,r=t===void 0?void 0:t.schemas===void 0?t:{...t,schemas:t.schemas.map(e=>m(Oy(e)))};return{...r===void 0?void 0:{representation:r},...Object.keys(n).length===0?void 0:{annotations:n}}}}function Ax(e){return Oh(e)?e.value:{issues:[{message:Ch(e.cause)}]}}function jx(e,t){let n=Tb(e),r={errors:`all`,...t?.parseOptions},i=Yg(t),a=e=>{let t=new wp(`sync`),a=Kh(Gh(n(e,r),{onFailure:i,onSuccess:e=>({value:e})}),{scheduler:t});a.currentDispatcher?.flush();let o=a.pollUnsafe();return o?Ax(o):new Promise(e=>{a.addObserver(t=>{e(Ax(t))})})};if(Object.hasOwn(e,`~standard`)){let t=e;return`validate`in t[`~standard`]||Object.assign(t[`~standard`],{validate:a}),t}return Object.assign(e,{"~standard":{version:1,vendor:`effect`,validate:a}})}var Mx=e=>e,Nx=`~effect/Schema/SchemaError`;function Px(e){return Jc(e,`~effect/Schema/SchemaError`)&&e[`~effect/Schema/SchemaError`]===`~effect/Schema/SchemaError`}function Fx(){return(e,t,n)=>Yx(new Y_(e.map(Ov),e=>t(e.map(e=>Yx(e))),n))}function Ix(e,t){return Fx()([],()=>(t,n,r)=>e(t)?Fh(t):Lh(new Bg(n,t,r)),t)}var Lx=class extends Op(`SchemaError`){[Nx]=Nx;constructor(e){let t=eu();tu(0);try{super({issue:e})}finally{tu(t)}}get message(){return n_(this.issue)}toString(){return`SchemaError(${this.message})`}};function Rx(e){return Px(e)}function zx(e){return Hm(e)?Bx(e):Wh(e,e=>Rh(()=>Sh(e,e=>new Lx(e))))}function Bx(e){return Oh(e)?e:Th(Sh(e.cause,e=>new Lx(e)))}function Vx(e,t){let n;for(let r of e.reasons){if(!bh(r)||!Rx(r.error))throw new globalThis.Error(t,{cause:e});n??=r.error}if(n===void 0)throw new globalThis.Error(t,{cause:e});return n}function Hx(e){let t=qh(e);if(Oh(t))return t.value;throw Vx(t.cause,`Sync adapter can only throw schema errors`)}function Ux(e,t){return jx(e,t)}var Wx=Sb;function Gx(e,t){let n=Tb(e,t);return(e,t)=>zx(n(e,t))}var Kx=Eb;function qx(e,t){let n=Db(e,t);return(e,t)=>Rd(n(e,t),e=>new Lx(e))}function Jx(e,t){let n=Gx(e,t);return(e,t)=>Hx(n(e,t))}var Yx=Ub,Xx=Mx(e=>Yx(_y(e.ast),{schema:e})),q=Mx(e=>{let t=dS(e);return Yx(yy(e.ast),{schema:t})});function Zx(e){let t=Yx(new tv(e),{literal:e,transform(n){return t.pipe(pS(Zx(n),{decode:u_(()=>n),encode:u_(()=>e)}))}});return t}var Qx=Yx(ev),$x=Yx(X_),eS=Yx($_),tS=Yx(rv),nS=Yx(ov),rS=Yx(sv);function iS(e,t){return Yx(e,{fields:t,mapFields(e,t){let n=e(this.fields);return iS(Dv(n,t?.unsafePreserveChecks?this.ast.checks:void 0),n)}})}function J(e){return iS(Dv(e,void 0),e)}function aS(e,t){return Yx(Sy(e.ast,t.ast),{key:e,value:t})}var oS=Mx(e=>Yx(new cv(!1,[],[e.ast]),{value:e}));function sS(e,t){return Yx(e,{members:t,mapMembers(e,t){let n=e(this.members);return sS(kv(n,this.ast.options,t?.unsafePreserveChecks?this.ast.checks:void 0),n)}})}function cS(e,t){return sS(kv(e,t,void 0),e)}function lS(e){let t=e.map(Zx);return Yx(kv(t,void 0,void 0),{literals:e,members:t,mapMembers(e){return cS(e(this.members))},pick(e){return lS(e)},transform(e){return cS(t.map((t,n)=>t.transform(e[n])))}})}var uS=Mx(e=>cS([e,$x])),dS=Mx(e=>cS([e,eS]));function Y(...e){return t=>t.check(...e)}function fS(e){return t=>Yx(t.ast,{schema:t,identifier:e})}function pS(e,t){return n=>Yx(by(n.ast,e.ast,t?C_(t):E_()),{from:n,to:e})}function mS(e,t){return Ix(t=>t instanceof e,t)}function hS(){return(e,t)=>new W_(e.ast,C_(t))}var gS=Yv,_S=`^\\S[\\s\\S]*\\S$|^\\S$|^$`;function vS(e){let t=new globalThis.RegExp(_S);return gS(e=>e.trim()===e,{expected:`a string with no leading or trailing whitespace`,representation:{id:`effect/schema/isTrimmed`,payload:null},toJsonSchema:()=>({pattern:t.source}),toCode:()=>({runtime:`Schema.isTrimmed()`}),arbitraryConstraint:{patterns:[{source:_S,flags:``}]},...e})}function yS(e,t){let n=e.source,r=e.flags,i=/^[dg]*uy?$/.test(r),a=r===``?`new RegExp(${Bl(n)})`:`new RegExp(${Bl(n)}, ${Bl(r)})`;return $v(e,{toJsonSchema:()=>i?{pattern:r.endsWith(`y`)?`^(?:${n})`:n}:[{},!0],toCode:()=>({runtime:`Schema.isPattern(${a})`}),...t})}var bS=Yx(Zv),xS=Xv;function SS(e){let t=xd(e.order),n=e.formatter??Bl;return(r,i)=>gS(e=>t(e,r),{expected:`a value greater than ${n(r)}`,arbitraryConstraint:{order:e.order,minimum:r,exclusiveMinimum:!0},...e.annotate?.(r),...i})}function CS(e){let t=Cd(e.order),n=e.formatter??Bl;return(r,i)=>gS(e=>t(e,r),{expected:`a value greater than or equal to ${n(r)}`,arbitraryConstraint:{order:e.order,minimum:r},...e.annotate?.(r),...i})}function wS(e){let t=Sd(e.order),n=e.formatter??Bl;return(r,i)=>gS(e=>t(e,r),{expected:`a value less than or equal to ${n(r)}`,arbitraryConstraint:{order:e.order,maximum:r},...e.annotate?.(r),...i})}function TS(e){let t=Cd(e.order),n=xd(e.order),r=Sd(e.order),i=bd(e.order),a=e.formatter??Bl;return(o,s)=>{let c=o.exclusiveMinimum?n:t,l=o.exclusiveMaximum?i:r;return gS(e=>c(e,o.minimum)&&l(e,o.maximum),{expected:`a value between ${a(o.minimum)}${o.exclusiveMinimum?` (excluded)`:``} and ${a(o.maximum)}${o.exclusiveMaximum?` (excluded)`:``}`,arbitraryConstraint:{order:e.order,minimum:o.minimum,maximum:o.maximum,...o.exclusiveMinimum&&{exclusiveMinimum:!0},...o.exclusiveMaximum&&{exclusiveMaximum:!0}},...e.annotate?.(o),...s})}}function ES(e){if(!globalThis.Number.isFinite(e))throw new globalThis.RangeError(`Expected a finite number, got ${Bl(e)}`);return e}var DS=SS({order:yd,annotate:e=>({representation:{id:`effect/schema/isGreaterThan`,payload:{exclusiveMinimum:ES(e)}},toJsonSchema:()=>({exclusiveMinimum:e}),toCode:()=>({runtime:`Schema.isGreaterThan(${Bl(e)})`})})}),OS=CS({order:yd,annotate:e=>({representation:{id:`effect/schema/isGreaterThanOrEqualTo`,payload:{minimum:ES(e)}},toJsonSchema:()=>({minimum:e}),toCode:()=>({runtime:`Schema.isGreaterThanOrEqualTo(${Bl(e)})`})})}),kS=wS({order:yd,annotate:e=>({representation:{id:`effect/schema/isLessThanOrEqualTo`,payload:{maximum:ES(e)}},toJsonSchema:()=>({maximum:e}),toCode:()=>({runtime:`Schema.isLessThanOrEqualTo(${Bl(e)})`})})}),AS=TS({order:yd,annotate:e=>{let t=e.exclusiveMinimum?!0:void 0,n=e.exclusiveMaximum?!0:void 0;return{representation:{id:`effect/schema/isBetween`,payload:{minimum:ES(e.minimum),maximum:ES(e.maximum),...t&&{exclusiveMinimum:t},...n&&{exclusiveMaximum:n}}},toJsonSchema:()=>({[t?`exclusiveMinimum`:`minimum`]:e.minimum,[n?`exclusiveMaximum`:`maximum`]:e.maximum}),toCode:()=>({runtime:`Schema.isBetween({ minimum: ${Bl(e.minimum)}, maximum: ${Bl(e.maximum)}, exclusiveMinimum: ${Bl(t)}, exclusiveMaximum: ${Bl(n)} })`})}}});function jS(e){return gS(e=>globalThis.Number.isSafeInteger(e),{expected:`an integer`,representation:{id:`effect/schema/isInt`,payload:null},toJsonSchema:()=>[{type:`integer`},!0],toCode:()=>({runtime:`Schema.isInt()`}),arbitraryConstraint:{number:`integer`},...e})}var MS=nS.check(jS());function NS(e,t){return e=LS(e),PS(e,Math.ceil(e/2),t)}function PS(e,t,n){return gS(t=>t.length>=e,{expected:`a value with a length of at least ${e}`,representation:{id:`effect/schema/isMinLength`,payload:{minLength:e}},toJsonSchema:({type:n})=>n===`string`?e<=1?{minLength:t}:[{minLength:t},!0]:n===`array`?{minItems:e}:n===void 0?[{minLength:t,minItems:e},!0]:[{},!0],toCode:()=>({runtime:`Schema.isMinLength(${e})`}),[pg]:!0,arbitraryConstraint:{minLength:e},...n})}function FS(e){return PS(1,1,e)}function IS(e,t){return e=LS(e),gS(t=>t.length<=e,{expected:`a value with a length of at most ${e}`,representation:{id:`effect/schema/isMaxLength`,payload:{maxLength:e}},toJsonSchema:({type:t})=>t===`string`?e===0?{maxLength:e}:[{maxLength:e},!0]:t===`array`?{maxItems:e}:t===void 0?[{maxLength:e,maxItems:e},!0]:[{},!0],toCode:()=>({runtime:`Schema.isMaxLength(${e})`}),[pg]:!0,arbitraryConstraint:{maxLength:e},...t})}function LS(e){if(!globalThis.Number.isFinite(e))throw new globalThis.RangeError(`Expected a finite number, got ${e}`);return Math.max(0,Math.floor(e))}var RS=tS.check(FS());globalThis.RegExp,globalThis.URL;var zS=tS.annotate({expected:`a string that will be decoded as JSON`,contentMediaType:`application/json`});function BS(e,t){return zS.pipe(pS(e,k_(t)))}globalThis.File,globalThis.FormData,globalThis.URLSearchParams;var VS=tS.check(vS()),HS=tS.annotate({expected:`a string that will be decoded as a trimmed string`}).pipe(pS(VS,w_())),US=tS.annotate({expected:`a base64 encoded string that will be decoded as Uint8Array`,format:`byte`,contentEncoding:`base64`}),WS=mS(globalThis.Uint8Array,{representation:{id:`effect/schema/Uint8Array`,payload:null},toCode:()=>({runtime:`Schema.Uint8Array`,Type:`globalThis.Uint8Array`}),expected:`Uint8Array`,toCodecJson:()=>hS()(US,O_)});function GS(e,t){return Tx(Ox(ex(e.ast),t),t)}var KS=tS.pipe(Y(NS(1)),Y(IS(80))),qS=[`exec_isolation_required`,`execution_not_admitted`,`artifact_unavailable`,`disabled`,`timed_out`,`permission_changed`,`binding_reply_invalid`,`backend_error`,`cancelled`,`request_too_large`,`not_offered`,`internal`],JS=W({binding:U().min(1).max(64),method:U().min(1).max(128),path:U().max(256)});W({error:go(`App execution unavailable`),reason:mo(qS),ref:U().min(1).max(64).optional(),where:JS.optional()});var YS=[`InferenceUpstreamError`,`AiInternalError`,`TypeError`,`AbortError`,`TimeoutError`,`Error`],XS=[`credits_exhausted`,`content_refused`,`invalid_input`,`rate_limited`,`provider_unavailable`,`timeout`,`spending_limit`],ZS=[`invalid_request`,`unauthorized`,`unavailable`,`rate_limited`,`too_large`,`unreachable`,`invalid_response`],QS={minimum:0,maximum:99999},$S={minimum:0,maximum:599},eC=cS([J({category:lS(YS),code:uS(MS.check(AS(QS))),reason:Xx(lS(XS)),detail:Xx(tS.check(IS(160)))}),J({category:Zx(`result_download`),status:MS.check(AS($S))}),J({category:Zx(`media_service`),failure:lS(ZS)})]);ro([W({category:mo(YS),code:Ra().int().min(QS.minimum).max(QS.maximum).nullable(),reason:mo(XS).optional(),detail:U().max(160).optional()}),W({category:go(`result_download`),status:Ra().int().min($S.minimum).max($S.maximum)}),W({category:go(`media_service`),failure:mo(ZS)})]);var tC=[`CANCELLED`,`CAPABILITY_DENIED`,`CAPABILITY_REVOKED`,`COMMAND_NOT_DECLARED`,`CONFLICT`,`DAILY_LIMIT_REACHED`,`DELIVERY_PENDING`,`DISCONNECTED`,`FILE_TOO_LARGE`,`HOST_FAILURE`,`IDENTITY`,`INSUFFICIENT_CREDIT`,`INVALID_ARGUMENT`,`MEDIA_PROVIDER_FAILURE`,`MEDIA_PROVIDER_FAILURE_UNCHARGED`,`PROTOCOL`,`SAFETY_FILTER_REFUSED`,`SELECTION_CHANGED`,`SETUP_REQUIRED`,`TIMEOUT`],nC=J({name:Zx(`AppError`),code:lS(tC),retryable:rS,need:q(tS),reason:q(tS),ref:q(tS),where:q(Qx)}),rC=lS(qS),iC=J({binding:tS,method:tS,path:tS}),X=class extends Error{code;retryable;need;reason;ref;where;constructor(e,t){super(e,{cause:t.cause}),this.name=`AppError`,this.code=t.code,this.retryable=t.retryable,this.need=t.need,this.reason=t.reason,this.ref=t.ref,this.where=t.where}};function aC(e){return Md(Kx(KS)(e))}function oC(e){return`This needs ${e??`setup`} first.`}var sC={CANCELLED:{title:`Request cancelled`,message:`It stopped before it finished. Start it again if you still want it.`},CAPABILITY_DENIED:{title:`Access needed`,message:`This App needs permission to do that.`,action:`grant`},CAPABILITY_REVOKED:{title:`Access changed`,message:`This App no longer has permission to do that.`,action:`grant`},COMMAND_NOT_DECLARED:{title:`Action unavailable`,message:`This App doesn't include that action. It may need an update.`},CONFLICT:{title:`File changed`,message:`This file changed elsewhere. Review it before saving again.`},DAILY_LIMIT_REACHED:{title:`Daily limit reached`,message:`Today's spending limit for this Oyster is used up. It resets at 00:00 UTC.`},DELIVERY_PENDING:{title:`App delivery pending`,message:`The App hasn't finished getting ready. Try opening it again.`},DISCONNECTED:{title:`Connection lost`,message:`Reopen the App to connect again.`,action:`reconnect`},HOST_FAILURE:{title:`Couldn't complete the request`,message:`The host stopped answering. Reopen the App or reload the workspace.`},FILE_TOO_LARGE:{title:`File too large`,message:`Choose a file within the supported size limit.`},IDENTITY:{title:`Couldn't connect`,message:`Reopen the App to connect again.`,action:`reconnect`},INSUFFICIENT_CREDIT:{title:`Something went wrong`,message:`The App couldn't complete this request.`,action:`billing`},INVALID_ARGUMENT:{title:`Request not accepted`,message:`Some of the details weren't usable. Check them and try again.`},MEDIA_PROVIDER_FAILURE:{title:`Generation failed`,message:`The model couldn't complete this generation. Change the prompt or model and send again.`},MEDIA_PROVIDER_FAILURE_UNCHARGED:{title:`Generation failed`,message:`The model couldn't complete this generation. You weren't charged. Change the prompt or model and send again.`},PROTOCOL:{title:`Couldn't read the response`,message:`The host sent something this App doesn't understand. Reload the workspace; if it keeps happening, the App may need an update.`},SAFETY_FILTER_REFUSED:{title:`Generation refused`,message:`The model refused this generation. Change the prompt or reference image and send again.`},SELECTION_CHANGED:{title:`Selection changed`,message:`The selection changed during this request. Reopen the App to continue.`,action:`reconnect`},SETUP_REQUIRED:{title:`Setup needed`,message:oC(void 0),action:`setup`},TIMEOUT:{title:`Still waiting`,message:`The request didn't respond in time. Its outcome isn't known yet.`},UNKNOWN:{title:`Something went wrong`,message:`The App couldn't complete this request.`}};function cC(e){return e===void 0||e===``?``:` (ref ${e})`}var lC={exec_isolation_required:()=>({title:`App can't run here`,message:`This App needs a runtime this host doesn't have.`}),execution_not_admitted:()=>({title:`App not allowed to run`,message:`This App isn't allowed to run right now. A Team owner can check its access.`}),artifact_unavailable:()=>({title:`App files missing`,message:`This App's files couldn't be loaded. Update or reinstall it.`}),disabled:()=>({title:`App turned off`,message:`This App is turned off.`}),timed_out:()=>({title:`Still waiting`,message:`The App took too long to answer. Its result isn't known; check before you retry.`}),permission_changed:()=>({title:`Access changed`,message:`This App's access changed while it was working. Review its permissions.`,action:`grant`}),binding_reply_invalid:(e,t)=>({title:`Internal error`,message:t===void 0?`One of the App's connections returned an answer we couldn't read. That's our bug${cC(e)}.`:`The App's ${t.binding.toLowerCase()} connection answered ${t.method} with something we couldn't read${t.path===``?``:` (${t.path})`}. That's our bug${cC(e)}.`}),cancelled:()=>({title:`Request cancelled`,message:`This request was cancelled before it finished. Start it again if you still want it.`}),request_too_large:()=>({title:`Request too large`,message:`This request is too large for the App to accept. Try something smaller.`}),not_offered:()=>({title:`App can't do that`,message:`This App doesn't offer that.`}),backend_error:e=>({title:`The App failed`,message:`The App's own code failed on this request${cC(e)}.`}),internal:e=>({title:`Internal error`,message:`An internal error stopped the App from running this request${cC(e)}.`})};function uC(e,t){let n=Kx(nC)(e);if(Ed(n))return{...sC.UNKNOWN,retryable:!1};let r=n.value,i=sC[r.code],a=Md(Kx(rC)(r.reason));if(a!==void 0){let e=Md(Kx(iC)(r.where)),t=lC[a](r.ref,e),n=t.action??(r.retryable?`retry`:void 0),i={title:t.title,message:t.message,retryable:r.retryable};return n?{...i,action:n}:i}let o=t?.[r.code]??(r.code===`SETUP_REQUIRED`?{title:i.title,message:oC(aC(r.need))}:i),s=i.action??(r.retryable?`retry`:void 0),c={title:o.title,message:o.message,retryable:r.retryable};return s?{...c,action:s}:c}mo(`light.dark.latte.mocha.readout.readout-night.field-guide.field-guide-night.embed.embed-dark.phosphor.codec.paper.ember.tide.tape.sunrise.pirate-radio.pirate-radio-night.consulting.consulting-ink.consulting-night.consulting-night-ink.consulting-riso-latte.consulting-riso-latte-ink.consulting-riso-glomzy.consulting-riso-glomzy-ink.vishnu.coin.coin-night.chamfer`.split(`.`));var dC=`data-theme`;function fC(e){return e||(globalThis.document?.documentElement??null)}function pC(e){let t=e.trim();if(t.length===0)throw TypeError(`Theme must be a non-empty string`);return t}function mC(e,t){let n=pC(e),r=fC(t);r&&r.setAttribute(dC,n)}function hC(e){return fC(e)?.getAttribute(dC)??null}var gC=o((e=>{var t=d(),n=Symbol.for(`react.element`),r=Symbol.for(`react.fragment`),i=Object.prototype.hasOwnProperty,a=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,o={key:!0,ref:!0,__self:!0,__source:!0};function s(e,t,r){var s,c={},l=null,u=null;for(s in r!==void 0&&(l=``+r),t.key!==void 0&&(l=``+t.key),t.ref!==void 0&&(u=t.ref),t)i.call(t,s)&&!o.hasOwnProperty(s)&&(c[s]=t[s]);if(e&&e.defaultProps)for(s in t=e.defaultProps,t)c[s]===void 0&&(c[s]=t[s]);return{$$typeof:n,type:e,key:l,ref:u,props:c,_owner:a.current}}e.Fragment=r,e.jsx=s,e.jsxs=s})),_C=o(((e,t)=>{t.exports=gC()})),Z=_C(),vC=G.createContext(void 0),yC=e=>{let t=G.useContext(vC);if(e)return e;if(!t)throw Error(`No QueryClient set, use QueryClientProvider to set one`);return t},bC=({client:e,children:t})=>(G.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),(0,Z.jsx)(vC.Provider,{value:e,children:t})),xC={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},SC=new class{#e=xC;setTimeoutProvider(e){this.#e=e}setTimeout(e,t){return this.#e.setTimeout(e,t)}clearTimeout(e){this.#e.clearTimeout(e)}setInterval(e,t){return this.#e.setInterval(e,t)}clearInterval(e){this.#e.clearInterval(e)}};function CC(e){setTimeout(e,0)}var wC=typeof window>`u`||`Deno`in globalThis;function TC(){}function EC(e,t){return typeof e==`function`?e(t):e}function DC(e){return typeof e==`number`&&e>=0&&e!==1/0}function OC(e,t){return Math.max(e+(t||0)-Date.now(),0)}function kC(e,t){return typeof e==`function`?e(t):e}function AC(e,t){let{type:n=`all`,exact:r,fetchStatus:i,predicate:a,queryKey:o,stale:s}=e;if(o){if(r){if(t.queryHash!==MC(o,t.options))return!1}else if(!PC(t.queryKey,o))return!1}if(n!==`all`){let e=t.isActive();if(n===`active`&&!e||n===`inactive`&&e)return!1}return!(typeof s==`boolean`&&t.isStale()!==s||i&&i!==t.state.fetchStatus||a&&!a(t))}function jC(e,t){let{exact:n,status:r,predicate:i,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(n){if(NC(t.options.mutationKey)!==NC(a))return!1}else if(!PC(t.options.mutationKey,a))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function MC(e,t){return(t?.queryKeyHashFn||NC)(e)}function NC(e){return JSON.stringify(e,(e,t)=>zC(t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}):t)}function PC(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(e&&t&&typeof e==`object`&&typeof t==`object`){if(Array.isArray(e)&&Array.isArray(t)){for(let n=0;n<t.length;n++)if(!PC(e[n],t[n]))return!1;return!0}let n=Object.keys(t);for(let r of n)if(!PC(e[r],t[r]))return!1;return!0}return!1}var FC=Object.prototype.hasOwnProperty;function IC(e,t,n=0){if(e===t)return e;if(n>500)return t;let r=RC(e)&&RC(t);if(!r&&!(zC(e)&&zC(t)))return t;let i=(r?e:Object.keys(e)).length,a=r?t:Object.keys(t),o=a.length,s=r?Array(o):{},c=0;for(let l=0;l<o;l++){let o=r?l:a[l],u=e[o],d=t[o];if(u===d){s[o]=u,(r?l<i:FC.call(e,o))&&c++;continue}if(u===null||d===null||typeof u!=`object`||typeof d!=`object`){s[o]=d;continue}let f=IC(u,d,n+1);s[o]=f,f===u&&c++}return i===o&&c===i?e:s}function LC(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(e[n]!==t[n])return!1;return!0}function RC(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function zC(e){if(!BC(e))return!1;let t=e.constructor;if(t===void 0)return!0;let n=t.prototype;return!(!BC(n)||!n.hasOwnProperty(`isPrototypeOf`)||Object.getPrototypeOf(e)!==Object.prototype)}function BC(e){return Object.prototype.toString.call(e)===`[object Object]`}function VC(e){return new Promise(t=>{SC.setTimeout(t,e)})}function HC(e,t,n){return typeof n.structuralSharing==`function`?n.structuralSharing(e,t):n.structuralSharing===!1?t:IC(e,t)}function UC(e,t,n=0){let r=[...e,t];return n&&r.length>n?r.slice(1):r}function WC(e,t,n=0){let r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var GC=Symbol();function KC(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===GC?()=>Promise.reject(Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function qC(e,t){return typeof e==`function`?e(...t):!!e}function JC(e,t,n){let r=!1,i;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(i??=t(),r?i:(r=!0,i.aborted?n():i.addEventListener(`abort`,n,{once:!0}),i))}),e}var YC=()=>wC,XC=()=>YC(),ZC=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},QC=new class extends ZC{#e;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e();return window.addEventListener(`visibilitychange`,t,!1),()=>{window.removeEventListener(`visibilitychange`,t)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(e=>{typeof e==`boolean`?this.setFocused(e):this.onFocus()})}setFocused(e){this.#e!==e&&(this.#e=e,this.onFocus())}onFocus(){let e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return typeof this.#e==`boolean`?this.#e:globalThis.document?.visibilityState!==`hidden`}},$C=CC;function ew(){let e=[],t=0,n=e=>{e()},r=e=>{e()},i=$C,a=r=>{t?e.push(r):i(()=>{n(r)})},o=()=>{let t=e;e=[],t.length&&i(()=>{r(()=>{t.forEach(e=>{n(e)})})})};return{batch:e=>{let n;t++;try{n=e()}finally{t--,t||o()}return n},batchCalls:e=>(...t)=>{a(()=>{e(...t)})},schedule:a,setNotifyFunction:e=>{n=e},setBatchNotifyFunction:e=>{r=e},setScheduler:e=>{i=e}}}var tw=ew(),nw=new class extends ZC{#e=!0;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e(!0),n=()=>e(!1);return window.addEventListener(`online`,t,!1),window.addEventListener(`offline`,n,!1),()=>{window.removeEventListener(`online`,t),window.removeEventListener(`offline`,n)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(this.setOnline.bind(this))}setOnline(e){this.#e!==e&&(this.#e=e,this.listeners.forEach(t=>{t(e)}))}isOnline(){return this.#e}};function rw(e){return Math.min(1e3*2**e,3e4)}function iw(e){return(e??`online`)!==`online`||nw.isOnline()}var aw=class extends Error{constructor(e){super(`CancelledError`),this.revert=e?.revert,this.silent=e?.silent}};function ow(e){let t=!1,n=0,r,i=`pending`,a,o,s=new Promise((e,t)=>{a=e,o=t});s.catch(TC);let c=()=>i!==`pending`,l=t=>{if(!c()){let n=new aw(t);h(n),e.onCancel?.(n)}},u=()=>{t=!0},d=()=>{t=!1},f=()=>QC.isFocused()&&(e.networkMode===`always`||nw.isOnline())&&e.canRun(),p=()=>iw(e.networkMode)&&e.canRun(),m=e=>{c()||(r?.(),i=`resolved`,a(e))},h=e=>{c()||(r?.(),i=`rejected`,o(e))},g=()=>new Promise(t=>{r=e=>{(c()||f())&&t(e)},e.onPause?.()}).then(()=>{r=void 0,c()||e.onContinue?.()}),_=()=>{if(c())return;let r,i=n===0?e.initialPromise:void 0;try{r=i??e.fn()}catch(e){r=Promise.reject(e)}Promise.resolve(r).then(m).catch(r=>{if(c())return;let i=e.retry??(XC()?0:3),a=e.retryDelay??rw,o=typeof a==`function`?a(n,r):a,s=i===!0||typeof i==`number`&&n<i||typeof i==`function`&&i(n,r);if(t||!s){h(r);return}n++,e.onFail?.(n,r),VC(o).then(()=>f()?void 0:g()).then(()=>{t?h(r):_()})})};return{promise:s,status:()=>i,cancel:l,continue:()=>(r?.(),s),cancelRetry:u,continueRetry:d,canStart:p,start:()=>(p()?_():g().then(_),s)}}var sw=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),DC(this.gcTime)&&(this.#e=SC.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(XC()?1/0:3e5))}clearGcTimeout(){this.#e!==void 0&&(SC.clearTimeout(this.#e),this.#e=void 0)}};function cw(e){return{onFetch:(t,n)=>{let r=t.options,i=t.fetchOptions?.meta?.fetchMore?.direction,a=t.state.data?.pages||[],o=t.state.data?.pageParams||[],s={pages:[],pageParams:[]},c=0,l=async()=>{let n=!1,l=e=>{JC(e,()=>t.signal,()=>n=!0)},u=KC(t.options,t.fetchOptions),d=async(e,r,i)=>{if(n)return Promise.reject(t.signal.reason);if(r==null&&e.pages.length)return Promise.resolve(e);let a=(()=>{let e={client:t.client,queryKey:t.queryKey,pageParam:r,direction:i?`backward`:`forward`,meta:t.options.meta};return l(e),e})(),o=await u(a),{maxPages:s}=t.options,c=i?WC:UC;return{pages:c(e.pages,o,s),pageParams:c(e.pageParams,r,s)}};if(i&&a.length){let e=i===`backward`,t=e?uw:lw,n={pages:a,pageParams:o};s=await d(n,t(r,n),e)}else{let t=e??a.length;do{let e=c===0?o[0]??r.initialPageParam:lw(r,s);if(c>0&&e==null)break;s=await d(s,e),c++}while(c<t)}return s};t.fetchFn=t.options.persister?()=>t.options.persister?.(l,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):l}}}function lw(e,{pages:t,pageParams:n}){let r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function uw(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}function dw(e,t){return t?lw(e,t)!=null:!1}function fw(e,t){return!t||!e.getPreviousPageParam?!1:uw(e,t)!=null}var pw=class extends sw{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e){super(),this.#s=!1,this.#o=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#i=e.client,this.#r=this.#i.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#t=gw(this.options),this.state=e.state??this.#t,this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return this.#e}get promise(){return this.#a?.promise}setOptions(e){if(this.options={...this.#o,...e},e?._type&&(this.#e=e._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){let e=gw(this.options);e.data!==void 0&&(this.setState(hw(e.data,e.dataUpdatedAt)),this.#t=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus===`idle`&&this.#r.remove(this)}setData(e,t){let n=HC(this.state.data,e,this.options);return this.#c({data:n,type:`success`,dataUpdatedAt:t?.updatedAt,manual:t?.manual}),n}setState(e){this.#c({type:`setState`,state:e})}cancel(e){let t=this.#a?.promise;return this.#a?.cancel(e),t?t.then(TC).catch(TC):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return this.#t}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(e=>kC(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===GC||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0&&this.observers.some(e=>kC(e.options.staleTime,this)===`static`)}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e===`static`?!1:this.state.isInvalidated?!0:!OC(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(e=>e.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#a?.continue()}onOnline(){this.observers.find(e=>e.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#a?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#r.notify({type:`observerAdded`,query:this,observer:e}))}removeObserver(e){let t=this.observers.indexOf(e);t!==-1&&(this.observers.splice(t,1),this.observers.length||(this.#a&&(this.#s||this.state.fetchStatus===`paused`&&this.state.status===`pending`?this.#a.cancel({revert:!0}):this.#a.cancelRetry()),this.scheduleGc()),this.#r.notify({type:`observerRemoved`,query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||this.#c({type:`invalidate`})}async fetch(e,t){if(this.state.fetchStatus!==`idle`&&this.#a?.status()!==`rejected`){if(this.state.data!==void 0&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#a)return this.#a.continueRetry(),this.#a.promise}if(e&&this.setOptions(e),!this.options.queryFn){let e=this.observers.find(e=>e.options.queryFn);e&&this.setOptions(e.options)}let n=new AbortController,r=e=>{Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(this.#s=!0,n.signal)})},i=()=>{let e=KC(this.options,t),n=(()=>{let e={client:this.#i,queryKey:this.queryKey,meta:this.meta};return r(e),e})();return this.#s=!1,this.options.persister?this.options.persister(e,n,this):e(n)},a=(()=>{let e={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#i,state:this.state,fetchFn:i};return r(e),e})();(this.#e===`infinite`?cw(this.options.pages):this.options.behavior)?.onFetch(a,this),this.#n=this.state,(this.state.fetchStatus===`idle`||this.state.fetchMeta!==a.fetchOptions?.meta)&&this.#c({type:`fetch`,meta:a.fetchOptions?.meta});let o=this.#a=ow({initialPromise:t?.initialPromise,fn:a.fetchFn,onCancel:e=>{e instanceof aw&&e.revert&&this.setState({...this.#n,fetchStatus:`idle`}),n.abort()},onFail:(e,t)=>{this.#c({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#c({type:`pause`})},onContinue:()=>{this.#c({type:`continue`})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0});try{let e=await o.start();if(e===void 0)throw Error(`${this.queryHash} data is undefined`);return this.setData(e),this.#r.config.onSuccess?.(e,this),this.#r.config.onSettled?.(e,this.state.error,this),e}catch(e){if(e instanceof aw){if(e.silent)return this.#a.promise;if(e.revert){if(this.state.data===void 0)throw e;return this.state.data}}throw this.#c({type:`error`,error:e}),this.#r.config.onError?.(e,this),this.#r.config.onSettled?.(this.state.data,e,this),e}finally{this.#a===o&&(this.#a=void 0),this.scheduleGc()}}#c(e){let t=t=>{switch(e.type){case`failed`:return{...t,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case`pause`:return{...t,fetchStatus:`paused`};case`continue`:return{...t,fetchStatus:`fetching`};case`fetch`:return{...t,...mw(t.data,this.options),fetchMeta:e.meta??null};case`success`:let n={...t,...hw(e.data,e.dataUpdatedAt),dataUpdateCount:t.dataUpdateCount+1,...!e.manual&&{fetchStatus:`idle`,fetchFailureCount:0,fetchFailureReason:null}};return this.#n=e.manual?n:void 0,n;case`error`:let r=e.error;return{...t,error:r,errorUpdateCount:t.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:t.fetchFailureCount+1,fetchFailureReason:r,fetchStatus:`idle`,status:`error`,isInvalidated:!0};case`invalidate`:return{...t,isInvalidated:!0};case`setState`:return{...t,...e.state}}};this.state=t(this.state),tw.batch(()=>{this.observers.slice().forEach(e=>{e.onQueryUpdate()}),this.#r.notify({query:this,type:`updated`,action:e})})}};function mw(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:iw(t.networkMode)?`fetching`:`paused`,...e===void 0&&{error:null,status:`pending`}}}function hw(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:`success`}}function gw(e){let t=typeof e.initialData==`function`?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt==`function`?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?`success`:`pending`,fetchStatus:`idle`}}var _w=class extends ZC{#e;#t=void 0;#n=void 0;#r=void 0;#i;#a;#o;#s;#c;#l;#u;#d;#f;#p=new Set;constructor(e,t){super(),this.options=t,this.#e=e,this.#o=null,this.bindMethods(),this.setOptions(t)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),yw(this.#t,this.options)?this.#m():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return bw(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return bw(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#b(),this.#x(),this.#t.removeObserver(this)}setOptions(e){let t=this.options,n=this.#t;if(this.options=this.#e.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!=`boolean`&&typeof this.options.enabled!=`function`&&typeof kC(this.options.enabled,this.#t)!=`boolean`)throw Error(`Expected enabled to be a boolean or a callback that returns a boolean`);this.#S(),this.#t.setOptions(this.options),t._defaulted&&!LC(this.options,t)&&this.#e.getQueryCache().notify({type:`observerOptionsUpdated`,query:this.#t,observer:this});let r=this.hasListeners();r&&xw(this.#t,n,this.options,t)&&this.#m(),this.updateResult(),r&&(this.#t!==n||kC(this.options.enabled,this.#t)!==kC(t.enabled,this.#t)||kC(this.options.staleTime,this.#t)!==kC(t.staleTime,this.#t))&&this.#g();let i=this.#_();r&&(this.#t!==n||kC(this.options.enabled,this.#t)!==kC(t.enabled,this.#t)||i!==this.#f)&&this.#v(i)}getOptimisticResult(e){let t=this.#e.getQueryCache().build(this.#e,e),n=this.createResult(t,e);return LC(this.getCurrentResult(),n)||(this.#r=n,this.#a=this.options,this.#i=this.#t.state),n}getCurrentResult(){return this.#r}trackResult(e,t){return new Proxy(e,{get:(e,n)=>(this.trackProp(n),t?.(n),Reflect.get(e,n))})}trackProp(e){this.#p.add(e)}getCurrentQuery(){return this.#t}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){let t=this.#e.defaultQueryOptions(e),n=this.#e.getQueryCache().build(this.#e,t),r=()=>{},i,a=new Promise(e=>{i=e,r=this.#e.getQueryCache().subscribe(i=>{i.type===`updated`&&i.query.queryHash===n.queryHash&&n.state.data!==void 0&&(r(),e(this.createResult(n,t)))})});return Promise.race([n.fetch().then(()=>{let e=this.createResult(n,t);return i?.(e),e}).finally(()=>{r()}),a])}fetch(e){return this.#m({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#r))}#m(e){this.#S();let t=this.#t.fetch(this.options,e);return e?.throwOnError||(t=t.catch(TC)),t}#h(e){return!XC()&&kC(this.options.enabled,this.#t)!==!1&&DC(e)}#g(){this.#b();let e=kC(this.options.staleTime,this.#t);if(this.#r.isStale||!this.#h(e))return;let t=OC(this.#r.dataUpdatedAt,e)+1;this.#u=SC.setTimeout(()=>{this.#r.isStale||this.updateResult()},t)}#_(){return(typeof this.options.refetchInterval==`function`?this.options.refetchInterval(this.#t):this.options.refetchInterval)??!1}#v(e){this.#x(),this.#f=e,!(this.#f===0||!this.#h(this.#f))&&(this.#d=SC.setInterval(()=>{(this.options.refetchIntervalInBackground||QC.isFocused())&&this.#m()},this.#f))}#y(){this.#g(),this.#v(this.#_())}#b(){this.#u!==void 0&&(SC.clearTimeout(this.#u),this.#u=void 0)}#x(){this.#d!==void 0&&(SC.clearInterval(this.#d),this.#d=void 0)}createResult(e,t){let n=this.#t,r=this.options,i=this.#r,a=this.#i,o=this.#a,s=e===n?this.#n:e.state,{state:c}=e,l={...c},u=!1,d;if(t._optimisticResults){let i=this.hasListeners(),a=!i&&yw(e,t),o=i&&xw(e,n,t,r);(a||o)&&(l={...l,...mw(c.data,e.options)}),t._optimisticResults===`isRestoring`&&(l.fetchStatus=`idle`)}let{error:f,errorUpdatedAt:p,status:m}=l;d=l.data;let h=!1;if(t.placeholderData!==void 0&&d===void 0&&m===`pending`){let e;i?.isPlaceholderData&&t.placeholderData===o?.placeholderData?(e=i.data,h=!0):e=typeof t.placeholderData==`function`?t.placeholderData(this.#l?.state.data,this.#l):t.placeholderData,e!==void 0&&(m=`success`,d=HC(i?.data,e,t),u=!0)}if(t.select&&d!==void 0&&!h){if(i&&d===a?.data&&t.select===this.#s)d=this.#c;else try{this.#s=t.select,d=t.select(d),d=HC(i?.data,d,t),this.#c=d,this.#o=null}catch(e){this.#o=e}}else d===void 0&&(this.#o=null);this.#o&&(f=this.#o,d=this.#c,p=Date.now(),m=`error`,u=!1);let g=l.fetchStatus===`fetching`,_=m===`pending`,v=m===`error`,y=_&&g,b=d!==void 0;return{status:m,fetchStatus:l.fetchStatus,isPending:_,isSuccess:m===`success`,isError:v,isInitialLoading:y,isLoading:y,data:d,dataUpdatedAt:l.dataUpdatedAt,error:f,errorUpdatedAt:p,failureCount:l.fetchFailureCount,failureReason:l.fetchFailureReason,errorUpdateCount:l.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:l.dataUpdateCount>s.dataUpdateCount||l.errorUpdateCount>s.errorUpdateCount,isFetching:g,isRefetching:g&&!_,isLoadingError:v&&!b,isPaused:l.fetchStatus===`paused`,isPlaceholderData:u,isRefetchError:v&&b,isStale:Sw(e,t),refetch:this.refetch,isEnabled:kC(t.enabled,e)!==!1}}updateResult(){let e=this.#r,t=this.createResult(this.#t,this.options);if(this.#i=this.#t.state,this.#a=this.options,this.#i.data!==void 0&&(this.#l=this.#t),LC(t,e))return;this.#r=t;let n=(()=>{if(!e)return!0;let{notifyOnChangeProps:t}=this.options,n=typeof t==`function`?t():t;if(n===`all`||!n&&!this.#p.size)return!0;let r=new Set(n??this.#p);return this.options.throwOnError&&r.add(`error`),Object.keys(this.#r).some(t=>{let n=t;return this.#r[n]!==e[n]&&r.has(n)})})();tw.batch(()=>{n&&this.listeners.forEach(e=>{e(this.#r)}),this.#e.getQueryCache().notify({query:this.#t,type:`observerResultsUpdated`})})}#S(){let e=this.#e.getQueryCache().build(this.#e,this.options);if(e===this.#t)return;let t=this.#t;this.#t=e,this.#n=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#y()}};function vw(e,t){return kC(t.enabled,e)!==!1&&e.state.data===void 0&&(e.state.status!==`error`||kC(t.retryOnMount,e)!==!1)}function yw(e,t){return vw(e,t)||e.state.data!==void 0&&bw(e,t,t.refetchOnMount)}function bw(e,t,n){if(kC(t.enabled,e)!==!1&&kC(t.staleTime,e)!==`static`){let r=typeof n==`function`?n(e):n;return r===`always`||r!==!1&&Sw(e,t)}return!1}function xw(e,t,n,r){return(e!==t||kC(r.enabled,e)===!1)&&(!n.suspense||e.state.status!==`error`)&&Sw(e,n)}function Sw(e,t){return kC(t.enabled,e)!==!1&&e.isStaleByTime(kC(t.staleTime,e))}var Cw=class extends _w{constructor(e,t){super(e,t)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(e){e._type=`infinite`,super.setOptions(e)}getOptimisticResult(e){return e._type=`infinite`,super.getOptimisticResult(e)}fetchNextPage(e){return this.fetch({...e,meta:{fetchMore:{direction:`forward`}}})}fetchPreviousPage(e){return this.fetch({...e,meta:{fetchMore:{direction:`backward`}}})}createResult(e,t){let{state:n}=e,r=super.createResult(e,t),{isFetching:i,isRefetching:a,isError:o,isRefetchError:s}=r,c=n.fetchMeta?.fetchMore?.direction,l=o&&c===`forward`,u=i&&c===`forward`,d=o&&c===`backward`,f=i&&c===`backward`;return{...r,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:dw(t,n.data),hasPreviousPage:fw(t,n.data),isFetchNextPageError:l,isFetchingNextPage:u,isFetchPreviousPageError:d,isFetchingPreviousPage:f,isRefetchError:s&&!l&&!d,isRefetching:a&&!u&&!f}}},ww=class extends sw{#e;#t;#n;#r;constructor(e){super(),this.#e=e.client,this.mutationId=e.mutationId,this.#n=e.mutationCache,this.#t=[],this.state=e.state||Tw(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#n.notify({type:`observerAdded`,mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#n.notify({type:`observerRemoved`,mutation:this,observer:e})}optionalRemove(){this.#t.length||(this.state.status===`pending`?this.scheduleGc():this.#n.remove(this))}continue(){return this.#r?.continue()??(this.state.status===`pending`?this.execute(this.state.variables):Promise.resolve())}async execute(e){let t=()=>{this.#i({type:`continue`})},n={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey},r=this.#r=ow({fn:()=>this.options.mutationFn?this.options.mutationFn(e,n):Promise.reject(Error(`No mutationFn found`)),onFail:(e,t)=>{this.#i({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#i({type:`pause`})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)}),i=this.state.status===`pending`,a=!r.canStart();try{if(i)t();else{this.#i({type:`pending`,variables:e,isPaused:a}),this.#n.config.onMutate&&await this.#n.config.onMutate(e,this,n);let t=await this.options.onMutate?.(e,n);t!==this.state.context&&this.#i({type:`pending`,context:t,variables:e,isPaused:a})}let o=await r.start();return await this.#n.config.onSuccess?.(o,e,this.state.context,this,n),await this.options.onSuccess?.(o,e,this.state.context,n),await this.#n.config.onSettled?.(o,null,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(o,null,e,this.state.context,n),this.#i({type:`success`,data:o}),o}catch(t){try{await this.#n.config.onError?.(t,e,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onError?.(t,e,this.state.context,n)}catch(e){Promise.reject(e)}try{await this.#n.config.onSettled?.(void 0,t,this.state.variables,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onSettled?.(void 0,t,e,this.state.context,n)}catch(e){Promise.reject(e)}throw this.#i({type:`error`,error:t}),t}finally{this.#r===r&&(this.#r=void 0),this.#n.runNext(this)}}#i(e){let t=t=>{switch(e.type){case`failed`:return{...t,failureCount:e.failureCount,failureReason:e.error};case`pause`:return{...t,isPaused:!0};case`continue`:return{...t,isPaused:!1};case`pending`:return{...t,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:`pending`,variables:e.variables,submittedAt:Date.now()};case`success`:return{...t,data:e.data,failureCount:0,failureReason:null,error:null,status:`success`,isPaused:!1};case`error`:return{...t,data:void 0,error:e.error,failureCount:t.failureCount+1,failureReason:e.error,isPaused:!1,status:`error`}}};this.state=t(this.state),tw.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function Tw(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var Ew=class extends ZC{#e;#t;#n;constructor(e={}){super(),this.config=e,this.#e=new Set,this.#t=new Map,this.#n=0}build(e,t,n){let r=new ww({client:e,mutationCache:this,mutationId:++this.#n,options:e.defaultMutationOptions(t),state:n});return this.add(r),r}add(e){this.#e.add(e);let t=Dw(e);if(typeof t==`string`){let n=this.#t.get(t);n?n.push(e):this.#t.set(t,[e])}this.notify({type:`added`,mutation:e})}remove(e){if(this.#e.delete(e)){let t=Dw(e);if(typeof t==`string`){let n=this.#t.get(t);if(n){if(n.length>1){let t=n.indexOf(e);t!==-1&&n.splice(t,1)}else n[0]===e&&this.#t.delete(t)}}}this.notify({type:`removed`,mutation:e})}canRun(e){let t=Dw(e);if(typeof t==`string`){let n=this.#t.get(t)?.find(e=>e.state.status===`pending`);return!n||n===e}return!0}runNext(e){let t=Dw(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){tw.batch(()=>{this.#e.forEach(e=>{this.notify({type:`removed`,mutation:e})}),this.#e.clear(),this.#t.clear()})}getAll(){return Array.from(this.#e)}find(e){let t={exact:!0,...e};return this.getAll().find(e=>jC(t,e))}findAll(e={}){return this.getAll().filter(t=>jC(e,t))}notify(e){tw.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return tw.batch(()=>Promise.all(e.map(e=>e.continue().catch(TC))))}};function Dw(e){return e.options.scope?.id}var Ow=class extends ZC{#e;#t=void 0;#n;#r;constructor(e,t){super(),this.#e=e,this.setOptions(t),this.bindMethods(),this.#i()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(e){let t=this.options;this.options=this.#e.defaultMutationOptions(e),LC(this.options,t)||this.#e.getMutationCache().notify({type:`observerOptionsUpdated`,mutation:this.#n,observer:this}),t?.mutationKey&&this.options.mutationKey&&NC(t.mutationKey)!==NC(this.options.mutationKey)?this.reset():this.#n?.state.status===`pending`&&this.#n.setOptions(this.options)}onSubscribe(){this.listeners.size===1&&this.#n&&(this.#n.addObserver(this),this.#i())}onUnsubscribe(){this.hasListeners()||this.#n?.removeObserver(this)}onMutationUpdate(e){this.#i(),this.#a(e)}getCurrentResult(){return this.#t}reset(){this.#n?.removeObserver(this),this.#n=void 0,this.#i(),this.#a()}mutate(e,t){return this.#r=t,this.#n?.removeObserver(this),this.#n=this.#e.getMutationCache().build(this.#e,this.options),this.#n.addObserver(this),this.#n.execute(e)}#i(){let e=this.#n?.state??Tw();this.#t={...e,isPending:e.status===`pending`,isSuccess:e.status===`success`,isError:e.status===`error`,isIdle:e.status===`idle`,mutate:this.mutate,reset:this.reset}}#a(e){tw.batch(()=>{if(this.#r&&this.hasListeners()){let t=this.#t.variables,n=this.#t.context,r={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};if(e?.type===`success`){try{this.#r.onSuccess?.(e.data,t,n,r)}catch(e){Promise.reject(e)}try{this.#r.onSettled?.(e.data,null,t,n,r)}catch(e){Promise.reject(e)}}else if(e?.type===`error`){try{this.#r.onError?.(e.error,t,n,r)}catch(e){Promise.reject(e)}try{this.#r.onSettled?.(void 0,e.error,t,n,r)}catch(e){Promise.reject(e)}}}this.listeners.forEach(e=>{e(this.#t)})})}};function kw(e,t){let n=new Set(t);return e.filter(e=>!n.has(e))}var Aw=class extends ZC{#e;#t;#n;#r;#i;#a;#o;#s;#c;#l=[];constructor(e,t,n){super(),this.#e=e,this.#r=n,this.#n=[],this.#i=[],this.#t=[],this.setQueries(t)}onSubscribe(){this.listeners.size===1&&this.#i.forEach(e=>{e.subscribe(t=>{this.#m(e,t)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,this.#i.forEach(e=>{e.destroy()})}setQueries(e,t){this.#n=e,this.#r=t,tw.batch(()=>{let e=this.#i,t=this.#p(this.#n);t.forEach(e=>e.observer.setOptions(e.defaultedQueryOptions));let n=t.map(e=>e.observer),r=n.map(e=>e.getCurrentResult()),i=e.length!==n.length,a=n.some((t,n)=>t!==e[n]),o=i||a,s=o?!0:r.some((e,t)=>{let n=this.#t[t];return!n||!LC(e,n)});!o&&!s||(o&&(this.#l=t,this.#i=n),this.#t=r,this.hasListeners()&&(o&&(kw(e,n).forEach(e=>{e.destroy()}),kw(n,e).forEach(e=>{e.subscribe(t=>{this.#m(e,t)})})),this.#h()))})}getCurrentResult(){return this.#t}getQueries(){return this.#i.map(e=>e.getCurrentQuery())}getObservers(){return this.#i}getOptimisticResult(e,t){let n=this.#p(e),r=n.map(e=>e.observer.getOptimisticResult(e.defaultedQueryOptions)),i=n.map(e=>e.defaultedQueryOptions.queryHash);return[r,e=>this.#d(e??r,t,i),()=>this.#u(r,n)]}#u(e,t){let n=new Set;return t.map((r,i)=>{let a=e[i];return r.defaultedQueryOptions.notifyOnChangeProps?a:r.observer.trackResult(a,e=>{n.has(e)||(n.add(e),t.forEach(t=>{t.observer.trackProp(e)}))})})}#d(e,t,n){if(t){let r=this.#c,i=n!==void 0&&r!==void 0&&(r.length!==n.length||n.some((e,t)=>e!==r[t]));return(this.#t!==this.#s||i||t!==this.#o)&&(this.#o=t,this.#s=this.#t,n!==void 0&&(this.#c=n),this.#a=IC(this.#a,t(e))),this.#a}return e}#f(){return!this.#r?.combine||this.#i.some((e,t)=>e.options.suspense&&this.#t[t]?.data===void 0)}#p(e){let t=new Map;this.#i.forEach(e=>{let n=e.options.queryHash;if(!n)return;let r=t.get(n);r?r.push(e):t.set(n,[e])});let n=[];return e.forEach(e=>{let r=this.#e.defaultQueryOptions(e),i=t.get(r.queryHash)?.shift()??new _w(this.#e,r);n.push({defaultedQueryOptions:r,observer:i})}),n}#m(e,t){let n=this.#i.indexOf(e);n!==-1&&(this.#t=this.#t.slice(),this.#t[n]=t,this.#h())}#h(){if(this.hasListeners()){let e=this.#f(),t=this.#a,n=e?t:this.#d(this.#u(this.#t,this.#l),this.#r?.combine);(e||t!==n)&&tw.batch(()=>{this.listeners.forEach(e=>{e(this.#t)})})}}},jw=class extends ZC{#e;constructor(e={}){super(),this.config=e,this.#e=new Map}build(e,t,n){let r=t.queryKey,i=t.queryHash??MC(r,t),a=this.get(i);return a||(a=new pw({client:e,queryKey:r,queryHash:i,options:e.defaultQueryOptions(t),state:n,defaultOptions:e.getQueryDefaults(r)}),this.add(a)),a}add(e){this.#e.has(e.queryHash)||(this.#e.set(e.queryHash,e),this.notify({type:`added`,query:e}))}remove(e){let t=this.#e.get(e.queryHash);t&&(e.destroy(),t===e&&this.#e.delete(e.queryHash),this.notify({type:`removed`,query:e}))}clear(){tw.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#e.get(e)}getAll(){return[...this.#e.values()]}find(e){let t={exact:!0,...e};return this.getAll().find(e=>AC(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>AC(e,t)):t}notify(e){tw.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){tw.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){tw.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},Mw=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new jw,this.#t=e.mutationCache||new Ew,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=QC.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=nw.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#a--,this.#a===0&&(this.#o?.(),this.#o=void 0,this.#s?.(),this.#s=void 0)}isFetching(e){return this.#e.findAll({...e,fetchStatus:`fetching`}).length}isMutating(e){return this.#t.findAll({...e,status:`pending`}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),n=this.#e.build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(kC(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return this.#e.findAll(e).map(({queryKey:e,state:t})=>[e,t.data])}setQueryData(e,t,n){let r=this.defaultQueryOptions({queryKey:e}),i=this.#e.get(r.queryHash)?.state.data,a=EC(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return tw.batch(()=>this.#e.findAll(e).map(({queryKey:e})=>[e,this.setQueryData(e,t,n)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state}removeQueries(e){let t=this.#e;tw.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return tw.batch(()=>{let r=n.findAll(e),i=new Set(r);return r.forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,predicate:e=>i.has(e)},t)})}cancelQueries(e,t={}){let n={revert:!0,...t},r=tw.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(TC).catch(TC)}invalidateQueries(e,t={}){return tw.batch(()=>(this.#e.findAll(e).forEach(e=>{e.invalidate()}),e?.refetchType===`none`?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??`active`},t)))}refetchQueries(e,t={}){let n={...t,cancelRefetch:t.cancelRefetch??!0},r=tw.batch(()=>this.#e.findAll(e).filter(e=>!e.isDisabled()&&!e.isStatic()).map(e=>{let t=e.fetch(void 0,n);return n.throwOnError||(t=t.catch(TC)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(TC)}async query(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t),r=n.isStaleByTime(kC(t.staleTime,n))?await n.fetch(t):n.state.data,i=t.select;return i?i(r):r}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime(kC(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(TC).catch(TC)}infiniteQuery(e){return e._type=`infinite`,this.query(e)}fetchInfiniteQuery(e){return e._type=`infinite`,this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(TC).catch(TC)}ensureInfiniteQueryData(e){return e._type=`infinite`,this.ensureQueryData(e)}resumePausedMutations(){return nw.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#n}setDefaultOptions(e){this.#n=e}setQueryDefaults(e,t){this.#r.set(NC(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{PC(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(NC(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{PC(e,t.mutationKey)&&Object.assign(n,t.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;let t={...this.#n.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||=MC(t.queryKey,t),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!==`always`),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode=`offlineFirst`),t.queryFn===GC&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#n.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}},Nw=G.createContext(!1),Pw=()=>G.useContext(Nw);Nw.Provider;function aee(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var oee=G.createContext(aee()),Fw=()=>G.useContext(oee),Iw=(e,t,n)=>{let r=n?.state.error&&typeof e.throwOnError==`function`?qC(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||r)&&(t.isReset()||(e.retryOnMount=!1))},Lw=e=>{G.useEffect(()=>{e.clearReset()},[e])},Rw=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||qC(n,[e.error,r])),zw=e=>{if(e.suspense){let t=1e3,n=e=>e===`static`?e:Math.max(e??t,t),r=e.staleTime;e.staleTime=typeof r==`function`?(...e)=>n(r(...e)):n(r),typeof e.gcTime==`number`&&(e.gcTime=Math.max(e.gcTime,t))}},Bw=(e,t)=>e?.suspense&&t.isPending,Vw=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function Hw({queries:e,...t},n){let r=yC(n),i=Pw(),a=Fw(),o=t.subscribed!==!1,s=G.useMemo(()=>e.map(e=>{let t=r.defaultQueryOptions(e);return t._optimisticResults=i?`isRestoring`:o?`optimistic`:void 0,t}),[e,r,i,o]);s.forEach(e=>{zw(e);let t=r.getQueryCache().get(e.queryHash);Iw(e,a,t)}),Lw(a);let[c]=G.useState(()=>new Aw(r,s,t)),[l,u,d]=c.getOptimisticResult(s,t.combine),f=!i&&o;G.useSyncExternalStore(G.useCallback(e=>f?c.subscribe(tw.batchCalls(e)):TC,[c,f]),()=>c.getCurrentResult(),()=>c.getCurrentResult()),G.useEffect(()=>{c.setQueries(s,t)},[s,t,c]);let p=l.some((e,t)=>Bw(s[t],e))?l.flatMap((e,t)=>{let n=s[t];return n&&Bw(n,e)?Vw(n,new _w(r,n),a):[]}):[];if(p.length>0)throw Promise.all(p);let m=l.find((e,t)=>{let n=s[t];return n&&Rw({result:e,errorResetBoundary:a,throwOnError:n.throwOnError,query:r.getQueryCache().get(n.queryHash),suspense:n.suspense})});if(m)throw m.error;return u(d())}function Uw(e,t,n){let r=Pw(),i=Fw(),a=yC(n),o=a.defaultQueryOptions(e),s=a.getQueryCache().get(o.queryHash),c=e.subscribed!==!1;o._optimisticResults=r?`isRestoring`:c?`optimistic`:void 0,zw(o),Iw(o,i,s),Lw(i);let[l]=G.useState(()=>new t(a,o)),u=l.getOptimisticResult(o),d=!r&&c;if(G.useSyncExternalStore(G.useCallback(e=>{let t=d?l.subscribe(tw.batchCalls(e)):TC;return l.updateResult(),t},[l,d]),()=>l.getCurrentResult(),()=>l.getCurrentResult()),G.useEffect(()=>{l.setOptions(o)},[o,l]),Bw(o,u))throw Vw(o,l,i);if(Rw({result:u,errorResetBoundary:i,throwOnError:o.throwOnError,query:s,suspense:o.suspense}))throw u.error;return o.notifyOnChangeProps?u:l.trackResult(u)}function Ww(e,t){return Uw(e,_w,t)}function Gw(e){return e}function Kw(e){return e}function qw(e,t){return e.findAll(t.filters).map(e=>t.select?t.select(e):e.state)}function Jw(e={},t){let n=yC(t).getMutationCache(),r=G.useRef(e),i=G.useRef(null);return i.current===null&&(i.current=qw(n,e)),G.useEffect(()=>{r.current=e}),G.useSyncExternalStore(G.useCallback(e=>n.subscribe(()=>{let t=IC(i.current,qw(n,r.current));i.current!==t&&(i.current=t,tw.schedule(e))}),[n]),()=>i.current,()=>i.current)}function Yw(e,t){let n=yC(t),[r]=G.useState(()=>new Ow(n,e));G.useEffect(()=>{r.setOptions(e)},[r,e]);let i=G.useSyncExternalStore(G.useCallback(e=>r.subscribe(tw.batchCalls(e)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),a=G.useCallback((...e)=>{r.mutate(e[0],e[1]).catch(TC)},[r]);if(i.error&&qC(r.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:a,mutateAsync:i.mutate}}function Xw(e){return e}function Zw(e,t){return Uw(e,Cw,t)}var Qw=o((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0<n;){var r=n-1>>>1,a=e[r];if(0<i(a,t))e[r]=t,e[n]=a,n=r;else break a}}function n(e){return e.length===0?null:e[0]}function r(e){if(e.length===0)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;a:for(var r=0,a=e.length,o=a>>>1;r<o;){var s=2*(r+1)-1,c=e[s],l=s+1,u=e[l];if(0>i(c,n))l<a&&0>i(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(l<a&&0>i(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=typeof setTimeout==`function`?setTimeout:null,_=typeof clearTimeout==`function`?clearTimeout:null,v=typeof setImmediate<`u`?setImmediate:null;typeof navigator<`u`&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function y(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function b(e){if(h=!1,y(e),!m){if(n(c)!==null)m=!0,M(x);else{var t=n(l);t!==null&&N(b,t.startTime-e)}}}function x(t,i){m=!1,h&&(h=!1,_(w),w=-1),p=!0;var a=f;try{for(y(i),d=n(c);d!==null&&(!(d.expirationTime>i)||t&&!D());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=i);i=e.unstable_now(),typeof s==`function`?d.callback=s:d===n(c)&&r(c),y(i)}else r(c);d=n(c)}if(d!==null)var u=!0;else{var g=n(l);g!==null&&N(b,g.startTime-i),u=!1}return u}finally{d=null,f=a,p=!1}}var S=!1,C=null,w=-1,T=5,E=-1;function D(){return!(e.unstable_now()-E<T)}function O(){if(C!==null){var t=e.unstable_now();E=t;var n=!0;try{n=C(!0,t)}finally{n?k():(S=!1,C=null)}}else S=!1}var k;if(typeof v==`function`)k=function(){v(O)};else if(typeof MessageChannel<`u`){var A=new MessageChannel,j=A.port2;A.port1.onmessage=O,k=function(){j.postMessage(null)}}else k=function(){g(O,0)};function M(e){C=e,S||(S=!0,k())}function N(t,n){w=g(function(){t(e.unstable_now())},n)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_continueExecution=function(){m||p||(m=!0,M(x))},e.unstable_forceFrameRate=function(e){0>e||125<e?console.error(`forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported`):T=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_getFirstCallbackNode=function(){return n(c)},e.unstable_next=function(e){switch(f){case 1:case 2:case 3:var t=3;break;default:t=f}var n=f;f=t;try{return e()}finally{f=n}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=f;f=e;try{return t()}finally{f=n}},e.unstable_scheduleCallback=function(r,i,a){var o=e.unstable_now();switch(typeof a==`object`&&a?(a=a.delay,a=typeof a==`number`&&0<a?o+a:o):a=o,r){case 1:var s=-1;break;case 2:s=250;break;case 5:s=1073741823;break;case 4:s=1e4;break;default:s=5e3}return s=a+s,r={id:u++,callback:i,priorityLevel:r,startTime:a,expirationTime:s,sortIndex:-1},a>o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(_(w),w=-1):h=!0,N(b,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,M(x))),r},e.unstable_shouldYield=D,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),$w=o(((e,t)=>{t.exports=Qw()})),eT=o((e=>{var t=d(),n=$w();function r(e){for(var t=`https://reactjs.org/docs/error-decoder.html?invariant=`+e,n=1;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n]);return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}var i=new Set,a={};function o(e,t){s(e,t),s(e+`Capture`,t)}function s(e,t){for(a[e]=t,e=0;e<t.length;e++)i.add(t[e])}var c=!(typeof window>`u`||window.document===void 0||window.document.createElement===void 0),l=Object.prototype.hasOwnProperty,u=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,f={},p={};function m(e){return l.call(p,e)?!0:l.call(f,e)?!1:u.test(e)?p[e]=!0:(f[e]=!0,!1)}function h(e,t,n,r){if(n!==null&&n.type===0)return!1;switch(typeof t){case`function`:case`symbol`:return!0;case`boolean`:return r?!1:n===null?(e=e.toLowerCase().slice(0,5),e!==`data-`&&e!==`aria-`):!n.acceptsBooleans;default:return!1}}function g(e,t,n,r){if(t==null||h(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return!1===t;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function _(e,t,n,r,i,a,o){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=i,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=a,this.removeEmptyString=o}var v={};`children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style`.split(` `).forEach(function(e){v[e]=new _(e,0,!1,e,null,!1,!1)}),[[`acceptCharset`,`accept-charset`],[`className`,`class`],[`htmlFor`,`for`],[`httpEquiv`,`http-equiv`]].forEach(function(e){var t=e[0];v[t]=new _(t,1,!1,e[1],null,!1,!1)}),[`contentEditable`,`draggable`,`spellCheck`,`value`].forEach(function(e){v[e]=new _(e,2,!1,e.toLowerCase(),null,!1,!1)}),[`autoReverse`,`externalResourcesRequired`,`focusable`,`preserveAlpha`].forEach(function(e){v[e]=new _(e,2,!1,e,null,!1,!1)}),`allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope`.split(` `).forEach(function(e){v[e]=new _(e,3,!1,e.toLowerCase(),null,!1,!1)}),[`checked`,`multiple`,`muted`,`selected`].forEach(function(e){v[e]=new _(e,3,!0,e,null,!1,!1)}),[`capture`,`download`].forEach(function(e){v[e]=new _(e,4,!1,e,null,!1,!1)}),[`cols`,`rows`,`size`,`span`].forEach(function(e){v[e]=new _(e,6,!1,e,null,!1,!1)}),[`rowSpan`,`start`].forEach(function(e){v[e]=new _(e,5,!1,e.toLowerCase(),null,!1,!1)});var y=/[\-:]([a-z])/g;function b(e){return e[1].toUpperCase()}`accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height`.split(` `).forEach(function(e){var t=e.replace(y,b);v[t]=new _(t,1,!1,e,null,!1,!1)}),`xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type`.split(` `).forEach(function(e){var t=e.replace(y,b);v[t]=new _(t,1,!1,e,`http://www.w3.org/1999/xlink`,!1,!1)}),[`xml:base`,`xml:lang`,`xml:space`].forEach(function(e){var t=e.replace(y,b);v[t]=new _(t,1,!1,e,`http://www.w3.org/XML/1998/namespace`,!1,!1)}),[`tabIndex`,`crossOrigin`].forEach(function(e){v[e]=new _(e,1,!1,e.toLowerCase(),null,!1,!1)}),v.xlinkHref=new _(`xlinkHref`,1,!1,`xlink:href`,`http://www.w3.org/1999/xlink`,!0,!1),[`src`,`href`,`action`,`formAction`].forEach(function(e){v[e]=new _(e,1,!1,e.toLowerCase(),null,!0,!0)});function x(e,t,n,r){var i=v.hasOwnProperty(t)?v[t]:null;(i===null?r||!(2<t.length)||t[0]!==`o`&&t[0]!==`O`||t[1]!==`n`&&t[1]!==`N`:i.type!==0)&&(g(t,n,i,r)&&(n=null),r||i===null?m(t)&&(n===null?e.removeAttribute(t):e.setAttribute(t,``+n)):i.mustUseProperty?e[i.propertyName]=n===null?i.type!==3&&``:n:(t=i.attributeName,r=i.attributeNamespace,n===null?e.removeAttribute(t):(i=i.type,n=i===3||i===4&&!0===n?``:``+n,r?e.setAttributeNS(r,t,n):e.setAttribute(t,n))))}var S=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,C=Symbol.for(`react.element`),w=Symbol.for(`react.portal`),T=Symbol.for(`react.fragment`),E=Symbol.for(`react.strict_mode`),D=Symbol.for(`react.profiler`),O=Symbol.for(`react.provider`),k=Symbol.for(`react.context`),A=Symbol.for(`react.forward_ref`),j=Symbol.for(`react.suspense`),M=Symbol.for(`react.suspense_list`),N=Symbol.for(`react.memo`),P=Symbol.for(`react.lazy`),F=Symbol.for(`react.offscreen`),I=Symbol.iterator;function L(e){return typeof e!=`object`||!e?null:(e=I&&e[I]||e[`@@iterator`],typeof e==`function`?e:null)}var R=Object.assign,z;function ee(e){if(z===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);z=t&&t[1]||``}return`
|
|
78
|
+
`+z+e}var te=!1;function B(e,t){if(!e||te)return``;te=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(t){if(t=function(){throw Error()},Object.defineProperty(t.prototype,"props",{set:function(){throw Error()}}),typeof Reflect==`object`&&Reflect.construct){try{Reflect.construct(t,[])}catch(e){var r=e}Reflect.construct(e,[],t)}else{try{t.call()}catch(e){r=e}e.call(t.prototype)}}else{try{throw Error()}catch(e){r=e}e()}}catch(t){if(t&&r&&typeof t.stack==`string`){for(var i=t.stack.split(`
|
|
79
|
+
`),a=r.stack.split(`
|
|
80
|
+
`),o=i.length-1,s=a.length-1;1<=o&&0<=s&&i[o]!==a[s];)s--;for(;1<=o&&0<=s;o--,s--)if(i[o]!==a[s]){if(o!==1||s!==1)do if(o--,s--,0>s||i[o]!==a[s]){var c=`
|
|
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
|
+
`).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
|
+
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&<(n),e.callbackNode=null,e.callbackPriority=0;else if(t=r&-r,e.callbackPriority!==t){if(n!=null&<(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`})),tT=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=eT()})),nT=o((e=>{var t=tT();e.createRoot=t.createRoot,e.hydrateRoot=t.hydrateRoot}))();function rT(e,t){console.error(JSON.stringify({source:`agar`,operation:e,failureKind:t instanceof Error?`Error`:`NonErrorThrown`}),lg(t))}var iT=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 aT=globalThis[iT],oT=aT?aT.RpcTarget:class{},sT=async function(){}.constructor,cT=typeof Buffer<`u`?Buffer.prototype:void 0;function lT(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 sT.prototype:return`function`;case Array.prototype:return`array`;case Date.prototype:return`date`;case Uint8Array.prototype:case cT: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 xT.prototype:return`stub`;case ST.prototype:return`rpc-promise`;default:if(aT){if(t==aT.RpcStub.prototype||e instanceof aT.ServiceStub)return`rpc-target`;if(t==aT.RpcPromise.prototype||t==aT.RpcProperty.prototype)return`rpc-thenable`}return e instanceof oT?`rpc-target`:e instanceof Error?`error`:`unsupported`}}function uT(){throw Error(`RPC map() implementation was not loaded.`)}var dT={applyMap:uT,sendMap:uT};function fT(){throw Error(`Stream implementation was not loaded.`)}var pT={createWritableStreamHook:fT,createWritableStreamFromHook:fT,createReadableStreamHook:fT},mT=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}}},hT=class extends mT{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)}}},gT=new hT(Error(`Attempted to use RPC stub after it has been disposed.`)),_T=(e,t,n)=>e.call(t,n);function vT(e,t){let n=_T;_T=e;try{return t()}finally{_T=n}}var yT=Symbol(`realStub`),bT={apply(e,t,n){let r=e.raw;return new ST(_T(r.hook,r.pathIfPromise||[],kT.fromAppParams(n)),[])},get(e,t,n){let r=e.raw;if(t===yT)return r;if(t in ST.prototype)return r[t];if(typeof t==`string`)return new ST(r.hook,r.pathIfPromise?[...r.pathIfPromise,t]:[t]);if(t===Symbol.dispose&&(!r.pathIfPromise||r.pathIfPromise.length==0))return()=>{r.hook.dispose(),r.hook=gT}},has(e,t){let n=e.raw;return t===yT?!0:t in ST.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.`)}},xT=class e extends oT{constructor(e,t){if(super(),!(e instanceof mT)){let n=e;if(e=n instanceof oT||n instanceof Function?PT.create(n,void 0):new MT(kT.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,bT)}hook;pathIfPromise;dup(){let t=this[yT];return t.pathIfPromise?new e(t.hook.get(t.pathIfPromise)):new e(t.hook.dup())}onRpcBroken(e){this[yT].hook.onBroken(e)}map(e){let{hook:t,pathIfPromise:n}=this[yT];return dT.sendMap(t,n||[],e)}toString(){return`[object RpcStub]`}},ST=class extends xT{constructor(e,t){if(e instanceof mT)super(e,t??[]);else{if(t!==void 0)throw TypeError(`RpcPromise constructor expected one argument, received two.`);let n=lT(e);if(n===`rpc-promise`){let t=DT(e);if(t.pathIfPromise.length>0)super(t.hook,t.pathIfPromise);else{let e=t.hook;t.hook=gT,super(e,[])}}else if(n===`rpc-thenable`)super(PT.create(e,void 0),[]);else{let t=new FT(Promise.resolve(e).then(e=>new MT(kT.fromAppReturn(e))));t.ignoreUnhandledRejections(),super(t,[])}}}then(e,t){return OT(this).then(...arguments)}catch(e){return OT(this).catch(...arguments)}finally(e){return OT(this).finally(...arguments)}toString(){return`[object RpcPromise]`}};function CT(e){let{hook:t,pathIfPromise:n}=e[yT];return n&&n.length>0?t.get(n):t}function wT(e){let{hook:t,pathIfPromise:n}=e[yT];return n?t.get(n):t.dup()}function TT(e){let{hook:t,pathIfPromise:n}=e[yT];if(!(n&&n.length>0))return t}function ET(e){return e[yT].hook}function DT(e){return e[yT]}async function OT(e){let{hook:t,pathIfPromise:n}=e[yT];return n.length>0&&(t=t.get(n)),(await t.pull()).deliverResolve()}var kT=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 PT.create(e,t)}if(this.source===`return`){let r=this.rpcTargets?.get(e);return r?n?r.dup():(this.rpcTargets?.delete(e),r):(r=PT.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 pT.createWritableStreamHook(e);if(this.source===`return`){let t=this.rpcTargets?.get(e);return t?n?t.dup():(this.rpcTargets?.delete(e),t):(t=pT.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 pT.createReadableStreamHook(e);if(this.source===`return`){let t=this.rpcTargets?.get(e);return t?n?t.dup():(this.rpcTargets?.delete(e),t):(t=pT.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(lT(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?wT(t):CT(t),t instanceof ST){let e=new ST(a,[]);return this.promises.push({parent:r,property:n,promise:e}),e}return this.hooks.push(a),new xT(a)}case`function`:case`rpc-target`:{let n=e,r;return r=a?a.getHookForRpcTarget(n,t,i):PT.create(n,t),this.hooks.push(r),new xT(r)}case`rpc-thenable`:{let o=e,s;return s=a?new ST(a.getHookForRpcTarget(o,t,i),[]):new ST(PT.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):pT.createWritableStreamHook(n),this.hooks.push(r),n}case`readable`:{let n=e,r;return r=a?a.getHookForReadableStream(n,t,i):pT.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 ST)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=TT(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 ST?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(lT(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=TT(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)):NT(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=pT.createWritableStreamHook(t),n.dispose();return}case`readable`:{let t=e,n=this.rpcTargets?.get(t);n?this.rpcTargets.delete(t):n=pT.createReadableStreamHook(t),n.dispose();return}default:return}}ignoreUnhandledRejections(){this.hooks?(this.hooks.forEach(e=>{e.ignoreUnhandledRejections()}),this.promises.forEach(e=>ET(e.promise).ignoreUnhandledRejections())):this.ignoreUnhandledRejectionsImpl(this.value)}ignoreUnhandledRejectionsImpl(e){switch(lT(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`:ET(e).ignoreUnhandledRejections();return;case`rpc-thenable`:e.then(e=>{},e=>{});return;default:return}}};function AT(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(lT(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}=DT(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 ST){let{hook:t,pathIfPromise:n}=DT(e);return{hook:t,remainingPath:n||[]}}return{value:e,parent:t,owner:r}}var jT=class extends mT{call(e,t){let n;try{let{value:t,owner:r}=this.getValue();n=AT(t,void 0,e,r)}catch(e){return t.dispose(),new hT(e)}return n.hook?n.hook.call(n.remainingPath,t):typeof n.value==`function`?new FT(t.deliverCall(n.value,n.parent).then(e=>new MT(e))):(t.dispose(),new hT(TypeError(`'${e.join(`.`)}' is not a function.`)))}map(e,t,n){try{let r;try{let{value:t,owner:n}=this.getValue();r=AT(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):dT.applyMap(r.value,r.parent,r.owner,t,n)}catch(e){return new hT(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=AT(t,void 0,e,n);return r.hook?r.hook.get(r.remainingPath):new MT(kT.deepCopyFrom(r.value,r.parent,r.owner))}catch(e){return new hT(e)}}},MT=class e extends jT{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(kT.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 xT&&this.payload.value.onRpcBroken(e)}};function NT(e){if(Symbol.dispose in e)try{e[Symbol.dispose]()}catch(e){Promise.reject(e)}}var PT=class e extends jT{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=>kT.fromAppReturn(e)):Promise.reject(Error(`Tried to resolve a non-promise stub.`))}ignoreUnhandledRejections(){}dispose(){this.target&&=(this.refcount&&--this.refcount.count==0&&NT(this.target),void 0)}onBroken(e){let t=this.target;t&&`then`in t&&Promise.resolve(t).then(()=>{},e)}},FT=class e extends mT{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)}},IT={maxBigIntDigits:16384,maxDepth:256,maxMessageSize:33554432},LT=new Uint8Array(new Uint16Array([1]).buffer)[0]===1,RT=[`ArrayBuffer`,`DataView`,`Int8Array`,`Uint8Array`,`Uint8ClampedArray`,`Int16Array`,`Uint16Array`,`Int32Array`,`Uint32Array`,`BigInt64Array`,`BigUint64Array`,`Float32Array`,`Float64Array`];function zT(e){return RT.includes(e)}var BT={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},VT={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},HT=new Map;for(let e of Object.keys(VT))HT.set(VT[e],e);function UT(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 WT=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 GT(e,t){let n=await new Response(e).blob();return n.type===t?n:n.slice(0,n.size,t)}var KT={__proto__:null,Error,EvalError,RangeError,ReferenceError,SyntaxError,TypeError,URIError,AggregateError},qT=class e{exporter;source;encodingLevel;constructor(e,t,n){this.exporter=e,this.source=t,this.encodingLevel=n}static devaluate(t,n,r=WT,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(lT(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=HT.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=BT[t];!LT&&i&&(n=n.slice(),UT(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=pT.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=pT.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}=DT(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 IT}};function JT(e,t){return new ST(new FT(new Response(t).arrayBuffer().then(t=>{let n=new Uint8Array(t),r=new Request(e,{body:n});return new MT(kT.fromAppReturn(r))})),[])}function YT(e,t){return new ST(new FT(GT(e,t).then(e=>new MT(kT.fromAppReturn(e)))),[])}var XT=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=kT.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(!zT(t[2])){let e=t[2].slice(0,64);throw TypeError(`Unknown bytes type marker: ${e}`)}let n=t[2],r=BT[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(!LT&&r!==void 0&&UT(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=KT[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=JT(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=YT(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 ST(e,[]);return this.promises.push({promise:t,parent:n,property:r}),t}return this.hooks.push(e),new ST(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 ST(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 ST(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 xT(e)}}break;case`writable`:if(typeof t[1]==`number`){let e=this.importer.importStub(t[1]),n=pT.createWritableStreamFromHook(e);return this.hooks.push(e),n}break;case`readable`:if(typeof t[1]==`number`){let e=this.importer.getPipeReadable(t[1]),n=pT.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}},ZT=16,QT=8,$T=16,eE=64;function tE(e){return 2+e.length*3}function nE(e,t,n=0){if(n>=eE)return QT;switch(typeof e){case`string`:return tE(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 $T+e.byteLength;if(typeof Blob<`u`&&e instanceof Blob)return $T+e.size;if(e instanceof Date)return 16;if(t??=new WeakSet,t.has(e))return QT;if(t.add(e),e instanceof Array){let r=ZT;for(let i of e)r+=QT+nE(i,t,n+1);return r}if(e instanceof Error){let r=ZT+tE(e.name)+tE(e.message)+tE(e.stack??``);for(let i of Object.keys(e))r+=QT+tE(i)+nE(e[i],t,n+1);return r}let r=ZT;for(let i of Object.keys(e))r+=QT+tE(i)+nE(e[i],t,n+1);return r}default:return 16}}var rE=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 hT(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)}},iE=class e extends mT{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)}},aE=class extends iE{session;constructor(e){super(!1,e),this.session=e.session}dispose(){if(this.session){let e=this.session;this.session=void 0,e.shutdown()}}},oE=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={...IT,...n.limits},this.exports.push({hook:t,refcount:1}),this.imports.push(new rE(this,0,!1)),this.readLoop().catch(e=>this.abort(e))}getMainImport(){return new aE(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,qT.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 xT){let{hook:n,pathIfPromise:r}=DT(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=qT.devaluate(t.value,void 0,this,t,this.encodingLevel);this.send([`resolve`,e,n]),r&&this.releaseExport(e,1)},t=>{this.send([`reject`,e,qT.devaluate(t,void 0,this,void 0,this.encodingLevel)]),r&&this.releaseExport(e,1)}).catch(t=>{try{this.send([`reject`,e,qT.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 iE&&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 rE(this,e,!1),this.imports[e]=t),new iE(!1,t)}importPromise(e){if(this.abortReason)throw this.abortReason;if(this.imports[e])return new hT(Error(`Bug in RPC system: The peer sent a promise reusing an existing export ID.`));let t=new rE(this,e,!0);return this.imports[e]=t,new iE(!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 rE(this,n,!1);this.imports.push(r);let i=new iE(!1,r),a=pT.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=qT.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 rE(this,this.imports.length,!1);return this.imports.push(i),new iE(!0,i)}sendStream(e,t,n){if(this.abortReason)throw n.dispose(),this.abortReason;let r=[`pipeline`,e,t],i;try{i=qT.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=nE(a));let s=this.imports.length,c=new rE(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 rE(this,this.imports.length,!1);return this.imports.push(a),new iE(!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`,qT.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 MT(new XT(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 MT(new XT(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=pT.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 MT(new XT(this,this.encodingLevel).evaluate(n[2])));else{let e=new XT(this,this.encodingLevel).evaluate(n[2]);e.dispose(),t.resolve(new hT(e.value))}}else n[0]==`resolve`&&new XT(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 XT(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}},sE=class{#e;#t;constructor(e,t,n={}){let r;r=t?new MT(kT.fromAppReturn(t)):new hT(Error(`This connection has no main object.`)),this.#e=new oE(e,r,n),this.#t=new xT(this.#e.getMainImport())}getRemoteMain(){return this.#t}getStats(){return this.#e.getStats()}drain(){return this.#e.drain()}};function cE(e,t,n){return new sE(new lE(e),t,n).getRemoteMain()}var lE=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))}},uE,dE=class{context;captureMap=new Map;instructions=[];constructor(e,t){this.context=uE?{parent:uE,captures:[],subject:uE.capture(e),path:t}:{parent:void 0,captures:[],subject:e,path:t},uE=this}unregister(){uE=this.context.parent}makeInput(){return new pE(this,0)}makeOutput(e){let t;try{t=qT.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 pE(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=qT.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 pE(this,this.instructions.length)}pushGet(e,t){let n=this.capture(e.dup());return this.instructions.push([`pipeline`,n,t]),new pE(this,this.instructions.length)}capture(e){if(e instanceof pE&&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){}};dT.sendMap=(e,t,n)=>{let r=new dE(e,t),i;try{i=kT.fromAppReturn(vT(r.pushCall.bind(r),()=>n(new ST(r.makeInput(),[]))))}finally{r.unregister()}if(i instanceof Promise)throw i.catch(e=>{}),Error(`RPC map() callbacks cannot be async.`);return new ST(r.makeOutput(i),[])};function fE(){throw Error(`Attempted to use an abstract placeholder from a mapper function. Please make sure your map function has no side effects.`)}var pE=class extends mT{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(uE)return uE.pushGet(this,e);fE()}call(e,t){t.dispose(),fE()}map(e,t,n){for(let e of t)e.dispose();fE()}pull(){fE()}ignoreUnhandledRejections(){}onBroken(e){fE()}},mE=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 XT(this).evaluateCopy(t);if(e.value instanceof xT){let t=TT(e.value);if(t){this.variables.push(t);continue}}this.variables.push(new MT(e))}return new XT(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 IT}};function hE(e,t,n,r,i){let a=new mE(r,new MT(kT.deepCopyFrom(e,t,n)));try{return a.apply(i)}finally{a.dispose()}}dT.applyMap=(e,t,n,r,i)=>{try{let a;if(e instanceof ST)throw Error(`applyMap() can't be called on RpcPromise`);if(e instanceof Array){let t=[];try{for(let a of e)t.push(hE(a,e,n,r,i))}catch(e){for(let e of t)e.dispose();throw e}a=kT.fromArray(t)}else a=e==null?kT.fromAppReturn(e):hE(e,t,n,r,i);return new MT(a)}finally{for(let e of r)e.dispose()}};var gE=class e extends mT{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 FT((r===`write`?t.deliverStreamWrite(n.writer):t.deliverCall(n.writer[r],n.writer)).then(e=>new MT(e)))}catch(e){return t.dispose(),new hT(e)}}map(e,t,n){for(let e of t)e.dispose();return new hT(Error(`Cannot use map() on a WritableStream`))}get(e){return new hT(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)}},_E=262144,vE=1073741824,yE=65536,bE=2,xE=1.25,SE=.9,CE=3,wE=class{now;window=_E;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?bE:xE,s=a*this.minRtt*o;s=Math.min(s,e.windowAtSend*o),s=e.windowFullAtSend?Math.max(s,e.windowAtSend*SE):Math.max(s,this.window),this.window=Math.max(Math.min(s,vE),yE),this.inStartupPhase&&e.sentTime>=this.roundStartTime&&(this.window>this.lastRoundWindow*xE?this.roundsWithoutIncrease=0:++this.roundsWithoutIncrease>=CE&&(this.inStartupPhase=!1),this.roundStartTime=t,this.lastRoundWindow=this.window)}return this.bytesInFlight<this.window}};function TE(e){let t,n=!1,r=new wE(()=>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=kT.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`],kT.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`],kT.fromAppParams([n]));r.then(()=>o(),()=>o())}})}var EE=class e extends mT{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 hT(Error(`Cannot call methods on a ReadableStream stub`))}map(e,t,n){for(let e of t)e.dispose();return new hT(Error(`Cannot use map() on a ReadableStream`))}get(e){return new hT(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){}};pT.createWritableStreamHook=gE.create,pT.createWritableStreamFromHook=TE,pT.createReadableStreamHook=EE.create;var DE=xT,OE=oT,kE=cE;function AE(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 jE(e,t=80){let n=``;for(let t=0;t<e.length;t+=1){let r=e.charCodeAt(t);n+=AE(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 ME(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 NE(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 PE(e){let t=e.trim().toLowerCase();if(!t)throw Error(`Invalid keymap token: token cannot be empty`);return t}function FE(e){let t=e.trim().toLowerCase();if(!t)throw Error(`Invalid key name: key name cannot be empty`);return t}function IE(e){return{name:FE(e.name),ctrl:e.ctrl??!1,shift:e.shift??!1,meta:e.meta??!1,super:e.super??!1,hyper:e.hyper||void 0}}function LE(e){return{name:e.name,ctrl:e.ctrl,shift:e.shift,meta:e.meta,super:e.super,hyper:e.hyper||void 0}}function RE(e,t){let n=LE(IE(e));return{stroke:n,display:t?.display??KE(n),match:t?.match??HE(n),tokenName:t?.tokenName?PE(t.tokenName):void 0}}function zE(e){return{stroke:LE(e.stroke),display:e.display,match:e.match,tokenName:e.tokenName,patternName:e.patternName,payloadKey:e.payloadKey}}function BE(e){return e.map(e=>zE(e))}function VE(e){return`match`in e?e.match:`stroke`in e?HE(e.stroke):HE(e)}function HE(e){return`key:${qE(IE(e))}`}function UE(e){let t=e.trim();if(!t)throw Error(`Invalid keymap match id: id cannot be empty`);return`text:${t}`}function WE(e,t){return`stroke`in e?t?.preferDisplay&&e.display?e.display:KE(e.stroke):KE(IE(e))}function GE(e,t){return e.map(e=>WE(e,t)).join(t?.separator??``)}function KE(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 qE(e){return`${e.name}:${+!!e.ctrl}:${+!!e.shift}:${+!!e.meta}:${+!!e.super}:${+!!e.hyper}`}var JE=Symbol(`keymap-extension-context`);function YE(e){return e.isDestroyed?null:e.getFocusedTarget()}function XE(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 ZE(e,t){let n=new Set;return XE(e,t,e=>{n.add(e)}),n}function QE(e,t,n){let r=[],i=ZE(t,n),a=Array.isArray(e)?e:$E(e);for(let e of a)eD(t,e,n,i)&&r.push(e);return r}function $E(e){return[...e].sort((e,t)=>t.priority-e.priority||t.order-e.order)}function eD(e,t,n,r=ZE(e,n)){let i=t.target;return i?e.isTargetDestroyed(i)?!1:t.targetMode===`focus`?i===n:r.has(i):!0}function tD(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 nD(e,t,n=!0){let r=e.binding.sequence[e.index];if(!r?.patternName)return!0;let i=t.get(r.patternName);return i?tD(e)>=i.min:n}function rD(e,t,n=!0){let r=e.binding.sequence[e.index];if(r?.patternName){let n=t.get(r.patternName);if(n&&tD(e)<n.max)return!0}return nD(e,t,n)&&e.index+1<e.binding.sequence.length}function iD(e,t){return e.index===e.binding.sequence.length-1&&nD(e,t,!1)}function aD(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 oD(e,t){let n=aD(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=aD(e,n.stroke,n.match,r),e.patternChildren.push(i))}else i=e.children.get(n.match),i||(i=aD(e,n.stroke,n.match),e.children.set(n.match,i));i.reachableBindings.push(r),e=i}e.bindings.push(r)}return n}function sD(e,t){let n=[];for(let r of e){if(!nD(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 cD(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 lD(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 uD(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 cD({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 dD(e,t,n,r,i,a){let o=e.binding.sequence[e.index];if(o?.patternName){let s=r.get(o.patternName);if(s&&tD(e)<s.max){let t=i(s.name,n);if(t){let r=a(n,s.name,t);return cD(e,e.index,r,t.value??n.name)}}return nD(e,r,!1)?uD(e.layer,e.binding,e.index+1,e.parts,e.patterns,t,n,i,a):void 0}return uD(e.layer,e.binding,e.index+1,e.parts,e.patterns,t,n,i,a)}function fD(e,t,n,r,i){let a=[],o=1/0;for(let s of e.bindings){if(s.event!==`press`)continue;let c=uD(e,s,0,[],void 0,t,n,r,i);if(!c)continue;let l=lD(c,t);l<o&&(o=l,a.length=0),l===o&&a.push(c)}return a}import.meta.require;function pD(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 mD(){let e=[];return{get:()=>e,set:t=>{e=t},remove(t){e=e.filter(e=>e!==t)},has:()=>e.length>0,clear:()=>{e=[]}}}function hD(){let e=mD();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 gD(){let e=mD(),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 _D(e){return typeof e==`string`||!!e&&typeof e==`object`&&!Array.isArray(e)}function vD(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(!_D(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 yD(e){let t=vD(e);if(!t.ok)throw Error(t.reason);return e.map(e=>({...e,key:typeof e.key==`string`?e.key:{...e.key}}))}function bD(e){return{...e,sequence:BE(e.sequence)}}function xD(e,t){let n=hD();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=SD(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 SD(e){return e.map(t=>({sequence:BE(t.sequence),command:t.command,attrs:t.attrs,event:t.event,preventDefault:t.preventDefault,fallthrough:t.fallthrough,parsedBinding:bD(t.parsedBinding),sourceTarget:t.sourceTarget,sourceLayerOrder:t.sourceLayerOrder,bindingIndex:t.bindingIndex,hasCommandAtSequence:e.some(e=>e.event===`press`&&e.command!==void 0&&CD(e,t)),hasContinuations:e.some(e=>e.event===`press`&&wD(t,e))}))}function CD(e,t){return e.sequence.length===t.sequence.length&&e.sequence.every((e,n)=>e.match===t.sequence[n]?.match)}function wD(e,t){return e.sequence.length<t.sequence.length&&e.sequence.every((e,n)=>e.match===t.sequence[n]?.match)}function TD(){return{version:-1,notifyVersion:-1,focused:void 0,value:[],targets:new WeakMap}}function ED(){return{plain:TD(),bindings:TD(),metadata:TD(),bindingsAndMetadata:TD()}}function DD(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 OD(e,t,n){let r=n?e.targets.get(n):e.nullTarget;return r?.version===t?r:void 0}function kD(e,t,n,r){let i={version:t,value:r};n?e.targets.set(n,i):e.nullTarget=i}function AD(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 jD(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 MD(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=WE(i.stroke)),c&&(o=void 0),n.push(RE(i.stroke,{display:a,match:i.match,tokenName:o}))}return n}function ND(e){if(e.isDestroyed)throw Error(`Cannot use a keymap after its host was destroyed`);return e}function PD(e,t,n,r,i,a,o={}){let s=ED(),c=-1,l=[],u=()=>ND(t).getFocusedTarget(),d=()=>YE(t),f=t=>{let n=e.pending;AD(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)&&rD(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?MD(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=jD(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=DD(s,t);return i.notifyVersion===e.derivedVersion?i.value:y(i,n,r)},y=(n,r,i)=>{t.isDestroyed&&ND(t);let o=u(),s=OD(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,kD(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=QE(e.sortedLayers,t,n),e.activeLayersCache),C=(e,n)=>eD(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?WE(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(sD(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?WE(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:LE(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?MD(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:MD,collectMatchingBindings:E,collectActiveBindings:A}}var FD=new Set([`name`,`run`,`fields`,`attrs`,`rejectedResult`]),ID=new Set([`key`,`cmd`,`event`,`preventDefault`,`fallthrough`]),LD=new Set([`target`,`targetMode`,`priority`,`bindings`,`commands`]);function RD(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 zD(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 BD(e,t,n){let r=e.get(t);r?r.push(n):e.set(t,[n])}function VD(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),BD(n,e.command.name,i)}return{entries:t,chainsByName:n}}function HD(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),BD(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 UD(e,t,n,r){return(e.activeLayersCacheVersion!==e.cacheVersion||e.activeLayersCacheFocused!==r)&&(e.activeLayersCacheVersion=e.cacheVersion,e.activeLayersCacheFocused=r,e.activeLayersCache=QE(e.sortedLayers,t,r)),HD(e.activeLayersCache,n,!0)}function WD(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 GD(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 KD(e){let t=`field ${e.fieldName}`;return{require(n,r){WD(e.requirements,n,r,t)},attr(n,r){if(!e.attrs)throw Error(`Keymap ${t} cannot publish attrs`);GD(e.attrs,n,r,t)},activeWhen(n){e.matchers.push(e.conditions.buildRuntimeMatcher(n,t))}}}function qD(e){let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}function JD(e,t){return e instanceof Error&&e.message?e.message:t}function YD(e){return!e||typeof e!=`object`&&typeof e!=`function`?!1:typeof e.then==`function`}function XD(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=>XD(e,t)):[...e];return r?Object.freeze(i):i}if(e&&typeof e==`object`){if(i&&!qD(e))return e;let a={};for(let[r,i]of Object.entries(e))a[r]=n?XD(i,t):i;return r?Object.freeze(a):a}return e}var ZD=[`name`],QD=Object.freeze({}),$D=new WeakMap;function eO(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=>nO({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=>tO(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:tO(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(!eD(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=UD(e,t,r,n);return P()&&(s=e.derivedVersion,c=n,l=i),i},N=()=>a===e.derivedVersion&&o?o:(a=e.derivedVersion,o=VD(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,YE(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:YE(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??[],sO({entries:r,query:e,getCommand:e=>tO(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=rO(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)??oO(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 tO(e){return e.command}function nO(e){let t=[],n=new Set;for(let r of e.commands)try{let i={},a=[],o=zD(r.name),s=iO(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,KD({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,JD(t,`Failed to register keymap command "${String(r.name)}"`));continue}return t}function rO(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:aO(t,o.getExecutionFields())}}return{hadError:i}}function iO(e){let t={};for(let[n,r]of Object.entries(e))!FD.has(n)&&r!==void 0&&(t[n]=r);return Object.keys(t).length===0?QD:t}function aO(e,t){return{command:e,input:t.input,payload:t.payload}}function oO(e){let t=iO(e);return t===QD?void 0:t}function sO(e){let t=e.query?.namespace,n=cO(e.query?.limit);if(n===0)return[];let r=e.query?.search?.trim().toLowerCase()??``,i=ZD;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(uO(u,t)&&lO(u,r,i)&&!(c&&!c.has(u.command.name))&&dO(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 cO(e){if(e===void 0)return;let t=Math.floor(Number(e));return!Number.isFinite(t)||t<=0?0:t}function lO(e,t,n){if(!t)return!0;for(let r of n)if(fO(e,r,t))return!0;return!1}function uO(e,t){if(t===void 0)return!0;let n=e.fields;return Object.prototype.hasOwnProperty.call(n,`namespace`)?yO(n.namespace,t):!1}function dO(e,t,n){if(!t)return!0;for(let[r,i]of t)if(!gO(e,r,i,n))return!1;return!0}function fO(e,t,n){return pO(e,t)?.includes(n)===!0}function pO(e,t){let n=$D.get(e);if(n||(n=new Map,$D.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=mO(a);return n.set(t,o),o}function mO(e){if(Array.isArray(e)){let t=[];for(let n of e){let e=mO(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 hO(e,t,n,r){try{return e(t,n)}catch(e){return r(e),!1}}function gO(e,t,n,r){return typeof n==`function`?_O(e,t,n,r):vO(e,t,n)}function _O(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,hO(n,i.name,l(),r.onFilterError))||Object.prototype.hasOwnProperty.call(a,t)&&(c=!0,hO(n,a[t],l(),r.onFilterError))||o&&Object.prototype.hasOwnProperty.call(o,t)&&(c=!0,hO(n,o[t],l(),r.onFilterError))?!0:!c&&hO(n,void 0,l(),r.onFilterError)}function vO(e,t,n){let r=e.command,i=e.fields,a=e.attrs;return t===`name`&&yO(r.name,n)||Object.prototype.hasOwnProperty.call(i,t)&&yO(i[t],n)?!0:!!a&&Object.prototype.hasOwnProperty.call(a,t)&&yO(a[t],n)}function yO(e,t){return Array.isArray(t)?t.some(t=>bO(e,t)):bO(e,t)}function bO(e,t){return Array.isArray(e)?e.some(e=>bO(e,t)):Object.is(e,t)}function xO(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(YD(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(SO(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=RD(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`&&(CO(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 CO(n,i),!0;return!1}}}function SO(e){return typeof e==`object`&&!!e&&`ok`in e}function CO(e,t){e.preventDefault&&(t.preventDefault(),t.stopPropagation())}var wO=Object.freeze({}),TO=[],EO=[];function DO(e){if(Object.keys(e).length!==0)return XD(e,{freeze:!0})}function OO(e,t,n,r){let i=t=>PO(t,e.bindingParsers.values(),{tokens:e.tokens,patterns:e.patterns,layer:wO,parseObjectKey:(e,t)=>c(e,t)}),a=t=>{if(typeof t!=`string`)return[c(t)];let n=NO(t,e.bindingParsers.values(),{tokens:e.tokens,patterns:e.patterns,layer:wO,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)=>GE(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=jO(b.key,m,{layer:d})}catch(e){t.emitError(`binding-expand-error`,e,JD(e,`Failed to expand keymap binding`));continue}for(let m of i){let i=m.key,x;try{x=typeof i==`string`?NO(i,h,{tokens:a,patterns:e.patterns,layer:d,parseObjectKey:(e,t)=>c(e,t)}):{parts:[c(i)],usedTokens:[],unknownTokens:[],hasTokenBindings:!1},x=MO(x,m)}catch(e){t.emitError(`binding-parse-error`,e,JD(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`||ID.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,KD({fieldName:e,conditions:n,requirements:c,matchers:d,attrs:u}))}let p=Object.keys(u).length>0?DO(u):void 0,m=RD(i.cmd),h={binding:b,sequence:a,command:m,event:t,parsedBinding:bD(i),sourceTarget:o,sourceLayerOrder:s,bindingIndex:r,requires:Object.keys(c).length>0?Object.entries(c):TO,matchers:d.length>0?d:EO,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`&&!_&&AO(f,h),f.push(h)}catch(e){t.emitError(`binding-compile-error`,e,JD(e,`Failed to compile keymap binding`))}}}return{bindings:f,hasTokenBindings:p}},c=(e,t)=>RE(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:BE(r)}];let l={...n,sequence:BE(r)},u=[],d=!0,f=o??wO;for(let n of s)try{n(l,{layer:f,parseKey:t=>PO(t,a,{tokens:i,patterns:e.patterns,layer:f,parseObjectKey:(e,t)=>c(e,t)}),add:e=>{u.push(bD(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 kO(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 AO(e,t){for(let n of e)if(n.event===`press`&&(n.command!==void 0&&kO(n.sequence,t.sequence)||t.command!==void 0&&kO(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 jO(e,t,n){if(typeof e!=`string`||t.length===0)return[{key:e}];let r=n?.layer??wO,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 MO(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 NO(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??wO,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:PE,createMatch:UE,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 PO(e,t,n){if(typeof e!=`string`)return n.parseObjectKey(e);let{parts:r}=NO(e,t,n),[i]=r;if(!i||r.length!==1)throw Error(`Invalid key "${String(e)}": expected a single key stroke`);return i}function FO(e){if(!e||typeof e!=`object`)return!1;let t=e;return typeof t.get==`function`&&typeof t.subscribe==`function`}function IO(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(FO(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 LO=Symbol(`keymap-disambiguation-decision`),RO=Symbol(`keymap-deferred-disambiguation-decision`);function zO(e,t){return{[LO]:!0,action:e,handler:t}}function BO(e){return{[RO]:!0,action:e}}function VO(e){return!!e&&typeof e==`object`&&e[LO]===!0}function HO(e){return!!e&&typeof e==`object`&&e[RO]===!0}function UO(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 WO(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 GO(e,t,n,r){let i=e.get(n)?.payloadKey??n;return{...RE({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 KO(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 qO(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:BE(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:BE(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?BE(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=dD(r,n,i,e.patterns,ve,ye);t&&c.push(t)}let l=c.reduce((e,t)=>Math.min(e,lD(t,n)),1/0),u=c.filter(e=>lD(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(!iD(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=>rD(t,e.patterns,!1)).length>0){let n=u.filter(t=>iD(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=>iD(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??=BE(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:LE(e.stroke)},c},get exact(){return o??=r.collectActiveBindings(i.exactBindings,i.focused,i.activeView).map(e=>({...e,sequence:BE(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:()=>zO(`run-exact`),continueSequence:()=>zO(`continue-sequence`),clear:()=>zO(`clear`),defer:e=>zO(`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(YD(e)){t.emitError(`invalid-disambiguation-resolver-return`,e,`[Keymap] Disambiguation resolvers must return synchronously; use ctx.defer(...) for async handling`);continue}if(!VO(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:BE(i),focused:r,sleep:t=>UO(t,e.controller.signal),runExact:()=>BO(`run-exact`),continueSequence:()=>BO(`continue-sequence`),clear:()=>BO(`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(YD(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&&!HO(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=GE(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))rD(t,e.patterns,!1)&&c.push(t)}return c}function me(t,n,r){return t.filter((t,i)=>i>=n&&rD(t,e.patterns,!1)&&YO(t.parts,r.parts))}function he(t,n){return t.filter(t=>t.layer===n.layer&&iD(t,e.patterns)&&YO(t.parts,n.parts))}function ge(n){let r=e.eventMatchResolvers.values();if(r.length===0)return[];if(r.length===1)return JO(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 WO(e.patterns,t,n,r)}function ye(t,n,r){return GO(e.patterns,t,n,r)}function be(e,t,n,r,i){let a=fD(e,t,n,ve,ye);return a.some(e=>Ce(e,r,i))?a:[]}function xe(n){return KO(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 JO(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 YO(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 XO=()=>{};function ZO(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 QO(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 $O(e,t,n,r,i){let a;try{a=PE(i.name)}catch(e){return t.emitError(`token-name-normalize-error`,e,JD(e,`Failed to register keymap token`)),XO}if(e.tokens.has(a)||e.patterns.has(a))return t.emitError(`duplicate-token`,{token:a},`Keymap token "${a}" is already registered`),XO;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,JD(e,`Failed to register keymap token "${a}"`)),XO}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,JD(e,`Failed to register keymap token "${a}"`)),XO}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,JD(e,`Failed to unregister keymap token "${a}"`))}}}function ek(e,t,n,r){let i,a;try{i=PE(r.name);let e=ZO(i,`min`,r.min,1),t=ZO(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:UE(`pattern:${i}`),min:e,max:t,matcher:e=>r.match(e),finalize:r.finalize}}catch(e){return t.emitError(`sequence-pattern-register-error`,e,JD(e,`Failed to register keymap sequence pattern`)),XO}return e.tokens.has(i)||e.patterns.has(i)?(t.emitError(`duplicate-sequence-pattern`,{pattern:i},`Keymap sequence pattern "${i}" is already registered`),XO):(e.patterns.set(i,a),n.recompileBindings(),()=>{e.patterns.get(i)===a&&(e.patterns.delete(i),n.recompileBindings())})}function tk(e,t,n,r){return QO(r,{kind:n,reservedFields:n===`layer`?LD:n===`binding`?ID:FD,registeredFields:n===`layer`?e.layerFields:n===`binding`?e.bindingFields:e.commandFields,emitError:(e,n,r)=>t.emitError(e,n,r)})}var nk=()=>{};function rk(e,t){return t.priority-e.priority||t.order-e.order}function ik(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 ak(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 ok(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`),nk;let o,s,c,p,m,v,y;try{y=l(n),o=u(yD(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,JD(e,`Failed to register keymap layer`)),nk}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 nk;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:oD(x.bindings,e.patterns),hasTokenBindings:x.hasTokenBindings,activeKeyCacheBlocked:!1,activeCommandViewCacheBlocked:!1};_(S),e.layers.add(S),e.sortedLayers=[...e.sortedLayers,S].sort(rk),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=>vD(e)});t&&(i=yD(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(LD.has(c)||l===void 0)continue;o[c]=XD(l);let t=e.layerFields.get(c);if(!t){i.warnUnknownField(`layer`,c);continue}t(l,KD({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?XD(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=oD(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,JD(e,`Failed to subscribe to reactive matcher from ${n.source}`))}},_=t=>{let n=ik(t),r=ak(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,JD(e,`Failed to dispose reactive matcher from ${n.source}`))}n.dispose=void 0}};return{registerLayer:a,applyTokenState:o,recompileBindings:s,cleanup:c}}var sk=1e3;function ck(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>=sk){e.stateChangePending=!1,i(`state-change-feedback-loop`,{iterations:sk},`[Keymap] Possible infinite state listener feedback loop detected after ${sk} 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 lk(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 uk=Object.freeze({});function dk(){return{order:0,tokens:new Map,patterns:new Map,layerFields:new Map,layerBindingsTransformers:hD(),bindingExpanders:hD(),bindingParsers:hD(),bindingTransformers:hD(),bindingFields:new Map,commandTransformers:hD(),commandFields:new Map,eventMatchResolvers:hD(),disambiguationResolvers:hD(),keyHooks:gD(),keyAfterHooks:gD(),rawHooks:gD(),layers:new Set,sortedLayers:[],activeLayersCacheVersion:-1,activeLayersCacheFocused:void 0,activeLayersCache:[],activeKeyCacheBlockers:0,activeCommandViewCacheBlockers:0,commandResolvers:hD(),pending:null,data:{},dataVersion:0,readonlyDataVersion:-1,readonlyData:uk,cacheVersion:0,derivedVersion:0,stateChangeDepth:0,stateChangePending:!1,flushingStateChange:!1,usedWarningKeys:new Set}}function fk(e){return VE(e)}var pk=class{#e=dk();#t=!1;#n=new Map;#r=[];#i=pD(()=>{});#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=pD((e,t)=>{this.#o.reportListenerError(e,t)}),this.#o=ck(this.#e,this.#i,this.#a),this.#l=IO(this.#e,this.#o),this.#u=eO(this.#e,this.#b,this.#o,this.#l,{onCommandResolversChanged:()=>{this.#s.ensureValidPendingSequence()}}),this.#s=PD(this.#e,this.#b,this.#a,this.#o,this.#l,this.#u,{onPendingSequenceChanged:(e,t)=>{this.#p?.handlePendingSequenceChange(e,t)}}),this.#c=lk(this.#e,this.#o,this.#s),this.#d=xO(this.#o,this.#c,this.#s,this.#u,{keymap:this,createCommandEvent:()=>this.#b.createCommandEvent()}),this.#f=OO(this.#e,this.#o,this.#l,{warnUnknownField:(e,t)=>{this.#C(e,t)},warnUnknownToken:(e,t)=>{this.#w(e,t)}}),this.#h=xD(this.#o,this.#u),this.#m=ok(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=qO(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()}))}[JE](){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?fk(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 tk(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 $O(this.#e,this.#o,this.#f,this.#m,e)}registerSequencePattern(e){return ek(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 tk(this.#e,this.#o,`binding`,e)}registerCommandFields(e){return tk(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)))}},mk=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(`.`)),hk=new Set([`ctrl`,`control`,`shift`,`meta`,`alt`,`option`,`super`,`hyper`]),gk=vk(mk),_k=vk(hk);function vk(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 yk(e){return e>=65&&e<=90?e+32:e}function bk(e){return e>=48&&e<=57}function xk(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(yk(e.charCodeAt(n+r))!==t.charCodeAt(r))return!1;return!0}function Sk(e,t,n){let r=t.charCodeAt(n);if(Number.isNaN(r))return;let i=e.get(yk(r));if(i){for(let e of i)if(xk(t,e,n))return e}}function Ck(e,t,n,r,i){return e.parseObjectKey(t,{display:n,match:r,tokenName:i})}function wk(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 Tk(e,t){let n=e.trim().toLowerCase();return t.parseObjectKey({name:n},{display:n})}function Ek(e,t){let n=Sk(gk,e,t);if(n)return n;if(yk(e.charCodeAt(t))!==102||!bk(e.charCodeAt(t+1)))return;let r=bk(e.charCodeAt(t+2))?t+3:t+2;return e.slice(t,r).toLowerCase()}function Dk(e,t){return Sk(_k,e,t)}function Ok(e,t,n){let r=t,i=!1,a=!1,o=!1,s=!1,c=!1;for(;r<e.length;){let t=Dk(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=Ek(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 kk=e=>{let{input:t,index:n,tokens:r,normalizeTokenName:i}=e;if(n===0&&t.includes(`+`)&&/\s/.test(t))return{parts:[wk(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:[wk(a,e)],nextIndex:n+1};let s=i(t.slice(n+1,o)),c=r.get(s);return c?{parts:[Ck(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:[wk(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=Ok(t,n,e);if(o)return{parts:[o.part],nextIndex:o.nextIndex};let s=Ek(t,n);return s?{parts:[Tk(s,e)],nextIndex:n+s.length}:{parts:[wk(a,e)],nextIndex:n+1}},Ak=(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 jk(e){return e.appendBindingParser(e=>kk(e))}function Mk(e){return e.appendEventMatchResolver((e,t)=>Ak(e,t))}function Nk(e){let t=jk(e),n=Mk(e);return()=>{n(),t()}}var Pk=Symbol(`keymap:mod-bindings`),Fk=/(^|[+,\s])mod(?=\s*\+)/i,Ik=/(^|[+,\s])mod(?=\s*\+)/gi;function Lk(e){let t=e.primaryModifier;return(t===`ctrl`||t===`super`)&&e.modifiers[t]!==`unsupported`?t:e.modifiers.ctrl===`unsupported`?`super`:`ctrl`}function Rk(e){if(e.includes(`,`))return[e];let t=e.trim();return t.includes(` `)?t.split(/\s+/):[e]}function zk(e){return e.acquireResource(Pk,()=>e.appendBindingExpander(({input:t,displays:n})=>{if(!Fk.test(t))return;let r=Lk(e.getHostMetadata());return[{key:t.replace(Ik,(e,t)=>`${t}${r}`),displays:n??Rk(t)}]}))}var Bk=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 Vk(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 Hk(){let e=globalThis.navigator,t=e?.userAgentData?.platform,n=Vk(t);return n===`unknown`?Vk(e?.platform??e?.userAgent):n}function Uk(){let e=Hk();return{platform:e,primaryModifier:e===`macos`?`super`:e===`unknown`?`unknown`:`ctrl`,modifiers:{ctrl:`supported`,shift:`supported`,meta:`supported`,super:`supported`,hyper:`unsupported`}}}function Wk(e){return e.length===1&&!/^[a-z0-9]$/i.test(e)}function Gk(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||!Wk(t.name)?[t]:[t,{...t,shift:!1}]}var Kk=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 qk(){return globalThis.MutationObserver}function Jk(e){return Bk.get(e)||(/^F\d{1,2}$/i.test(e)||e.length===1?e.toLowerCase():e.trim().toLowerCase().replace(/\s+/g,``))}function Yk(e){if(!e)return new Kk(`command`,!1,!1,!1,!1);let t=globalThis.KeyboardEvent;return new Kk(Jk(e.key),e.ctrlKey,e.shiftKey,e.altKey,e.metaKey,t&&e instanceof t?e:void 0)}var Xk=class{metadata=Uk();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(Yk(t))};return this.rootTarget.addEventListener(`keydown`,t,{capture:!0}),()=>{this.rootTarget.removeEventListener(`keydown`,t,{capture:!0})}}onKeyRelease(e){let t=t=>{e(Yk(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 Yk()}ensureObserver(){if(this.observer||this.targetDestroyListeners.size===0)return;let e=qk();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 Zk(e){return new Xk(e)}var Qk=(e,t)=>Gk(e).map(e=>t.resolveKey(e)),$k=[2,3],eA=`fungi.app.ready.v3`,tA=`fungi.app.ready`,nA=`fungi.app.connect`,rA=e=>tS.pipe(Y(NS(1)),Y(IS(e))),iA=e=>q(rA(e)),aA=nS.pipe(Y(jS()),Y(gS(Number.isSafeInteger,{message:`Expected a safe integer`}))),oA=aA.pipe(Y(OS(0))),sA=aA.pipe(Y(DS(0))),cA=J({appId:rA(160),releaseId:rA(160),surfaceId:rA(160)}),lA=J({editing:rS,surface:cS([rA(160),$x])}),uA=cS([J({kind:Zx(`compose`),requestId:rA(160),text:rA(2e3)}),J({kind:Zx(`navigate`),requestId:rA(160),params:oS(J({key:rA(64),value:rA(4096)})).pipe(Y(IS(16)))})]),dA=Xx(lS([`granted`,`missing`])),fA=J({"agent.list":dA,"agent.manage":dA,"agent.read":dA,"agent.send":dA,"computer.list":dA,"computer.readFile":dA,"computer.writeFile":dA,"computer.execute":dA,"git.repository":dA,"workflow.publish":dA,"workflow.arm":dA,"workflow.run":dA,"app.events.emit":dA,"llm.generation":dA,"media.generation":dA,"media.share":dA}),pA=lS([`ready`,`missing`,`unknown`]),mA=J({models:pA,media:pA,git:pA,terminal:lS([`ready`,`exec-only`,`missing`,`unknown`]),terminalReason:q(tS)}),hA=lS([`model`,`media`,`git`,`computer`]),gA=lS([`opened`,`unavailable`]),_A=J({computerId:cS([rA(256),$x]),computerName:q(uS(tS)),teamHasComputers:q(uS(rS)),computerAccessGranted:q(rS),setup:q(mA),permissions:q(fA),focus:lA,openRequest:cS([$x,uA]),visibility:lS([`visible`,`hidden`])}),vA=lS([`connecting`,`connected`,`suspended`,`disconnected`,`disposing`,`disposed`]),yA=J({altKey:rS,ctrlKey:rS,id:rA(160),key:rA(64),metaKey:rS,shiftKey:rS}),bA=J({action:q(Qx),availability:q(Qx),category:rA(160),description:iA(512),id:rA(160),projections:q(Qx),title:rA(160)}),xA=J({arguments:q(Qx),commandId:rA(321),origin:lS([`agent`,`browser`,`keyboard`,`menu`,`palette`,`programmatic`,`slash`,`terminal`]),requestId:rA(160)}),SA=cS([J({result:q(Qx),status:Zx(`handled`)}),J({error:Qx,status:Zx(`failed`)})]),CA=e=>rA(e).pipe(Y(gS(e=>{for(let t=0;t<e.length;t+=1)if(AE(e.charCodeAt(t)))return!1;return!0},{message:`Expected one line of plain text`}))),wA={id:rA(64),text:CA(80),end:Xx(rS),priority:Xx(Zx(`low`))},TA=Xx(nS.pipe(Y(jS()),Y(AS({minimum:0,maximum:9999})))),EA=oS(cS([J({...wA,kind:Zx(`text`),tone:Xx(lS([`neutral`,`success`,`warning`,`error`]))}),J({...wA,kind:Zx(`button`),icon:Xx(lS([`folder`,`ports`,`processes`,`access`])),count:TA,tone:Xx(lS([`neutral`,`success`,`warning`,`error`])),busy:Xx(rS),title:Xx(CA(1024)),disabled:Xx(rS),opens:Xx(Zx(`dialog`)),expanded:Xx(rS)}),J({...wA,kind:Zx(`toggle`),pressed:rS}),J({...wA,kind:Zx(`menu`),count:TA,title:Xx(CA(1024)),options:oS(J({id:rA(64),text:CA(80),checked:Xx(rS),disabled:Xx(rS)})).pipe(Y(IS(16)),Y(gS(e=>new Set(e.map(e=>e.id)).size===e.length,{message:`Expected unique status option ids`})))})])).pipe(Y(IS(6)),Y(gS(e=>new Set(e.map(e=>e.id)).size===e.length,{message:`Expected unique status item ids`}))),DA=J({computerId:rA(256),path:rA(1024)}),OA=rA(80).pipe(Y(gS(e=>e.trim()===e,{message:`Expected a trimmed title`}))),kA=rA(64),AA=rA(80),jA=e=>new Set(e.map(e=>e.id)).size===e.length,MA=J({id:kA,label:AA,siblings:q(oS(J({id:kA,label:AA})).pipe(Y(IS(16)),Y(gS(jA,{message:`Expected unique crumb sibling ids`}))))}),NA=J({id:kA,label:AA,icon:q(Zx(`play`)),variant:q(lS([`primary`,`outline`,`ghost`])),tone:q(Zx(`destructive`)),disabled:q(rS)}),PA=e=>oS(NA).pipe(Y(IS(e)),Y(gS(jA,{message:`Expected unique header command ids`}))),FA={status:q(oS(J({id:kA,label:AA,presentation:q(Zx(`bead`)),tone:q(lS([`neutral`,`info`,`warning`,`success`,`error`]))})).pipe(Y(IS(4)),Y(gS(jA,{message:`Expected unique header status ids`})))),crumbs:q(oS(MA).pipe(Y(IS(8)),Y(gS(jA,{message:`Expected unique crumb ids`})))),primary:q(PA(3)),menu:q(PA(12))},IA=J({contractVersion:Zx(2),canGoBack:rS,canGoForward:rS,title:q(OA),...FA}),LA=J({canGoBack:rS,canGoForward:rS,title:q(tS),...FA}),RA=cS([J({kind:Zx(`crumb`),crumbId:kA,siblingId:q(kA)}),J({kind:Zx(`action`),actionId:kA})]),zA=uS(J({agentId:rA(256),sessionId:rA(256)})),BA=e=>q(oS(lS(e)).pipe(Y(IS(e.length)))),VA=J({agents:q(oS(lS([`agent.list`,`agent.manage`,`agent.read`,`agent.send`])).pipe(Y(IS(4)))),computers:q(oS(lS([`computer.list`,`computer.readFile`,`computer.writeFile`,`computer.execute`])).pipe(Y(IS(4)))),git:BA([`git.repository`]),workflows:BA([`workflow.publish`,`workflow.arm`,`workflow.run`]),events:BA([`app.events.emit`]),generation:BA([`llm.generation`,`media.generation`,`media.share`])}),HA=lS([`granted`,`declined`,`customize`]),UA=J({message:rA(512),tone:q(lS([`info`,`success`,`warning`,`error`]))}),WA=lS(tC);J({code:WA.pick([`DELIVERY_PENDING`])});var GA=J({code:WA,message:rA(512),retryable:rS,need:Xx(KS)}),KA=cS([J({protocolVersion:Zx(3),type:Zx(eA)}),J({protocolVersion:Zx(2),type:Zx(tA)})]),qA=J({epoch:rA(160),protocolVersion:lS($k),type:Zx(nA)}),JA=J({epoch:rA(160),protocolVersion:lS($k)}),YA={[Symbol.dispose]:q(Qx)},XA=cS([J({...YA,ok:Zx(!0),value:Qx}),J({...YA,error:GA,ok:Zx(!1)})]);function ZA(e,t,n=`PROTOCOL`){return kc(qx(e,{onExcessProperty:`error`}),zd({onFailure:e=>{throw new X(`The peer sent malformed protocol data`,{cause:e,code:n,retryable:!1})},onSuccess:t}))}function QA(e){return Object.freeze(e)}function $A(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}),QA(r)}var ej=ZA(bA,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}),QA(Gj(()=>fs(t)))},`INVALID_ARGUMENT`),tj=ZA(rA(321),e=>e),nj=ZA(xA,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}),QA(n)}),rj=ZA(cS([eS,Qx]),e=>e===void 0?void 0:$o(e)),ij=ZA(qA,e=>QA(e));ZA(JA,e=>QA(e));var aj=ZA(_A,e=>{let t={computerId:e.computerId,focus:QA({...e.focus}),openRequest:e.openRequest===null?null:QA({...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=QA({...e.setup})),e.permissions!==void 0&&(t.permissions=QA({...e.permissions})),QA(t)}),oj=ZA(GA,e=>QA({...e})),sj=ZA(lA,e=>QA({...e}),`INVALID_ARGUMENT`),cj=ZA(cA,e=>QA({...e})),lj=ZA(vA,e=>e),uj=ZA(EA,e=>QA(e.map(e=>e.kind===`menu`?QA({...e,options:QA(e.options.map(e=>QA(e)))}):QA(e))),`INVALID_ARGUMENT`),dj=ZA(J({itemId:rA(64),optionId:Xx(rA(64)),anchor:Xx(J({start:nS.pipe(Y(AS({minimum:0,maximum:1e5}))),width:nS.pipe(Y(AS({minimum:0,maximum:1e5})))}))}),e=>QA(e.anchor===void 0?{...e}:{...e,anchor:QA({...e.anchor})}),`INVALID_ARGUMENT`),fj=ZA(DA,e=>QA({...e}),`INVALID_ARGUMENT`);function pj(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}),QA(t)}function mj(e){let t={id:e.id,label:e.label};return e.siblings===void 0?QA(t):QA({...t,siblings:QA(e.siblings.map(e=>QA({...e})))})}function hj(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}),QA(t)}function gj(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:QA(e.crumbs.map(mj))}),e.primary!==void 0&&(t={...t,primary:QA(e.primary.map(hj))}),e.menu!==void 0&&(t={...t,menu:QA(e.menu.map(hj))}),e.status!==void 0&&(t={...t,status:QA(e.status.map(pj))}),QA(t)}var _j=ZA(IA,gj,`INVALID_ARGUMENT`),vj=ZA(LA,e=>{let t=e.title?.trim();return yj({...gj({...e,title:t===void 0||t.length===0?void 0:t}),contractVersion:2})},`INVALID_ARGUMENT`),yj=ZA(IA,e=>QA({...gj(e),contractVersion:2}),`INVALID_ARGUMENT`),bj=ZA(RA,e=>e.kind===`action`?QA({...e}):QA(e.siblingId===void 0?{kind:e.kind,crumbId:e.crumbId}:e),`INVALID_ARGUMENT`),xj=ZA(zA,e=>e===null?null:QA({...e}),`INVALID_ARGUMENT`),Sj=ZA(VA,e=>QA({agents:QA([...new Set(e.agents??[])]),computers:QA([...new Set(e.computers??[])]),...e.git&&{git:QA([...new Set(e.git)])},...e.workflows&&{workflows:QA([...new Set(e.workflows)])},...e.events&&{events:QA([...new Set(e.events)])},...e.generation&&{generation:QA([...new Set(e.generation)])}}),`INVALID_ARGUMENT`),Cj=ZA(hA,e=>e,`INVALID_ARGUMENT`);ZA(KA,e=>QA(e));var wj=ZA(rA(512),e=>e),Tj=ZA(UA,e=>QA({...e}),`INVALID_ARGUMENT`);ZA(J({id:rA(160),repeat:rS}),e=>QA(e));var Ej=ZA(oS(yA).pipe(Y(IS(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 QA(e.map(e=>QA({...e})))});function Dj(e){return ZA(J({value:Qx,version:oA}),t=>QA({value:e(t.value),version:t.version}))}var Oj=Dj(aj),kj=ZA(J({capabilities:oS(Qx).pipe(Y(IS(128))),context:Qx}),e=>QA({capabilities:QA(e.capabilities.map(e=>Fj(e))),context:Oj(e.context)})),Aj=Dj(lj),jj=Dj(Ej),Mj=Dj(wj),Nj=kc(Aj,e=>{if(e.value!==`connected`&&e.value!==`suspended`)throw new X(`The host lifecycle is invalid`,{code:`PROTOCOL`,retryable:!1});return QA({value:e.value,version:e.version})});function Pj(e){return ZA(J({handle:Qx,id:rA(160),version:sA}),t=>{if(!(t.handle instanceof DE)&&!(e&&t.handle instanceof OE))throw new X(`A capability handle is invalid`,{code:`PROTOCOL`,retryable:!1});return QA({handle:t.handle,id:t.id,version:t.version})})}var Fj=Pj(!1),Ij=Pj(!0);function Lj(e){let t=e?Ij:Fj;return ZA(J({capabilities:oS(Qx).pipe(Y(IS(128))),context:Qx,identity:Qx,lifecycle:Qx,reservedChords:Qx,theme:Qx}),e=>QA({capabilities:QA(e.capabilities.map(e=>t(e))),context:Oj(e.context),identity:cj(e.identity),lifecycle:Nj(e.lifecycle),reservedChords:jj(e.reservedChords),theme:Mj(e.theme)}))}var Rj=Lj(!1);Lj(!0);function zj(e){return ZA(XA,t=>t.ok?QA({ok:!0,value:e(t.value)}):QA({ok:!1,error:oj(t.error)}))}var Bj=zj(Rj),Vj=zj(ZA(J({commandId:rA(321)}),e=>QA(e)));zj(ZA(SA,e=>{if(e.status===`failed`)return QA({status:`failed`,error:Gj(()=>ts(e.error))});let t=e.result===void 0?void 0:$o(e.result);return QA(t===void 0?{status:`handled`}:{status:`handled`,result:t})}));var Hj=zj(ZA(eS,()=>void 0)),Uj=zj(ZA(HA,e=>e)),Wj=zj(ZA(gA,e=>e));zj(ZA(rS,e=>e)),zj(ZA(rS,e=>e));function Gj(e){try{return e()}catch(e){throw new X(`The command metadata is invalid`,{cause:e,code:`INVALID_ARGUMENT`,retryable:!1})}}var Kj=cS([J({kind:Zx(`saveFile`),name:rA(255).pipe(Y(yS(/^[^\p{Cc}/\\]+$/u))),mime:rA(255),bytes:WS}),J({kind:Zx(`copyText`),text:tS})]);function qj(e){let t=qx(Kj,{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 Jj=zj(ZA(cS([J({kind:Zx(`saved`)}),J({kind:Zx(`copied`)}),J({kind:Zx(`refused`),reason:lS([`no-user-gesture`,`too-large`,`invalid-request`,`unavailable`,`denied`,`busy`])})]),e=>QA(e)));function Yj(e){return e instanceof X?{code:e.code,message:Zj(e.message),retryable:e.retryable,...e.need!==void 0&&{need:e.need}}:{code:`HOST_FAILURE`,message:`Host operation failed`,retryable:!1}}function Xj(e){try{let t=oj(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 Zj(e){return e.trim().slice(0,512)||`Host operation failed`}var Qj=e=>({ok:!0,value:e}),$j=e=>({error:Yj(e),ok:!1});async function eM(e,t){let n,r=new Set;try{return n=await e,tM(t(n))}catch(e){throw nM(e)&&rM(e,r),e instanceof X?e:new X(`The remote operation failed`,{cause:e,code:`HOST_FAILURE`,retryable:!0})}finally{n!==e&&nM(n)&&rM(n,r)}}function tM(e){if(e.ok)return e.value;throw Xj(e.error)}function nM(e){return Kc(e)&&Symbol.dispose in e&&Hc(e[Symbol.dispose])}function rM(e,t){if(!t.has(e)){t.add(e);try{e[Symbol.dispose]()}catch(e){console.warn(`RPC result disposal failed`,e)}}}function iM(){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 aM(e){let t=Ej(e),n=new Set;return{get:()=>t,subscribe:e=>(n.add(e),()=>n.delete(e)),update:e=>{t=Ej(e);for(let e of Array.from(n))try{e()}catch(e){console.warn(`Reserved chord subscriber failed`,e)}}}}function oM(e){let t=!0,n,r=e.window.document.querySelector(`html`);if(!r)return()=>{t=!1};let i=Zk(r),a=new pk(i);Nk(a),zk(a),a.prependEventMatchResolver(Qk);let o=cM(e.onBroken),s=fM(a,e.chords,e.remote,o),c=sM(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=()=>lM(e.window.document,e.identity.surfaceId).editing,g=m===void 0?()=>void 0:uM(a,m,h),_=m===void 0?()=>void 0:m.subscribe(()=>{g(),g=uM(a,m,h)}),v=e.chords.subscribe(()=>{s(),s=fM(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 sM(e,t,n,r,i){return a=>{if(!n())return;let o=lM(e.window.document,e.identity.surfaceId),s=a===void 0?o:sj({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 cM(e){return t=>{try{eM(t(),Hj).catch(t=>{rT(`browser-bridge.host-call`,t),e(t)})}catch(t){rT(`browser-bridge.host-call`,t),e(t)}}}function lM(e,t){let n=e.activeElement;return sj({editing:!!(n?.matches(`input, textarea, select, [contenteditable='true']`)===!0||n?.closest(`[contenteditable='true']`)),surface:e.hasFocus()?t:null})}function uM(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||dM(e.key)&&n())return!1;e.run()}})),priority:500})}function dM(e){return!/(?:^|\+)(?:ctrl|control|super|meta|cmd|alt|option|mod)\+/iu.test(e)}function fM(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:Jk(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 pM(e){let t=t=>{if(t.defaultPrevented||t.isComposing)return;let n=gM(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=hM(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 mM)e.window.addEventListener(t,n);return()=>{e.window.removeEventListener(`keydown`,t);for(let t of mM)e.window.removeEventListener(t,n)}}var mM=[`mousedown`,`mouseup`,`auxclick`];function hM(e){return e===3?`back`:e===4?`forward`:null}function gM(e,t){return e.shiftKey||e.ctrlKey?null:t?!e.metaKey||e.altKey?null:e.key===`[`?`back`:e.key===`]`?`forward`:_M(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 _M(e){return e instanceof HTMLElement?e.isContentEditable||e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement||e instanceof HTMLSelectElement:!1}function vM(){return!Uc(globalThis.navigator)&&/Mac|iPhone|iPad/u.test(globalThis.navigator.userAgent)}function yM(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 bM(e){let t=new Map,n=yM(0),r=!1,i=e=>{let t=new Map;try{for(let n of e){let e=Fj(n),r=TM(e.id,e.version);if(t.has(r))throw SM(e.handle),new X(`Duplicate capability grant`,{code:`PROTOCOL`,retryable:!1});t.set(r,e.handle)}}catch(e){for(let e of t.values())SM(e);throw e}return t};for(let[n,r]of i(e))t.set(n,r);let a=e=>{for(let t of e)SM(t)},o=e=>{if(r)throw new X(`The app connection is disposed`,{code:`DISCONNECTED`,retryable:!0});let n=TM(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 xM=Ka().transform(e=>{let t=qo(Object).safeParse(e);if(!t.success)return;let n=Object.create(t.data),r=Jx(J({[Symbol.dispose]:q(mS(Function))}))(n);return{owner:t.data,dispose:r[Symbol.dispose]}});function SM(e){try{let t=xM.parse(e);if(t===void 0||wM.has(t.owner))return;wM.add(t.owner),t.dispose?.call(t.owner)}catch(e){console.warn(`RPC value disposal failed`,e)}}function CM(e){return{value:e,[Symbol.dispose](){SM(e)}}}var wM=new WeakSet;function TM(e,t){return`${e}@${String(t)}`}var EM=`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(`.`),DM=`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 OM(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 kM(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=[OM(EM)];for(let e=1;e<t;e++)r.push(OM(DM));return r.join(n)}var AM=[];for(let e=0;e<256;++e)AM.push((e+256).toString(16).slice(1));function jM(e,t=0){return(AM[e[t+0]]+AM[e[t+1]]+AM[e[t+2]]+AM[e[t+3]]+`-`+AM[e[t+4]]+AM[e[t+5]]+`-`+AM[e[t+6]]+AM[e[t+7]]+`-`+AM[e[t+8]]+AM[e[t+9]]+`-`+AM[e[t+10]]+AM[e[t+11]]+AM[e[t+12]]+AM[e[t+13]]+AM[e[t+14]]+AM[e[t+15]]).toLowerCase()}var MM,NM=new Uint8Array(16);function PM(){if(!MM){if(typeof crypto>`u`||!crypto.getRandomValues)throw Error(`crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported`);MM=crypto.getRandomValues.bind(crypto)}return MM(NM)}var FM={randomUUID:typeof crypto<`u`&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function IM(e,t,n){if(FM.randomUUID&&!t&&!e)return FM.randomUUID();e||={};let r=e.random??e.rng?.()??PM();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 jM(r)}U().regex(/^replay_[a-f0-9]{64}$/);var LM=ya({version:`v4`}),RM=Wo(e=>LM.safeParse(e).success);function zM(){return RM.parse(IM())}var BM=class extends OE{#e=!0;#t;#n=new Map;constructor(e){super(),this.#t=e}cancel(e){try{return this.#n.get(tj(e))?.abort(),Promise.resolve(Qj(void 0))}catch(e){return Promise.resolve($j(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=nj(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=rj(await this.#t($A(t,n.signal)));return Qj(e===void 0?{status:`handled`}:{status:`handled`,result:e})}finally{this.#n.delete(t.requestId)}}catch(e){if(e instanceof xs)try{return Qj({status:`failed`,error:ts({code:e.code,message:e.message,details:e.details})})}catch(e){return $j(e)}return $j(e)}}[Symbol.dispose](){this.dispose()}};function VM(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=tM(await i.invoke({commandId:e,origin:`keyboard`,requestId:zM()}));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 HM(e,t,n,r){let i=new Map,a=!1,o=()=>{r?.update(a?[]:VM(i))},s=e=>{try{n()}catch(t){console.warn(`App command failure callback failed`,t,e)}},c=e=>{try{eM(e(),Hj).catch(e=>{s(e)})}catch(e){console.warn(`App command RPC supervision failed`,e),s(e)}};return{commands:WM(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 UM(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 WM(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=ej(o),l=new BM(s),u=UM(n,c,l);try{let t=await GM(e,c,u.target);r()&&await KM(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 GM(e,t,n){return eM(e.registerCommand(t,n),Vj)}async function KM(e,t,n){throw n.dispose(),await eM(e.unregisterCommand(t),Hj),new X(`The command controller is disposed`,{code:`DISCONNECTED`,retryable:!0})}var qM=Ix(e=>e instanceof DE),JM=class extends OE{#e=!1;#t;constructor(e){super(),this.#t=e}disconnect(e){try{if(this.#e)throw aN();let t=e===void 0?void 0:oj(e);return setTimeout(()=>this.#t.disconnect?.(t??lN()),0),Promise.resolve(Qj(void 0))}catch(e){return Promise.resolve($j(e))}}async requestClose(){try{if(this.#e)throw aN();return Qj(await(this.#t.beforeClose?.()??!0))}catch(e){return $j(e)}}async requestBack(){try{if(this.#e)throw aN();return Qj(await(this.#t.back?.()??!1))}catch(e){return $j(e)}}async requestForward(){try{if(this.#e)throw aN();return Qj(await(this.#t.forward?.()??!1))}catch(e){return $j(e)}}async activateNavigation(e){try{if(this.#e)throw aN();let t=bj(e);return NE(this.#t.navigation,t)?Qj(await(this.#t.activate?.(t)??!1)):Qj(!1)}catch(e){return $j(e)}}async activateStatus(e){try{if(this.#e)throw aN();let t=dj(e);return ME(this.#t.statusItems,t)?Qj(await(this.#t.statusAction?.(t)??!1)):Qj(!1)}catch(e){return $j(e)}}[Symbol.dispose](){this.#e=!0}async updateContext(e){return this.#e?$j(aN()):this.#n(e,`context`,aj,e=>{this.#t.context.update(e)})}reconfigure(e){let t=[];try{if(this.#e)throw aN();let n=kj(e);if(n.context.version<=this.#t.versions.context)return Promise.resolve(Qj(void 0));for(let e of n.capabilities)t.push({...e,handle:Jx(qM)(e.handle).dup()});if(!this.#t.capabilities)throw aN();return this.#t.capabilities.replace(t),t=[],this.#t.versions.context=n.context.version,this.#t.context.update(n.context.value),Promise.resolve(Qj(void 0))}catch(e){for(let e of t)SM(e.handle);return Promise.resolve($j(e))}}updateLifecycle(e){try{if(this.#e)throw aN();let t=Dj(lj)(e);if(t.version<=this.#t.versions.lifecycle)return Promise.resolve(Qj(void 0));if(!uN(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(Qj(void 0))}catch(e){return Promise.resolve($j(e))}}async updateReservedChords(e){return this.#e?$j(aN()):this.#n(e,`chords`,Ej,e=>{this.#t.chords.update(e)})}async updateTheme(e){return this.#e?$j(aN()):this.#n(e,`theme`,wj,e=>{this.#t.theme.update(e)})}#n(e,t,n,r){try{let i=Dj(n)(e);return i.version>this.#t.versions[t]&&(this.#t.versions[t]=i.version,r(i.value)),Promise.resolve(Qj(void 0))}catch(e){return Promise.resolve($j(e))}}};async function YM(e){let t=$M(),n=new JM(t),r=kE(e.port,n),i,a=QM(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=tM(Bj(o));if(!e.isActive())throw ZM();let c=eN({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 fN(t,e,n,r,i)}}function XM(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 ZM(){return new X(`App connection was cancelled`,{code:`CANCELLED`,retryable:!1})}function QM(e){let t,n=new Promise((e,n)=>{t=n});return n.catch(e=>{rT(`app-session.rpc-disconnect`,e)}),e.onRpcBroken(()=>t?.(new X(`The app host disconnected`,{code:`DISCONNECTED`,retryable:!0}))),n}function $M(){return{statusItems:[],navigation:{canGoBack:!1,canGoForward:!1},bindings:iM(),chords:aM([]),context:yM({computerId:null,focus:{editing:!1,surface:null},openRequest:null,visibility:`hidden`}),lifecycle:yM(`connecting`),theme:yM(`default`),canGoBack:!1,canGoForward:!1,versions:{chords:-1,context:-1,lifecycle:-1,theme:-1}}}function eN(e){let t=cj(e.bootstrap.identity),n=dN(e.bootstrap);XM(e.state,n);let r=bM(e.bootstrap.capabilities);return e.state.capabilities=r,nN(e,t,r)}function tN(e,t,n){return oM({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 nN(e,t,n){let r=!1,i=t=>{r||(r=!0,sN([()=>{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]()},()=>{SM(e.bootstrapOwner)},()=>{SM(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=HM(e.remote,a,()=>{i({code:`DISCONNECTED`,message:`The app host rejected a terminal command operation`,retryable:!0})},e.state.bindings),s=iN(e.remote,a,e.state),c=rN(e.state,e.remote,a),l=tN(e,t,i),u=pM({window:e.options.window,mac:vM(),canGoBack:()=>e.state.canGoBack&&e.state.back!==void 0,back:()=>{let t=e.state.back;t&&Promise.resolve().then(t).catch(e=>{rT(`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=>{rT(`app-window.forward-input`,e)})}});return e.state.disconnect=i,e.remote.onRpcBroken(()=>{oN(i)}),cN({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 rN(e,t,n){let r=Object.freeze({async publish(r){n();let i=vj(r);e.canGoBack=i.canGoBack,e.canGoForward=i.canGoForward,e.navigation=_j(i),await eM(t.reportNavigation(i),Hj)},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 iN(e,t,n){return Object.freeze({async requestComputerChoice(){t(),await eM(e.requestComputerChoice(),Hj)},async requestBrowserAction(n){t();let r=qj(n);return r.kind===`refused`?r:await eM(e.requestBrowserAction(r),Jj)},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 eM(e.requestAppPermissions(Sj(n)),Uj)},async openDesktopSettings(){t(),await eM(e.openDesktopSettings(),Hj)},async openSetup(n){return t(),await eM(e.openSetup(Cj(n)),Wj)},async openTeamBilling(){t(),await eM(e.openTeamBilling(),Hj)},async openNavigation(n){t(),await eM(e.openNavigation(fj(n)),Hj)},async reportStatus(r){t();let i=uj(r);n.statusItems=i,await eM(e.reportStatus(i),Hj)},async reportAgentSessionSelection(n){t(),await eM(e.reportAgentSessionSelection(xj(n)),Hj)},async showToast(n){t(),await eM(e.showToast(Tj(n)),Hj)}})}function aN(){return new X(`The app connection is disposed`,{code:`DISCONNECTED`,retryable:!0})}function oN(e){e({code:`DISCONNECTED`,message:`The app host disconnected`,retryable:!0})}function sN(e,t){for(let n of e)try{n()}catch(e){console.warn(`${t} cleanup failed`,e)}}function cN(e){return Object.freeze(e)}function lN(){return{code:`DISCONNECTED`,message:`The app host disconnected`,retryable:!1}}function uN(e,t){return e===t||e===`connected`&&t===`suspended`||e===`suspended`&&t===`connected`}function dN(e){let t=Dj(aj)(e.context),n=Dj(wj)(e.theme),r=Dj(lj)(e.lifecycle),i=Dj(Ej)(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 fN(e,t,n,r,i){throw sN([()=>{n[Symbol.dispose]()},()=>{i&&SM(i)},()=>{SM(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 pN=!1,mN=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):(pN=!0,this.#a())}#a(){return new Promise((e,t)=>{let n=(n,a)=>{this.#o(n,a,i,r,e,t)},r=()=>{n(gN())},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:eA},`*`),this.#e.parent.postMessage({protocolVersion:2,type:tA},`*`)}catch(e){rT(`connect.notify-host`,e),n(SN(e))}};this.#r=setInterval(a,200),this.#i=setTimeout(()=>{n(vN())},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(),pN=!1,a(e??vN());return}i(t)}}#s(e,t,n){if(!xN(e.data))return;if(performance.mark(`fungi.app-open.agar-connect-received`),e.source!==this.#e.parent||yN(e.origin)===void 0){t(bN());return}let r=CN(e,t);if(!r)return;let i=e.ports.length===1?e.ports[0]:void 0;if(!i){t(wN(`The app host did not transfer exactly one port`));return}this.#t=i,this.#c(),this.#e.removeEventListener(`message`,n),YM({epoch:r.epoch,protocolVersion:r.protocolVersion,isActive:()=>!this.#n,onDisposed:()=>{pN=!1},port:i,window:this.#e}).then(e=>{performance.mark(`fungi.app-open.agar-root-ready`),t(void 0,e)},e=>{t(_N(e))})}#c(){clearInterval(this.#r),clearTimeout(this.#i),this.#r=void 0,this.#i=void 0}#l(){if(this.options.signal?.aborted)return gN();if(pN)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 hN(e){return new mN(e).start()}function gN(){return new X(`App connection was cancelled`,{code:`CANCELLED`,retryable:!1})}function _N(e){return e instanceof X?e:new X(`Unable to connect to the app host`,{cause:e,code:`PROTOCOL`,retryable:!1})}function vN(){return new X(`The app host disconnected`,{code:`DISCONNECTED`,retryable:!0})}function yN(e){if(!URL.canParse(e))return;let t=new URL(e).origin;return t===e?t:void 0}function bN(){return new X(`The app connection identity is invalid`,{code:`IDENTITY`,retryable:!1})}var xN=Wx(J({type:Zx(nA)}));function SN(e){return new X(`Unable to notify the app host`,{cause:e,code:`DISCONNECTED`,retryable:!0})}function CN(e,t){try{return ij(e.data)}catch(e){rT(`connect.decode-message`,e),t(e instanceof X?e:new X(`Malformed app connection`,{cause:e,code:`PROTOCOL`,retryable:!1}));return}}function wN(e){return new X(e,{code:`PROTOCOL`,retryable:!1})}function TN(e,t,n){e.style.isolation=`isolate`;let r=(0,nT.createRoot)(e),i=new AbortController,a=e.ownerDocument.documentElement,o=hC(a),s,c,l,u=!1,d=e=>{let i=(0,G.createElement)(EN,{state:e,render:n});r.render(t.queryClient?(0,G.createElement)(bC,{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`):mC(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`}),hN({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,mC(e.theme.get(),a),c=e.theme.subscribe(e=>{mC(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 EN({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 DN(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 ON(e){return DN(e?.context)??null}function kN(e){return ON(e)?.computerId??null}function AN(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 jN(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 MN(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(),NN(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}),NN(e,i)},[e,t,n,r,g])}function NN(e,t){e.publish(t).catch(e=>{e instanceof X&&e.code===`DISCONNECTED`||console.warn(`App navigation report failed`,e)})}var PN=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 FN(e,t,n){return new PN(e,t,n)}function IN(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](){SM(e)}}})}function LN(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{SM(t)}})}function RN(e){return Ho({output:Bo(Ka().transform(t=>{try{return e.parse(t)}catch(e){throw SM(t),e instanceof X?e:new X(`The capability returned a malformed result`,{cause:e,code:`PROTOCOL`,retryable:!1})}}))})}var zN=RN(LN(Xa()));IN({fetch:RN(qo(Response)),close:zN});var BN=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)}),VN=p(`ZodMiniObject`,(e,t)=>{vn.init(e,t),BN.init(e,t),T(e,`shape`,()=>t.shape)});function HN(e,t){return new VN({type:`object`,shape:e??{},...R(t)})}var UN=p(`ZodMiniLiteral`,(e,t)=>{Mn.init(e,t),BN.init(e,t)});function WN(e,t){return new UN({type:`literal`,values:Array.isArray(e)?e:[e],...R(t)})}var GN=to({status:Ra()}),KN=3,qN=/network ?(?:changed|error)|failed to fetch|load failed|network connection was lost/iu;function JN(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 YN(e){return JN(e).some(e=>{if(e instanceof TypeError)return!0;if(e instanceof X)return e.code===`HOST_FAILURE`&&e.retryable;let t=GN.safeParse(e);return t.success?t.data.status>=500:e instanceof Error&&qN.test(e.message)})}function XN(e,t){return e<KN&&YN(t)}function ZN(e){return 250*2**e}function QN(e){return e instanceof X?e:new X(`App operation failed`,{cause:e,code:`HOST_FAILURE`,retryable:!1})}var $N=new WeakMap,eP={of(e,...t){return[e?.identity.surfaceId??null,e?.context.get().computerId??null,...t]}};function tP(e){let t={};return e&&$N.set(t,e),t}function nP(){let e=new Mw({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&&$N.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 rP(e,t,n,r){let i=e?.context.get().computerId;return Gw({queryKey:n,meta:tP(e),enabled:e!==null,retry:XN,retryDelay:ZN,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 QN(e)}}})}function iP(e){return Xw({mutationKey:e.queryKey,scope:{id:NC(e.queryKey)},mutationFn:async(t,n)=>{try{return await e.mutationFn(t,n)}catch(e){throw QN(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})})}FN(`app.backend`,1,Ro(()=>IN({request:RN(LN(Ka().transform(e=>$o(e))))})));var aP=FN(`app.methods`,1,Ro(()=>IN({call:RN(LN(Ka().transform(e=>$o(e))))})));FN(`app.region`,1,Ro(()=>IN({connect:RN(IN({messages:RN(qo(ReadableStream).transform(e=>e.pipeThrough(new TransformStream({transform(e,t){t.enqueue(U().parse(e))}})))),send:zN,close:zN}))})));var oP=72e4,sP=mo({png:`png`,jpeg:`jpeg`,webp:`webp`}),cP=mo({draft:`draft`,balanced:`balanced`,premium:`premium`,max:`max`}),lP=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()),uP=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`}),dP=mo({p480:`480p`,p720:`720p`,p768:`768p`,p1080:`1080p`,p4k:`4k`}),fP=mo({wide:`16:9`,landscape:`4:3`,square:`1:1`,portrait:`3:4`,tall:`9:16`,ultrawide:`21:9`,ultratall:`9:21`}),pP=mo({first:`first-frame`,last:`last-frame`,reference:`reference`}),mP=Ro(()=>W({resolution:dP,aspectRatio:fP,width:Ra().int().positive(),height:Ra().int().positive()}).readonly()),hP=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(mP).readonly(),defaultResolution:dP,defaultAspectRatio:fP,supportsAudio:Ha(),defaultGenerateAudio:Ha().nullable(),referenceRoles:Qa(pP).readonly(),maxReferenceImages:Ra().int().nonnegative(),referenceResolutions:Qa(dP).readonly(),audioReferences:W({max:Ra().int().positive(),totalSeconds:Ra().int().positive()}).readonly().nullable(),prices:Qa(W({resolution:dP,silentMilliunitsPerSecond:Ra().int().positive(),audioMilliunitsPerSecond:Ra().int().positive()}).readonly()).readonly()}).readonly()),gP=mo({multilingual:`elevenlabs/eleven-multilingual-v2`,v3:`elevenlabs/eleven-v3`,music:`elevenlabs/music-v2`}),_P=Ro(()=>W({id:U().min(1).max(64),label:U().min(1).max(128)}).readonly()),vP=Ro(()=>W({provider:go(`elevenlabs`),mode:mo({speech:`speech`,music:`music`}),voices:Qa(_P).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()),yP=32e3,bP=2048,xP=mo({remove_background:`remove_background`,upscale:`upscale`}),SP=Ro(()=>W({operation:xP,source:W({formats:Qa(sP).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()),CP=[[4,.005],[8,.01],[16,.02],[32,.04],[64,.06],[128,.12]],wP=[4,8,16],TP=1e5,EP=.018,DP=8388608,OP=25e6,kP=mo({image:`image`,video_second:`video_second`,audio_second:`audio_second`,audio_character_block:`audio_character_block`}),AP=e=>e.kind===`video`?`video_second`:e.kind===`audio`?e.audio?.mode===`speech`?`audio_character_block`:`audio_second`:`image`,jP=W({id:U().min(1).max(256),label:U().min(1).max(512),kind:mo({image:`image`,video:`video`,audio:`audio`}),tier:cP,outputFormats:Qa(sP).max(3).readonly(),maxPromptLength:Ra().int().positive().max(yP),input:lP,sizes:Qa(U().regex(/^\d+x\d+$/u)).readonly().nullable(),video:hP.nullable(),audio:vP.nullable(),billingUnit:kP,transform:SP.nullable()}).readonly(),MP=e=>{let t={kind:`image`,sizes:null,video:null,audio:null,transform:null,outputFormats:Object.freeze([]),...e};return Object.freeze({...t,billingUnit:AP(t),input:Object.freeze(e.input)})},NP=3840,PP=8294400,FP=[[1,1],[4,3],[3,4],[3,2],[2,3],[16,9],[9,16],[21,9]],IP=(()=>{let e=new Set([`1024x1024`,`1024x1536`,`1536x1024`]),t=[],n=[];for(let[r,i]of FP){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(NP/Math.max(o,s),Math.sqrt(PP/c)))))}return Object.freeze([...t,...n])})(),LP=(e=>Object.freeze(FP.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),RP={"480p":480,"720p":720,"768p":768,"1080p":1080,"4k":2160},zP={"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]},BP={maxSeconds:30,maxReferenceImages:30,audioReferences:{max:10,totalSeconds:30},maxPromptLength:25e3,resolutions:[`480p`,`720p`],aspects:fP.options.filter(e=>e!==fP.enum.ultratall)};function VP(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?fP.options:[fP.enum.wide,fP.enum.tall,fP.enum.square],d=Object.freeze(s.flatMap(e=>u.map(t=>{let[n,r]=zP[t],i=RP[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?pP.options:[pP.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 MP({id:e,label:t,tier:n,maxPromptLength:a?.maxPromptLength??(o?1e4:bP),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 HP(){let e=[`480p`,`768p`],t=[fP.enum.wide,fP.enum.landscape,fP.enum.square,fP.enum.portrait,fP.enum.tall,fP.enum.ultrawide],n=Object.freeze(e.flatMap(e=>t.map(t=>{let[n,r]=zP[t],i=RP[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=dP.enum.p768,i=fP.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([pP.enum.first,pP.enum.reference]),maxReferenceImages:4,audioReferences:null,referenceResolutions:Object.freeze(e),prices:Object.freeze([{resolution:dP.enum.p480,silentMilliunitsPerSecond:5e3,audioMilliunitsPerSecond:5e3},{resolution:dP.enum.p768,silentMilliunitsPerSecond:8e3,audioMilliunitsPerSecond:8e3}])});return MP({id:uP.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 UP=Object.freeze([Object.freeze({id:`JBFqnCBsd6RMkjVDRZzb`,label:`Default voice`})]);function WP(e,t,n,r){return KP(e,t,n,1e4,{provider:`elevenlabs`,mode:`speech`,voices:UP,defaultVoiceId:UP[0]?.id??null,seconds:null,milliunitsPerUnit:r})}function GP(){return KP(gP.enum.music,`Eleven Music v2`,`premium`,bP,{provider:`elevenlabs`,mode:`music`,voices:Object.freeze([]),defaultVoiceId:null,seconds:Object.freeze({min:3,max:600,default:30}),milliunitsPerUnit:250})}function KP(e,t,n,r,i){return MP({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 qP(e){let t=CP.find(([t])=>e<=t);if(t===void 0)throw Error(`no published upscale price for ${String(e)} MP`);return t[1]}function JP(e){return MP({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:DP,maxPixels:OP}),defaultMegapixels:e.defaultMegapixels,milliunits:e.flatUsd===null?null:Math.round(e.flatUsd*TP),sizes:Object.freeze(e.sizes.map(({megapixels:e,usd:t})=>Object.freeze({megapixels:e,milliunits:Math.round(t*TP)})))}),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([MP({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`}}),MP({id:`@cf/black-forest-labs/flux-2-klein-4b`,maxPromptLength:bP,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`}}),MP({id:`@cf/black-forest-labs/flux-2-klein-9b`,maxPromptLength:bP,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`}}),MP({id:`@cf/black-forest-labs/flux-2-dev`,maxPromptLength:bP,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`}}),MP({id:`@cf/leonardo/lucid-origin`,maxPromptLength:bP,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`}}),MP({id:`@cf/leonardo/phoenix-1.0`,maxPromptLength:bP,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`}}),MP({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:IP,input:{transport:`json`,dimensions:`own`,maxDimension:NP,maxDimensionDocumented:!0,defaultWidth:1024,defaultHeight:1024,steps:`fixed`,maxSteps:null,defaultSteps:null,guidance:null,referenceField:`images`,maxReferences:16,referenceDimension:1024,referenceFormat:`webp`}}),MP({id:`bytedance/seedream-5-pro`,maxPromptLength:bP,outputFormats:Object.freeze([`jpeg`]),tier:`premium`,label:`Seedream 5 Pro — ByteDance, high-quality images`,sizes:LP,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`}}),JP({id:`bria/remove-background`,label:`Remove background — Bria RMBG 2.0`,tier:`draft`,operation:`remove_background`,outputFormat:`png`,flatUsd:EP,sizes:[],defaultMegapixels:null}),JP({id:`pruna/p-image-upscale`,label:`Upscale — Pruna P-Image-Upscale`,tier:`draft`,operation:`upscale`,outputFormat:`webp`,flatUsd:null,sizes:wP.map(e=>({megapixels:e,usd:qP(e)})),defaultMegapixels:4}),VP(uP.enum.seedance25,`Seedance 2.5`,`balanced`,`seedance`,[[`480p`,10280,10280],[`720p`,23120,23120]],BP),VP(uP.enum.seedance,`Seedance 2.0`,`balanced`,`seedance`,[[`480p`,7e3,7e3],[`720p`,15e3,15e3],[`1080p`,37e3,37e3],[`4k`,78e3,78e3]]),VP(uP.enum.seedanceFast,`Seedance 2.0 Fast`,`draft`,`seedance`,[[`480p`,6e3,6e3],[`720p`,12e3,12e3]]),VP(uP.enum.seedanceMini,`Seedance 2.0 Mini`,`draft`,`seedance`,[[`480p`,4e3,4e3],[`720p`,9e3,9e3]]),VP(uP.enum.veo,`Veo 3.1`,`premium`,`veo`,[[`720p`,2e4,4e4],[`1080p`,2e4,4e4]]),VP(uP.enum.veoFast,`Veo 3.1 Fast`,`balanced`,`veo`,[[`720p`,8e3,1e4],[`1080p`,1e4,12e3]]),HP(),WP(gP.enum.multilingual,`Eleven Multilingual v2 — natural speech`,`balanced`,10),WP(gP.enum.v3,`Eleven v3 — expressive speech`,`premium`,10),GP()]),Qa(jP.unwrap().extend({billingUnit:kP.optional(),audio:vP.unwrap().nullable().default(null),transform:SP.unwrap().nullable().default(null),video:hP.unwrap().unwrap().extend({audioReferences:hP.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!==AP(e)&&i(`${e.id} billingUnit must be ${AP(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 YP=e=>U().min(1).max(e),XP=Ra().int().min(-(2**53-1)).max(2**53-1),ZP=XP.positive(),QP=XP.nonnegative(),$P=W({printId:YP(256),computerId:YP(256),kind:mo([`image`,`video`,`audio`]),prompt:YP(yP),model:YP(256),width:ZP.nullable(),height:ZP.nullable(),steps:QP.nullable(),durationSeconds:QP.nullable(),format:YP(32),bytes:ZP,costMilliunits:QP,actorKind:mo([`member`,`agent`]),actorId:YP(256),derivedFrom:YP(256).nullable(),createdAt:QP,source:mo([`recorded`,`file`]),schemaVersion:ZP}),eF=eo({printId:$P.shape.printId,path:U().startsWith(`/`).min(2).max(4096)});function tF(e,t){let n=e?.app??null,r=ON(n),i=r?.openRequest,a=r?.computerId,o=i?.kind===`navigate`?i.params.find(e=>e.key===`print`):void 0,s=$P.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=Ww({...rP(n,aP,eP.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=eF.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(aP)),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 nF=cS([J({kind:Zx(`compose`),text:tS.pipe(Y(NS(1)),Y(IS(2e3)))}),J({kind:Zx(`navigate`),params:oS(J({key:tS.pipe(Y(NS(1)),Y(IS(64))),value:tS.pipe(Y(IS(1024)))})).pipe(Y(IS(16)))})]);cS([J({role:tS.pipe(Y(NS(1)),Y(IS(80))),intent:nF}),J({appId:tS.pipe(Y(NS(1)),Y(IS(128))),intent:nF})],{mode:`oneOf`});var rF=W({displayName:U().min(1).max(80).nullable()}).nullable(),iF=FN(`apps.open`,1,Ro(()=>IN({open:zN,role:RN(LN(rF))})));FN(`apps.call`,1,Ro(()=>IN({call:RN(LN(Ka().transform(e=>$o(e))))})));var aF=U().regex(/^[a-zA-Z0-9._-]{1,128}$/).refine(e=>e!==`.`&&e!==`..`),oF=U().regex(/^[0-9a-f]{40}$/);W({ref:U().startsWith(`refs/`).max(1024),before:oF,after:oF}),Ro(()=>U().min(1).max(512));var sF=`files`,cF=W({name:U(),email:U()}),lF=W({hash:oF,treeHash:oF,message:U(),author:cF,committer:cF,parents:Qa(oF),authoredAt:Ra(),committedAt:Ra()}),uF=W({name:U(),mode:U(),hash:oF,type:mo([`blob`,`tree`,`commit`])});W({ref:U(),commit:lF,path:U(),entries:Qa(uF)});var dF=65536,fF=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.`),pF=U().min(1).max(256),mF={repo:aF,branch:pF,path:fF},hF=mo([`pending`,`synced`,`conflict`,`failed`]),gF=W({text:U(),revision:Ra().int().positive(),state:hF,theirs:W({blob:oF.nullable(),commit:oF}).optional(),failure:mo([`branch_missing`,`access_changed`,`sync_failed`,`permanent_material`]).optional()});W({...mF,baseBlob:oF.nullable(),baseCommit:oF,text:U().max(dF),revision:Ra().int().positive().nullable()});var _F=ro([W({kind:go(`saved`),revision:Ra().int().positive(),state:go(`pending`)}),W({kind:go(`synced`),revision:Ra().int().positive(),commit:oF}),W({kind:go(`conflict`),revision:Ra().int().nonnegative(),theirs:gF.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({...mF,revision:Ra().int().positive()}),ro([W({kind:mo([`discarded`,`not_found`])}),W({kind:go(`conflict`),revision:Ra().int().positive()})]),W({settled:Qa(W({...mF,result:_F})),more:Ha()}),W({version:Ra().int().positive().nullable(),commit:oF,blob:oF.nullable(),pending:gF.optional(),ref:U(),path:U(),size:Ra(),binary:Ha(),text:U().nullable()}),W({ref:U(),commits:Qa(W({commit:lF,agent:U().nullable()})),next:U().optional()}),W({ref:U(),commit:lF,paths:Qa(U()),truncated:Ha()}),W({kind:go(`rebuilding`)}),W({done:Ha(),cursor:U().nullable()}),ro([W({repository:aF,branch:pF,path:fF}),W({path:U().min(1).max(1024)})]);var vF=Kx(BS(J({error:Zx(`too_large`)})));async function yF(e,t){let n,r=()=>n??=e.close(),i=()=>{r().catch(e=>{rT(`files.read.abort-close`,e)})};t.signal?.addEventListener(`abort`,i,{once:!0});try{t.signal?.throwIfAborted();let n=await e.response();try{let e=Jx(mS(Response))(n);if(e.status===413)throw new X(`App file exceeds the read bound`,{code:vF(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{SM(n)}}finally{t.signal?.removeEventListener(`abort`,i);try{await r()}finally{e[Symbol.dispose]()}}}async function bF(e,t,n){let r,i=()=>r??=e.close(),a=()=>{i().catch(e=>{rT(`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){rT(`files.write.remote-close`,e)}try{e[Symbol.dispose]()}catch(e){rT(`files.write.local-dispose`,e)}}}var xF=mo([`exec`,`write`,`media`]),SF=Ro(()=>W({error:go(`attachment_budget_exceeded`),kind:xF,retryAfterMs:Ra()})),CF=Ro(()=>W({error:go(`unavailable`),ref:U().min(1).max(128)}));Ro(()=>ro([W({error:mo([`revoked`,`not_granted`,`grantor_lost_authority`,`unavailable`])}),CF,SF])),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`])}),CF])),Ro(()=>ro([W({error:mo([`capacity`,`unfunded`,`admission_unavailable`,`backend_unavailable`])}),CF])),Ro(()=>W({error:go(`timeout`),requestId:U()}));var wF=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:wF.exclude([`attachment_budget_exceeded`,`timeout`])}),CF]));var TF=J({path:tS,entries:oS(J({name:tS,type:lS([`file`,`directory`,`symlink`]),size:nS,modifiedAt:nS})),nextOffset:uS(nS)}),EF=FN(`computer.list`,1,Ro(()=>IN({list:RN(LN(Ka().transform(e=>Jx(TF)(e))))}))),DF=cS([J({state:lS([`running`,`sleeping`,`starting`])}),J({state:Zx(`start_failed`),reason:Xx(tS.pipe(Y(NS(1)),Y(IS(1024))))}),J({state:Zx(`queued`),position:nS.pipe(Y(jS()),Y(DS(0)))})]),OF=J({enabled:rS,effective:rS,blockedBy:uS(lS([`team`,`global`]))}),kF=J({computerId:RS,name:RS,runtime:DF,backends:oS(J({id:RS,kind:lS([`platform-container`,`on-box-vm`,`local`]),status:lS([`ready`,`queued`,`online`,`offline`]),queuePosition:uS(nS.pipe(Y(jS()),Y(DS(0)))),hostId:uS(tS),hostLabel:uS(tS),folderLabel:uS(tS),detachable:rS})),internet:OF});FN(`computer.instrument.read`,1,Ro(()=>IN({read:RN(LN(Ka().transform(e=>Jx(kF)(e))))}))),FN(`computer.instrument.control`,1,Ro(()=>IN({start:RN(LN(Ka().transform(e=>Jx(DF)(e)))),setInternetAccess:RN(LN(Ka().transform(e=>Jx(OF)(e)))),detachLocal:RN(LN(Ka().transform(e=>Jx(J({detached:rS}))(e))))})));var AF=cS([J({ports:oS(J({port:nS.pipe(Y(jS()),Y(AS({minimum:1,maximum:65535}))),previewUrl:RS,openMode:lS([`inline`,`external-only`])})).pipe(Y(IS(64)))}),J({error:Zx(`port_previews_not_configured`)})]),jF=J({port:nS.annotate({message:`Use a port from 1 to 65535.`}).check(jS({message:`Use a port from 1 to 65535.`}),AS({minimum:1,maximum:65535},{message:`Use a port from 1 to 65535.`})),exposed:rS}),MF=J({port:nS.pipe(Y(jS()),Y(AS({minimum:1,maximum:65535}))),removed:rS});FN(`computer.ports`,2,Ro(()=>IN({list:RN(LN(Ka().transform(e=>Jx(AF)(e)))),expose:RN(LN(Ka().transform(e=>Jx(jF)(e)))),unexpose:RN(LN(Ka().transform(e=>Jx(MF)(e))))})));var NF=lS([`synced`,`pending`,`unknown`]),PF=J({port:uS(jF.fields.port),id:RS,command:RS,cwd:uS(tS),startedAt:nS.pipe(Y(jS()),Y(OS(0))),state:lS([`running`,`exited`,`uncertain`]),exitCode:uS(nS.pipe(Y(jS()))),sync:NF,endedAt:uS(nS.pipe(Y(jS()),Y(OS(0)))),endedReason:uS(Zx(`idle-sleep`))}),FF=J({processes:oS(PF)}),IF=J({process:PF,signalled:rS}),LF=J({process:PF,lines:oS(tS.pipe(Y(IS(2e3)))).pipe(Y(IS(200))),truncated:rS});J({requestId:RS.pipe(Y(IS(256))),command:RS.pipe(Y(IS(16384))),cwd:Xx(tS),port:Xx(jF.fields.port)}),FN(`computer.processes`,1,Ro(()=>IN({start:RN(LN(Ka().transform(e=>Jx(PF)(e)))),list:RN(LN(Ka().transform(e=>Jx(FF)(e)))),kill:RN(LN(Ka().transform(e=>Jx(IF)(e)))),logs:RN(LN(Ka().transform(e=>Jx(LF)(e))))}))),J({error:lS(wF.options),ref:q(tS)});var RF=FN(`computer.readFile`,1,Ro(()=>IN({open:RN(IN({response:RN(qo(Response)),close:zN}))})));async function zF(e,t,n){return await yF(await e.require(RF).open(t),{...n,name:t.path.split(`/`).at(-1)??`file`})}async function BF(e,t){return Jx(TF)(await e.require(EF).list(t))}var VF=FN(`computer.writeFile`,3,Ro(()=>IN({open:RN(IN({write:zN,close:zN})),mkdir:zN,replace:RN(LN(Ka().transform(e=>Jx(HF)(e))))}))),HF=cS([J({kind:Zx(`replaced`),path:RS,bytes:nS.pipe(Y(jS()),Y(OS(0)))}),J({kind:Zx(`conflict`)})]),UF=J({computerName:RS.pipe(Y(IS(256))),teamName:RS.pipe(Y(IS(256))),modelDoor:RS.pipe(Y(IS(256))),uptimeSeconds:nS.pipe(Y(jS()),Y(OS(0))),version:RS.pipe(Y(IS(64)))});FN(`computer.terminal`,2,Ro(()=>IN({open:RN(IN({information:RN(LN(Ka().transform(e=>Jx(UF)(e)))),output:RN(qo(ReadableStream).transform(e=>e.pipeThrough(new TransformStream({transform(e,t){t.enqueue(qo(Uint8Array).parse(e))}})))),input:RN(qo(WritableStream)),resize:zN,close:zN}))})));async function WF(e,t,n){await bF(await e.require(VF).open({path:t.path}),t.content,n)}var GF=l(tT(),1);function KF(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 qF=e=>{switch(e){case`success`:return XF;case`info`:return QF;case`warning`:return ZF;case`error`:return $F;default:return null}},JF=Array(12).fill(0),YF=({visible:e,className:t})=>G.createElement(`div`,{className:[`sonner-loading-wrapper`,t].filter(Boolean).join(` `),"data-visible":e},G.createElement(`div`,{className:`sonner-spinner`},JF.map((e,t)=>G.createElement(`div`,{className:`sonner-loading-bar`,key:`spinner-bar-${t}`})))),XF=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`})),ZF=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`})),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-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`})),$F=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`})),eI=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`})),tI=()=>{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},nI=1,rI=100,iI=e=>typeof e?.id==`number`||e?.id?.length>0?e.id:nI++,aI=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-rI;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=iI(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(sI(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=iI(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}},oI=(e,t)=>aI.message(e,t),sI=e=>e&&typeof e==`object`&&`ok`in e&&typeof e.ok==`boolean`&&`status`in e&&typeof e.status==`number`,cI=Object.assign(oI,{success:aI.success,info:aI.info,warning:aI.warning,error:aI.error,custom:aI.custom,message:aI.message,promise:aI.promise,dismiss:aI.dismiss,loading:aI.loading},{getHistory:()=>aI.toasts,getToasts:()=>aI.getActiveToasts()});KF(`[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 lI(e){return e.label!==void 0}var uI=3,dI=`24px`,fI=`16px`,pI=4e3,mI=356,hI=14,gI=45,_I=200;function vI(...e){return e.filter(Boolean).join(` `)}function yI(e){let[t,n]=e.split(`-`),r=[];return t&&r.push(t),n&&r.push(n),r}var bI=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||pI),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||pI,[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=tI(),Se=G.useMemo(()=>e.swipeDirections??yI(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)},_I)},[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:vI(C?.loader,n?.classNames?.loader,`sonner-loader`),"data-visible":oe===`loading`},w.loading):G.createElement(YF,{className:vI(C?.loader,n?.classNames?.loader),visible:oe===`loading`})}let De=n.icon||w?.[oe]||qF(oe);return G.createElement(`li`,{tabIndex:0,ref:H,className:vI(_,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)>=gI||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:vI(C?.closeButton,n?.classNames?.closeButton)},w?.close??eI):null,(oe||n.icon||n.promise)&&n.icon!==null&&(w?.[oe]!==null||n.icon)?G.createElement(`div`,{"data-icon":``,className:vI(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:vI(C?.content,n?.classNames?.content)},G.createElement(`div`,{"data-title":``,className:vI(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:vI(v,ue,C?.description,n?.classNames?.description)},typeof n.description==`function`?n.description():n.description):null),G.isValidElement(n.cancel)?n.cancel:n.cancel&&lI(n.cancel)?G.createElement(`button`,{"data-button":!0,"data-cancel":!0,style:n.cancelButtonStyle||h,onClick:e=>{lI(n.cancel)&&ce&&(n.cancel.onClick==null||n.cancel.onClick.call(n.cancel,e),Te())},className:vI(C?.cancelButton,n?.classNames?.cancelButton)},n.cancel.label):null,G.isValidElement(n.action)?n.action:n.action&&lI(n.action)?G.createElement(`button`,{"data-button":!0,"data-action":!0,style:n.actionButtonStyle||g,onClick:e=>{lI(n.action)&&(n.action.onClick==null||n.action.onClick.call(n.action,e),!e.defaultPrevented&&Te())},className:vI(C?.actionButton,n?.classNames?.actionButton)},n.action.label):null)};function xI(){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 SI(e,t){let n={};return[e,t].forEach((e,t)=>{let r=t===1,i=r?`--mobile-offset`:`--offset`,a=r?fI:dI;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 CI=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=uI,toastOptions:g,dir:_=xI(),gap:v=hI,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||aI.dismiss(e.id),t.filter(({id:t})=>t!==e.id)))},[]);return G.useEffect(()=>aI.subscribe(e=>{if(e.dismiss){requestAnimationFrame(()=>{C(t=>t.map(t=>t.id===e.id?{...t,delete:!0}:t))});return}setTimeout(()=>{GF.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`?xI():_,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":`${mI}px`,"--gap":`${v}px`,...m,...SI(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(bI,{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}))}),wI=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),TI=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),EI={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`},DI=(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,...EI,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:TI(`lucide`,i),...s},[...o.map(([e,t])=>(0,G.createElement)(e,t)),...Array.isArray(a)?a:[a]])),OI=(e,t)=>{let n=(0,G.forwardRef)(({className:n,...r},i)=>(0,G.createElement)(DI,{ref:i,iconNode:t,className:TI(`lucide-${wI(e)}`,n),...r}));return n.displayName=`${e}`,n},kI=OI(`ArrowUp`,[[`path`,{d:`m5 12 7-7 7 7`,key:`hav0vg`}],[`path`,{d:`M12 19V5`,key:`x0mq9r`}]]),AI=OI(`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`}]]),jI=OI(`Check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),MI=OI(`ChevronDown`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]),NI=OI(`ChevronUp`,[[`path`,{d:`m18 15-6-6-6 6`,key:`153udz`}]]),PI=OI(`Clock`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`polyline`,{points:`12 6 12 12 16 14`,key:`68esgv`}]]),FI=OI(`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`}]]),II=OI(`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`}]]),LI=OI(`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`}]]),RI=OI(`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`}]]),zI=OI(`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`}]]),BI=OI(`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`}]]),VI=OI(`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`}]]),HI=OI(`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`}]]),UI=OI(`Info`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 16v-4`,key:`1dtifu`}],[`path`,{d:`M12 8h.01`,key:`e9boi3`}]]),WI=OI(`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`}]]),GI=OI(`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`}]]),KI=OI(`Minus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}]]),qI=OI(`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`}]]),JI=OI(`Play`,[[`polygon`,{points:`6 3 20 12 6 21 6 3`,key:`1oa8hb`}]]),YI=OI(`Plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]),XI=OI(`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`}]]),ZI=OI(`Square`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}]]),QI=OI(`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`}]]),$I=OI(`X`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]),eL=Object.freeze({alphaIntercept:-9,alphaSlope:19,blurStdDeviation:1.5}),tL=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 nL(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=nL(e[t]))&&(r&&(r+=` `),r+=n)}else for(n in e)e[n]&&(r&&(r+=` `),r+=n)}return r}function rL(){for(var e,t,n=0,r=``,i=arguments.length;n<i;n++)(e=arguments[n])&&(t=nL(e))&&(r&&(r+=` `),r+=t);return r}var iL=e=>typeof e==`boolean`?`${e}`:e===0?`0`:e,aL=rL,oL=(e,t)=>n=>{if(t?.variants==null)return aL(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=iL(t)||iL(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 aL(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)},sL=Object.defineProperty,cL=((e,t)=>{let n={};for(var r in e)sL(n,r,{get:e[r],enumerable:!0});return t||sL(n,Symbol.toStringTag,{value:`Module`}),n})({isAny:()=>SL,isAnyNonArbitrary:()=>DL,isArbitraryFamilyName:()=>WL,isArbitraryImage:()=>KL,isArbitraryLength:()=>VL,isArbitraryNumber:()=>HL,isArbitraryPosition:()=>GL,isArbitraryShadow:()=>qL,isArbitrarySize:()=>zL,isArbitraryValue:()=>BL,isArbitraryVariable:()=>JL,isArbitraryVariableFamilyName:()=>XL,isArbitraryVariableImage:()=>$L,isArbitraryVariableLength:()=>YL,isArbitraryVariablePosition:()=>ZL,isArbitraryVariableShadow:()=>eR,isArbitraryVariableSize:()=>QL,isArbitraryVariableWeight:()=>tR,isArbitraryWeight:()=>UL,isFraction:()=>_L,isInteger:()=>yL,isNamedContainerQuery:()=>OL,isNumber:()=>vL,isPercent:()=>bL,isTshirtSize:()=>xL}),lL=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,uL=/^\((?:(\w[\w-]*):)?(.+)\)$/i,dL=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,fL=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,pL=/\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$/,mL=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,hL=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,gL=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,_L=e=>dL.test(e),vL=e=>!!e&&!Number.isNaN(Number(e)),yL=e=>!!e&&Number.isInteger(Number(e)),bL=e=>e.endsWith(`%`)&&vL(e.slice(0,-1)),xL=e=>fL.test(e),SL=()=>!0,CL=e=>pL.test(e)&&!mL.test(e),wL=()=>!1,TL=e=>hL.test(e),EL=e=>gL.test(e),DL=e=>!BL(e)&&!JL(e),OL=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)),kL=(e,t,n)=>{let r=lL.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},AL=(e,t,n=!1)=>{let r=uL.exec(e);return r?r[1]?t(r[1]):n:!1},jL=e=>e===`position`||e===`percentage`,ML=e=>e===`image`||e===`url`,NL=e=>e===`length`||e===`size`||e===`bg-size`,PL=e=>e===`length`,FL=e=>e===`number`,IL=e=>e===`family-name`,LL=e=>e===`number`||e===`weight`,RL=e=>e===`shadow`,zL=e=>kL(e,NL,wL),BL=e=>lL.test(e),VL=e=>kL(e,PL,CL),HL=e=>kL(e,FL,vL),UL=e=>kL(e,LL,SL),WL=e=>kL(e,IL,wL),GL=e=>kL(e,jL,wL),KL=e=>kL(e,ML,EL),qL=e=>kL(e,RL,TL),JL=e=>uL.test(e),YL=e=>AL(e,PL),XL=e=>AL(e,IL),ZL=e=>AL(e,jL),QL=e=>AL(e,NL),$L=e=>AL(e,ML),eR=e=>AL(e,RL,!0),tR=e=>AL(e,LL,!0),nR=(e,t)=>{let n=Object.keys(e);return n.length===1&&n[0]===t&&typeof e[t]==`string`},rR=e=>typeof e==`function`&&e.isThemeGetter===!0,iR=e=>({...e,theme:{...e.theme},classGroups:{...e.classGroups},conflictingClassGroups:{...e.conflictingClassGroups},conflictingClassGroupModifiers:{...e.conflictingClassGroupModifiers},orderSensitiveModifiers:[...e.orderSensitiveModifiers],postfixLookupClassGroups:[...e.postfixLookupClassGroups??[]]}),aR=(e,t)=>{let n=iR(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},oR={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},sR=25,cR=()=>({names:[],idByName:new Map,impls:{},fnName:new Map,classifierFns:new Map}),lR=(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},uR=(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),lR(e,n,t)}let n=t.$v,r=cL[n];if(oR[n]===void 0||!r)throw Error(`cn: unknown validator "${n}"`);return lR(e,n,r)},dR=()=>({nextPart:new Map,validators:null,classGroupId:-1,lit:[]}),fR=(e,t)=>e.theme[t]??[],pR=(e,t,n)=>{let r=dR(),i=(e,t)=>{for(let n of t.split(`-`)){let t=e.nextPart.get(n);t||(t=dR(),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(rR(n)){for(let t of n(e.theme))a(t,r,o);return}(r.validators??=[]).push({validatorId:uR(t,n),groupId:o});return}if(nR(n,`$t`)){for(let t of fR(e,n.$t))a(t,r,o);return}if(nR(n,`$v`)){(r.validators??=[]).push({validatorId:uR(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},mR=e=>{let t=cR(),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=pR(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=oR[n];if(r!==void 0)oe[e]=r;else{let t=ae.indexOf(n);t===-1&&(t=ae.length,ae.push(n)),oe[e]=sR+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}},hR=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},gR=e=>{let t=mR(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:hR(t.edgeCounts),labelStart:hR(t.edgeLabelLen),labelText:t.labelText,edgeTarget:Int32Array.from(t.edgeTargetActual),nodeGroup:t.nodeGroup,nodeVlist:t.nodeVlist,vlistPat:hR(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:hR(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}},_R=`line`in Error(),vR=-1,yR=-1,bR=(e,t,n)=>{let r=2166136261;for(let i=t;i<n;i++)r=Math.imul(r^e.charCodeAt(i),16777619);return r},xR=(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},SR=(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=(bR(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=(bR(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=bR(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?vR: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 vR},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[_]=vR,Ve(y,e,p,h,v,vR,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=yR,ee=0;for(let t=M;t<D;t++)if(t===A&&(z=F<I?yR:P,ee=R),P!==yR){let n=e.charCodeAt(t),r=-1;if(F<I)o.charCodeAt(F)===n?(F++,F===I&&(r=P=L)):P=yR;else{let e=i[P],t=i[P+1],c=yR;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?yR:P,ee=R);let ne=F<I?yR:P,re,V=!1;if(A>=0){if(V=!0,re=ct(e,E,A,z,ee),re!==vR&&re<r&&j[re]){let t=ct(e,E,D,ne,R);t!==vR&&t!==re&&(re=t,V=!1)}else re===vR&&(re=ct(e,E,D,ne,R),V=!1)}else re=ct(e,E,D,ne,R);let H=0,ie=0;re===vR?qe[_]=vR:(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===vR){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=xR(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=xR(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=xR(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:_R?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(TR.apply(null,arguments))},mergeString:wt,seenBefore:z===0?()=>!1:Ct,mergeUncached:lt}},CR=(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:CR(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},wR=(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:CR(i,t);a&&(n&&(n+=` `),n+=a)}return n},TR=function(){return wR(arguments,!1)},ER=(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]=CR(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(CR(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)}},DR=`{"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"]}`,OR=()=>JSON.parse(DR),kR=e=>`classGroups`in e&&`theme`in e&&`conflictingClassGroups`in e,AR=e=>e===void 0?{config:OR()}:typeof e==`function`?{config:e(OR())}:kR(e)?{config:e}:{config:aR(OR(),e),cacheSize:e.cacheSize},jR=e=>{let{config:t,cacheSize:n}=AR(e),{tables:r,validatorImpls:i,prefix:a}=gR(t);return SR(r,i,{cacheSize:n,prefix:a})},Q=(e=>{let t=null,n=()=>t??=jR(e);return ER(e=>n().mergeString(e),{seenBefore:e=>n().seenBefore(e),mergeUncached:e=>n().mergeUncached(e)})})({extend:{theme:{spacing:[...tL]}}});function MR(e,t){return typeof e==`function`?e(t):e}function NR(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}function PR(...e){return t=>{let n=!1,r=e.map(e=>{let r=NR(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():NR(e[t],null)}}}}function see(...e){return G.useCallback(PR(...e),e)}function cee(e){let t=G.forwardRef((t,n)=>{let{children:r,...i}=t,a=null,o=!1,s=[];IR(r)&&typeof LR==`function`&&(r=LR(r._payload)),G.Children.forEach(r,e=>{if(pee(e)){o=!0;let t=e,n=`child`in t.props?t.props.child:t.props.children;IR(n)&&typeof LR==`function`&&(n=LR(n._payload)),a=uee(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?fee(a):void 0,l=see(n,c);if(!a){if(r||r===0)throw Error(o?_ee(e):gee(e));return r}let u=dee(i,a.props??{});return a.type!==G.Fragment&&(u.ref=n?l:c),G.cloneElement(a,u)});return t.displayName=`${e}.Slot`,t}var FR=cee(`Slot`),lee=Symbol.for(`radix.slottable`),uee=(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 dee(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 fee(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 pee(e){return G.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===lee}var mee=Symbol.for(`react.lazy`);function IR(e){return typeof e==`object`&&!!e&&`$$typeof`in e&&e.$$typeof===mee&&`_payload`in e&&hee(e._payload)}function hee(e){return typeof e==`object`&&!!e&&`then`in e}var gee=e=>`${e} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,_ee=e=>`${e} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,LR=G.use,RR=(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)(FR,{...n,className:i,ref:r}):(0,Z.jsx)(`span`,{...n,className:i,ref:r})}),zR=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)`}),BR=`(prefers-reduced-motion: reduce)`;function VR(e){let t=e.ownerDocument.defaultView;if(!t)return zR;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?.(BR).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`,zR.squish),fast:o(`fast`,zR.fast),normal:o(`normal`,zR.normal),slow:o(`slow`,zR.slow),springDuration:o(`spring-duration`,zR.springDuration),bounce:Math.min(1,s(`bounce`,zR.bounce)),stretch:s(`stretch`,zR.stretch),distance:s(`distance`,zR.distance),stagger:a?0:i(`--stipe-motion-stagger`,zR.stagger),blur:s(`blur`,zR.blur),shake:s(`shake`,zR.shake),steps:Math.floor(s(`steps`,zR.steps)),fuse:r(`--stipe-motion-fuse`,zR.fuse),pressDepth:a?0:r(`--stipe-press-depth`,zR.pressDepth),pressScale:a?1:r(`--stipe-press-scale`,zR.pressScale),ease:n.getPropertyValue(`--stipe-motion-ease`).trim()||zR.ease,easeExit:n.getPropertyValue(`--stipe-motion-ease-exit`).trim()||zR.easeExit}}function HR(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 UR(e){let t=e.target;if(e.attributeName!==`style`||!(t instanceof Element))return!0;let n=t.ownerDocument,r=HR(n,e.oldValue),i=HR(n,t.getAttribute(`style`));return r.size!==i.size||[...i].some(([e,t])=>r.get(e)!==t)}function WR(e){let[t,n]=(0,G.useState)(()=>({...zR,reduced:!0}));return(0,G.useLayoutEffect)(()=>{let t=e.current,r=t?.ownerDocument.defaultView;if(!t||!r)return;let i=()=>{let e=VR(t);n(t=>JSON.stringify(t)===JSON.stringify(e)?t:e)};i();let a=new r.MutationObserver(e=>{e.some(UR)&&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?.(BR);return o?.addEventListener(`change`,i),()=>{a.disconnect(),o?.removeEventListener(`change`,i)}},[e]),t}function GR(e,t){return e.reduced?0:Math.round(t*e.normal/zR.normal)}function KR(e,t){if(e.reduced)return 0;let n=t*e.bounce/zR.bounce;return Math.min(.9,Math.max(0,n))}function qR(e,t){return e.reduced?0:Math.round(t*e.springDuration/zR.springDuration)}function JR(e,t){return e.steps>0?`steps(${String(e.steps)}, end)`:t}function YR(e){return`animate`in e}var XR=globalThis;function ZR(){return XR.matchMedia?.(BR).matches??!1}function QR(e){let t=XR.matchMedia?.(BR);return t?.addEventListener(`change`,e),()=>{t?.removeEventListener(`change`,e)}}function $R(){return!0}function ez(){return(0,G.useSyncExternalStore)(QR,ZR,$R)}var tz=typeof window<`u`,nz=tz?window:null,rz=tz?document:null,iz={OBJECT:0,ATTRIBUTE:1,CSS:2,TRANSFORM:3,CSS_VAR:4},az={NUMBER:0,UNIT:1,COLOR:2,COMPLEX:3},oz={NONE:0,AUTO:1,FORCE:2},sz={replace:0,none:1,blend:2},cz=Symbol(),lz=Symbol(),uz=Symbol(),dz=Symbol(),fz=Symbol(),pz=1e-11,mz=0xe8d4a51000,hz=1e3,gz=[],_z=(()=>{let e=new Map;return e.set(`x`,`translateX`),e.set(`y`,`translateY`),e.set(`z`,`translateZ`),e})(),vz=[`perspective`,`translateX`,`translateY`,`translateZ`,`rotate`,`rotateX`,`rotateY`,`rotateZ`,`scale`,`scaleX`,`scaleY`,`scaleZ`,`skew`,`skewX`,`skewY`],yz=vz.reduce((e,t)=>({...e,[t]:t+`(`}),{}),bz=()=>{},xz=e=>e,Sz=/\)\s*[-.\d]/,Cz=/(^#([\da-f]{3}){1,2}$)|(^#([\da-f]{4}){1,2}$)/i,wz=/rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)/i,Tz=/rgba\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*(-?\d+|-?\d*.\d+)\s*\)/i,Ez=/hsl\(\s*(-?\d+|-?\d*.\d+)\s*,\s*(-?\d+|-?\d*.\d+)%\s*,\s*(-?\d+|-?\d*.\d+)%\s*\)/i,Dz=/hsla\(\s*(-?\d+|-?\d*.\d+)\s*,\s*(-?\d+|-?\d*.\d+)%\s*,\s*(-?\d+|-?\d*.\d+)%\s*,\s*(-?\d+|-?\d*.\d+)\s*\)/i,Oz=/[-+]?\d*\.?\d+(?:e[-+]?\d)?/gi,kz=/^([-+]?\d*\.?\d+(?:e[-+]?\d+)?)([a-z]+|%)$/i,Az=/([a-z])([A-Z])/g,jz=/var\(\s*(--[\w-]+)(?:\s*,\s*([^)]+))?\s*\)/,Mz={id:null,keyframes:null,playbackEase:null,playbackRate:1,frameRate:240,loop:0,reversed:!1,alternate:!1,autoplay:!0,persist:!1,duration:hz,delay:0,loopDelay:0,ease:`out(2)`,composition:sz.replace,modifier:xz,onBegin:bz,onBeforeUpdate:bz,onUpdate:bz,onLoop:bz,onPause:bz,onComplete:bz,onRender:bz},Nz={current:null,root:rz},Pz={defaults:Mz,precision:4,timeScale:1,tickThreshold:200,editor:null},Fz={version:`4.5.0`,engine:null};tz&&(nz.AnimeJS||=[],nz.AnimeJS.push(Fz));var Iz=e=>e.replace(Az,`$1-$2`).toLowerCase(),Lz=(e,t)=>e.indexOf(t)===0,Rz=Date.now,zz=Array.isArray,Bz=e=>e&&e.constructor===Object,Vz=e=>typeof e==`number`&&!isNaN(e),Hz=e=>typeof e==`string`,Uz=e=>typeof e==`function`,Wz=e=>e===void 0,Gz=e=>Wz(e)||e===null,Kz=e=>tz&&e instanceof SVGElement,qz=e=>Cz.test(e),Jz=e=>Lz(e,`rgb`),Yz=e=>Lz(e,`hsl`),Xz=e=>qz(e)||(Jz(e)||Yz(e))&&(e[e.length-1]===`)`||!Sz.test(e)),Zz=e=>!Pz.defaults.hasOwnProperty(e),Qz=[`opacity`,`rotate`,`overflow`,`color`],$z=(e,t)=>{if(Qz.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}},eB=Math.pow,tB=Math.sqrt,nB=Math.sin,rB=Math.cos,iB=Math.abs,aB=Math.exp,oB=Math.ceil,sB=Math.floor,cB=Math.asin,lB=Math.PI,uB=Math.round,dB=(e,t,n)=>e<t?t:e>n?n:e,fB=(e,t)=>{if(t<0)return e;if(!t)return uB(e);let n=10**t;return uB(e*n)/n},pB=(e,t,n)=>n===1?t:n===0?e:e+(t-e)*n,mB=e=>e===1/0?mz:e===-1/0?-mz:e,hB=e=>e<=1e-11?pz:mB(fB(e,11)),gB=e=>zz(e)?[...e]:e,_B=(e,t)=>{let n={...e};for(let r in t){let i=e[r];n[r]=Wz(i)?t[r]:i}return n},vB=(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}},yB=(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},bB=(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},xB=(e,t,n)=>{let r=e.style.transform;if(r){let i=e[dz],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(!Wz(c))return n&&(n[t]=c),c}return t===`translate3d`?`0px, 0px, 0px`:t===`rotate3d`?`0, 0, 0, 0deg`:Lz(t,`scale`)?`1`:Lz(t,`rotate`)||Lz(t,`skew`)?`0deg`:`0px`},SB=e=>{let t=``;for(let n=0,r=vz.length;n<r;n++){let r=vz[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+=`${yz[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},CB=[];function wB(e,t){if(!e)return null;let n=CB.length;outer:for(let r=0;r<n;r++){let n=CB[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=CB[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 TB=e=>{let t=wz.exec(e)||Tz.exec(e),n=Wz(t[4])?1:+t[4];return[+t[1],+t[2],+t[3],n]},EB=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]},DB=(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),OB=e=>{let t=Ez.exec(e)||Dz.exec(e),n=t[1]/360,r=t[2]/100,i=t[3]/100,a=Wz(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=fB(DB(t,e,n+1/3)*255,0),s=fB(DB(t,e,n)*255,0),c=fB(DB(t,e,n-1/3)*255,0)}return[o,s,c,a]},kB=e=>Jz(e)?TB(e):qz(e)?EB(e):Yz(e)?OB(e):[0,0,0,1],AB=(e,t)=>Wz(e)?t:e,jB=(e,t)=>{let n=e.match(jz),r=t[lz]?t:document.documentElement,i=getComputedStyle(r)?.getPropertyValue(n[1]);return(!i||i.trim()===``)&&n[2]&&(i=n[2].trim()),i||0},MB=(e,t,n,r,i,a)=>{if(Uz(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(Hz(e)&&Lz(e,`var(`)){if(!i)return jB(e,t);let n=()=>jB(e,t);return i.func=n,n()}return e},NB=(e,t)=>e[lz]?e[uz]&&$z(e,t)?iz.ATTRIBUTE:vz.includes(t)||_z.get(t)?iz.TRANSFORM:Lz(t,`--`)?iz.CSS_VAR:t in e.style?iz.CSS:t in e?iz.OBJECT:iz.ATTRIBUTE:iz.OBJECT,PB=(e,t,n)=>{let r=e.style[t];r&&n&&(n[t]=r);let i=r||getComputedStyle(e[fz]||e).getPropertyValue(t);return i===`auto`?`0`:i},FB=(e,t,n,r)=>{let i=Wz(n)?NB(e,t):n,a=wB(e,t);if(a){let n=a.get(e);return n&&r&&(r[t]=n),n??0}if(i===iz.OBJECT){let n=e[t];return n&&r&&(r[t]=n),n||0}if(i===iz.ATTRIBUTE){let n=e.getAttribute(t);return n&&r&&(r[t]=n),n}return i===iz.TRANSFORM?xB(e,t,r):i===iz.CSS_VAR?PB(e,t,r).trimStart():PB(e,t,r)},IB=(e,t,n)=>n===`-`?e-t:n===`+`?e+t:e*t,LB=()=>({t:az.NUMBER,n:0,u:null,o:null,d:null,s:null}),RB=(e,t)=>{if(t.t=az.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(` `)&&kz.exec(r);if(i)return t.t=az.UNIT,t.n=+i[1],t.u=i[2],t;if(t.o)return t.n=+r,t;if(Xz(r))return t.t=az.COLOR,t.d=kB(r),t;{let e=r.match(Oz);return t.t=az.COMPLEX,t.d=e?e.map(Number):[],t.s=r.split(Oz)||[],t}},zB=(e,t)=>(t.t=e._valueType,t.n=e._toNumber,t.u=e._unit,t.o=null,t.d=gB(e._toNumbers),t.s=gB(e._strings),t),BB=LB(),VB=(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(fB(pB(i[c],a[c],t),n)),u=o[c+1];s+=`${u?l+u:l}`,e._numbers[c]=l}return s},HB=(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=dB(g,-h,o),b=dB(v,-h,o),x=v-g,S=b>0,C=b>=o,w=o<=pz,T=i===oz.FORCE,E=0,D=v,O=0;if(l>1){let t=c+(C?0:d),n=~~(b/t);e._currentIteration=dB(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===oz.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)>=Pz.tickThreshold,i=fB(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!==sz.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=dB(j-o._startTime,0,a),n=o._ease(t/o._updateDuration),i=o._modifier,f=o._valueType,p=o._tweenType,m=p===iz.OBJECT,g=f===az.NUMBER,_=g&&m||n===0||n===1?-1:Pz.precision,v,y;if(g)v=y=i(fB(pB(o._fromNumber,o._toNumber,n),_));else if(f===az.UNIT)y=i(fB(pB(o._fromNumber,o._toNumber,n),_)),v=`${y}${o._unit}`;else if(f===az.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(pB(t[3],a[3],n)),(!o._setter||r)&&(v=`rgba(${fB(e[0],0)},${fB(e[1],0)},${fB(e[2],0)},${e[3]})`)}else f===az.COMPLEX&&(v=VB(o,n,_));if(h&&(o._number=y),!r&&e!==sz.blend){let e=o.property;s=o.target,o._setter?o._setter(s,y,o):m?s[e]=v:p===iz.ATTRIBUTE?s.setAttribute(e,v):(c=s.style,p===iz.TRANSFORM?(s!==l&&(l=s,u=s[dz]),u[e]=v,d=1):p===iz.CSS?c[e]=v:p===iz.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=SB(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},UB=(e,t,n,r,i)=>{let a=e._currentIteration;if(HB(e,t,n,r,i),e._hasChildren){let o=e,s=o.backwards,c=r?t:o._iterationTime,l=Rz(),u=0,d=!0;if(!r&&o._currentIteration!==a){let e=o.iterationDuration;vB(o,t=>{if(!s)!t.completed&&!t.backwards&&t._currentTime<t.iterationDuration&&HB(t,e,n,1,oz.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)}vB(o,e=>{let t=fB((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+=HB(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))))}},WB={},GB=(e,t,n)=>{if(n===iz.TRANSFORM)return _z.get(e)||e;if(n===iz.CSS||n===iz.ATTRIBUTE&&Kz(t)&&e in t.style){let t=WB[e];if(t)return t;{let t=e&&Iz(e);return WB[e]=t,t}}return e},KB=(e,t=!1)=>{if(e._hasChildren)vB(e,e=>KB(e,t),!0);else{let n=e;n.pause(),vB(n,e=>{let r=e.property,i=e.target,a=e._tweenType,o=e._inlineValue,s=Gz(o)||o===``;if(e._setter){if(!t&&!s){if(RB(o,BB),BB.d){let t=BB.d,n=e._numbers;for(let e=0,r=t.length;e<r;e++)n[e]=t[e]}else e._number=BB.n;e._setter(e.target,e._number,e)}}else if(a===iz.OBJECT)!t&&!s&&(i[r]=o);else if(i[lz]){if(a===iz.ATTRIBUTE)t||(s?i.removeAttribute(r):i.setAttribute(r,o));else{let t=i.style;if(a===iz.TRANSFORM){let n=i[dz];s?delete n[r]:n[r]=o,e._renderTransforms&&(Object.keys(n).length?t.transform=SB(n):t.removeProperty(`transform`))}else s?t.removeProperty(Iz(r)):t[r]=o}}i[lz]&&n._tail===e&&n.targets.forEach(e=>{e.getAttribute&&e.getAttribute(`style`)===``&&e.removeAttribute(`style`)})})}return e},qB=class{constructor(e=0){this.deltaTime=0,this._currentTime=e,this._lastTickTime=e,this._startTime=e,this._lastTime=e,this._frameDuration=hz/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?pz:t,r=hz/n;n>Mz.frameRate&&(Mz.frameRate=n),this._fps=n,this._frameDuration=r}get speed(){return this._speed}set speed(e){let t=+e;this._speed=t<1e-11?pz:t}requestTick(e){let t=this._frameDuration,n=e-this._lastTickTime,r=t*.25;return n+(r<4?r:4)<t?oz.NONE:(this._lastTickTime=n>=t?e-n%t:e,oz.AUTO)}computeDeltaTime(e){let t=e-this._lastTime;return this.deltaTime=t,this._lastTime=e,t}},JB={animation:null,update:bz},YB=e=>{let t=JB.animation;return t||(t={duration:pz,computeDeltaTime:bz,_offset:0,_delay:0,_head:null,_tail:null},JB.animation=t,JB.update=()=>{e.forEach(e=>{for(let t in e){let n=e[t],r=n._head;if(r){let e=r._valueType,t=e===az.COMPLEX||e===az.COLOR?gB(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}}}),HB(t,1,1,0,oz.FORCE)}),t},XB=tz?requestAnimationFrame:setImmediate,ZB=tz?cancelAnimationFrame:clearImmediate,QB=class extends qB{constructor(e){super(e),this.useDefaultMainLoop=!0,this.pauseOnDocumentHidden=!0,this.defaults=Mz,this.paused=!0,this.reqId=0}update(){let e=this._currentTime=Rz();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?(yB(this,r),this._hasChildren=!!this._tail,r._running=!1,r.completed&&!r._cancelled&&r.cancel()):UB(r,(e-r._startTime)*r._speed*t,0,0,r._fps<n?r.requestTick(e):oz.AUTO),r=i}JB.update()}}wake(){return this.useDefaultMainLoop&&!this.reqId&&(this.requestTick(Rz()),this.reqId=XB(eV)),this}pause(){if(this.reqId)return this.paused=!0,tV()}resume(){if(this.paused)return this.paused=!1,vB(this,e=>e.resetTime()),this.wake()}get speed(){return this._speed*(Pz.timeScale===1?1:hz)}set speed(e){let t=e*Pz.timeScale;this._speed!==t&&(this._speed=t,vB(this,e=>e.speed=e._speed))}get timeUnit(){return Pz.timeScale===1?`ms`:`s`}set timeUnit(e){let t=.001,n=e===`s`,r=n?t:1;if(Pz.timeScale!==r){Pz.timeScale=r,Pz.tickThreshold=200*r;let e=n?t:hz;this.defaults.duration*=e,this._speed*=e}}get precision(){return Pz.precision}set precision(e){Pz.precision=e}},$B=(()=>{let e=new QB(Rz());return tz&&(Fz.engine=e,rz.addEventListener(`visibilitychange`,()=>{e.pauseOnDocumentHidden&&(rz.hidden?e.pause():e.resume())})),e})(),eV=()=>{$B._head?($B.reqId=XB(eV),$B.update()):$B.reqId=0},tV=()=>(ZB($B.reqId),$B.reqId=0,$B),nV={_rep:new WeakMap,_add:new Map},rV=(e,t,n=`_rep`)=>{let r=nV[n],i=r.get(e);return i||(i={},r.set(e,i)),i[t]?i[t]:i[t]={_head:null,_tail:null}},iV=(e,t)=>e._isOverridden||e._absoluteStartTime>t._absoluteStartTime,aV=e=>{e._isOverlapped=1,e._isOverridden=1,e._changeDuration=pz,e._currentTime=pz},oV=(e,t)=>{let n=e._composition;if(n===sz.replace){let n=e._absoluteStartTime;bB(t,e,iV,`_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){aV(r);let e=r._prevRep;for(;e&&e.parent.id===t.id;)aV(e),e=e._prevRep}let a=e._absoluteUpdateStartTime;if(i>a){let e=r._startTime,t=fB(a-(i-(e+r._updateDuration))-e,12);r._changeDuration=t,r._currentTime=t,r._isOverlapped=1,t<1e-11&&aV(r)}let o=e.parent.parent;if(!o||o!==t.parent){let e=!0;if(vB(t,t=>{t._isOverlapped||(e=!1)}),e){let e=t.parent;if(e){let n=!0;vB(e,e=>{e!==t&&vB(e,e=>{e._isOverlapped||(n=!1)})}),n&&e.cancel()}else t.cancel()}}}}else if(n===sz.blend){let t=rV(e.target,e.property,`_add`),n=YB(nV._add),r=t._head;r||(r={...e},r._composition=sz.replace,r._updateDuration=pz,r._startTime=0,r._numbers=gB(e._fromNumbers),r._number=0,r._next=null,r._prev=null,bB(t,r),bB(n,r));let i=e._toNumber;if(e._fromNumber=r._fromNumber-i,e._toNumber=0,e._numbers=gB(e._fromNumbers),e._number=0,r._fromNumber=i,e._toNumbers.length){let t=gB(e._toNumbers);t.forEach((t,n)=>{e._fromNumbers[n]=r._fromNumbers[n]-t,e._toNumbers[n]=0}),r._fromNumbers=t}bB(t,e,null,`_prevAdd`,`_nextAdd`)}return e},sV=e=>{let t=e._composition;if(t!==sz.none){let n=e.target,r=e.property,i=nV._rep.get(n)[r];if(yB(i,e,`_prevRep`,`_nextRep`),t===sz.blend){let t=nV._add,i=t.get(n);if(!i)return;let a=i[r],o=JB.animation;yB(a,e,`_prevAdd`,`_nextAdd`);let s=a._head;if(s&&s===a._tail){yB(a,s,`_prevAdd`,`_nextAdd`),yB(o,s);let e=!0;for(let t in i)if(i[t]._head){e=!1;break}e&&t.delete(n)}}}return e},cV=e=>(e.paused=!0,e.began=!1,e.completed=!1,e),lV=e=>e._cancelled?(e._hasChildren?vB(e,lV):vB(e,e=>{e._composition!==sz.none&&oV(e,rV(e.target,e.property))}),e._cancelled=0,e):e,uV=0,dV=(e,t)=>e._priority>t._priority,fV=class extends qB{constructor(e={},t=null,n=0){super(0),++uV;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;Nz.current&&Nz.current.register(this);let b=t?0:$B._lastTickTime,x=t?t.defaults:Pz.defaults,S=Uz(i)||Wz(i)?x.delay:+i,C=Uz(a)||Wz(a)?1/0:+a,w=AB(c,x.loop),T=AB(l,x.loopDelay),E=w===!0||w===1/0||w<0?1/0:w+1,D=0;t?D=n:($B.reqId||$B.requestTick(Rz()),D=($B._lastTickTime-$B._startTime)*Pz.timeScale),this.id=Wz(r)?uV:r,this.parent=t,this.duration=mB((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&&AB(u,x.autoplay),this._offset=D,this._delay=S,this._loopDelay=T,this._iterationTime=0,this._currentIteration=0,this._resolve=bz,this._running=!1,this._reversed=+AB(o,x.reversed),this._reverse=this._reversed,this._cancelled=0,this._alternate=AB(s,x.alternate),this._prev=null,this._next=null,this._lastTickTime=b,this._startTime=b,this._lastTime=b,this._fps=AB(d,x.frameRate),this._speed=AB(f,x.playbackRate),this._priority=+AB(p,1)}get cancelled(){return!!this._cancelled}set cancelled(e){e?this.cancel():this.reset(!0).play()}get currentTime(){return dB(fB(this._currentTime,Pz.precision),-this._delay,this.duration)}set currentTime(e){let t=this.paused;this.pause().seek(+e),t||this.resume()}get iterationCurrentTime(){return dB(fB(this._iterationTime,Pz.precision),0,this.iterationDuration)}set iterationCurrentTime(e){this.currentTime=this.iterationDuration*this._currentIteration+e}get progress(){return dB(fB(this._currentTime/this.duration,10),0,1)}set progress(e){this.currentTime=this.duration*e}get iterationProgress(){return dB(fB(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*dB(+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 lV(this),this._reversed&&!this._reverse&&(this.reversed=!1),this._iterationTime=this.iterationDuration,UB(this,0,1,~~e,oz.FORCE),cV(this),this._hasChildren&&vB(this,cV),this}init(e=!1){this.fps=this._fps,this.speed=this._speed,!e&&this._hasChildren&&UB(this,this.duration,1,~~e,oz.FORCE),this.reset(e);let t=this._autoplay;return t===!0?this.resume():t&&!Wz(t.linked)&&t.link(this),this}resetTime(){let e=1/(this._speed*$B._speed);return this._startTime=Rz()-(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?UB(this,pz,0,0,oz.FORCE):(this._running||=(bB($B,this,dV),$B._hasChildren=!0,!0),this.resetTime(),this._startTime-=12,$B.wake()),this):this}restart(){return this.reset().resume()}seek(e,t=0,n=0){lV(this),this.completed=!1;let r=this.paused;return this.paused=!0,UB(this,e+this._delay,~~t,~~n,oz.AUTO),r?this:this.resume()}alternate(){let e=this._reversed,t=this.iterationCount,n=this.iterationDuration,r=t===1/0?sB(mz/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?vB(this,e=>e.cancel(),!0):vB(this,sV),this._cancelled=1,this.pause()}stretch(e){let t=this.duration,n=hB(e);if(t===n)return this;let r=e/t,i=e<=pz;return this.duration=i?pz:n,this.iterationDuration=i?pz:hB(this.iterationDuration*r),this._offset*=r,this._delay*=r,this._loopDelay*=r,this}revert(){UB(this,0,1,0,oz.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=bz){let t=this.then,n=()=>{this.then=null,e(this),this.then=t,this._resolve=bz};return new Promise(e=>(this._resolve=()=>e(n()),this.completed&&this._resolve(),this))}};function pV(e){let t=Hz(e)?Nz.root.querySelectorAll(e):e;if(t instanceof NodeList||t instanceof HTMLCollection)return t}function mV(e){if(Gz(e))return[];if(!tz)return zz(e)&&e.flat(1/0)||[e];if(zz(e)){let t=e.flat(1/0),n=[];for(let e=0,r=t.length;e<r;e++){let r=t[e];if(!Gz(r)){let e=pV(r);if(e)for(let t=0,r=e.length;t<r;t++){let r=e[t];if(!Gz(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=pV(e);return t?Array.from(t):[e]}function hV(e){let t=mV(e),n=t.length;for(let e=0;e<n;e++){let n=t[e];if(!n[cz]){n[cz]=!0;let e=Kz(n);(n.nodeType||e)&&(n[lz]=!0,n[uz]=e,n[dz]={})}}return t}var gV={deg:1,rad:180/lB,turn:360},_V={},vV=(e,t,n,r=!1)=>{let i=t.u,a=t.n;if(t.t===az.UNIT&&i===n)return t;let o=a+i+n,s=_V[o];if(!Wz(s)&&!r)t.n=s;else{let r;if(i in gV)r=a*gV[i]/gV[n];else{let t=e.cloneNode(),o=e.parentNode,s=o&&o!==rz?o:rz.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,_V[o]=r}return t.t,az.UNIT,t.u=n,t},yV=e=>e,bV=(e=1.68)=>t=>eB(t,+e),xV={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},SV=lB/2,CV=lB*2,wV={"":bV,Quad:bV(2),Cubic:bV(3),Quart:bV(4),Quint:bV(5),Sine:e=>1-rB(e*SV),Circ:e=>1-tB(1-e*e),Expo:e=>e?eB(2,10*e-10):0,Bounce:e=>{let t,n=4;for(;e<((t=eB(2,--n))-1)/11;);return 1/eB(4,3-n)-7.5625*eB((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=dB(+e,1,10),r=dB(+t,pz,2),i=r/CV*cB(1/n),a=CV/r;return e=>e===0||e===1?e:-n*eB(2,-10*(1-e))*nB((1-e-i)*a)}},TV=(()=>{let e={linear:yV,none:yV};for(let t in xV)for(let n in wV){let r=wV[n],i=xV[t];e[t+n]=n===``||n===`Back`||n===`Elastic`?(e,t)=>i(r(e,t)):i(r)}return e})(),EV={linear:yV,none:yV},DV=e=>{if(EV[e])return EV[e];if(e.indexOf(`(`)<=-1){let t=xV[e]||e.includes(`Back`)||e.includes(`Elastic`)?TV[e]():TV[e];return t?EV[e]=t:yV}{let t=e.slice(0,-1).split(`(`),n=TV[t[0]];return n?EV[e]=n(...t[1].split(`,`)):yV}},OV=[`steps(`,`irregular(`,`linear(`,`cubicBezier(`],kV=e=>{if(Hz(e)){for(let t=0,n=OV.length;t<n;t++)if(Lz(e,OV[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}\``),yV}return Uz(e)?e:Hz(e)?DV(e):yV},AV=LB(),jV=LB(),MV={},NV={func:null},PV={func:null},FV=[null],IV=[null,null],LV={to:null},RV=0,zV=0,BV,VV,HV=(e,t)=>{let n={};if(zz(e)){let t=[].concat(...e.map(e=>Object.keys(e))).filter(Zz);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];Zz(n)?n===i&&(t.to=r):t[n]=r}return t})}}else{let r=AB(t.duration,Pz.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(Zz(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},UV=class extends fV{constructor(e,t,n,r,i=!1,a=0,o){super(t,n,r),this._head,this._tail,++zV;let s=hV(e),c=s.length,l=t.keyframes,u=l?_B(HV(l,t),t):t,{id:d,delay:f,duration:p,ease:m,playbackEase:h,modifier:g,composition:_,onRender:v}=u,y=n?n.defaults:Pz.defaults,b=AB(m,y.ease),x=AB(h,y.playbackEase),S=x?kV(x):null,C=!Wz(b.ease),w=C?b.ease:AB(m,S?`linear`:y.ease),T=C?b.settlingDuration:AB(p,y.duration),E=AB(f,y.delay),D=g||y.modifier,O=Wz(_)&&c>=1e3?sz.none:Wz(_)?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(Zz(e)){let a=NB(t,e),o=wB(t,e),s=GB(e,t,a),f=u[e],p=zz(f);if(i&&!p&&(IV[0]=f,IV[1]=f,f=IV),p){let e=f.length,t=!Bz(f[0]);e===2&&t?(LV.to=f,FV[0]=LV,BV=FV):e>2&&t?(BV=[],f.forEach((e,t)=>{t?t===1?(IV[1]=e,BV.push(IV)):BV.push(e):IV[0]=e})):BV=f}else FV[0]=f,BV=FV;let m=null,h=null,g=NaN,_=0,v=0;for(let e=BV.length;v<e;v++){let i=BV[v];Bz(i)?VV=i:(LV.to=i,VV=LV),NV.func=null,PV.func=null;let l=MB(AB(VV.composition,O),t,r,c,null,null),u=Vz(l)?l:sz[l];!m&&u!==sz.none&&(m=rV(t,s));let d=m?m._tail:null,f=n&&d&&d.parent.parent===n?d:h,p=MB(VV.to,t,r,c,NV,f),y;Bz(p)&&!Wz(p.to)?(VV=p,y=p.to):y=p;let b=MB(VV.from,t,r,c,PV,f),x=VV.ease||w,S=MB(x,t,r,c,null,f),C=Uz(S)||Hz(S)?S:x,A=!Wz(C)&&!Wz(C.ease),j=A?C.ease:C,P=A?C.settlingDuration:MB(AB(VV.duration,e>1?MB(T,t,r,c,null,f)/e:T),t,r,c,null,f),F=MB(AB(VV.delay,v?0:E),t,r,c,null,f),I=VV.modifier||D,L=!Wz(b),R=!Wz(y),z=zz(y),ee=z||L&&R,te=h?_:0,B=h?_+F:F,ne=fB(k+B,12),re=fB(k+te,12);!N&&(L||z)&&(N=1);let V=h;if(u!==sz.none){let e=m._head;for(;e&&e._absoluteStartTime<=ne;)if(e._isOverridden||(V=e),e=e._nextRep,e&&e._absoluteStartTime>=ne)for(;e;)aV(e),e=e._nextRep}if(ee){RB(z?MB(y[0],t,r,c,PV,f):b,AV),RB(z?MB(y[1],t,r,c,NV,f):y,jV);let e=FB(t,s,a,MV);AV.t===az.NUMBER&&(V?V._valueType===az.UNIT&&(AV.t=az.UNIT,AV.u=V._unit):(RB(e,BB),BB.t===az.UNIT&&(AV.t=az.UNIT,AV.u=BB.u)))}else R?RB(y,jV):h?zB(h,jV):RB(n&&V&&V.parent.parent===n?V._value:FB(t,s,a,MV),jV),L?RB(b,AV):h?zB(h,AV):RB(n&&V&&V.parent.parent===n?V._value:FB(t,s,a,MV),AV);if(AV.o&&(AV.n=IB(V?V._toNumber:RB(FB(t,s,a,MV),BB).n,AV.n,AV.o)),jV.o&&(jV.n=IB(AV.n,jV.n,jV.o)),AV.t!==jV.t){if(AV.t===az.COMPLEX||jV.t===az.COMPLEX){let e=AV.t===az.COMPLEX?AV:jV,t=AV.t===az.COMPLEX?jV:AV;t.t=az.COMPLEX,t.s=gB(e.s),t.d=e.d.map(()=>t.n)}else if(AV.t===az.UNIT||jV.t===az.UNIT){let e=AV.t===az.UNIT?AV:jV,t=AV.t===az.UNIT?jV:AV;t.t=az.UNIT,t.u=e.u}else if(AV.t===az.COLOR||jV.t===az.COLOR){let e=AV.t===az.COLOR?AV:jV,t=AV.t===az.COLOR?jV:AV;t.t=az.COLOR,t.d=e.d.map(()=>0)}}if(AV.u!==jV.u){let e=jV.u?AV:jV;e=vV(t,e,jV.u?jV.u:AV.u,!1)}if(jV.d&&AV.d&&jV.d.length!==AV.d.length){let e=AV.d.length>jV.d.length?AV:jV,t=e===AV?jV:AV;t.d=e.d.map((e,n)=>Wz(t.d[n])?0:t.d[n]),t.s=gB(e.s)}let H=fB(+P||1e-11,12),ie=MV[s];Gz(ie)||(MV[s]=null);let ae=o?o.set:null;_=fB(B+H,12);let oe=AV.d,se=jV.d,ce=jV.s,le={parent:this,id:RV++,property:s,target:t,_value:null,_toFunc:NV.func,_fromFunc:PV.func,_ease:kV(j),_fromNumbers:oe?gB(oe):gz,_toNumbers:se?gB(se):gz,_strings:ce?gB(ce):gz,_fromNumber:AV.n,_toNumber:jV.n,_numbers:oe?gB(oe):gz,_number:AV.n,_unit:jV.u,_modifier:I,_currentTime:0,_startTime:B,_delay:+F,_updateDuration:H,_changeDuration:H,_absoluteStartTime:ne,_absoluteUpdateStartTime:re,_absoluteEndTime:fB(k+_,12),_hasFromValue:L||z?1:0,_tweenType:a,_setter:ae,_valueType:jV.t,_composition:u,_isOverlapped:0,_isOverridden:0,_renderTransforms:0,_inlineValue:ie,_prevRep:null,_nextRep:null,_prevAdd:null,_nextAdd:null,_prev:null,_next:null};u!==sz.none&&oV(le,m);let ue=le._valueType;if(ue===az.COMPLEX)le._value=VB(le,1,-1);else if(ue===az.UNIT)le._value=`${I(le._toNumber)}${le._unit}`;else if(ue===az.COLOR){let e=jV.d;le._value=`rgba(${fB(e[0],0)},${fB(e[1],0)},${fB(e[2],0)},${e[3]})`}else le._value=I(le._toNumber);isNaN(g)&&(g=le._startTime),h=le,M++,bB(this,le)}(isNaN(j)||g<j)&&(j=g),(isNaN(A)||_>A)&&(A=_),a===iz.TRANSFORM&&(l=M-v,d=M)}if(!isNaN(l)){let e=0;vB(this,t=>{e>=l&&e<d&&(t._renderTransforms=1,t._composition===sz.blend&&vB(JB.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?(vB(this,e=>{e._startTime-e._delay||(e._delay-=j),e._startTime-=j}),A-=j):j=0,A||(A=pz,this.iterationCount=0),this.targets=s,this.id=Wz(d)?zV:d,this.duration=A===1e-11?pz:mB((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===hB(e))return this;let n=e/t;return vB(this,e=>{e._updateDuration=hB(e._updateDuration*n),e._changeDuration=hB(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 vB(this,e=>{let t=e._toFunc,n=e._fromFunc;(t||n)&&(n?(RB(n(),AV),AV.u!==e._unit&&e.target[lz]&&vV(e.target,AV,e._unit,!0),e._fromNumbers=gB(AV.d),e._fromNumber=AV.n):t&&(RB(FB(e.target,e.property,e._tweenType),BB),e._fromNumbers=gB(BB.d),e._fromNumber=BB.n),t&&(RB(t(),jV),e._toNumbers=gB(jV.d),e._strings=gB(jV.s),e._toNumber=jV.o?IB(e._fromNumber,jV.n,jV.o):jV.n))}),this.duration===1e-11&&this.restart(),this}revert(){return super.revert(),KB(this)}then(e){return super.then(e)}},WV=(e,t)=>Pz.editor?Pz.editor.addAnimation(e,t):new UV(e,t,null,0,!1).init(),GV=hz*10,KV=class{constructor(e={}){let t=!Wz(e.bounce)||!Wz(e.duration);this.timeStep=.02,this.restThreshold=5e-4,this.restDuration=200,this.maxDuration=6e4,this.maxRestSteps=this.restDuration/this.timeStep/hz,this.maxIterations=this.maxDuration/this.timeStep/hz,this.bn=dB(AB(e.bounce,.5),-1,1),this.pd=dB(AB(e.duration,628),10*Pz.timeScale,GV*Pz.timeScale),this.m=dB(AB(e.mass,1),1,GV),this.s=dB(AB(e.stiffness,100),pz,GV),this.d=dB(AB(e.damping,10),pz,GV),this.v=dB(AB(e.velocity,0),-GV,GV),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||bz,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?aB(-a*t*n)*(1*rB(r*a)+i*nB(r*a)):t===1?(1+i*a)*aB(-a*n):((1+i)*aB((-t*n+r)*a)+(1-i)*aB((-t*n-r)*a))/2,1-a}calculateSDFromBD(){let e=Pz.timeScale===1?this.pd/hz:this.pd;this.m=1,this.v=0,this.s=eB(2*lB/e,2),this.d=this.bn>=0?(1-this.bn)*4*lB/e:4*lB/(e*(1+this.bn)),this.s=fB(dB(this.s,pz,GV),3),this.d=fB(dB(this.d,pz,300),3)}calculateBDFromSD(){let e=2*lB/tB(this.s);this.pd=e*(Pz.timeScale===1?hz:1),this.bn=this.d/(2*tB(this.s))<=1?1-this.d*e/(4*lB):4*lB/(this.d*e)-1,this.bn=fB(dB(this.bn,-1,1),3),this.pd=fB(dB(this.pd,10*Pz.timeScale,GV*Pz.timeScale),3)}compute(){let{maxRestSteps:e,maxIterations:t,restThreshold:n,timeStep:r,m:i,d:a,s:o,v:s}=this,c=this.w0=dB(tB(o/i),pz,hz),l=this.zeta=a/(2*tB(o*i));l<1?(this.wd=c*tB(1-l*l),this.b=(l*c+-s)/this.wd):l===1?(this.wd=0,this.b=-s+c):(this.wd=c*tB(l*l-1),this.b=(l*c+-s)/this.wd);let u=0,d=0,f=0;for(;d<=e&&f<=t;)iB(1-this.solve(u))<n?d++:d=0,this.solverDuration=u,u+=r,f++;this.settlingDuration=fB(this.solverDuration*hz,0)*Pz.timeScale}get bounce(){return this.bn}set bounce(e){this.bn=dB(AB(e,1),-1,1),this.calculateSDFromBD(),this.compute()}get duration(){return this.pd}set duration(e){this.pd=dB(AB(e,1),10*Pz.timeScale,GV*Pz.timeScale),this.calculateSDFromBD(),this.compute()}get stiffness(){return this.s}set stiffness(e){this.s=dB(AB(e,100),pz,GV),this.calculateBDFromSD(),this.compute()}get damping(){return this.d}set damping(e){this.d=dB(AB(e,10),pz,GV),this.calculateBDFromSD(),this.compute()}get mass(){return this.m}set mass(e){this.m=dB(AB(e,1),1,GV),this.compute()}get velocity(){return this.v}set velocity(e){this.v=dB(AB(e,0),-GV,GV),this.compute()}},qV=e=>new KV(e),JV=(e=10,t)=>{let n=t?oB:sB;return t=>n(dB(t,0,1)*e)*(1/e)},YV=s({animate:()=>WV,spring:()=>qV}),XV=(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 ZV({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 QV({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 $V=Object.freeze({alphaIntercept:-8,alphaSlope:18,blurStdDeviation:2});function eH({id:e,values:t=eL}){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 tH(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 nH(e){let t=Math.max(0,Math.min(1,e));return t*t*(3-2*t)}function rH(e,t){let n=Math.max(0,Math.min(1,(t-(e-1)*.085)/.68));return Math.sin(n*Math.PI)**2}function iH(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=nH(n/.66)*Math.PI*2,o=Math.min(e,t*Math.PI/8)-Math.PI/2,s=nH((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+rH(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=rH(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 aH={line:1700,square:1900,donut:3e3,wander:4600,bloom:2800},oH=2;function sH({variant:e,pace:t=`working`}){let n=`caps-loader-${(0,G.useId)().replaceAll(`:`,``)}`,r=(0,G.useRef)(null),i=(0,G.useRef)(null),a=WR(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?[WV(r.current,{opacity:[.55,1],duration:a.slow*10,ease:`inOutSine`,alternate:!0,loop:!0})]:[...r.current.querySelectorAll(`ellipse`)].map((n,r)=>WV(n,{keyframes:Array.from({length:48},(n,i)=>({...iH(e,r,(i+1)/48),duration:GR(a,aH[e]*(t===`idle`?oH:1))/48})),ease:`linear`,loop:!0})),s=tH(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)(eH,{id:n,values:$V}),(0,Z.jsx)(XV,{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)(ZV,{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`,{...iH(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 cH={sm:`caps-loader-sm`,md:`caps-loader-md`,lg:`caps-loader-lg`,fill:`caps-loader-fill`},lH={neutral:`text-base-content`,accent:`text-accent`,primary:`text-primary`,success:`text-success`,current:`text-current`},uH=(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`,cH[a],lH[c],n),"data-variant":o,"data-pace":s,role:r?void 0:`status`,ref:u,children:[(0,Z.jsx)(sH,{variant:o,pace:s}),f?(0,Z.jsx)(RR,{id:d,children:i}):null]})}),dH=Object.freeze({ease:`linear`,duration:0});function fH(e,t){let n=qR(e,t.duration);return n<=0?dH:e.steps>0?{ease:JV(e.steps),duration:n}:{ease:qV({bounce:KR(e,t.bounce),duration:n}),duration:n}}function pH(e,t){let n=GR(e,t.duration);return{ease:e.steps>0?JV(e.steps):t.ease,duration:n}}var mH={dot:{y:-4,height:8,cy:0},pill:{y:-16,height:32,cy:0},bang:{y:-16,height:20,cy:12}};function hH({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)(mH[t]).current,d=(0,G.useRef)(t===`dot`?1:4).current,f=(0,G.useRef)(+(t===`bang`)).current,p=(0,G.useRef)(t),m=WR(s),{reduced:h}=m;return(0,G.useLayoutEffect)(()=>{if(!i.current||!a.current||!c.current||!l.current)return;let e=mH[t],n=h||p.current===t;p.current=t;let r=VR(i.current),o=n?{duration:0}:fH(r,{bounce:.3,duration:360}),s=WV(i.current,{y:e.y,height:e.height,...o}),u=WV(a.current,{cy:e.cy,...n?{duration:0}:{delay:GR(r,35),...fH(r,{bounce:.3,duration:420})}}),d=WV(c.current,{gradientTransform:`matrix(1 0 0 ${t===`dot`?`1`:`4`} 0 0)`,...o}),f=WV(l.current,{opacity:+(t===`bang`),...n?dH:pH(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`?WV(o.current,{opacity:[1,.45],...pH(m,{ease:`inOutSine`,duration:750}),alternate:!0,loop:!0}):WV(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}},...pH(m,{ease:`inOutSine`,duration:1e3}),loop:!0}),t=tH(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)(eH,{id:r,values:$V}),(0,Z.jsx)(XV,{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)(ZV,{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 gH=.28;function _H(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?gH: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 vH=7.25;function yH({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)(_H(t,n)).current,p=(0,G.useRef)(t),m=ez();(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=_H(t,n),y=p.current;p.current=t;let b=VR(e),x=m||y===t&&t!==`arc`,S=x?m?{ease:b.ease,duration:b.fast}:dH:pH(b,{ease:`outQuad`,duration:160}),C=(t===`check`||t===`cross`)&&!x,w=pH(b,{ease:`inOutSine`,duration:220}),T=[WV(r,{opacity:v.dashes,...S}),WV(c,{opacity:v.track*.28,...S}),WV(f,{opacity:v.arc,"stroke-dasharray":`${String(v.sweep)} 1`,...x?m?dH:S:w}),WV(h,{r:v.disc*vH,...C?{delay:w.duration*.7,...fH(b,{bounce:.35,duration:360})}:m?dH:pH(b,{ease:`inCubic`,duration:140})}),WV(g,{"stroke-dashoffset":1-v.tick,...C&&v.tick>0?{delay:w.duration*.7+b.fast,...pH(b,{ease:`outCubic`,duration:240})}:dH}),WV(_,{"stroke-dashoffset":1-v.cross,...C&&v.cross>0?{delay:w.duration*.7+b.fast,...pH(b,{ease:`outCubic`,duration:240})}:dH})];return t===`cross`&&C&&b.shake>0&&T.push(WV(e,{translateX:[0,-b.shake,b.shake,-b.shake/2,0],delay:w.duration+b.fast,...pH(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=VR(i.current),t=WV(c.current,{rotate:[0,360],...pH(e,{ease:`linear`,duration:900}),loop:!0}),n=tH(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)(XV,{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*vH,fill:`url(#${r}-surface)`,mask:`url(#${r}-knock)`})]})}var bH=new Set([`ring`,`arc`,`check`,`cross`]);function xH(e){return bH.has(e)}var SH={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`},CH=(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:[xH(n)?(0,Z.jsx)(yH,{className:SH[i],glyph:n,progress:s}):(0,Z.jsx)(hH,{className:SH[i],glyph:n,motion:r}),t===void 0?null:(0,Z.jsx)(`span`,{children:t})]})}),wH=(0,G.createContext)(void 0),TH=(0,G.createContext)(null);function EH(e){let t=(0,G.useContext)(TH);return t===null?Object.hasOwn(globalThis,`document`)?document.body:null:t[e]}function DH(e){let t=(0,G.useContext)(wH),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,GF.createPortal)((0,Z.jsx)(CI,{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)($I,{"aria-hidden":`true`,size:12}),success:(0,Z.jsx)(CH,{glyph:`dot`,tone:`success`}),error:(0,Z.jsx)(CH,{glyph:`dot`,tone:`error`}),warning:(0,Z.jsx)(CH,{glyph:`dot`,tone:`warning`}),info:(0,Z.jsx)(CH,{glyph:`dot`,tone:`info`}),loading:(0,Z.jsx)(uH,{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){cI.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=Wx(tS.pipe(Y(NS(1)),Y(IS(zH)),Y(gS(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:oS(tS.pipe(Y(IS(zH)))).pipe(Y(NS(1))),offset:nS.pipe(Y(jS()),Y(OS(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(aP).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=>eP.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 Kw({queryKey:sU.listing(e,oU(t)),initialPageParam:i,enabled:!!(n&&r&&e.capabilities.has(EF)&&e.capabilities.has(RF)),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 BF(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{...rP(e,RF,[...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 zF(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(RF)),structuralSharing:!1}}function mU(e,t){let n=e?.app??null,r=kN(n),i=yC(),[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=Zw(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=Hw({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:RS});var vU=tS.pipe(Y(IS(4096)),Y(gS(e=>e.startsWith(`/`)&&e!==`/`&&!e.includes(`\0`)&&!e.endsWith(`/`)&&!e.split(`/`).some(e=>e===`.`||e===`..`))));J({path:uS(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=>tS.pipe(Y(NS(1)),Y(IS(e))),CU=J({requestId:SU(256),computerId:SU(256)}),wU=nS.pipe(Y(jS()),Y(gS(Number.isSafeInteger,{message:`Expected a safe integer`}))),TU=wU.pipe(Y(DS(0))),EU=wU.pipe(Y(OS(0))),DU=nS.pipe(Y(xS()),Y(OS(0))),OU=nS.pipe(Y(xS()),Y(DS(0))),kU=lS([`first-frame`,`last-frame`,`reference`]),AU=lS([`480p`,`720p`,`768p`,`1080p`,`4k`]),jU=lS([`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:uS(EU),defaultWidth:TU,dimensions:lS([`none`,`own`]),guidance:uS(J({default:DU,max:OU,min:DU})).pipe(Xx),maxDimension:uS(TU),maxDimensionDocumented:rS,maxReferences:EU,maxSteps:uS(TU),referenceDimension:uS(TU),referenceField:uS(SU(256)),referenceFormat:lS([`png`,`webp`]),steps:lS([`steps`,`num_steps`,`fixed`]),transport:lS([`json`,`multipart`])}),IU=J({minSeconds:TU,maxSeconds:TU,defaultSeconds:TU,durations:oS(TU),provider:lS([`seedance`,`veo`,`minimax`]),formats:oS(J({resolution:AU,aspectRatio:jU,width:TU,height:TU})),defaultResolution:AU,defaultAspectRatio:jU,supportsAudio:rS,defaultGenerateAudio:uS(rS),referenceRoles:oS(kU),maxReferenceImages:EU,audioReferences:uS(J({max:TU,totalSeconds:TU})),referenceResolutions:oS(AU),prices:oS(J({resolution:AU,silentMilliunitsPerSecond:TU,audioMilliunitsPerSecond:TU}))}),LU=J({provider:Zx(`elevenlabs`),mode:lS([`speech`,`music`]),voices:oS(J({id:SU(64),label:SU(128)})),defaultVoiceId:uS(SU(64)),seconds:uS(J({min:TU,max:TU,default:TU})),milliunitsPerUnit:TU}),RU=J({operation:lS([`remove_background`,`upscale`]),source:J({formats:oS(lS([`png`,`jpeg`,`webp`])),maxBytes:TU,maxPixels:TU}),defaultMegapixels:uS(TU),milliunits:uS(TU),sizes:oS(J({megapixels:TU,milliunits:TU}))}),zU=oS(J({id:SU(256),input:FU,kind:lS([`image`,`video`,`audio`]),label:SU(512),maxPromptLength:TU,tier:lS([`draft`,`balanced`,`premium`,`max`]),outputFormats:oS(lS([`png`,`jpeg`,`webp`])).pipe(Y(IS(3))),sizes:uS(oS(tS.pipe(Y(yS(/^\d+x\d+$/u))))),video:uS(IU),audio:uS(LU),transform:uS(RU),billingUnit:lS([`image`,`video_second`,`audio_second`,`audio_character_block`])})),BU=J({[Symbol.dispose]:q(Qx),computerId:SU(256),models:zU,canGenerate:rS}),VU=J({model:SU(256),prompt:SU(32e3),width:q(TU.pipe(Y(kS(5040)))),height:q(TU.pipe(Y(kS(5040)))),voiceId:q(SU(64)),steps:q(TU),durationSeconds:q(TU),targetMegapixels:q(TU),resolution:q(AU),aspectRatio:q(jU),generateAudio:q(rS),references:q(oS(MU).pipe(Y(IS(16))))});J({model:SU(256),prompt:SU(2048),resolution:q(AU),aspectRatio:q(jU),durationSeconds:q(TU.pipe(Y(OS(4)),Y(kS(15)))),generateAudio:q(rS),references:q(oS(NU).pipe(Y(IS(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:Qx}),WU=J({[Symbol.dispose]:q(Qx),bytes:TU,costMilliunits:EU,destination:PU,format:lS([`png`,`jpeg`,`gif`,`webp`,`mp4`,`mp3`]),height:q(TU),model:SU(256),width:q(TU)});J({...WU.fields,format:Zx(`mp4`)});var GU=J({message:SU(512),stage:q(lS(HU)),provider:q(eC),code:lS([`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:rS,need:q(KS)}),KU=cS([J({[Symbol.dispose]:q(Qx),kind:Zx(`succeeded`),result:WU}),J({[Symbol.dispose]:q(Qx),kind:Zx(`failed`),failure:GU})]),qU=IN({reference:RN(LN(Ka().transform(e=>Jx(CU)(e)))),generate:RN(LN(Ka().transform(e=>{let t=Jx(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=FN(`media.generation`,5,Ro(()=>IN({describe:RN(LN(Ka().transform(e=>{let{computerId:t,canGenerate:n,models:r}=Jx(BU,{onExcessProperty:`error`})(e);return{computerId:t,canGenerate:n,models:r}}))),quote:RN(LN(W({costMilliunits:Ra().int().nonnegative().max(2**53-1)}))).optional(),createAttempt:RN(qU),restoreAttempt:RN(qU),cancelAttempt:zN}))),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=FN(`media.share`,1,Ro(()=>IN({status:RN(LN(YU)),share:RN(LN(YU)),stop:RN(LN(YU))})));function ZU(e,t){try{return Jx(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=Jx(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(Jx(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(Jx(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,CM(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=CM(e),a;try{{let t={stack:[],error:void 0,hasError:!1};try{let n=yU(t,CM(await e.reference()),!1),i=ZU(J({...CU.fields,[Symbol.dispose]:q(Qx)}),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,CM(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,CM(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}),lg(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 WF(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(iF))return;let t=!0;return e.capabilities.require(iF).role(sF).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=kN(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(EF)===!0,c=e?.app.capabilities.has(RF)===!0,l=e?.app.capabilities.has(VF)===!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 zF(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=>BF(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=oP+18e4,pW=`4 generations are running. Wait for one to finish.`,mW=J({error:Zx(`generation_limit`),limit:MS,message:tS}),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=Kx(J({code:lS(tC)}));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{...uC(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 uC(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(kM({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(qx(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:tS,width:nS,height:nS,durationSeconds:Xx(dS(nS)),steps:Xx(dS(nS))}).check(gS(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=qx(lG(()=>t))(e);if(Id(r))return Yg()(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(aP).call(t,n)}var xG=RS,SG=oS(RS.pipe(Y(IS(1024)))).pipe(Y(IS(200)));J({computerId:xG}),J({computerId:xG,keys:SG});var CG=Jx(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=Jx(J({path:vU,configured:rS}));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=tS.pipe(Y(NS(1)),Y(IS(64))),NG=tS.pipe(Y(NS(1)),Y(IS(AG))),PG=RS,FG=J({id:MS,name:MG,text:NG,builtIn:rS});J({computerId:PG,id:q(MS),name:MG,text:NG}),J({computerId:PG,id:MS}),J({computerId:PG,path:RS});var IG=J({styles:oS(FG).pipe(Y(IS(50+jG.length)))}),LG=J({style:uS(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=Jx(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 Jx(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=tS.pipe(Y(NS(1)),Y(IS(32)),Y(yS(/^[\p{L}\p{N}_-]+$/u)),Y(yS(/^(?!image\d+$)/iu))),iK=tS.pipe(Y(IS(500))),aK=oS(J({path:RS.pipe(Y(IS(4096)))})).pipe(Y(IS(8))),oK=RS,sK=J({id:MS,name:rK,description:iK,references:aK});J({computerId:oK,id:q(MS),name:rK,description:iK,references:aK}),J({computerId:oK,id:MS});var cK=J({characters:oS(sK).pipe(Y(IS(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=Jx(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=>eP.of(e,`prints`,`models`),folder:e=>eP.of(e,`prints`,`folder`),dismissals:e=>eP.of(e,`prints`,`dismissals`),styles:e=>eP.of(e,`prints`,`styles`),printStyle:(e,t)=>eP.of(e,`prints`,`print-style`,t),characters:e=>eP.of(e,`prints`,`characters`)};function EK(e){return{...rP(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{...rP(e,aP,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(aP))}}function OK(e){let t=e?.context.get().computerId;return{...rP(e,aP,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(aP))}}function kK(e){let t=e?.context.get().computerId;return{...rP(e,aP,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(aP))}}function AK(e,t){let n=e?.context.get().computerId;return{...rP(e,aP,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(aP))}}function jK(e){let t=e?.context.get().computerId;return{...rP(e,aP,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(aP))}}var MK=e=>tS.pipe(Y(NS(1)),Y(IS(e))),NK=nS.pipe(Y(jS()),Y(gS(Number.isSafeInteger,{message:`Expected a safe integer`}))),PK=NK.pipe(Y(DS(0))),FK=J({reference:CU,result:J({bytes:PK,costMilliunits:NK.pipe(Y(OS(0))),destination:J({computerId:MK(256),path:MK(4096)}),format:lS([`png`,`jpeg`,`gif`,`webp`,`mp4`,`mp3`]),height:q(PK),model:MK(256),width:q(PK)}),derivedFrom:q(MK(256)),references:q(oS(uS(MK(256))))}),IK=J({prompt:RS,references:MS.pipe(Y(OS(0)))}),LK=J({reason:lS([...tC,`UNKNOWN`]),message:RS.pipe(Y(IS(512)))}),RK=J({reference:CU,input:UU,typed:IK,style:q(MG),characters:q(oS(rK)),failure:q(LK)});J({record:RK}),J({reference:CU,failure:LK}),J({reference:CU}),J({after:uS(tS)});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(Jx(RK,{onExcessProperty:`error`})(t)),r=Jx(cS([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){Jx(RK,{onExcessProperty:`error`})(await bG(e,yG.failGeneration,JSON.stringify({reference:t,failure:n})))}async function HK(e,t){Jx(J({removed:rS}))(await bG(e,yG.forgetGeneration,JSON.stringify({reference:t})))}async function UK(e,t=null){let n=Jx(J({records:oS(RK),next:uS(tS)}),{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=Jx(FK,{onExcessProperty:`error`})({reference:t,result:n}),i=Jx(J({printId:tS,computerId:tS}))(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=Kx(J({reference:CU}));function KK({connection:e,folder:t,effects:n,styles:r,characters:i}){let a=e?.app??null,o=kN(a),s=(0,G.useRef)(e);s.current=e;let c=(0,G.useRef)(n);c.current=n;let l=yC(),u=eP.of(a,`prints`,`generation`),d=[...u,`recovery`],f=Ww(EK(a)),p=f.isError?void 0:f.data,m=p?.models??[],h=a?.capabilities.has(JU)===!0,g=p?.canGenerate??!1,_=f.error?uC(f.error).message:p?.models.length===0?`The granted Media model registry is empty.`:null,v=Zw({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(uC(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=Yw({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=Yw({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(uC(e).message)},onSettled:(e,t,n)=>{b.current.get(n.reference.requestId)===n.controller&&b.current.delete(n.reference.requestId)}}),ne=Jw({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=eP.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(VF)||!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(VF)||!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?uC(v.error).message:null),reportRecoveryError:e=>{F(uC(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=oL(`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)(FR,{...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)(uH,{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||!YR(o))return;let f=VR(o);if(f.reduced)return;let p=o.animate([{width:`${String(u)}px`},{width:`${String(d)}px`}],{duration:f.normal,easing:JR(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:JR(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:JR(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:JR(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:JR(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=ez(),[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||!YR(t))return;let n=VR(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||!YR(e)){c||d(!1);return}let r=VR(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:JR(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)(uH,{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=ez();(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=VR(t),i=pH(r,{ease:`outQuad`,duration:45}),a=fH(r,{bounce:.18,duration:180});n=WV(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){cI.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=ez(),[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(!YR(n)){e||l(!1);return}let i=VR(n),a=`translateY(${String(i.distance)}px)`,c=JR(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:JR(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 vee=(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=ez(),[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(!YR(e)){d([]);return}let r=f.current,i=e.getBoundingClientRect(),a=VR(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:JR(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:JR(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:JR(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)(vee,{...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)(KI,{"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)(YI,{"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)(MI,{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=ez();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=VR(n.current),c=fH(s,{bounce:.25,duration:440}),l=pH(s,{ease:`inOutSine`,duration:100}),u=WV(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=WV(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)(XV,{ref:r,id:`${t}-surface`,transform:i?`matrix(2 0 0 1 10 6)`:`matrix(1 0 0 1 6 6)`}),(0,Z.jsx)(ZV,{id:`${t}-shadow`}),(0,Z.jsx)(QV,{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=GR(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)(uH,{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=WR(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)(uH,{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=Kx(BS(J({maxHeight:bS,collapsed:rS})));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)(BI,{"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)(LI,{"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)($I,{}),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)(RI,{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)(zI,{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];cI.error(`Couldn't move ${String(a.length)} ${a.length===1?`item`:`items`}: ${O1[e.error]}.`,{toasterId:T1,id:`prints-move-error`})}i.length!==0&&cI(`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),cI.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=yC(),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(aP)===!0,T=Hw({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=>({...rP(e,aP,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),cI.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),cI.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(VF).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`:jE(`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)(CH,{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?GF.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&&GF.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,GF.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){GF.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`?GF.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,GF.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=HN({keyCode:WN(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:JR(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:JR(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:JR(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:JR(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||!YR(t))return;let r=t.querySelector(`[data-glyph="arrow"]`),i=t.querySelector(`[data-glyph="busy"]`);if(!r||!i)return;let a=VR(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)(kI,{"aria-hidden":`true`,size:r})}),(0,Z.jsx)(`span`,{"data-glyph":`busy`,children:t===void 0?(0,Z.jsx)(uH,{decorative:!0,size:`sm`}):(0,Z.jsx)(ZI,{"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)(MI,{"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)(CH,{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)($I,{"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)(CH,{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=ez();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=VR(n.current),c=pH(s,{ease:`inCubic`,duration:160}),l=WV(n.current,{d:{to:M6[e],...o?dH:pH(s,{ease:`outCubic`,duration:200})},"stroke-dashoffset":{to:+!t,...o?dH:t?pH(s,{ease:`inOutSine`,duration:260}):c},"stroke-width":o?{to:t?2.4:0,duration:0}:t&&!r?[{to:2.2,...pH(s,{ease:`outCubic`,duration:65})},{to:2.4,delay:GR(s,120),...fH(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)(XV,{id:`${t}-surface`,transform:`matrix(1 0 0 1 6 6)`}),(0,Z.jsx)(ZV,{id:`${t}-shadow`}),(0,Z.jsx)(QV,{id:`${t}-inset`}),(0,Z.jsx)(eH,{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(!YR(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=VR(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:JR(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=oL(`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;GF.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`,MR(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`,MR(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 w-full items-center gap-sm rounded-field px-md py-sm 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`,MR(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,MR(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`,MR(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`,MR(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)(MI,{"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)(GI,{}),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)(PI,{}),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)(FI,{}),label:null,readout:(0,Z.jsx)(MI,{"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=kN(e),n=(0,G.useRef)(e);n.current=e;let r=yC(),i=Ww(DK(e)),a=Zw(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=Yw({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(VF).mkdir({path:r}),a(),await BF(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(!Wx(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(aP)===!0,writable:e?.capabilities.has(VF)===!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:jE(`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=uC(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=Ww(OK(e)),r=Yw(iP({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(!YR(t)){p(!1);return}let r=VR(t),i=JR(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)(uH,{decorative:!0,size:`lg`,variant:`bloom`}):null,_===void 0?null:(0,Z.jsx)(RR,{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)(qI,{}):(0,Z.jsx)(JI,{}),iconSize:`sm`,size:`sm`,variant:`accent`,onClick:t.toggle})}var j9=8,M9=320,N9=4,P9=640,F9=656;function yee(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(()=>YV);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)(uH,{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)(ZI,{fill:`currentColor`})}):null]}):null,!e.pending&&!e.error?(0,Z.jsx)(See,{item:e}):null,(0,Z.jsxs)(`div`,{className:`prints-gallery-tools`,children:[!e.pending&&!e.error?(0,Z.jsx)(Cee,{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)(UI,{})}):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)(jI,{}):(0,Z.jsx)(VI,{})}):null]})]})}),bee=(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})}),xee=e=>`${String(e)}s`;function See({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)(BI,{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)(QI,{"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)(PI,{"aria-hidden":!0,size:12}),(0,Z.jsx)(`span`,{children:xee(e.badge.seconds)})]})]})}):null,e.folderCaption?(0,Z.jsx)(`div`,{className:`prints-tile-folder`,title:e.folderCaption,children:e.folderCaption}):null]})}function Cee({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)(II,{})})}),(0,Z.jsxs)(q5,{children:[(0,Z.jsxs)(Y5,{onSelect:e.onMove,children:[(0,Z.jsx)(LI,{"aria-hidden":!0,size:16}),` Move to…`]}),e.onToggleFavorite?(0,Z.jsxs)(Y5,{onSelect:e.onToggleFavorite,children:[(0,Z.jsx)(BI,{"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)(UI,{"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)(jI,{"aria-hidden":!0,size:16}):(0,Z.jsx)(VI,{"aria-hidden":!0,size:16}),` `,e.referenced?`Remove reference`:`Add reference`]}):null]})]})}var wee=(0,G.memo)(function({children:e,style:t,...n}){return(0,Z.jsx)(`div`,{"data-media-grid":!0,...n,style:t,children:e})});function Tee(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 Eee(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 Dee(e,t,n){let r=e.some(e=>e.select!==void 0),i=Math.max(1,yee(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 Oee=132,kee=(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<Oee?``:void 0,style:{height:n,width:t},children:(0,Z.jsx)(bee,{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 Aee(e,t,n){let r=e.ownerDocument;(r.activeElement!==r.body||B9(e,t))&&n()}function jee(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 Mee=(0,G.memo)(function({items:e,scrollRef:t,focus:n}){let r=Tee(t,e.length),i=r.width||M9,a=e.length===1&&r.height>0,o=i-16,s=r.height-16,c=Dee(e,i,r.height),{isScrolling:l,scrollTop:u}=Eee(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=jee(o,u,l);if(a){Aee(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)(kee,{data:e,width:t}),[]),h=u9({as:wee,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 Nee({items:e,scrollRef:t,focus:n}){return(0,Z.jsx)(`section`,{"data-media-mosaic":!0,children:(0,Z.jsx)(Mee,{items:e,scrollRef:t,focus:n})})}function Pee(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 Fee({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 Iee=.8;function Lee(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 Ree({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?Lee(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*Iee);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 zee({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 Bee(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 Vee({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 Hee=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 Uee(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=Hee(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 Wee(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 Gee=400;function Kee(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 qee(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 Jee(e,t){return Gw({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=qee(t,Gee),i=Ww(Jee(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 Yee(e,t){let n=G9(e,t);return n.state===`ready`?n.price:null}function Xee(e){let t=yC(),n=Ww(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=Yw(r((e,t,n)=>CK(e.capabilities,t,n))),a=Yw(r((e,t,n)=>wK(e.capabilities,t,n)));return{characters:n.data?.characters??[],error:n.error?uC(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:Xx(uS(tS)),height:Xx(MS),model:Xx(tS),prompt:Xx(tS),references:Xx(oS(J({computerId:Xx(tS),path:tS,role:Xx(lS([`first-frame`,`last-frame`,`reference`]))}))),generateAudio:Xx(uS(rS)),steps:Xx(uS(MS)),style:Xx(uS(tS)),width:Xx(MS)}),Zee=fo(U(),Jo()).parse(structuredClone(GS(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`}}}),Qee=q9(`inspect-generation-draft`,`Inspect image draft`,`Read the current Prints image form and available models`),$ee=q9(`set-generation-draft`,`Edit image draft`,`Set selected Prints image form fields; this does not generate an image`,Zee),ete=q9(`submit-generation-draft`,`Generate image`,`Submit the current Prints image form using the same action as the Send button`);function J9(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(Qee,()=>{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($ee,({arguments:e})=>{if(n)return;let r=Jx(K9,{onExcessProperty:`error`})(e);t.setDraft(r)}),i(ete,async()=>{if(!n)return{accepted:await t.submit()}}),()=>{if(!n){n=!0;for(let e of r)e();r.clear()}}}function tte(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 nte(e,t){let n=(0,G.useRef)(e);n.current=e;let r=jN(t,{sourceId:`media-prompt`,namespace:`media`},(0,G.useCallback)(()=>tte(()=>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 rte(e){let t=yC(),n=Ww(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=Yw(r((e,t,n)=>UG(e.capabilities,t,n))),a=Yw(r((e,t,n)=>WG(e.capabilities,t,n)));return{styles:n.data?.styles??[],error:n.error?uC(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 ite(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 ate(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):ite(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 ote({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 ste=(0,G.lazy)(async()=>({default:(await R1(()=>import(`./prints-activity-tray-B_d8CifY.js`),__vite__mapDeps([0,1,2,3]),import.meta.url)).PrintsActivityTray})),cte=(0,G.lazy)(async()=>({default:(await R1(()=>import(`./prompt-styles-dialog-DqdIT7bt.js`),__vite__mapDeps([4,5]),import.meta.url)).PromptStylesDialog})),lte=(0,G.lazy)(async()=>({default:(await R1(()=>import(`./prompt-character-controls-CG5JFMgW.js`),__vite__mapDeps([6,5]),import.meta.url)).PromptCharactersDialog})),ute=(0,G.lazy)(async()=>({default:(await R1(()=>import(`./reference-lightbox-CLpNtWiA.js`),__vite__mapDeps([7,8,5]),import.meta.url)).ReferenceLightbox})),dte=(0,G.lazy)(async()=>({default:(await R1(()=>import(`./library-dialogs-Csei16Ij.js`),__vite__mapDeps([9,5]),import.meta.url)).MoveDialog})),fte=(0,G.lazy)(async()=>({default:(await R1(()=>import(`./library-dialogs-Csei16Ij.js`),__vite__mapDeps([9,5]),import.meta.url)).NewFolderDialog})),pte=(0,G.lazy)(async()=>({default:(await R1(()=>import(`./library-folders-dialog-BJNQFVME.js`),__vite__mapDeps([10,5,11,12]),import.meta.url)).LibraryFoldersDialog})),mte=(0,G.lazy)(async()=>({default:(await R1(()=>import(`./library-rail-Bv6CJHTX.js`),__vite__mapDeps([11,12]),import.meta.url)).LibraryRail})),hte=(0,G.lazy)(async()=>({default:(await R1(()=>import(`./print-viewer-BN9Xq85Y.js`),__vite__mapDeps([13,8,5]),import.meta.url)).PrintViewer})),gte=(0,G.lazy)(async()=>({default:(await R1(()=>import(`./prints-folder-dialog-B4dKHnjl.js`),__vite__mapDeps([14,5,2,3]),import.meta.url)).PrintsFolderDialog})),_te=(0,G.lazy)(async()=>({default:(await R1(()=>import(`./print-info-drawer-ClagKCnR.js`),__vite__mapDeps([15,3,12,1]),import.meta.url)).PrintInfoDrawer})),vte=[`a mushroom knight`,`moss on a keyboard`,`a tiny house made of mushrooms`];function Z9(e){cI.error(e,{id:`prints-generation-error`,toasterId:`prints-generation-notices`})}function yte(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 bte(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 xte({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,bte(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 Ste({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),cI(`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=nte({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=Uee(h,me,l.prompt),ge=U9(l.prompt,h,me,f),_e=Bee(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)(xte,{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)($I,{}),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)(ute,{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)(zee,{index:_e.slashIndex,listId:ye,matches:_e.slashMatches,onHighlight:_e.highlightSlash,onPick:Se}):null,!_e.slashOpen&&he.matches.length>0?(0,Z.jsx)(Vee,{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)(Ree,{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)(NI,{}):(0,Z.jsx)(MI,{}),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)(HI,{"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)(WI,{}),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)(AI,{}),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)(Fee,{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)(XI,{"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 Cte({connection:e}){let t=(0,G.useRef)(null),n=(0,G.useRef)(e);n.current=e;let r=k7(e?.app??null),i=ON(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});MN(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=tF(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=rte(e?.app??null),de=Xee(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=yte(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=Wee(Ie.references,Ie.prompt,r.computerId);je.current=Le;let Re=Yee(me.session,Kee({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 J9(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,...Pee(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);AN(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)(_te,{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=ate(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)(mte,{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)(Nee,{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:vte.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)(dte,{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)(fte,{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)(pte,{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)(hte,{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)(Ste,{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)(ote,{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)(cte,{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)(lte,{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)(QI,{}),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)(ste,{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)(gte,{folder:r})}):null]})}var $9=document.getElementById(`media-root`);if(!$9)throw Error(`Media root is missing`);TN($9,{name:`Prints`,queryClient:nP()},({app:e})=>(0,G.createElement)(Cte,{connection:e?{app:e}:null}));export{N2 as $,qI as $n,H_ as $r,cX as $t,s6 as A,o as Ai,UH as An,bS as Ar,L$ as At,m4 as B,QV as Bn,Kx as Br,E$ as Bt,F6 as C,mo as Ci,cW as Cn,Hw as Cr,x1 as Ct,E6 as D,U as Di,XU as Dn,uC as Dr,J$ as Dt,w6 as E,eo as Ei,oW as En,X as Er,X$ as Et,V4 as F,EH as Fn,J as Fr,N$ as Ft,j2 as G,RR as Gn,B_ as Gr,mZ as Gt,Y2 as H,XV as Hn,Wx as Hr,gZ as Ht,T4 as I,CH as In,HS as Ir,A$ as It,M2 as J,oL as Jn,M_ as Jr,nZ as Jt,P2 as K,Q as Kn,L_ as Kr,rZ as Kt,C4 as L,pH as Ln,eS as Lr,k$ as Lt,q3 as M,NH as Mn,uS as Mr,z$ as Mt,K3 as N,IH as Nn,aS as Nr,q$ as Nt,T6 as O,nr as Oi,vU as On,oS as Or,H$ as Ot,G3 as P,DH as Pn,tS as Pr,M$ as Pt,H2 as Q,JI as Qn,N_ as Qr,WX as Qt,h4 as R,fH as Rn,cS as Rr,O$ as Rt,z6 as S,no as Si,pW as Sn,Ww as Sr,R1 as St,C6 as T,Ra as Ti,uW as Tn,_C as Tr,w1 as Tt,X2 as U,WV as Un,gS as Ur,_Z as Ut,a4 as V,ZV as Vn,mS as Vr,$ as Vt,W2 as W,WR as Wn,Ux as Wr,hZ as Wt,B2 as X,QI as Xn,V_ as Xr,tZ as Xt,L2 as Y,$I as Yn,I_ as Yr,iZ as Yt,V2 as Z,XI as Zn,F_ as Zr,HX as Zt,f5 as _,$a as _i,gG as _n,rP as _r,r0 as _t,w9 as a,Md as ai,zJ as an,LI as ar,y2 as at,O8 as b,ma as bi,tG as bn,tT as br,X1 as bt,c7 as c,Od as ci,EJ as cn,PI as cr,s2 as ct,V5 as d,Va as di,Mq as dn,jI as dr,J0 as dt,Ky as ei,qY as en,WI as er,U2 as et,q5 as f,To as fi,AK as fn,OI as fr,A0 as ft,m5 as g,La as gi,hG as gn,aP as gr,h0 as gt,P5 as h,Co as hi,pG as hn,zF as hr,c0 as ht,T9 as i,kd as ii,GJ as in,zI as ir,b2 as it,i6 as j,l as ji,LH as jn,$x as jr,I$ as jt,u6 as k,d as ki,HH as kn,rS as kr,B$ as kt,t7 as l,Ad as li,vJ as ln,NI as lr,e2 as lt,U5 as m,ho as mi,fG as mn,EF as mr,l0 as mt,W9 as n,qy as ni,nY as nn,VI as nr,k2 as nt,S9 as o,Dd as oi,LJ as on,II as or,c2 as ot,Y5 as p,po as pi,rK as pn,cI as pr,s0 as pt,R2 as q,MR as qn,R_ as qr,aZ as qt,U9 as r,ky as ri,$J as rn,BI as rr,C2 as rt,S7 as s,Nd as si,kJ as sn,FI as sr,l2 as st,G9 as t,Jy as ti,MY as tn,UI as tr,z2 as tt,s7 as u,Za as ui,gJ as un,MI as ur,K0 as ut,d5 as v,yo as vi,mG as vn,eP as vr,n0 as vt,D6 as w,Qa as wi,lW as wn,yC as wr,C1 as wt,D8 as x,fa as xi,eG as xn,Yw as xr,G1 as xt,t5 as y,No as yi,gW as yn,kN as yr,$1 as yt,c4 as z,uH as zn,fS as zr,D$ as zt};
|