@fungi.computer/prints 0.4.0 → 0.5.0
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/README.md +24 -3
- package/dist/assets/index-7_6t_G_r.js +91 -0
- package/dist/assets/index-DEn6uVuz.css +2 -0
- package/dist/index.html +2 -2
- package/package.json +8 -8
- package/dist/assets/index-BqGc0fci.js +0 -91
- package/dist/assets/index-DmgM95V3.js +0 -91
- package/dist/assets/index-ghHnoWMF.css +0 -2
- package/dist/assets/index-hMYDjtKK.css +0 -2
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
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 B(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 V(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 te(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 ne(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 H(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 U(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 re(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 ie(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 ae(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 oe(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function se(e){return typeof e==`string`?e:e?.message}function W(e,t,n){let r=e.message?e.message:se(e.inst?._zod.def?.error?.(e))??se(t?.error?.(e))??se(n.customError?.(e))??se(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 G(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function ce(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}var le=(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})},ue=p(`$ZodError`,le),de=p(`$ZodError`,le,{Parent:Error});function fe(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 pe(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 me=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=>W(e,a,_())));throw A(t,i?.callee),t}return o.value},he=me(de),ge=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=>W(e,a,_())));throw A(t,i?.callee),t}return o.value},_e=ge(de),ve=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??ue)(a.issues.map(e=>W(e,i,_())))}:{success:!0,data:a.value}},ye=ve(de),be=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=>W(e,i,_())))}:{success:!0,data:a.value}},xe=be(de),Se=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return me(e)(t,n,i)},Ce=e=>(t,n,r)=>me(e)(t,n,r),we=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return ge(e)(t,n,i)},Te=e=>async(t,n,r)=>ge(e)(t,n,r),Ee=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return ve(e)(t,n,i)},De=e=>(t,n,r)=>ve(e)(t,n,r),Oe=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return be(e)(t,n,i)},ke=e=>async(t,n,r)=>be(e)(t,n,r),Ae=/^[cC][0-9a-z]{6,}$/,je=/^[0-9a-z]+$/,Me=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Ne=/^[0-9a-vA-V]{20}$/,Pe=/^[A-Za-z0-9]{27}$/,Fe=/^[a-zA-Z0-9_-]{21}$/,Ie=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Le=/^([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})$/,Re=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)$/,ze=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Be=`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`;function Ve(){return new RegExp(Be,`u`)}var He=/^(?:(?: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])$/,Ue=/^(([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}|:))$/,We=/^((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])$/,Ge=/^(([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])$/,Ke=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,qe=/^[A-Za-z0-9_-]*$/,Je=/^https?$/,Ye=/^\+[1-9]\d{6,14}$/,Xe=`(?:(?:\\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])))`,Ze=RegExp(`^${Xe}$`);function Qe(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 $e(e){return RegExp(`^${Qe(e)}$`)}function et(e){let t=Qe({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(`^${Xe}T(?:${r})$`)}var tt=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??``}}`:`[\\s\\S]*`;return RegExp(`^${t}$`)},nt=/^-?\d+$/,rt=/^-?\d+(?:\.\d+)?$/,it=/^(?:true|false)$/i,at=/^null$/i,ot=/^[^A-Z]*$/,st=/^[^a-z]*$/,ct=p(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),lt={number:`number`,bigint:`bigint`,object:`date`},ut=p(`$ZodCheckLessThan`,(e,t)=>{ct.init(e,t);let n=lt[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})}}),dt=p(`$ZodCheckGreaterThan`,(e,t)=>{ct.init(e,t);let n=lt[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})}}),ft=p(`$ZodCheckMultipleOf`,(e,t)=>{ct.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})}}),pt=p(`$ZodCheckNumberFormat`,(e,t)=>{ct.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=nt)}),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})}}),mt=p(`$ZodCheckMaxLength`,(e,t)=>{var n;ct.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=G(r);n.issues.push({origin:i,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),ht=p(`$ZodCheckMinLength`,(e,t)=>{var n;ct.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=G(r);n.issues.push({origin:i,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),gt=p(`$ZodCheckLengthEquals`,(e,t)=>{var n;ct.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=G(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})}}),_t=p(`$ZodCheckStringFormat`,(e,t)=>{var n,r;ct.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=()=>{})}),vt=p(`$ZodCheckRegex`,(e,t)=>{_t.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})}}),yt=p(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=ot,_t.init(e,t)}),bt=p(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=st,_t.init(e,t)}),xt=p(`$ZodCheckIncludes`,(e,t)=>{ct.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})}}),St=p(`$ZodCheckStartsWith`,(e,t)=>{ct.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})}}),Ct=p(`$ZodCheckEndsWith`,(e,t)=>{ct.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})}}),wt=p(`$ZodCheckOverwrite`,(e,t)=>{ct.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}}),Tt=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(`
|
|
2
|
+
`).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(`
|
|
3
|
+
`))}},Et={major:4,minor:4,patch:3},Dt=p(`$ZodType`,(e,t)=>{var n;e??={},e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Et;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=ie(e),i;for(let a of t){if(a._zod.def.when){if(ae(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||=ie(e,t))});else{if(e.issues.length===t)continue;r||=ie(e,t)}}return i?i.then(()=>e):e},n=(n,i,a)=>{if(ie(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=ye(e,t);return n.success?{value:n.data}:{issues:n.error?.issues}}catch{return xe(e,t).then(e=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:`zod`,version:1}))}),Ot=p(`$ZodString`,(e,t)=>{Dt.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??tt(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}}),kt=p(`$ZodStringFormat`,(e,t)=>{_t.init(e,t),Ot.init(e,t)}),At=p(`$ZodGUID`,(e,t)=>{t.pattern??=Le,kt.init(e,t)}),jt=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??=Re(e)}else t.pattern??=Re();kt.init(e,t)}),Mt=p(`$ZodEmail`,(e,t)=>{t.pattern??=ze,kt.init(e,t)}),Nt=p(`$ZodURL`,(e,t)=>{kt.init(e,t),e._zod.check=n=>{try{let r=n.value.trim();if(!t.normalize&&t.protocol?.source===Je.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})}}}),Pt=p(`$ZodEmoji`,(e,t)=>{t.pattern??=Ve(),kt.init(e,t)}),Ft=p(`$ZodNanoID`,(e,t)=>{t.pattern??=Fe,kt.init(e,t)}),It=p(`$ZodCUID`,(e,t)=>{t.pattern??=Ae,kt.init(e,t)}),Lt=p(`$ZodCUID2`,(e,t)=>{t.pattern??=je,kt.init(e,t)}),Rt=p(`$ZodULID`,(e,t)=>{t.pattern??=Me,kt.init(e,t)}),zt=p(`$ZodXID`,(e,t)=>{t.pattern??=Ne,kt.init(e,t)}),Bt=p(`$ZodKSUID`,(e,t)=>{t.pattern??=Pe,kt.init(e,t)}),Vt=p(`$ZodISODateTime`,(e,t)=>{t.pattern??=et(t),kt.init(e,t)}),Ht=p(`$ZodISODate`,(e,t)=>{t.pattern??=Ze,kt.init(e,t)}),Ut=p(`$ZodISOTime`,(e,t)=>{t.pattern??=$e(t),kt.init(e,t)}),Wt=p(`$ZodISODuration`,(e,t)=>{t.pattern??=Ie,kt.init(e,t)}),Gt=p(`$ZodIPv4`,(e,t)=>{t.pattern??=He,kt.init(e,t),e._zod.bag.format=`ipv4`}),Kt=p(`$ZodIPv6`,(e,t)=>{t.pattern??=Ue,kt.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})}}}),qt=p(`$ZodCIDRv4`,(e,t)=>{t.pattern??=We,kt.init(e,t)}),Jt=p(`$ZodCIDRv6`,(e,t)=>{t.pattern??=Ge,kt.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 Yt(e){if(e===``)return!0;if(/\s/.test(e)||e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}var Xt=p(`$ZodBase64`,(e,t)=>{t.pattern??=Ke,kt.init(e,t),e._zod.bag.contentEncoding=`base64`,e._zod.check=n=>{Yt(n.value)||n.issues.push({code:`invalid_format`,format:`base64`,input:n.value,inst:e,continue:!t.abort})}});function Zt(e){if(!qe.test(e))return!1;let t=e.replace(/[-_]/g,e=>e===`-`?`+`:`/`);return Yt(t.padEnd(Math.ceil(t.length/4)*4,`=`))}var Qt=p(`$ZodBase64URL`,(e,t)=>{t.pattern??=qe,kt.init(e,t),e._zod.bag.contentEncoding=`base64url`,e._zod.check=n=>{Zt(n.value)||n.issues.push({code:`invalid_format`,format:`base64url`,input:n.value,inst:e,continue:!t.abort})}}),$t=p(`$ZodE164`,(e,t)=>{t.pattern??=Ye,kt.init(e,t)});function en(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 tn=p(`$ZodJWT`,(e,t)=>{kt.init(e,t),e._zod.check=n=>{en(n.value,t.alg)||n.issues.push({code:`invalid_format`,format:`jwt`,input:n.value,inst:e,continue:!t.abort})}}),nn=p(`$ZodNumber`,(e,t)=>{Dt.init(e,t),e._zod.pattern=e._zod.bag.pattern??rt,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}}),rn=p(`$ZodNumberFormat`,(e,t)=>{pt.init(e,t),nn.init(e,t)}),an=p(`$ZodBoolean`,(e,t)=>{Dt.init(e,t),e._zod.pattern=it,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}}),on=p(`$ZodNull`,(e,t)=>{Dt.init(e,t),e._zod.pattern=at,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}}),sn=p(`$ZodUnknown`,(e,t)=>{Dt.init(e,t),e._zod.parse=e=>e}),cn=p(`$ZodNever`,(e,t)=>{Dt.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:`never`,code:`invalid_type`,input:t.value,inst:e}),t)}),ln=p(`$ZodVoid`,(e,t)=>{Dt.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 un(e,t,n){e.issues.length&&t.issues.push(...oe(n,e.issues)),t.value[n]=e.value}var dn=p(`$ZodArray`,(e,t)=>{Dt.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=>un(t,n,e))):un(s,n,e)}return a.length?Promise.all(a).then(()=>n):n}});function fn(e,t,n,r,i,a){let o=n in r;if(e.issues.length){if(i&&a&&!o)return;t.issues.push(...oe(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 pn(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 mn(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=>fn(e,n,i,t,u,d))):fn(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 hn=p(`$ZodObject`,(e,t)=>{if(Dt.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(()=>pn(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=>fn(n,t,e,s,r,i))):fn(a,t,e,s,r,i)}return i?mn(c,s,t,o,n.value,e):c.length?Promise.all(c).then(()=>t):t}}),gn=p(`$ZodObjectJIT`,(e,t)=>{hn.init(e,t);let n=e._zod.parse,r=b(()=>pn(t)),i=e=>{let t=new Tt([`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(`
|
|
4
|
+
if (${n}.issues.length) {
|
|
5
|
+
if (${o} in input) {
|
|
6
|
+
payload.issues = payload.issues.concat(${n}.issues.map(iss => ({
|
|
7
|
+
...iss,
|
|
8
|
+
path: iss.path ? [${o}, ...iss.path] : [${o}]
|
|
9
|
+
})));
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
if (${n}.value === undefined) {
|
|
14
|
+
if (${o} in input) {
|
|
15
|
+
newResult[${o}] = undefined;
|
|
16
|
+
}
|
|
17
|
+
} else {
|
|
18
|
+
newResult[${o}] = ${n}.value;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
`):c?t.write(`
|
|
22
|
+
if (${n}.issues.length) {
|
|
23
|
+
payload.issues = payload.issues.concat(${n}.issues.map(iss => ({
|
|
24
|
+
...iss,
|
|
25
|
+
path: iss.path ? [${o}, ...iss.path] : [${o}]
|
|
26
|
+
})));
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
if (${n}.value === undefined) {
|
|
30
|
+
if (${o} in input) {
|
|
31
|
+
newResult[${o}] = undefined;
|
|
32
|
+
}
|
|
33
|
+
} else {
|
|
34
|
+
newResult[${o}] = ${n}.value;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
`):t.write(`
|
|
38
|
+
const ${n}_present = ${o} in input;
|
|
39
|
+
if (${n}.issues.length) {
|
|
40
|
+
payload.issues = payload.issues.concat(${n}.issues.map(iss => ({
|
|
41
|
+
...iss,
|
|
42
|
+
path: iss.path ? [${o}, ...iss.path] : [${o}]
|
|
43
|
+
})));
|
|
44
|
+
}
|
|
45
|
+
if (!${n}_present && !${n}.issues.length) {
|
|
46
|
+
payload.issues.push({
|
|
47
|
+
code: "invalid_type",
|
|
48
|
+
expected: "nonoptional",
|
|
49
|
+
input: undefined,
|
|
50
|
+
path: [${o}]
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
if (${n}_present) {
|
|
55
|
+
if (${n}.value === undefined) {
|
|
56
|
+
newResult[${o}] = undefined;
|
|
57
|
+
} else {
|
|
58
|
+
newResult[${o}] = ${n}.value;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
`)}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?mn([],p,d,f,u,e):d):n(d,f):(d.issues.push({expected:`object`,code:`invalid_type`,input:p,inst:e}),d)}});function _n(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=>!ie(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=>W(e,r,_())))}),t)}var vn=p(`$ZodUnion`,(e,t)=>{Dt.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=>_n(t,r,e,i)):_n(o,r,e,i)}}),yn=p(`$ZodDiscriminatedUnion`,(e,t)=>{t.inclusive=!1,vn.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)}}),bn=p(`$ZodIntersection`,(e,t)=>{Dt.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])=>Sn(e,t,n)):Sn(e,i,a)}});function xn(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=xn(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=xn(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 Sn(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}),ie(e))return e;let o=xn(t.value,n.value);if(!o.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(o.mergeErrorPath)}`);return e.value=o.data,e}var Cn=p(`$ZodTuple`,(e,t)=>{Dt.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=wn(n,`optin`),c=wn(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=>Tn(t,r,e))):Tn(a,r,e)}}return o.length?Promise.all(o).then(()=>En(l,r,n,a,c)):En(l,r,n,a,c)}});function wn(e,t){for(let n=e.length-1;n>=0;n--)if(e[n]._zod[t]!==`optional`)return n+1;return 0}function Tn(e,t,n){e.issues.length&&t.issues.push(...oe(n,e.issues)),t.value[n]=e.value}function En(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(...oe(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 Dn=p(`$ZodRecord`,(e,t)=>{Dt.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=>W(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(...oe(c,e.issues)),n.value[l]=e.value})):(u.issues.length&&n.issues.push(...oe(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`&&rt.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=>W(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(...oe(o,e.issues)),n.value[s.value]=e.value})):(c.issues.length&&n.issues.push(...oe(o,c.issues)),n.value[s.value]=c.value)}}return a.length?Promise.all(a).then(()=>n):n}}),On=p(`$ZodEnum`,(e,t)=>{Dt.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}}),kn=p(`$ZodLiteral`,(e,t)=>{if(Dt.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}}),An=p(`$ZodTransform`,(e,t)=>{Dt.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 jn(e,t){return t===void 0&&(e.issues.length||e.fallback)?{issues:[],value:void 0}:e}var Mn=p(`$ZodOptional`,(e,t)=>{Dt.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=>jn(e,r)):jn(i,r)}return e.value===void 0?e:t.innerType._zod.run(e,n)}}),Nn=p(`$ZodExactOptional`,(e,t)=>{Mn.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)}),Pn=p(`$ZodNullable`,(e,t)=>{Dt.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)}),Fn=p(`$ZodDefault`,(e,t)=>{Dt.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=>In(e,t)):In(r,t)}});function In(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var Ln=p(`$ZodPrefault`,(e,t)=>{Dt.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))}),Rn=p(`$ZodNonOptional`,(e,t)=>{Dt.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=>zn(t,e)):zn(i,e)}});function zn(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 Bn=p(`$ZodCatch`,(e,t)=>{Dt.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=>W(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=>W(e,n,_()))},input:e.value}),e.issues=[],e.fallback=!0),e)}}),Vn=p(`$ZodPipe`,(e,t)=>{Dt.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=>Hn(e,t.in,n)):Hn(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>Hn(e,t.out,n)):Hn(r,t.out,n)}});function Hn(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 Un=p(`$ZodReadonly`,(e,t)=>{Dt.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(Wn):Wn(r)}});function Wn(e){return e.value=Object.freeze(e.value),e}var Gn=p(`$ZodFunction`,(e,t)=>(Dt.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?he(e._def.input,n):n,i=Reflect.apply(t,this,r);return e._def.output?he(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 _e(e._def.input,n):n,i=await Reflect.apply(t,this,r);return e._def.output?await _e(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 Cn({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)),Kn=p(`$ZodPromise`,(e,t)=>{Dt.init(e,t),e._zod.parse=(e,n)=>Promise.resolve(e.value).then(e=>t.innerType._zod.run({value:e,issues:[]},n))}),qn=p(`$ZodLazy`,(e,t)=>{Dt.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)}),Jn=p(`$ZodCustom`,(e,t)=>{ct.init(e,t),Dt.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=>Yn(t,n,r,e));Yn(i,n,r,e)}});function Yn(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(ce(e))}}var Xn,Zn=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 Qn(){return new Zn}(Xn=globalThis).__zod_globalRegistry??(Xn.__zod_globalRegistry=Qn());var $n=globalThis.__zod_globalRegistry;function er(e,t){return new e({type:`string`,...R(t)})}function tr(e,t){return new e({type:`string`,format:`email`,check:`string_format`,abort:!1,...R(t)})}function nr(e,t){return new e({type:`string`,format:`guid`,check:`string_format`,abort:!1,...R(t)})}function rr(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,...R(t)})}function ir(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v4`,...R(t)})}function ar(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v6`,...R(t)})}function or(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v7`,...R(t)})}function sr(e,t){return new e({type:`string`,format:`url`,check:`string_format`,abort:!1,...R(t)})}function cr(e,t){return new e({type:`string`,format:`emoji`,check:`string_format`,abort:!1,...R(t)})}function lr(e,t){return new e({type:`string`,format:`nanoid`,check:`string_format`,abort:!1,...R(t)})}function ur(e,t){return new e({type:`string`,format:`cuid`,check:`string_format`,abort:!1,...R(t)})}function dr(e,t){return new e({type:`string`,format:`cuid2`,check:`string_format`,abort:!1,...R(t)})}function fr(e,t){return new e({type:`string`,format:`ulid`,check:`string_format`,abort:!1,...R(t)})}function pr(e,t){return new e({type:`string`,format:`xid`,check:`string_format`,abort:!1,...R(t)})}function mr(e,t){return new e({type:`string`,format:`ksuid`,check:`string_format`,abort:!1,...R(t)})}function hr(e,t){return new e({type:`string`,format:`ipv4`,check:`string_format`,abort:!1,...R(t)})}function gr(e,t){return new e({type:`string`,format:`ipv6`,check:`string_format`,abort:!1,...R(t)})}function _r(e,t){return new e({type:`string`,format:`cidrv4`,check:`string_format`,abort:!1,...R(t)})}function vr(e,t){return new e({type:`string`,format:`cidrv6`,check:`string_format`,abort:!1,...R(t)})}function yr(e,t){return new e({type:`string`,format:`base64`,check:`string_format`,abort:!1,...R(t)})}function br(e,t){return new e({type:`string`,format:`base64url`,check:`string_format`,abort:!1,...R(t)})}function xr(e,t){return new e({type:`string`,format:`e164`,check:`string_format`,abort:!1,...R(t)})}function Sr(e,t){return new e({type:`string`,format:`jwt`,check:`string_format`,abort:!1,...R(t)})}function Cr(e,t){return new e({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null,...R(t)})}function wr(e,t){return new e({type:`string`,format:`date`,check:`string_format`,...R(t)})}function Tr(e,t){return new e({type:`string`,format:`time`,check:`string_format`,precision:null,...R(t)})}function Er(e,t){return new e({type:`string`,format:`duration`,check:`string_format`,...R(t)})}function Dr(e,t){return new e({type:`number`,checks:[],...R(t)})}function Or(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`safeint`,...R(t)})}function kr(e,t){return new e({type:`boolean`,...R(t)})}function Ar(e,t){return new e({type:`null`,...R(t)})}function jr(e){return new e({type:`unknown`})}function Mr(e,t){return new e({type:`never`,...R(t)})}function Nr(e,t){return new e({type:`void`,...R(t)})}function Pr(e,t){return new ut({check:`less_than`,...R(t),value:e,inclusive:!1})}function Fr(e,t){return new ut({check:`less_than`,...R(t),value:e,inclusive:!0})}function Ir(e,t){return new dt({check:`greater_than`,...R(t),value:e,inclusive:!1})}function Lr(e,t){return new dt({check:`greater_than`,...R(t),value:e,inclusive:!0})}function Rr(e,t){return new ft({check:`multiple_of`,...R(t),value:e})}function zr(e,t){return new mt({check:`max_length`,...R(t),maximum:e})}function Br(e,t){return new ht({check:`min_length`,...R(t),minimum:e})}function Vr(e,t){return new gt({check:`length_equals`,...R(t),length:e})}function Hr(e,t){return new vt({check:`string_format`,format:`regex`,...R(t),pattern:e})}function Ur(e){return new yt({check:`string_format`,format:`lowercase`,...R(e)})}function Wr(e){return new bt({check:`string_format`,format:`uppercase`,...R(e)})}function Gr(e,t){return new xt({check:`string_format`,format:`includes`,...R(t),includes:e})}function Kr(e,t){return new St({check:`string_format`,format:`starts_with`,...R(t),prefix:e})}function qr(e,t){return new Ct({check:`string_format`,format:`ends_with`,...R(t),suffix:e})}function Jr(e){return new wt({check:`overwrite`,tx:e})}function Yr(e){return Jr(t=>t.normalize(e))}function Xr(){return Jr(e=>e.trim())}function Zr(){return Jr(e=>e.toLowerCase())}function Qr(){return Jr(e=>e.toUpperCase())}function $r(){return Jr(e=>k(e))}function ei(e,t,n){return new e({type:`array`,element:t,...R(n)})}function ti(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,...R(n)})}function ni(e,t){let n=ri(t=>(t.addIssue=e=>{if(typeof e==`string`)t.issues.push(ce(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(ce(r))}},e(t.value,t)),t);return n}function ri(e,t){let n=new ct({check:`custom`,...R(t)});return n._zod.check=e,n}function ii(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??$n,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 ai(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,ai(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`&&ci(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 oi(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>
|
|
63
|
+
|
|
64
|
+
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 si(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:ui(t,`input`,e.processors),output:ui(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function ci(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 ci(r.element,n);if(r.type===`set`)return ci(r.valueType,n);if(r.type===`lazy`)return ci(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 ci(r.innerType,n);if(r.type===`intersection`)return ci(r.left,n)||ci(r.right,n);if(r.type===`record`||r.type===`map`)return ci(r.keyType,n)||ci(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:ci(r.in,n)||ci(r.out,n);if(r.type===`object`){for(let e in r.shape)if(ci(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(ci(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(ci(e,n))return!0;return!!(r.rest&&ci(r.rest,n))}return!1}var li=(e,t={})=>n=>{let r=ii({...n,processors:t});return ai(e,r),oi(r,e),si(r,e)},ui=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=ii({...i??{},target:a,io:t,processors:n});return ai(e,o),oi(o,e),si(o,e)},di={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},fi=(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=di[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}))])}},pi=(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)},mi=(e,t,n,r)=>{n.type=`boolean`},hi=(e,t,n,r)=>{t.target===`openapi-3.0`?(n.type=`string`,n.nullable=!0,n.enum=[null]):n.type=`null`},gi=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Void cannot be represented in JSON Schema`)},_i=(e,t,n,r)=>{n.not={}},vi=(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},yi=(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}},bi=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Custom types cannot be represented in JSON Schema`)},xi=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Function types cannot be represented in JSON Schema`)},Si=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Transforms cannot be represented in JSON Schema`)},Ci=(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=ai(a.element,t,{...r,path:[...r.path,`items`]})},wi=(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]=ai(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=ai(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},Ti=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>ai(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},Ei=(e,t,n,r)=>{let i=e._zod.def,a=ai(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=ai(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]]},Di=(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)=>ai(e,t,{...r,path:[...r.path,o,n]})),l=a.rest?ai(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)},Oi=(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=ai(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=ai(a.keyType,t,{...r,path:[...r.path,`propertyNames`]})),i.additionalProperties=ai(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)}},ki=(e,t,n,r)=>{let i=e._zod.def,a=ai(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`}]},Ai=(e,t,n,r)=>{let i=e._zod.def;ai(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},ji=(e,t,n,r)=>{let i=e._zod.def;ai(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.default=JSON.parse(JSON.stringify(i.defaultValue))},Mi=(e,t,n,r)=>{let i=e._zod.def;ai(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)))},Ni=(e,t,n,r)=>{let i=e._zod.def;ai(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},Pi=(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;ai(o,t,r);let s=t.seen.get(e);s.ref=o},Fi=(e,t,n,r)=>{let i=e._zod.def;ai(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},Ii=(e,t,n,r)=>{let i=e._zod.def;ai(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Li=(e,t,n,r)=>{let i=e._zod.def;ai(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Ri=(e,t,n,r)=>{let i=e._zod.innerType;ai(i,t,r);let a=t.seen.get(e);a.ref=i},zi=p(`ZodISODateTime`,(e,t)=>{Vt.init(e,t),fa.init(e,t)});function Bi(e){return Cr(zi,e)}var Vi=p(`ZodISODate`,(e,t)=>{Ht.init(e,t),fa.init(e,t)});function Hi(e){return wr(Vi,e)}var Ui=p(`ZodISOTime`,(e,t)=>{Ut.init(e,t),fa.init(e,t)});function Wi(e){return Tr(Ui,e)}var Gi=p(`ZodISODuration`,(e,t)=>{Wt.init(e,t),fa.init(e,t)});function Ki(e){return Er(Gi,e)}var qi=p(`ZodError`,(e,t)=>{ue.init(e,t),e.name=`ZodError`,Object.defineProperties(e,{format:{value:t=>pe(e,t)},flatten:{value:t=>fe(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}),Ji=me(qi),Yi=ge(qi),Xi=ve(qi),Zi=be(qi),Qi=Se(qi),$i=Ce(qi),ea=we(qi),ta=Te(qi),na=Ee(qi),ra=De(qi),ia=Oe(qi),aa=ke(qi),oa=new WeakMap;function sa(e,t,n){let r=Object.getPrototypeOf(e),i=oa.get(r);if(i||(i=new Set,oa.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 ca=p(`ZodType`,(e,t)=>(Dt.init(e,t),Object.assign(e[`~standard`],{jsonSchema:{input:ui(e,`input`),output:ui(e,`output`)}}),e.toJSONSchema=li(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(t,n)=>Ji(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>Xi(e,t,n),e.parseAsync=async(t,n)=>Yi(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>Zi(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>Qi(e,t,n),e.decode=(t,n)=>$i(e,t,n),e.encodeAsync=async(t,n)=>ea(e,t,n),e.decodeAsync=async(t,n)=>ta(e,t,n),e.safeEncode=(t,n)=>na(e,t,n),e.safeDecode=(t,n)=>ra(e,t,n),e.safeEncodeAsync=async(t,n)=>ia(e,t,n),e.safeDecodeAsync=async(t,n)=>aa(e,t,n),sa(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(Bo(e,t))},superRefine(e,t){return this.check(Vo(e,t))},overwrite(e){return this.check(Jr(e))},optional(){return go(this)},exactOptional(){return vo(this)},nullable(){return bo(this)},nullish(){return go(bo(this))},nonoptional(e){return Eo(this,e)},array(){return Ja(this)},or(e){return $a([this,e])},and(e){return ro(this,e)},transform(e){return Ao(this,mo(e))},default(e){return So(this,e)},prefault(e){return wo(this,e)},catch(e){return Oo(this,e)},pipe(e){return Ao(this,e)},readonly(){return Mo(this)},describe(e){let t=this.clone();return $n.add(t,{description:e}),t},meta(...e){if(e.length===0)return $n.get(this);let t=this.clone();return $n.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 $n.get(e)?.description},configurable:!0}),e)),la=p(`_ZodString`,(e,t)=>{Ot.init(e,t),ca.init(e,t),e._zod.processJSONSchema=(t,n,r)=>fi(e,t,n,r);let n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,sa(e,`_ZodString`,{regex(...e){return this.check(Hr(...e))},includes(...e){return this.check(Gr(...e))},startsWith(...e){return this.check(Kr(...e))},endsWith(...e){return this.check(qr(...e))},min(...e){return this.check(Br(...e))},max(...e){return this.check(zr(...e))},length(...e){return this.check(Vr(...e))},nonempty(...e){return this.check(Br(1,...e))},lowercase(e){return this.check(Ur(e))},uppercase(e){return this.check(Wr(e))},trim(){return this.check(Xr())},normalize(...e){return this.check(Yr(...e))},toLowerCase(){return this.check(Zr())},toUpperCase(){return this.check(Qr())},slugify(){return this.check($r())}})}),ua=p(`ZodString`,(e,t)=>{Ot.init(e,t),la.init(e,t),e.email=t=>e.check(tr(pa,t)),e.url=t=>e.check(sr(ga,t)),e.jwt=t=>e.check(Sr(Ma,t)),e.emoji=t=>e.check(cr(va,t)),e.guid=t=>e.check(nr(ma,t)),e.uuid=t=>e.check(rr(ha,t)),e.uuidv4=t=>e.check(ir(ha,t)),e.uuidv6=t=>e.check(ar(ha,t)),e.uuidv7=t=>e.check(or(ha,t)),e.nanoid=t=>e.check(lr(ya,t)),e.guid=t=>e.check(nr(ma,t)),e.cuid=t=>e.check(ur(ba,t)),e.cuid2=t=>e.check(dr(xa,t)),e.ulid=t=>e.check(fr(Sa,t)),e.base64=t=>e.check(yr(ka,t)),e.base64url=t=>e.check(br(Aa,t)),e.xid=t=>e.check(pr(Ca,t)),e.ksuid=t=>e.check(mr(wa,t)),e.ipv4=t=>e.check(hr(Ta,t)),e.ipv6=t=>e.check(gr(Ea,t)),e.cidrv4=t=>e.check(_r(Da,t)),e.cidrv6=t=>e.check(vr(Oa,t)),e.e164=t=>e.check(xr(ja,t)),e.datetime=t=>e.check(Bi(t)),e.date=t=>e.check(Hi(t)),e.time=t=>e.check(Wi(t)),e.duration=t=>e.check(Ki(t))});function da(e){return er(ua,e)}var fa=p(`ZodStringFormat`,(e,t)=>{kt.init(e,t),la.init(e,t)}),pa=p(`ZodEmail`,(e,t)=>{Mt.init(e,t),fa.init(e,t)}),ma=p(`ZodGUID`,(e,t)=>{At.init(e,t),fa.init(e,t)}),ha=p(`ZodUUID`,(e,t)=>{jt.init(e,t),fa.init(e,t)}),ga=p(`ZodURL`,(e,t)=>{Nt.init(e,t),fa.init(e,t)});function _a(e){return sr(ga,e)}var va=p(`ZodEmoji`,(e,t)=>{Pt.init(e,t),fa.init(e,t)}),ya=p(`ZodNanoID`,(e,t)=>{Ft.init(e,t),fa.init(e,t)}),ba=p(`ZodCUID`,(e,t)=>{It.init(e,t),fa.init(e,t)}),xa=p(`ZodCUID2`,(e,t)=>{Lt.init(e,t),fa.init(e,t)}),Sa=p(`ZodULID`,(e,t)=>{Rt.init(e,t),fa.init(e,t)}),Ca=p(`ZodXID`,(e,t)=>{zt.init(e,t),fa.init(e,t)}),wa=p(`ZodKSUID`,(e,t)=>{Bt.init(e,t),fa.init(e,t)}),Ta=p(`ZodIPv4`,(e,t)=>{Gt.init(e,t),fa.init(e,t)}),Ea=p(`ZodIPv6`,(e,t)=>{Kt.init(e,t),fa.init(e,t)}),Da=p(`ZodCIDRv4`,(e,t)=>{qt.init(e,t),fa.init(e,t)}),Oa=p(`ZodCIDRv6`,(e,t)=>{Jt.init(e,t),fa.init(e,t)}),ka=p(`ZodBase64`,(e,t)=>{Xt.init(e,t),fa.init(e,t)}),Aa=p(`ZodBase64URL`,(e,t)=>{Qt.init(e,t),fa.init(e,t)}),ja=p(`ZodE164`,(e,t)=>{$t.init(e,t),fa.init(e,t)}),Ma=p(`ZodJWT`,(e,t)=>{tn.init(e,t),fa.init(e,t)}),Na=p(`ZodNumber`,(e,t)=>{nn.init(e,t),ca.init(e,t),e._zod.processJSONSchema=(t,n,r)=>pi(e,t,n,r),sa(e,`ZodNumber`,{gt(e,t){return this.check(Ir(e,t))},gte(e,t){return this.check(Lr(e,t))},min(e,t){return this.check(Lr(e,t))},lt(e,t){return this.check(Pr(e,t))},lte(e,t){return this.check(Fr(e,t))},max(e,t){return this.check(Fr(e,t))},int(e){return this.check(Ia(e))},safe(e){return this.check(Ia(e))},positive(e){return this.check(Ir(0,e))},nonnegative(e){return this.check(Lr(0,e))},negative(e){return this.check(Pr(0,e))},nonpositive(e){return this.check(Fr(0,e))},multipleOf(e,t){return this.check(Rr(e,t))},step(e,t){return this.check(Rr(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 Pa(e){return Dr(Na,e)}var Fa=p(`ZodNumberFormat`,(e,t)=>{rn.init(e,t),Na.init(e,t)});function Ia(e){return Or(Fa,e)}var La=p(`ZodBoolean`,(e,t)=>{an.init(e,t),ca.init(e,t),e._zod.processJSONSchema=(t,n,r)=>mi(e,t,n,r)});function Ra(e){return kr(La,e)}var za=p(`ZodNull`,(e,t)=>{on.init(e,t),ca.init(e,t),e._zod.processJSONSchema=(t,n,r)=>hi(e,t,n,r)});function Ba(e){return Ar(za,e)}var Va=p(`ZodUnknown`,(e,t)=>{sn.init(e,t),ca.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function Ha(){return jr(Va)}var Ua=p(`ZodNever`,(e,t)=>{cn.init(e,t),ca.init(e,t),e._zod.processJSONSchema=(t,n,r)=>_i(e,t,n,r)});function Wa(e){return Mr(Ua,e)}var Ga=p(`ZodVoid`,(e,t)=>{ln.init(e,t),ca.init(e,t),e._zod.processJSONSchema=(t,n,r)=>gi(e,t,n,r)});function Ka(e){return Nr(Ga,e)}var qa=p(`ZodArray`,(e,t)=>{dn.init(e,t),ca.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ci(e,t,n,r),e.element=t.element,sa(e,`ZodArray`,{min(e,t){return this.check(Br(e,t))},nonempty(e){return this.check(Br(1,e))},max(e,t){return this.check(zr(e,t))},length(e,t){return this.check(Vr(e,t))},unwrap(){return this.element}})});function Ja(e,t){return ei(qa,e,t)}var Ya=p(`ZodObject`,(e,t)=>{gn.init(e,t),ca.init(e,t),e._zod.processJSONSchema=(t,n,r)=>wi(e,t,n,r),T(e,`shape`,()=>t.shape),sa(e,`ZodObject`,{keyof(){return lo(Object.keys(this._zod.def.shape))},catchall(e){return this.clone({...this._zod.def,catchall:e})},passthrough(){return this.clone({...this._zod.def,catchall:Ha()})},loose(){return this.clone({...this._zod.def,catchall:Ha()})},strict(){return this.clone({...this._zod.def,catchall:Wa()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(e){return te(this,e)},safeExtend(e){return ne(this,e)},merge(e){return H(this,e)},pick(e){return B(this,e)},omit(e){return V(this,e)},partial(...e){return U(ho,this,e[0])},required(...e){return re(To,this,e[0])}})});function Xa(e,t){return new Ya({type:`object`,shape:e??{},...R(t)})}function Za(e,t){return new Ya({type:`object`,shape:e,catchall:Wa(),...R(t)})}var Qa=p(`ZodUnion`,(e,t)=>{vn.init(e,t),ca.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ti(e,t,n,r),e.options=t.options});function $a(e,t){return new Qa({type:`union`,options:e,...R(t)})}var eo=p(`ZodDiscriminatedUnion`,(e,t)=>{Qa.init(e,t),yn.init(e,t)});function to(e,t,n){return new eo({type:`union`,options:t,discriminator:e,...R(n)})}var no=p(`ZodIntersection`,(e,t)=>{bn.init(e,t),ca.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ei(e,t,n,r)});function ro(e,t){return new no({type:`intersection`,left:e,right:t})}var io=p(`ZodTuple`,(e,t)=>{Cn.init(e,t),ca.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Di(e,t,n,r),e.rest=t=>e.clone({...e._zod.def,rest:t})});function ao(e,t,n){let r=t instanceof Dt;return new io({type:`tuple`,items:e,rest:r?t:null,...R(r?n:t)})}var oo=p(`ZodRecord`,(e,t)=>{Dn.init(e,t),ca.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Oi(e,t,n,r),e.keyType=t.keyType,e.valueType=t.valueType});function so(e,t,n){return!t||!t._zod?new oo({type:`record`,keyType:da(),valueType:e,...R(t)}):new oo({type:`record`,keyType:e,valueType:t,...R(n)})}var co=p(`ZodEnum`,(e,t)=>{On.init(e,t),ca.init(e,t),e._zod.processJSONSchema=(t,n,r)=>vi(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 co({...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 co({...t,checks:[],...R(r),entries:i})}});function lo(e,t){return new co({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...R(t)})}var uo=p(`ZodLiteral`,(e,t)=>{kn.init(e,t),ca.init(e,t),e._zod.processJSONSchema=(t,n,r)=>yi(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 fo(e,t){return new uo({type:`literal`,values:Array.isArray(e)?e:[e],...R(t)})}var po=p(`ZodTransform`,(e,t)=>{An.init(e,t),ca.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Si(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(ce(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(ce(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 mo(e){return new po({type:`transform`,transform:e})}var ho=p(`ZodOptional`,(e,t)=>{Mn.init(e,t),ca.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Li(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function go(e){return new ho({type:`optional`,innerType:e})}var _o=p(`ZodExactOptional`,(e,t)=>{Nn.init(e,t),ca.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Li(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function vo(e){return new _o({type:`optional`,innerType:e})}var yo=p(`ZodNullable`,(e,t)=>{Pn.init(e,t),ca.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ki(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function bo(e){return new yo({type:`nullable`,innerType:e})}var xo=p(`ZodDefault`,(e,t)=>{Fn.init(e,t),ca.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ji(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function So(e,t){return new xo({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():P(t)}})}var Co=p(`ZodPrefault`,(e,t)=>{Ln.init(e,t),ca.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Mi(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function wo(e,t){return new Co({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():P(t)}})}var To=p(`ZodNonOptional`,(e,t)=>{Rn.init(e,t),ca.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ai(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Eo(e,t){return new To({type:`nonoptional`,innerType:e,...R(t)})}var Do=p(`ZodCatch`,(e,t)=>{Bn.init(e,t),ca.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ni(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Oo(e,t){return new Do({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:()=>t})}var ko=p(`ZodPipe`,(e,t)=>{Vn.init(e,t),ca.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Pi(e,t,n,r),e.in=t.in,e.out=t.out});function Ao(e,t){return new ko({type:`pipe`,in:e,out:t})}var jo=p(`ZodReadonly`,(e,t)=>{Un.init(e,t),ca.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Fi(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Mo(e){return new jo({type:`readonly`,innerType:e})}var No=p(`ZodLazy`,(e,t)=>{qn.init(e,t),ca.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ri(e,t,n,r),e.unwrap=()=>e._zod.def.getter()});function Po(e){return new No({type:`lazy`,getter:e})}var Fo=p(`ZodPromise`,(e,t)=>{Kn.init(e,t),ca.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ii(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Io(e){return new Fo({type:`promise`,innerType:e})}var Lo=p(`ZodFunction`,(e,t)=>{Gn.init(e,t),ca.init(e,t),e._zod.processJSONSchema=(t,n,r)=>xi(e,t,n,r)});function Ro(e){return new Lo({type:`function`,input:Array.isArray(e?.input)?ao(e?.input):e?.input??Ja(Ha()),output:e?.output??Ha()})}var zo=p(`ZodCustom`,(e,t)=>{Jn.init(e,t),ca.init(e,t),e._zod.processJSONSchema=(t,n,r)=>bi(e,t,n,r)});function Bo(e,t={}){return ti(zo,e,t)}function Vo(e,t){return ni(e,t)}function Ho(e,t={}){let n=new zo({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 Uo(e){let t=Po(()=>$a([da(e),Pa(),Ra(),Ba(),Ja(t),so(da(),t)]));return t}var K=l(d(),1),Wo=Uo(),Go=Po(()=>to(`status`,[Xa({status:fo(`available`)}).strict(),Xa({status:fo(`unavailable`),reason:da()}).strict()])),Ko=Wo,qo=Po(()=>so(da(),Ko)),Jo=e=>Ko.parse(e),Yo=Po(()=>Xa({code:da().min(1).max(160),message:da().min(1).max(512),details:Ko.optional()}).strict()),Xo=e=>Yo.parse(e),Zo=qo,Qo=Po(()=>da().refine(e=>e.trim().length>0)),$o=Go,es=Po(()=>$a([Xa({type:fo(`action`)}).strict(),Xa({type:fo(`custom`),data:qo}).strict(),Xa({type:fo(`choice`),options:Ja(Xa({value:Ko,label:Qo,description:Qo.optional()}))}).strict(),Xa({type:fo(`form`),submitLabel:Qo.optional()}).strict(),Xa({type:fo(`confirmation`),message:Qo,confirmLabel:Qo.optional(),cancelLabel:Qo.optional()}).strict()])),ts=Po(()=>Xa({inputSchema:Zo.optional(),outputSchema:Zo.optional(),presentation:es.optional()}).strict()),ns=Po(()=>Pa().int().refine(e=>Number.isSafeInteger(e))),rs=Po(()=>Xa({hint:Qo.pipe(da().max(120)),words:Ja(Xa({word:da().regex(/^\S{1,64}$/u),description:Qo.pipe(da().max(512)).optional(),arguments:qo}).strict()).max(32).optional(),text:Xa({field:Qo.pipe(da().max(120)),arguments:qo,requestIdField:Qo.pipe(da().max(120)).optional()}).strict().optional()}).strict().refine(e=>e.words!==void 0||e.text!==void 0,`slash arguments need words or text`)),is=Po(()=>Xa({order:ns.optional()}).strict()),as=Po(()=>Xa({bindings:Xa({order:ns.optional(),values:Ja(Qo).max(16)}).strict().optional(),agent:Xa({keybind:Qo.optional(),order:ns.optional()}).strict().optional(),help:is.optional(),menu:is.optional(),palette:is.optional(),slash:Xa({aliases:Ja(Qo).max(16),consumesDraft:Ra().optional(),order:ns.optional(),arguments:rs.optional()}).strict().optional()}).strict()),os=Po(()=>Xa({id:Qo.refine(e=>!e.includes(`:`)),title:Qo,category:Qo,description:Qo.optional(),projections:as.optional(),action:ts.optional(),availability:$o.optional()}).strict()),ss=e=>os.parse(e),cs=Po(()=>Xa({inputSchema:Zo.optional(),outputSchema:Zo.optional()}).strict()),ls=da().min(1).brand();Po(()=>Xa({commandId:ls,command:Xa({namespace:da(),id:da()}).strict(),sourceId:da(),scope:da().optional(),title:da(),category:da(),description:da().optional(),order:Pa(),availability:Go,action:cs.optional(),keybind:da().optional()}).strict());var us=8192,ds=Qo.pipe(da().max(us)),fs=Qo.pipe(da().max(60)),ps=_a({protocol:/^https?$/u}),ms=Xa({label:ds,value:ds}).strict(),hs={summary:ds.optional(),facts:Ja(ms).max(4).optional(),body:ds.optional(),bodyLabel:ds.optional(),details:Ja(ms).max(24).optional()};to(`type`,[Xa({type:fo(`choice`),message:fs,...hs,current:ds.optional(),collapsedGroup:ds.optional(),options:Ja(Xa({value:ds,label:ds,description:ds.optional(),group:ds.optional(),destructive:fo(!0).optional()}).strict()).min(1).max(256)}).strict(),Xa({type:fo(`text`),message:fs,...hs,placeholder:ds.optional(),secret:Ra().optional()}).strict(),Xa({type:fo(`confirmation`),message:fs,...hs,confirmLabel:ds.optional(),cancelLabel:ds.optional(),destructive:fo(!0).optional()}).strict(),Xa({type:fo(`decision`),message:fs,...hs,options:Ja(Xa({value:ds,label:ds,description:ds.optional(),destructive:fo(!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:Ra().optional(),other:Xa({label:ds,placeholder:ds.optional(),maxLength:Pa().int().min(1).max(us),blank:ds.optional()}).strict().optional(),escape:ds.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`)]),Po(()=>to(`type`,[Xa({type:fo(`info`),message:ds,links:Ja(Xa({url:ps,label:ds.optional()}).strict()).max(16).optional()}).strict(),Xa({type:fo(`progress`),message:ds}).strict(),Xa({type:fo(`handoff`),url:ps,code:ds.optional(),message:ds.optional()}).strict(),Xa({type:fo(`success`),message:ds}).strict()]));var gs=class extends Error{code;details;constructor(e,t,n){super(t),this.code=e,this.details=n,this.name=`WhistleActionError`}},_s=class extends Error{constructor(){super(`Whistle runtime is closed`),this.name=`WhistleClosedError`}};function vs(){let e=!1,t=Zs,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=Zs,s(),o.clear())},contribute:t=>{if(Ds(t),e)throw new _s;Os(t,n),ks(t,n);let r=Symbol(`whistle-contribution`);Es(t)||(n=[...n,{contribution:As(t),generation:r}],i=!0,s());let a=!0;return Ys(o=>{if(!a||e)return;let c={...t,commands:o};Ds(c);let l=n.findIndex(e=>e.generation===r),u=n.filter(e=>e.generation!==r);Os(c,u),ks(c,u);let d=As(c);if(Es(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=Ts(t,n);if(i===void 0)return{status:`missing`};let o;try{let e=$s(i);if(e.status===`unavailable`)return e;let n=a.at(-1)?.presenter;r.interaction===void 0&&n!==void 0&&ys.has(r.origin)&&(o=n({commandId:ws(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=tc(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 Zs;let a=n.flatMap(e=>e.contribution.commands.map($s));return(i||a.some((e,t)=>!ec(e,r[t])))&&(t=nc(n,a),r=a,i=!1),t},subscribe:t=>e?()=>void 0:(o.add(t),()=>{o.delete(t)})})}var ys=new Set([`browser`,`keyboard`,`menu`,`palette`,`slash`,`terminal`]),bs=16,xs=32,Ss=64,Cs=256;function ws(e,t){return ls.parse(`${e}:${t}`)}function Ts(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 Es(e){return e.commands.length===0}function Ds(e){qs(e.sourceId,`source ID`),qs(e.namespace,`namespace`),e.scope!==void 0&&qs(e.scope,`scope`);for(let t of e.commands)Hs(t)}function Os(e,t){t.find(t=>t.contribution.namespace===e.namespace&&t.contribution.sourceId!==e.sourceId)!==void 0&&Xs(`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(ws(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=ws(e.namespace,t.id);n.has(i)&&Xs(`Canonical command ID is already registered`),n.add(i);for(let e of t.projections?.slash?.aliases??[])r.has(e)&&Xs(`Slash alias is already registered`),r.add(e)}}function ks(e,t){t.length>=Ss&&Xs(`Live contribution capacity exceeded`),t.reduce((e,t)=>e+t.contribution.commands.length,0)+e.commands.length>Cs&&Xs(`Live command capacity exceeded`)}function As(e){let t={sourceId:e.sourceId,namespace:e.namespace,commands:e.commands.map(js)};return e.scope===void 0?t:{...t,scope:e.scope}}function js(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=Ms(e.action)),e.availability!==void 0&&(t.availability=e.availability),e.projections!==void 0&&(t.projections=Is(e.projections)),t}function Ms(e){let t={};return e.inputSchema!==void 0&&(t.inputSchema=Ns(e.inputSchema)),e.outputSchema!==void 0&&(t.outputSchema=Ns(e.outputSchema)),e.presentation!==void 0&&(t.presentation=Fs(e.presentation)),Object.freeze(t)}function Ns(e){return Object.freeze(Object.fromEntries(Object.entries(e).map(([e,t])=>[e,Ps(t)])))}function Ps(e){return Array.isArray(e)?Object.freeze(e.map(Ps)):e!==null&&e instanceof Object?Object.freeze(Object.fromEntries(Object.entries(e).map(([e,t])=>[e,Ps(t)]))):e}function Fs(e){switch(e.type){case`action`:return Object.freeze({type:`action`});case`custom`:return Object.freeze({type:`custom`,data:Ns(e.data)});case`choice`:return Object.freeze({type:`choice`,options:Object.freeze(e.options.map(e=>Object.freeze({...e,value:Ps(e.value)})))});case`form`:return Object.freeze({...e});case`confirmation`:return Object.freeze({...e})}}function Is(e){let t={};return e.bindings!==void 0&&(t.bindings=Ls(e.bindings)),e.agent!==void 0&&(t.agent=Rs(e.agent)),e.help!==void 0&&(t.help=zs(e.help.order)),e.menu!==void 0&&(t.menu=zs(e.menu.order)),e.palette!==void 0&&(t.palette=zs(e.palette.order)),e.slash!==void 0&&(t.slash=Bs(e.slash)),t}function Ls(e){let t={values:[...e.values]};return e.order!==void 0&&(t.order=e.order),t}function Rs(e){let t={};return e.keybind!==void 0&&(t.keybind=e.keybind),e.order!==void 0&&(t.order=e.order),t}function zs(e){let t={};return e!==void 0&&(t.order=e),t}function Bs(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=Vs(e.arguments)),t}function Vs(e){let t={hint:e.hint};return e.words!==void 0&&(t.words=Object.freeze(e.words.map(e=>Object.freeze({...e,arguments:Ns(e.arguments)})))),e.text!==void 0&&(t.text=Object.freeze({...e.text,arguments:Ns(e.text.arguments)})),Object.freeze(t)}function Hs(e){qs(e.id,`command ID`,!0),qs(e.title,`title`),qs(e.category,`category`),Us(e.action),Ws(e.projections)}function Us(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 Ws(e){if(e!==void 0){for(let t of[e.bindings,e.palette,e.slash,e.help,e.menu,e.agent])t!==void 0&&Js(t.order);if(e.bindings!==void 0&&Ks(e.bindings.values,`binding`),e.slash!==void 0){Ks(e.slash.aliases,`slash alias`);for(let t of e.slash.aliases)/\s/u.test(t)&&Xs(`slash alias must not contain whitespace`);Gs(e.slash.arguments)}e.agent?.keybind!==void 0&&qs(e.agent.keybind,`agent keybind`)}}function Gs(e){if(e===void 0)return;qs(e.hint,`argument hint`),e.words===void 0&&e.text===void 0&&Xs(`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)&&Xs(`argument word must not contain whitespace`),t.has(n.word)&&Xs(`argument word is repeated`),t.add(n.word),n.description!==void 0&&qs(n.description,`argument word description`);t.size>xs&&Xs(`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 Ks(e,t){e.length>bs&&Xs(`${t} count exceeds 16`);for(let n of e)qs(n,t)}function qs(e,t,n=!1){e.trim().length===0&&Xs(`${t} must not be blank`),n&&e.includes(`:`)&&Xs(`${t} must not contain a colon`)}function Js(e){e!==void 0&&!Number.isSafeInteger(e)&&Xs(`order must be a safe integer`)}function Ys(e=()=>void 0,t=()=>void 0){return Object.freeze({update:e,dispose:t})}function Xs(e){throw Error(e)}var Zs=Object.freeze({bindings:Object.freeze([]),palette:Object.freeze([]),slash:Object.freeze([]),help:Object.freeze([]),menu:Object.freeze([]),agent:Object.freeze([])}),Qs=Object.freeze({status:`available`});function $s(e){let t=e.availability?.()??Qs;return t.status===`available`?Qs:Object.freeze({status:`unavailable`,reason:t.reason})}function ec(e,t){return e.status===`available`?t?.status===`available`:t?.status===`unavailable`&&e.reason===t.reason}function tc(e){if(e instanceof gs){let t={code:e.code,message:e.message};return Object.freeze(e.details===void 0?t:{...t,details:Ps(e.details)})}return Object.freeze({code:`command_failed`,message:e.message})}function nc(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++]??Qs;if(u?.bindings!==void 0)for(let t of u.bindings.values)n.push({...lc(e,l,u.bindings.order,d),binding:t});if(u?.palette!==void 0&&r.push({...lc(e,l,u.palette.order,d)}),u?.slash!==void 0)for(let t of u.slash.aliases){let n={...lc(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({...lc(e,l,u.help.order,d)}),u?.menu!==void 0&&o.push({...lc(e,l,u.menu.order,d)}),u?.agent!==void 0&&s.push(dc(e,l,u.agent,d))}}return oc(n),sc(i),ac(r),ac(a),ac(o),ac(s),Object.freeze({bindings:cc(n),palette:cc(r),slash:cc(i),help:cc(a),menu:cc(o),agent:cc(s)})}var rc=new TextEncoder;function ic(e,t){let n=rc.encode(e),r=rc.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 ac(e){e.sort((e,t)=>e.order-t.order||ic(e.commandId,t.commandId))}function oc(e){e.sort((e,t)=>e.order-t.order||ic(e.commandId,t.commandId)||ic(e.binding,t.binding))}function sc(e){e.sort((e,t)=>e.order-t.order||ic(e.commandId,t.commandId)||ic(e.alias,t.alias))}function cc(e){return Object.freeze(e.map(e=>Object.freeze(e)))}function lc(e,t,n,r){let i=uc(e,t,n,r);return e.scope===void 0?i:{...i,scope:e.scope}}function uc(e,t,n,r){let i={commandId:ws(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 dc(e,t,n,r){let i=lc(e,t,n.order,r),a=i.action===void 0?i:{...i,action:fc(i.action)};return n.keybind===void 0?a:{...a,keybind:n.keybind}}function fc(e){let t={};return e.inputSchema!==void 0&&(t.inputSchema=e.inputSchema),e.outputSchema!==void 0&&(t.outputSchema=e.outputSchema),Object.freeze(t)}function pc(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()};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:Jo(r)}).then(e=>{n?e():r.push(e)},e=>{console.warn(`App command ${i.id} was not registered`,e)})}return()=>{if(!n){n=!0;for(let e of r.splice(0))e()}}}var mc=(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}}},hc={pipe(){return mc(this,arguments)}},gc=function(){function e(){}return e.prototype=hc,e}(),_c=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)}}}},vc=e=>e,yc=e=>()=>e,bc=yc(!0),xc=yc(null),Sc=yc(void 0),Cc=Sc;function wc(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 Tc(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 Ec(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 Dc=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},Oc=new WeakSet,kc=e=>new Uint8Array(e.buffer,e.byteOffset,e.byteLength),Ac=0,jc=()=>{Ac++};function Mc(e){return typeof e==`string`}function Nc(e){return typeof e==`number`}function Pc(e){return typeof e==`boolean`}function Fc(e){return typeof e==`symbol`}function Ic(e){return Mc(e)||Nc(e)||Fc(e)}function Lc(e){return typeof e==`function`}function Rc(e){return e===void 0}function zc(e){return e!=null}function Bc(e){return!0}function Vc(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Hc(e){return typeof e==`object`&&!!e||Lc(e)}var Uc=_c(2,(e,t)=>Hc(e)&&t in e),Wc=`~effect/Hash`,Gc=e=>{switch(typeof e){case`number`:return Zc(e);case`bigint`:return Qc(e.toString(10));case`string`:return Qc(e);case`function`:case`object`:if(e===null)break;if(e instanceof Date)return Number.isNaN(e.getTime())?Qc(`Invalid Date`):Qc(e.toISOString());if(e instanceof RegExp)return Qc(e.toString());{if(Oc.has(e))return Kc(e);let t=sl.get(e);if(t!==void 0)return t;if(cl.has(e))return jc(),Qc(`[Circular]`);cl.add(e);let n=Ac,r;try{r=`~effect/Hash`in e?e[Wc]():typeof e==`function`?Kc(e):e instanceof DataView?nl(kc(e)):Array.isArray(e)||ArrayBuffer.isView(e)?nl(e):e instanceof Map?rl(e):e instanceof Set?al(e):el(e)}finally{cl.delete(e)}return n===Ac&&sl.set(e,r),r}}return Yc(qc(Qc(String(e))))},Kc=e=>(ol.has(e)||ol.set(e,Yc(Math.random()*4294967296|0)),ol.get(e)),qc=e=>(e^=e>>>16,e=Math.imul(e,2246822507),e^=e>>>13,e=Math.imul(e,3266489909),e^e>>>16),Jc=_c(2,(e,t)=>qc(Math.imul(e,2654435761)+Math.imul(t,2246822507))),Yc=e=>e&3221225471|e>>>1&1073741824,Xc=new DataView(new ArrayBuffer(8)),Zc=e=>{let t=e|0;return t===e?Yc(t):(Xc.setFloat64(0,e===e?e:NaN),Yc(Jc(Xc.getInt32(0),Xc.getInt32(4))))},Qc=e=>{let t=5381,n=e.length;for(;n;)t=t*33^e.charCodeAt(--n);return Yc(t)},$c=(e,t)=>{let n=12289;for(let r of t)n^=Jc(Gc(r),Gc(e[r]));return Yc(n)},el=e=>$c(e,Dc(e)),tl=(e,t)=>n=>{let r=e;for(let e of n)r^=t(e);return Yc(r)},nl=e=>{let t=6151;for(let n of e)t=Jc(t,Gc(n));return Yc(t)},rl=tl(Qc(`Map`),([e,t])=>Jc(Gc(e),Gc(t))),il=Qc(`Set`),al=tl(il,e=>Jc(il,Gc(e))),ol=new WeakMap,sl=new WeakMap,cl=new WeakSet,ll=`~effect/Equal`;function ul(){return arguments.length===1?e=>dl(e,arguments[0]):dl(arguments[0],arguments[1])}function dl(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`||Oc.has(e)||Oc.has(t)?!1:fl(e,t):!1}function fl(e,t){let n=ml.length;for(let r=n;r-->0;)if(ml[r]===e&&hl[r]===t)return!0;if(n)return pl(e,t);let r=gl.get(e);r||gl.set(e,r=new WeakMap);let i=r.get(t);return i===void 0&&r.set(t,i=pl(e,t)),i}function pl(e,t){ml.push(e),hl.push(t);try{return _l(e,t)}finally{ml.pop(),hl.pop()}}var ml=[],hl=[],gl=new WeakMap;function _l(e,t){if(Gc(e)!==Gc(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=wl(e);if(n!==wl(t)||typeof e==`function`&&!n)return!1;if(n)return e[ll](t);if(Array.isArray(e))return!Array.isArray(t)||e.length!==t.length?!1:vl(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?yl(kc(e),kc(t)):yl(e,t)}return e instanceof Map?!(t instanceof Map)||e.size!==t.size?!1:xl(e,t,Sl,Cl):e instanceof Set?!(t instanceof Set)||e.size!==t.size?!1:xl(e,t,Gc,dl):bl(e,t)}function vl(e,t){for(let n=0;n<e.length;n++)if(!dl(e[n],t[n]))return!1;return!0}function yl(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 bl(e,t){let n=Dc(e),r=Dc(t);if(n.size!==r.size)return!1;for(let i of n)if(!r.has(i)||!dl(e[i],t[i]))return!1;return!0}function xl(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 Sl=e=>Gc(e[0]),Cl=(e,t)=>dl(e[0],t[0])&&dl(e[1],t[1]),wl=e=>Uc(e,ll),Tl=e=>e.length>0;function El(e,t,n){t===`__proto__`?Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0}):e[t]=n}function Dl(e,t){for(let n of Reflect.ownKeys(t))Object.prototype.propertyIsEnumerable.call(t,n)&&El(e,n,t[n])}var Ol=Symbol.for(`~effect/Redactable`),kl=e=>Uc(e,Ol);function Al(e){return kl(e)?jl(e):e}function jl(e){return e[Ol](globalThis[`~effect/Fiber/currentFiber`]?.context??Pl)}var Ml=`~effect/Fiber/currentFiber`,Nl=new Map,Pl={"~effect/Context":{},base:Nl,depth:0,mapUnsafe:Nl,pipe(){return mc(this,arguments)}};function Fl(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 Il;r.add(e);let l;if(Ol in e)l=c(jl(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(`,
|
|
65
|
+
`+a(n+1))}\n${a(n)}]`;else if(e instanceof Date)l=zl(e);else if(!t?.ignoreToString&&Uc(e,`toString`)&&typeof e.toString==`function`&&e.toString!==Object.prototype.toString&&e.toString!==Array.prototype.toString){let t=Bl(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=>`${Ll(t)}:${c(Vl(e,t),n)}`).join(`,`)}}`;l=o(e,r)}else{let r=`{\n${t.map(t=>`${a(n+1)}${Ll(t)}: ${c(Vl(e,t),n+1)}`).join(`,
|
|
66
|
+
`)}\n${a(n)}}`;l=o(e,r)}}return r.delete(e),l}return String(e)}return c(e,0)}var Il=`[Circular]`;function Ll(e){return typeof e==`string`?JSON.stringify(e):String(e)}function Rl(e){return e.map(e=>`[${Ll(e)}]`).join(``)}function zl(e){try{return e.toISOString()}catch{return`Invalid Date`}}function Bl(e){try{let t=e.toString();return typeof t==`string`?t:String(t)}catch{return`[toString threw]`}}function Vl(e,t){try{return e[t]}catch{return`[property access threw]`}}function Hl(e,t){let n=[];return JSON.stringify(e,function(e,t){let r=Object.getOwnPropertyDescriptor(this,e)?.value,i=Uc(r,Ol)?Al(r):Al(t);if(typeof i==`bigint`)return Fl(i);if(typeof i!=`object`||!i)return i;let a=i instanceof Error&&!Uc(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),!Ul(a)||Wl(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:Al(n)}});return n.push(o),o},t?.space)??`null`}function Ul(e){for(let t of Object.getOwnPropertyNames(e))if(Object.getOwnPropertyDescriptor(e,t)?.get!==void 0)return!0;return!1}function Wl(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 Gl=Symbol.for(`nodejs.util.inspect.custom`),Kl=e=>{try{return e=Al(e),Uc(e,`toJSON`)&&Lc(e.toJSON)&&e.toJSON.length===0?e.toJSON():Array.isArray(e)?e.map(Kl):e}catch{return`[toJSON threw]`}},ql={toJSON(){return Kl(this)},[Gl](){return this.toJSON()},toString(){return Fl(this.toJSON())}},Jl=(()=>{let e=Object.getOwnPropertyDescriptor(Error,`stackTraceLimit`);return e===void 0?Object.isExtensible(Error):Object.hasOwn(e,`writable`)?e.writable===!0:e.set!==void 0})(),Yl=()=>Error.stackTraceLimit,Xl=e=>{Jl&&(Error.stackTraceLimit=e)},Zl=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})}},Ql=(()=>{let e=`~effect/Utils/internal`,t={[e]:e=>e()},n={[e]:e=>{try{return e()}finally{}}};return Yl()!==0&&t[e](()=>Error().stack)?.includes(e)===!0?t[e]:n[e]})(),$l=`~effect/Effect`,eu=`~effect/Exit`,tu={_A:vc,_E:vc,_R:vc},nu=`${$l}/identifier`,ru=`${$l}/args`,iu=`${$l}/evaluate`,au=`${$l}/successCont`,ou=`${$l}/failureCont`,su=`${$l}/ensureCont`,cu=Symbol.for(`effect/Effect/Yield`),lu={pipe(){return mc(this,arguments)},toJSON(){return{...this}},toString(){return Fl(this.toJSON(),{ignoreToString:!0,space:2})},[Gl](){return this.toJSON()}},uu={[$l]:tu,...lu,[Symbol.iterator](){return new Zl(this)},toJSON(){return{_id:`Effect`,op:this[nu],...ru in this?{args:this[ru]}:void 0}}},du=e=>Uc(e,eu),fu=`~effect/Cause`,pu=`~effect/Cause/Reason`,mu=e=>Uc(e,fu),hu=class{constructor(e){this[fu]=fu,this.reasons=e}pipe(){return mc(this,arguments)}toJSON(){return{_id:`Cause`,failures:this.reasons.map(e=>e.toJSON())}}toString(){return`Cause(${Fl(this.reasons)})`}[Gl](){return this.toJSON()}[ll](e){return mu(e)&&this.reasons.length===e.reasons.length&&this.reasons.every((t,n)=>ul(t,e.reasons[n]))}[Wc](){return nl(this.reasons)}},gu=new WeakMap,_u=class{[pu];annotations;_tag;constructor(e,t,n){if(this[pu]=pu,this._tag=e,t!==vu&&typeof n==`object`&&n&&t.size>0){let e=gu.get(n);e&&(t=new Map([...e,...t])),gu.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 mc(this,arguments)}toString(){return Fl(this)}[Gl](){return this.toString()}},vu=new Map,yu=class extends _u{constructor(e,t=vu){super(`Fail`,t,e),this.error=e}toString(){return`Fail(${Fl(this.error)})`}toJSON(){return{_tag:`Fail`,error:this.error}}[ll](e){return Du(e)&&ul(this.error,e.error)&&ul(this.annotations,e.annotations)}[Wc](){return Jc(Qc(this._tag))(Jc(Gc(this.error))(Gc(this.annotations)))}},bu=e=>new hu(e),xu=(e,t)=>{let n=new Map,r=[];for(let i of e.concat(t)){let e=Gc(i),t=n.get(e);if(t===void 0)n.set(e,[i]);else if(t.some(e=>ul(e,i)))continue;else t.push(i);r.push(i)}return r},Su=_c(2,(e,t)=>{if(e.reasons.length===0)return t;if(t.reasons.length===0)return e;let n=new hu(xu(e.reasons,t.reasons));return ul(e,n)?e:n}),Cu=e=>new hu([new yu(e)]),wu=class extends _u{constructor(e,t=vu){super(`Die`,t,e),this.defect=e}toString(){return`Die(${Fl(this.defect)})`}toJSON(){return{_tag:`Die`,defect:this.defect}}[ll](e){return Ou(e)&&ul(this.defect,e.defect)&&ul(this.annotations,e.annotations)}[Wc](){return Jc(Qc(this._tag))(Jc(Gc(this.defect))(Gc(this.annotations)))}},Tu=e=>new hu([new wu(e)]),Eu=_c(e=>mu(e[0]),(e,t,n)=>t.mapUnsafe.size===0?e:new hu(e.reasons.map(e=>e.annotate(t,n)))),Du=e=>e._tag===`Fail`,Ou=e=>e._tag===`Die`,ku=e=>e._tag===`Interrupt`;function eee(e){return Ru(`Effect.evaluate: Not implemented`)}var Au=e=>({...uu,[nu]:e.op,[iu]:e[iu]??eee,[au]:e[au],[ou]:e[ou],[su]:e[su]}),ju=e=>{let t=Au(e),n=function(e){this[ru]=e};return n.prototype=t,function(e){return new n(e)}},Mu=e=>{let t={[eu]:eu,_tag:e.op,get[e.prop](){return this[ru]},...Au(e),toString(){return`${e.op}(${Fl(this[ru])})`},toJSON(){return{_id:`Exit`,_tag:e.op,[e.prop]:this[ru]}},[ll](e){return du(e)&&e._tag===this._tag&&ul(this[ru],e[ru])},[Wc](){return Jc(Qc(e.op),Gc(this[ru]))}},n=function(e){this[ru]=e};return n.prototype=t,function(e){return new n(e)}},Nu=Mu({op:`Success`,prop:`value`,[iu](e){let t=e.getCont(au);return t?t[au](this[ru],e,this):e.yieldWith(this)}}),Pu={key:`effect/Cause/StackTrace`},Fu={key:`effect/Cause/InterruptorStackTrace`},Iu=Mu({op:`Failure`,prop:`cause`,[iu](e){let t=this[ru],n=!1;e.cache.stackFrame&&(t=Eu(t,{mapUnsafe:new Map([[Pu.key,e.cache.stackFrame]])}),n=!0);let r=e.getCont(ou),i=e._interruptedCause;if(i&&e.interruptible){let a=!1;for(;r&&e.interruptible;)a||=nu in r,r=e.getCont(ou);a&&(t=bu(t.reasons.filter(e=>e._tag!==`Fail`))),t=Su(t,i),n=!0}return r?r[ou](t,e,n?void 0:this):e.yieldWith(n?Iu(t):this)}}),Lu=e=>Iu(Cu(e)),Ru=e=>Iu(Tu(e)),zu=ju({op:`WithFiber`,[iu](e){return this[ru](e)}}),tee=function(){class e extends globalThis.Error{}let t=Au({op:`YieldableError`,[iu](){return Lu(this)}});return delete t.toString,Object.assign(e.prototype,t),e}(),Bu=function(){let e=Symbol.for(`effect/Data/Error/plainArgs`);return class extends tee{constructor(t){super(t?.message,t?.cause?{cause:t.cause}:void 0),t&&(Dl(this,t),Object.defineProperty(this,e,{value:t,enumerable:!1}))}toJSON(){return{...this[e],...this}}}}(),Vu=e=>{class t extends Bu{_tag=e}return t.prototype.name=e,t};Vu(`NoSuchElementError`);var Hu=`~effect/Option`,Uu={[Hu]:{_A:e=>e},...lu,[Symbol.iterator](){return new Zl(this)}},Wu=Object.defineProperty(Object.assign(Object.create(Uu),{_tag:`Some`,_op:`Some`,[ll](e){return Gu(e)&&qu(e)&&ul(this.value,e.value)},[Wc](){return Jc(Gc(this._tag))(Gc(this.value))},toString(){return`some(${Fl(this.value)})`},toJSON(){return{_id:`Option`,_tag:this._tag,value:Kl(this.value)}}}),"valueOrUndefined",{get(){return this.value}}),nee=Gc(`None`),ree=Object.assign(Object.create(Uu),{_tag:`None`,_op:`None`,valueOrUndefined:void 0,[ll](e){return Gu(e)&&Ku(e)},[Wc](){return nee},toString(){return`none()`},toJSON(){return{_id:`Option`,_tag:this._tag}}}),Gu=e=>Uc(e,Hu),Ku=e=>e._tag===`None`,qu=e=>e._tag===`Some`,Ju=Object.create(ree),Yu=function(e){this.value=e};Yu.prototype=Wu;var Xu=e=>new Yu(e),Zu=`~effect/Result`,Qu={[Zu]:{_A:e=>e,_E:e=>e},...lu,[Symbol.iterator](){return new Zl(this)}},iee=Object.assign(Object.create(Qu),{_tag:`Success`,_op:`Success`,[ll](e){return $u(e)&&td(e)&&ul(this.success,e.success)},[Wc](){return Jc(Gc(this._tag))(Gc(this.success))},toString(){return`success(${Fl(this.success)})`},toJSON(){return{_id:`Result`,_tag:this._tag,value:Kl(this.success)}}}),aee=Object.assign(Object.create(Qu),{_tag:`Failure`,_op:`Failure`,[ll](e){return $u(e)&&ed(e)&&ul(this.failure,e.failure)},[Wc](){return Jc(Gc(this._tag))(Gc(this.failure))},toString(){return`failure(${Fl(this.failure)})`},toJSON(){return{_id:`Result`,_tag:this._tag,failure:Kl(this.failure)}}}),$u=e=>Uc(e,Zu),ed=e=>e._tag===`Failure`,td=e=>e._tag===`Success`,nd=function(e){this.failure=e};nd.prototype=aee;var rd=e=>new nd(e),id=function(e){this.success=e};id.prototype=iee;var ad=e=>new id(e);function od(e){return(t,n)=>t===n?0:e(t,n)}var sd=od((e,t)=>e<t?-1:1),cd=od((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),oee=e=>_c(2,(t,n)=>e(t,n)===-1),ld=e=>_c(2,(t,n)=>e(t,n)===1),ud=e=>_c(2,(t,n)=>e(t,n)!==1),dd=e=>_c(2,(t,n)=>e(t,n)!==-1),fd=()=>Ju,pd=Xu,md=Ku,hd=qu,gd=_c(2,(e,{onNone:t,onSome:n})=>md(e)?t():n(e.value)),_d=_c(2,(e,t)=>md(e)?t():e.value),vd=_c(2,(e,t)=>md(e)?t():e),yd=_d(xc),bd=_d(Sc),xd=_c(2,(e,t)=>md(e)?fd():pd(t(e.value))),Sd=ad,Cd=rd,wd=ed,Td=td,Ed=_c(2,(e,t)=>wd(e)?Cd(t(e.failure)):e),Dd=_c(2,(e,{onFailure:t,onSuccess:n})=>wd(e)?t(e.failure):n(e.success)),Od=globalThis.Array,kd=_c(2,(e,t)=>[...e,t]);Od.isArray;var Ad=Tl,jd=Tl,Md=()=>[],Nd=_c(2,(e,t)=>e.map(t)),Pd=`~effect/BigDecimal`,see={[Pd]:Pd,[Wc](){let e=Ld(this);return Jc(Qc(String(e.value)),Zc(e.scale))},[ll](e){return cee(e)&&Bd(this,e)===0},toString(){return`BigDecimal(${Hd(this)})`},toJSON(){return{_id:`BigDecimal`,value:String(this.value),scale:this.scale}},[Gl](){return this.toJSON()},pipe(){return mc(this,arguments)}},cee=e=>Uc(e,Pd),lee=(e,t)=>{if(!Number.isSafeInteger(t))throw RangeError(`Scale must be a safe integer, got ${t}`);let n=Object.create(see);return n.value=e,n.scale=t,n},Fd=(e,t)=>{let n=lee(e,t);return n.normalized=n,n},Id=BigInt(0),uee=BigInt(1),dee=BigInt(10),fee=Fd(Id,0),Ld=e=>{if(e.normalized===void 0){if(e.value===Id)e.normalized=fee;else{let t=`${e.value}`,n=t.length;for(;t[n-1]===`0`;)n--;e.normalized=Fd(BigInt(t.slice(0,n)),e.scale-(t.length-n))}}return e.normalized},pee=100,mee=[uee],Rd=(e,t)=>e===t?0:e<t?-1:1,zd=(e,t)=>{let n=`${e.value<Id?-e.value:e.value}`,r=`${t.value<Id?-t.value:t.value}`,i=BigInt(n.length-r.length)-BigInt(e.scale)+BigInt(t.scale);if(i!==Id)return i<Id?-1:1;let a=Math.max(n.length,r.length);return sd(n.padEnd(a,`0`),r.padEnd(a,`0`))},Bd=(e,t)=>{if(e.scale===t.scale)return Rd(e.value,t.value);let n=Vd(e),r=Vd(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>pee)return n===-1?zd(t,e):zd(e,t);let o=mee[a]??=dee**BigInt(a);return i>0?Rd(e.value,t.value*o):Rd(e.value*o,t.value)},Vd=e=>e.value===Id?0:e.value<Id?-1:1,Hd=e=>{let t=Ld(e);if(Math.abs(t.scale)>=16)return Ud(t);let n=t.value<Id,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},Ud=e=>{if(Wd(e))return`0e+0`;let t=Ld(e),n=`${t.value}`,r=t.value<Id?2:1,i=n.slice(0,r),a=n.slice(r),o=a.length-t.scale;return`${i}${a===``?``:`.${a}`}e${o>=0?`+`:``}${o}`},Wd=e=>e.value===Id,Gd=e=>Au({op:e.label,[iu]:e.evaluate}),Kd=`~effect/Context/Service`,qd=function(){function e(){}let t=e;Object.setPrototypeOf(t,Jd);let n=(e,n)=>(t.key=e,n?.defaultValue&&(t[Xd]=Xd,t.defaultValue=n.defaultValue),n?.make&&(t.make=n.make),n?.fiberCached&&Yd.add(e),t);return arguments.length>0?n(arguments[0],arguments[1]):n},Jd={[Kd]:Kd,...Gd({label:`Service`,evaluate(e){return Nu(_f(e.context,this))}}),toJSON(){return{_id:`Service`,key:this.key}},of(e){return e},context(e){return pf(this,e)},use(e){return zu(t=>e(_f(t.context,this)))},useSync(e){return zu(t=>Nu(e(_f(t.context,this))))}},Yd=new Set,Xd=`~effect/Context/Reference`,Zd=`~effect/Context`,Qd=8,$d=8,ef=(e,t,n,r)=>{let i=Object.create(sf);return i.cacheRoot=e??i,i.base=t,i.overlay=n,i.depth=r,i._flat=void 0,i.baseHits=0,i},tf=(e,t)=>{t&&(tf(e,t.parent),e.set(t.key,t.value))},nf=e=>{if(e._flat)return e._flat;if(!e.overlay)return e._flat=e.base;let t=new Map(e.base);return tf(t,e.overlay),e._flat=t},rf=Symbol(),af=(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)?rf:(n.overlay&&++n.baseHits>=n.base.size&&n.baseHits>=$d&&(n.base=nf(n),n.overlay=void 0,n.depth=0),r)},of=e=>ef(void 0,e,void 0,0),sf={get mapUnsafe(){return nf(this)},...lu,[Zd]:{_Services:e=>e},toJSON(){return{_id:`Context`,services:Array.from(this.mapUnsafe).map(([e,t])=>({key:e,value:t}))}},[ll](e){if(!lf(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)||!ul(r,n.get(e)))return!1;return!0},[Wc](){return Zc(this.mapUnsafe.size)}},cf=(e,t)=>e.cacheRoot===t.cacheRoot,lf=e=>Uc(e,Zd),uf=e=>!!e[Xd],df=()=>ff,ff=of(new Map),pf=(e,t)=>of(new Map([[e.key,t]])),mf=_c(3,(e,t,n)=>hf(e,t.key,n)),hf=(e,t,n)=>{let r=e,i=Yd.has(t)?void 0:r.cacheRoot;if(r.depth>=Qd){let e=new Map(r.mapUnsafe);return e.set(t,n),ef(i,e,void 0,0)}return ef(i,r.base,{key:t,value:n,parent:r.overlay},r.depth+1)},gf=(e,t)=>{let n=af(e,t);return n===rf?void 0:n},_f=_c(2,(e,t)=>{let n=af(e,t.key);if(n===rf){if(uf(t))return yf(t);throw hee(t)}return n}),vf=`~effect/Context/defaultValue`,yf=e=>vf in e?e[vf]:e[vf]=e.defaultValue(),hee=e=>{let t=Error(`Service not found${e.key?`: ${String(e.key)}`:``}`);if(t.stack){let e=t.stack.split(`
|
|
67
|
+
`);e.splice(1,3),t.stack=e.join(`
|
|
68
|
+
`)}return t},bf=qd,xf=`~effect/Duration`,Sf=BigInt(0),Cf=BigInt(1),gee=BigInt(2),_ee=BigInt(10),vee=BigInt(1e3),wf=e=>BigInt(e<0?Math.ceil(e-.5):Math.floor(e+.5)),Tf=e=>wf(e*1e6),Ef=(e,t)=>{let n=e.indexOf(`.`);if(n===-1)return BigInt(e)*t;let r=e[0]===`-`,i=e.slice(n+1),a=_ee**BigInt(i.length),o=(BigInt(e.slice(+!!r,n))*a+BigInt(i))*t,s=o/a+(o%a*gee>=a?Cf:Sf);return r?-s:s},yee=/^(-?\d+(?:\.\d+)?)\s+(nanos?|micros?|millis?|seconds?|minutes?|hours?|days?|weeks?)$/,bee=e=>{switch(typeof e){case`number`:return Nf(e);case`bigint`:return Mf(e);case`string`:{if(e===`Infinity`)return Af;if(e===`-Infinity`)return jf;let t=yee.exec(e);if(!t)break;let[n,r,i]=t;if(i===`nano`||i===`nanos`)return Mf(Ef(r,Cf));if(i===`micro`||i===`micros`)return Mf(Ef(r,vee));let a=Number(r);switch(i){case`milli`:case`millis`:return Nf(a);case`second`:case`seconds`:return Eee(a);case`minute`:case`minutes`:return Dee(a);case`hour`:case`hours`:return Oee(a);case`day`:case`days`:return kee(a);case`week`:case`weeks`:return Aee(a)}break}case`object`:{if(e===null)break;if(xf in e)return e;if(Array.isArray(e))return e.length!==2||!e.every(Nc)?Df(e):Number.isNaN(e[0])||Number.isNaN(e[1])?Tee:e[0]===-1/0||e[1]===-1/0?jf:e[0]===1/0||e[1]===1/0?Af:kf(wf(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?kf(n):kf(wf(n*1e6+(t.microseconds??0)*1e3+(t.nanoseconds??0)))}}return Df(e)},Df=e=>{throw Error(`Invalid Input: ${e}`)},Of={_tag:`Millis`,millis:0},xee={_tag:`Infinity`},See={_tag:`NegativeInfinity`},Cee={[xf]:xf,[Wc](){switch(this.value._tag){case`Millis`:{let e=this.value.millis*1e6;return Number.isFinite(e)?Gc(wf(e)):Zc(this.value.millis)}case`Nanos`:return Gc(this.value.nanos);default:return el(this.value)}},[ll](e){return wee(e)&&Nee(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`}}},[Gl](){return this.toJSON()},pipe(){return mc(this,arguments)}},kf=e=>{let t=Object.create(Cee);return t.value=typeof e==`number`?isNaN(e)||e===0||Object.is(e,-0)?Of:Number.isFinite(e)?Number.isInteger(e)?{_tag:`Millis`,millis:e}:{_tag:`Nanos`,nanos:Tf(e)}:e>0?xee:See:e===Sf?Of:{_tag:`Nanos`,nanos:e},t},wee=e=>Uc(e,xf),Tee=kf(0),Af=kf(1/0),jf=kf(-1/0),Mf=e=>kf(e),Nf=e=>kf(e),Eee=e=>kf(e*1e3),Dee=e=>kf(e*6e4),Oee=e=>kf(e*36e5),kee=e=>kf(e*864e5),Aee=e=>kf(e*6048e5),Pf=e=>{let t=bee(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 Tf(t.value.millis)}},jee=_c(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(Pf(e),t.value.nanos):n.onNanos(e.value.nanos,Pf(t))),Mee=(e,t)=>jee(e,t,{onMillis:(e,t)=>e===t,onNanos:(e,t)=>e===t,onInfinity:(e,t)=>e.value._tag===t.value._tag}),Nee=_c(2,(e,t)=>Mee(e,t)),Ff=bf(`effect/Scheduler`,{fiberCached:!0,defaultValue:()=>new Bf}),If=e=>{let t=!1;return Promise.resolve().then(()=>{t||e()}),()=>{t=!0}},Lf=`setImmediate`in globalThis?e=>{let t=globalThis.setImmediate(e);return()=>globalThis.clearImmediate(t)}:e=>{let t=setTimeout(e,0);return()=>clearTimeout(t)},Rf=e=>{try{return Lf(e)}catch{return If(e)}},zf=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}},Bf=class{executionMode;setImmediate;constructor(e=`async`,t){this.executionMode=e,this.setImmediate=t??(e===`sync`?If:Rf)}shouldYield(e){return e.currentOpCount>=e.cache.maxOpsBeforeYield}makeDispatcher(){return new Vf(this.setImmediate)}},Vf=class{tasks=new zf;running=void 0;setImmediate;constructor(e=Rf){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()}},Hf=bf(`effect/Scheduler/MaxOpsBeforeYield`,{fiberCached:!0,defaultValue:()=>2048}),Uf=bf(`effect/Scheduler/PreventSchedulerYield`,{fiberCached:!0,defaultValue:()=>!1}),Wf=Vu,Gf=`~effect/encoding/EncodingError`,Kf=class extends Wf(`EncodingError`){[Gf]=Gf},qf=`effect/Tracer/ParentSpan`;qd()(qf,{fiberCached:!0});var Jf=`effect/Tracer`,Yf=`effect/Metric/FiberRuntimeMetrics`,Xf=bf(`effect/References/CurrentStackFrame`,{fiberCached:!0,defaultValue:Sc}),Zf=bf(`effect/References/TracerEnabled`,{fiberCached:!0,defaultValue:bc}),Qf=bf(`effect/References/CurrentLogLevel`,{fiberCached:!0,defaultValue:()=>`Info`}),$f=bf(`effect/References/MinimumLogLevel`,{fiberCached:!0,defaultValue:()=>`Info`}),ep=class extends _u{constructor(e,t=vu){super(`Interrupt`,t,`Interrupted`),this.fiberId=e}toString(){return`Interrupt(${this.fiberId})`}toJSON(){return{_tag:`Interrupt`,fiberId:this.fiberId}}[ll](e){return ku(e)&&this.fiberId===e.fiberId&&this.annotations===e.annotations}[Wc](){return Jc(Qc(`${this._tag}:${this.fiberId}`))(Kc(this.annotations))}},tp=e=>new hu([new ep(e)]),np=e=>{for(let t=0;t<e.reasons.length;t++){let n=e.reasons[t];if(n._tag===`Fail`)return Sd(n.error)}return Cd(e)},rp=e=>e.reasons.some(ku),ip=_c(2,(e,t)=>{let n=!1,r=e.reasons.map(e=>Du(e)?(n=!0,new yu(t(e.error),e.annotations)):e);return n?bu(r):e}),ap=(e,t)=>{let n=[],r=[];if(e.reasons.length===0)return n;let i=Yl();i!==0&&Xl(1);try{for(let i of e.reasons){if(i._tag===`Interrupt`){r.push(i);continue}n.push(op(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=dp(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(op(i,r[0].annotations,t))}}finally{i!==0&&Xl(i)}return n},op=(e,t,n)=>{let r=typeof e,i;if(e&&r===`object`){if(i=new globalThis.Error(sp(e),{cause:e.cause?op(e.cause):void 0}),typeof e.name==`string`&&(i.name=e.name),typeof e.stack==`string`)i.stack=lp(e.stack,i,t);else{let e=`${i.name}: ${i.message}`;i.stack=t?up(e,t):e}n?.includeCauseInStack&&(i.stack=mp(i));for(let t of Object.keys(e))t in i||(i[t]=e[t])}else{i=new globalThis.Error(e?r===`string`?e:Hl(e):`Unknown error: ${e}`);let n=`${i.name}: ${i.message}`;i.stack=t?up(n,t):n}return i},sp=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 Hl(e)},cp=/\((.*)\)/g,lp=(e,t,n)=>{let r=`${t.name}: ${t.message}`,i=(e.startsWith(r)?e.slice(r.length):e).split(`
|
|
69
|
+
`),a=[r];for(let e=1;e<i.length&&!/Generator\.next|~effect\/(?:Effect|Utils)/.test(i[e]);e++)a.push(i[e]);return n?up(a.join(`
|
|
70
|
+
`),n):a.join(`
|
|
71
|
+
`)},up=(e,t)=>{let n=t?.get(Pu.key);return n&&(e=`${e}\n${fp(n)}`),e},dp=(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(Fu.key);n.push(` at fiber (${t})`),r&&n.push(fp(r))}return n.join(`
|
|
72
|
+
`)},fp=e=>{let t=[],n=e,r=0;for(;n&&r<10;){let e=n.stack();if(e){let r=e.matchAll(cp),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(`
|
|
73
|
+
`)},pp=e=>ap(e).map(mp).join(`
|
|
74
|
+
`),mp=e=>e.cause?`${e.stack} {\n${hp(e.cause,` `)}\n}`:e.stack,hp=(e,t)=>{let n=e.stack.split(`
|
|
75
|
+
`),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${hp(e.cause,`${t} `)}\n${t}}`),r},gp=`~effect/Fiber`,_p={_A:vc,_E:vc},vp={id:0},yp=(()=>{try{return globalThis.process?.getBuiltinModule?.(`node:async_hooks`)?.AsyncResource}catch{return}})(),bp=()=>yp===void 0?void 0:new yp(`effect/Fiber`),xp=()=>globalThis[Ml],Sp=class{constructor(e,t=!0){this.setContext(e),this.id=++vp.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[gp](){return _p}get currentDispatcher(){return this._dispatcher??=this.cache.scheduler.makeDispatcher()}getRef(e){return _f(this.context,e)}addObserver(e){return this._exit?(e(this._exit),Cc):(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=tp(e);this.cache.stackFrame&&(n=Eu(n,pf(Pu,this.cache.stackFrame))),t&&(n=Eu(n,t)),this._interruptedCause=this._interruptedCause?Su(this._interruptedCause,n):n,this.interruptible&&(this._running?this._deferredInterrupt=!0:this.evaluate(jp(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===cu){this._asyncContext=bp();return}let n=Ep.interruptChildren&&Ep.interruptChildren(this);if(n!==void 0)return this.evaluate(rm(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=df()}runLoop(e){let t=globalThis[Ml];globalThis[Ml]=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=jp(this._interruptedCause)),this.currentOpCount++;let e=this.cache;if(!r&&!e.preventYield&&e.scheduler.shouldYield(this)){r=!0;let e=i;i=rm(Ip,()=>e)}if(i=e.tracerContext?e.tracerContext(i,this):i[iu](this),i===cu){let e=this._yielded;if(eu in e)return this._deferredInterrupt=!1,this._yielded=void 0,e;if(this._deferredInterrupt){this._yielded=void 0,e();continue}return cu}}catch(e){if(!Uc(i,iu))return Ru(`Fiber.runLoop: Not a valid effect: ${String(i)}`);i=Ru(e)}}finally{this._running=n,globalThis[Ml]=t}}getCont(e){if(this._deferredInterrupt)return this._deferredInterrupt=!1,wp;for(;;){let t=this._stack.pop();if(!t)return;let n=t[su];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&Tp-1))return Nu(e);let t=this.getCont(au);return t?t[au](e,this):this.yieldWith(Nu(e))}yieldWith(e){return this._yielded=e,cu}children(){return this._children??=new Set}pipe(){return mc(this,arguments)}setContext(e){let t=this.context;if(this.context=e,t!==void 0&&cf(t,e))return;let n=e.cacheRoot,r=n._fiberCache??=Cp(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}},Cp=e=>{let t=gf(e,Jf);return{scheduler:_f(e,Ff),tracer:t,tracerContext:t?t.context:void 0,tracerEnabled:_f(e,Zf),span:gf(e,qf),logLevel:_f(e,Qf),minimumLogLevel:_f(e,$f),stackFrame:_f(e,Xf),runtimeMetrics:gf(e,Yf),maxOpsBeforeYield:_f(e,Hf),preventYield:_f(e,Uf)}},wp={[au](e,t){return jp(t._interruptedCause)},[ou](e,t){return jp(t._interruptedCause)}},Tp=32,Ep={interruptChildren:void 0},Dp=e=>{if(!e.cache.stackFrame)return;let t=new Map;return t.set(Fu.key,e.cache.stackFrame),of(t)},Op=e=>Wp(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(Ap(r))}return a(),Np(()=>i?.())}),kp=e=>zu(t=>{let n=Dp(t),r=Md();for(let i of e)i.interruptUnsafe(t.id,n),r.push(i);return nm(Op(r))}),Ap=Nu,jp=Iu,Mp=Lu,Np=ju({op:`Sync`,[iu](e){let t=this[ru](),n=e.getCont(au);return n?n[au](t,e):e.yieldWith(Nu(t))}}),Pp=ju({op:`Suspend`,[iu](e){return this[ru]()}}),Fp=Dd({onFailure:Mp,onSuccess:Ap}),Ip=ju({op:`Yield`,[iu](e){let t=!1;return e.currentDispatcher.scheduleTask(()=>{t||e.evaluate(sm)},this[ru]??0),e.yieldWith(()=>{t=!0})}})(0),Lp=e=>Pp(()=>jp(e())),Rp=e=>Ru(e),zp=e=>Pp(()=>Mp(e())),Bp=Ap(void 0),Vp=e=>{let t=typeof e==`function`?e:e.try,n=typeof e==`function`?e=>new ete(e,`An error occurred in Effect.try`):e.catch;return Pp(()=>{try{return Ap(t())}catch(e){return Mp(n(e))}})},Hp=function(){let e=Au({op:`Async`,[iu](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(Up(()=>(t=!0,r?.abort(),i??sm))),cu):n}}),t=function(e,t){this.register=e,this.withSignal=t};return t.prototype=e,function(e,n){return new t(e,n)}}(),Up=ju({op:`AsyncFinalizer`,[su](e){e.interruptible&&(e.interruptible=!1,e._stack.push(dm))},[ou](e,t){return rp(e)?rm(qee(Iu(e),this[ru]()),()=>jp(e)):jp(e)}}),Wp=e=>Hp(e,e.length>=2),Gp=(e,t)=>Object.defineProperty(t,"length",{value:e,configurable:!0}),Kp=(e,...t)=>Gp(e.length,t.length===0?function(){return qp(()=>e.apply(this,arguments))}:function(){let n=qp(()=>e.apply(this,arguments));for(let e of t)n=e(n,...arguments);return n}),qp=e=>{try{let t=e(),n;for(;;){let r=t.next(n);if(r.done)return Ap(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 Pp(()=>n?(n=!1,rm(r.value,e=>Jp(t,e))):Pp(()=>Jp(e())))}}}catch(e){return Rp(e)}},Jp=function(){let e=Au({op:`Iterator`,[au](e,t){let n=this.iterator;for(;;){let r=n.next(e);if(r.done)return Ap(r.value);if(!im(r.value))return t._stack.push(this),r.value;if(r.value._tag===`Failure`)return r.value;e=r.value.value}},[iu](e){return this[au](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)}}(),Yp=function(e){return e._stack.push(this),this[ru]},Xp=Au({op:`OnSuccess`,[iu]:Yp}),Zp=function(e,t,n){this[ru]=e,this[au]=t,this.payload=n};Zp.prototype=Xp;var Qp=function(){return this.payload},$p=(()=>{let e=`~effect/Effect/stackProbe`;return{[e]:function(){return Error().stack}}[e]()?.includes(`[as `+e+`]`)===!0})(),em=function(e,t){let n=this.payload;return t.succeedWith($p?n(e):Ql(()=>n(e)))},tm=function(e){let t=this.payload;return t(e)},nm=e=>new Zp(e,Qp,sm),rm=_c(2,(e,t)=>new Zp(e,tm,t)),im=e=>e[eu]!==void 0,am=_c(2,(e,t)=>im(e)?e._tag===`Success`?t(e.value):e:rm(e,t)),Pee=_c(2,(e,t)=>new Zp(e,em,t)),Fee=_c(2,(e,t)=>im(e)?Lee(e,t):Pee(e,t)),Iee=_c(2,(e,t)=>im(e)?Ree(e,t):Hee(e,t)),om=e=>e._tag===`Success`,sm=Nu(void 0),Lee=_c(2,(e,t)=>e._tag===`Success`?Nu(t(e.value)):e),Ree=_c(2,(e,t)=>{if(e._tag===`Success`)return e;let n=np(e.cause);return wd(n)?e:Lu(t(n.success))}),cm=_c(2,(e,t)=>new lm(e,t.length===1?t:e=>t(e))),zee=Au({op:`OnFailure`,[iu]:Yp}),lm=function(e,t){this[ru]=e,this[ou]=t};lm.prototype=zee;var Bee=_c(3,(e,t,n)=>cm(e,e=>{let r=t(e);return wd(r)?jp(r.failure):n(r.success,e)})),Vee=_c(2,(e,t)=>Bee(e,np,e=>t(e))),Hee=_c(2,(e,t)=>Vee(e,e=>zp(()=>t(e)))),Uee=function(e,t){let n=this.payload;return t.succeedWith($p?n.onSuccess(e):Ql(()=>n.onSuccess(e)))},Wee=((e,t)=>{let n=Au({op:e,[iu]:Yp,[au]:Uee,[ou]:t}),r=function(e,t){this[ru]=e,this.payload=t};return r.prototype=n,r})(`Match`,function(e,t){let n=e.reasons.find(Du);if(n===void 0)return jp(e);let r=this.payload;return t.succeedWith($p?r.onFailure(n.error):Ql(()=>r.onFailure(n.error)))}),Gee=_c(2,(e,t)=>new Wee(e,t)),um=e=>im(e)?Nu(e):Kee(e),Kee=ju({op:`Exit`,[iu](e){return e._stack.push(this),this[ru]},[au](e,t,n){return t.succeedWith(n??Nu(e))},[ou](e,t,n){return t.succeedWith(n??Iu(e))}}),qee=(e,t)=>om(e)?t:cm(t,t=>jp(Su(e.cause,t))),Jee=e=>zu(t=>t.interruptible?(t.interruptible=!1,t._stack.push(dm),e):e),dm=ju({op:`SetInterruptible`,[su](e){if(e.interruptible=this[ru],e._interruptedCause&&e.interruptible)return()=>jp(e._interruptedCause)}})(!0),fm=e=>e===`unbounded`?1/0:Math.max(1,e??1),pm=()=>e=>{let t=e.onItem,n=e.step,r=(e,t,r,a,o)=>rm(um(o),o=>n(e,t[r],o,r)??i(e,t,r+1,a)??Bp),i=(e,i,a=0,o=i.length)=>{for(;a<o;a++){let s=i[a],c=t(e,s,a);if(!im(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},Yee=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=Ru(e);return f=t,c=!0,u&&u.size>0?rm(Jee(kp(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(im(g)){if(f=n(e,o,g,a),f)break}else if(l){p=void 0;let t=Xee(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=bu(e);f=Iu(f._tag===`Failure`?Su(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??Bp)}catch(e){d(m(e))}}),u.size<s)continue;i=!0,a++;return}else return Wp(e=>{l=xp(),u=new Set,p=g,d=e;let t;try{t=h()}catch(t){return e(m(t))}return t?e(t):Pp(()=>(f??=sm,rm(u?kp(u):Bp,()=>f?._tag===`Failure`?f:Bp)))})}if(c=!0,f){if(u&&u.size>0){let e=Dp(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(Bp);else return sm}};return h()}},mm=()=>e=>Yee(e),Xee=(e,t,n=!1,r=!1,i=!1)=>{let a=e,o=i===`inherit`?a.interruptible:!i,s=new Sp(a.context,o);return r||(a.children().add(s),s._parent=a),n?s.evaluate(t):(s._asyncContext=bp(),a.currentDispatcher.scheduleTask(()=>s.evaluate(t),0)),s},hm=e=>(t,n)=>{let r=new Sp(n?.scheduler?mf(e,Ff,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},Zee=hm(df()),Qee=(e=>{let t=hm(e);return e=>{if(im(e))return e;let n=new Bf(`sync`),r=t(e,{scheduler:n});return r._dispatcher?.flush(),r._exit??Ru(new $ee(r))}})(df());Vu(`TimeoutError`),Vu(`IllegalArgumentError`),Vu(`ExceededCapacityError`);var gm=`~effect/Cause/AsyncFiberError`,$ee=class extends Vu(`AsyncFiberError`){[gm]=gm;constructor(e){super({message:`An asynchronous Effect was executed with Effect.runSync`,fiber:e})}},_m=`~effect/Cause/UnknownError`,ete=class extends Vu(`UnknownError`){[_m]=_m;constructor(e,t){super({message:t,cause:e})}},vm={bold:`1`,red:`31`,green:`32`,yellow:`33`,blue:`34`,cyan:`36`,white:`37`,gray:`90`,black:`30`,bgBrightRed:`101`};vm.gray,vm.blue,vm.green,vm.yellow,vm.red,vm.bgBrightRed,vm.black;var ym=Du,tte=Tu,bm=ip,nte=pp;qd()(`effect/Cause/StackTrace`),qd()(`effect/Cause/InterruptorStackTrace`);var rte=Nu,xm=Iu,Sm=Lu,Cm=sm,wm=om,Tm=`~effect/DateTime`,Em=`~effect/DateTime/TimeZone`,Dm={[Tm]:Tm,pipe(){return mc(this,arguments)},[Gl](){return this.toString()},toJSON(){return ite(this).toJSON()}};({...Dm}),{...Dm};var Om={[Em]:Em,[Gl](){return this.toString()}};({...Om}),{...Om};var ite=e=>new Date(e.epochMilliseconds);globalThis.String;var ate=e=>e.trim(),km=Ap,Am=Pp,jm=Mp,Mm=Lp,Nm=Rp,Pm=Vp,ote=Fp,Fm=rm,Im=um,Lm=cm,ste=Gee,cte=Zee,Rm=Qee;qd()(`effect/Effect/Transaction`);var lte=Fee,ute=Iee,zm=am,dte=Kp;qd()(`effect/DateTime/CurrentTimeZone`);var fte=e=>Vm(typeof e==`string`?Hm.encode(e):e),Bm=e=>{let t=Um(e),n=t.length;if(n%4!=0)return Cd(new Kf({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 Cd(new Kf({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=Km(t.charCodeAt(e))<<18|Km(t.charCodeAt(e+1))<<12|Km(t.charCodeAt(e+2))<<6|Km(t.charCodeAt(e+3));r[i]=n>>16,r[i+1]=n>>8&255,r[i+2]=n&255}return Sd(r)}catch(e){return Cd(new Kf({kind:`Decode`,module:`Base64`,input:t,message:e instanceof Error?e.message:`Invalid input`}))}},Vm=e=>{let t=e.length,n=``,r;for(r=2;r<t;r+=3)n+=Wm[e[r-2]>>2],n+=Wm[(e[r-2]&3)<<4|e[r-1]>>4],n+=Wm[(e[r-1]&15)<<2|e[r]>>6],n+=Wm[e[r]&63];return r===t+1&&(n+=Wm[e[r-2]>>2],n+=Wm[(e[r-2]&3)<<4],n+=`==`),r===t&&(n+=Wm[e[r-2]>>2],n+=Wm[(e[r-2]&3)<<4|e[r-1]>>4],n+=Wm[(e[r-1]&15)<<2],n+=`=`),n},Hm=new TextEncoder,Um=e=>e.replace(/[\n\r]/g,``),Wm=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`,Gm=new Uint8Array(123).fill(255);for(let e=0;e<64;e++)Gm[Wm.charCodeAt(e)]=e;Gm[61]=0;var Km=e=>{if(e>=Gm.length||Gm[e]===255)throw TypeError(`Invalid character ${String.fromCharCode(e)}`);return Gm[e]};Wf(`CookiesError`),{...ql},{...ql};var qm=new WeakMap,Jm=`~effect/Redacted`,Ym=e=>Uc(e,Jm),Xm=(e,t)=>{let n=Object.create(Zm);return t?.label&&(n.label=t.label),qm.set(n,e),n},Zm={[Jm]:{_A:e=>e},label:void 0,...lu,toJSON(){return this.toString()},toString(){return`<redacted${Mc(this.label)?`:`+this.label:``}>`},[Wc](){return Gc(qm.get(this))},[ll](e){return Ym(e)&&ul(qm.get(this),qm.get(e))}};({...lu});function Qm(e){return e.checks?e.checks[e.checks.length-1].annotations:e.annotations}function $m(e){return t=>Qm(t)?.[e]}var eh=`~structural`,th=`~identifier`,nh=`~sentinels`,rh=`~constructor`,ih=[`title`,`description`,`default`,`examples`,`readOnly`,`writeOnly`,`format`,`contentEncoding`,`contentMediaType`,`contentSchema`],ah=$m(`identifier`),oh=$m(th),sh=$m(`title`),ch=$m(`description`),lh=Tc(e=>{let t=Qm(e)?.identifier;return typeof t==`string`?t:e.getExpected(lh)}),uh=new Set([nh,eh,`representation`,`arbitraryConstraint`,`toJsonSchema`,`toCode`,`toEquivalence`,`toFormatter`,`toCodec`,`toCodecJson`,`toCodecStringTree`,`toCodecIso`,`toCodecArbitrary`]),dh=Symbol(),fh=rte,ph=fh(dh),mh=fh(dh),hh=e=>e===dh?fd():pd(e),gh=e=>e._tag===`None`?ph:fh(e.value),_h=`~effect/SchemaIssue/Issue`;function vh(e){return Uc(e,_h)&&e[_h]===_h}function yh(e){return Object.hasOwn(e,`input`)}var bh=class{[_h]=_h;constructor(e,t){t?.reportInput===!0&&e!==dh&&(this.input=e)}},xh=class extends bh{_tag=`Filter`;filter;issue;constructor(e,t,n,r){super(n,r),this.filter=e,this.issue=t}},Sh=class extends bh{_tag=`Encoding`;ast;issue;constructor(e,t,n,r){super(n,r),this.ast=e,this.issue=t}},Ch=class extends bh{_tag=`Pointer`;path;issue;constructor(e,t){super(),this.path=e,this.issue=t}},wh=class extends bh{_tag=`MissingKey`;annotations;constructor(e){super(),this.annotations=e}},Th=class extends bh{_tag=`UnexpectedKey`;ast;constructor(e,t,n){super(t,n),this.ast=e}},Eh=class extends bh{_tag=`Composite`;ast;issues;constructor(e,t,n,r){super(n,r),this.ast=e,this.issues=t}},Dh=class extends bh{_tag=`InvalidType`;ast;constructor(e,t,n){super(t,n),this.ast=e}},Oh=class extends bh{_tag=`InvalidValue`;annotations;constructor(e,t,n){super(t,n),this.annotations=e}},kh=class extends bh{_tag=`AnyOf`;ast;issues;constructor(e,t,n,r){super(n,r),this.ast=e,this.issues=t}},Ah=class extends bh{_tag=`OneOf`;ast;successes;constructor(e,t,n,r){super(n,r),this.ast=e,this.successes=t}};function jh(e,t,n){if(vh(e))return e;if(typeof e==`string`)return new Oh({message:e},t,n);let r=typeof e.issue==`string`?new Oh({message:e.issue},t,n):e.issue;return new Ch(e.path,r)}function Mh(e,t,n){if(e!==void 0)return typeof e==`boolean`?e?void 0:new Oh(void 0,t,n):jh(e,t,n)}function Nh(e,t,n,r){return Array.isArray(t)?jd(t)?t.length===1?jh(t[0],n,r):new Eh(e,Nd(t,e=>jh(e,n,r)),n,r):void 0:Mh(t,n,r)}var Ph=e=>{let t=Gh(e);if(t!==void 0)return t;switch(e._tag){case`InvalidType`:return zh(lh(e.ast),e);case`InvalidValue`:{let t=Rh(e);if(t!==void 0)return zh(t,e);let n=Lh(e);return n===void 0?`Expected a valid value`:`Invalid data ${n}`}case`MissingKey`:return`Missing key`;case`UnexpectedKey`:{let t=Lh(e);return t===void 0?`Expected no excess property`:`Unexpected key with value ${t}`}case`Forbidden`:return`Forbidden operation`;case`OneOf`:{let t=Lh(e);return t===void 0?`Expected exactly one member to match`:`Expected exactly one member to match the input ${t}`}}},Fh=e=>Gh(e.issue)??Gh(e);function Ih(e){return t=>({issues:Bh(t,[],e?.leafHook??Ph,e?.checkHook??Fh)})}function Lh(e){return yh(e)?Fl(e.input):void 0}function Rh(e){let t=e.annotations?.expected;return typeof t==`string`?t:void 0}function zh(e,t){let n=Lh(t);return n===void 0?`Expected ${e}`:`Expected ${e}, got ${n}`}function Bh(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 Bh(e.issue,t,n,r);let a=Rh(e.issue);return[{path:t,message:a===void 0?zh(Vh(e.filter),e):zh(a,e.issue)}]}case`Encoding`:return Bh(e.issue,t,n,r);case`Pointer`:return Bh(e.issue,[...t,...e.path],n,r);case`Composite`:return e.issues.flatMap(e=>Bh(e,t,n,r));case`AnyOf`:return e.issues.length===0?[{path:t,message:Gh(e)??zh(lh(e.ast),e)}]:e.issues.flatMap(e=>Bh(e,t,n,r));default:return[{path:t,message:n(e)}]}}function Vh(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=>Vh(e)).join(` & `)}}function Hh(){return e=>Wh(e,``)}var Uh=Hh();function Wh(e,t){let n;switch(e._tag){case`Filter`:{let r=Fh(e);if(r!==void 0)n=r;else{if(e.issue._tag!==`InvalidValue`)return Wh(e.issue,t);let r=Rh(e.issue);n=r===void 0?zh(Vh(e.filter),e):zh(r,e.issue)}break}case`Encoding`:return Wh(e.issue,t);case`Pointer`:return Wh(e.issue,t+Rl(e.path));case`Composite`:case`AnyOf`:if(e._tag===`Composite`||e.issues.length>0)return e.issues.map(e=>Wh(e,t)).join(`
|
|
76
|
+
`);n=Gh(e)??zh(lh(e.ast),e);break;default:n=Ph(e)}return t?`${n}\n at ${t}`:n}function Gh(e){if(e._tag===`Pointer`)return;if(e._tag===`Encoding`)return Gh(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 Kh(e){let t;for(let n of e.reasons){if(!ym(n)||!vh(n.error))return;t??=n.error}return t}function qh(e,t){let n=Kh(e);if(n===void 0)throw Error(t,{cause:e});return n}var Jh=e=>Object.assign(Object.create(hc),e),Yh=Jh({_tag:`Passthrough`});function Xh(){return Yh}function Zh(e){return Jh({_tag:`Transform`,transform:e})}function Qh(e){return Jh({_tag:`TransformEffect`,transform:e})}function $h(){return Zh(globalThis.String)}function eg(){return Zh(globalThis.Number)}function tg(){return Zh(ate)}function ng(e){return Qh((t,n)=>Pm({try:()=>JSON.parse(t,e?.reviver),catch:()=>new Oh({expected:`a valid JSON string`},t,n)}))}function rg(e){return Qh((t,n)=>Pm({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 Oh({expected:`a JSON-serializable value`},t,n)}))}function ig(){return Zh(fte)}function ag(){return Qh((e,t)=>ute(ote(Bm(e)),()=>new Oh({expected:`a valid Base64 string`},e,t)))}var og=class extends gc{_tag=`Middleware`;decode;encode;constructor(e,t){super(),this.decode=e,this.encode=t}flip(){return new og(this.encode,this.decode)}},sg=`~effect/SchemaTransformation/Transformation`,cg=class extends gc{[sg]=sg;_tag=`Transformation`;decode;encode;constructor(e,t){super(),this.decode=e,this.encode=t}flip(){return new cg(this.encode,this.decode)}};function lg(e){return Uc(e,sg)&&e[sg]===sg}var ug=e=>lg(e)?e:new cg(e.decode,e.encode);function dg(){return new cg(tg(),Xh())}var fg=new cg(Xh(),Xh());function pg(){return fg}var mg=new cg(eg(),$h()),hg=new cg(ag(),ig());function gg(e){return new cg(ng(e??{}),rg(e))}function _g(e){return t=>t._tag===e}var vg=_g(`Declaration`),yg=_g(`Null`),bg=_g(`Undefined`),xg=_g(`Never`),Sg=_g(`String`),Cg=_g(`Number`),wg=_g(`Boolean`),Tg=_g(`Literal`),Eg=_g(`UniqueSymbol`),Dg=_g(`Arrays`),Og=_g(`Objects`),kg=_g(`Union`),Ag=_g(`Suspend`),jg=class{to;transformation;constructor(e,t){this.to=e,this.transformation=t}},Mg={},Ng=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}},Pg=`~effect/Schema`,Fg=class{[Pg]=Pg;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}>`}},Ig=class extends Fg{_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===dh?ph:(e??=this.run(this.typeParameters))(t,this,n)}_rebuild(e,t,n,r,i){let a=W_(this.typeParameters,e);return a===this.typeParameters&&t===this.checks&&n===this.encodingChecks&&r===this.run&&i===this.encodingRun?this:new Ig(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>`}},Lg=new class extends Fg{_tag=`Null`;getParser(){return Q_(this,null)}getExpected(){return`null`}},Rg=class extends Fg{_tag=`Undefined`;getParser(){return Q_(this,void 0)}toCodecJson(){return P_(this,[zg])}getExpected(){return`undefined`}},zg=new jg(Lg,new cg(Zh(()=>void 0),Zh(()=>null))),Bg=new Rg,Vg=new class extends Fg{_tag=`Unknown`;getParser(){return $_(this,Bc)}getExpected(){return`unknown`}},Hg=class extends Fg{_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 ${Fl(e)}`);this.literal=e}getParser(){return Q_(this,this.literal)}matchPart(e,t){return e===globalThis.String(this.literal)?this.literal:void 0}toCodecJson(){return typeof this.literal==`bigint`?Ug(this):this}toCodecStringTree(){return typeof this.literal==`string`?this:Ug(this)}getExpected(){return typeof this.literal==`string`?JSON.stringify(this.literal):globalThis.String(this.literal)}};function Ug(e){let t=globalThis.String(e.literal);return P_(e,[new jg(new Hg(t),new cg(Zh(()=>e.literal),Zh(()=>t)))])}var Wg=new class extends Fg{_tag=`String`;getParser(){return $_(this,Mc)}matchPart(e,t){let n=this.checks;return n&&!t.disableChecks&&iv(n,e,void 0,this,t)?void 0:e}getExpected(){return`string`}},Gg=class extends Fg{_tag=`Number`;getParser(){return $_(this,Nc)}matchKey(e,t){return this._match(Ite,e,t)}matchPart(e,t){return this._match(nv,e,t)}_match(e,t,n){if(!e.test(t))return;let r=globalThis.Number(t);return n.disableChecks||!this.checks?r:iv(this.checks,r,void 0,this,n)?void 0:r}toCodecJson(){return this.checks&&(Kg(this.checks,`effect/schema/isFinite`)||Kg(this.checks,`effect/schema/isInt`))?this:P_(this,[Ste])}toCodecStringTree(){return this.toCodecJson()===this?P_(this,[Rte]):P_(this,[zte])}getExpected(){return`number`}};function Kg(e,t){return e.some(e=>e.annotations?.representation?.id===t||e._tag===`FilterGroup`&&Kg(e.checks,t))}var qg=new Gg,Jg=new class extends Fg{_tag=`Boolean`;getParser(){return $_(this,Pc)}getExpected(){return`boolean`}},Yg=class extends Fg{_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(K_(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(K_(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 Th(n,t[o],i),a=new Ch([o],r);if(i.errors===`all`)e.issues?e.issues.push(a):e.issues=[a];else return jm(new Eh(n,[a],t,i))}return e.issues?jm(new Eh(n,e.issues,t,i)):fh(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:fm(t.concurrency),f=d===1?mte(i,e,0,u):hte(i,e,{concurrency:d,end:u});if(!f)return c(i);if(im(f))return zm(f,()=>c(i));let p=!0;return Am(()=>p?(p=!1,Fm(f,()=>c(i))):l(e,t))};return(e,a)=>{if(e===dh)return ph;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)):jm(new Dh(n,e,a))}catch(e){return Nm(e)}}}_rebuild(e,t,n){let r=W_(this.elements,e),i=W_(this.rest,e);return r===this.elements&&i===this.rest&&t===this.checks&&n===this.encodingChecks?this:new Yg(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 pte(e,t,n,r){if(n._tag===`Failure`)return Zg(e,e.ast,r,n);let i=n===mh?t:n[ru];if(i!==dh)e.output[r]=i;else{let t=e.getParser(e.tailThreshold,r);if(K_(t.ast))return;let n=new Ch([r],new wh(t.ast.context?.annotations));if(e.options.errors===`all`)e.issues?e.issues.push(n):e.issues=[n];else return Sm(new Eh(e.ast,[n],e.input,e.options))}}var Xg={onItem(e,t,n){let r=n<e.len?t:dh;return e.getParser(e.tailThreshold,n).parser(r,e.options)},step:pte},mte=pm()(Xg),hte=mm()(Xg),Zg=(e,t,n,r)=>{if(r.cause.reasons.length===0)return r;let i=Kh(r.cause);if(i===void 0)return xm(bm(r.cause,r=>new Eh(t,[new Ch([n],r)],e.input,e.options)));let a=new Ch([n],i);if(e.options.errors===`all`)e.issues?e.issues.push(a):e.issues=[a];else return Sm(new Eh(t,[a],e.input,e.options))},Qg=`[+-]?\\d*\\.?\\d+(?:[Ee][+-]?\\d+)?`;function $g(e,t,n=Mg){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(ev(Y_(t)))}var e_=class{name;type;constructor(e,t){this.name=e,this.type=t}};function t_(e){switch(e._tag){case`String`:case`Number`:case`Symbol`:case`TemplateLiteral`:return!0;case`Union`:return e.types.every(t_);default:return!1}}function n_(e){let t=I_(e);switch(t._tag){case`String`:case`Number`:case`Symbol`:case`TemplateLiteral`:return!0;case`Union`:return t.types.every(n_);default:return!1}}function gte(e){return t_(e)&&n_(e)}var r_=class{parameter;type;constructor(e,t){if(!gte(e))throw Error(`Invalid index signature parameter ${e._tag}`);if(this.parameter=e,this.type=t,K_(t)&&!Z_(t))throw Error("Cannot use `Schema.optionalKey` with index signatures, use `Schema.optional` instead.")}},i_=class extends Fg{_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 $_(n,zc);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(ev(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 Zg(t,n,i,s)??Cm;let c=s===mh?o:s[ru];if(a!==dh&&c!==dh){if(r&&(e.has(i)||e.has(typeof a==`number`?globalThis.String(a):a)))return Cm;El(t.out,a,c)}return Cm},c=(e,r,i,a)=>{if(!a){let t=i.parserKey(r,e.options);if(!im(t))return Fm(Im(t),t=>c(e,r,i,t));a=t}if(a._tag===`Failure`)return Zg(e,n,r,a)??Cm;let o=a===mh?r:a[ru],s=e.input[r],l=i.parserValue(s,e.options);return im(l)?t(e,r,o,s,l):Fm(Im(l),n=>t(e,r,o,s,n))},l=(e,n,r)=>{let i=e.input[n],a=r.parserValue(i,e.options);return im(a)?t(e,n,n,i,a):Fm(Im(a),r=>t(e,n,n,i,r))},u=i?mm()({onItem:(e,[t,n])=>n.is.parameter===Wg?l(e,t,n):c(e,t,n),step:(e,t,n)=>n._tag===`Failure`?n:void 0}):void 0;return dte(function*(t,d){if(t===dh)return dh;if(!(typeof t==`object`&&t&&!Array.isArray(t)))return yield*jm(new Dh(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:fm(d.concurrency),v=i&&g?n.indexSignatures.map(e=>$g(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 Th(n,f[a],d),r=new Ch([a],e);if(h){m.issues?m.issues.push(r):m.issues=[r];continue}return yield*jm(new Eh(n,[r],t,d))}}}if(r){let e=_===1?s_(m,a):_te(m,a,{concurrency:_});e&&(yield*e)}if(i&&_===1)for(let e=0;e<i;e++){let t=o[e],n=t.is.parameter===Wg?l:c,r=v?.[e]??(t.is.parameter===Wg?Object.keys(f):$g(f,t.is.parameter,d));for(let e=0;e<r.length;e++){let i=n(m,r[e],t);if(!im(i))yield*i;else if(i._tag===`Failure`)return yield*i}}else if(u){let e=Md();for(let t=0;t<i;t++){let n=o[t],r=v?.[t]??(n.is.parameter===Wg?Object.keys(f):$g(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*jm(new Eh(n,m.issues,t,d)):p})};if(i)return c();let l,u=(e,t,n)=>{let r=a[t];return Fm(Im(n),n=>{let i=a_(e,r,n);if(i)return i;let o=()=>fh(e.out),s=s_(e,a.slice(t+1));return s?zm(s,o):o()})};return(e,t)=>{if(e===dh)return ph;if(t.errors===`all`||t.onExcessProperty!==void 0||t.concurrency!==void 0&&fm(t.concurrency)!==1)return(l??=c())(e,t);if(!(typeof e==`object`&&e&&!Array.isArray(e)))return jm(new Dh(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=v_(i,s),l=c?i[s]:dh,d=n.parser(l,t);if(!im(d))return u(o,e,d);if(d===mh){c&&El(a,s,l);continue}let f=a_(o,n,d);if(f)return f}}catch(e){return Nm(e)}return fh(a)}}_rebuild(e,t,n,r){let i=W_(this.propertySignatures,t=>{let n=e(t.type);return n===t.type?t:new e_(t.name,n)}),a=W_(this.indexSignatures,n=>{let r=t(n.parameter),i=e(n.type);return r===n.parameter&&i===n.type?n:new r_(r,i)});return i===this.propertySignatures&&a===this.indexSignatures&&n===this.checks&&r===this.encodingChecks?this:new i_(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 a_(e,t,n){if(n._tag===`Failure`)return Zg(e,e.ast,t.name,n);if(n===mh)return;let r=n[ru];if(r!==dh){El(e.out,t.name,r);return}if(delete e.out[t.name],!K_(t.type)){let n=new Ch([t.name],new wh(t.type.context?.annotations));if(e.options.errors===`all`){e.issues?e.issues.push(n):e.issues=[n];return}return Sm(new Eh(e.ast,[n],e.input,e.options))}}var o_={onItem(e,t){if(!v_(e.input,t.name))return t.parser(dh,e.options);let n=e.input[t.name];return El(e.out,t.name,n),t.parser(n,e.options)},step:a_},s_=pm()(o_),_te=mm()(o_);function c_(e,t){return e?t?[...e,...t]:e:t}function l_(e,t,n){return new i_(Reflect.ownKeys(e).map(t=>new e_(t,e[t].ast)),[],n,t)}function u_(e){return e.ast}function d_(e,t,n){return new y_(e.map(u_),t,void 0,n)}var f_=Ec(e=>{for(;;){if(Ag(e))return Vg;let t=e.encoding;if(!t)return e.recur?.(f_,vc)??e;if(t.some(e=>e.transformation._tag===`Middleware`&&e.transformation.decode!==vc))return Vg;e=t[t.length-1].to}});function p_(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(p_)));default:return[`null`,`undefined`,`string`,`number`,`boolean`,`symbol`,`bigint`,`object`,`array`,`function`]}}function m_(e){switch(e._tag){default:return[];case`Declaration`:{let t=e.annotations?.[nh];return Array.isArray(t)?t:[]}case`Objects`:return e.propertySignatures.flatMap(e=>{let t=e.type;if(!K_(t)){if(Tg(t))return[{key:e.name,literal:t.literal}];if(Eg(t))return[{key:e.name,literal:t.symbol}]}return[]});case`Arrays`:return e.elements.flatMap((e,t)=>{if(!K_(e)){if(Tg(e))return[{key:t,literal:e.literal}];if(Eg(e))return[{key:t,literal:e.symbol}]}return[]});case`Union`:{if(e.types.length===0)return[];let t=e.types.map(e=>m_(f_(e)));return t[0].filter(e=>t.every(t=>t.some(t=>t.key===e.key&&t.literal===e.literal)))}case`Suspend`:return m_(e.thunk())}}var h_=new WeakMap,g_=Object.freeze([]),__=e=>e===null?`null`:Array.isArray(e)?`array`:typeof e,v_=(e,t)=>t===`__proto__`?Object.hasOwn(e,t):t in e;function vte(e){let t=h_.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=f_(c);if(xg(l))continue;if(Tg(l)||Eg(l)){a??=new Map;let e=Tg(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=m_(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=p_(l);for(let n of e)(i[n]??=[]).push(t)}}let c={},l=e=>c[e]??=Object.freeze(i?.[e]??g_);if(o&&a)a.forEach(Object.freeze),t=e=>a.get(e)??g_;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(Hc(e)){let n=v_(e,r)?e[r]:void 0;if(n!==void 0)return a.get(n)??g_;if(t)return o}return g_}}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=__(t);if(!Hc(t))return l(a);let o=new Set(i?.[a]),s;if(e){let[n,[i]]=e,c=v_(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=v_(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=v_(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(__(e));return a?t.filter(t=>s[t]===void 0||s[t]===e):t};return h_.set(e,t),t}var y_=class extends Fg{_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===dh)return ph;let i=(o??=vte(n.types))(e,r);if(i.length===0)return jm(new kh(n,[],e,t));if(i.length===1){let r=a(i[0])(e,t);return r._tag===`Success`?r:im(r)?b_(n,r.cause,e,t):yte(n,r,e,t)}return x_(n,a,i,e,t)}}_rebuild(e,t,n){let r=W_(this.types,e);return r===this.types&&t===this.checks&&n===this.encodingChecks?this:new y_(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=Y_(t);switch(n._tag){case`Arrays`:{let t=n.elements.filter(Tg);if(t.length>0)return`${w_(n.isMutable)}[ ${t.map(t=>e(t)+T_(t.context?.isOptional)).join(`, `)}, ... ]`;break}case`Objects`:{let t=n.propertySignatures.filter(e=>Tg(e.type));if(t.length>0)return`{ ${t.map(t=>`${w_(t.type.context?.isMutable)}${Ll(t.name)}${T_(t.type.context?.isOptional)}: ${e(t.type)}`).join(`, `)}, ... }`;break}}return e(n)});return Array.from(new Set(n)).join(` | `)}};function b_(e,t,n,r){let i=Kh(t);return i?Sm(new kh(e,[i],n,r)):xm(t)}function yte(e,t,n,r){return Lm(t,t=>b_(e,t,n,r))}function x_(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=bte(a,n);if(!o)return a.out?a.out:jm(new kh(e,a.issues??[],r,i));if(im(o))return S_(o,a);let s=!0;return Am(()=>s?(s=!1,S_(o,a)):x_(e,t,n,r,i))}function S_(e,t){return zm(e,e=>t.out===mh?km(t.input):t.out?t.out:jm(new kh(t.ast,t.issues??[],t.input,t.options)))}var bte=pm()({onItem(e,t){return e.parser(t)(e.input,e.options)},step(e,t,n){if(n._tag===`Failure`){let t=Kh(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]),Sm(new Ah(e.ast,e.successes,e.input,e.options));if(e.out=n,e.successes)e.successes.push(e.ast.types[t]);else return Cm}}}),C_=new y_([new Hg(`Infinity`),new Hg(`-Infinity`),new Hg(`NaN`)]);function w_(e){return e?``:`readonly `}function T_(e){return e?`?`:``}var E_=class extends gc{_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 E_(this.run,{...this.annotations,...e},this.aborted)}abort(){return new E_(this.run,this.annotations,!0)}and(e,t){return new D_([this,e],t)}},D_=class extends gc{_tag=`FilterGroup`;checks;annotations;constructor(e,t=void 0){super(),this.checks=e,this.annotations=t}annotate(e){return new D_(this.checks,{...this.annotations,...e})}and(e,t){return new D_([this,e],t)}};function O_(e,t,n=!1){return new E_((t,n,r)=>Nh(n,e(t,n,r),t,r),t,n)}function xte(e){return O_(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 k_=z_(qg,[xte()]),Ste=new jg(new y_([k_,C_]),new cg(eg(),Zh(e=>globalThis.Number.isFinite(e)?e:globalThis.String(e))));function A_(e,t){let n=new globalThis.RegExp(e),r={source:n.source,flags:n.flags};return O_(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 j_=new WeakMap;function M_(e,t){let n=Object.assign(Object.create(Object.getPrototypeOf(e)),e,t);return Reflect.ownKeys(t).every(e=>e===`context`||e===`encoding`)&&j_.set(n,N_(e)),n}function N_(e){let t=j_.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 j_.set(e,n),n}function P_(e,t){return e.encoding===t?e:M_(e,{encoding:t})}function F_(e,t){if(e.context===t)return e;let n=N_(e);return n.context===t&&n.encoding===e.encoding?n:M_(e,{context:t})}function I_(e){return e.encoding?I_(e.encoding[e.encoding.length-1].to):e}function L_(e,t){if(e.checks){let n=e.checks[e.checks.length-1];return R_(e,kd(e.checks.slice(0,-1),n.annotate(t)))}return M_(e,{annotations:{...e.annotations,...t}})}function R_(e,t){if(e._tag===`Suspend`&&t)throw Error(`Cannot add checks to Suspend`);return e.checks===t?e:M_(e,{checks:t})}function z_(e,t){return R_(e,c_(e.checks,t))}function B_(e,t){let n=t(e.to);return n===e.to?e:new jg(n,e.transformation)}function V_(e,t){let n=e,r=n[n.length-1],i=B_(r,t);return i===r?e:kd(e.slice(0,e.length-1),i)}function H_(e){return t=>t.encoding?P_(t,V_(t.encoding,e)):t}function Cte(e,t){return H_(e=>F_(e,t))(e)}function U_(e,t){function n(r){if(r.encoding){let e=r.encoding[r.encoding.length-1];return t?.stopAt?.(e)?r:P_(r,V_(r.encoding,n))}return e(r)}return Ec(n)}function wte(e,t,n){let r=new jg(e,t);return P_(n,n.encoding?[...n.encoding,r]:[r])}function W_(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 Tte(e,t){return F_(e,e.context?new Ng(e.context.isOptional,e.context.isMutable,e.context.constructorDefault,{...e.context.annotations,...t}):new Ng(!1,!1,void 0,t))}var G_=Ec(e=>Ete(F_(e,e.context?e.context.isOptional===!1?new Ng(!0,e.context.isMutable,e.context.constructorDefault,e.context.annotations):e.context:new Ng(!0,!1)))),Ete=H_(G_),Dte=Tc(e=>G_(new y_([e,Bg])));function Ote(e,t,n){return wte(e,n,t)}function kte(e){let t=[],n=[];function r(e){switch(e._tag){case`Literal`:Ic(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 Ate(e,t){let{literals:n,parameters:r}=kte(e);return new i_(n.map(e=>new e_(e,t)),r.map(e=>new r_(e,t)))}function K_(e){return e.context?.isOptional??!1}function jte(e){return e.context?.isMutable??!1}function q_(e){return e.annotations?.[`~structural`]===!0||e._tag===`FilterGroup`&&e.checks.every(q_)}function Mte(e){function t(e){return q_(e)?[e]:e._tag===`FilterGroup`?e.checks.flatMap(t):[]}let n=e.flatMap(t);return Ad(n)?n:void 0}function Nte(e){let t=!0;function n(e){return t=t&&!e.encoding&&!Ag(e),t&&`recur`in e&&e.recur(n),e}return`recur`in e&&e.recur(n),t}var J_=Ec(e=>{let t=N_(e);if(t!==e){let n=J_(t);return n===t&&e.encoding===void 0?e:F_(n,e.context)}let n=`recur`in e?e.recur(J_):e;if(`encodingChecks`in n&&n.encodingChecks){let t=Nte(e)?n.encodingChecks:Dg(n)||Og(n)||vg(n)&&n.typeParameters.length>0?Mte(n.encodingChecks):void 0;return M_(n,{encodingChecks:void 0,checks:c_(n.checks,t)})}return n}),Y_=Ec(e=>J_(X_(e)));function Pte(e,t){let n=t,r=n.length,i=n[r-1],a=[new jg(X_(P_(e,void 0)),n[0].transformation.flip())];for(let e=1;e<r;e++)a.unshift(new jg(X_(n[e-1].to),n[e].transformation.flip()));let o=X_(i.to);return o.encoding?P_(o,[...o.encoding,...a]):P_(o,a)}var X_=Tc(e=>{if(e.encoding)return Pte(e,e.encoding);let t=N_(e);if(t!==e){let n=X_(t);return n===t?e:F_(n,e.context)}return`flip`in e?e.flip(X_):`recur`in e?e.recur(X_):e});function Z_(e){switch(e._tag){case`Undefined`:return!0;case`Union`:return e.types.some(Z_);default:return!1}}function Q_(e,t){let n=t===0?mh:fh(t);return(r,i)=>r===dh?ph:r===t?n:jm(new Dh(e,r,i))}function $_(e,t){return(n,r)=>n===dh?ph:t(n)?mh:jm(new Dh(e,n,r))}var ev=U_(e=>{switch(e._tag){default:return e;case`Number`:return e.toCodecStringTree();case`Union`:return e.recur(ev)}}),tv=U_(e=>{switch(e._tag){default:return e;case`Symbol`:case`UniqueSymbol`:return e.toCodecStringTree();case`Union`:return e.recur(tv)}}),Fte=`[\\s\\S]*?`,nv=new globalThis.RegExp(`^${Qg}$`),Ite=new globalThis.RegExp(`^(?:${Qg}|Infinity|-Infinity|NaN)$`);function Lte(e){return A_(nv,{expected:`a string representing a finite number`,representation:{id:`effect/schema/isStringFinite`,payload:null},toJsonSchema:()=>({pattern:nv.source}),...e})}var rv=z_(Wg,[Lte()]),Rte=new jg(rv,mg),zte=new jg(new y_([rv,C_]),mg);function iv(e,t,n,r,i){for(let a=0;a<e.length;a++){let o=e[a];if(o._tag===`FilterGroup`){if(n=iv(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 xh(o,e,t,i);if(n?n.push(r):n=[r],i.errors!==`all`||o.aborted)return n}}}return n}function Bte(e){if(!vg(e))return;let t=e.annotations?.[rh];return Lc(t)?t(e.typeParameters):void 0}var Vte=Qm,Hte=sh,Ute=ch;function Wte(e){return e===null||typeof e==`string`||typeof e==`boolean`||typeof e==`number`&&globalThis.Number.isFinite(e)}function Gte(e){return e===void 0||typeof e==`string`}function av(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 ov(e){return av(e,Wte)}var sv=new Ig([],()=>(e,t,n)=>ov(e)?mh:jm(new Dh(t,e,n)),{representation:{id:`effect/schema/Json`,payload:null},expected:`JSON value`,toCodecJson:()=>void 0,toCodecStringTree:()=>uv}),cv=new jg(sv,pg()),Kte=new jg(new y_([new Yg(!1,[],[sv]),new i_([],[new r_(Wg,sv)])]),pg());function lv(e){return av(e,Gte)}var uv=new jg(new Ig([],()=>(e,t,n)=>lv(e)?mh:jm(new Dh(t,e,n)),{expected:`StringTree`,toCodecStringTree:()=>void 0}),pg()),dv=(e,t,n)=>e===mh?n(t):zm(e,n);function fv(e){if(e._tag===`Middleware`)return(t,n,r)=>pv(t===mh?e.decode(fh(hh(n)),r):e.decode(lte(t,hh),r));let t=e.decode;switch(t._tag){case`Passthrough`:return(e,t)=>e===mh?fh(t):e;case`Transform`:{let e=e=>e===dh?ph:fh(t.transform(e));return(t,n)=>dv(t,n,e)}case`TransformOptional`:{let e=e=>gh(t.transform(hh(e)));return(t,n)=>dv(t,n,e)}case`TransformEffect`:return(e,n,r)=>dv(e,n,e=>e===dh?ph:t.transform(e,r));case`TransformOptionalEffect`:return(e,n,r)=>dv(e,n,e=>pv(t.transform(hh(e),r)))}}var pv=e=>zm(e,gh),mv=(e,t,n,r)=>Lm(r,r=>Mm(()=>bm(r,r=>new Sh(e,r,t,n))));function hv(e,t){let n=fv(e.link.transformation),r;return(i,a)=>{if(i===dh)return ph;if(e.isConstructed(i))return mh;let o=(r??=t(e.link.to))(i,a);return n(o,i,a)}}function gv(e,t){let n=e.context.constructorDefault;return(r,i)=>{if(r!==dh&&r!==void 0)return t(r,i);let a=n;if(im(a)&&a._tag===`Success`){let e=t(a[ru],i);return e===mh?a:e}return zm(mv(e,r,i,a),e=>{let n=t(e,i);return n===mh?fh(e):n})}}function _v(e,t){let n=t(e);return e.context?.constructorDefault===void 0?n:gv(e,n)}function vv(e,t,n,r,i){if(e._tag===`Declaration`)for(let n of e.typeParameters)t(n);let a=n?Bte(e):void 0,o=a?hv(a,t):r??e.getParser(t,n),s=e.checks,c=e.encoding,l=c?.map(e=>fv(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(im(r)){if(r._tag===`Success`){let i=r===mh?t:r[ru];if(t!==dh&&i!==dh){let i=iv(u,t,void 0,e,n);i&&(r=jm(new Eh(e,i,t,n)))}}}else r=Fm(r,r=>{if(t!==dh&&r!==dh){let r=iv(u,t,void 0,e,n);if(r)return jm(new Eh(e,r,t,n))}return km(r)})}if(s&&!n.disableChecks){if(im(r)){if(r._tag===`Success`){let i=r===mh?t:r[ru];if(i===dh)return r;let a=iv(s,i,void 0,e,n);a&&(r=jm(new Eh(e,a,i,n)))}}else r=Fm(r,t=>{if(t!==dh){let r=iv(s,t,void 0,e,n);if(r)return jm(new Eh(e,r,t,n))}return km(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[ru],o=t(a,r)):o=zm(o,e=>{let n=t(e,r);return n===mh?fh(e):n})}if(o._tag===`Success`){let e=o[ru],t=p(e,r);return t===mh?o:t}return o=mv(e,n,r,o),zm(o,e=>{let t=p(e,r);return t===mh?fh(e):t})}:p}var yv=Symbol(),bv=new WeakMap,xv=e=>Tv(e).parser,Sv=e=>Tv(e).makeEffect,Cv=e=>_v(e,Sv),wv=class{ast;constructor(e){this.ast=e}get decodeEffect(){return this.cachedDecodeEffect??=vv(this.ast,xv)}get parser(){return this.decodeEffect}get makeEffect(){return this.cachedMakeEffect??=vv(this.ast,Sv,Cv)}};function Tv(e){let t=bv.get(e);if(t!==void 0)return t;let n=new wv(e);return bv.set(e,n),n}function Ev(e){let t=e.ast,n;return(e,r)=>(n??=zv(Kv,J_(t)))(e,r?.disableChecks?r?.parseOptions?{...r.parseOptions,disableChecks:!0}:{disableChecks:!0}:r?.parseOptions)}function Dv(e){let t=Ev(e);return(e,n)=>{let r=Rm(t(e,n));return wm(r)?pd(r.value):(qh(r.cause,`Option adapter can only return none for schema issues`),fd())}}function Ov(e){return Wv(J_(e.ast))}function kv(e){return jv(e.ast)}function Av(e){{let t=Bv(Lv(e));return e=>{let n=t(e,Mg);return wm(n)?!0:(qh(n.cause,`Type guard adapter can only return false for schema issues`),!1)}}}function jv(e){let t=J_(e),n=e=>(n=Av(t),n(e));return e=>n(e)}function Mv(e,t){let n=Lv(e.ast);return t===void 0?n:(e,r)=>n(e,Fv(t,r))}function Nv(e,t){return Vv(Mv(e,t))}function Pv(e,t){return Hv(Mv(e,t))}var Fv=(e,t)=>t?{...e,...t}:e,Iv=e=>e===dh?jm(new Oh):km(e);function Lv(e){return zv(Gv,e)}function Rv(e,t){return e===mh?km(t):im(e)?e[ru]===dh?Iv(dh):e:zm(e,Iv)}function zv(e,t){let n;return(r,i)=>{let a=(n??=e(t))(r,i??Mg);return a===mh?km(r):im(a)?a[ru]===dh?Iv(dh):a:zm(a,Iv)}}function Bv(e){return(t,n)=>Rm(e(t,n))}function Vv(e){let t=Bv(e);return(e,n)=>{let r=t(e,n);return wm(r)?pd(r.value):(qh(r.cause,`Option adapter can only return none for schema issues`),fd())}}function Hv(e){let t=Bv(e);return(e,n)=>{let r=t(e,n);return wm(r)?Sd(r.value):Cd(qh(r.cause,`Result adapter can only return schema issues`))}}function Uv(e,t){let n=Rm(e);if(wm(n))return n.value;let r=qh(n.cause,t);throw Error(`Schema validation failed`,{cause:r})}function Wv(e){let t,n;return(r,i)=>{t??=Tv(e);let a=i?.disableChecks?i.parseOptions?{...i.parseOptions,disableChecks:!0}:{disableChecks:!0}:i?.parseOptions??Mg,o=t.make;if(o!==void 0&&r!==dh){let e;try{e=o(r,a)}catch(e){throw qh(tte(e),`Constructor adapter can only throw schema issues`),e}if(e!==yv&&e!==dh)return e}return Uv(Rv((n??=t.makeEffect)(r,a),r),`Constructor adapter can only throw schema issues`)}}var Gv=e=>Tv(e).parser,Kv=e=>Tv(e).makeEffect,qv=`~effect/Schema/Schema`,Jv=Symbol(),Yv={[qv]:qv,get make(){let e=Ov(this);return Object.defineProperty(this,"make",{value:e,enumerable:!0}),e},get makeEffect(){let e=Ev(this);return Object.defineProperty(this,"makeEffect",{value:e,enumerable:!0}),e},get makeOption(){let e=Dv(this);return Object.defineProperty(this,"makeOption",{value:e,enumerable:!0}),e},pipe(){return mc(this,arguments)},annotate(e){return this.rebuild(L_(this.ast,e))},annotateKey(e){return this.rebuild(Tte(this.ast,e))},check(...e){return this.rebuild(z_(this.ast,e))},rebuild(e){return Xv(e,this[Jv])}};function Xv(e,t){function n(){}let r=Object.setPrototypeOf(n,Yv);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[Jv]=t,r.ast=e,r}function Zv(e){return e.replace(/~/g,`~0`).replace(/\//g,`~1`)}function Qv(e){return e.replace(/~1/g,`/`).replace(/~0/g,`~`)}function $v(e){return encodeURI(Zv(e)).replace(/#/g,`%23`)}function ey(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 ty(e,t){return n(e,!1,!0);function n(e,r,i=!1){if(!Vc(e))return e;let a=r||!i&&ay(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=iy(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)}El(o,t,i)}return t(o,a),o}}function ny(e,t){return ty(e,e=>{ry(e,t)})}function ry(e,t){typeof e.$ref==`string`&&El(e,`$ref`,t(e.$ref,`$ref`)),typeof e.$dynamicRef==`string`&&El(e,`$dynamicRef`,t(e.$dynamicRef,`$dynamicRef`))}function iy(e,t){if(!Vc(e))return;let n={};for(let r of Object.keys(e))El(n,r,t(e[r],r));return n}function ay(e){return typeof e==`string`&&e.length>0&&e[0]!==`#`}var oy=[`$anchor`,`$defs`,`$dynamicAnchor`,`$dynamicRef`,`$vocabulary`,`contentSchema`,`dependentRequired`,`dependentSchemas`,`maxContains`,`minContains`,`prefixItems`,`unevaluatedItems`,`unevaluatedProperties`];[...oy],[...oy];var sy=U_(e=>{let t=fy(e,sy),n=e.context;return t===e||n===void 0?t:Cte(t,cy(n))});function cy(e){return e.constructorDefault===void 0?e:new Ng(e.isOptional,e.isMutable,void 0,e.annotations)}function ly(e){if(e.propertySignatures.some(e=>typeof e.name!=`string`))throw new globalThis.Error(`Objects property names must be strings`,{cause:e})}function uy(e){return t=>{let n=[...t].sort((t,n)=>e(Y_(t))-e(Y_(n)));return n.some((e,n)=>e!==t[n])?n:t}}var dy=uy(e=>{switch(e._tag){case`BigInt`:case`Symbol`:case`UniqueSymbol`:return 0;default:return 1}});function fy(e,t){switch(e._tag){case`Declaration`:{let n=e.annotations?.toCodecJson??e.annotations?.toCodec;if(!Lc(n))return P_(e,[cv]);let r=n(e.typeParameters.map(e=>Xv(Y_(e))));return r===void 0?e:P_(e,[B_(r,t)])}case`Unknown`:return P_(e,[cv]);case`ObjectKeyword`:return P_(e,[Kte]);case`Undefined`:case`Void`:case`Literal`:case`Number`:return e.toCodecJson();case`UniqueSymbol`:case`Symbol`:case`BigInt`:return e.toCodecStringTree();case`Objects`:return ly(e),e.recur(t,tv);case`Union`:{let n=dy(e.types);return n===e.types?e.recur(t):new y_(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 py=e=>e.replace(/[/\\^$*+?.()|[\]{}]/g,`\\$&`);function my(e,t){return t.length>0&&(e+=`\n at ${Rl(t)}`),Error(e)}function hy(e){return`#/$defs/${$v(e)}`}var gy=new Set([...uh,th,...ih]);function _y(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;ov(o)&&(n.default=o);let s=e.examples;Array.isArray(s)&&ov(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(ov(p)&&(n.contentSchema=p),t?.includeAnnotationKey!==void 0)for(let[r,i]of Object.entries(e))gy.has(r)||!t.includeAnnotationKey(r)||ov(i)&&El(n,r,i);return Object.keys(n).length===0?void 0:n}function vy(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=vy(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 yy(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 by=`|type|format|pattern|multipleOf|minimum|maximum|exclusiveMinimum|exclusiveMaximum|minLength|maxLength|minItems|maxItems|uniqueItems|minProperties|maxProperties|propertyNames|`;function xy(e,t){return Object.keys(e).every(e=>t.includes(`|${e}|`))}function Sy(e,t){return typeof e.$ref!=`string`&&t.every(t=>!Object.hasOwn(e,t))}var Cy=`|title|description|default|examples|readOnly|writeOnly|`,wy=by+Cy;function Ty(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=yy(e);if(i!==void 0||a){let r=vy(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:xy(r.schema,Cy)&&Sy(o,s)?{...o,...r.schema}:Ty(o,r.schema,n)}}if(n&&Sy(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 Ey(e,t=new Set){return typeof e==`boolean`?e:t.has(e)?!0:(t.add(e),e.every(e=>Ey(e,t)))}function Dy(e){return Array.isArray(e)}function Oy(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=Nd(e,(e,n)=>v(e,t[n],[]));for(let[e,t]of s.values())if(!Ey(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=>ul(i.get(e)[0],o));l===void 0?s===void 0?c.set(r,[e]):s.push(e):a.set(e,l)}let d=Nd(u,h),f={};for(let e of l)a.has(e)||El(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 my(`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 ny(e,e=>{let t=ey(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(Qv(t.slice(7,n<0?void 0:n)));return r===void 0?e:e.replace(/^#(?:\/|%2f).*?(?:\/|%2f).*?(?=\/|%2f|$)/i,hy(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[th]: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=Dy(s);c&&i.push(!1);let l=c?s[0]:s,u=_y(a,r),d=u===void 0?l:{...l,...u},f=u===void 0?by:wy;return[d,e._tag===`Filter`&&xy(d,f)&&(u===void 0||xy(u,Cy))?!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=_y(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:hy(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=_y(e.annotations,r);c!==void 0&&(s={...s,...c});for(let n=0;n<e.checks.length;n++){let r=typeof s.type==`string`&&ky(s.type)?s.type:void 0,i=_(e.checks[n],r,[...t,`checks`,n],a);i!==void 0&&(s=Ty(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 my(`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(jy).join(``)}$`};case`Arrays`:{if(e.rest.length>1)throw my(`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=_y(e.annotations,r);return s===void 0?o:p(Ty(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 my(`Invalid schema representation document`,[...t,`propertySignatures`,i,`name`]);let c=s.name,l=v(s.type,[...t,`propertySignatures`,i,`type`],n),u=_y(s.annotations,r);El(a,c,u===void 0?l:p(Ty(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);ul(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];El(s,e,t===void 0?a:t===!1||a===!1?!1:p(Ty(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=Ay(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 my(`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 Ey(n)&&r.type===`string`&&typeof r.pattern==`string`&&xy(r,`|type|pattern|title|description|default|examples|readOnly|writeOnly|`)?[r.pattern]:void 0}case`TemplateLiteral`:return e.checks.length===0?[`^${e.parts.map(jy).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 my(`Invalid schema representation document`,t)}}}function ky(e){return e===`string`||e===`number`||e===`boolean`||e===`array`||e===`object`||e===`null`||e===`integer`}function Ay(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 jy(e){switch(e._tag){case`Literal`:return py(globalThis.String(e.literal));case`String`:return Fte;case`Number`:return Qg;case`TemplateLiteral`:return e.parts.map(jy).join(``);case`Union`:return`(?:${e.types.map(jy).join(`|`)})`;default:throw my(`Invalid schema representation document`,[])}}function My(e,t){let n=Oy([e.representation],[[`representation`]],e.references,t);return{dialect:n.dialect,schema:n.schemas[0],definitions:n.definitions}}var Ny=({identifier:e})=>e;function Py(e){return e===void 0?void 0:{annotations:e}}function Fy(e,t){let{references:n,representations:r}=Iy([e],t);return{representation:r[0],references:n}}function Iy(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??Ny;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:Nd(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:L_(e,{identifier:n}):oh(e)===r?e:L_(e,{[th]:r})}function u(e,t){if(!Object.hasOwn(n,e)&&!i.has(e)){i.add(e);let r=h(t);i.delete(e),El(n,e,r)}return{_tag:`Reference`,$ref:e}}function d(e){let t=I_(e),n=N_(t),r=ah(t),i=r===void 0?(t===e?void 0:ah(e))??oh(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(J_(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,...Py(e.annotations)};case`Literal`:return{_tag:`Literal`,literal:e.literal,checks:t,...Py(e.annotations)};case`UniqueSymbol`:return{_tag:`UniqueSymbol`,symbol:e.symbol,checks:t,...Py(e.annotations)};case`Enum`:return{_tag:`Enum`,enums:e.enums,checks:t,...Py(e.annotations)};case`TemplateLiteral`:return{_tag:`TemplateLiteral`,parts:e.parts.map(e=>m(e)),checks:t,...Py(e.annotations)};case`Arrays`:return{_tag:`Arrays`,elements:e.elements.map(e=>{let t=I_(e),n=t.context?.annotations;return{isOptional:K_(t),type:m(e),...Py(n)}}),rest:e.rest.map(e=>m(e)),checks:t,...Py(e.annotations)};case`Objects`:return{_tag:`Objects`,propertySignatures:e.propertySignatures.map(e=>{let t=I_(e.type),n=t.context?.annotations;return{name:e.name,type:m(e.type),isOptional:K_(t),isMutable:jte(t),...Py(n)}}),indexSignatures:e.indexSignatures.map(e=>({parameter:m(e.parameter),type:m(e.type)})),checks:t,...Py(e.annotations)};case`Union`:return{_tag:`Union`,types:e.types.map(e=>m(e)),...e.options===void 0?{}:{options:e.options},checks:t,...Py(e.annotations)};case`Suspend`:return{_tag:`Suspend`,checks:[],thunk:m(e.thunk()),...Py(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:Nd(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(J_(e)))};return{...r===void 0?void 0:{representation:r},...Object.keys(n).length===0?void 0:{annotations:n}}}}function Ly(e){return wm(e)?e.value:{issues:[{message:nte(e.cause)}]}}function Ry(e,t){let n=Mv(e),r={errors:`all`,...t?.parseOptions},i=Ih(t),a=e=>{let t=new Bf(`sync`),a=cte(ste(n(e,r),{onFailure:i,onSuccess:e=>({value:e})}),{scheduler:t});a.currentDispatcher?.flush();let o=a.pollUnsafe();return o?Ly(o):new Promise(e=>{a.addObserver(t=>{e(Ly(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 zy=e=>e,By=`~effect/Schema/SchemaError`;function Vy(e){return Uc(e,`~effect/Schema/SchemaError`)&&e[`~effect/Schema/SchemaError`]===`~effect/Schema/SchemaError`}function Hy(){return(e,t,n)=>nb(new Ig(e.map(u_),e=>t(e.map(e=>nb(e))),n))}function Uy(e,t){return Hy()([],()=>(t,n,r)=>e(t)?km(t):jm(new Dh(n,t,r)),t)}var Wy=class extends Wf(`SchemaError`){[By]=By;constructor(e){let t=Yl();Xl(0);try{super({issue:e})}finally{Xl(t)}}get message(){return Uh(this.issue)}toString(){return`SchemaError(${this.message})`}};function Gy(e){return Vy(e)}function Ky(e){return im(e)?qy(e):Lm(e,e=>Mm(()=>bm(e,e=>new Wy(e))))}function qy(e){return wm(e)?e:xm(bm(e.cause,e=>new Wy(e)))}function Jy(e,t){let n;for(let r of e.reasons){if(!ym(r)||!Gy(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 Yy(e){let t=Rm(e);if(wm(t))return t.value;throw Jy(t.cause,`Sync adapter can only throw schema errors`)}function Xy(e,t){return Ry(e,t)}var Zy=kv;function Qy(e,t){let n=Mv(e,t);return(e,t)=>Ky(n(e,t))}var $y=Nv;function eb(e,t){let n=Pv(e,t);return(e,t)=>Ed(n(e,t),e=>new Wy(e))}function tb(e,t){let n=Qy(e,t);return(e,t)=>Yy(n(e,t))}var nb=Xv,rb=zy(e=>nb(G_(e.ast),{schema:e})),ib=zy(e=>{let t=yb(e);return nb(Dte(e.ast),{schema:t})});function ab(e){let t=nb(new Hg(e),{literal:e,transform(n){return t.pipe(xb(ab(n),{decode:Zh(()=>n),encode:Zh(()=>e)}))}});return t}var ob=nb(Vg),sb=nb(Lg),cb=nb(Bg),lb=nb(Wg),ub=nb(qg),db=nb(Jg);function fb(e,t){return nb(e,{fields:t,mapFields(e,t){let n=e(this.fields);return fb(l_(n,t?.unsafePreserveChecks?this.ast.checks:void 0),n)}})}function q(e){return fb(l_(e,void 0),e)}function pb(e,t){return nb(Ate(e.ast,t.ast),{key:e,value:t})}var mb=zy(e=>nb(new Yg(!1,[],[e.ast]),{value:e}));function hb(e,t){return nb(e,{members:t,mapMembers(e,t){let n=e(this.members);return hb(d_(n,this.ast.options,t?.unsafePreserveChecks?this.ast.checks:void 0),n)}})}function gb(e,t){return hb(d_(e,t,void 0),e)}function _b(e){let t=e.map(ab);return nb(d_(t,void 0,void 0),{literals:e,members:t,mapMembers(e){return gb(e(this.members))},pick(e){return _b(e)},transform(e){return gb(t.map((t,n)=>t.transform(e[n])))}})}var vb=zy(e=>gb([e,sb])),yb=zy(e=>gb([e,cb]));function J(...e){return t=>t.check(...e)}function bb(e){return t=>nb(t.ast,{schema:t,identifier:e})}function xb(e,t){return n=>nb(Ote(n.ast,e.ast,t?ug(t):pg()),{from:n,to:e})}function Sb(e,t){return Uy(t=>t instanceof e,t)}function Cb(){return(e,t)=>new jg(e.ast,ug(t))}var wb=O_,Tb=`^\\S[\\s\\S]*\\S$|^\\S$|^$`;function Eb(e){let t=new globalThis.RegExp(Tb);return wb(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:Tb,flags:``}]},...e})}function Db(e,t){let n=e.source,r=e.flags,i=/^[dg]*uy?$/.test(r),a=r===``?`new RegExp(${Fl(n)})`:`new RegExp(${Fl(n)}, ${Fl(r)})`;return A_(e,{toJsonSchema:()=>i?{pattern:r.endsWith(`y`)?`^(?:${n})`:n}:[{},!0],toCode:()=>({runtime:`Schema.isPattern(${a})`}),...t})}var Ob=nb(k_);function kb(e){let t=ld(e.order),n=e.formatter??Fl;return(r,i)=>wb(e=>t(e,r),{expected:`a value greater than ${n(r)}`,arbitraryConstraint:{order:e.order,minimum:r,exclusiveMinimum:!0},...e.annotate?.(r),...i})}function Ab(e){let t=dd(e.order),n=e.formatter??Fl;return(r,i)=>wb(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 jb(e){let t=ud(e.order),n=e.formatter??Fl;return(r,i)=>wb(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 Mb(e){let t=dd(e.order),n=ld(e.order),r=ud(e.order),i=oee(e.order),a=e.formatter??Fl;return(o,s)=>{let c=o.exclusiveMinimum?n:t,l=o.exclusiveMaximum?i:r;return wb(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 Nb(e){if(!globalThis.Number.isFinite(e))throw new globalThis.RangeError(`Expected a finite number, got ${Fl(e)}`);return e}var Pb=kb({order:cd,annotate:e=>({representation:{id:`effect/schema/isGreaterThan`,payload:{exclusiveMinimum:Nb(e)}},toJsonSchema:()=>({exclusiveMinimum:e}),toCode:()=>({runtime:`Schema.isGreaterThan(${Fl(e)})`})})}),Fb=Ab({order:cd,annotate:e=>({representation:{id:`effect/schema/isGreaterThanOrEqualTo`,payload:{minimum:Nb(e)}},toJsonSchema:()=>({minimum:e}),toCode:()=>({runtime:`Schema.isGreaterThanOrEqualTo(${Fl(e)})`})})}),Ib=jb({order:cd,annotate:e=>({representation:{id:`effect/schema/isLessThanOrEqualTo`,payload:{maximum:Nb(e)}},toJsonSchema:()=>({maximum:e}),toCode:()=>({runtime:`Schema.isLessThanOrEqualTo(${Fl(e)})`})})}),Lb=Mb({order:cd,annotate:e=>{let t=e.exclusiveMinimum?!0:void 0,n=e.exclusiveMaximum?!0:void 0;return{representation:{id:`effect/schema/isBetween`,payload:{minimum:Nb(e.minimum),maximum:Nb(e.maximum),...t&&{exclusiveMinimum:t},...n&&{exclusiveMaximum:n}}},toJsonSchema:()=>({[t?`exclusiveMinimum`:`minimum`]:e.minimum,[n?`exclusiveMaximum`:`maximum`]:e.maximum}),toCode:()=>({runtime:`Schema.isBetween({ minimum: ${Fl(e.minimum)}, maximum: ${Fl(e.maximum)}, exclusiveMinimum: ${Fl(t)}, exclusiveMaximum: ${Fl(n)} })`})}}});function Rb(e){return wb(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 zb=ub.check(Rb());function Bb(e,t){return e=Wb(e),Vb(e,Math.ceil(e/2),t)}function Vb(e,t,n){return wb(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})`}),[eh]:!0,arbitraryConstraint:{minLength:e},...n})}function Hb(e){return Vb(1,1,e)}function Ub(e,t){return e=Wb(e),wb(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})`}),[eh]:!0,arbitraryConstraint:{maxLength:e},...t})}function Wb(e){if(!globalThis.Number.isFinite(e))throw new globalThis.RangeError(`Expected a finite number, got ${e}`);return Math.max(0,Math.floor(e))}var Gb=lb.check(Hb());globalThis.RegExp,globalThis.URL;var Kb=lb.annotate({expected:`a string that will be decoded as JSON`,contentMediaType:`application/json`});function qb(e,t){return Kb.pipe(xb(e,gg(t)))}globalThis.File,globalThis.FormData,globalThis.URLSearchParams;var Jb=lb.check(Eb()),Yb=lb.annotate({expected:`a string that will be decoded as a trimmed string`}).pipe(xb(Jb,dg())),Xb=lb.annotate({expected:`a base64 encoded string that will be decoded as Uint8Array`,format:`byte`,contentEncoding:`base64`}),Zb=Sb(globalThis.Uint8Array,{representation:{id:`effect/schema/Uint8Array`,payload:null},toCode:()=>({runtime:`Schema.Uint8Array`,Type:`globalThis.Uint8Array`}),expected:`Uint8Array`,toCodecJson:()=>Cb()(Xb,hg)});function Qb(e,t){return My(Fy(sy(e.ast),t),t)}var $b=[`InferenceUpstreamError`,`AiInternalError`,`TypeError`,`AbortError`,`TimeoutError`,`Error`],ex={minimum:0,maximum:99999},tx={minimum:0,maximum:599},nx=gb([q({category:_b($b),code:vb(zb.check(Lb(ex))),reason:rb(ab(`credits_exhausted`))}),q({category:ab(`result_download`),status:zb.check(Lb(tx))})]);$a([Za({category:lo($b),code:Pa().int().min(ex.minimum).max(ex.maximum).nullable(),reason:fo(`credits_exhausted`).optional()}),Za({category:fo(`result_download`),status:Pa().int().min(tx.minimum).max(tx.maximum)})]);var rx=[`CANCELLED`,`CAPABILITY_DENIED`,`CAPABILITY_REVOKED`,`COMMAND_NOT_DECLARED`,`CONFLICT`,`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`,`TIMEOUT`],ix=q({name:ab(`AppError`),code:_b(rx),retryable:db}),Y=class extends Error{code;retryable;constructor(e,t){super(e,{cause:t.cause}),this.name=`AppError`,this.code=t.code,this.retryable=t.retryable}},ax={CANCELLED:{title:`Request cancelled`,message:`This request was cancelled.`},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 action isn't available in this App.`},CONFLICT:{title:`File changed`,message:`This file changed elsewhere. Review it before saving again.`},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 service couldn't complete this request.`},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:`The App couldn't use the details in this request.`},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 App received a response it couldn't use.`},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`},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 ox(e,t){let n=$y(ix)(e);if(md(n))return{...ax.UNKNOWN,retryable:!1};let r=n.value,i=ax[r.code],a=t?.[r.code]??i,o=i.action??(r.retryable?`retry`:void 0),s={title:a.title,message:a.message,retryable:r.retryable};return o?{...s,action:o}:s}lo(`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 sx=`data-theme`;function cx(e){return e||(globalThis.document?.documentElement??null)}function lx(e){let t=e.trim();if(t.length===0)throw TypeError(`Theme must be a non-empty string`);return t}function ux(e,t){let n=lx(e),r=cx(t);r&&r.setAttribute(sx,n)}function dx(e){return cx(e)?.getAttribute(sx)??null}var fx=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})),X=o(((e,t)=>{t.exports=fx()}))(),px=K.createContext(void 0),mx=e=>{let t=K.useContext(px);if(e)return e;if(!t)throw Error(`No QueryClient set, use QueryClientProvider to set one`);return t},hx=({client:e,children:t})=>(K.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),(0,X.jsx)(px.Provider,{value:e,children:t})),gx={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},_x=new class{#e=gx;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 vx(e){setTimeout(e,0)}var yx=typeof window>`u`||`Deno`in globalThis;function bx(){}function xx(e,t){return typeof e==`function`?e(t):e}function Sx(e){return typeof e==`number`&&e>=0&&e!==1/0}function Cx(e,t){return Math.max(e+(t||0)-Date.now(),0)}function wx(e,t){return typeof e==`function`?e(t):e}function Tx(e,t){let{type:n=`all`,exact:r,fetchStatus:i,predicate:a,queryKey:o,stale:s}=e;if(o){if(r){if(t.queryHash!==Dx(o,t.options))return!1}else if(!kx(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 Ex(e,t){let{exact:n,status:r,predicate:i,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(n){if(Ox(t.options.mutationKey)!==Ox(a))return!1}else if(!kx(t.options.mutationKey,a))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function Dx(e,t){return(t?.queryKeyHashFn||Ox)(e)}function Ox(e){return JSON.stringify(e,(e,t)=>Px(t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}):t)}function kx(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(!kx(e[n],t[n]))return!1;return!0}let n=Object.keys(t);for(let r of n)if(!kx(e[r],t[r]))return!1;return!0}return!1}var Ax=Object.prototype.hasOwnProperty;function jx(e,t,n=0){if(e===t)return e;if(n>500)return t;let r=Nx(e)&&Nx(t);if(!r&&!(Px(e)&&Px(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:Ax.call(e,o))&&c++;continue}if(u===null||d===null||typeof u!=`object`||typeof d!=`object`){s[o]=d;continue}let f=jx(u,d,n+1);s[o]=f,f===u&&c++}return i===o&&c===i?e:s}function Mx(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 Nx(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Px(e){if(!Fx(e))return!1;let t=e.constructor;if(t===void 0)return!0;let n=t.prototype;return!(!Fx(n)||!n.hasOwnProperty(`isPrototypeOf`)||Object.getPrototypeOf(e)!==Object.prototype)}function Fx(e){return Object.prototype.toString.call(e)===`[object Object]`}function Ix(e){return new Promise(t=>{_x.setTimeout(t,e)})}function Lx(e,t,n){return typeof n.structuralSharing==`function`?n.structuralSharing(e,t):n.structuralSharing===!1?t:jx(e,t)}function Rx(e,t,n=0){let r=[...e,t];return n&&r.length>n?r.slice(1):r}function zx(e,t,n=0){let r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var Bx=Symbol();function Vx(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===Bx?()=>Promise.reject(Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function Hx(e,t){return typeof e==`function`?e(...t):!!e}function Ux(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 Wx=()=>yx,Gx=()=>Wx(),Kx=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(){}},qx=new class extends Kx{#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`}},Jx=vx;function Yx(){let e=[],t=0,n=e=>{e()},r=e=>{e()},i=Jx,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 Xx=Yx(),Zx=new class extends Kx{#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 Qx(e){return Math.min(1e3*2**e,3e4)}function $x(e){return(e??`online`)!==`online`||Zx.isOnline()}var eS=class extends Error{constructor(e){super(`CancelledError`),this.revert=e?.revert,this.silent=e?.silent}};function tS(e){let t=!1,n=0,r,i=`pending`,a,o,s=new Promise((e,t)=>{a=e,o=t});s.catch(bx);let c=()=>i!==`pending`,l=t=>{if(!c()){let n=new eS(t);h(n),e.onCancel?.(n)}},u=()=>{t=!0},d=()=>{t=!1},f=()=>qx.isFocused()&&(e.networkMode===`always`||Zx.isOnline())&&e.canRun(),p=()=>$x(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??(Gx()?0:3),a=e.retryDelay??Qx,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),Ix(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 nS=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Sx(this.gcTime)&&(this.#e=_x.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Gx()?1/0:3e5))}clearGcTimeout(){this.#e!==void 0&&(_x.clearTimeout(this.#e),this.#e=void 0)}};function qte(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=>{Ux(e,()=>t.signal,()=>n=!0)},u=Vx(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?zx:Rx;return{pages:c(e.pages,o,s),pageParams:c(e.pageParams,r,s)}};if(i&&a.length){let e=i===`backward`,t=e?iS:rS,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:rS(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 rS(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 iS(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}function Jte(e,t){return t?rS(e,t)!=null:!1}function Yte(e,t){return!t||!e.getPreviousPageParam?!1:iS(e,t)!=null}var Xte=class extends nS{#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=sS(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=sS(this.options);e.data!==void 0&&(this.setState(oS(e.data,e.dataUpdatedAt)),this.#t=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus===`idle`&&this.#r.remove(this)}setData(e,t){let n=Lx(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(bx).catch(bx):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=>wx(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Bx||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0&&this.observers.some(e=>wx(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:!Cx(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=Vx(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`?qte(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=tS({initialPromise:t?.initialPromise,fn:a.fetchFn,onCancel:e=>{e instanceof eS&&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 eS){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,...aS(t.data,this.options),fetchMeta:e.meta??null};case`success`:let n={...t,...oS(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),Xx.batch(()=>{this.observers.slice().forEach(e=>{e.onQueryUpdate()}),this.#r.notify({query:this,type:`updated`,action:e})})}};function aS(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:$x(t.networkMode)?`fetching`:`paused`,...e===void 0&&{error:null,status:`pending`}}}function oS(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:`success`}}function sS(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 cS=class extends Kx{#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),lS(this.#t,this.options)?this.#m():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return uS(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return uS(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 wx(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&&!Mx(this.options,t)&&this.#e.getQueryCache().notify({type:`observerOptionsUpdated`,query:this.#t,observer:this});let r=this.hasListeners();r&&dS(this.#t,n,this.options,t)&&this.#m(),this.updateResult(),r&&(this.#t!==n||wx(this.options.enabled,this.#t)!==wx(t.enabled,this.#t)||wx(this.options.staleTime,this.#t)!==wx(t.staleTime,this.#t))&&this.#g();let i=this.#_();r&&(this.#t!==n||wx(this.options.enabled,this.#t)!==wx(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 Mx(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(bx)),t}#h(e){return!Gx()&&wx(this.options.enabled,this.#t)!==!1&&Sx(e)}#g(){this.#b();let e=wx(this.options.staleTime,this.#t);if(this.#r.isStale||!this.#h(e))return;let t=Cx(this.#r.dataUpdatedAt,e)+1;this.#u=_x.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=_x.setInterval(()=>{(this.options.refetchIntervalInBackground||qx.isFocused())&&this.#m()},this.#f))}#y(){this.#g(),this.#v(this.#_())}#b(){this.#u!==void 0&&(_x.clearTimeout(this.#u),this.#u=void 0)}#x(){this.#d!==void 0&&(_x.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&&lS(e,t),o=i&&dS(e,n,t,r);(a||o)&&(l={...l,...aS(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=Lx(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=Lx(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:fS(e,t),refetch:this.refetch,isEnabled:wx(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),Mx(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)})})();Xx.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 Zte(e,t){return wx(t.enabled,e)!==!1&&e.state.data===void 0&&(e.state.status!==`error`||wx(t.retryOnMount,e)!==!1)}function lS(e,t){return Zte(e,t)||e.state.data!==void 0&&uS(e,t,t.refetchOnMount)}function uS(e,t,n){if(wx(t.enabled,e)!==!1&&wx(t.staleTime,e)!==`static`){let r=typeof n==`function`?n(e):n;return r===`always`||r!==!1&&fS(e,t)}return!1}function dS(e,t,n,r){return(e!==t||wx(r.enabled,e)===!1)&&(!n.suspense||e.state.status!==`error`)&&fS(e,n)}function fS(e,t){return wx(t.enabled,e)!==!1&&e.isStaleByTime(wx(t.staleTime,e))}var Qte=class extends cS{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:Jte(t,n.data),hasPreviousPage:Yte(t,n.data),isFetchNextPageError:l,isFetchingNextPage:u,isFetchPreviousPageError:d,isFetchingPreviousPage:f,isRefetchError:s&&!l&&!d,isRefetching:a&&!u&&!f}}},$te=class extends nS{#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||pS(),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=tS({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),Xx.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function pS(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var ene=class extends Kx{#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 $te({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=mS(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=mS(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=mS(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=mS(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){Xx.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=>Ex(t,e))}findAll(e={}){return this.getAll().filter(t=>Ex(e,t))}notify(e){Xx.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return Xx.batch(()=>Promise.all(e.map(e=>e.continue().catch(bx))))}};function mS(e){return e.options.scope?.id}var tne=class extends Kx{#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),Mx(this.options,t)||this.#e.getMutationCache().notify({type:`observerOptionsUpdated`,mutation:this.#n,observer:this}),t?.mutationKey&&this.options.mutationKey&&Ox(t.mutationKey)!==Ox(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??pS();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){Xx.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 hS(e,t){let n=new Set(t);return e.filter(e=>!n.has(e))}var nne=class extends Kx{#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,Xx.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||!Mx(e,n)});!o&&!s||(o&&(this.#l=t,this.#i=n),this.#t=r,this.hasListeners()&&(o&&(hS(e,n).forEach(e=>{e.destroy()}),hS(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=jx(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 cS(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)&&Xx.batch(()=>{this.listeners.forEach(e=>{e(this.#t)})})}}},rne=class extends Kx{#e;constructor(e={}){super(),this.config=e,this.#e=new Map}build(e,t,n){let r=t.queryKey,i=t.queryHash??Dx(r,t),a=this.get(i);return a||(a=new Xte({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(){Xx.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=>Tx(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>Tx(e,t)):t}notify(e){Xx.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){Xx.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){Xx.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},ine=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new rne,this.#t=e.mutationCache||new ene,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=qx.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=Zx.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(wx(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=xx(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return Xx.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;Xx.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return Xx.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=Xx.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(bx).catch(bx)}invalidateQueries(e,t={}){return Xx.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=Xx.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(bx)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(bx)}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(wx(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(wx(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(bx).catch(bx)}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(bx).catch(bx)}ensureInfiniteQueryData(e){return e._type=`infinite`,this.ensureQueryData(e)}resumePausedMutations(){return Zx.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(Ox(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{kx(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(Ox(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{kx(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||=Dx(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===Bx&&(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()}},gS=K.createContext(!1),_S=()=>K.useContext(gS);gS.Provider;function ane(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var one=K.createContext(ane()),vS=()=>K.useContext(one),yS=(e,t,n)=>{let r=n?.state.error&&typeof e.throwOnError==`function`?Hx(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||r)&&(t.isReset()||(e.retryOnMount=!1))},bS=e=>{K.useEffect(()=>{e.clearReset()},[e])},xS=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||Hx(n,[e.error,r])),SS=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))}},CS=(e,t)=>e?.suspense&&t.isPending,wS=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function sne({queries:e,...t},n){let r=mx(n),i=_S(),a=vS(),o=t.subscribed!==!1,s=K.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=>{SS(e);let t=r.getQueryCache().get(e.queryHash);yS(e,a,t)}),bS(a);let[c]=K.useState(()=>new nne(r,s,t)),[l,u,d]=c.getOptimisticResult(s,t.combine),f=!i&&o;K.useSyncExternalStore(K.useCallback(e=>f?c.subscribe(Xx.batchCalls(e)):bx,[c,f]),()=>c.getCurrentResult(),()=>c.getCurrentResult()),K.useEffect(()=>{c.setQueries(s,t)},[s,t,c]);let p=l.some((e,t)=>CS(s[t],e))?l.flatMap((e,t)=>{let n=s[t];return n&&CS(n,e)?wS(n,new cS(r,n),a):[]}):[];if(p.length>0)throw Promise.all(p);let m=l.find((e,t)=>{let n=s[t];return n&&xS({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 TS(e,t,n){let r=_S(),i=vS(),a=mx(n),o=a.defaultQueryOptions(e),s=a.getQueryCache().get(o.queryHash),c=e.subscribed!==!1;o._optimisticResults=r?`isRestoring`:c?`optimistic`:void 0,SS(o),yS(o,i,s),bS(i);let[l]=K.useState(()=>new t(a,o)),u=l.getOptimisticResult(o),d=!r&&c;if(K.useSyncExternalStore(K.useCallback(e=>{let t=d?l.subscribe(Xx.batchCalls(e)):bx;return l.updateResult(),t},[l,d]),()=>l.getCurrentResult(),()=>l.getCurrentResult()),K.useEffect(()=>{l.setOptions(o)},[o,l]),CS(o,u))throw wS(o,l,i);if(xS({result:u,errorResetBoundary:i,throwOnError:o.throwOnError,query:s,suspense:o.suspense}))throw u.error;return o.notifyOnChangeProps?u:l.trackResult(u)}function ES(e,t){return TS(e,cS,t)}function cne(e){return e}function lne(e){return e}function DS(e,t){return e.findAll(t.filters).map(e=>t.select?t.select(e):e.state)}function une(e={},t){let n=mx(t).getMutationCache(),r=K.useRef(e),i=K.useRef(null);return i.current===null&&(i.current=DS(n,e)),K.useEffect(()=>{r.current=e}),K.useSyncExternalStore(K.useCallback(e=>n.subscribe(()=>{let t=jx(i.current,DS(n,r.current));i.current!==t&&(i.current=t,Xx.schedule(e))}),[n]),()=>i.current,()=>i.current)}function OS(e,t){let n=mx(t),[r]=K.useState(()=>new tne(n,e));K.useEffect(()=>{r.setOptions(e)},[r,e]);let i=K.useSyncExternalStore(K.useCallback(e=>r.subscribe(Xx.batchCalls(e)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),a=K.useCallback((...e)=>{r.mutate(e[0],e[1]).catch(bx)},[r]);if(i.error&&Hx(r.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:a,mutateAsync:i.mutate}}function dne(e){return e}function kS(e,t){return TS(e,Qte,t)}var fne=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}}}})),pne=o(((e,t)=>{t.exports=fne()})),mne=o((e=>{var t=d(),n=pne();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`
|
|
77
|
+
`+z+e}var B=!1;function V(e,t){if(!e||B)return``;B=!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(`
|
|
78
|
+
`),a=r.stack.split(`
|
|
79
|
+
`),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=`
|
|
80
|
+
`+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{B=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:``)?ee(e):``}function te(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=V(e.type,!1),e;case 11:return e=V(e.type.render,!1),e;case 1:return e=V(e.type,!0),e;default:return``}}function ne(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?ne(e.type)||`Memo`:t;case P:t=e._payload,e=e._init;try{return ne(e(t))}catch{}}return null}function H(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 ne(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 U(e){switch(typeof e){case`boolean`:case`number`:case`string`:case`undefined`:return e;case`object`:return e;default:return``}}function re(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()===`input`&&(t===`checkbox`||t===`radio`)}function ie(e){var t=re(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 ae(e){e._valueTracker||=ie(e)}function oe(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r=``;return e&&(r=re(e)?e.checked?`true`:`false`:e.value),e=r,e!==n&&(t.setValue(e),!0)}function se(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 W(e,t){var n=t.checked;return R({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function G(e,t){var n=t.defaultValue==null?``:t.defaultValue,r=t.checked==null?t.defaultChecked:t.checked;n=U(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 ce(e,t){t=t.checked,t!=null&&x(e,`checked`,t,!1)}function le(e,t){ce(e,t);var n=U(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`)?de(e,t.type,n):t.hasOwnProperty(`defaultValue`)&&de(e,t.type,U(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function ue(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 de(e,t,n){(t!==`number`||se(e.ownerDocument)!==e)&&(n==null?e.defaultValue=``+e._wrapperState.initialValue:e.defaultValue!==``+n&&(e.defaultValue=``+n))}var fe=Array.isArray;function pe(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=``+U(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 me(e,t){if(t.dangerouslySetInnerHTML!=null)throw Error(r(91));return R({},t,{value:void 0,defaultValue:void 0,children:``+e._wrapperState.initialValue})}function he(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(fe(n)){if(1<n.length)throw Error(r(93));n=n[0]}t=n}t??=``,n=t}e._wrapperState={initialValue:U(n)}}function ge(e,t){var n=U(t.value),r=U(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 _e(e){var t=e.textContent;t===e._wrapperState.initialValue&&t!==``&&t!==null&&(e.value=t)}function ve(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 ye(e,t){return e==null||e===`http://www.w3.org/1999/xhtml`?ve(t):e===`http://www.w3.org/2000/svg`&&t===`foreignObject`?`http://www.w3.org/1999/xhtml`:e}var be,xe=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(be||=document.createElement(`div`),be.innerHTML=`<svg>`+t.valueOf().toString()+`</svg>`,t=be.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Se(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Ce={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},we=[`Webkit`,`ms`,`Moz`,`O`];Object.keys(Ce).forEach(function(e){we.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Ce[t]=Ce[e]})});function Te(e,t,n){return t==null||typeof t==`boolean`||t===``?``:n||typeof t!=`number`||t===0||Ce.hasOwnProperty(e)&&Ce[e]?(``+t).trim():t+`px`}function Ee(e,t){for(var n in e=e.style,t)if(t.hasOwnProperty(n)){var r=n.indexOf(`--`)===0,i=Te(n,t[n],r);n===`float`&&(n=`cssFloat`),r?e.setProperty(n,i):e[n]=i}}var De=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 Oe(e,t){if(t){if(De[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 ke(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 Ae=null;function je(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Me=null,Ne=null,Pe=null;function Fe(e){if(e=Ii(e)){if(typeof Me!=`function`)throw Error(r(280));var t=e.stateNode;t&&(t=Ri(t),Me(e.stateNode,e.type,t))}}function Ie(e){Ne?Pe?Pe.push(e):Pe=[e]:Ne=e}function Le(){if(Ne){var e=Ne,t=Pe;if(Pe=Ne=null,Fe(e),t)for(e=0;e<t.length;e++)Fe(t[e])}}function Re(e,t){return e(t)}function ze(){}var Be=!1;function Ve(e,t,n){if(Be)return e(t,n);Be=!0;try{return Re(e,t,n)}finally{Be=!1,(Ne!==null||Pe!==null)&&(ze(),Le())}}function He(e,t){var n=e.stateNode;if(n===null)return null;var i=Ri(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 Ue=!1;if(c)try{var We={};Object.defineProperty(We,"passive",{get:function(){Ue=!0}}),window.addEventListener(`test`,We,We),window.removeEventListener(`test`,We,We)}catch{Ue=!1}function Ge(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 Ke=!1,qe=null,Je=!1,Ye=null,Xe={onError:function(e){Ke=!0,qe=e}};function Ze(e,t,n,r,i,a,o,s,c){Ke=!1,qe=null,Ge.apply(Xe,arguments)}function Qe(e,t,n,i,a,o,s,c,l){if(Ze.apply(this,arguments),Ke){if(Ke){var u=qe;Ke=!1,qe=null}else throw Error(r(198));Je||(Je=!0,Ye=u)}}function $e(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 et(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 tt(e){if($e(e)!==e)throw Error(r(188))}function nt(e){var t=e.alternate;if(!t){if(t=$e(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 tt(a),e;if(o===i)return tt(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 rt(e){return e=nt(e),e===null?null:it(e)}function it(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var t=it(e);if(t!==null)return t;e=e.sibling}return null}var at=n.unstable_scheduleCallback,ot=n.unstable_cancelCallback,st=n.unstable_shouldYield,ct=n.unstable_requestPaint,lt=n.unstable_now,ut=n.unstable_getCurrentPriorityLevel,dt=n.unstable_ImmediatePriority,ft=n.unstable_UserBlockingPriority,pt=n.unstable_NormalPriority,mt=n.unstable_LowPriority,ht=n.unstable_IdlePriority,gt=null,_t=null;function vt(e){if(_t&&typeof _t.onCommitFiberRoot==`function`)try{_t.onCommitFiberRoot(gt,e,void 0,(e.current.flags&128)==128)}catch{}}var yt=Math.clz32?Math.clz32:St,bt=Math.log,xt=Math.LN2;function St(e){return e>>>=0,e===0?32:31-(bt(e)/xt|0)|0}var Ct=64,wt=4194304;function Tt(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 Et(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=Tt(a))):r=Tt(s)}else o=n&~i,o===0?a!==0&&(r=Tt(a)):r=Tt(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-yt(t),i=1<<n,r|=e[n],t&=~i;return r}function Dt(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 Ot(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,i=e.expirationTimes,a=e.pendingLanes;0<a;){var o=31-yt(a),s=1<<o,c=i[o];c===-1?((s&n)===0||(s&r)!==0)&&(i[o]=Dt(s,t)):c<=t&&(e.expiredLanes|=s),a&=~s}}function kt(e){return e=e.pendingLanes&-1073741825,e===0?e&1073741824?1073741824:0:e}function At(){var e=Ct;return Ct<<=1,!(Ct&4194240)&&(Ct=64),e}function jt(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function Mt(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-yt(t),e[t]=n}function Nt(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-yt(n),a=1<<i;t[i]=0,r[i]=-1,e[i]=-1,n&=~a}}function Pt(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-yt(n),i=1<<r;i&t|e[r]&t&&(e[r]|=t),n&=~i}}var Ft=0;function It(e){return e&=-e,1<e?4<e?e&268435455?16:536870912:4:1}var Lt,Rt,zt,Bt,Vt,Ht=!1,Ut=[],Wt=null,Gt=null,Kt=null,qt=new Map,Jt=new Map,Yt=[],Xt=`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 Zt(e,t){switch(e){case`focusin`:case`focusout`:Wt=null;break;case`dragenter`:case`dragleave`:Gt=null;break;case`mouseover`:case`mouseout`:Kt=null;break;case`pointerover`:case`pointerout`:qt.delete(t.pointerId);break;case`gotpointercapture`:case`lostpointercapture`:Jt.delete(t.pointerId)}}function Qt(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=Ii(t),t!==null&&Rt(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,i!==null&&t.indexOf(i)===-1&&t.push(i),e)}function $t(e,t,n,r,i){switch(t){case`focusin`:return Wt=Qt(Wt,e,t,n,r,i),!0;case`dragenter`:return Gt=Qt(Gt,e,t,n,r,i),!0;case`mouseover`:return Kt=Qt(Kt,e,t,n,r,i),!0;case`pointerover`:var a=i.pointerId;return qt.set(a,Qt(qt.get(a)||null,e,t,n,r,i)),!0;case`gotpointercapture`:return a=i.pointerId,Jt.set(a,Qt(Jt.get(a)||null,e,t,n,r,i)),!0}return!1}function en(e){var t=Fi(e.target);if(t!==null){var n=$e(t);if(n!==null){if(t=n.tag,t===13){if(t=et(n),t!==null){e.blockedOn=t,Vt(e.priority,function(){zt(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 tn(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=pn(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);Ae=r,n.target.dispatchEvent(r),Ae=null}else return t=Ii(n),t!==null&&Rt(t),e.blockedOn=n,!1;t.shift()}return!0}function nn(e,t,n){tn(e)&&n.delete(t)}function rn(){Ht=!1,Wt!==null&&tn(Wt)&&(Wt=null),Gt!==null&&tn(Gt)&&(Gt=null),Kt!==null&&tn(Kt)&&(Kt=null),qt.forEach(nn),Jt.forEach(nn)}function an(e,t){e.blockedOn===t&&(e.blockedOn=null,Ht||(Ht=!0,n.unstable_scheduleCallback(n.unstable_NormalPriority,rn)))}function on(e){function t(t){return an(t,e)}if(0<Ut.length){an(Ut[0],e);for(var n=1;n<Ut.length;n++){var r=Ut[n];r.blockedOn===e&&(r.blockedOn=null)}}for(Wt!==null&&an(Wt,e),Gt!==null&&an(Gt,e),Kt!==null&&an(Kt,e),qt.forEach(t),Jt.forEach(t),n=0;n<Yt.length;n++)r=Yt[n],r.blockedOn===e&&(r.blockedOn=null);for(;0<Yt.length&&(n=Yt[0],n.blockedOn===null);)en(n),n.blockedOn===null&&Yt.shift()}var sn=S.ReactCurrentBatchConfig,cn=!0;function ln(e,t,n,r){var i=Ft,a=sn.transition;sn.transition=null;try{Ft=1,dn(e,t,n,r)}finally{Ft=i,sn.transition=a}}function un(e,t,n,r){var i=Ft,a=sn.transition;sn.transition=null;try{Ft=4,dn(e,t,n,r)}finally{Ft=i,sn.transition=a}}function dn(e,t,n,r){if(cn){var i=pn(e,t,n,r);if(i===null)si(e,t,r,fn,n),Zt(e,r);else if($t(i,e,t,n,r))r.stopPropagation();else if(Zt(e,r),t&4&&-1<Xt.indexOf(e)){for(;i!==null;){var a=Ii(i);if(a!==null&&Lt(a),a=pn(e,t,n,r),a===null&&si(e,t,r,fn,n),a===i)break;i=a}i!==null&&r.stopPropagation()}else si(e,t,r,null,n)}}var fn=null;function pn(e,t,n,r){if(fn=null,e=je(r),e=Fi(e),e!==null){if(t=$e(e),t===null)e=null;else if(n=t.tag,n===13){if(e=et(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 fn=e,null}function mn(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(ut()){case dt:return 1;case ft:return 4;case pt:case mt:return 16;case ht:return 536870912;default:return 16}default:return 16}}var hn=null,gn=null,_n=null;function vn(){if(_n)return _n;var e,t=gn,n=t.length,r,i=`value`in hn?hn.value:hn.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 _n=i.slice(e,1<r?1-r:void 0)}function yn(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 bn(){return!0}function xn(){return!1}function Sn(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)?bn:xn,this.isPropagationStopped=xn,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=bn)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():typeof e.cancelBubble!=`unknown`&&(e.cancelBubble=!0),this.isPropagationStopped=bn)},persist:function(){},isPersistent:bn}),t}var Cn={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},wn=Sn(Cn),Tn=R({},Cn,{view:0,detail:0}),En=Sn(Tn),Dn,On,kn,An=R({},Tn,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Vn,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!==kn&&(kn&&e.type===`mousemove`?(Dn=e.screenX-kn.screenX,On=e.screenY-kn.screenY):On=Dn=0,kn=e),Dn)},movementY:function(e){return`movementY`in e?e.movementY:On}}),jn=Sn(An),Mn=Sn(R({},An,{dataTransfer:0})),Nn=Sn(R({},Tn,{relatedTarget:0})),Pn=Sn(R({},Cn,{animationName:0,elapsedTime:0,pseudoElement:0})),Fn=Sn(R({},Cn,{clipboardData:function(e){return`clipboardData`in e?e.clipboardData:window.clipboardData}})),In=Sn(R({},Cn,{data:0})),Ln={Esc:`Escape`,Spacebar:` `,Left:`ArrowLeft`,Up:`ArrowUp`,Right:`ArrowRight`,Down:`ArrowDown`,Del:`Delete`,Win:`OS`,Menu:`ContextMenu`,Apps:`ContextMenu`,Scroll:`ScrollLock`,MozPrintableKey:`Unidentified`},Rn={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`},zn={Alt:`altKey`,Control:`ctrlKey`,Meta:`metaKey`,Shift:`shiftKey`};function Bn(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=zn[e])?!!t[e]:!1}function Vn(){return Bn}var Hn=Sn(R({},Tn,{key:function(e){if(e.key){var t=Ln[e.key]||e.key;if(t!==`Unidentified`)return t}return e.type===`keypress`?(e=yn(e),e===13?`Enter`:String.fromCharCode(e)):e.type===`keydown`||e.type===`keyup`?Rn[e.keyCode]||`Unidentified`:``},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Vn,charCode:function(e){return e.type===`keypress`?yn(e):0},keyCode:function(e){return e.type===`keydown`||e.type===`keyup`?e.keyCode:0},which:function(e){return e.type===`keypress`?yn(e):e.type===`keydown`||e.type===`keyup`?e.keyCode:0}})),Un=Sn(R({},An,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0})),Wn=Sn(R({},Tn,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Vn})),Gn=Sn(R({},Cn,{propertyName:0,elapsedTime:0,pseudoElement:0})),Kn=Sn(R({},An,{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})),qn=[9,13,27,32],Jn=c&&`CompositionEvent`in window,Yn=null;c&&`documentMode`in document&&(Yn=document.documentMode);var Xn=c&&`TextEvent`in window&&!Yn,Zn=c&&(!Jn||Yn&&8<Yn&&11>=Yn),Qn=` `,$n=!1;function er(e,t){switch(e){case`keyup`:return qn.indexOf(t.keyCode)!==-1;case`keydown`:return t.keyCode!==229;case`keypress`:case`mousedown`:case`focusout`:return!0;default:return!1}}function tr(e){return e=e.detail,typeof e==`object`&&`data`in e?e.data:null}var nr=!1;function rr(e,t){switch(e){case`compositionend`:return tr(t);case`keypress`:return t.which===32?($n=!0,Qn):null;case`textInput`:return e=t.data,e===Qn&&$n?null:e;default:return null}}function ir(e,t){if(nr)return e===`compositionend`||!Jn&&er(e,t)?(e=vn(),_n=gn=hn=null,nr=!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 Zn&&t.locale!==`ko`?null:t.data;default:return null}}var ar={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 or(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t===`input`?!!ar[e.type]:t===`textarea`}function sr(e,t,n,r){Ie(r),t=li(t,`onChange`),0<t.length&&(n=new wn(`onChange`,`change`,null,n,r),e.push({event:n,listeners:t}))}var cr=null,lr=null;function ur(e){ti(e,0)}function dr(e){if(oe(Li(e)))return e}function fr(e,t){if(e===`change`)return t}var pr=!1;if(c){var mr;if(c){var hr=`oninput`in document;if(!hr){var gr=document.createElement(`div`);gr.setAttribute(`oninput`,`return;`),hr=typeof gr.oninput==`function`}mr=hr}else mr=!1;pr=mr&&(!document.documentMode||9<document.documentMode)}function _r(){cr&&(cr.detachEvent(`onpropertychange`,vr),lr=cr=null)}function vr(e){if(e.propertyName===`value`&&dr(lr)){var t=[];sr(t,lr,e,je(e)),Ve(ur,t)}}function yr(e,t,n){e===`focusin`?(_r(),cr=t,lr=n,cr.attachEvent(`onpropertychange`,vr)):e===`focusout`&&_r()}function br(e){if(e===`selectionchange`||e===`keyup`||e===`keydown`)return dr(lr)}function xr(e,t){if(e===`click`)return dr(t)}function Sr(e,t){if(e===`input`||e===`change`)return dr(t)}function Cr(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var wr=typeof Object.is==`function`?Object.is:Cr;function Tr(e,t){if(wr(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)||!wr(e[i],t[i]))return!1}return!0}function Er(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Dr(e,t){var n=Er(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=Er(n)}}function Or(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Or(e,t.parentNode):`contains`in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function kr(){for(var e=window,t=se();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href==`string`}catch{n=!1}if(n)e=t.contentWindow;else break;t=se(e.document)}return t}function Ar(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 jr(e){var t=kr(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&Or(n.ownerDocument.documentElement,n)){if(r!==null&&Ar(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=Dr(n,a);var o=Dr(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 Mr=c&&`documentMode`in document&&11>=document.documentMode,Nr=null,Pr=null,Fr=null,Ir=!1;function Lr(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Ir||Nr==null||Nr!==se(r)||(r=Nr,`selectionStart`in r&&Ar(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}),Fr&&Tr(Fr,r)||(Fr=r,r=li(Pr,`onSelect`),0<r.length&&(t=new wn(`onSelect`,`select`,null,t,n),e.push({event:t,listeners:r}),t.target=Nr)))}function Rr(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n[`Webkit`+e]=`webkit`+t,n[`Moz`+e]=`moz`+t,n}var zr={animationend:Rr(`Animation`,`AnimationEnd`),animationiteration:Rr(`Animation`,`AnimationIteration`),animationstart:Rr(`Animation`,`AnimationStart`),transitionend:Rr(`Transition`,`TransitionEnd`)},Br={},Vr={};c&&(Vr=document.createElement(`div`).style,`AnimationEvent`in window||(delete zr.animationend.animation,delete zr.animationiteration.animation,delete zr.animationstart.animation),`TransitionEvent`in window||delete zr.transitionend.transition);function Hr(e){if(Br[e])return Br[e];if(!zr[e])return e;var t=zr[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in Vr)return Br[e]=t[n];return e}var Ur=Hr(`animationend`),Wr=Hr(`animationiteration`),Gr=Hr(`animationstart`),Kr=Hr(`transitionend`),qr=new Map,Jr=`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 Yr(e,t){qr.set(e,t),o(t,[e])}for(var Xr=0;Xr<Jr.length;Xr++){var Zr=Jr[Xr];Yr(Zr.toLowerCase(),`on`+(Zr[0].toUpperCase()+Zr.slice(1)))}Yr(Ur,`onAnimationEnd`),Yr(Wr,`onAnimationIteration`),Yr(Gr,`onAnimationStart`),Yr(`dblclick`,`onDoubleClick`),Yr(`focusin`,`onFocus`),Yr(`focusout`,`onBlur`),Yr(Kr,`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 Qr=`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(` `),$r=new Set(`cancel close invalid load scroll toggle`.split(` `).concat(Qr));function ei(e,t,n){var r=e.type||`unknown-event`;e.currentTarget=n,Qe(r,t,void 0,e),e.currentTarget=null}function ti(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;ei(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;ei(i,s,l),a=c}}}if(Je)throw e=Ye,Je=!1,Ye=null,e}function ni(e,t){var n=t[Mi];n===void 0&&(n=t[Mi]=new Set);var r=e+`__bubble`;n.has(r)||(oi(t,e,2,!1),n.add(r))}function ri(e,t,n){var r=0;t&&(r|=4),oi(n,e,r,t)}var ii=`_reactListening`+Math.random().toString(36).slice(2);function ai(e){if(!e[ii]){e[ii]=!0,i.forEach(function(t){t!==`selectionchange`&&($r.has(t)||ri(t,!1,e),ri(t,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[ii]||(t[ii]=!0,ri(`selectionchange`,!1,t))}}function oi(e,t,n,r){switch(mn(t)){case 1:var i=ln;break;case 4:i=un;break;default:i=dn}n=i.bind(null,t,n,e),i=void 0,!Ue||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 si(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=Fi(s),o===null)return;if(c=o.tag,c===5||c===6){r=a=o;continue a}s=s.parentNode}}r=r.return}Ve(function(){var r=a,i=je(n),o=[];a:{var s=qr.get(e);if(s!==void 0){var c=wn,l=e;switch(e){case`keypress`:if(yn(n)===0)break a;case`keydown`:case`keyup`:c=Hn;break;case`focusin`:l=`focus`,c=Nn;break;case`focusout`:l=`blur`,c=Nn;break;case`beforeblur`:case`afterblur`:c=Nn;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=jn;break;case`drag`:case`dragend`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`dragstart`:case`drop`:c=Mn;break;case`touchcancel`:case`touchend`:case`touchmove`:case`touchstart`:c=Wn;break;case Ur:case Wr:case Gr:c=Pn;break;case Kr:c=Gn;break;case`scroll`:c=En;break;case`wheel`:c=Kn;break;case`copy`:case`cut`:case`paste`:c=Fn;break;case`gotpointercapture`:case`lostpointercapture`:case`pointercancel`:case`pointerdown`:case`pointermove`:case`pointerout`:case`pointerover`:case`pointerup`:c=Un}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=He(p,f),h!=null&&u.push(ci(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!==Ae&&(l=n.relatedTarget||n.fromElement)&&(Fi(l)||l[ji]))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?Fi(l):null,l!==null&&(d=$e(l),l!==d||l.tag!==5&&l.tag!==6)&&(l=null)):(c=null,l=r),c!==l)){if(u=jn,h=`onMouseLeave`,f=`onMouseEnter`,p=`mouse`,(e===`pointerout`||e===`pointerover`)&&(u=Un,h=`onPointerLeave`,f=`onPointerEnter`,p=`pointer`),d=c==null?s:Li(c),m=l==null?s:Li(l),s=new u(h,p+`leave`,c,n,i),s.target=d,s.relatedTarget=m,h=null,Fi(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=ui(m))p++;for(m=0,h=f;h;h=ui(h))m++;for(;0<p-m;)u=ui(u),p--;for(;0<m-p;)f=ui(f),m--;for(;p--;){if(u===f||f!==null&&u===f.alternate)break b;u=ui(u),f=ui(f)}u=null}else u=null;c!==null&&di(o,s,c,u,!1),l!==null&&d!==null&&di(o,d,l,u,!0)}}a:{if(s=r?Li(r):window,c=s.nodeName&&s.nodeName.toLowerCase(),c===`select`||c===`input`&&s.type===`file`)var g=fr;else if(or(s)){if(pr)g=Sr;else{g=br;var _=yr}}else(c=s.nodeName)&&c.toLowerCase()===`input`&&(s.type===`checkbox`||s.type===`radio`)&&(g=xr);if(g&&=g(e,r)){sr(o,g,n,i);break a}_&&_(e,s,r),e===`focusout`&&(_=s._wrapperState)&&_.controlled&&s.type===`number`&&de(s,`number`,s.value)}switch(_=r?Li(r):window,e){case`focusin`:(or(_)||_.contentEditable===`true`)&&(Nr=_,Pr=r,Fr=null);break;case`focusout`:Fr=Pr=Nr=null;break;case`mousedown`:Ir=!0;break;case`contextmenu`:case`mouseup`:case`dragend`:Ir=!1,Lr(o,n,i);break;case`selectionchange`:if(Mr)break;case`keydown`:case`keyup`:Lr(o,n,i)}var v;if(Jn)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 nr?er(e,n)&&(y=`onCompositionEnd`):e===`keydown`&&n.keyCode===229&&(y=`onCompositionStart`);y&&(Zn&&n.locale!==`ko`&&(nr||y!==`onCompositionStart`?y===`onCompositionEnd`&&nr&&(v=vn()):(hn=i,gn=`value`in hn?hn.value:hn.textContent,nr=!0)),_=li(r,y),0<_.length&&(y=new In(y,e,null,n,i),o.push({event:y,listeners:_}),v?y.data=v:(v=tr(n),v!==null&&(y.data=v)))),(v=Xn?rr(e,n):ir(e,n))&&(r=li(r,`onBeforeInput`),0<r.length&&(i=new In(`onBeforeInput`,`beforeinput`,null,n,i),o.push({event:i,listeners:r}),i.data=v))}ti(o,t)})}function ci(e,t,n){return{instance:e,listener:t,currentTarget:n}}function li(e,t){for(var n=t+`Capture`,r=[];e!==null;){var i=e,a=i.stateNode;i.tag===5&&a!==null&&(i=a,a=He(e,n),a!=null&&r.unshift(ci(e,a,i)),a=He(e,t),a!=null&&r.push(ci(e,a,i))),e=e.return}return r}function ui(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5);return e||null}function di(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=He(n,a),c!=null&&o.unshift(ci(n,c,s))):i||(c=He(n,a),c!=null&&o.push(ci(n,c,s)))),n=n.return}o.length!==0&&e.push({event:t,listeners:o})}var fi=/\r\n?/g,pi=/\u0000|\uFFFD/g;function mi(e){return(typeof e==`string`?e:``+e).replace(fi,`
|
|
81
|
+
`).replace(pi,``)}function hi(e,t,n){if(t=mi(t),mi(e)!==t&&n)throw Error(r(425))}function gi(){}var _i=null,vi=null;function yi(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 bi=typeof setTimeout==`function`?setTimeout:void 0,xi=typeof clearTimeout==`function`?clearTimeout:void 0,Si=typeof Promise==`function`?Promise:void 0,Ci=typeof queueMicrotask==`function`?queueMicrotask:Si===void 0?bi:function(e){return Si.resolve(null).then(e).catch(wi)};function wi(e){setTimeout(function(){throw e})}function Ti(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),on(t);return}r--}else n!==`$`&&n!==`$?`&&n!==`$!`||r++}n=i}while(n);on(t)}function Ei(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 Di(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 Oi=Math.random().toString(36).slice(2),ki=`__reactFiber$`+Oi,Ai=`__reactProps$`+Oi,ji=`__reactContainer$`+Oi,Mi=`__reactEvents$`+Oi,Ni=`__reactListeners$`+Oi,Pi=`__reactHandles$`+Oi;function Fi(e){var t=e[ki];if(t)return t;for(var n=e.parentNode;n;){if(t=n[ji]||n[ki]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=Di(e);e!==null;){if(n=e[ki])return n;e=Di(e)}return t}e=n,n=e.parentNode}return null}function Ii(e){return e=e[ki]||e[ji],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function Li(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(r(33))}function Ri(e){return e[Ai]||null}var zi=[],Bi=-1;function Vi(e){return{current:e}}function Hi(e){0>Bi||(e.current=zi[Bi],zi[Bi]=null,Bi--)}function Ui(e,t){Bi++,zi[Bi]=e.current,e.current=t}var Wi={},Gi=Vi(Wi),Ki=Vi(!1),qi=Wi;function Ji(e,t){var n=e.type.contextTypes;if(!n)return Wi;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 Yi(e){return e=e.childContextTypes,e!=null}function Xi(){Hi(Ki),Hi(Gi)}function Zi(e,t,n){if(Gi.current!==Wi)throw Error(r(168));Ui(Gi,t),Ui(Ki,n)}function Qi(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,H(e)||`Unknown`,a));return R({},n,i)}function $i(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Wi,qi=Gi.current,Ui(Gi,e),Ui(Ki,Ki.current),!0}function ea(e,t,n){var i=e.stateNode;if(!i)throw Error(r(169));n?(e=Qi(e,t,qi),i.__reactInternalMemoizedMergedChildContext=e,Hi(Ki),Hi(Gi),Ui(Gi,e)):Hi(Ki),Ui(Ki,n)}var ta=null,na=!1,ra=!1;function ia(e){ta===null?ta=[e]:ta.push(e)}function aa(e){na=!0,ia(e)}function oa(){if(!ra&&ta!==null){ra=!0;var e=0,t=Ft;try{var n=ta;for(Ft=1;e<n.length;e++){var r=n[e];do r=r(!0);while(r!==null)}ta=null,na=!1}catch(t){throw ta!==null&&(ta=ta.slice(e+1)),at(dt,oa),t}finally{Ft=t,ra=!1}}return null}var sa=[],ca=0,la=null,ua=0,da=[],fa=0,pa=null,ma=1,ha=``;function ga(e,t){sa[ca++]=ua,sa[ca++]=la,la=e,ua=t}function _a(e,t,n){da[fa++]=ma,da[fa++]=ha,da[fa++]=pa,pa=e;var r=ma;e=ha;var i=32-yt(r)-1;r&=~(1<<i),n+=1;var a=32-yt(t)+i;if(30<a){var o=i-i%5;a=(r&(1<<o)-1).toString(32),r>>=o,i-=o,ma=1<<32-yt(t)+i|n<<i|r,ha=a+e}else ma=1<<a|n<<i|r,ha=e}function va(e){e.return!==null&&(ga(e,1),_a(e,1,0))}function ya(e){for(;e===la;)la=sa[--ca],sa[ca]=null,ua=sa[--ca],sa[ca]=null;for(;e===pa;)pa=da[--fa],da[fa]=null,ha=da[--fa],da[fa]=null,ma=da[--fa],da[fa]=null}var ba=null,xa=null,Sa=!1,Ca=null;function wa(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 Ta(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,ba=e,xa=Ei(t.firstChild),!0);case 6:return t=e.pendingProps===``||t.nodeType!==3?null:t,t!==null&&(e.stateNode=t,ba=e,xa=null,!0);case 13:return t=t.nodeType===8?t:null,t!==null&&(n=pa===null?null:{id:ma,overflow:ha},e.memoizedState={dehydrated:t,treeContext:n,retryLane:1073741824},n=Ql(18,null,null,0),n.stateNode=t,n.return=e,e.child=n,ba=e,xa=null,!0);default:return!1}}function Ea(e){return!!(e.mode&1)&&!(e.flags&128)}function Da(e){if(Sa){var t=xa;if(t){var n=t;if(!Ta(e,t)){if(Ea(e))throw Error(r(418));t=Ei(n.nextSibling);var i=ba;t&&Ta(e,t)?wa(i,n):(e.flags=e.flags&-4097|2,Sa=!1,ba=e)}}else{if(Ea(e))throw Error(r(418));e.flags=e.flags&-4097|2,Sa=!1,ba=e}}}function Oa(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;ba=e}function ka(e){if(e!==ba)return!1;if(!Sa)return Oa(e),Sa=!0,!1;var t;if((t=e.tag!==3)&&!(t=e.tag!==5)&&(t=e.type,t=t!==`head`&&t!==`body`&&!yi(e.type,e.memoizedProps)),t&&=xa){if(Ea(e))throw Aa(),Error(r(418));for(;t;)wa(e,t),t=Ei(t.nextSibling)}if(Oa(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){xa=Ei(e.nextSibling);break a}t--}else n!==`$`&&n!==`$!`&&n!==`$?`||t++}e=e.nextSibling}xa=null}}else xa=ba?Ei(e.stateNode.nextSibling):null;return!0}function Aa(){for(var e=xa;e;)e=Ei(e.nextSibling)}function ja(){xa=ba=null,Sa=!1}function Ma(e){Ca===null?Ca=[e]:Ca.push(e)}var Na=S.ReactCurrentBatchConfig;function Pa(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 Fa(e,t){throw e=Object.prototype.toString.call(t),Error(r(31,e===`[object Object]`?`object with keys {`+Object.keys(t).join(`, `)+`}`:e))}function Ia(e){var t=e._init;return t(e._payload)}function La(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&&Ia(i)===t.type)?(r=a(t,n.props),r.ref=Pa(e,t,n),r.return=e,r):(r=nu(n.type,n.key,n.props,null,e.mode,r),r.ref=Pa(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=Pa(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(fe(t)||L(t))return t=ru(t,e.mode,n,null),t.return=e,t;Fa(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(fe(n)||L(n))return i===null?d(e,t,n,r,null):null;Fa(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(fe(r)||L(r))return e=e.get(n)||null,d(t,e,r,i,null);Fa(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),Sa&&ga(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 Sa&&ga(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)}),Sa&&ga(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),Sa&&ga(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 Sa&&ga(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)}),Sa&&ga(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&&Ia(c)===l.type){n(e,l.sibling),r=a(l,i.props),r.ref=Pa(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=Pa(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(fe(i))return h(e,r,i,o);if(L(i))return g(e,r,i,o);Fa(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 Ra=La(!0),za=La(!1),Ba=Vi(null),Va=null,Ha=null,Ua=null;function Wa(){Ua=Ha=Va=null}function Ga(e){var t=Ba.current;Hi(Ba),e._currentValue=t}function Ka(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 qa(e,t){Va=e,Ua=Ha=null,e=e.dependencies,e!==null&&e.firstContext!==null&&((e.lanes&t)!==0&&(Is=!0),e.firstContext=null)}function Ja(e){var t=e._currentValue;if(Ua!==e){if(e={context:e,memoizedValue:t,next:null},Ha===null){if(Va===null)throw Error(r(308));Ha=e,Va.dependencies={lanes:0,firstContext:e}}else Ha=Ha.next=e}return t}var Ya=null;function Xa(e){Ya===null?Ya=[e]:Ya.push(e)}function Za(e,t,n,r){var i=t.interleaved;return i===null?(n.next=n,Xa(t)):(n.next=i.next,i.next=n),t.interleaved=n,Qa(e,r)}function Qa(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 $a=!1;function eo(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function to(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 no(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function ro(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,Qa(e,n)}return i=r.interleaved,i===null?(t.next=t,Xa(r)):(t.next=i.next,i.next=t),r.interleaved=t,Qa(e,n)}function io(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,Pt(e,n)}}function ao(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 oo(e,t,n,r){var i=e.updateQueue;$a=!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:$a=!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 so(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 co={},lo=Vi(co),uo=Vi(co),fo=Vi(co);function po(e){if(e===co)throw Error(r(174));return e}function mo(e,t){switch(Ui(fo,t),Ui(uo,e),Ui(lo,co),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:ye(null,``);break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=ye(t,e)}Hi(lo),Ui(lo,t)}function ho(){Hi(lo),Hi(uo),Hi(fo)}function go(e){po(fo.current);var t=po(lo.current),n=ye(t,e.type);t!==n&&(Ui(uo,e),Ui(lo,n))}function _o(e){uo.current===e&&(Hi(lo),Hi(uo))}var vo=Vi(0);function yo(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 bo=[];function xo(){for(var e=0;e<bo.length;e++)bo[e]._workInProgressVersionPrimary=null;bo.length=0}var So=S.ReactCurrentDispatcher,Co=S.ReactCurrentBatchConfig,wo=0,To=null,Eo=null,Do=null,Oo=!1,ko=!1,Ao=0,jo=0;function Mo(){throw Error(r(321))}function No(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!wr(e[n],t[n]))return!1;return!0}function Po(e,t,n,i,a,o){if(wo=o,To=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,So.current=e===null||e.memoizedState===null?gs:_s,e=n(i,a),ko){o=0;do{if(ko=!1,Ao=0,25<=o)throw Error(r(301));o+=1,Do=Eo=null,t.updateQueue=null,So.current=vs,e=n(i,a)}while(ko)}if(So.current=hs,t=Eo!==null&&Eo.next!==null,wo=0,Do=Eo=To=null,Oo=!1,t)throw Error(r(300));return e}function Fo(){var e=Ao!==0;return Ao=0,e}function Io(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Do===null?To.memoizedState=Do=e:Do=Do.next=e,Do}function Lo(){if(Eo===null){var e=To.alternate;e=e===null?null:e.memoizedState}else e=Eo.next;var t=Do===null?To.memoizedState:Do.next;if(t!==null)Do=t,Eo=e;else{if(e===null)throw Error(r(310));Eo=e,e={memoizedState:Eo.memoizedState,baseState:Eo.baseState,baseQueue:Eo.baseQueue,queue:Eo.queue,next:null},Do===null?To.memoizedState=Do=e:Do=Do.next=e}return Do}function Ro(e,t){return typeof t==`function`?t(e):t}function zo(e){var t=Lo(),n=t.queue;if(n===null)throw Error(r(311));n.lastRenderedReducer=e;var i=Eo,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((wo&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,To.lanes|=d,el|=d}u=u.next}while(u!==null&&u!==o);l===null?s=i:l.next=c,wr(i,t.memoizedState)||(Is=!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,To.lanes|=o,el|=o,a=a.next;while(a!==e)}else a===null&&(n.lanes=0);return[t.memoizedState,n.dispatch]}function Bo(e){var t=Lo(),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);wr(o,t.memoizedState)||(Is=!0),t.memoizedState=o,t.baseQueue===null&&(t.baseState=o),n.lastRenderedState=o}return[o,i]}function Vo(){}function Ho(e,t){var n=To,i=Lo(),a=t(),o=!wr(i.memoizedState,a);if(o&&(i.memoizedState=a,Is=!0),i=i.queue,$o(Wo.bind(null,n,i,e),[e]),i.getSnapshot!==t||o||Do!==null&&Do.memoizedState.tag&1){if(n.flags|=2048,Jo(9,K.bind(null,n,i,a,t),void 0,null),qc===null)throw Error(r(349));wo&30||Uo(n,t,a)}return a}function Uo(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=To.updateQueue,t===null?(t={lastEffect:null,stores:null},To.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function K(e,t,n,r){t.value=n,t.getSnapshot=r,Go(t)&&Ko(e)}function Wo(e,t,n){return n(function(){Go(t)&&Ko(e)})}function Go(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!wr(e,n)}catch{return!0}}function Ko(e){var t=Qa(e,1);t!==null&&bl(t,e,1,-1)}function qo(e){var t=Io();return typeof e==`function`&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Ro,lastRenderedState:e},t.queue=e,e=e.dispatch=ds.bind(null,To,e),[t.memoizedState,e]}function Jo(e,t,n,r){return e={tag:e,create:t,destroy:n,deps:r,next:null},t=To.updateQueue,t===null?(t={lastEffect:null,stores:null},To.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 Yo(){return Lo().memoizedState}function Xo(e,t,n,r){var i=Io();To.flags|=e,i.memoizedState=Jo(1|t,n,void 0,r===void 0?null:r)}function Zo(e,t,n,r){var i=Lo();r=r===void 0?null:r;var a=void 0;if(Eo!==null){var o=Eo.memoizedState;if(a=o.destroy,r!==null&&No(r,o.deps)){i.memoizedState=Jo(t,n,a,r);return}}To.flags|=e,i.memoizedState=Jo(1|t,n,a,r)}function Qo(e,t){return Xo(8390656,8,e,t)}function $o(e,t){return Zo(2048,8,e,t)}function es(e,t){return Zo(4,2,e,t)}function ts(e,t){return Zo(4,4,e,t)}function ns(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 rs(e,t,n){return n=n==null?null:n.concat([e]),Zo(4,4,ns.bind(null,t,e),n)}function is(){}function as(e,t){var n=Lo();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&No(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function os(e,t){var n=Lo();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&No(t,r[1])?r[0]:(e=e(),n.memoizedState=[e,t],e)}function ss(e,t,n){return wo&21?(wr(n,t)||(n=At(),To.lanes|=n,el|=n,e.baseState=!0),t):(e.baseState&&(e.baseState=!1,Is=!0),e.memoizedState=n)}function cs(e,t){var n=Ft;Ft=n!==0&&4>n?n:4,e(!0);var r=Co.transition;Co.transition={};try{e(!1),t()}finally{Ft=n,Co.transition=r}}function ls(){return Lo().memoizedState}function us(e,t,n){var r=yl(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},fs(e))ps(t,n);else if(n=Za(e,t,n,r),n!==null){var i=vl();bl(n,e,r,i),ms(n,t,r)}}function ds(e,t,n){var r=yl(e),i={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(fs(e))ps(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,wr(s,o)){var c=t.interleaved;c===null?(i.next=i,Xa(t)):(i.next=c.next,c.next=i),t.interleaved=i;return}}catch{}n=Za(e,t,i,r),n!==null&&(i=vl(),bl(n,e,r,i),ms(n,t,r))}}function fs(e){var t=e.alternate;return e===To||t!==null&&t===To}function ps(e,t){ko=Oo=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function ms(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Pt(e,n)}}var hs={readContext:Ja,useCallback:Mo,useContext:Mo,useEffect:Mo,useImperativeHandle:Mo,useInsertionEffect:Mo,useLayoutEffect:Mo,useMemo:Mo,useReducer:Mo,useRef:Mo,useState:Mo,useDebugValue:Mo,useDeferredValue:Mo,useTransition:Mo,useMutableSource:Mo,useSyncExternalStore:Mo,useId:Mo,unstable_isNewReconciler:!1},gs={readContext:Ja,useCallback:function(e,t){return Io().memoizedState=[e,t===void 0?null:t],e},useContext:Ja,useEffect:Qo,useImperativeHandle:function(e,t,n){return n=n==null?null:n.concat([e]),Xo(4194308,4,ns.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Xo(4194308,4,e,t)},useInsertionEffect:function(e,t){return Xo(4,2,e,t)},useMemo:function(e,t){var n=Io();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=Io();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=us.bind(null,To,e),[r.memoizedState,e]},useRef:function(e){var t=Io();return e={current:e},t.memoizedState=e},useState:qo,useDebugValue:is,useDeferredValue:function(e){return Io().memoizedState=e},useTransition:function(){var e=qo(!1),t=e[0];return e=cs.bind(null,e[1]),Io().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var i=To,a=Io();if(Sa){if(n===void 0)throw Error(r(407));n=n()}else{if(n=t(),qc===null)throw Error(r(349));wo&30||Uo(i,t,n)}a.memoizedState=n;var o={value:n,getSnapshot:t};return a.queue=o,Qo(Wo.bind(null,i,o,e),[e]),i.flags|=2048,Jo(9,K.bind(null,i,o,n,t),void 0,null),n},useId:function(){var e=Io(),t=qc.identifierPrefix;if(Sa){var n=ha,r=ma;n=(r&~(1<<32-yt(r)-1)).toString(32)+n,t=`:`+t+`R`+n,n=Ao++,0<n&&(t+=`H`+n.toString(32)),t+=`:`}else n=jo++,t=`:`+t+`r`+n.toString(32)+`:`;return e.memoizedState=t},unstable_isNewReconciler:!1},_s={readContext:Ja,useCallback:as,useContext:Ja,useEffect:$o,useImperativeHandle:rs,useInsertionEffect:es,useLayoutEffect:ts,useMemo:os,useReducer:zo,useRef:Yo,useState:function(){return zo(Ro)},useDebugValue:is,useDeferredValue:function(e){return ss(Lo(),Eo.memoizedState,e)},useTransition:function(){return[zo(Ro)[0],Lo().memoizedState]},useMutableSource:Vo,useSyncExternalStore:Ho,useId:ls,unstable_isNewReconciler:!1},vs={readContext:Ja,useCallback:as,useContext:Ja,useEffect:$o,useImperativeHandle:rs,useInsertionEffect:es,useLayoutEffect:ts,useMemo:os,useReducer:Bo,useRef:Yo,useState:function(){return Bo(Ro)},useDebugValue:is,useDeferredValue:function(e){var t=Lo();return Eo===null?t.memoizedState=e:ss(t,Eo.memoizedState,e)},useTransition:function(){return[Bo(Ro)[0],Lo().memoizedState]},useMutableSource:Vo,useSyncExternalStore:Ho,useId:ls,unstable_isNewReconciler:!1};function ys(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 bs(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 xs={isMounted:function(e){return(e=e._reactInternals)?$e(e)===e:!1},enqueueSetState:function(e,t,n){e=e._reactInternals;var r=vl(),i=yl(e),a=no(r,i);a.payload=t,n!=null&&(a.callback=n),t=ro(e,a,i),t!==null&&(bl(t,e,i,r),io(t,e,i))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=vl(),i=yl(e),a=no(r,i);a.tag=1,a.payload=t,n!=null&&(a.callback=n),t=ro(e,a,i),t!==null&&(bl(t,e,i,r),io(t,e,i))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=vl(),r=yl(e),i=no(n,r);i.tag=2,t!=null&&(i.callback=t),t=ro(e,i,r),t!==null&&(bl(t,e,r,n),io(t,e,r))}};function Ss(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?!Tr(n,r)||!Tr(i,a):!0}function Cs(e,t,n){var r=!1,i=Wi,a=t.contextType;return typeof a==`object`&&a?a=Ja(a):(i=Yi(t)?qi:Gi.current,r=t.contextTypes,a=(r=r!=null)?Ji(e,i):Wi),t=new t(n,a),e.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=xs,e.stateNode=t,t._reactInternals=e,r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=i,e.__reactInternalMemoizedMaskedChildContext=a),t}function ws(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&&xs.enqueueReplaceState(t,t.state,null)}function Ts(e,t,n,r){var i=e.stateNode;i.props=n,i.state=e.memoizedState,i.refs={},eo(e);var a=t.contextType;typeof a==`object`&&a?i.context=Ja(a):(a=Yi(t)?qi:Gi.current,i.context=Ji(e,a)),i.state=e.memoizedState,a=t.getDerivedStateFromProps,typeof a==`function`&&(bs(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&&xs.enqueueReplaceState(i,i.state,null),oo(e,n,i,r),i.state=e.memoizedState),typeof i.componentDidMount==`function`&&(e.flags|=4194308)}function Es(e,t){try{var n=``,r=t;do n+=te(r),r=r.return;while(r);var i=n}catch(e){i=`
|
|
82
|
+
Error generating stack: `+e.message+`
|
|
83
|
+
`+e.stack}return{value:e,source:t,stack:i,digest:null}}function Ds(e,t,n){return{value:e,source:null,stack:n??null,digest:t??null}}function Os(e,t){try{console.error(t.value)}catch(e){setTimeout(function(){throw e})}}var ks=typeof WeakMap==`function`?WeakMap:Map;function As(e,t,n){n=no(-1,n),n.tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){cl||(cl=!0,ll=r),Os(e,t)},n}function js(e,t,n){n=no(-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(){Os(e,t)}}var a=e.stateNode;return a!==null&&typeof a.componentDidCatch==`function`&&(n.callback=function(){Os(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 Ms(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new ks;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 Ns(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 Ps(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=no(-1,1),t.tag=2,ro(n,t,1))),n.lanes|=1),e)}var Fs=S.ReactCurrentOwner,Is=!1;function Ls(e,t,n,r){t.child=e===null?za(t,null,n,r):Ra(t,e.child,n,r)}function Rs(e,t,n,r,i){n=n.render;var a=t.ref;return qa(t,i),r=Po(e,t,n,r,a,i),n=Fo(),e!==null&&!Is?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i,ic(e,t,i)):(Sa&&n&&va(t),t.flags|=1,Ls(e,t,r,i),t.child)}function zs(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,Bs(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?Tr:n,n(o,r)&&e.ref===t.ref)return ic(e,t,i)}return t.flags|=1,e=tu(a,r),e.ref=t.ref,e.return=t,t.child=e}function Bs(e,t,n,r,i){if(e!==null){var a=e.memoizedProps;if(Tr(a,r)&&e.ref===t.ref){if(Is=!1,t.pendingProps=r=a,(e.lanes&i)!==0)e.flags&131072&&(Is=!0);else return t.lanes=e.lanes,ic(e,t,i)}}return Us(e,t,n,r,i)}function Vs(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},Ui(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,Ui(Zc,Xc),Xc|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=a===null?n:a.baseLanes,Ui(Zc,Xc),Xc|=r}}else a===null?r=n:(r=a.baseLanes|n,t.memoizedState=null),Ui(Zc,Xc),Xc|=r;return Ls(e,t,i,n),t.child}function Hs(e,t){var n=t.ref;(e===null&&n!==null||e!==null&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function Us(e,t,n,r,i){var a=Yi(n)?qi:Gi.current;return a=Ji(t,a),qa(t,i),n=Po(e,t,n,r,a,i),r=Fo(),e!==null&&!Is?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i,ic(e,t,i)):(Sa&&r&&va(t),t.flags|=1,Ls(e,t,n,i),t.child)}function Ws(e,t,n,r,i){if(Yi(n)){var a=!0;$i(t)}else a=!1;if(qa(t,i),t.stateNode===null)rc(e,t),Cs(t,n,r),Ts(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=Ja(l):(l=Yi(n)?qi:Gi.current,l=Ji(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)&&ws(t,o,r,l),$a=!1;var f=t.memoizedState;o.state=f,oo(t,r,o,i),c=t.memoizedState,s!==r||f!==c||Ki.current||$a?(typeof u==`function`&&(bs(t,n,u,r),c=t.memoizedState),(s=$a||Ss(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,to(e,t),s=t.memoizedProps,l=t.type===t.elementType?s:ys(t.type,s),o.props=l,d=t.pendingProps,f=o.context,c=n.contextType,typeof c==`object`&&c?c=Ja(c):(c=Yi(n)?qi:Gi.current,c=Ji(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)&&ws(t,o,r,c),$a=!1,f=t.memoizedState,o.state=f,oo(t,r,o,i);var m=t.memoizedState;s!==d||f!==m||Ki.current||$a?(typeof p==`function`&&(bs(t,n,p,r),m=t.memoizedState),(l=$a||Ss(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 Gs(e,t,n,r,a,i)}function Gs(e,t,n,r,i,a){Hs(e,t);var o=!!(t.flags&128);if(!r&&!o)return i&&ea(t,n,!1),ic(e,t,a);r=t.stateNode,Fs.current=t;var s=o&&typeof n.getDerivedStateFromError!=`function`?null:r.render();return t.flags|=1,e!==null&&o?(t.child=Ra(t,e.child,null,a),t.child=Ra(t,null,s,a)):Ls(e,t,s,a),t.memoizedState=r.state,i&&ea(t,n,!0),t.child}function Ks(e){var t=e.stateNode;t.pendingContext?Zi(e,t.pendingContext,t.pendingContext!==t.context):t.context&&Zi(e,t.context,!1),mo(e,t.containerInfo)}function qs(e,t,n,r,i){return ja(),Ma(i),t.flags|=256,Ls(e,t,n,r),t.child}var Js={dehydrated:null,treeContext:null,retryLane:0};function Ys(e){return{baseLanes:e,cachePool:null,transitions:null}}function Xs(e,t,n){var r=t.pendingProps,i=vo.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),Ui(vo,i&1),e===null)return Da(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=Ys(n),t.memoizedState=Js,e):Zs(t,o));if(i=e.memoizedState,i!==null&&(s=i.dehydrated,s!==null))return $s(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?Ys(n):{baseLanes:o.baseLanes|n,cachePool:null,transitions:o.transitions},a.memoizedState=o,a.childLanes=e.childLanes&~n,t.memoizedState=Js,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 Zs(e,t){return t=iu({mode:`visible`,children:t},e.mode,0,null),t.return=e,e.child=t}function Qs(e,t,n,r){return r!==null&&Ma(r),Ra(t,e.child,null,n),e=Zs(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function $s(e,t,n,i,a,o,s){if(n)return t.flags&256?(t.flags&=-257,i=Ds(Error(r(422))),Qs(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&&Ra(t,e.child,null,s),t.child.memoizedState=Ys(s),t.memoizedState=Js,o):(t.child=e.child,t.flags|=128,null);if(!(t.mode&1))return Qs(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=Ds(o,i,void 0),Qs(e,t,s,i)}if(c=(s&e.childLanes)!==0,Is||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,Qa(e,a),bl(i,e,a,-1))}return Pl(),i=Ds(Error(r(421))),Qs(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,xa=Ei(a.nextSibling),ba=t,Sa=!0,Ca=null,e!==null&&(da[fa++]=ma,da[fa++]=ha,da[fa++]=pa,ma=e.id,ha=e.overflow,pa=t),t=Zs(t,i.children),t.flags|=4096,t)}function ec(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),Ka(e.return,t,n)}function tc(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 nc(e,t,n){var r=t.pendingProps,i=r.revealOrder,a=r.tail;if(Ls(e,t,r.children,n),r=vo.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&&ec(e,n,t);else if(e.tag===19)ec(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(Ui(vo,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&&yo(e)===null&&(i=n),n=n.sibling;n=i,n===null?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null),tc(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&&yo(e)===null){t.child=i;break}e=i.sibling,i.sibling=n,n=i,i=e}tc(t,!0,n,null,a);break;case`together`:tc(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function rc(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function ic(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 ac(e,t,n){switch(t.tag){case 3:Ks(t),ja();break;case 5:go(t);break;case 1:Yi(t.type)&&$i(t);break;case 4:mo(t,t.stateNode.containerInfo);break;case 10:var r=t.type._context,i=t.memoizedProps.value;Ui(Ba,r._currentValue),r._currentValue=i;break;case 13:if(r=t.memoizedState,r!==null)return r.dehydrated===null?(n&t.child.childLanes)===0?(Ui(vo,vo.current&1),e=ic(e,t,n),e===null?null:e.sibling):Xs(e,t,n):(Ui(vo,vo.current&1),t.flags|=128,null);Ui(vo,vo.current&1);break;case 19:if(r=(n&t.childLanes)!==0,e.flags&128){if(r)return nc(e,t,n);t.flags|=128}if(i=t.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),Ui(vo,vo.current),r)break;return null;case 22:case 23:return t.lanes=0,Vs(e,t,n)}return ic(e,t,n)}var oc=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}},sc=function(e,t,n,r){var i=e.memoizedProps;if(i!==r){e=t.stateNode,po(lo.current);var o=null;switch(n){case`input`:i=W(e,i),r=W(e,r),o=[];break;case`select`:i=R({},i,{value:void 0}),r=R({},r,{value:void 0}),o=[];break;case`textarea`:i=me(e,i),r=me(e,r),o=[];break;default:typeof i.onClick!=`function`&&typeof r.onClick==`function`&&(e.onclick=gi)}Oe(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`&&ni(`scroll`,e),o||c===l||(o=[])):(o||=[]).push(u,l))}}n&&(o||=[]).push(`style`,n);var u=o;(t.updateQueue=u)&&(t.flags|=4)}},cc=function(e,t,n,r){n!==r&&(t.flags|=4)};function lc(e,t){if(!Sa)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 uc(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 dc(e,t,n){var i=t.pendingProps;switch(ya(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return uc(t),null;case 1:return Yi(t.type)&&Xi(),uc(t),null;case 3:return i=t.stateNode,ho(),Hi(Ki),Hi(Gi),xo(),i.pendingContext&&(i.context=i.pendingContext,i.pendingContext=null),(e===null||e.child===null)&&(ka(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,Ca!==null&&(wl(Ca),Ca=null))),uc(t),null;case 5:_o(t);var o=po(fo.current);if(n=t.type,e!==null&&t.stateNode!=null)sc(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 uc(t),null}if(e=po(lo.current),ka(t)){i=t.stateNode,n=t.type;var s=t.memoizedProps;switch(i[ki]=t,i[Ai]=s,e=!!(t.mode&1),n){case`dialog`:ni(`cancel`,i),ni(`close`,i);break;case`iframe`:case`object`:case`embed`:ni(`load`,i);break;case`video`:case`audio`:for(o=0;o<Qr.length;o++)ni(Qr[o],i);break;case`source`:ni(`error`,i);break;case`img`:case`image`:case`link`:ni(`error`,i),ni(`load`,i);break;case`details`:ni(`toggle`,i);break;case`input`:G(i,s),ni(`invalid`,i);break;case`select`:i._wrapperState={wasMultiple:!!s.multiple},ni(`invalid`,i);break;case`textarea`:he(i,s),ni(`invalid`,i)}for(var c in Oe(n,s),o=null,s)if(s.hasOwnProperty(c)){var l=s[c];c===`children`?typeof l==`string`?i.textContent!==l&&(!0!==s.suppressHydrationWarning&&hi(i.textContent,l,e),o=[`children`,l]):typeof l==`number`&&i.textContent!==``+l&&(!0!==s.suppressHydrationWarning&&hi(i.textContent,l,e),o=[`children`,``+l]):a.hasOwnProperty(c)&&l!=null&&c===`onScroll`&&ni(`scroll`,i)}switch(n){case`input`:ae(i),ue(i,s,!0);break;case`textarea`:ae(i),_e(i);break;case`select`:case`option`:break;default:typeof s.onClick==`function`&&(i.onclick=gi)}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=ve(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[ki]=t,e[Ai]=i,oc(e,t,!1,!1),t.stateNode=e;a:{switch(c=ke(n,i),n){case`dialog`:ni(`cancel`,e),ni(`close`,e),o=i;break;case`iframe`:case`object`:case`embed`:ni(`load`,e),o=i;break;case`video`:case`audio`:for(o=0;o<Qr.length;o++)ni(Qr[o],e);o=i;break;case`source`:ni(`error`,e),o=i;break;case`img`:case`image`:case`link`:ni(`error`,e),ni(`load`,e),o=i;break;case`details`:ni(`toggle`,e),o=i;break;case`input`:G(e,i),o=W(e,i),ni(`invalid`,e);break;case`option`:o=i;break;case`select`:e._wrapperState={wasMultiple:!!i.multiple},o=R({},i,{value:void 0}),ni(`invalid`,e);break;case`textarea`:he(e,i),o=me(e,i),ni(`invalid`,e);break;default:o=i}for(s in Oe(n,o),l=o,l)if(l.hasOwnProperty(s)){var u=l[s];s===`style`?Ee(e,u):s===`dangerouslySetInnerHTML`?(u=u?u.__html:void 0,u!=null&&xe(e,u)):s===`children`?typeof u==`string`?(n!==`textarea`||u!==``)&&Se(e,u):typeof u==`number`&&Se(e,``+u):s!==`suppressContentEditableWarning`&&s!==`suppressHydrationWarning`&&s!==`autoFocus`&&(a.hasOwnProperty(s)?u!=null&&s===`onScroll`&&ni(`scroll`,e):u!=null&&x(e,s,u,c))}switch(n){case`input`:ae(e),ue(e,i,!1);break;case`textarea`:ae(e),_e(e);break;case`option`:i.value!=null&&e.setAttribute(`value`,``+U(i.value));break;case`select`:e.multiple=!!i.multiple,s=i.value,s==null?i.defaultValue!=null&&pe(e,!!i.multiple,i.defaultValue,!0):pe(e,!!i.multiple,s,!1);break;default:typeof o.onClick==`function`&&(e.onclick=gi)}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 uc(t),null;case 6:if(e&&t.stateNode!=null)cc(e,t,e.memoizedProps,i);else{if(typeof i!=`string`&&t.stateNode===null)throw Error(r(166));if(n=po(fo.current),po(lo.current),ka(t)){if(i=t.stateNode,n=t.memoizedProps,i[ki]=t,(s=i.nodeValue!==n)&&(e=ba,e!==null))switch(e.tag){case 3:hi(i.nodeValue,n,!!(e.mode&1));break;case 5:!0!==e.memoizedProps.suppressHydrationWarning&&hi(i.nodeValue,n,!!(e.mode&1))}s&&(t.flags|=4)}else i=(n.nodeType===9?n:n.ownerDocument).createTextNode(i),i[ki]=t,t.stateNode=i}return uc(t),null;case 13:if(Hi(vo),i=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(Sa&&xa!==null&&t.mode&1&&!(t.flags&128))Aa(),ja(),t.flags|=98560,s=!1;else if(s=ka(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[ki]=t}else ja(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;uc(t),s=!1}else Ca!==null&&(wl(Ca),Ca=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||vo.current&1?Qc===0&&(Qc=3):Pl())),t.updateQueue!==null&&(t.flags|=4),uc(t),null);case 4:return ho(),e===null&&ai(t.stateNode.containerInfo),uc(t),null;case 10:return Ga(t.type._context),uc(t),null;case 17:return Yi(t.type)&&Xi(),uc(t),null;case 19:if(Hi(vo),s=t.memoizedState,s===null)return uc(t),null;if(i=!!(t.flags&128),c=s.rendering,c===null){if(i)lc(s,!1);else{if(Qc!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(c=yo(e),c!==null){for(t.flags|=128,lc(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 Ui(vo,vo.current&1|2),t.child}e=e.sibling}s.tail!==null&<()>ol&&(t.flags|=128,i=!0,lc(s,!1),t.lanes=4194304)}}else{if(!i){if(e=yo(c),e!==null){if(t.flags|=128,i=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),lc(s,!0),s.tail===null&&s.tailMode===`hidden`&&!c.alternate&&!Sa)return uc(t),null}else 2*lt()-s.renderingStartTime>ol&&n!==1073741824&&(t.flags|=128,i=!0,lc(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?(uc(t),null):(t=s.tail,s.rendering=t,s.tail=t.sibling,s.renderingStartTime=lt(),t.sibling=null,n=vo.current,Ui(vo,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&&(uc(t),t.subtreeFlags&6&&(t.flags|=8192)):uc(t),null;case 24:return null;case 25:return null}throw Error(r(156,t.tag))}function fc(e,t){switch(ya(t),t.tag){case 1:return Yi(t.type)&&Xi(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return ho(),Hi(Ki),Hi(Gi),xo(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return _o(t),null;case 13:if(Hi(vo),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(r(340));ja()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Hi(vo),null;case 4:return ho(),null;case 10:return Ga(t.type._context),null;case 22:case 23:return Al(),null;case 24:return null;default:return null}}var pc=!1,mc=!1,hc=typeof WeakSet==`function`?WeakSet:Set,gc=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(_i=cn,e=kr(),Ar(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(vi={focusedElem:e,selectionRange:n},cn=!1,gc=t;gc!==null;)if(t=gc,e=t.child,t.subtreeFlags&1028&&e!==null)e.return=t,gc=e;else for(;gc!==null;){t=gc;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:ys(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,gc=e;break}gc=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[ki],delete t[Ai],delete t[Mi],delete t[Ni],delete t[Pi])),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=gi));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(_t&&typeof _t.onCommitFiberUnmount==`function`)try{_t.onCommitFiberUnmount(gt,n)}catch{}switch(n.tag){case 5:mc||_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?Ti(e.parentNode,n):e.nodeType===1&&Ti(e,n),on(e)):Ti(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(!mc&&(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(!mc&&(_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?(mc=(r=mc)||n.memoizedState!==null,jc(e,t,n),mc=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 hc),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{Se(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&&ce(a,o),ke(c,s);var u=ke(c,o);for(s=0;s<l.length;s+=2){var d=l[s],f=l[s+1];d===`style`?Ee(a,f):d===`dangerouslySetInnerHTML`?xe(a,f):d===`children`?Se(a,f):x(a,d,f,u)}switch(c){case`input`:le(a,o);break;case`textarea`:ge(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?pe(a,!!o.multiple,o.multiple?[]:``,!1):pe(a,!!o.multiple,o.defaultValue,!0)):pe(a,!!o.multiple,m,!1)}a[Ai]=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{on(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=lt())),i&4&&Nc(e);break;case 22:if(d=n!==null&&n.memoizedState!==null,e.mode&1?(mc=(u=mc)||d,Pc(t,e),mc=u):Pc(t,e),Ic(e),i&8192){if(u=e.memoizedState!==null,(e.stateNode.isHidden=u)&&!d&&e.mode&1)for(gc=e,d=e.child;d!==null;){for(f=gc=d;gc!==null;){switch(p=gc,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,gc=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=Te(`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&&(Se(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){gc=e,Rc(e,t,n)}function Rc(e,t,n){for(var r=!!(e.mode&1);gc!==null;){var i=gc,a=i.child;if(i.tag===22&&r){var o=i.memoizedState!==null||pc;if(!o){var s=i.alternate,c=s!==null&&s.memoizedState!==null||mc;s=pc;var l=mc;if(pc=o,(mc=c)&&!l)for(gc=i;gc!==null;)o=gc,c=o.child,o.tag===22&&o.memoizedState!==null||c===null?Vc(i):(c.return=o,gc=c);for(;a!==null;)gc=a,Rc(a,t,n),a=a.sibling;gc=i,pc=s,mc=l}zc(e,t,n)}else i.subtreeFlags&8772&&a!==null?(a.return=i,gc=a):zc(e,t,n)}}function zc(e){for(;gc!==null;){var t=gc;if(t.flags&8772){var n=t.alternate;try{if(t.flags&8772)switch(t.tag){case 0:case 11:case 15:mc||Sc(5,t);break;case 1:var i=t.stateNode;if(t.flags&4&&!mc){if(n===null)i.componentDidMount();else{var a=t.elementType===t.type?n.memoizedProps:ys(t.type,n.memoizedProps);i.componentDidUpdate(a,n.memoizedState,i.__reactInternalSnapshotBeforeUpdate)}}var o=t.updateQueue;o!==null&&so(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}so(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&&on(f)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(r(163))}mc||t.flags&512&&Cc(t)}catch(e){Wl(t,t.return,e)}}if(t===e){gc=null;break}if(n=t.sibling,n!==null){n.return=t.return,gc=n;break}gc=t.return}}function Bc(e){for(;gc!==null;){var t=gc;if(t===e){gc=null;break}var n=t.sibling;if(n!==null){n.return=t.return,gc=n;break}gc=t.return}}function Vc(e){for(;gc!==null;){var t=gc;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){gc=null;break}var s=t.sibling;if(s!==null){s.return=t.return,gc=s;break}gc=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=Vi(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?lt():gl===-1?gl=lt():gl}function yl(e){return e.mode&1?Kc&2&&Yc!==0?Yc&-Yc:Na.transition===null?(e=Ft,e===0?(e=window.event,e=e===void 0?16:mn(e.type),e):e):(_l===0&&(_l=At()),_l):1}function bl(e,t,n,i){if(50<ml)throw ml=0,hl=null,Error(r(185));Mt(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=lt()+500,na&&oa()))}function xl(e,t){var n=e.callbackNode;Ot(e,t);var r=Et(e,e===qc?Yc:0);if(r===0)n!==null&&ot(n),e.callbackNode=null,e.callbackPriority=0;else if(t=r&-r,e.callbackPriority!==t){if(n!=null&&ot(n),t===1)e.tag===0?aa(Dl.bind(null,e)):ia(Dl.bind(null,e)),Ci(function(){!(Kc&6)&&oa()}),n=null;else{switch(It(r)){case 1:n=dt;break;case 4:n=ft;break;case 16:n=pt;break;case 536870912:n=ht;break;default:n=pt}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=Et(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=lt()+500,jl(e,t));do try{Ll();break}catch(t){Ml(e,t)}while(1);Wa(),Uc.current=o,Kc=a,Jc===null?(qc=null,Yc=0,t=Qc):t=0}if(t!==0){if(t===2&&(a=kt(e),a!==0&&(i=a,t=Cl(e,a))),t===1)throw n=$c,jl(e,0),El(e,i),xl(e,lt()),n;if(t===6)El(e,i);else{if(a=e.current.alternate,!(i&30)&&!Tl(a)&&(t=Fl(e,i),t===2&&(o=kt(e),o!==0&&(i=o,t=Cl(e,o))),t===1))throw n=$c,jl(e,0),El(e,i),xl(e,lt()),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-lt(),10<t)){if(Et(e,0)!==0)break;if(a=e.suspendedLanes,(a&i)!==i){vl(),e.pingedLanes|=e.suspendedLanes&a;break}e.timeoutHandle=bi(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-yt(i);o=1<<s,s=t[s],s>a&&(a=s),i&=~o}if(i=a,i=lt()-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=bi(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,lt()),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(!wr(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-yt(t),r=1<<n;e[n]=-1,t&=~r}}function Dl(e){if(Kc&6)throw Error(r(327));Hl();var t=Et(e,0);if(!(t&1))return xl(e,lt()),null;var n=Fl(e,t);if(e.tag!==0&&n===2){var i=kt(e);i!==0&&(t=i,n=Cl(e,i))}if(n===1)throw n=$c,jl(e,0),El(e,t),xl(e,lt()),n;if(n===6)throw Error(r(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,Bl(e,il,sl),xl(e,lt()),null}function Ol(e,t){var n=Kc;Kc|=1;try{return e(t)}finally{Kc=n,Kc===0&&(ol=lt()+500,na&&oa())}}function kl(e){fl!==null&&fl.tag===0&&!(Kc&6)&&Hl();var t=Kc;Kc|=1;var n=Gc.transition,r=Ft;try{if(Gc.transition=null,Ft=1,e)return e()}finally{Ft=r,Gc.transition=n,Kc=t,!(Kc&6)&&oa()}}function Al(){Xc=Zc.current,Hi(Zc)}function jl(e,t){e.finishedWork=null,e.finishedLanes=0;var n=e.timeoutHandle;if(n!==-1&&(e.timeoutHandle=-1,xi(n)),Jc!==null)for(n=Jc.return;n!==null;){var r=n;switch(ya(r),r.tag){case 1:r=r.type.childContextTypes,r!=null&&Xi();break;case 3:ho(),Hi(Ki),Hi(Gi),xo();break;case 5:_o(r);break;case 4:ho();break;case 13:Hi(vo);break;case 19:Hi(vo);break;case 10:Ga(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,Ya!==null){for(t=0;t<Ya.length;t++)if(n=Ya[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}Ya=null}return e}function Ml(e,t){do{var n=Jc;try{if(Wa(),So.current=hs,Oo){for(var i=To.memoizedState;i!==null;){var a=i.queue;a!==null&&(a.pending=null),i=i.next}Oo=!1}if(wo=0,Do=Eo=To=null,ko=!1,Ao=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=Ns(s);if(m!==null){m.flags&=-257,Ps(m,s,c,o,t),m.mode&1&&Ms(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)){Ms(o,u,t),Pl();break a}l=Error(r(426))}else if(Sa&&c.mode&1){var _=Ns(s);if(_!==null){!(_.flags&65536)&&(_.flags|=256),Ps(_,s,c,o,t),Ma(Es(l,c));break a}}o=l=Es(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=As(o,l,t);ao(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=js(o,c,t);ao(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=hs,e===null?hs: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(Wa(),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&&!st();)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=fc(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=dc(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=Ft,i=Gc.transition;try{Gc.transition=null,Ft=1,Vl(e,t,n,r)}finally{Gc.transition=i,Ft=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(Nt(e,o),e===qc&&(Jc=qc=null,Yc=0),!(n.subtreeFlags&2064)&&!(n.flags&2064)||dl||(dl=!0,Xl(pt,function(){return Hl(),null})),o=!!(n.flags&15990),n.subtreeFlags&15990||o){o=Gc.transition,Gc.transition=null;var s=Ft;Ft=1;var c=Kc;Kc|=4,Wc.current=null,bc(e,n),Fc(n,e),jr(vi),cn=!!_i,vi=_i=null,e.current=n,Lc(n,e,a),ct(),Kc=c,Ft=s,Gc.transition=o}else e.current=n;if(dl&&(dl=!1,fl=e,pl=a),o=e.pendingLanes,o===0&&(ul=null),vt(n.stateNode,i),xl(e,lt()),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,oa(),null}function Hl(){if(fl!==null){var e=It(pl),t=Gc.transition,n=Ft;try{if(Gc.transition=null,Ft=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,gc=e.current;gc!==null;){var o=gc,s=o.child;if(gc.flags&16){var c=o.deletions;if(c!==null){for(var l=0;l<c.length;l++){var u=c[l];for(gc=u;gc!==null;){var d=gc;switch(d.tag){case 0:case 11:case 15:xc(8,d,o)}var f=d.child;if(f!==null)f.return=d,gc=f;else for(;gc!==null;){d=gc;var p=d.sibling,m=d.return;if(wc(d),d===u){gc=null;break}if(p!==null){p.return=m,gc=p;break}gc=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)}}gc=o}}if(o.subtreeFlags&2064&&s!==null)s.return=o,gc=s;else b:for(;gc!==null;){if(o=gc,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,gc=v;break b}gc=o.return}}var y=e.current;for(gc=y;gc!==null;){s=gc;var b=s.child;if(s.subtreeFlags&2064&&b!==null)b.return=s,gc=b;else b:for(s=y;gc!==null;){if(c=gc,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){gc=null;break b}var x=c.sibling;if(x!==null){x.return=c.return,gc=x;break b}gc=c.return}}if(Kc=a,oa(),_t&&typeof _t.onPostCommitFiberRoot==`function`)try{_t.onPostCommitFiberRoot(gt,e)}catch{}i=!0}return i}finally{Ft=n,Gc.transition=t}}return!1}function Ul(e,t,n){t=Es(n,t),t=As(e,t,1),e=ro(e,t,1),t=vl(),e!==null&&(Mt(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=Es(n,e),e=js(t,e,1),t=ro(t,e,1),e=vl(),t!==null&&(Mt(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>lt()-al?jl(e,0):nl|=n),xl(e,t)}function Kl(e,t){t===0&&(e.mode&1?(t=wt,wt<<=1,!(wt&130023424)&&(wt=4194304)):t=1);var n=vl();e=Qa(e,t),e!==null&&(Mt(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||Ki.current)Is=!0;else{if((e.lanes&n)===0&&!(t.flags&128))return Is=!1,ac(e,t,n);Is=!!(e.flags&131072)}}else Is=!1,Sa&&t.flags&1048576&&_a(t,ua,t.index);switch(t.lanes=0,t.tag){case 2:var i=t.type;rc(e,t),e=t.pendingProps;var a=Ji(t,Gi.current);qa(t,n),a=Po(null,t,i,e,a,n);var o=Fo();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,Yi(i)?(o=!0,$i(t)):o=!1,t.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,eo(t),a.updater=xs,t.stateNode=a,a._reactInternals=t,Ts(t,i,e,n),t=Gs(null,t,i,!0,o,n)):(t.tag=0,Sa&&o&&va(t),Ls(null,t,a,n),t=t.child),t;case 16:i=t.elementType;a:{switch(rc(e,t),e=t.pendingProps,a=i._init,i=a(i._payload),t.type=i,a=t.tag=eu(i),e=ys(i,e),a){case 0:t=Us(null,t,i,e,n);break a;case 1:t=Ws(null,t,i,e,n);break a;case 11:t=Rs(null,t,i,e,n);break a;case 14:t=zs(null,t,i,ys(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:ys(i,a),Us(e,t,i,a,n);case 1:return i=t.type,a=t.pendingProps,a=t.elementType===i?a:ys(i,a),Ws(e,t,i,a,n);case 3:a:{if(Ks(t),e===null)throw Error(r(387));i=t.pendingProps,o=t.memoizedState,a=o.element,to(e,t),oo(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=Es(Error(r(423)),t),t=qs(e,t,i,n,a);break a}if(i!==a){a=Es(Error(r(424)),t),t=qs(e,t,i,n,a);break a}for(xa=Ei(t.stateNode.containerInfo.firstChild),ba=t,Sa=!0,Ca=null,n=za(t,null,i,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling}else{if(ja(),i===a){t=ic(e,t,n);break a}Ls(e,t,i,n)}t=t.child}return t;case 5:return go(t),e===null&&Da(t),i=t.type,a=t.pendingProps,o=e===null?null:e.memoizedProps,s=a.children,yi(i,a)?s=null:o!==null&&yi(i,o)&&(t.flags|=32),Hs(e,t),Ls(e,t,s,n),t.child;case 6:return e===null&&Da(t),null;case 13:return Xs(e,t,n);case 4:return mo(t,t.stateNode.containerInfo),i=t.pendingProps,e===null?t.child=Ra(t,null,i,n):Ls(e,t,i,n),t.child;case 11:return i=t.type,a=t.pendingProps,a=t.elementType===i?a:ys(i,a),Rs(e,t,i,a,n);case 7:return Ls(e,t,t.pendingProps,n),t.child;case 8:return Ls(e,t,t.pendingProps.children,n),t.child;case 12:return Ls(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,Ui(Ba,i._currentValue),i._currentValue=s,o!==null){if(wr(o.value,s)){if(o.children===a.children&&!Ki.current){t=ic(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=no(-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),Ka(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),Ka(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}}Ls(e,t,a.children,n),t=t.child}return t;case 9:return a=t.type,i=t.pendingProps.children,qa(t,n),a=Ja(a),i=i(a),t.flags|=1,Ls(e,t,i,n),t.child;case 14:return i=t.type,a=ys(i,t.pendingProps),a=ys(i.type,a),zs(e,t,i,a,n);case 15:return Bs(e,t,t.type,t.pendingProps,n);case 17:return i=t.type,a=t.pendingProps,a=t.elementType===i?a:ys(i,a),rc(e,t),t.tag=1,Yi(i)?(e=!0,$i(t)):e=!1,qa(t,n),Cs(t,i,a),Ts(t,i,a,n),Gs(null,t,i,!0,e,n);case 19:return nc(e,t,n);case 22:return Vs(e,t,n)}throw Error(r(156,t.tag))};function Xl(e,t){return at(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=jt(0),this.expirationTimes=jt(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=jt(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},eo(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 Wi;e=e._reactInternals;a:{if($e(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(Yi(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(Yi(n))return Qi(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=no(r,i),a.callback=t??null,ro(n,a,i),e.current.lanes=i,Mt(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=no(a,o),t.payload={element:e},r=r===void 0?null:r,r!==null&&(t.callback=r),e=ro(i,t,o),e!==null&&(bl(e,i,o,a),io(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[ji]=null}};function yu(e){this._internalRoot=e}yu.prototype.unstable_scheduleHydration=function(e){if(e){var t=Bt();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Yt.length&&t!==0&&t<Yt[n].priority;n++);Yt.splice(n,0,e),n===0&&en(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[ji]=o.current,ai(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[ji]=c.current,ai(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)}Lt=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var n=Tt(t.pendingLanes);n!==0&&(Pt(t,n|1),xl(t,lt()),!(Kc&6)&&(ol=lt()+500,oa()))}break;case 13:kl(function(){var t=Qa(e,1);t!==null&&bl(t,e,1,vl())}),hu(e,1)}},Rt=function(e){if(e.tag===13){var t=Qa(e,134217728);t!==null&&bl(t,e,134217728,vl()),hu(e,134217728)}},zt=function(e){if(e.tag===13){var t=yl(e),n=Qa(e,t);n!==null&&bl(n,e,t,vl()),hu(e,t)}},Bt=function(){return Ft},Vt=function(e,t){var n=Ft;try{return Ft=e,t()}finally{Ft=n}},Me=function(e,t,n){switch(t){case`input`:if(le(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=Ri(i);if(!a)throw Error(r(90));oe(i),le(i,a)}}}break;case`textarea`:ge(e,n);break;case`select`:t=n.value,t!=null&&pe(e,!!n.multiple,t,!1)}},Re=Ol,ze=kl;var Tu={usingClientEntryPoint:!1,Events:[Ii,Li,Ri,Ie,Le,Ol]},Eu={findFiberByHostInstance:Fi,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=rt(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{gt=Ou.inject(Du),_t=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[ji]=t.current,ai(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=rt(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[ji]=t.current,ai(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[ji]=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`})),AS=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=mne()})),hne=o((e=>{var t=AS();e.createRoot=t.createRoot,e.hydrateRoot=t.hydrateRoot}))();function jS(e,t){console.error(JSON.stringify({source:`agar`,operation:e,failureKind:t instanceof Error?`Error`:`NonErrorThrown`}),Xm(t))}var gne=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 MS=globalThis[gne],NS=MS?MS.RpcTarget:class{},_ne=async function(){}.constructor,vne=typeof Buffer<`u`?Buffer.prototype:void 0;function PS(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 _ne.prototype:return`function`;case Array.prototype:return`array`;case Date.prototype:return`date`;case Uint8Array.prototype:case vne: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 WS.prototype:return`stub`;case GS.prototype:return`rpc-promise`;default:if(MS){if(t==MS.RpcStub.prototype||e instanceof MS.ServiceStub)return`rpc-target`;if(t==MS.RpcPromise.prototype||t==MS.RpcProperty.prototype)return`rpc-thenable`}return e instanceof NS?`rpc-target`:e instanceof Error?`error`:`unsupported`}}function FS(){throw Error(`RPC map() implementation was not loaded.`)}var IS={applyMap:FS,sendMap:FS};function LS(){throw Error(`Stream implementation was not loaded.`)}var RS={createWritableStreamHook:LS,createWritableStreamFromHook:LS,createReadableStreamHook:LS},zS=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}}},BS=class extends zS{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)}}},VS=new BS(Error(`Attempted to use RPC stub after it has been disposed.`)),HS=(e,t,n)=>e.call(t,n);function yne(e,t){let n=HS;HS=e;try{return t()}finally{HS=n}}var US=Symbol(`realStub`),bne={apply(e,t,n){let r=e.raw;return new GS(HS(r.hook,r.pathIfPromise||[],XS.fromAppParams(n)),[])},get(e,t,n){let r=e.raw;if(t===US)return r;if(t in GS.prototype)return r[t];if(typeof t==`string`)return new GS(r.hook,r.pathIfPromise?[...r.pathIfPromise,t]:[t]);if(t===Symbol.dispose&&(!r.pathIfPromise||r.pathIfPromise.length==0))return()=>{r.hook.dispose(),r.hook=VS}},has(e,t){let n=e.raw;return t===US?!0:t in GS.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.`)}},WS=class e extends NS{constructor(e,t){if(super(),!(e instanceof zS)){let n=e;if(e=n instanceof NS||n instanceof Function?tC.create(n,void 0):new $S(XS.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,bne)}hook;pathIfPromise;dup(){let t=this[US];return t.pathIfPromise?new e(t.hook.get(t.pathIfPromise)):new e(t.hook.dup())}onRpcBroken(e){this[US].hook.onBroken(e)}map(e){let{hook:t,pathIfPromise:n}=this[US];return IS.sendMap(t,n||[],e)}toString(){return`[object RpcStub]`}},GS=class extends WS{constructor(e,t){if(e instanceof zS)super(e,t??[]);else{if(t!==void 0)throw TypeError(`RpcPromise constructor expected one argument, received two.`);let n=PS(e);if(n===`rpc-promise`){let t=JS(e);if(t.pathIfPromise.length>0)super(t.hook,t.pathIfPromise);else{let e=t.hook;t.hook=VS,super(e,[])}}else if(n===`rpc-thenable`)super(tC.create(e,void 0),[]);else{let t=new nC(Promise.resolve(e).then(e=>new $S(XS.fromAppReturn(e))));t.ignoreUnhandledRejections(),super(t,[])}}}then(e,t){return YS(this).then(...arguments)}catch(e){return YS(this).catch(...arguments)}finally(e){return YS(this).finally(...arguments)}toString(){return`[object RpcPromise]`}};function xne(e){let{hook:t,pathIfPromise:n}=e[US];return n&&n.length>0?t.get(n):t}function Sne(e){let{hook:t,pathIfPromise:n}=e[US];return n?t.get(n):t.dup()}function KS(e){let{hook:t,pathIfPromise:n}=e[US];if(!(n&&n.length>0))return t}function qS(e){return e[US].hook}function JS(e){return e[US]}async function YS(e){let{hook:t,pathIfPromise:n}=e[US];return n.length>0&&(t=t.get(n)),(await t.pull()).deliverResolve()}var XS=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 tC.create(e,t)}if(this.source===`return`){let r=this.rpcTargets?.get(e);return r?n?r.dup():(this.rpcTargets?.delete(e),r):(r=tC.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 RS.createWritableStreamHook(e);if(this.source===`return`){let t=this.rpcTargets?.get(e);return t?n?t.dup():(this.rpcTargets?.delete(e),t):(t=RS.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 RS.createReadableStreamHook(e);if(this.source===`return`){let t=this.rpcTargets?.get(e);return t?n?t.dup():(this.rpcTargets?.delete(e),t):(t=RS.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(PS(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?Sne(t):xne(t),t instanceof GS){let e=new GS(a,[]);return this.promises.push({parent:r,property:n,promise:e}),e}return this.hooks.push(a),new WS(a)}case`function`:case`rpc-target`:{let n=e,r;return r=a?a.getHookForRpcTarget(n,t,i):tC.create(n,t),this.hooks.push(r),new WS(r)}case`rpc-thenable`:{let o=e,s;return s=a?new GS(a.getHookForRpcTarget(o,t,i),[]):new GS(tC.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):RS.createWritableStreamHook(n),this.hooks.push(r),n}case`readable`:{let n=e,r;return r=a?a.getHookForReadableStream(n,t,i):RS.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 GS)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=KS(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 GS?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(PS(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=KS(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)):eC(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=RS.createWritableStreamHook(t),n.dispose();return}case`readable`:{let t=e,n=this.rpcTargets?.get(t);n?this.rpcTargets.delete(t):n=RS.createReadableStreamHook(t),n.dispose();return}default:return}}ignoreUnhandledRejections(){this.hooks?(this.hooks.forEach(e=>{e.ignoreUnhandledRejections()}),this.promises.forEach(e=>qS(e.promise).ignoreUnhandledRejections())):this.ignoreUnhandledRejectionsImpl(this.value)}ignoreUnhandledRejectionsImpl(e){switch(PS(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`:qS(e).ignoreUnhandledRejections();return;case`rpc-thenable`:e.then(e=>{},e=>{});return;default:return}}};function ZS(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(PS(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}=JS(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 GS){let{hook:t,pathIfPromise:n}=JS(e);return{hook:t,remainingPath:n||[]}}return{value:e,parent:t,owner:r}}var QS=class extends zS{call(e,t){let n;try{let{value:t,owner:r}=this.getValue();n=ZS(t,void 0,e,r)}catch(e){return t.dispose(),new BS(e)}return n.hook?n.hook.call(n.remainingPath,t):typeof n.value==`function`?new nC(t.deliverCall(n.value,n.parent).then(e=>new $S(e))):(t.dispose(),new BS(TypeError(`'${e.join(`.`)}' is not a function.`)))}map(e,t,n){try{let r;try{let{value:t,owner:n}=this.getValue();r=ZS(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):IS.applyMap(r.value,r.parent,r.owner,t,n)}catch(e){return new BS(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=ZS(t,void 0,e,n);return r.hook?r.hook.get(r.remainingPath):new $S(XS.deepCopyFrom(r.value,r.parent,r.owner))}catch(e){return new BS(e)}}},$S=class e extends QS{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(XS.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 WS&&this.payload.value.onRpcBroken(e)}};function eC(e){if(Symbol.dispose in e)try{e[Symbol.dispose]()}catch(e){Promise.reject(e)}}var tC=class e extends QS{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=>XS.fromAppReturn(e)):Promise.reject(Error(`Tried to resolve a non-promise stub.`))}ignoreUnhandledRejections(){}dispose(){this.target&&=(this.refcount&&--this.refcount.count==0&&eC(this.target),void 0)}onBroken(e){let t=this.target;t&&`then`in t&&Promise.resolve(t).then(()=>{},e)}},nC=class e extends zS{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)}},rC={maxBigIntDigits:16384,maxDepth:256,maxMessageSize:33554432},iC=new Uint8Array(new Uint16Array([1]).buffer)[0]===1,Cne=[`ArrayBuffer`,`DataView`,`Int8Array`,`Uint8Array`,`Uint8ClampedArray`,`Int16Array`,`Uint16Array`,`Int32Array`,`Uint32Array`,`BigInt64Array`,`BigUint64Array`,`Float32Array`,`Float64Array`];function wne(e){return Cne.includes(e)}var aC={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},oC={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},sC=new Map;for(let e of Object.keys(oC))sC.set(oC[e],e);function cC(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 Tne=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 Ene(e,t){let n=await new Response(e).blob();return n.type===t?n:n.slice(0,n.size,t)}var Dne={__proto__:null,Error,EvalError,RangeError,ReferenceError,SyntaxError,TypeError,URIError,AggregateError},lC=class e{exporter;source;encodingLevel;constructor(e,t,n){this.exporter=e,this.source=t,this.encodingLevel=n}static devaluate(t,n,r=Tne,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(PS(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=sC.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=aC[t];!iC&&i&&(n=n.slice(),cC(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=RS.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=RS.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}=JS(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 rC}};function One(e,t){return new GS(new nC(new Response(t).arrayBuffer().then(t=>{let n=new Uint8Array(t),r=new Request(e,{body:n});return new $S(XS.fromAppReturn(r))})),[])}function kne(e,t){return new GS(new nC(Ene(e,t).then(e=>new $S(XS.fromAppReturn(e)))),[])}var uC=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=XS.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(!wne(t[2])){let e=t[2].slice(0,64);throw TypeError(`Unknown bytes type marker: ${e}`)}let n=t[2],r=aC[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(!iC&&r!==void 0&&cC(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=Dne[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=One(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=kne(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 GS(e,[]);return this.promises.push({promise:t,parent:n,property:r}),t}return this.hooks.push(e),new GS(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 GS(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 GS(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 WS(e)}}break;case`writable`:if(typeof t[1]==`number`){let e=this.importer.importStub(t[1]),n=RS.createWritableStreamFromHook(e);return this.hooks.push(e),n}break;case`readable`:if(typeof t[1]==`number`){let e=this.importer.getPipeReadable(t[1]),n=RS.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}},dC=16,fC=8,pC=16,Ane=64;function mC(e){return 2+e.length*3}function hC(e,t,n=0){if(n>=Ane)return fC;switch(typeof e){case`string`:return mC(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 pC+e.byteLength;if(typeof Blob<`u`&&e instanceof Blob)return pC+e.size;if(e instanceof Date)return 16;if(t??=new WeakSet,t.has(e))return fC;if(t.add(e),e instanceof Array){let r=dC;for(let i of e)r+=fC+hC(i,t,n+1);return r}if(e instanceof Error){let r=dC+mC(e.name)+mC(e.message)+mC(e.stack??``);for(let i of Object.keys(e))r+=fC+mC(i)+hC(e[i],t,n+1);return r}let r=dC;for(let i of Object.keys(e))r+=fC+mC(i)+hC(e[i],t,n+1);return r}default:return 16}}var gC=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 BS(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)}},_C=class e extends zS{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)}},jne=class extends _C{session;constructor(e){super(!1,e),this.session=e.session}dispose(){if(this.session){let e=this.session;this.session=void 0,e.shutdown()}}},Mne=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={...rC,...n.limits},this.exports.push({hook:t,refcount:1}),this.imports.push(new gC(this,0,!1)),this.readLoop().catch(e=>this.abort(e))}getMainImport(){return new jne(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,lC.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 WS){let{hook:n,pathIfPromise:r}=JS(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=lC.devaluate(t.value,void 0,this,t,this.encodingLevel);this.send([`resolve`,e,n]),r&&this.releaseExport(e,1)},t=>{this.send([`reject`,e,lC.devaluate(t,void 0,this,void 0,this.encodingLevel)]),r&&this.releaseExport(e,1)}).catch(t=>{try{this.send([`reject`,e,lC.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 _C&&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 gC(this,e,!1),this.imports[e]=t),new _C(!1,t)}importPromise(e){if(this.abortReason)throw this.abortReason;if(this.imports[e])return new BS(Error(`Bug in RPC system: The peer sent a promise reusing an existing export ID.`));let t=new gC(this,e,!0);return this.imports[e]=t,new _C(!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 gC(this,n,!1);this.imports.push(r);let i=new _C(!1,r),a=RS.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=lC.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 gC(this,this.imports.length,!1);return this.imports.push(i),new _C(!0,i)}sendStream(e,t,n){if(this.abortReason)throw n.dispose(),this.abortReason;let r=[`pipeline`,e,t],i;try{i=lC.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=hC(a));let s=this.imports.length,c=new gC(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 gC(this,this.imports.length,!1);return this.imports.push(a),new _C(!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`,lC.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 $S(new uC(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 $S(new uC(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=RS.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 $S(new uC(this,this.encodingLevel).evaluate(n[2])));else{let e=new uC(this,this.encodingLevel).evaluate(n[2]);e.dispose(),t.resolve(new BS(e.value))}}else n[0]==`resolve`&&new uC(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 uC(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}},Nne=class{#e;#t;constructor(e,t,n={}){let r;r=t?new $S(XS.fromAppReturn(t)):new BS(Error(`This connection has no main object.`)),this.#e=new Mne(e,r,n),this.#t=new WS(this.#e.getMainImport())}getRemoteMain(){return this.#t}getStats(){return this.#e.getStats()}drain(){return this.#e.drain()}};function Pne(e,t,n){return new Nne(new Fne(e),t,n).getRemoteMain()}var Fne=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))}},vC,Ine=class{context;captureMap=new Map;instructions=[];constructor(e,t){this.context=vC?{parent:vC,captures:[],subject:vC.capture(e),path:t}:{parent:void 0,captures:[],subject:e,path:t},vC=this}unregister(){vC=this.context.parent}makeInput(){return new bC(this,0)}makeOutput(e){let t;try{t=lC.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 bC(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=lC.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 bC(this,this.instructions.length)}pushGet(e,t){let n=this.capture(e.dup());return this.instructions.push([`pipeline`,n,t]),new bC(this,this.instructions.length)}capture(e){if(e instanceof bC&&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){}};IS.sendMap=(e,t,n)=>{let r=new Ine(e,t),i;try{i=XS.fromAppReturn(yne(r.pushCall.bind(r),()=>n(new GS(r.makeInput(),[]))))}finally{r.unregister()}if(i instanceof Promise)throw i.catch(e=>{}),Error(`RPC map() callbacks cannot be async.`);return new GS(r.makeOutput(i),[])};function yC(){throw Error(`Attempted to use an abstract placeholder from a mapper function. Please make sure your map function has no side effects.`)}var bC=class extends zS{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(vC)return vC.pushGet(this,e);yC()}call(e,t){t.dispose(),yC()}map(e,t,n){for(let e of t)e.dispose();yC()}pull(){yC()}ignoreUnhandledRejections(){}onBroken(e){yC()}},Lne=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 uC(this).evaluateCopy(t);if(e.value instanceof WS){let t=KS(e.value);if(t){this.variables.push(t);continue}}this.variables.push(new $S(e))}return new uC(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 rC}};function xC(e,t,n,r,i){let a=new Lne(r,new $S(XS.deepCopyFrom(e,t,n)));try{return a.apply(i)}finally{a.dispose()}}IS.applyMap=(e,t,n,r,i)=>{try{let a;if(e instanceof GS)throw Error(`applyMap() can't be called on RpcPromise`);if(e instanceof Array){let t=[];try{for(let a of e)t.push(xC(a,e,n,r,i))}catch(e){for(let e of t)e.dispose();throw e}a=XS.fromArray(t)}else a=e==null?XS.fromAppReturn(e):xC(e,t,n,r,i);return new $S(a)}finally{for(let e of r)e.dispose()}};var Rne=class e extends zS{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 nC((r===`write`?t.deliverStreamWrite(n.writer):t.deliverCall(n.writer[r],n.writer)).then(e=>new $S(e)))}catch(e){return t.dispose(),new BS(e)}}map(e,t,n){for(let e of t)e.dispose();return new BS(Error(`Cannot use map() on a WritableStream`))}get(e){return new BS(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)}},zne=262144,Bne=1073741824,Vne=65536,Hne=2,SC=1.25,Une=.9,Wne=3,Gne=class{now;window=zne;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?Hne:SC,s=a*this.minRtt*o;s=Math.min(s,e.windowAtSend*o),s=e.windowFullAtSend?Math.max(s,e.windowAtSend*Une):Math.max(s,this.window),this.window=Math.max(Math.min(s,Bne),Vne),this.inStartupPhase&&e.sentTime>=this.roundStartTime&&(this.window>this.lastRoundWindow*SC?this.roundsWithoutIncrease=0:++this.roundsWithoutIncrease>=Wne&&(this.inStartupPhase=!1),this.roundStartTime=t,this.lastRoundWindow=this.window)}return this.bytesInFlight<this.window}};function Kne(e){let t,n=!1,r=new Gne(()=>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=XS.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`],XS.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`],XS.fromAppParams([n]));r.then(()=>o(),()=>o())}})}var qne=class e extends zS{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 BS(Error(`Cannot call methods on a ReadableStream stub`))}map(e,t,n){for(let e of t)e.dispose();return new BS(Error(`Cannot use map() on a ReadableStream`))}get(e){return new BS(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){}};RS.createWritableStreamHook=Rne.create,RS.createWritableStreamFromHook=Kne,RS.createReadableStreamHook=qne.create;var CC=WS,wC=NS,Jne=Pne;function TC(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 EC(e,t=80){let n=``;for(let t=0;t<e.length;t+=1){let r=e.charCodeAt(t);n+=TC(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 Yne(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,onActivate:()=>()=>void 0});function Xne(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 DC(e){let t=e.trim().toLowerCase();if(!t)throw Error(`Invalid keymap token: token cannot be empty`);return t}function Zne(e){let t=e.trim().toLowerCase();if(!t)throw Error(`Invalid key name: key name cannot be empty`);return t}function OC(e){return{name:Zne(e.name),ctrl:e.ctrl??!1,shift:e.shift??!1,meta:e.meta??!1,super:e.super??!1,hyper:e.hyper||void 0}}function kC(e){return{name:e.name,ctrl:e.ctrl,shift:e.shift,meta:e.meta,super:e.super,hyper:e.hyper||void 0}}function AC(e,t){let n=kC(OC(e));return{stroke:n,display:t?.display??IC(n),match:t?.match??MC(n),tokenName:t?.tokenName?DC(t.tokenName):void 0}}function Qne(e){return{stroke:kC(e.stroke),display:e.display,match:e.match,tokenName:e.tokenName,patternName:e.patternName,payloadKey:e.payloadKey}}function jC(e){return e.map(e=>Qne(e))}function $ne(e){return`match`in e?e.match:`stroke`in e?MC(e.stroke):MC(e)}function MC(e){return`key:${ere(OC(e))}`}function NC(e){let t=e.trim();if(!t)throw Error(`Invalid keymap match id: id cannot be empty`);return`text:${t}`}function PC(e,t){return`stroke`in e?t?.preferDisplay&&e.display?e.display:IC(e.stroke):IC(OC(e))}function FC(e,t){return e.map(e=>PC(e,t)).join(t?.separator??``)}function IC(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 ere(e){return`${e.name}:${+!!e.ctrl}:${+!!e.shift}:${+!!e.meta}:${+!!e.super}:${+!!e.hyper}`}var tre=Symbol(`keymap-extension-context`);function LC(e){return e.isDestroyed?null:e.getFocusedTarget()}function nre(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 RC(e,t){let n=new Set;return nre(e,t,e=>{n.add(e)}),n}function zC(e,t,n){let r=[],i=RC(t,n),a=Array.isArray(e)?e:rre(e);for(let e of a)BC(t,e,n,i)&&r.push(e);return r}function rre(e){return[...e].sort((e,t)=>t.priority-e.priority||t.order-e.order)}function BC(e,t,n,r=RC(e,n)){let i=t.target;return i?e.isTargetDestroyed(i)?!1:t.targetMode===`focus`?i===n:r.has(i):!0}function VC(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 HC(e,t,n=!0){let r=e.binding.sequence[e.index];if(!r?.patternName)return!0;let i=t.get(r.patternName);return i?VC(e)>=i.min:n}function UC(e,t,n=!0){let r=e.binding.sequence[e.index];if(r?.patternName){let n=t.get(r.patternName);if(n&&VC(e)<n.max)return!0}return HC(e,t,n)&&e.index+1<e.binding.sequence.length}function WC(e,t){return e.index===e.binding.sequence.length-1&&HC(e,t,!1)}function GC(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 KC(e,t){let n=GC(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=GC(e,n.stroke,n.match,r),e.patternChildren.push(i))}else i=e.children.get(n.match),i||(i=GC(e,n.stroke,n.match),e.children.set(n.match,i));i.reachableBindings.push(r),e=i}e.bindings.push(r)}return n}function ire(e,t){let n=[];for(let r of e){if(!HC(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 qC(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 JC(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 YC(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 qC({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 are(e,t,n,r,i,a){let o=e.binding.sequence[e.index];if(o?.patternName){let s=r.get(o.patternName);if(s&&VC(e)<s.max){let t=i(s.name,n);if(t){let r=a(n,s.name,t);return qC(e,e.index,r,t.value??n.name)}}return HC(e,r,!1)?YC(e.layer,e.binding,e.index+1,e.parts,e.patterns,t,n,i,a):void 0}return YC(e.layer,e.binding,e.index+1,e.parts,e.patterns,t,n,i,a)}function XC(e,t,n,r,i){let a=[],o=1/0;for(let s of e.bindings){if(s.event!==`press`)continue;let c=YC(e,s,0,[],void 0,t,n,r,i);if(!c)continue;let l=JC(c,t);l<o&&(o=l,a.length=0),l===o&&a.push(c)}return a}import.meta.require;function ZC(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 QC(){let e=[];return{get:()=>e,set:t=>{e=t},remove(t){e=e.filter(e=>e!==t)},has:()=>e.length>0,clear:()=>{e=[]}}}function $C(){let e=QC();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 ew(){let e=QC(),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 tw(e){return typeof e==`string`||!!e&&typeof e==`object`&&!Array.isArray(e)}function nw(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(!tw(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 rw(e){let t=nw(e);if(!t.ok)throw Error(t.reason);return e.map(e=>({...e,key:typeof e.key==`string`?e.key:{...e.key}}))}function iw(e){return{...e,sequence:jC(e.sequence)}}function aw(e,t){let n=$C();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=ow(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 ow(e){return e.map(t=>({sequence:jC(t.sequence),command:t.command,attrs:t.attrs,event:t.event,preventDefault:t.preventDefault,fallthrough:t.fallthrough,parsedBinding:iw(t.parsedBinding),sourceTarget:t.sourceTarget,sourceLayerOrder:t.sourceLayerOrder,bindingIndex:t.bindingIndex,hasCommandAtSequence:e.some(e=>e.event===`press`&&e.command!==void 0&&sw(e,t)),hasContinuations:e.some(e=>e.event===`press`&&cw(t,e))}))}function sw(e,t){return e.sequence.length===t.sequence.length&&e.sequence.every((e,n)=>e.match===t.sequence[n]?.match)}function cw(e,t){return e.sequence.length<t.sequence.length&&e.sequence.every((e,n)=>e.match===t.sequence[n]?.match)}function lw(){return{version:-1,notifyVersion:-1,focused:void 0,value:[],targets:new WeakMap}}function uw(){return{plain:lw(),bindings:lw(),metadata:lw(),bindingsAndMetadata:lw()}}function dw(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 fw(e,t,n){let r=n?e.targets.get(n):e.nullTarget;return r?.version===t?r:void 0}function pw(e,t,n,r){let i={version:t,value:r};n?e.targets.set(n,i):e.nullTarget=i}function mw(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 hw(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 gw(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=PC(i.stroke)),c&&(o=void 0),n.push(AC(i.stroke,{display:a,match:i.match,tokenName:o}))}return n}function _w(e){if(e.isDestroyed)throw Error(`Cannot use a keymap after its host was destroyed`);return e}function vw(e,t,n,r,i,a,o={}){let s=uw(),c=-1,l=[],u=()=>_w(t).getFocusedTarget(),d=()=>LC(t),f=t=>{let n=e.pending;mw(n,t)||(e.pending=t,o.onPendingSequenceChanged?.(n,t),H(),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)&&UC(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?gw(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=hw(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=dw(s,t);return i.notifyVersion===e.derivedVersion?i.value:y(i,n,r)},y=(n,r,i)=>{t.isDestroyed&&_w(t);let o=u(),s=fw(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,pw(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=zC(e.sortedLayers,t,n),e.activeLayersCache),C=(e,n)=>BC(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?PC(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?te(c,s,r):t.set(e,V(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=B(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=B(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(ire(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?te(l,c,i):n.set(s,V(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=ne(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=B(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?PC(a.stroke):``),i&&(n=void 0),{display:t,tokenName:n}},B=(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}},V=(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}),te=(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)}},ne=(e,t,n,r,i)=>{if(!e.commandBinding&&!e.continues)return;let o={stroke:kC(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},H=()=>{n.has(`pendingSequence`)&&n.emit(`pendingSequence`,e.pending?gw(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:gw,collectMatchingBindings:E,collectActiveBindings:A}}var yw=new Set([`name`,`run`,`fields`,`attrs`,`rejectedResult`]),bw=new Set([`key`,`cmd`,`event`,`preventDefault`,`fallthrough`]),xw=new Set([`target`,`targetMode`,`priority`,`bindings`,`commands`]);function Sw(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 Cw(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 ww(e,t,n){let r=e.get(t);r?r.push(n):e.set(t,[n])}function Tw(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),ww(n,e.command.name,i)}return{entries:t,chainsByName:n}}function Ew(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),ww(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 Dw(e,t,n,r){return(e.activeLayersCacheVersion!==e.cacheVersion||e.activeLayersCacheFocused!==r)&&(e.activeLayersCacheVersion=e.cacheVersion,e.activeLayersCacheFocused=r,e.activeLayersCache=zC(e.sortedLayers,t,r)),Ew(e.activeLayersCache,n,!0)}function Ow(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 kw(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 Aw(e){let t=`field ${e.fieldName}`;return{require(n,r){Ow(e.requirements,n,r,t)},attr(n,r){if(!e.attrs)throw Error(`Keymap ${t} cannot publish attrs`);kw(e.attrs,n,r,t)},activeWhen(n){e.matchers.push(e.conditions.buildRuntimeMatcher(n,t))}}}function jw(e){let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}function Mw(e,t){return e instanceof Error&&e.message?e.message:t}function Nw(e){return!e||typeof e!=`object`&&typeof e!=`function`?!1:typeof e.then==`function`}function Pw(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=>Pw(e,t)):[...e];return r?Object.freeze(i):i}if(e&&typeof e==`object`){if(i&&!jw(e))return e;let a={};for(let[r,i]of Object.entries(e))a[r]=n?Pw(i,t):i;return r?Object.freeze(a):a}return e}var Fw=[`name`],Iw=Object.freeze({}),Lw=new WeakMap;function Rw(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=>Bw({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=>re(e).map(e=>zw(e.commandState)),S=e=>{let t=U(e),n=re(e,t);if(n.length===0)return[];let r=n.map(e=>({entry:e,command:zw(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&&ie(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:(ae(n,U(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=le(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=le(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=V(B(t));return g.set(t,n??null),n},E=(e,t)=>V(M(t).chainsByName.get(e)),D=(e,t)=>le(e,null,{mode:`registered`,execution:t}),O=(e,t,n)=>le(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(!BC(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=Dw(e,t,r,n);return P()&&(s=e.derivedVersion,c=n,l=i),i},N=()=>a===e.derivedVersion&&o?o:(a=e.derivedVersion,o=Tw(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:te(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:te(e.command,t,`active`)?.attrs},L=(e,n)=>{if(n?.some(t=>t.command.name===e)||N().chainsByName.has(e))return`resolved`;let r=le(e,LC(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}:te(e,t,`active`)},ee=e=>B(e)?.[0],B=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},V=e=>{if(e?.length)return e.map(e=>({target:e.layer.target,command:e.commandState.command,attrs:e.commandState.attrs}))},te=(e,t,n)=>le(e,t,{mode:n}).resolved,ne=()=>N().entries,H=()=>{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},U=e=>{let n=e?.visibility??`reachable`,r=e&&Object.prototype.hasOwnProperty.call(e,`focused`)?e.focused??null:LC(t);return n===`registered`?{visibility:n,focused:r}:{visibility:n,focused:r,activeView:M(r)}},re=(e,t=U(e))=>{let r;return r=t.visibility===`registered`?ne():t.visibility===`active`?t.activeView?.entries??[]:t.activeView?.reachable??[],Gw({entries:r,query:e,getCommand:e=>zw(e),onFilterError:e=>{n.emitError(`command-query-filter-error`,e,`[Keymap] Error in command query filter:`)}})},ie=(e,t,n)=>{oe(n,n=>{se(e,t,n)})},ae=(e,t)=>{if(t.visibility===`registered`){let t=H();for(let[n,r]of e){let e=N().chainsByName.get(n)?.[0]?.commandState.attrs;for(let i of t.get(n)??[])r.push(G(i,e))}return}oe(t,n=>{W(e,n,t)})},oe=(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)}},se=(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(G(n,r.commandAttrs))}},W=(e,t,n)=>{if(typeof t.command!=`string`)return;let r=e.get(t.command);r&&r.push(G(t,ce(t,n)))},G=(e,t)=>({sequence:e.sequence,command:e.command,commandAttrs:t,attrs:e.attrs,event:e.event,preventDefault:e.preventDefault,fallthrough:e.fallthrough}),ce=(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)},le=(t,r,i)=>{let a=i?.mode??`active`,o=i?.execution??{input:t},s=Vw(t,e.commandResolvers.values(),()=>fe(r,a,o),e=>{n.emitError(`command-resolver-error`,e,`[Keymap] Error in command resolver for "${t}":`)}),c=s.resolved;if(c){let e=de(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=ue(c.command.name,r,a)??Ww(c.command);e&&(s.resolved={...c,attrs:e})}return s},ue=(e,t,n)=>n===`registered`?ee(e)?.commandState.attrs:M(t).reachableByName.get(e)?.commandState.attrs,de=(e,t,n)=>n===`registered`?ee(e):M(t).reachableByName.get(e),fe=(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 zw(e){return e.command}function Bw(e){let t=[],n=new Set;for(let r of e.commands)try{let i={},a=[],o=Cw(r.name),s=Hw(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,Aw({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,Mw(t,`Failed to register keymap command "${String(r.name)}"`));continue}return t}function Vw(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:Uw(t,o.getExecutionFields())}}return{hadError:i}}function Hw(e){let t={};for(let[n,r]of Object.entries(e))!yw.has(n)&&r!==void 0&&(t[n]=r);return Object.keys(t).length===0?Iw:t}function Uw(e,t){return{command:e,input:t.input,payload:t.payload}}function Ww(e){let t=Hw(e);return t===Iw?void 0:t}function Gw(e){let t=e.query?.namespace,n=Kw(e.query?.limit);if(n===0)return[];let r=e.query?.search?.trim().toLowerCase()??``,i=Fw;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(Jw(u,t)&&qw(u,r,i)&&!(c&&!c.has(u.command.name))&&Yw(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 Kw(e){if(e===void 0)return;let t=Math.floor(Number(e));return!Number.isFinite(t)||t<=0?0:t}function qw(e,t,n){if(!t)return!0;for(let r of n)if(Xw(e,r,t))return!0;return!1}function Jw(e,t){if(t===void 0)return!0;let n=e.fields;return Object.prototype.hasOwnProperty.call(n,`namespace`)?rT(n.namespace,t):!1}function Yw(e,t,n){if(!t)return!0;for(let[r,i]of t)if(!eT(e,r,i,n))return!1;return!0}function Xw(e,t,n){return Zw(e,t)?.includes(n)===!0}function Zw(e,t){let n=Lw.get(e);if(n||(n=new Map,Lw.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=Qw(a);return n.set(t,o),o}function Qw(e){if(Array.isArray(e)){let t=[];for(let n of e){let e=Qw(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 $w(e,t,n,r){try{return e(t,n)}catch(e){return r(e),!1}}function eT(e,t,n,r){return typeof n==`function`?tT(e,t,n,r):nT(e,t,n)}function tT(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,$w(n,i.name,l(),r.onFilterError))||Object.prototype.hasOwnProperty.call(a,t)&&(c=!0,$w(n,a[t],l(),r.onFilterError))||o&&Object.prototype.hasOwnProperty.call(o,t)&&(c=!0,$w(n,o[t],l(),r.onFilterError))?!0:!c&&$w(n,void 0,l(),r.onFilterError)}function nT(e,t,n){let r=e.command,i=e.fields,a=e.attrs;return t===`name`&&rT(r.name,n)||Object.prototype.hasOwnProperty.call(i,t)&&rT(i[t],n)?!0:!!a&&Object.prototype.hasOwnProperty.call(a,t)&&rT(a[t],n)}function rT(e,t){return Array.isArray(t)?t.some(t=>iT(e,t)):iT(e,t)}function iT(e,t){return Array.isArray(e)?e.some(e=>iT(e,t)):Object.is(e,t)}function aT(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(Nw(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(oT(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=Sw(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`&&(sT(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 sT(n,i),!0;return!1}}}function oT(e){return typeof e==`object`&&!!e&&`ok`in e}function sT(e,t){e.preventDefault&&(t.preventDefault(),t.stopPropagation())}var cT=Object.freeze({}),lT=[],uT=[];function dT(e){if(Object.keys(e).length!==0)return Pw(e,{freeze:!0})}function fT(e,t,n,r){let i=t=>vT(t,e.bindingParsers.values(),{tokens:e.tokens,patterns:e.patterns,layer:cT,parseObjectKey:(e,t)=>c(e,t)}),a=t=>{if(typeof t!=`string`)return[c(t)];let n=_T(t,e.bindingParsers.values(),{tokens:e.tokens,patterns:e.patterns,layer:cT,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)=>FC(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=hT(b.key,m,{layer:d})}catch(e){t.emitError(`binding-expand-error`,e,Mw(e,`Failed to expand keymap binding`));continue}for(let m of i){let i=m.key,x;try{x=typeof i==`string`?_T(i,h,{tokens:a,patterns:e.patterns,layer:d,parseObjectKey:(e,t)=>c(e,t)}):{parts:[c(i)],usedTokens:[],unknownTokens:[],hasTokenBindings:!1},x=gT(x,m)}catch(e){t.emitError(`binding-parse-error`,e,Mw(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`||bw.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,Aw({fieldName:e,conditions:n,requirements:c,matchers:d,attrs:u}))}let p=Object.keys(u).length>0?dT(u):void 0,m=Sw(i.cmd),h={binding:b,sequence:a,command:m,event:t,parsedBinding:iw(i),sourceTarget:o,sourceLayerOrder:s,bindingIndex:r,requires:Object.keys(c).length>0?Object.entries(c):lT,matchers:d.length>0?d:uT,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`&&!_&&mT(f,h),f.push(h)}catch(e){t.emitError(`binding-compile-error`,e,Mw(e,`Failed to compile keymap binding`))}}}return{bindings:f,hasTokenBindings:p}},c=(e,t)=>AC(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:jC(r)}];let l={...n,sequence:jC(r)},u=[],d=!0,f=o??cT;for(let n of s)try{n(l,{layer:f,parseKey:t=>vT(t,a,{tokens:i,patterns:e.patterns,layer:f,parseObjectKey:(e,t)=>c(e,t)}),add:e=>{u.push(iw(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 pT(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 mT(e,t){for(let n of e)if(n.event===`press`&&(n.command!==void 0&&pT(n.sequence,t.sequence)||t.command!==void 0&&pT(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 hT(e,t,n){if(typeof e!=`string`||t.length===0)return[{key:e}];let r=n?.layer??cT,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 gT(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 _T(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??cT,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:DC,createMatch:NC,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 vT(e,t,n){if(typeof e!=`string`)return n.parseObjectKey(e);let{parts:r}=_T(e,t,n),[i]=r;if(!i||r.length!==1)throw Error(`Invalid key "${String(e)}": expected a single key stroke`);return i}function yT(e){if(!e||typeof e!=`object`)return!1;let t=e;return typeof t.get==`function`&&typeof t.subscribe==`function`}function bT(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(yT(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 xT=Symbol(`keymap-disambiguation-decision`),ST=Symbol(`keymap-deferred-disambiguation-decision`);function CT(e,t){return{[xT]:!0,action:e,handler:t}}function wT(e){return{[ST]:!0,action:e}}function TT(e){return!!e&&typeof e==`object`&&e[xT]===!0}function ET(e){return!!e&&typeof e==`object`&&e[ST]===!0}function DT(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 OT(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 kT(e,t,n,r){let i=e.get(n)?.payloadKey??n;return{...AC({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 AT(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 jT(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&&G()}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:jC(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:jC(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?jC(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||G();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=pe(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=me(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=pe(e);if(n)return ee(n,i,e,t);let a=r.getActiveLayers(t),o=M();for(let n of i){let r=V(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=are(r,n,i,e.patterns,he,ge);t&&c.push(t)}let l=c.reduce((e,t)=>Math.min(e,JC(t,n)),1/0),u=c.filter(e=>JC(e,n)===l);if(u.length===0||!u.some(e=>be(e,a,o))){let e=O(`sequence-miss`,t.captures);return T(`sequence-clear`,t.captures,a),r.setPendingSequence(null),e}return B(u,0,!1,i,a)}function B(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=de(t,i,n);if(u.length>0){if(s)continue;let e=fe(t,n);return H(t,i,u,e,a,o,s)||P(`sequence-advance`,u,o,a)}if(!WC(n,e.patterns))continue;let d=fe(t,n);for(let e of d)l.add(e);let f=xe(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 V(e,t,n,r){return te(e,0,t,n,r)}function te(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=_e(n,r,a,o,c);if(u.length===0)continue;if(u.filter(t=>UC(t,e.patterns,!1)).length>0){let n=u.filter(t=>WC(t,e.patterns)),i=ue(t,s,r,a,o);return ne(t,s,r,i,n,a,o)||P(`sequence-start`,i,o,a)}let d=xe(n,u.filter(t=>WC(t,e.patterns)),a,o);if(l=A(l,d.outcome),d.handled&&d.stop)return l}return l}function ne(e,t,n,i,a,o,s){return U({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=xe(i,a,o,s);return c.stop?c.outcome:A(c.outcome,te(e,t+1,n,o,s))}})}function H(e,t,n,i,a,o,s){return U({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=xe(n,i,a,o);return c.stop?c.outcome:A(c.outcome,B(e,t+1,s||c.handled,a,o))}})}function U(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=ie({event:n,focused:i,getSequence:h,exactBindings:d,continuationCaptures:a,activeView:u});return g?re(g,a,l,f,p,i,h):(le(h()),f())}function re(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 ae(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 ie(i){let a,o,s,c,l={event:i.event,focused:i.focused,get sequence(){return a??=jC(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:kC(e.stroke)},c},get exact(){return o??=r.collectActiveBindings(i.exactBindings,i.focused,i.activeView).map(e=>({...e,sequence:jC(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:()=>CT(`run-exact`),continueSequence:()=>CT(`continue-sequence`),clear:()=>CT(`clear`),defer:e=>CT(`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(Nw(e)){t.emitError(`invalid-disambiguation-resolver-return`,e,`[Keymap] Disambiguation resolvers must return synchronously; use ctx.defer(...) for async handling`);continue}if(!TT(e)){t.emitError(`invalid-disambiguation-decision`,e,`[Keymap] Invalid disambiguation decision returned by resolver:`);continue}return e}}}function ae(e,t,n,r,i){G();let a=new AbortController,o={id:f++,controller:a,captures:e,apply:i};d=o,queueMicrotask(()=>{oe(o,t,n,r)})}function oe(e,n,r,i){if(!ce(e))return;let a={signal:e.controller.signal,sequence:jC(i),focused:r,sleep:t=>DT(t,e.controller.signal),runExact:()=>wT(`run-exact`),continueSequence:()=>wT(`continue-sequence`),clear:()=>wT(`clear`)},o;try{o=n(a)}catch(n){ce(e)&&(t.emitError(`deferred-disambiguation-error`,n,`[Keymap] Error in deferred disambiguation handler:`),W(e));return}if(Nw(o)){o.then(t=>{se(e,t)}).catch(n=>{ce(e)&&(t.emitError(`deferred-disambiguation-error`,n,`[Keymap] Error in deferred disambiguation handler:`),W(e))});return}se(e,o)}function se(e,n){if(ce(e)){if(n!==void 0&&!ET(n)){t.emitError(`invalid-deferred-disambiguation-decision`,n,`[Keymap] Invalid deferred disambiguation decision returned by handler:`),W(e);return}W(e),e.apply(n)}}function W(e){ce(e)&&(d=null)}function G(){let e=d;e&&(d=null,e.controller.abort())}function ce(e){return d===e}function le(e){let n=FC(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 ue(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 _e(n,r,a,o,l))UC(t,e.patterns,!1)&&c.push(t)}return c}function de(t,n,r){return t.filter((t,i)=>i>=n&&UC(t,e.patterns,!1)&&NT(t.parts,r.parts))}function fe(t,n){return t.filter(t=>t.layer===n.layer&&WC(t,e.patterns)&&NT(t.parts,n.parts))}function pe(n){let r=e.eventMatchResolvers.values();if(r.length===0)return[];if(r.length===1)return MT(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 me(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 he(n,r){return OT(e.patterns,t,n,r)}function ge(t,n,r){return kT(e.patterns,t,n,r)}function _e(e,t,n,r,i){let a=XC(e,t,n,he,ge);return a.some(e=>be(e,r,i))?a:[]}function ve(n){return AT(e.patterns,t,n)}function ye(e,t,n){return i.matchesConditions(e)&&s.isBindingVisible(e,t,n)}function be(e,t,n){return ye(e.binding,t,n)}function xe(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,ve(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 MT(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 NT(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 PT=()=>{};function FT(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 IT(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 LT(e,t,n,r,i){let a;try{a=DC(i.name)}catch(e){return t.emitError(`token-name-normalize-error`,e,Mw(e,`Failed to register keymap token`)),PT}if(e.tokens.has(a)||e.patterns.has(a))return t.emitError(`duplicate-token`,{token:a},`Keymap token "${a}" is already registered`),PT;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,Mw(e,`Failed to register keymap token "${a}"`)),PT}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,Mw(e,`Failed to register keymap token "${a}"`)),PT}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,Mw(e,`Failed to unregister keymap token "${a}"`))}}}function RT(e,t,n,r){let i,a;try{i=DC(r.name);let e=FT(i,`min`,r.min,1),t=FT(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:NC(`pattern:${i}`),min:e,max:t,matcher:e=>r.match(e),finalize:r.finalize}}catch(e){return t.emitError(`sequence-pattern-register-error`,e,Mw(e,`Failed to register keymap sequence pattern`)),PT}return e.tokens.has(i)||e.patterns.has(i)?(t.emitError(`duplicate-sequence-pattern`,{pattern:i},`Keymap sequence pattern "${i}" is already registered`),PT):(e.patterns.set(i,a),n.recompileBindings(),()=>{e.patterns.get(i)===a&&(e.patterns.delete(i),n.recompileBindings())})}function zT(e,t,n,r){return IT(r,{kind:n,reservedFields:n===`layer`?xw:n===`binding`?bw:yw,registeredFields:n===`layer`?e.layerFields:n===`binding`?e.bindingFields:e.commandFields,emitError:(e,n,r)=>t.emitError(e,n,r)})}var BT=()=>{};function VT(e,t){return t.priority-e.priority||t.order-e.order}function HT(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 UT(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 WT(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`),BT;let o,s,c,p,m,v,y;try{y=l(n),o=u(rw(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,Mw(e,`Failed to register keymap layer`)),BT}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 BT;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:KC(x.bindings,e.patterns),hasTokenBindings:x.hasTokenBindings,activeKeyCacheBlocked:!1,activeCommandViewCacheBlocked:!1};_(S),e.layers.add(S),e.sortedLayers=[...e.sortedLayers,S].sort(VT),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=>nw(e)});t&&(i=rw(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(xw.has(c)||l===void 0)continue;o[c]=Pw(l);let t=e.layerFields.get(c);if(!t){i.warnUnknownField(`layer`,c);continue}t(l,Aw({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?Pw(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=KC(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,Mw(e,`Failed to subscribe to reactive matcher from ${n.source}`))}},_=t=>{let n=HT(t),r=UT(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,Mw(e,`Failed to dispose reactive matcher from ${n.source}`))}n.dispose=void 0}};return{registerLayer:a,applyTokenState:o,recompileBindings:s,cleanup:c}}var GT=1e3;function KT(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>=GT){e.stateChangePending=!1,i(`state-change-feedback-loop`,{iterations:GT},`[Keymap] Possible infinite state listener feedback loop detected after ${GT} 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 qT(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 JT=Object.freeze({});function YT(){return{order:0,tokens:new Map,patterns:new Map,layerFields:new Map,layerBindingsTransformers:$C(),bindingExpanders:$C(),bindingParsers:$C(),bindingTransformers:$C(),bindingFields:new Map,commandTransformers:$C(),commandFields:new Map,eventMatchResolvers:$C(),disambiguationResolvers:$C(),keyHooks:ew(),keyAfterHooks:ew(),rawHooks:ew(),layers:new Set,sortedLayers:[],activeLayersCacheVersion:-1,activeLayersCacheFocused:void 0,activeLayersCache:[],activeKeyCacheBlockers:0,activeCommandViewCacheBlockers:0,commandResolvers:$C(),pending:null,data:{},dataVersion:0,readonlyDataVersion:-1,readonlyData:JT,cacheVersion:0,derivedVersion:0,stateChangeDepth:0,stateChangePending:!1,flushingStateChange:!1,usedWarningKeys:new Set}}function XT(e){return $ne(e)}var ZT=class{#e=YT();#t=!1;#n=new Map;#r=[];#i=ZC(()=>{});#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=ZC((e,t)=>{this.#o.reportListenerError(e,t)}),this.#o=KT(this.#e,this.#i,this.#a),this.#l=bT(this.#e,this.#o),this.#u=Rw(this.#e,this.#b,this.#o,this.#l,{onCommandResolversChanged:()=>{this.#s.ensureValidPendingSequence()}}),this.#s=vw(this.#e,this.#b,this.#a,this.#o,this.#l,this.#u,{onPendingSequenceChanged:(e,t)=>{this.#p?.handlePendingSequenceChange(e,t)}}),this.#c=qT(this.#e,this.#o,this.#s),this.#d=aT(this.#o,this.#c,this.#s,this.#u,{keymap:this,createCommandEvent:()=>this.#b.createCommandEvent()}),this.#f=fT(this.#e,this.#o,this.#l,{warnUnknownField:(e,t)=>{this.#C(e,t)},warnUnknownToken:(e,t)=>{this.#w(e,t)}}),this.#h=aw(this.#o,this.#u),this.#m=WT(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=jT(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()}))}[tre](){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?XT(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 zT(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 LT(this.#e,this.#o,this.#f,this.#m,e)}registerSequencePattern(e){return RT(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 zT(this.#e,this.#o,`binding`,e)}registerCommandFields(e){return zT(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)))}},QT=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(`.`)),$T=new Set([`ctrl`,`control`,`shift`,`meta`,`alt`,`option`,`super`,`hyper`]),eE=nE(QT),tE=nE($T);function nE(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 rE(e){return e>=65&&e<=90?e+32:e}function iE(e){return e>=48&&e<=57}function aE(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(rE(e.charCodeAt(n+r))!==t.charCodeAt(r))return!1;return!0}function oE(e,t,n){let r=t.charCodeAt(n);if(Number.isNaN(r))return;let i=e.get(rE(r));if(i){for(let e of i)if(aE(t,e,n))return e}}function sE(e,t,n,r,i){return e.parseObjectKey(t,{display:n,match:r,tokenName:i})}function cE(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 lE(e,t){let n=e.trim().toLowerCase();return t.parseObjectKey({name:n},{display:n})}function uE(e,t){let n=oE(eE,e,t);if(n)return n;if(rE(e.charCodeAt(t))!==102||!iE(e.charCodeAt(t+1)))return;let r=iE(e.charCodeAt(t+2))?t+3:t+2;return e.slice(t,r).toLowerCase()}function dE(e,t){return oE(tE,e,t)}function fE(e,t,n){let r=t,i=!1,a=!1,o=!1,s=!1,c=!1;for(;r<e.length;){let t=dE(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=uE(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 pE=e=>{let{input:t,index:n,tokens:r,normalizeTokenName:i}=e;if(n===0&&t.includes(`+`)&&/\s/.test(t))return{parts:[cE(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:[cE(a,e)],nextIndex:n+1};let s=i(t.slice(n+1,o)),c=r.get(s);return c?{parts:[sE(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:[cE(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=fE(t,n,e);if(o)return{parts:[o.part],nextIndex:o.nextIndex};let s=uE(t,n);return s?{parts:[lE(s,e)],nextIndex:n+s.length}:{parts:[cE(a,e)],nextIndex:n+1}},mE=(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 hE(e){return e.appendBindingParser(e=>pE(e))}function gE(e){return e.appendEventMatchResolver((e,t)=>mE(e,t))}function _E(e){let t=hE(e),n=gE(e);return()=>{n(),t()}}var vE=Symbol(`keymap:mod-bindings`),yE=/(^|[+,\s])mod(?=\s*\+)/i,bE=/(^|[+,\s])mod(?=\s*\+)/gi;function xE(e){let t=e.primaryModifier;return(t===`ctrl`||t===`super`)&&e.modifiers[t]!==`unsupported`?t:e.modifiers.ctrl===`unsupported`?`super`:`ctrl`}function SE(e){if(e.includes(`,`))return[e];let t=e.trim();return t.includes(` `)?t.split(/\s+/):[e]}function CE(e){return e.acquireResource(vE,()=>e.appendBindingExpander(({input:t,displays:n})=>{if(!yE.test(t))return;let r=xE(e.getHostMetadata());return[{key:t.replace(bE,(e,t)=>`${t}${r}`),displays:n??SE(t)}]}))}var wE=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 TE(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 EE(){let e=globalThis.navigator,t=e?.userAgentData?.platform,n=TE(t);return n===`unknown`?TE(e?.platform??e?.userAgent):n}function DE(){let e=EE();return{platform:e,primaryModifier:e===`macos`?`super`:e===`unknown`?`unknown`:`ctrl`,modifiers:{ctrl:`supported`,shift:`supported`,meta:`supported`,super:`supported`,hyper:`unsupported`}}}function OE(e){return e.length===1&&!/^[a-z0-9]$/i.test(e)}function kE(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||!OE(t.name)?[t]:[t,{...t,shift:!1}]}var AE=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 jE(){return globalThis.MutationObserver}function ME(e){return wE.get(e)||(/^F\d{1,2}$/i.test(e)||e.length===1?e.toLowerCase():e.trim().toLowerCase().replace(/\s+/g,``))}function NE(e){if(!e)return new AE(`command`,!1,!1,!1,!1);let t=globalThis.KeyboardEvent;return new AE(ME(e.key),e.ctrlKey,e.shiftKey,e.altKey,e.metaKey,t&&e instanceof t?e:void 0)}var PE=class{metadata=DE();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(NE(t))};return this.rootTarget.addEventListener(`keydown`,t,{capture:!0}),()=>{this.rootTarget.removeEventListener(`keydown`,t,{capture:!0})}}onKeyRelease(e){let t=t=>{e(NE(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 NE()}ensureObserver(){if(this.observer||this.targetDestroyListeners.size===0)return;let e=jE();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 FE(e){return new PE(e)}var IE=(e,t)=>kE(e).map(e=>t.resolveKey(e)),LE=`fungi.app.ready`,RE=`fungi.app.connect`,zE=e=>lb.pipe(J(Bb(1)),J(Ub(e))),BE=e=>ib(zE(e)),VE=ub.pipe(J(Rb()),J(wb(Number.isSafeInteger,{message:`Expected a safe integer`}))),HE=VE.pipe(J(Fb(0))),UE=VE.pipe(J(Pb(0))),WE=q({appId:zE(160),releaseId:zE(160),surfaceId:zE(160)}),GE=q({editing:db,surface:gb([zE(160),sb])}),KE=gb([q({kind:ab(`compose`),requestId:zE(160),text:zE(2e3)}),q({kind:ab(`navigate`),requestId:zE(160),params:mb(q({key:zE(64),value:zE(4096)})).pipe(J(Ub(16)))})]),qE=q({computerId:gb([zE(256),sb]),teamHasComputers:ib(vb(db)),computerAccessGranted:ib(db),focus:GE,openRequest:gb([sb,KE]),visibility:_b([`visible`,`hidden`])}),JE=_b([`connecting`,`connected`,`suspended`,`disconnected`,`disposing`,`disposed`]),YE=q({altKey:db,ctrlKey:db,id:zE(160),key:zE(64),metaKey:db,shiftKey:db}),XE=q({action:ib(ob),availability:ib(ob),category:zE(160),description:BE(512),id:zE(160),projections:ib(ob),title:zE(160)}),ZE=q({arguments:ib(ob),commandId:zE(321),origin:_b([`agent`,`browser`,`keyboard`,`menu`,`palette`,`programmatic`,`slash`,`terminal`]),requestId:zE(160)}),QE=gb([q({result:ib(ob),status:ab(`handled`)}),q({error:ob,status:ab(`failed`)})]),$E=e=>zE(e).pipe(J(wb(e=>{for(let t=0;t<e.length;t+=1)if(TC(e.charCodeAt(t)))return!1;return!0},{message:`Expected one line of plain text`}))),eD={id:zE(64),text:$E(80),end:rb(db)},tD=rb(ub.pipe(J(Rb()),J(Lb({minimum:0,maximum:9999})))),nD=mb(gb([q({...eD,kind:ab(`text`),tone:rb(_b([`neutral`,`success`,`warning`,`error`]))}),q({...eD,kind:ab(`button`),icon:rb(_b([`folder`,`ports`,`processes`,`access`])),count:tD,tone:rb(_b([`neutral`,`success`,`warning`,`error`])),busy:rb(db),title:rb($E(1024)),disabled:rb(db),opens:rb(ab(`dialog`)),expanded:rb(db)}),q({...eD,kind:ab(`toggle`),pressed:db}),q({...eD,kind:ab(`menu`),count:tD,title:rb($E(1024)),options:mb(q({id:zE(64),text:$E(80),checked:rb(db),disabled:rb(db)})).pipe(J(Ub(16)),J(wb(e=>new Set(e.map(e=>e.id)).size===e.length,{message:`Expected unique status option ids`})))})])).pipe(J(Ub(6)),J(wb(e=>new Set(e.map(e=>e.id)).size===e.length,{message:`Expected unique status item ids`}))),rD=q({computerId:zE(256),path:zE(1024)}),iD=zE(80).pipe(J(wb(e=>e.trim()===e,{message:`Expected a trimmed title`}))),aD=zE(64),oD=zE(80),sD=e=>new Set(e.map(e=>e.id)).size===e.length,cD=q({id:aD,label:oD,siblings:ib(mb(q({id:aD,label:oD})).pipe(J(Ub(16)),J(wb(sD,{message:`Expected unique crumb sibling ids`}))))}),lD=q({id:aD,label:oD,icon:ib(ab(`play`)),variant:ib(_b([`primary`,`outline`,`ghost`])),tone:ib(ab(`destructive`)),disabled:ib(db)}),uD=e=>mb(lD).pipe(J(Ub(e)),J(wb(sD,{message:`Expected unique header command ids`}))),dD={status:ib(mb(q({id:aD,label:oD,presentation:ib(ab(`bead`)),tone:ib(_b([`neutral`,`info`,`warning`,`success`,`error`]))})).pipe(J(Ub(4)),J(wb(sD,{message:`Expected unique header status ids`})))),crumbs:ib(mb(cD).pipe(J(Ub(8)),J(wb(sD,{message:`Expected unique crumb ids`})))),primary:ib(uD(3)),menu:ib(uD(12))},fD=q({contractVersion:ab(1),canGoBack:db,title:ib(iD),...dD}),pD=q({canGoBack:db,title:ib(lb),...dD}),mD=gb([q({kind:ab(`crumb`),crumbId:aD,siblingId:ib(aD)}),q({kind:ab(`action`),actionId:aD})]),hD=vb(q({agentId:zE(256),sessionId:zE(256)})),gD=q({agents:ib(mb(_b([`agent.list`,`agent.manage`,`agent.read`,`agent.send`])).pipe(J(Ub(4)))),computers:ib(mb(_b([`computer.list`,`computer.readFile`,`computer.writeFile`,`computer.execute`])).pipe(J(Ub(4))))}),_D=_b([`granted`,`declined`,`customize`]),vD=q({message:zE(512),tone:ib(_b([`info`,`success`,`warning`,`error`]))}),yD=_b(rx);q({code:yD.pick([`DELIVERY_PENDING`])});var bD=q({code:yD,message:zE(512),retryable:db}),xD=q({protocolVersion:ab(2),type:ab(LE)}),SD=q({epoch:zE(160),protocolVersion:ab(2),type:ab(RE)}),CD=q({epoch:zE(160),protocolVersion:ab(2)}),wD={[Symbol.dispose]:ib(ob)},TD=gb([q({...wD,ok:ab(!0),value:ob}),q({...wD,error:bD,ok:ab(!1)})]);function ED(e,t,n=`PROTOCOL`){return wc(eb(e,{onExcessProperty:`error`}),Dd({onFailure:e=>{throw new Y(`The peer sent malformed protocol data`,{cause:e,code:n,retryable:!1})},onSuccess:t}))}function DD(e){return Object.freeze(e)}function OD(e,t){let n=e.arguments===void 0?void 0:Jo(e.arguments),r={origin:e.origin,signal:t};return n!==void 0&&Object.assign(r,{arguments:n}),DD(r)}var kD=ED(XE,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}),DD(vO(()=>ss(t)))},`INVALID_ARGUMENT`),AD=ED(zE(321),e=>e),jD=ED(ZE,e=>{let t=e.arguments===void 0?void 0:Jo(e.arguments),n={commandId:e.commandId,origin:e.origin,requestId:e.requestId};return t!==void 0&&Object.assign(n,{arguments:t}),DD(n)}),MD=ED(gb([cb,ob]),e=>e===void 0?void 0:Jo(e)),ND=ED(SD,e=>DD(e));ED(CD,e=>DD(e));var PD=ED(qE,e=>{let t={computerId:e.computerId,focus:DD({...e.focus}),openRequest:e.openRequest===null?null:DD({...e.openRequest}),visibility:e.visibility};return e.teamHasComputers!==void 0&&(t.teamHasComputers=e.teamHasComputers),e.computerAccessGranted!==void 0&&(t.computerAccessGranted=e.computerAccessGranted),DD(t)}),FD=ED(bD,e=>DD({...e})),ID=ED(GE,e=>DD({...e}),`INVALID_ARGUMENT`),LD=ED(WE,e=>DD({...e})),RD=ED(JE,e=>e),zD=ED(nD,e=>DD(e.map(e=>e.kind===`menu`?DD({...e,options:DD(e.options.map(e=>DD(e)))}):DD(e))),`INVALID_ARGUMENT`),BD=ED(q({itemId:zE(64),optionId:rb(zE(64)),anchor:rb(q({start:ub.pipe(J(Lb({minimum:0,maximum:1e5}))),width:ub.pipe(J(Lb({minimum:0,maximum:1e5})))}))}),e=>DD(e.anchor===void 0?{...e}:{...e,anchor:DD({...e.anchor})}),`INVALID_ARGUMENT`),VD=ED(rD,e=>DD({...e}),`INVALID_ARGUMENT`);function HD(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}),DD(t)}function UD(e){let t={id:e.id,label:e.label};return e.siblings===void 0?DD(t):DD({...t,siblings:DD(e.siblings.map(e=>DD({...e})))})}function WD(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}),DD(t)}function GD(e){let t={canGoBack:e.canGoBack};return e.title!==void 0&&(t={...t,title:e.title}),e.crumbs!==void 0&&(t={...t,crumbs:DD(e.crumbs.map(UD))}),e.primary!==void 0&&(t={...t,primary:DD(e.primary.map(WD))}),e.menu!==void 0&&(t={...t,menu:DD(e.menu.map(WD))}),e.status!==void 0&&(t={...t,status:DD(e.status.map(HD))}),DD(t)}var KD=ED(fD,GD,`INVALID_ARGUMENT`),qD=ED(pD,e=>{let t=e.title?.trim();return JD({...GD({...e,title:t===void 0||t.length===0?void 0:t}),contractVersion:1})},`INVALID_ARGUMENT`),JD=ED(fD,e=>DD({...GD(e),contractVersion:1}),`INVALID_ARGUMENT`),YD=ED(mD,e=>e.kind===`action`?DD({...e}):DD(e.siblingId===void 0?{kind:e.kind,crumbId:e.crumbId}:e),`INVALID_ARGUMENT`),XD=ED(hD,e=>e===null?null:DD({...e}),`INVALID_ARGUMENT`),ZD=ED(gD,e=>DD({agents:DD([...new Set(e.agents??[])]),computers:DD([...new Set(e.computers??[])])}),`INVALID_ARGUMENT`);ED(xD,e=>DD(e));var QD=ED(zE(512),e=>e),$D=ED(vD,e=>DD({...e}),`INVALID_ARGUMENT`);ED(q({id:zE(160),repeat:db}),e=>DD(e));var eO=ED(mb(YE).pipe(J(Ub(64))),e=>{if(new Set(e.map(e=>e.id)).size!==e.length)throw new Y(`Reserved chords are invalid`,{code:`PROTOCOL`,retryable:!1});return DD(e.map(e=>DD({...e})))});function tO(e){return ED(q({value:ob,version:HE}),t=>DD({value:e(t.value),version:t.version}))}var nO=tO(PD),rO=ED(q({capabilities:mb(ob).pipe(J(Ub(128))),context:ob}),e=>DD({capabilities:DD(e.capabilities.map(e=>lO(e))),context:nO(e.context)})),iO=tO(RD),aO=tO(eO),oO=tO(QD),sO=wc(iO,e=>{if(e.value!==`connected`&&e.value!==`suspended`)throw new Y(`The host lifecycle is invalid`,{code:`PROTOCOL`,retryable:!1});return DD({value:e.value,version:e.version})});function cO(e){return ED(q({handle:ob,id:zE(160),version:UE}),t=>{if(!(t.handle instanceof CC)&&!(e&&t.handle instanceof wC))throw new Y(`A capability handle is invalid`,{code:`PROTOCOL`,retryable:!1});return DD({handle:t.handle,id:t.id,version:t.version})})}var lO=cO(!1),uO=cO(!0);function dO(e){let t=e?uO:lO;return ED(q({capabilities:mb(ob).pipe(J(Ub(128))),context:ob,identity:ob,lifecycle:ob,reservedChords:ob,theme:ob}),e=>DD({capabilities:DD(e.capabilities.map(e=>t(e))),context:nO(e.context),identity:LD(e.identity),lifecycle:sO(e.lifecycle),reservedChords:aO(e.reservedChords),theme:oO(e.theme)}))}var fO=dO(!1);dO(!0);function pO(e){return ED(TD,t=>t.ok?DD({ok:!0,value:e(t.value)}):DD({ok:!1,error:FD(t.error)}))}var mO=pO(fO),hO=pO(ED(q({commandId:zE(321)}),e=>DD(e)));pO(ED(QE,e=>{if(e.status===`failed`)return DD({status:`failed`,error:vO(()=>Xo(e.error))});let t=e.result===void 0?void 0:Jo(e.result);return DD(t===void 0?{status:`handled`}:{status:`handled`,result:t})}));var gO=pO(ED(cb,()=>void 0)),_O=pO(ED(_D,e=>e));pO(ED(db,e=>e)),pO(ED(db,e=>e));function vO(e){try{return e()}catch(e){throw new Y(`The command metadata is invalid`,{cause:e,code:`INVALID_ARGUMENT`,retryable:!1})}}var yO=gb([q({kind:ab(`saveFile`),name:zE(255).pipe(J(Db(/^[^\p{Cc}/\\]+$/u))),mime:zE(255),bytes:Zb}),q({kind:ab(`copyText`),text:lb})]);function bO(e){let t=eb(yO,{onExcessProperty:`error`})(e);if(wd(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 xO=pO(ED(gb([q({kind:ab(`saved`)}),q({kind:ab(`copied`)}),q({kind:ab(`refused`),reason:_b([`no-user-gesture`,`too-large`,`invalid-request`,`unavailable`,`denied`,`busy`])})]),e=>DD(e)));function SO(e){return e instanceof Y?{code:e.code,message:wO(e.message),retryable:e.retryable}:{code:`HOST_FAILURE`,message:`Host operation failed`,retryable:!1}}function CO(e){try{let t=FD(e);return new Y(t.message,{code:t.code,retryable:t.retryable})}catch(e){return new Y(`The host returned a malformed error`,{cause:e,code:`PROTOCOL`,retryable:!1})}}function wO(e){return e.trim().slice(0,512)||`Host operation failed`}var TO=e=>({ok:!0,value:e}),EO=e=>({error:SO(e),ok:!1});async function DO(e,t){let n,r=new Set;try{return n=await e,OO(t(n))}catch(e){throw kO(e)&&AO(e,r),e instanceof Y?e:new Y(`The remote operation failed`,{cause:e,code:`HOST_FAILURE`,retryable:!0})}finally{n!==e&&kO(n)&&AO(n,r)}}function OO(e){if(e.ok)return e.value;throw CO(e.error)}function kO(e){return Vc(e)&&Symbol.dispose in e&&Lc(e[Symbol.dispose])}function AO(e,t){if(!t.has(e)){t.add(e);try{e[Symbol.dispose]()}catch(e){console.warn(`RPC result disposal failed`,e)}}}function jO(){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 MO(e){let t=eO(e),n=new Set;return{get:()=>t,subscribe:e=>(n.add(e),()=>n.delete(e)),update:e=>{t=eO(e);for(let e of Array.from(n))try{e()}catch(e){console.warn(`Reserved chord subscriber failed`,e)}}}}function NO(e){let t=!0,n,r=e.window.document.querySelector(`html`);if(!r)return()=>{t=!1};let i=FE(r),a=new ZT(i);_E(a),CE(a),a.prependEventMatchResolver(IE);let o=FO(e.onBroken),s=zO(a,e.chords,e.remote,o),c=PO(e,o,()=>t,e=>{n=e},()=>n),l=i.onFocusChange(()=>{queueMicrotask(c)}),u=()=>{queueMicrotask(c)};e.window.addEventListener(`focus`,u),e.window.addEventListener(`blur`,u);let d=e.bindings,f=()=>IO(e.window.document,e.identity.surfaceId).editing,p=d===void 0?()=>void 0:LO(a,d,f),m=d===void 0?()=>void 0:d.subscribe(()=>{p(),p=LO(a,d,f)}),h=e.chords.subscribe(()=>{s(),s=zO(a,e.chords,e.remote,o)});return queueMicrotask(c),()=>{t&&(t=!1,l(),e.window.removeEventListener(`focus`,u),e.window.removeEventListener(`blur`,u),h(),s(),m(),p())}}function PO(e,t,n,r,i){return()=>{if(!n())return;let a=IO(e.window.document,e.identity.surfaceId),o=i();(a.editing!==o?.editing||a.surface!==o.surface)&&(r(a),t(()=>e.remote.reportFocus(a)))}}function FO(e){return t=>{try{DO(t(),gO).catch(t=>{jS(`browser-bridge.host-call`,t),e(t)})}catch(t){jS(`browser-bridge.host-call`,t),e(t)}}}function IO(e,t){let n=e.activeElement;return ID({editing:!!(n?.matches(`input, textarea, select, [contenteditable='true']`)===!0||n?.closest(`[contenteditable='true']`)),surface:e.hasFocus()?t:null})}function LO(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||RO(e.key)&&n())return!1;e.run()}})),priority:500})}function RO(e){return!/(?:^|\+)(?:ctrl|control|super|meta|cmd|alt|option|mod)\+/iu.test(e)}function zO(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:ME(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 BO(e){let t=t=>{if(t.defaultPrevented||t.isComposing)return;let n=UO(t,e.mac);n!==null&&(t.preventDefault(),n===`back`&&!t.repeat&&e.canGoBack()&&e.back())},n=t=>{let n=HO(t.button);if(n===null)return;let r=t.defaultPrevented;t.preventDefault(),t.type===`mouseup`&&n===`back`&&!r&&e.canGoBack()&&e.back()};e.window.addEventListener(`keydown`,t);for(let t of VO)e.window.addEventListener(t,n);return()=>{e.window.removeEventListener(`keydown`,t);for(let t of VO)e.window.removeEventListener(t,n)}}var VO=[`mousedown`,`mouseup`,`auxclick`];function HO(e){return e===3?`back`:e===4?`forward`:null}function UO(e,t){return e.shiftKey||e.ctrlKey?null:t?!e.metaKey||e.altKey?null:e.key===`[`?`back`:e.key===`]`?`forward`:WO(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 WO(e){return e instanceof HTMLElement?e.isContentEditable||e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement||e instanceof HTMLSelectElement:!1}function GO(){return!Rc(globalThis.navigator)&&/Mac|iPhone|iPad/u.test(globalThis.navigator.userAgent)}function KO(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 qO(e){let t=new Map,n=KO(0),r=!1,i=e=>{let t=new Map;try{for(let n of e){let e=lO(n),r=QO(e.id,e.version);if(t.has(r))throw YO(e.handle),new Y(`Duplicate capability grant`,{code:`PROTOCOL`,retryable:!1});t.set(r,e.handle)}}catch(e){for(let e of t.values())YO(e);throw e}return t};for(let[n,r]of i(e))t.set(n,r);let a=e=>{for(let t of e)YO(t)},o=e=>{if(r)throw new Y(`The app connection is disposed`,{code:`DISCONNECTED`,retryable:!0});let n=QO(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 Y(`The capability is not granted`,{code:`CAPABILITY_DENIED`,retryable:!1});try{return e.schema.parse(t)}catch(e){throw new Y(`The capability interface is malformed`,{cause:e,code:`PROTOCOL`,retryable:!1})}}}),replace(e){if(r)throw new Y(`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 JO=Ha().transform(e=>{let t=Ho(Object).safeParse(e);if(!t.success)return;let n=Object.create(t.data),r=tb(q({[Symbol.dispose]:ib(Sb(Function))}))(n);return{owner:t.data,dispose:r[Symbol.dispose]}});function YO(e){try{let t=JO.parse(e);if(t===void 0||ZO.has(t.owner))return;ZO.add(t.owner),t.dispose?.call(t.owner)}catch(e){console.warn(`RPC value disposal failed`,e)}}function XO(e){return{value:e,[Symbol.dispose](){YO(e)}}}var ZO=new WeakSet;function QO(e,t){return`${e}@${String(t)}`}var $O=class extends wC{#e=!0;#t;#n=new Map;constructor(e){super(),this.#t=e}cancel(e){try{return this.#n.get(AD(e))?.abort(),Promise.resolve(TO(void 0))}catch(e){return Promise.resolve(EO(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 Y(`The command is disposed`,{code:`DISCONNECTED`,retryable:!0});let t=jD(e);if(this.#n.has(t.requestId))throw new Y(`Duplicate command request`,{code:`PROTOCOL`,retryable:!1});if(this.#n.size>=64)throw new Y(`Too many command requests`,{code:`HOST_FAILURE`,retryable:!0});let n=new AbortController;this.#n.set(t.requestId,n);try{let e=MD(await this.#t(OD(t,n.signal)));return TO(e===void 0?{status:`handled`}:{status:`handled`,result:e})}finally{this.#n.delete(t.requestId)}}catch(e){if(e instanceof gs)try{return TO({status:`failed`,error:Xo({code:e.code,message:e.message,details:e.details})})}catch(e){return EO(e)}return EO(e)}}[Symbol.dispose](){this.dispose()}};function ek(e){let t=[];for(let n of e.values()){let{definition:e,handler:r}=n;if(n.commandId===void 0)continue;let i=e.availability?.status!==`unavailable`;for(let n of e.projections?.bindings?.values??[])n.trim().includes(` `)||n.startsWith(`<`)||t.push({key:n,run:()=>{i&&Promise.resolve().then(()=>r({origin:`keyboard`,signal:new AbortController().signal})).catch(e=>{console.warn(`App key command failed`,e)})}})}return t}function tk(e,t,n,r){let i=new Map,a=!1,o=()=>{r?.update(a?[]:ek(i))},s=e=>{try{n()}catch(t){console.warn(`App command failure callback failed`,t,e)}},c=e=>{try{DO(e(),gO).catch(e=>{s(e)})}catch(e){console.warn(`App command RPC supervision failed`,e),s(e)}};return{commands:rk(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 nk(e,t,n,r){let i=t.id;if(e.size>=128||e.has(i))throw r.dispose(),new Y(`Command registration is unavailable`,{code:`INVALID_ARGUMENT`,retryable:!1});let a={commandId:void 0,definition:t,handler:n,target:r};e.set(i,a);let o=!1;return{commit(e){o||(a.commandId=e)},release(){o||(o=!0,e.get(i)===a&&e.delete(i),r.dispose())},target:r}}function rk(e,t,n,r,i,a){return Object.freeze({async register(o,s){if(t(),!Lc(s))throw new Y(`Command handler must be a function`,{code:`INVALID_ARGUMENT`,retryable:!1});let c=kD(o),l=new $O(s),u=nk(n,c,s,l);try{let t=await ik(e,c,u.target);r()&&await ak(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 ik(e,t,n){return DO(e.registerCommand(t,n),hO)}async function ak(e,t,n){throw n.dispose(),await DO(e.unregisterCommand(t),gO),new Y(`The command controller is disposed`,{code:`DISCONNECTED`,retryable:!0})}var ok=Uy(e=>e instanceof CC),sk=class extends wC{#e=!1;#t;constructor(e){super(),this.#t=e}disconnect(e){try{if(this.#e)throw vk();let t=e===void 0?void 0:FD(e);return setTimeout(()=>this.#t.disconnect?.(t??Sk()),0),Promise.resolve(TO(void 0))}catch(e){return Promise.resolve(EO(e))}}async requestClose(){try{if(this.#e)throw vk();return TO(await(this.#t.beforeClose?.()??!0))}catch(e){return EO(e)}}async requestBack(){try{if(this.#e)throw vk();return TO(await(this.#t.back?.()??!1))}catch(e){return EO(e)}}async activateNavigation(e){try{if(this.#e)throw vk();let t=YD(e);return Xne(this.#t.navigation,t)?TO(await(this.#t.activate?.(t)??!1)):TO(!1)}catch(e){return EO(e)}}async activateStatus(e){try{if(this.#e)throw vk();let t=BD(e);return Yne(this.#t.statusItems,t)?TO(await(this.#t.statusAction?.(t)??!1)):TO(!1)}catch(e){return EO(e)}}[Symbol.dispose](){this.#e=!0}async updateContext(e){return this.#e?EO(vk()):this.#n(e,`context`,PD,e=>{this.#t.context.update(e)})}reconfigure(e){let t=[];try{if(this.#e)throw vk();let n=rO(e);if(n.context.version<=this.#t.versions.context)return Promise.resolve(TO(void 0));for(let e of n.capabilities)t.push({...e,handle:tb(ok)(e.handle).dup()});if(!this.#t.capabilities)throw vk();return this.#t.capabilities.replace(t),t=[],this.#t.versions.context=n.context.version,this.#t.context.update(n.context.value),Promise.resolve(TO(void 0))}catch(e){for(let e of t)YO(e.handle);return Promise.resolve(EO(e))}}updateLifecycle(e){try{if(this.#e)throw vk();let t=tO(RD)(e);if(t.version<=this.#t.versions.lifecycle)return Promise.resolve(TO(void 0));if(!Ck(this.#t.lifecycle.get(),t.value))throw new Y(`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(TO(void 0))}catch(e){return Promise.resolve(EO(e))}}async updateReservedChords(e){return this.#e?EO(vk()):this.#n(e,`chords`,eO,e=>{this.#t.chords.update(e)})}async updateTheme(e){return this.#e?EO(vk()):this.#n(e,`theme`,QD,e=>{this.#t.theme.update(e)})}#n(e,t,n,r){try{let i=tO(n)(e);return i.version>this.#t.versions[t]&&(this.#t.versions[t]=i.version,r(i.value)),Promise.resolve(TO(void 0))}catch(e){return Promise.resolve(EO(e))}}};async function ck(e){let t=fk(),n=new sk(t),r=Jne(e.port,n),i,a=dk(r);try{performance.mark(`fungi.app-open.agar-rpc-connect-start`);let o=await Promise.race([r.connect({epoch:e.epoch,protocolVersion:2}),a]);performance.mark(`fungi.app-open.agar-rpc-connect-ready`),i=o;let s=OO(mO(o));if(!e.isActive())throw uk();let c=pk({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 Tk(t,e,n,r,i)}}function lk(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 uk(){return new Y(`App connection was cancelled`,{code:`CANCELLED`,retryable:!1})}function dk(e){let t,n=new Promise((e,n)=>{t=n});return n.catch(e=>{jS(`app-session.rpc-disconnect`,e)}),e.onRpcBroken(()=>t?.(new Y(`The app host disconnected`,{code:`DISCONNECTED`,retryable:!0}))),n}function fk(){return{statusItems:[],navigation:{canGoBack:!1},bindings:jO(),chords:MO([]),context:KO({computerId:null,focus:{editing:!1,surface:null},openRequest:null,visibility:`hidden`}),lifecycle:KO(`connecting`),theme:KO(`default`),canGoBack:!1,versions:{chords:-1,context:-1,lifecycle:-1,theme:-1}}}function pk(e){let t=LD(e.bootstrap.identity),n=wk(e.bootstrap);lk(e.state,n);let r=qO(e.bootstrap.capabilities);return e.state.capabilities=r,hk(e,t,r)}function mk(e,t,n){return NO({bindings:e.state.bindings,chords:e.state.chords,identity:t,onBroken:e=>{n({code:`DISCONNECTED`,message:e instanceof Y?e.message:`The app host rejected a browser bridge operation`,retryable:!0})},remote:e.remote,window:e.options.window})}function hk(e,t,n){let r=!1,i=t=>{r||(r=!0,bk([()=>{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.activate=void 0,e.state.statusAction=void 0},()=>{n.disconnect()},()=>{e.target[Symbol.dispose]()},()=>{YO(e.bootstrapOwner)},()=>{YO(e.remote)},()=>{e.options.port.close()},()=>{e.state.lifecycle.update(`disposed`)},e.options.onDisposed],`app connection disposal`))},a=()=>{if(r)throw new Y(`The app connection is disposed`,{code:`DISCONNECTED`,retryable:!0})},o=tk(e.remote,a,()=>{i({code:`DISCONNECTED`,message:`The app host rejected a terminal command operation`,retryable:!0})},e.state.bindings),s=_k(e.remote,a,e.state),c=gk(e.state,e.remote,a),l=mk(e,t,i),u=BO({window:e.options.window,mac:GO(),canGoBack:()=>e.state.canGoBack&&e.state.back!==void 0,back:()=>{let t=e.state.back;t&&Promise.resolve().then(t).catch(e=>{jS(`app-window.back-input`,e)})}});return e.state.disconnect=i,e.remote.onRpcBroken(()=>{yk(i)}),xk({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 gk(e,t,n){let r=Object.freeze({async publish(r){n();let i=qD(r);e.canGoBack=i.canGoBack,e.navigation=KD(i),await DO(t.reportNavigation(i),gO)},onActivate(t){if(n(),e.activate!==void 0)throw new Y(`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))}},onBack(t){if(n(),e.back!==void 0)throw new Y(`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 Y(`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 _k(e,t,n){return Object.freeze({async requestComputerChoice(){t(),await DO(e.requestComputerChoice(),gO)},async requestBrowserAction(n){t();let r=bO(n);return r.kind===`refused`?r:await DO(e.requestBrowserAction(r),xO)},onStatusAction(e){if(t(),n.statusAction!==void 0)throw new Y(`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 DO(e.requestAppPermissions(ZD(n)),_O)},async openDesktopSettings(){t(),await DO(e.openDesktopSettings(),gO)},async openTeamBilling(){t(),await DO(e.openTeamBilling(),gO)},async openNavigation(n){t(),await DO(e.openNavigation(VD(n)),gO)},async reportStatus(r){t();let i=zD(r);n.statusItems=i,await DO(e.reportStatus(i),gO)},async reportAgentSessionSelection(n){t(),await DO(e.reportAgentSessionSelection(XD(n)),gO)},async showToast(n){t(),await DO(e.showToast($D(n)),gO)}})}function vk(){return new Y(`The app connection is disposed`,{code:`DISCONNECTED`,retryable:!0})}function yk(e){e({code:`DISCONNECTED`,message:`The app host disconnected`,retryable:!0})}function bk(e,t){for(let n of e)try{n()}catch(e){console.warn(`${t} cleanup failed`,e)}}function xk(e){return Object.freeze(e)}function Sk(){return{code:`DISCONNECTED`,message:`The app host disconnected`,retryable:!1}}function Ck(e,t){return e===t||e===`connected`&&t===`suspended`||e===`suspended`&&t===`connected`}function wk(e){let t=tO(PD)(e.context),n=tO(QD)(e.theme),r=tO(RD)(e.lifecycle),i=tO(eO)(e.reservedChords);if(r.value!==`connected`&&r.value!==`suspended`)throw new Y(`The bootstrap lifecycle is invalid`,{code:`PROTOCOL`,retryable:!1});return{chords:i,context:t,lifecycle:r,theme:n}}function Tk(e,t,n,r,i){throw bk([()=>{n[Symbol.dispose]()},()=>{i&&YO(i)},()=>{YO(r)},()=>{t.port.close()},t.onDisposed],`app connection rejection`),e instanceof Y?e:new Y(`Unable to establish the app RPC session`,{cause:e,code:`PROTOCOL`,retryable:!1})}var Ek=!1,Dk=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):(Ek=!0,this.#a())}#a(){return new Promise((e,t)=>{let n=(n,a)=>{this.#o(n,a,i,r,e,t)},r=()=>{n(kk())},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:2,type:LE},`*`)}catch(e){jS(`connect.notify-host`,e),n(Fk(e))}};this.#r=setInterval(a,200),this.#i=setTimeout(()=>{n(jk())},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(),Ek=!1,a(e??jk());return}i(t)}}#s(e,t,n){if(!Pk(e.data))return;if(performance.mark(`fungi.app-open.agar-connect-received`),e.source!==this.#e.parent||Mk(e.origin)===void 0){t(Nk());return}let r=Ik(e,t);if(!r)return;let i=e.ports.length===1?e.ports[0]:void 0;if(!i){t(Lk(`The app host did not transfer exactly one port`));return}this.#t=i,this.#c(),this.#e.removeEventListener(`message`,n),ck({epoch:r.epoch,isActive:()=>!this.#n,onDisposed:()=>{Ek=!1},port:i,window:this.#e}).then(e=>{performance.mark(`fungi.app-open.agar-root-ready`),t(void 0,e)},e=>{t(Ak(e))})}#c(){clearInterval(this.#r),clearTimeout(this.#i),this.#r=void 0,this.#i=void 0}#l(){if(this.options.signal?.aborted)return kk();if(Ek)return new Y(`An app connection is already live`,{code:`IDENTITY`,retryable:!1});if(Rc(globalThis.window)||this.#e.parent===this.#e)return new Y(`The app host is unavailable`,{code:`DISCONNECTED`,retryable:!0})}};function Ok(e){return new Dk(e).start()}function kk(){return new Y(`App connection was cancelled`,{code:`CANCELLED`,retryable:!1})}function Ak(e){return e instanceof Y?e:new Y(`Unable to connect to the app host`,{cause:e,code:`PROTOCOL`,retryable:!1})}function jk(){return new Y(`The app host disconnected`,{code:`DISCONNECTED`,retryable:!0})}function Mk(e){if(!URL.canParse(e))return;let t=new URL(e).origin;return t===e?t:void 0}function Nk(){return new Y(`The app connection identity is invalid`,{code:`IDENTITY`,retryable:!1})}var Pk=Zy(q({type:ab(RE)}));function Fk(e){return new Y(`Unable to notify the app host`,{cause:e,code:`DISCONNECTED`,retryable:!0})}function Ik(e,t){try{return ND(e.data)}catch(e){jS(`connect.decode-message`,e),t(e instanceof Y?e:new Y(`Malformed app connection`,{cause:e,code:`PROTOCOL`,retryable:!1}));return}}function Lk(e){return new Y(e,{code:`PROTOCOL`,retryable:!1})}function Rk(e,t,n){e.style.isolation=`isolate`;let r=(0,hne.createRoot)(e),i=new AbortController,a=e.ownerDocument.documentElement,o=dx(a),s,c,l,u=!1,d=e=>{let i=(0,K.createElement)(zk,{state:e,render:n});r.render(t.queryClient?(0,K.createElement)(hx,{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`):ux(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`}),Ok({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,ux(e.theme.get(),a),c=e.theme.subscribe(e=>{ux(e,a)}),d({app:e,status:`live`}))}).catch(e=>{i.signal.aborted&&e instanceof Y&&e.code===`CANCELLED`||(console.error(`${t.name} host connection failed`,e),f(),i.signal.aborted||d({app:null,status:`not-hosted`,error:e instanceof Y?e:new Y(`The App host is unavailable`,{cause:e,code:`HOST_FAILURE`,retryable:!0})}))})):d({app:null,status:`not-hosted`,error:new Y(`The App document has no window`,{code:`DISCONNECTED`,retryable:!1})}),()=>{i.signal.aborted||(i.abort(),r.unmount(),f())}}function zk({state:e,render:t}){return(0,K.useLayoutEffect)(()=>{performance.mark(`fungi.app-open.react-initial-commit`)},[]),(0,K.useLayoutEffect)(()=>{e.app&&performance.mark(`fungi.app-open.react-connected-commit`)},[e.app]),(0,K.createElement)(K.Fragment,null,e.status===`not-hosted`?(0,K.createElement)(`p`,{role:`alert`},`App host connection unavailable. Open this App through its host to try again.`):null,t(e))}function Bk(e){let t=(0,K.useCallback)(t=>e?.subscribe(t)??(()=>void 0),[e]),n=(0,K.useCallback)(()=>e?.get(),[e]);return(0,K.useSyncExternalStore)(t,n,n)}function Vk(e){return Bk(e?.context)??null}function Hk(e){return Vk(e)?.computerId??null}function Uk(e,t,n,r){let i=(0,K.useRef)(t);i.current=t;let a=(0,K.useRef)(n);a.current=n;let o=(0,K.useRef)(r);o.current=r;let s=JSON.stringify(t),c=n!==void 0;(0,K.useEffect)(()=>{e&&e.ui.reportStatus(i.current).catch(e=>{o.current?o.current(e):console.error(`Window status report failed`,e)})},[e,s]),(0,K.useEffect)(()=>{if(!(!e||!c))return e.ui.onStatusAction(e=>a.current?.(e)??!1)},[e,c]),(0,K.useEffect)(()=>()=>{e?.ui.reportStatus([]).catch(e=>{console.error(`Window status report failed`,e)})},[e])}function Wk(e,{sourceId:t,namespace:n},r){let i=(0,K.useMemo)(()=>vs(),[]),a=(0,K.useMemo)(r,[r]);return(0,K.useEffect)(()=>{let e=i.contribute({sourceId:t,namespace:n,commands:a});return()=>{e.dispose()}},[i,t,n,a]),(0,K.useEffect)(()=>e?pc(e.commands,a):void 0,[e,a]),i}var Gk=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 Kk(e,t,n){return new Gk(e,t,n)}function qk(e){let t=Xa(e),n=Ho(Object),r=Xa(Object.fromEntries(Object.keys(e).map(e=>[e,Ha().optional()])));return Ha().transform(e=>{let i=n.parse(e),a=Object.create(i),o=r.parse(a),s=Object.fromEntries(Object.entries(o).map(([e,t])=>[e,Ro().parse(t).bind(i)]));return{...t.parse(s),[Symbol.dispose](){YO(e)}}})}function Jk(e){return Ha().transform(t=>{try{return e.parse(t)}catch(e){throw e instanceof Y?e:new Y(`The capability returned malformed data`,{cause:e,code:`PROTOCOL`,retryable:!1})}finally{YO(t)}})}function Yk(e){return Ro({output:Io(Ha().transform(t=>{try{return e.parse(t)}catch(e){throw YO(t),e instanceof Y?e:new Y(`The capability returned a malformed result`,{cause:e,code:`PROTOCOL`,retryable:!1})}}))})}var Xk=Yk(Jk(Ka()));qk({fetch:Yk(Ho(Response)),close:Xk});var Zk=e=>crypto.getRandomValues(new Uint8Array(e)),Qk=(e,t,n)=>{let r=256-256%e.length;if(r===256){let r=e.length-1;return(i=t)=>{if(!i)return``;let a=``;for(;;){let t=n(i),o=i;for(;o--;)if(a+=e[t[o]&r],a.length>=i)return a}}}let i=Math.ceil(409.6*t/r);return(a=t)=>{if(!a)return``;let o=``;for(;;){let t=n(i),s=i;for(;s--;)if(t[s]<r&&(o+=e[t[s]%e.length],o.length>=a))return o}}},$k=(e,t=21)=>Qk(e,t|0,Zk),eA=`abcdefghijklmnopqrstuvwxyz0123456789`;function tA(e=21){if(e===1/0||e===-1/0)throw RangeError(`nanoid length must be finite`);return $k(eA,e)()}var nA=`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(`.`),rA=`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 iA(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 aA(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=[iA(nA)];for(let e=1;e<t;e++)r.push(iA(rA));return r.join(n)}var oA=p(`ZodMiniType`,(e,t)=>{if(!e._zod)throw Error(`Uninitialized schema in ZodMiniType.`);Dt.init(e,t),e.def=t,e.type=t.type,e.parse=(t,n)=>he(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>ye(e,t,n),e.parseAsync=async(t,n)=>_e(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>xe(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)}),sA=p(`ZodMiniObject`,(e,t)=>{hn.init(e,t),oA.init(e,t),T(e,`shape`,()=>t.shape)});function cA(e,t){return new sA({type:`object`,shape:e??{},...R(t)})}var lA=p(`ZodMiniLiteral`,(e,t)=>{kn.init(e,t),oA.init(e,t)});function uA(e,t){return new lA({type:`literal`,values:Array.isArray(e)?e:[e],...R(t)})}function dA(e){return e instanceof Y?e:new Y(`App operation failed`,{cause:e,code:`HOST_FAILURE`,retryable:!1})}var fA=new WeakMap,pA={of(e,...t){return[e?.identity.surfaceId??null,e?.context.get().computerId??null,...t]}};function mA(e){let t={};return e&&fA.set(t,e),t}function hA(){let e=new ine({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&&fA.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 gA(e,t,n,r){let i=e?.context.get().computerId;return cne({queryKey:n,meta:mA(e),enabled:e!==null,retry:!1,queryFn:async({signal:n})=>{try{if(!e)throw new Y(`No App connection`,{code:`DISCONNECTED`,retryable:!0});if(e.context.get().computerId!==i)throw new Y(`The selected Computer changed`,{code:`SELECTION_CHANGED`,retryable:!1});return await r(e.capabilities.require(t),n)}catch(e){throw dA(e)}}})}function _A(e){return dne({mutationKey:e.queryKey,scope:{id:Ox(e.queryKey)},mutationFn:async(t,n)=>{try{return await e.mutationFn(t,n)}catch(e){throw dA(e)}},onMutate:async(t,{client:n})=>{if(n.isMutating({mutationKey:e.queryKey,exact:!0})>1)return;await n.cancelQueries({queryKey:e.queryKey,exact:!0});let r=n.getQueryData(e.queryKey);if(r!==void 0)return n.setQueryData(e.queryKey,e.apply(r,t)),{previous:r,optimistic:n.getQueryData(e.queryKey)}},onError:(t,n,r,{client:i})=>{r&&i.getQueryData(e.queryKey)===r.optimistic&&i.setQueryData(e.queryKey,r.previous)},onSettled:(t,n,r,i,{client:a})=>a.invalidateQueries({queryKey:e.queryKey,exact:!0})})}var vA=Kk(`app.backend`,1,Po(()=>qk({request:Yk(Jk(Ha().transform(e=>Jo(e))))}))),yA=Kk(`app.methods`,1,Po(()=>qk({call:Yk(Jk(Ha().transform(e=>Jo(e))))}))),bA=lo({png:`png`,jpeg:`jpeg`,webp:`webp`}),xA=lo({draft:`draft`,balanced:`balanced`,premium:`premium`,max:`max`}),SA=Po(()=>Za({transport:lo({json:`json`,multipart:`multipart`}),dimensions:lo({none:`none`,own:`own`}),maxDimension:Pa().int().positive().nullable(),maxDimensionDocumented:Ra(),defaultWidth:Pa().int().positive(),defaultHeight:Pa().int().positive(),steps:lo({steps:`steps`,num_steps:`num_steps`,fixed:`fixed`}),maxSteps:Pa().int().positive().nullable(),defaultSteps:Pa().int().nonnegative().nullable(),referenceField:da().min(1).max(256).nullable(),maxReferences:Pa().int().nonnegative()}).readonly()),CA=lo({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`}),wA=lo({p480:`480p`,p720:`720p`,p768:`768p`,p1080:`1080p`,p4k:`4k`}),TA=lo({wide:`16:9`,landscape:`4:3`,square:`1:1`,portrait:`3:4`,tall:`9:16`,ultrawide:`21:9`,ultratall:`9:21`}),EA=lo({first:`first-frame`,last:`last-frame`,reference:`reference`}),DA=Po(()=>Za({resolution:wA,aspectRatio:TA,width:Pa().int().positive(),height:Pa().int().positive()}).readonly()),OA=Po(()=>Za({minSeconds:Pa().int().positive(),maxSeconds:Pa().int().positive(),defaultSeconds:Pa().int().positive(),durations:Ja(Pa().int().positive()).readonly(),provider:lo({seedance:`seedance`,veo:`veo`,minimax:`minimax`}),formats:Ja(DA).readonly(),defaultResolution:wA,defaultAspectRatio:TA,supportsAudio:Ra(),defaultGenerateAudio:Ra().nullable(),referenceRoles:Ja(EA).readonly(),maxReferenceImages:Pa().int().nonnegative(),referenceResolutions:Ja(wA).readonly(),prices:Ja(Za({resolution:wA,silentMilliunitsPerSecond:Pa().int().positive(),audioMilliunitsPerSecond:Pa().int().positive()}).readonly()).readonly()}).readonly()),kA=32e3,AA=2048;Za({id:da().min(1).max(256),label:da().min(1).max(512),kind:lo({image:`image`,video:`video`}),tier:xA,outputFormats:Ja(bA).max(3).readonly(),maxPromptLength:Pa().int().positive().max(kA),input:SA,sizes:Ja(da().regex(/^\d+x\d+$/u)).readonly().nullable(),video:OA.nullable()}).readonly();var jA=e=>Object.freeze({kind:`image`,sizes:null,video:null,outputFormats:Object.freeze([]),...e,input:Object.freeze(e.input)}),MA={"480p":480,"720p":720,"768p":768,"1080p":1080,"4k":2160},NA={"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]};function PA(e,t,n,r,i){let a=r===`seedance`,o=a?TA.options:[TA.enum.wide,TA.enum.tall,TA.enum.square],s=Object.freeze(i.flatMap(([e])=>o.map(t=>{let[n,r]=NA[t],i=MA[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})}))),c=Object.freeze(a?[4,5,6,7,8,9,10,11,12]:[4,6,8]),l=Object.freeze({minSeconds:4,maxSeconds:a?12:8,defaultSeconds:a?5:6,durations:c,provider:r,formats:s,defaultResolution:`720p`,defaultAspectRatio:`16:9`,supportsAudio:!0,defaultGenerateAudio:!a||null,referenceRoles:Object.freeze(a?EA.options:[EA.enum.first]),maxReferenceImages:a?4:0,referenceResolutions:Object.freeze(a?i.map(([e])=>e).filter(e=>e!==`1080p`):[]),prices:Object.freeze(i.map(([e,t,n])=>Object.freeze({resolution:e,silentMilliunitsPerSecond:t,audioMilliunitsPerSecond:n})))});return jA({id:e,label:t,tier:n,maxPromptLength:a?2e3:AA,kind:`video`,video:l,sizes:Object.freeze(s.map(({width:e,height:t})=>`${String(e)}x${String(t)}`)),input:{transport:`json`,dimensions:`own`,maxDimension:Math.max(...s.map(({width:e,height:t})=>Math.max(e,t))),maxDimensionDocumented:!1,defaultWidth:1280,defaultHeight:720,steps:`fixed`,maxSteps:null,defaultSteps:null,referenceField:a?`image`:`image_input`,maxReferences:a?4:1}})}function FA(){let e=[`480p`,`768p`],t=[TA.enum.wide,TA.enum.landscape,TA.enum.square,TA.enum.portrait,TA.enum.tall,TA.enum.ultrawide],n=Object.freeze(e.flatMap(e=>t.map(t=>{let[n,r]=NA[t],i=MA[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=wA.enum.p768,i=TA.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([EA.enum.first,EA.enum.reference]),maxReferenceImages:4,referenceResolutions:Object.freeze(e),prices:Object.freeze([{resolution:wA.enum.p480,silentMilliunitsPerSecond:5e3,audioMilliunitsPerSecond:5e3},{resolution:wA.enum.p768,silentMilliunitsPerSecond:8e3,audioMilliunitsPerSecond:8e3}])});return jA({id:CA.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,referenceField:`image_url`,maxReferences:4}})}Object.freeze([jA({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,referenceField:null,maxReferences:0}}),jA({id:`@cf/black-forest-labs/flux-2-klein-4b`,maxPromptLength:AA,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,referenceField:`input_image_`,maxReferences:4}}),jA({id:`@cf/black-forest-labs/flux-2-klein-9b`,maxPromptLength:AA,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,referenceField:`input_image_`,maxReferences:4}}),jA({id:`@cf/black-forest-labs/flux-2-dev`,maxPromptLength:AA,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,referenceField:`input_image_`,maxReferences:4}}),jA({id:`@cf/leonardo/lucid-origin`,maxPromptLength:AA,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,referenceField:null,maxReferences:0}}),jA({id:`@cf/leonardo/phoenix-1.0`,maxPromptLength:AA,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,referenceField:null,maxReferences:0}}),jA({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:Object.freeze([`1024x1024`,`1024x1536`,`1536x1024`]),input:{transport:`json`,dimensions:`own`,maxDimension:1536,maxDimensionDocumented:!1,defaultWidth:1024,defaultHeight:1024,steps:`fixed`,maxSteps:null,defaultSteps:null,referenceField:`images`,maxReferences:16}}),PA(CA.enum.seedance,`Seedance 2.0`,`balanced`,`seedance`,[[`480p`,7e3,7e3],[`720p`,15e3,15e3],[`1080p`,37e3,37e3],[`4k`,78e3,78e3]]),PA(CA.enum.seedanceFast,`Seedance 2.0 Fast`,`draft`,`seedance`,[[`480p`,6e3,6e3],[`720p`,12e3,12e3]]),PA(CA.enum.seedanceMini,`Seedance 2.0 Mini`,`draft`,`seedance`,[[`480p`,4e3,4e3],[`720p`,9e3,9e3]]),PA(CA.enum.veo,`Veo 3.1`,`premium`,`veo`,[[`720p`,2e4,4e4],[`1080p`,2e4,4e4]]),PA(CA.enum.veoFast,`Veo 3.1 Fast`,`balanced`,`veo`,[[`720p`,8e3,1e4],[`1080p`,1e4,12e3]]),FA()]);var IA=e=>da().min(1).max(e),LA=Pa().int().min(-(2**53-1)).max(2**53-1),RA=LA.positive(),zA=LA.nonnegative(),BA=Za({printId:IA(256),computerId:IA(256),kind:lo([`image`,`video`]),prompt:IA(kA),model:IA(256),width:RA.nullable(),height:RA.nullable(),steps:zA.nullable(),durationSeconds:zA.nullable(),format:IA(32),bytes:RA,costMilliunits:zA,actorKind:lo([`member`,`agent`]),actorId:IA(256),derivedFrom:IA(256).nullable(),createdAt:zA,source:lo([`recorded`,`file`]),schemaVersion:RA}),VA=Xa({printId:BA.shape.printId,path:da().startsWith(`/`).min(2).max(4096)});function HA(e,t){let n=e?.app??null,r=Vk(n),i=r?.openRequest,a=r?.computerId,o=i?.kind===`navigate`?i.params.find(e=>e.key===`print`):void 0,s=BA.shape.printId.safeParse(o?.value),c=s.success?s.data:null,l=i?.kind===`navigate`?i.requestId:null,u=(0,K.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=ES({...gA(n,yA,pA.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=VA.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(yA)),retry:!1,staleTime:1/0}),p=(0,K.useRef)(t);p.current=t;let m=(0,K.useRef)(void 0);return(0,K.useEffect)(()=>{let t=f.data;!e||!t||m.current===t||e.app.context.get().computerId!==t.computerId||(m.current=t,p.current(t.path,`add`,e,t.computerId))},[e,f.data]),{target:f.data??null,error:f.error}}q({operation:ab(`read-library`),computerId:Gb});var UA=lb.pipe(J(Ub(4096)),J(wb(e=>e.startsWith(`/`)&&e!==`/`&&!e.includes(`\0`)&&!e.endsWith(`/`)&&!e.split(`/`).some(e=>e===`.`||e===`..`))));q({path:vb(UA)});var WA=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},GA=(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}),KA=class extends Y{stage;provider;constructor(e){super(e.message,{code:e.code,retryable:e.retryable}),this.stage=e.stage??null,this.provider=e.provider}},qA=e=>lb.pipe(J(Bb(1)),J(Ub(e))),JA=q({requestId:qA(256),computerId:qA(256)}),YA=ub.pipe(J(Rb()),J(wb(Number.isSafeInteger,{message:`Expected a safe integer`}))),XA=YA.pipe(J(Pb(0))),ZA=YA.pipe(J(Fb(0))),QA=_b([`first-frame`,`last-frame`,`reference`]),$A=_b([`480p`,`720p`,`768p`,`1080p`,`4k`]),ej=_b([`16:9`,`4:3`,`1:1`,`3:4`,`9:16`,`21:9`,`9:21`]),tj=q({computerId:ib(qA(256)),path:qA(4096),role:ib(QA)}),nj=q({path:qA(4096),role:QA}),rj=q({computerId:qA(256),path:qA(4096)}),ij=q({defaultHeight:XA,defaultSteps:vb(ZA),defaultWidth:XA,dimensions:_b([`none`,`own`]),maxDimension:vb(XA),maxDimensionDocumented:db,maxReferences:ZA,maxSteps:vb(XA),referenceField:vb(qA(256)),steps:_b([`steps`,`num_steps`,`fixed`]),transport:_b([`json`,`multipart`])}),aj=q({minSeconds:XA,maxSeconds:XA,defaultSeconds:XA,durations:mb(XA),provider:_b([`seedance`,`veo`,`minimax`]),formats:mb(q({resolution:$A,aspectRatio:ej,width:XA,height:XA})),defaultResolution:$A,defaultAspectRatio:ej,supportsAudio:db,defaultGenerateAudio:vb(db),referenceRoles:mb(QA),maxReferenceImages:ZA,referenceResolutions:mb($A),prices:mb(q({resolution:$A,silentMilliunitsPerSecond:XA,audioMilliunitsPerSecond:XA}))}),oj=mb(q({id:qA(256),input:ij,kind:_b([`image`,`video`]),label:qA(512),maxPromptLength:XA,tier:_b([`draft`,`balanced`,`premium`,`max`]),outputFormats:mb(_b([`png`,`jpeg`,`webp`])).pipe(J(Ub(3))),sizes:vb(mb(lb.pipe(J(Db(/^\d+x\d+$/u))))),video:vb(aj)})),sj=q({[Symbol.dispose]:ib(ob),computerId:qA(256),models:oj,canGenerate:db}),cj=q({model:qA(256),prompt:qA(2048),width:XA.pipe(J(Ib(5040))),height:XA.pipe(J(Ib(5040))),steps:ib(XA),durationSeconds:ib(XA),resolution:ib($A),aspectRatio:ib(ej),generateAudio:ib(db),references:ib(mb(tj).pipe(J(Ub(16))))});q({model:qA(256),prompt:qA(2048),resolution:ib($A),aspectRatio:ib(ej),durationSeconds:ib(XA.pipe(J(Fb(4)),J(Ib(15)))),generateAudio:ib(db),references:ib(mb(nj).pipe(J(Ub(4))))});var lj=[`admission`,`generation-authorization`,`settings`,`estimate`,`billing`,`operation`,`provider`,`normalization`,`artifact`,`destination-authorization`,`destination-write`],uj=q({destination:q({path:qA(4096)}),settings:ob}),dj=q({[Symbol.dispose]:ib(ob),bytes:XA,costMilliunits:ZA,destination:rj,format:_b([`png`,`jpeg`,`gif`,`webp`,`mp4`]),height:XA,model:qA(256),width:XA});q({...dj.fields,format:ab(`mp4`)});var fj=q({message:qA(512),stage:ib(_b(lj)),provider:ib(nx),code:_b([`CANCELLED`,`CAPABILITY_DENIED`,`CAPABILITY_REVOKED`,`DISCONNECTED`,`HOST_FAILURE`,`IDENTITY`,`INSUFFICIENT_CREDIT`,`INVALID_ARGUMENT`,`MEDIA_PROVIDER_FAILURE`,`MEDIA_PROVIDER_FAILURE_UNCHARGED`,`PROTOCOL`,`SAFETY_FILTER_REFUSED`,`TIMEOUT`]),retryable:db}),pj=gb([q({[Symbol.dispose]:ib(ob),kind:ab(`succeeded`),result:dj}),q({[Symbol.dispose]:ib(ob),kind:ab(`failed`),failure:fj})]),mj=qk({reference:Yk(Jk(Ha().transform(e=>tb(JA)(e)))),generate:Yk(Jk(Ha().transform(e=>{let t=tb(pj,{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,height:t.result.height,model:t.result.model,width:t.result.width}}:{kind:t.kind,failure:t.failure}})))}),hj=Kk(`media.generation`,5,Po(()=>qk({describe:Yk(Jk(Ha().transform(e=>{let{computerId:t,canGenerate:n,models:r}=tb(sj,{onExcessProperty:`error`})(e);return{computerId:t,canGenerate:n,models:r}}))),createAttempt:Yk(mj),restoreAttempt:Yk(mj),cancelAttempt:Xk})));function gj(e,t){try{return tb(e,{onExcessProperty:`error`})(t)}catch(e){throw new Y(`The Media capability returned malformed data`,{cause:e,code:`PROTOCOL`,retryable:!1})}}function _j(e){return e instanceof Y?e:new Y(`The Media capability failed`,{cause:e,code:`HOST_FAILURE`,retryable:!0})}function vj(e){if(e?.aborted)throw new Y(`Media generation was cancelled`,{code:`CANCELLED`,retryable:!1})}function yj(e){let t;try{t=tb(uj,{onExcessProperty:`error`})(e)}catch(e){throw new Y(`Media generation input is invalid`,{cause:e,code:`INVALID_ARGUMENT`,retryable:!1})}let n;try{n=bj(tb(cj,{onExcessProperty:`error`})(t.settings))}catch(e){throw new Y(`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 Y(`Media generation destination is invalid`,{code:`INVALID_ARGUMENT`,retryable:!1});return Object.freeze({destination:Object.freeze(r),settings:n})}function bj(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`),width:e.width,height:e.height};return e.steps!==void 0&&(n.steps=e.steps),e.durationSeconds!==void 0&&(n.durationSeconds=e.durationSeconds),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 xj(e){let t=gj(oj,e),n=new Set;for(let e of t){if(n.has(e.id))throw new Y(`The Media capability repeated a model`,{code:`PROTOCOL`,retryable:!1});n.add(e.id)}return Object.freeze(t.map(e=>Object.freeze(e)))}function Sj(e,t,n){let r=gj(dj,e);if(r.model!==t.settings.model||r.destination.computerId!==n||r.destination.path!==t.destination.path||r.width!==t.settings.width||r.height!==t.settings.height)throw new Y(`The Media capability returned an unrelated result`,{code:`PROTOCOL`,retryable:!1});return Object.freeze({bytes:r.bytes,costMilliunits:r.costMilliunits,destination:Object.freeze({...r.destination}),format:r.format,height:r.height,model:r.model,width:r.width})}async function Cj(e){try{let t=e.require(hj);{let e={stack:[],error:void 0,hasError:!1};try{let n=gj(sj,WA(e,XO(await t.describe()),!1).value),r=n.computerId.trim();if(r.length===0)throw new Y(`The Media capability returned no Computer`,{code:`PROTOCOL`,retryable:!1});let i=xj(n.models),a=async e=>{let n=XO(e),i;try{{let t={stack:[],error:void 0,hasError:!1};try{let n=WA(t,XO(await e.reference()),!1),a=gj(q({...JA.fields,[Symbol.dispose]:ib(ob)}),n.value);if(i={requestId:a.requestId,computerId:a.computerId},i.computerId!==r)throw new Y(`Media attempt belongs to another Computer`,{code:`IDENTITY`,retryable:!1})}catch(e){t.error=e,t.hasError=!0}finally{GA(t)}}}catch(e){throw n[Symbol.dispose](),_j(e)}let a=!1;return{reference:Object.freeze(i),async generate(n,o={}){if(a)throw new Y(`Media generation attempt is closed`,{code:`CAPABILITY_DENIED`,retryable:!1});vj(o.signal);let s=yj(n),c=o.signal,l,u,d=()=>(u??=t.cancelAttempt(i),u);try{let t=e.generate(s),n=c===void 0?await t:await Promise.race([t,new Promise((e,t)=>{l=()=>{d().then(()=>{t(new Y(`Media generation was cancelled`,{code:`CANCELLED`,retryable:!1}))},t)},c.addEventListener(`abort`,l,{once:!0}),c.aborted&&l()})]);c?.aborted&&(await d(),vj(c)),vj(c);{let e={stack:[],error:void 0,hasError:!1};try{let t=gj(pj,WA(e,XO(n),!1).value);if(t.kind===`failed`)throw new KA(t.failure);return Sj(t.result,s,r)}catch(t){e.error=t,e.hasError=!0}finally{GA(e)}}}catch(e){throw c?.aborted&&(await d(),vj(c)),_j(e)}finally{l!==void 0&&c?.removeEventListener(`abort`,l)}},[Symbol.dispose](){a||(a=!0,n[Symbol.dispose]())}}};return Object.freeze({computerId:r,canGenerate:n.canGenerate,models:i,async createAttempt(){return a(await t.createAttempt())},async restoreAttempt(e){let n=gj(JA,e);if(n.computerId!==r)throw new Y(`Select the original Computer to retry this generation`,{code:`IDENTITY`,retryable:!1});let i=await a(await t.restoreAttempt(n));if(i.reference.requestId!==n.requestId)throw i[Symbol.dispose](),new Y(`Media restore changed the request identity`,{code:`PROTOCOL`,retryable:!1});return i}})}catch(t){e.error=t,e.hasError=!0}finally{GA(e)}}}catch(e){throw _j(e)}}var wj=Gb,Tj=mb(Gb.pipe(J(Ub(1024)))).pipe(J(Ub(200)));gb([q({operation:ab(`read-notices`),computerId:wj}),q({operation:ab(`dismiss-notices`),computerId:wj,keys:Tj})]);var Ej=q({keys:Tj});async function Dj(e,t){return tb(Ej)(await e.require(vA).request(JSON.stringify(t)))}gb([q({operation:ab(`read-folder`),computerId:wj}),q({operation:ab(`select-folder`),computerId:wj,path:UA})]);var Oj=q({path:UA,configured:db});async function kj(e,t){return tb(Oj)(await e.require(vA).request(JSON.stringify(t)))}var Aj=2048,jj=8e3,Mj=[{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})),Nj=lb.pipe(J(Bb(1)),J(Ub(64))),Pj=lb.pipe(J(Bb(1)),J(Ub(jj))),Fj=Gb,Ij=q({id:zb,name:Nj,text:Pj,builtIn:db});gb([q({operation:ab(`list-styles`),computerId:Fj}),q({operation:ab(`save-style`),computerId:Fj,id:ib(zb),name:Nj,text:Pj}),q({operation:ab(`delete-style`),computerId:Fj,id:zb}),q({operation:ab(`read-print-style`),computerId:Fj,path:Gb})]);var Lj=q({styles:mb(Ij).pipe(J(Ub(50+Mj.length)))}),Rj=q({style:vb(Nj)});function zj(e,t){let n=t.trim();return e===void 0?n:`${e.trim()}\n\n${n}`}function Bj(e){return e?.maxPromptLength??Aj}function Vj(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 Hj=e=>e.require(vA),Uj=e=>JSON.stringify(e),Wj=tb(Lj);async function Gj(e,t){return Wj(await Hj(e).request(Uj({operation:`list-styles`,computerId:t})))}async function Kj(e,t,n){return Wj(await Hj(e).request(Uj({operation:`save-style`,computerId:t,id:n.id,name:n.name,text:n.text})))}async function qj(e,t,n){return Wj(await Hj(e).request(Uj({operation:`delete-style`,computerId:t,id:n})))}async function Jj(e,t,n){return tb(Rj)(await Hj(e).request(Uj({operation:`read-print-style`,computerId:t,path:n})))}var Yj=8,Xj=lb.pipe(J(Bb(1)),J(Ub(32)),J(Db(/^[\p{L}\p{N}_-]+$/u))),Zj=lb.pipe(J(Ub(500))),Qj=mb(q({path:Gb.pipe(J(Ub(4096)))})).pipe(J(Ub(8))),$j=Gb,eM=q({id:zb,name:Xj,description:Zj,references:Qj});gb([q({operation:ab(`list-characters`),computerId:$j}),q({operation:ab(`save-character`),computerId:$j,id:ib(zb),name:Xj,description:Zj,references:Qj}),q({operation:ab(`delete-character`),computerId:$j,id:zb})]);var tM=q({characters:mb(eM).pipe(J(Ub(50)))}),nM=(e,t)=>e.toLowerCase()===t.toLowerCase(),rM=/(?<![\p{L}\p{N}_@-])@([\p{L}\p{N}_-]+)/gu;function iM(e){let t=[];for(let n of e.matchAll(rM)){let e=n.at(1);e!==void 0&&!t.some(t=>nM(t,e))&&t.push(e)}return t}function aM(e,t){let n=[];return{prompt:e.replace(rM,(e,r)=>{let i=t.find(e=>nM(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 oM(e,t,n){let r=e.trim();return zj(t,aM(r,n).prompt).length-r.length}function sM(e,t){let n=iM(e),r=t.filter(e=>!n.some(t=>nM(t,e)));return r.length===0?e:`${r.map(e=>`@${e}`).join(` `)} ${e}`}function cM(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 lM(e){let t=aM(sM(e.prompt,e.names??[]),e.saved),n=cM(e.references,t.characters,e.computerId),r=n.length-e.references.length;if(e.model!==void 0&&r>0&&n.length>e.model.maxReferences){let n=t.characters.map(e=>e.name).join(`, `);return{kind:`refused`,message:e.model.maxReferences===0?`${e.model.label} does not take reference images, so it cannot use ${n}.`:`${n} add ${String(r)} reference ${r===1?`image`:`images`} to your ${String(e.references.length)}; ${e.model.label} accepts at most ${String(e.model.maxReferences)}.`}}return{kind:`ready`,prompt:t.prompt,references:n,characters:t.characters}}function uM(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 dM(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,Yj)}var fM=e=>e.require(vA),pM=e=>JSON.stringify(e),mM=tb(tM);async function hM(e,t){return mM(await fM(e).request(pM({operation:`list-characters`,computerId:t})))}async function gM(e,t,n){return mM(await fM(e).request(pM({operation:`save-character`,computerId:t,id:n.id,name:n.name,description:n.description,references:n.references})))}async function _M(e,t,n){return mM(await fM(e).request(pM({operation:`delete-character`,computerId:t,id:n})))}var vM={models:e=>pA.of(e,`prints`,`models`),folder:e=>pA.of(e,`prints`,`folder`),dismissals:e=>pA.of(e,`prints`,`dismissals`),styles:e=>pA.of(e,`prints`,`styles`),printStyle:(e,t)=>pA.of(e,`prints`,`print-style`,t),characters:e=>pA.of(e,`prints`,`characters`)};function yM(e){return{...gA(e,hj,vM.models(e),async(t,n)=>{if(!e)throw Error(`Prints is disconnected`);let r=await Cj(e.capabilities);return n.throwIfAborted(),r}),enabled:!!(e?.context.get().computerId&&e.capabilities.has(hj)),structuralSharing:!1}}function bM(e){let t=e?.context.get().computerId;return{...gA(e,vA,vM.folder(e),async(n,r)=>{if(!e||!t)throw Error(`No Computer selected`);let i=await kj(e.capabilities,{operation:`read-folder`,computerId:t});if(r.throwIfAborted(),e.context.get().computerId!==t)throw new Y(`Computer selection changed`,{code:`SELECTION_CHANGED`,retryable:!1});return i}),enabled:!!(t&&e.capabilities.has(vA))}}function xM(e){let t=e?.context.get().computerId;return{...gA(e,vA,vM.dismissals(e),async(n,r)=>{if(!e||!t)throw Error(`No Computer selected`);let i=await Dj(e.capabilities,{operation:`read-notices`,computerId:t});return r.throwIfAborted(),i}),enabled:!!(t&&e.capabilities.has(vA))}}function SM(e){let t=e?.context.get().computerId;return{...gA(e,vA,vM.styles(e),async(n,r)=>{if(!e||!t)throw Error(`No Computer selected`);let i=await Gj(e.capabilities,t);return r.throwIfAborted(),i}),enabled:!!(t&&e.capabilities.has(vA))}}function CM(e,t){let n=e?.context.get().computerId;return{...gA(e,vA,vM.printStyle(e,t??``),async(r,i)=>{if(!e||!n||t===null)throw Error(`No print selected`);let a=await Jj(e.capabilities,n,t);return i.throwIfAborted(),a}),enabled:!!(n&&t!==null&&e.capabilities.has(vA))}}function wM(e){let t=e?.context.get().computerId;return{...gA(e,vA,vM.characters(e),async(n,r)=>{if(!e||!t)throw Error(`No Computer selected`);let i=await hM(e.capabilities,t);return r.throwIfAborted(),i}),enabled:!!(t&&e.capabilities.has(vA))}}var TM=Object.freeze({alphaIntercept:-9,alphaSlope:19,blurStdDeviation:1.5}),EM=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-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 DM(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=DM(e[t]))&&(r&&(r+=` `),r+=n)}else for(n in e)e[n]&&(r&&(r+=` `),r+=n)}return r}function OM(){for(var e,t,n=0,r=``,i=arguments.length;n<i;n++)(e=arguments[n])&&(t=DM(e))&&(r&&(r+=` `),r+=t);return r}var kM=e=>typeof e==`boolean`?`${e}`:e===0?`0`:e,AM=OM,jM=(e,t)=>n=>{if(t?.variants==null)return AM(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=kM(t)||kM(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 AM(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)},MM=Object.defineProperty,NM=((e,t)=>{let n={};for(var r in e)MM(n,r,{get:e[r],enumerable:!0});return t||MM(n,Symbol.toStringTag,{value:`Module`}),n})({isAny:()=>qM,isAnyNonArbitrary:()=>QM,isArbitraryFamilyName:()=>hN,isArbitraryImage:()=>_N,isArbitraryLength:()=>fN,isArbitraryNumber:()=>pN,isArbitraryPosition:()=>gN,isArbitraryShadow:()=>vN,isArbitrarySize:()=>uN,isArbitraryValue:()=>dN,isArbitraryVariable:()=>yN,isArbitraryVariableFamilyName:()=>xN,isArbitraryVariableImage:()=>wN,isArbitraryVariableLength:()=>bN,isArbitraryVariablePosition:()=>SN,isArbitraryVariableShadow:()=>TN,isArbitraryVariableSize:()=>CN,isArbitraryVariableWeight:()=>EN,isArbitraryWeight:()=>mN,isFraction:()=>HM,isInteger:()=>WM,isNamedContainerQuery:()=>$M,isNumber:()=>UM,isPercent:()=>GM,isTshirtSize:()=>KM}),PM=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,FM=/^\((?:(\w[\w-]*):)?(.+)\)$/i,IM=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,LM=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,RM=/\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$/,zM=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,BM=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,VM=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,HM=e=>IM.test(e),UM=e=>!!e&&!Number.isNaN(Number(e)),WM=e=>!!e&&Number.isInteger(Number(e)),GM=e=>e.endsWith(`%`)&&UM(e.slice(0,-1)),KM=e=>LM.test(e),qM=()=>!0,JM=e=>RM.test(e)&&!zM.test(e),YM=()=>!1,XM=e=>BM.test(e),ZM=e=>VM.test(e),QM=e=>!dN(e)&&!yN(e),$M=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)),eN=(e,t,n)=>{let r=PM.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},tN=(e,t,n=!1)=>{let r=FM.exec(e);return r?r[1]?t(r[1]):n:!1},nN=e=>e===`position`||e===`percentage`,rN=e=>e===`image`||e===`url`,iN=e=>e===`length`||e===`size`||e===`bg-size`,aN=e=>e===`length`,oN=e=>e===`number`,sN=e=>e===`family-name`,cN=e=>e===`number`||e===`weight`,lN=e=>e===`shadow`,uN=e=>eN(e,iN,YM),dN=e=>PM.test(e),fN=e=>eN(e,aN,JM),pN=e=>eN(e,oN,UM),mN=e=>eN(e,cN,qM),hN=e=>eN(e,sN,YM),gN=e=>eN(e,nN,YM),_N=e=>eN(e,rN,ZM),vN=e=>eN(e,lN,XM),yN=e=>FM.test(e),bN=e=>tN(e,aN),xN=e=>tN(e,sN),SN=e=>tN(e,nN),CN=e=>tN(e,iN),wN=e=>tN(e,rN),TN=e=>tN(e,lN,!0),EN=e=>tN(e,cN,!0),DN=(e,t)=>{let n=Object.keys(e);return n.length===1&&n[0]===t&&typeof e[t]==`string`},ON=e=>typeof e==`function`&&e.isThemeGetter===!0,kN=e=>({...e,theme:{...e.theme},classGroups:{...e.classGroups},conflictingClassGroups:{...e.conflictingClassGroups},conflictingClassGroupModifiers:{...e.conflictingClassGroupModifiers},orderSensitiveModifiers:[...e.orderSensitiveModifiers],postfixLookupClassGroups:[...e.postfixLookupClassGroups??[]]}),AN=(e,t)=>{let n=kN(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},jN={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},MN=25,NN=()=>({names:[],idByName:new Map,impls:{},fnName:new Map,classifierFns:new Map}),PN=(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},FN=(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),PN(e,n,t)}let n=t.$v,r=NM[n];if(jN[n]===void 0||!r)throw Error(`cn: unknown validator "${n}"`);return PN(e,n,r)},IN=()=>({nextPart:new Map,validators:null,classGroupId:-1,lit:[]}),LN=(e,t)=>e.theme[t]??[],RN=(e,t,n)=>{let r=IN(),i=(e,t)=>{for(let n of t.split(`-`)){let t=e.nextPart.get(n);t||(t=IN(),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(ON(n)){for(let t of n(e.theme))a(t,r,o);return}(r.validators??=[]).push({validatorId:FN(t,n),groupId:o});return}if(DN(n,`$t`)){for(let t of LN(e,n.$t))a(t,r,o);return}if(DN(n,`$v`)){(r.validators??=[]).push({validatorId:FN(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},zN=e=>{let t=NN(),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=RN(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 B=Array(L);for(let e=0;e<L;e++)B[R[e]]=n[e];let V=[],te=[],ne=[],H=[],U=[];for(let t=0;t<L;t++){let n=B[t],i=(e.conflictingClassGroups[n]??[]).map(e=>R[r.get(e)]),a=(e.conflictingClassGroupModifiers[n]??[]).map(e=>R[r.get(e)]);i.length&&(V.push(t),te.push(i.length),ne.push(...i));for(let e of a)H.push(t),U.push(e)}let re=(e.postfixLookupClassGroups??[]).map(e=>R[r.get(e)]),ie=[],ae=new Int32Array(j.length);for(let e=0;e<j.length;e++){let n=t.names[j[e]],r=jN[n];if(r!==void 0)ae[e]=r;else{let t=ie.indexOf(n);t===-1&&(t=ie.length,ie.push(n)),ae[e]=MN+t}}let oe=new Map,se=[],W=[],G=[];{let e=0;for(let t of d){let n=[];for(let r=0;r<t.length;r++)n.push(ae[e++]);let r=n.join(`,`),i=oe.get(r);i===void 0&&(i=se.length,oe.set(r,i),se.push(n.length),W.push(...n)),G.push(i)}}let ce={};for(let e of ie)ce[e]=t.classifierFns.get(e);return{G:L,customNames:ie,impls:ce,edgeCounts:w,edgeLabelLen:T,labelText:E,edgeTargetActual:k,nodeGroup:D,nodeVlist:O,nodeCount:S,totalEdges:C,patCounts:se,patOps:W,listPat:G,vlistGroup:M,litEntries:h,sets:F,attachments:N,uniqueTailCount:I,adjGid:V,adjCnt:te,adjTgt:ne,patGid:H,patTgt:U,postfixLookup:re,orderSensitiveModifiers:e.orderSensitiveModifiers.join(` `),prefix:e.prefix}},BN=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},VN=e=>{let t=zN(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:BN(t.edgeCounts),labelStart:BN(t.edgeLabelLen),labelText:t.labelText,edgeTarget:Int32Array.from(t.edgeTargetActual),nodeGroup:t.nodeGroup,nodeVlist:t.nodeVlist,vlistPat:BN(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:BN(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}},HN=`line`in Error(),UN=-1,WN=-1,GN=(e,t,n)=>{let r=2166136261;for(let i=t;i<n;i++)r=Math.imul(r^e.charCodeAt(i),16777619);return r},KN=(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},ore=(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=(GN(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=(GN(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??``,B=ee===``?``:ee+`:`,V=B.length,te=(T??[]).map(e=>{let n=t&&t[e];if(!n)throw Error(`cn: missing validator `+e);return n}),ne=/\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$/,H=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,U=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,re=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,ie=0,ae=-1,oe=-1,se=-1,W=-1,G=e=>e>=97&&e<=122||e>=65&&e<=90||e>=48&&e<=57||e===95,ce=e=>/\s/.test(String.fromCharCode(e)),le=(e,t,n)=>{if(ie=0,ae=-1,n-t<3)return;let r=e.charCodeAt(t),i=e.charCodeAt(n-1);if(r===91&&i===93)ie=1;else if(r===40&&i===41)ie=2;else return;se=t+1,W=n-1;let a=t+1;if(G(e.charCodeAt(a))){for(a++;a<n-1;){let t=e.charCodeAt(a);if(!G(t)&&t!==45)break;a++}a<n-2&&e.charCodeAt(a)===58&&(ae=t+1,oe=a,se=a+1)}},ue=(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},de=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,fe=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,pe=e=>!!e&&!Number.isNaN(Number(e)),me=(e,t,n)=>{if(n-t<11||!ue(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&&ue(e,t+10,t+16,`-size/`)||r===110&&n-t>=19&&ue(e,t+10,t+18,`-normal/`)},he=[1,1,1,1,1,1,1,1,2,2,2,2,2,2,2],ge=`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(` `)),_e=[2,3,1,0,0,0,4,5,0,0,0,0,0,1,1],ve=(e,t,n,r)=>{if(e>=10){if(e>=25)return te[e-25](t.slice(n,r));let i=e-10;if(ie!==he[i])return!1;if(ae>=0){for(let e of ge[i])if(ue(t,ae,oe,e))return!0;return!1}switch(_e[i]){case 0:return!1;case 1:return!0;case 2:{let e=t.slice(se,W);return ne.test(e)&&!H.test(e)}case 3:return pe(t.slice(se,W));case 4:return re.test(t.slice(se,W));default:return U.test(t.slice(se,W))}}switch(e){case 0:return!0;case 1:return ie===0;case 2:return ie===1;case 3:return ie===2;case 4:return de.test(t.slice(n,r));case 5:return pe(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&&pe(t.slice(n,r-1));case 8:return fe.test(t.slice(n,r));default:return me(t,n,r)}},ye=new Set(typeof E==`string`?E.split(` `):E),be=(e,t,n,r,i,a)=>{let o=GN(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},xe=new Map,Se=new Map,Ce=2,we=4096,Te=(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||ye.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=Se.get(s);return c===void 0&&Se.set(s,c=Ce++),c},Ee=new Map,De=r,Oe=r+4096,ke=()=>De++,Ae=2097152,je=8192,Me=new Int32Array(je),Ne=Array(je).fill(null),Pe=new Int32Array(je),Fe=new Int32Array(je),Ie=new Uint8Array(je),Le=0,Re=(e,t,n,r,i,a,o,s)=>{let c=e;if(Ne[e]!==null){if(Ne[e|1]===null)c=e|1;else if(!(Le++&3))c=e|Le>>2&1;else return}Ne[c]=t.slice(n,r),Me[c]=i,Pe[c]=a,Fe[c]=o,Ie[c]=s},ze=()=>Ne.fill(null),Be=256,Ve=[new Int32Array(Be),new Int32Array(Be),new Int32Array(Be),new Int32Array(Be)],[He,Ue,We,Ge]=Ve,Ke=new Uint8Array(Be),qe=new Uint8Array(Be),Je=()=>{Be*=2,Ve=Ve.map(e=>{let t=new Int32Array(Be);return t.set(e),t}),[He,Ue,We,Ge]=Ve;let e=new Uint8Array(Be);e.set(Ke),Ke=e,qe=new Uint8Array(Be)},Ye=64,Xe=new Int32Array(Ye),Ze=new Int32Array(Ye),Qe=new Int32Array(r),$e=2048,et=21,tt=new Float64Array($e),nt=new Int32Array($e),rt=0,it=(e,t)=>{if(e===0&&t<r)return Qe[t]===rt?1:(Qe[t]=rt,0);let n=e*2097152+t+1,i=Math.imul(n,2654435761)>>>et;for(;nt[i]===rt;){if(tt[i]===n)return 1;i=i+1&$e-1}return tt[i]=n,nt[i]=rt,0},at=(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?UN:be(Ee,e,t+1,r,0,ke)}if(r>=0&&c[r]>=0)return c[r];for(let t=i-1;t>=0;t--){let r=Ze[t];if(r>n)continue;let i=Xe[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;le(e,r,n);let h=A[o]-c;for(let t=c;t<m;t++)if(ve(d[t],e,r,n))return p[h+t]}return UN},ot=e=>{let t=e.length,n=0,c=0,u=!1;(Ce>we||xe.size>we)&&(xe=new Map,Se=new Map,Ce=2,ze()),De>Oe&&(Ee=new Map,De=r,ze());let d=0;for(;d<t;){let f=e.charCodeAt(d);if(f===32||f>=9&&f<=13||f>=160&&ce(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&&ce(f)){u=!0;break}m=Math.imul(m^f,16777619),d++}let h=d,g=h-p;n===Be&&Je();let _=n++;He[_]=p,Ue[_]=h,c+=g,m^=Math.imul(g,2654435761);let v=m^m>>>15|0,y=v&8190;{let t=-1;if(Me[y]===v&&Ne[y]!==null&&Ne[y].length===g?t=y:Me[y|1]===v&&Ne[y|1]!==null&&Ne[y|1].length===g&&(t=y|1),t>=0){let n=Ne[t],r=!0;for(let t=0;t<g;t++)if(n.charCodeAt(t)!==e.charCodeAt(p+t)){r=!1;break}if(r){We[_]=Pe[t],Ge[_]=Fe[t],Ke[_]=Ie[t];continue}}}let b=p;if(V!==0){if(h-p<=V||!e.startsWith(B,p)){We[_]=UN,Re(y,e,p,h,v,UN,0,0);continue}b=p+V}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)&&(Xe[0]=0,Ze[0]=M,R=1);let z=WN,ee=0;for(let t=M;t<D;t++)if(t===A&&(z=F<I?WN:P,ee=R),P!==WN){let n=e.charCodeAt(t),r=-1;if(F<I)o.charCodeAt(F)===n?(F++,F===I&&(r=P=L)):P=WN;else{let e=i[P],t=i[P+1],c=WN;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===Ye){Ye*=2;let e=new Int32Array(Ye);e.set(Xe),Xe=e;let t=new Int32Array(Ye);t.set(Ze),Ze=t}Xe[R]=r,Ze[R]=t+2,R++}}A===D&&(z=F<I?WN:P,ee=R);let te=F<I?WN:P,ne,H=!1;if(A>=0){if(H=!0,ne=at(e,E,A,z,ee),ne!==UN&&ne<r&&j[ne]){let t=at(e,E,D,te,R);t!==UN&&t!==ne&&(ne=t,H=!1)}else ne===UN&&(ne=at(e,E,D,te,R),H=!1)}else ne=at(e,E,D,te,R);let U=0,re=0;ne===UN?We[_]=UN:(re=+!!H,U=b>=C?+!!O:be(xe,e,b,C,+!!O,e=>Te(e,O)),We[_]=ne,Ke[_]=re,Ge[_]=U),Re(y,e,p,h,v,ne,U,re)}if(n===0)return``;if(n===1)return He[0]===0&&Ue[0]===t?e:e.slice(He[0],Ue[0]);if(n*k>$e){for(;n*k>$e;)$e<<=1,et--;tt=new Float64Array($e),nt=new Int32Array($e)}if(Ce>=Ae||De>=Ae)throw Error(`cn: too many distinct classes in one merge`);rt=rt+1|0,rt===0&&(Qe.fill(0),nt.fill(0),rt=1);let f=!1;for(let e=n-1;e>=0;e--){let t=We[e];if(t===UN){qe[e]=1;continue}let n=Ge[e];if(it(n,t)===1){qe[e]=0,f=!0;continue}if(qe[e]=1,t<r){let r=D[t];if(r>=0)for(let e=b[r];e<b[r+1];e++)it(n,x[e]);if(Ke[e]&1)for(let e=0;e<S.length;e++)S[e]===t&&it(n,C[e])}}if(!f&&!u&&t===c+n-1)return e;let p=``,m=0;for(;m<n;){if(!qe[m]){m++;continue}let t=He[m],r=Ue[m],i=m+1;for(;i<n&&qe[i]&&He[i]===r+1&&e.charCodeAt(r)===32;)r=Ue[i],i++;p.length>0&&(p+=` `),p+=e.slice(t,r),m=i}return p},st=16384,ct=new Int32Array(st*2),lt=0,ut=1,dt=Object.create(null),ft=Object.create(null),pt=new Map,mt=new Map,ht=0,gt=0,_t=()=>{lt^=st,ut=ut+1|0,gt=0},vt=e=>{let t=dt[e];if(t!==void 0)return t;let n=KN(e,0,e.length),r=(n&16383)+lt,i=ct[r]===(n^ut)||ct[r^st]===(n^ut-1);return i&&(t=ft[e],t!==void 0)?(dt[e]=t,t):(t=ot(e),i?(dt[e]=t,++ht>z&&(ht=0,ft=dt,dt=Object.create(null),_t())):(ct[r]=n^ut,++gt>st&&_t()),t)},yt=e=>{let t=pt.get(e);if(t!==void 0)return t;let n=KN(e,0,e.length),r=(n&16383)+lt,i=ct[r]===(n^ut)||ct[r^st]===(n^ut-1);return i&&(t=mt.get(e),t!==void 0)?(pt.set(e,t),t):(t=ot(e),i?(pt.set(e,t),++ht>z&&(ht=0,mt=pt,pt=new Map,_t())):(ct[r]=n^ut,++gt>st&&_t()),t)},bt=e=>{let t=KN(e,0,e.length),n=(t&16383)+lt;return ct[n]===(t^ut)||ct[n^st]===(t^ut-1)||(ct[n]=t^ut,++gt>st&&_t(),!1)},xt=z===0?ot:HN?e=>{let t=pt.get(e);return t===void 0?yt(e):t}:vt;return{merge:function(){return arguments.length===1&&typeof arguments[0]==`string`?xt(arguments[0]):xt(cre.apply(null,arguments))},mergeString:xt,seenBefore:z===0?()=>!1:bt,mergeUncached:ot}},qN=(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:qN(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},sre=(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:qN(i,t);a&&(n&&(n+=` `),n+=a)}return n},cre=function(){return sre(arguments,!1)},lre=(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]=qN(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(qN(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)}},ure=`{"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"]}`,JN=()=>JSON.parse(ure),dre=e=>`classGroups`in e&&`theme`in e&&`conflictingClassGroups`in e,fre=e=>e===void 0?{config:JN()}:typeof e==`function`?{config:e(JN())}:dre(e)?{config:e}:{config:AN(JN(),e),cacheSize:e.cacheSize},pre=e=>{let{config:t,cacheSize:n}=fre(e),{tables:r,validatorImpls:i,prefix:a}=VN(t);return ore(r,i,{cacheSize:n,prefix:a})},Z=(e=>{let t=null,n=()=>t??=pre(e);return lre(e=>n().mergeString(e),{seenBefore:e=>n().seenBefore(e),mergeUncached:e=>n().mergeUncached(e)})})({extend:{theme:{spacing:[...EM]}}});function YN(e,t){return typeof e==`function`?e(t):e}var mre=(0,K.forwardRef)(function({tone:e=`neutral`,size:t=`md`,pressed:n=!1,className:r,...i},a){return(0,X.jsx)(`kbd`,{...i,ref:a,className:Z(`caps-keycap`,r),"data-tone":e,"data-size":t,"data-pressed":n})}),XN=(0,K.forwardRef)(function({label:e,shortcut:t,icon:n,readout:r,tone:i=`neutral`,pressed:a,expanded:o,className:s,type:c=`button`,...l},u){let d=a??o;return(0,X.jsxs)(`button`,{...l,ref:u,type:c,className:Z(`caps-keycap-button`,s),"data-tone":i,"aria-pressed":a,"aria-expanded":o,"aria-keyshortcuts":l[`aria-keyshortcuts`]??t,children:[d===void 0?null:(0,X.jsx)(`span`,{className:`caps-keycap-led`,"data-lit":d,"aria-hidden":`true`}),n?(0,X.jsx)(`span`,{className:`caps-keycap-button-icon`,"aria-hidden":`true`,children:n}):null,e===null?null:(0,X.jsx)(`span`,{className:`caps-keycap-button-label`,children:e}),r,t?(0,X.jsx)(mre,{size:`sm`,tone:`neutral`,"aria-hidden":`true`,children:t}):null]})});function ZN(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}function hre(...e){return t=>{let n=!1,r=e.map(e=>{let r=ZN(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():ZN(e[t],null)}}}}function gre(...e){return K.useCallback(hre(...e),e)}function _re(e){let t=K.forwardRef((t,n)=>{let{children:r,...i}=t,a=null,o=!1,s=[];$N(r)&&typeof eP==`function`&&(r=eP(r._payload)),K.Children.forEach(r,e=>{if(Sre(e)){o=!0;let t=e,n=`child`in t.props?t.props.child:t.props.children;$N(n)&&typeof eP==`function`&&(n=eP(n._payload)),a=yre(t,n),s.push(a?.props?.children)}else s.push(e)}),a?a=K.cloneElement(a,void 0,s):!o&&K.Children.count(r)===1&&K.isValidElement(r)&&(a=r);let c=a?xre(a):void 0,l=gre(n,c);if(!a){if(r||r===0)throw Error(o?Ere(e):Tre(e));return r}let u=bre(i,a.props??{});return a.type!==K.Fragment&&(u.ref=n?l:c),K.cloneElement(a,u)});return t.displayName=`${e}.Slot`,t}var QN=_re(`Slot`),vre=Symbol.for(`radix.slottable`),yre=(e,t)=>{if(`child`in e.props){let t=e.props.child;return K.isValidElement(t)?K.cloneElement(t,void 0,e.props.children(t.props.children)):null}return K.isValidElement(t)?t:null};function bre(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 xre(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 Sre(e){return K.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===vre}var Cre=Symbol.for(`react.lazy`);function $N(e){return typeof e==`object`&&!!e&&`$$typeof`in e&&e.$$typeof===Cre&&`_payload`in e&&wre(e._payload)}function wre(e){return typeof e==`object`&&!!e&&`then`in e}var Tre=e=>`${e} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,Ere=e=>`${e} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,eP=K.use,tP=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)`}),nP=`(prefers-reduced-motion: reduce)`;function rP(e){let t=e.ownerDocument.defaultView;if(!t)return tP;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?.(nP).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`,tP.squish),fast:o(`fast`,tP.fast),normal:o(`normal`,tP.normal),slow:o(`slow`,tP.slow),springDuration:o(`spring-duration`,tP.springDuration),bounce:Math.min(1,s(`bounce`,tP.bounce)),stretch:s(`stretch`,tP.stretch),distance:s(`distance`,tP.distance),stagger:a?0:i(`--stipe-motion-stagger`,tP.stagger),blur:s(`blur`,tP.blur),shake:s(`shake`,tP.shake),steps:Math.floor(s(`steps`,tP.steps)),fuse:r(`--stipe-motion-fuse`,tP.fuse),pressDepth:a?0:r(`--stipe-press-depth`,tP.pressDepth),pressScale:a?1:r(`--stipe-press-scale`,tP.pressScale),ease:n.getPropertyValue(`--stipe-motion-ease`).trim()||tP.ease,easeExit:n.getPropertyValue(`--stipe-motion-ease-exit`).trim()||tP.easeExit}}function iP(e){let[t,n]=(0,K.useState)(()=>({...tP,reduced:!0}));return(0,K.useLayoutEffect)(()=>{let t=e.current,r=t?.ownerDocument.defaultView;if(!t||!r)return;let i=()=>{let e=rP(t);n(t=>JSON.stringify(t)===JSON.stringify(e)?t:e)};i();let a=new r.MutationObserver(i);for(let e=t;e;e=e.parentElement)a.observe(e,{attributes:!0,attributeFilter:[`data-theme`,`class`,`style`]});let o=r.matchMedia?.(nP);return o?.addEventListener(`change`,i),()=>{a.disconnect(),o?.removeEventListener(`change`,i)}},[e]),t}function aP(e,t){return e.reduced?0:Math.round(t*e.normal/tP.normal)}function Dre(e,t){if(e.reduced)return 0;let n=t*e.bounce/tP.bounce;return Math.min(.9,Math.max(0,n))}function Ore(e,t){return e.reduced?0:Math.round(t*e.springDuration/tP.springDuration)}function oP(e,t){return e.steps>0?`steps(${String(e.steps)}, end)`:t}function sP(e){return`animate`in e}var cP=globalThis;function kre(){return cP.matchMedia?.(nP).matches??!1}function Are(e){let t=cP.matchMedia?.(nP);return t?.addEventListener(`change`,e),()=>{t?.removeEventListener(`change`,e)}}function jre(){return!0}function lP(){return(0,K.useSyncExternalStore)(Are,kre,jre)}var uP=(0,K.forwardRef)(function({asChild:e=!1,className:t,...n},r){let i=Z(`absolute h-px w-px overflow-hidden whitespace-nowrap border-0 p-0 [clip:rect(0,0,0,0)]`,t);return e?(0,X.jsx)(QN,{...n,className:i,ref:r}):(0,X.jsx)(`span`,{...n,className:i,ref:r})}),dP=typeof window<`u`,fP=dP?window:null,pP=dP?document:null,mP={OBJECT:0,ATTRIBUTE:1,CSS:2,TRANSFORM:3,CSS_VAR:4},hP={NUMBER:0,UNIT:1,COLOR:2,COMPLEX:3},gP={NONE:0,AUTO:1,FORCE:2},_P={replace:0,none:1,blend:2},vP=Symbol(),yP=Symbol(),bP=Symbol(),xP=Symbol(),Mre=Symbol(),SP=1e-11,CP=0xe8d4a51000,wP=1e3,TP=[],EP=(()=>{let e=new Map;return e.set(`x`,`translateX`),e.set(`y`,`translateY`),e.set(`z`,`translateZ`),e})(),DP=[`perspective`,`translateX`,`translateY`,`translateZ`,`rotate`,`rotateX`,`rotateY`,`rotateZ`,`scale`,`scaleX`,`scaleY`,`scaleZ`,`skew`,`skewX`,`skewY`],Nre=DP.reduce((e,t)=>({...e,[t]:t+`(`}),{}),OP=()=>{},Pre=e=>e,Fre=/\)\s*[-.\d]/,Ire=/(^#([\da-f]{3}){1,2}$)|(^#([\da-f]{4}){1,2}$)/i,Lre=/rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)/i,Rre=/rgba\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*(-?\d+|-?\d*.\d+)\s*\)/i,zre=/hsl\(\s*(-?\d+|-?\d*.\d+)\s*,\s*(-?\d+|-?\d*.\d+)%\s*,\s*(-?\d+|-?\d*.\d+)%\s*\)/i,Bre=/hsla\(\s*(-?\d+|-?\d*.\d+)\s*,\s*(-?\d+|-?\d*.\d+)%\s*,\s*(-?\d+|-?\d*.\d+)%\s*,\s*(-?\d+|-?\d*.\d+)\s*\)/i,kP=/[-+]?\d*\.?\d+(?:e[-+]?\d)?/gi,Vre=/^([-+]?\d*\.?\d+(?:e[-+]?\d+)?)([a-z]+|%)$/i,Hre=/([a-z])([A-Z])/g,Ure=/var\(\s*(--[\w-]+)(?:\s*,\s*([^)]+))?\s*\)/,AP={id:null,keyframes:null,playbackEase:null,playbackRate:1,frameRate:240,loop:0,reversed:!1,alternate:!1,autoplay:!0,persist:!1,duration:wP,delay:0,loopDelay:0,ease:`out(2)`,composition:_P.replace,modifier:Pre,onBegin:OP,onBeforeUpdate:OP,onUpdate:OP,onLoop:OP,onPause:OP,onComplete:OP,onRender:OP},jP={current:null,root:pP},MP={defaults:AP,precision:4,timeScale:1,tickThreshold:200,editor:null},NP={version:`4.5.0`,engine:null};dP&&(fP.AnimeJS||=[],fP.AnimeJS.push(NP));var PP=e=>e.replace(Hre,`$1-$2`).toLowerCase(),FP=(e,t)=>e.indexOf(t)===0,IP=Date.now,LP=Array.isArray,RP=e=>e&&e.constructor===Object,Wre=e=>typeof e==`number`&&!isNaN(e),zP=e=>typeof e==`string`,BP=e=>typeof e==`function`,VP=e=>e===void 0,HP=e=>VP(e)||e===null,UP=e=>dP&&e instanceof SVGElement,WP=e=>Ire.test(e),GP=e=>FP(e,`rgb`),KP=e=>FP(e,`hsl`),Gre=e=>WP(e)||(GP(e)||KP(e))&&(e[e.length-1]===`)`||!Fre.test(e)),qP=e=>!MP.defaults.hasOwnProperty(e),Kre=[`opacity`,`rotate`,`overflow`,`color`],qre=(e,t)=>{if(Kre.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}},JP=Math.pow,YP=Math.sqrt,XP=Math.sin,ZP=Math.cos,Jre=Math.abs,QP=Math.exp,Yre=Math.ceil,$P=Math.floor,Xre=Math.asin,eF=Math.PI,tF=Math.round,nF=(e,t,n)=>e<t?t:e>n?n:e,rF=(e,t)=>{if(t<0)return e;if(!t)return tF(e);let n=10**t;return tF(e*n)/n},iF=(e,t,n)=>n===1?t:n===0?e:e+(t-e)*n,aF=e=>e===1/0?CP:e===-1/0?-CP:e,oF=e=>e<=1e-11?SP:aF(rF(e,11)),sF=e=>LP(e)?[...e]:e,Zre=(e,t)=>{let n={...e};for(let r in t){let i=e[r];n[r]=VP(i)?t[r]:i}return n},cF=(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}},lF=(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},uF=(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},Qre=(e,t,n)=>{let r=e.style.transform;if(r){let i=e[xP],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(!VP(c))return n&&(n[t]=c),c}return t===`translate3d`?`0px, 0px, 0px`:t===`rotate3d`?`0, 0, 0, 0deg`:FP(t,`scale`)?`1`:FP(t,`rotate`)||FP(t,`skew`)?`0deg`:`0px`},dF=e=>{let t=``;for(let n=0,r=DP.length;n<r;n++){let r=DP[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+=`${Nre[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},fF=[];function pF(e,t){if(!e)return null;let n=fF.length;outer:for(let r=0;r<n;r++){let n=fF[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=fF[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 $re=e=>{let t=Lre.exec(e)||Rre.exec(e),n=VP(t[4])?1:+t[4];return[+t[1],+t[2],+t[3],n]},eie=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]},mF=(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),tie=e=>{let t=zre.exec(e)||Bre.exec(e),n=t[1]/360,r=t[2]/100,i=t[3]/100,a=VP(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=rF(mF(t,e,n+1/3)*255,0),s=rF(mF(t,e,n)*255,0),c=rF(mF(t,e,n-1/3)*255,0)}return[o,s,c,a]},nie=e=>GP(e)?$re(e):WP(e)?eie(e):KP(e)?tie(e):[0,0,0,1],hF=(e,t)=>VP(e)?t:e,gF=(e,t)=>{let n=e.match(Ure),r=t[yP]?t:document.documentElement,i=getComputedStyle(r)?.getPropertyValue(n[1]);return(!i||i.trim()===``)&&n[2]&&(i=n[2].trim()),i||0},_F=(e,t,n,r,i,a)=>{if(BP(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(zP(e)&&FP(e,`var(`)){if(!i)return gF(e,t);let n=()=>gF(e,t);return i.func=n,n()}return e},vF=(e,t)=>e[yP]?e[bP]&&qre(e,t)?mP.ATTRIBUTE:DP.includes(t)||EP.get(t)?mP.TRANSFORM:FP(t,`--`)?mP.CSS_VAR:t in e.style?mP.CSS:t in e?mP.OBJECT:mP.ATTRIBUTE:mP.OBJECT,yF=(e,t,n)=>{let r=e.style[t];r&&n&&(n[t]=r);let i=r||getComputedStyle(e[Mre]||e).getPropertyValue(t);return i===`auto`?`0`:i},bF=(e,t,n,r)=>{let i=VP(n)?vF(e,t):n,a=pF(e,t);if(a){let n=a.get(e);return n&&r&&(r[t]=n),n??0}if(i===mP.OBJECT){let n=e[t];return n&&r&&(r[t]=n),n||0}if(i===mP.ATTRIBUTE){let n=e.getAttribute(t);return n&&r&&(r[t]=n),n}return i===mP.TRANSFORM?Qre(e,t,r):i===mP.CSS_VAR?yF(e,t,r).trimStart():yF(e,t,r)},xF=(e,t,n)=>n===`-`?e-t:n===`+`?e+t:e*t,SF=()=>({t:hP.NUMBER,n:0,u:null,o:null,d:null,s:null}),CF=(e,t)=>{if(t.t=hP.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(` `)&&Vre.exec(r);if(i)return t.t=hP.UNIT,t.n=+i[1],t.u=i[2],t;if(t.o)return t.n=+r,t;if(Gre(r))return t.t=hP.COLOR,t.d=nie(r),t;{let e=r.match(kP);return t.t=hP.COMPLEX,t.d=e?e.map(Number):[],t.s=r.split(kP)||[],t}},wF=(e,t)=>(t.t=e._valueType,t.n=e._toNumber,t.u=e._unit,t.o=null,t.d=sF(e._toNumbers),t.s=sF(e._strings),t),TF=SF(),EF=(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(rF(iF(i[c],a[c],t),n)),u=o[c+1];s+=`${u?l+u:l}`,e._numbers[c]=l}return s},DF=(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=nF(g,-h,o),b=nF(v,-h,o),x=v-g,S=b>0,C=b>=o,w=o<=SP,T=i===gP.FORCE,E=0,D=v,O=0;if(l>1){let t=c+(C?0:d),n=~~(b/t);e._currentIteration=nF(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===gP.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)>=MP.tickThreshold,i=rF(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!==_P.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=nF(j-o._startTime,0,a),n=o._ease(t/o._updateDuration),i=o._modifier,f=o._valueType,p=o._tweenType,m=p===mP.OBJECT,g=f===hP.NUMBER,_=g&&m||n===0||n===1?-1:MP.precision,v,y;if(g)v=y=i(rF(iF(o._fromNumber,o._toNumber,n),_));else if(f===hP.UNIT)y=i(rF(iF(o._fromNumber,o._toNumber,n),_)),v=`${y}${o._unit}`;else if(f===hP.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(iF(t[3],a[3],n)),(!o._setter||r)&&(v=`rgba(${rF(e[0],0)},${rF(e[1],0)},${rF(e[2],0)},${e[3]})`)}else f===hP.COMPLEX&&(v=EF(o,n,_));if(h&&(o._number=y),!r&&e!==_P.blend){let e=o.property;s=o.target,o._setter?o._setter(s,y,o):m?s[e]=v:p===mP.ATTRIBUTE?s.setAttribute(e,v):(c=s.style,p===mP.TRANSFORM?(s!==l&&(l=s,u=s[xP]),u[e]=v,d=1):p===mP.CSS?c[e]=v:p===mP.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=dF(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},OF=(e,t,n,r,i)=>{let a=e._currentIteration;if(DF(e,t,n,r,i),e._hasChildren){let o=e,s=o.backwards,c=r?t:o._iterationTime,l=IP(),u=0,d=!0;if(!r&&o._currentIteration!==a){let e=o.iterationDuration;cF(o,t=>{if(!s)!t.completed&&!t.backwards&&t._currentTime<t.iterationDuration&&DF(t,e,n,1,gP.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)}cF(o,e=>{let t=rF((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+=DF(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))))}},kF={},rie=(e,t,n)=>{if(n===mP.TRANSFORM)return EP.get(e)||e;if(n===mP.CSS||n===mP.ATTRIBUTE&&UP(t)&&e in t.style){let t=kF[e];if(t)return t;{let t=e&&PP(e);return kF[e]=t,t}}return e},AF=(e,t=!1)=>{if(e._hasChildren)cF(e,e=>AF(e,t),!0);else{let n=e;n.pause(),cF(n,e=>{let r=e.property,i=e.target,a=e._tweenType,o=e._inlineValue,s=HP(o)||o===``;if(e._setter){if(!t&&!s){if(CF(o,TF),TF.d){let t=TF.d,n=e._numbers;for(let e=0,r=t.length;e<r;e++)n[e]=t[e]}else e._number=TF.n;e._setter(e.target,e._number,e)}}else if(a===mP.OBJECT)!t&&!s&&(i[r]=o);else if(i[yP]){if(a===mP.ATTRIBUTE)t||(s?i.removeAttribute(r):i.setAttribute(r,o));else{let t=i.style;if(a===mP.TRANSFORM){let n=i[xP];s?delete n[r]:n[r]=o,e._renderTransforms&&(Object.keys(n).length?t.transform=dF(n):t.removeProperty(`transform`))}else s?t.removeProperty(PP(r)):t[r]=o}}i[yP]&&n._tail===e&&n.targets.forEach(e=>{e.getAttribute&&e.getAttribute(`style`)===``&&e.removeAttribute(`style`)})})}return e},jF=class{constructor(e=0){this.deltaTime=0,this._currentTime=e,this._lastTickTime=e,this._startTime=e,this._lastTime=e,this._frameDuration=wP/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?SP:t,r=wP/n;n>AP.frameRate&&(AP.frameRate=n),this._fps=n,this._frameDuration=r}get speed(){return this._speed}set speed(e){let t=+e;this._speed=t<1e-11?SP:t}requestTick(e){let t=this._frameDuration,n=e-this._lastTickTime,r=t*.25;return n+(r<4?r:4)<t?gP.NONE:(this._lastTickTime=n>=t?e-n%t:e,gP.AUTO)}computeDeltaTime(e){let t=e-this._lastTime;return this.deltaTime=t,this._lastTime=e,t}},MF={animation:null,update:OP},iie=e=>{let t=MF.animation;return t||(t={duration:SP,computeDeltaTime:OP,_offset:0,_delay:0,_head:null,_tail:null},MF.animation=t,MF.update=()=>{e.forEach(e=>{for(let t in e){let n=e[t],r=n._head;if(r){let e=r._valueType,t=e===hP.COMPLEX||e===hP.COLOR?sF(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}}}),DF(t,1,1,0,gP.FORCE)}),t},NF=dP?requestAnimationFrame:setImmediate,aie=dP?cancelAnimationFrame:clearImmediate,oie=class extends jF{constructor(e){super(e),this.useDefaultMainLoop=!0,this.pauseOnDocumentHidden=!0,this.defaults=AP,this.paused=!0,this.reqId=0}update(){let e=this._currentTime=IP();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?(lF(this,r),this._hasChildren=!!this._tail,r._running=!1,r.completed&&!r._cancelled&&r.cancel()):OF(r,(e-r._startTime)*r._speed*t,0,0,r._fps<n?r.requestTick(e):gP.AUTO),r=i}MF.update()}}wake(){return this.useDefaultMainLoop&&!this.reqId&&(this.requestTick(IP()),this.reqId=NF(FF)),this}pause(){if(this.reqId)return this.paused=!0,sie()}resume(){if(this.paused)return this.paused=!1,cF(this,e=>e.resetTime()),this.wake()}get speed(){return this._speed*(MP.timeScale===1?1:wP)}set speed(e){let t=e*MP.timeScale;this._speed!==t&&(this._speed=t,cF(this,e=>e.speed=e._speed))}get timeUnit(){return MP.timeScale===1?`ms`:`s`}set timeUnit(e){let t=.001,n=e===`s`,r=n?t:1;if(MP.timeScale!==r){MP.timeScale=r,MP.tickThreshold=200*r;let e=n?t:wP;this.defaults.duration*=e,this._speed*=e}}get precision(){return MP.precision}set precision(e){MP.precision=e}},PF=(()=>{let e=new oie(IP());return dP&&(NP.engine=e,pP.addEventListener(`visibilitychange`,()=>{e.pauseOnDocumentHidden&&(pP.hidden?e.pause():e.resume())})),e})(),FF=()=>{PF._head?(PF.reqId=NF(FF),PF.update()):PF.reqId=0},sie=()=>(aie(PF.reqId),PF.reqId=0,PF),IF={_rep:new WeakMap,_add:new Map},LF=(e,t,n=`_rep`)=>{let r=IF[n],i=r.get(e);return i||(i={},r.set(e,i)),i[t]?i[t]:i[t]={_head:null,_tail:null}},cie=(e,t)=>e._isOverridden||e._absoluteStartTime>t._absoluteStartTime,RF=e=>{e._isOverlapped=1,e._isOverridden=1,e._changeDuration=SP,e._currentTime=SP},zF=(e,t)=>{let n=e._composition;if(n===_P.replace){let n=e._absoluteStartTime;uF(t,e,cie,`_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){RF(r);let e=r._prevRep;for(;e&&e.parent.id===t.id;)RF(e),e=e._prevRep}let a=e._absoluteUpdateStartTime;if(i>a){let e=r._startTime,t=rF(a-(i-(e+r._updateDuration))-e,12);r._changeDuration=t,r._currentTime=t,r._isOverlapped=1,t<1e-11&&RF(r)}let o=e.parent.parent;if(!o||o!==t.parent){let e=!0;if(cF(t,t=>{t._isOverlapped||(e=!1)}),e){let e=t.parent;if(e){let n=!0;cF(e,e=>{e!==t&&cF(e,e=>{e._isOverlapped||(n=!1)})}),n&&e.cancel()}else t.cancel()}}}}else if(n===_P.blend){let t=LF(e.target,e.property,`_add`),n=iie(IF._add),r=t._head;r||(r={...e},r._composition=_P.replace,r._updateDuration=SP,r._startTime=0,r._numbers=sF(e._fromNumbers),r._number=0,r._next=null,r._prev=null,uF(t,r),uF(n,r));let i=e._toNumber;if(e._fromNumber=r._fromNumber-i,e._toNumber=0,e._numbers=sF(e._fromNumbers),e._number=0,r._fromNumber=i,e._toNumbers.length){let t=sF(e._toNumbers);t.forEach((t,n)=>{e._fromNumbers[n]=r._fromNumbers[n]-t,e._toNumbers[n]=0}),r._fromNumbers=t}uF(t,e,null,`_prevAdd`,`_nextAdd`)}return e},lie=e=>{let t=e._composition;if(t!==_P.none){let n=e.target,r=e.property,i=IF._rep.get(n)[r];if(lF(i,e,`_prevRep`,`_nextRep`),t===_P.blend){let t=IF._add,i=t.get(n);if(!i)return;let a=i[r],o=MF.animation;lF(a,e,`_prevAdd`,`_nextAdd`);let s=a._head;if(s&&s===a._tail){lF(a,s,`_prevAdd`,`_nextAdd`),lF(o,s);let e=!0;for(let t in i)if(i[t]._head){e=!1;break}e&&t.delete(n)}}}return e},BF=e=>(e.paused=!0,e.began=!1,e.completed=!1,e),VF=e=>e._cancelled?(e._hasChildren?cF(e,VF):cF(e,e=>{e._composition!==_P.none&&zF(e,LF(e.target,e.property))}),e._cancelled=0,e):e,HF=0,uie=(e,t)=>e._priority>t._priority,die=class extends jF{constructor(e={},t=null,n=0){super(0),++HF;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;jP.current&&jP.current.register(this);let b=t?0:PF._lastTickTime,x=t?t.defaults:MP.defaults,S=BP(i)||VP(i)?x.delay:+i,C=BP(a)||VP(a)?1/0:+a,w=hF(c,x.loop),T=hF(l,x.loopDelay),E=w===!0||w===1/0||w<0?1/0:w+1,D=0;t?D=n:(PF.reqId||PF.requestTick(IP()),D=(PF._lastTickTime-PF._startTime)*MP.timeScale),this.id=VP(r)?HF:r,this.parent=t,this.duration=aF((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&&hF(u,x.autoplay),this._offset=D,this._delay=S,this._loopDelay=T,this._iterationTime=0,this._currentIteration=0,this._resolve=OP,this._running=!1,this._reversed=+hF(o,x.reversed),this._reverse=this._reversed,this._cancelled=0,this._alternate=hF(s,x.alternate),this._prev=null,this._next=null,this._lastTickTime=b,this._startTime=b,this._lastTime=b,this._fps=hF(d,x.frameRate),this._speed=hF(f,x.playbackRate),this._priority=+hF(p,1)}get cancelled(){return!!this._cancelled}set cancelled(e){e?this.cancel():this.reset(!0).play()}get currentTime(){return nF(rF(this._currentTime,MP.precision),-this._delay,this.duration)}set currentTime(e){let t=this.paused;this.pause().seek(+e),t||this.resume()}get iterationCurrentTime(){return nF(rF(this._iterationTime,MP.precision),0,this.iterationDuration)}set iterationCurrentTime(e){this.currentTime=this.iterationDuration*this._currentIteration+e}get progress(){return nF(rF(this._currentTime/this.duration,10),0,1)}set progress(e){this.currentTime=this.duration*e}get iterationProgress(){return nF(rF(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*nF(+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 VF(this),this._reversed&&!this._reverse&&(this.reversed=!1),this._iterationTime=this.iterationDuration,OF(this,0,1,~~e,gP.FORCE),BF(this),this._hasChildren&&cF(this,BF),this}init(e=!1){this.fps=this._fps,this.speed=this._speed,!e&&this._hasChildren&&OF(this,this.duration,1,~~e,gP.FORCE),this.reset(e);let t=this._autoplay;return t===!0?this.resume():t&&!VP(t.linked)&&t.link(this),this}resetTime(){let e=1/(this._speed*PF._speed);return this._startTime=IP()-(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?OF(this,SP,0,0,gP.FORCE):(this._running||=(uF(PF,this,uie),PF._hasChildren=!0,!0),this.resetTime(),this._startTime-=12,PF.wake()),this):this}restart(){return this.reset().resume()}seek(e,t=0,n=0){VF(this),this.completed=!1;let r=this.paused;return this.paused=!0,OF(this,e+this._delay,~~t,~~n,gP.AUTO),r?this:this.resume()}alternate(){let e=this._reversed,t=this.iterationCount,n=this.iterationDuration,r=t===1/0?$P(CP/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?cF(this,e=>e.cancel(),!0):cF(this,lie),this._cancelled=1,this.pause()}stretch(e){let t=this.duration,n=oF(e);if(t===n)return this;let r=e/t,i=e<=SP;return this.duration=i?SP:n,this.iterationDuration=i?SP:oF(this.iterationDuration*r),this._offset*=r,this._delay*=r,this._loopDelay*=r,this}revert(){OF(this,0,1,0,gP.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=OP){let t=this.then,n=()=>{this.then=null,e(this),this.then=t,this._resolve=OP};return new Promise(e=>(this._resolve=()=>e(n()),this.completed&&this._resolve(),this))}};function UF(e){let t=zP(e)?jP.root.querySelectorAll(e):e;if(t instanceof NodeList||t instanceof HTMLCollection)return t}function fie(e){if(HP(e))return[];if(!dP)return LP(e)&&e.flat(1/0)||[e];if(LP(e)){let t=e.flat(1/0),n=[];for(let e=0,r=t.length;e<r;e++){let r=t[e];if(!HP(r)){let e=UF(r);if(e)for(let t=0,r=e.length;t<r;t++){let r=e[t];if(!HP(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=UF(e);return t?Array.from(t):[e]}function pie(e){let t=fie(e),n=t.length;for(let e=0;e<n;e++){let n=t[e];if(!n[vP]){n[vP]=!0;let e=UP(n);(n.nodeType||e)&&(n[yP]=!0,n[bP]=e,n[xP]={})}}return t}var WF={deg:1,rad:180/eF,turn:360},GF={},KF=(e,t,n,r=!1)=>{let i=t.u,a=t.n;if(t.t===hP.UNIT&&i===n)return t;let o=a+i+n,s=GF[o];if(!VP(s)&&!r)t.n=s;else{let r;if(i in WF)r=a*WF[i]/WF[n];else{let t=e.cloneNode(),o=e.parentNode,s=o&&o!==pP?o:pP.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,GF[o]=r}return t.t,hP.UNIT,t.u=n,t},qF=e=>e,JF=(e=1.68)=>t=>JP(t,+e),YF={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},mie=eF/2,XF=eF*2,ZF={"":JF,Quad:JF(2),Cubic:JF(3),Quart:JF(4),Quint:JF(5),Sine:e=>1-ZP(e*mie),Circ:e=>1-YP(1-e*e),Expo:e=>e?JP(2,10*e-10):0,Bounce:e=>{let t,n=4;for(;e<((t=JP(2,--n))-1)/11;);return 1/JP(4,3-n)-7.5625*JP((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=nF(+e,1,10),r=nF(+t,SP,2),i=r/XF*Xre(1/n),a=XF/r;return e=>e===0||e===1?e:-n*JP(2,-10*(1-e))*XP((1-e-i)*a)}},QF=(()=>{let e={linear:qF,none:qF};for(let t in YF)for(let n in ZF){let r=ZF[n],i=YF[t];e[t+n]=n===``||n===`Back`||n===`Elastic`?(e,t)=>i(r(e,t)):i(r)}return e})(),$F={linear:qF,none:qF},hie=e=>{if($F[e])return $F[e];if(e.indexOf(`(`)<=-1){let t=YF[e]||e.includes(`Back`)||e.includes(`Elastic`)?QF[e]():QF[e];return t?$F[e]=t:qF}{let t=e.slice(0,-1).split(`(`),n=QF[t[0]];return n?$F[e]=n(...t[1].split(`,`)):qF}},eI=[`steps(`,`irregular(`,`linear(`,`cubicBezier(`],tI=e=>{if(zP(e)){for(let t=0,n=eI.length;t<n;t++)if(FP(e,eI[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}\``),qF}return BP(e)?e:zP(e)?hie(e):qF},nI=SF(),rI=SF(),iI={},aI={func:null},oI={func:null},sI=[null],cI=[null,null],lI={to:null},gie=0,uI=0,dI,fI,_ie=(e,t)=>{let n={};if(LP(e)){let t=[].concat(...e.map(e=>Object.keys(e))).filter(qP);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];qP(n)?n===i&&(t.to=r):t[n]=r}return t})}}else{let r=hF(t.duration,MP.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(qP(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},vie=class extends die{constructor(e,t,n,r,i=!1,a=0,o){super(t,n,r),this._head,this._tail,++uI;let s=pie(e),c=s.length,l=t.keyframes,u=l?Zre(_ie(l,t),t):t,{id:d,delay:f,duration:p,ease:m,playbackEase:h,modifier:g,composition:_,onRender:v}=u,y=n?n.defaults:MP.defaults,b=hF(m,y.ease),x=hF(h,y.playbackEase),S=x?tI(x):null,C=!VP(b.ease),w=C?b.ease:hF(m,S?`linear`:y.ease),T=C?b.settlingDuration:hF(p,y.duration),E=hF(f,y.delay),D=g||y.modifier,O=VP(_)&&c>=1e3?_P.none:VP(_)?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(qP(e)){let a=vF(t,e),o=pF(t,e),s=rie(e,t,a),f=u[e],p=LP(f);if(i&&!p&&(cI[0]=f,cI[1]=f,f=cI),p){let e=f.length,t=!RP(f[0]);e===2&&t?(lI.to=f,sI[0]=lI,dI=sI):e>2&&t?(dI=[],f.forEach((e,t)=>{t?t===1?(cI[1]=e,dI.push(cI)):dI.push(e):cI[0]=e})):dI=f}else sI[0]=f,dI=sI;let m=null,h=null,g=NaN,_=0,v=0;for(let e=dI.length;v<e;v++){let i=dI[v];RP(i)?fI=i:(lI.to=i,fI=lI),aI.func=null,oI.func=null;let l=_F(hF(fI.composition,O),t,r,c,null,null),u=Wre(l)?l:_P[l];!m&&u!==_P.none&&(m=LF(t,s));let d=m?m._tail:null,f=n&&d&&d.parent.parent===n?d:h,p=_F(fI.to,t,r,c,aI,f),y;RP(p)&&!VP(p.to)?(fI=p,y=p.to):y=p;let b=_F(fI.from,t,r,c,oI,f),x=fI.ease||w,S=_F(x,t,r,c,null,f),C=BP(S)||zP(S)?S:x,A=!VP(C)&&!VP(C.ease),j=A?C.ease:C,P=A?C.settlingDuration:_F(hF(fI.duration,e>1?_F(T,t,r,c,null,f)/e:T),t,r,c,null,f),F=_F(hF(fI.delay,v?0:E),t,r,c,null,f),I=fI.modifier||D,L=!VP(b),R=!VP(y),z=LP(y),ee=z||L&&R,B=h?_:0,V=h?_+F:F,te=rF(k+V,12),ne=rF(k+B,12);!N&&(L||z)&&(N=1);let H=h;if(u!==_P.none){let e=m._head;for(;e&&e._absoluteStartTime<=te;)if(e._isOverridden||(H=e),e=e._nextRep,e&&e._absoluteStartTime>=te)for(;e;)RF(e),e=e._nextRep}if(ee){CF(z?_F(y[0],t,r,c,oI,f):b,nI),CF(z?_F(y[1],t,r,c,aI,f):y,rI);let e=bF(t,s,a,iI);nI.t===hP.NUMBER&&(H?H._valueType===hP.UNIT&&(nI.t=hP.UNIT,nI.u=H._unit):(CF(e,TF),TF.t===hP.UNIT&&(nI.t=hP.UNIT,nI.u=TF.u)))}else R?CF(y,rI):h?wF(h,rI):CF(n&&H&&H.parent.parent===n?H._value:bF(t,s,a,iI),rI),L?CF(b,nI):h?wF(h,nI):CF(n&&H&&H.parent.parent===n?H._value:bF(t,s,a,iI),nI);if(nI.o&&(nI.n=xF(H?H._toNumber:CF(bF(t,s,a,iI),TF).n,nI.n,nI.o)),rI.o&&(rI.n=xF(nI.n,rI.n,rI.o)),nI.t!==rI.t){if(nI.t===hP.COMPLEX||rI.t===hP.COMPLEX){let e=nI.t===hP.COMPLEX?nI:rI,t=nI.t===hP.COMPLEX?rI:nI;t.t=hP.COMPLEX,t.s=sF(e.s),t.d=e.d.map(()=>t.n)}else if(nI.t===hP.UNIT||rI.t===hP.UNIT){let e=nI.t===hP.UNIT?nI:rI,t=nI.t===hP.UNIT?rI:nI;t.t=hP.UNIT,t.u=e.u}else if(nI.t===hP.COLOR||rI.t===hP.COLOR){let e=nI.t===hP.COLOR?nI:rI,t=nI.t===hP.COLOR?rI:nI;t.t=hP.COLOR,t.d=e.d.map(()=>0)}}if(nI.u!==rI.u){let e=rI.u?nI:rI;e=KF(t,e,rI.u?rI.u:nI.u,!1)}if(rI.d&&nI.d&&rI.d.length!==nI.d.length){let e=nI.d.length>rI.d.length?nI:rI,t=e===nI?rI:nI;t.d=e.d.map((e,n)=>VP(t.d[n])?0:t.d[n]),t.s=sF(e.s)}let U=rF(+P||1e-11,12),re=iI[s];HP(re)||(iI[s]=null);let ie=o?o.set:null;_=rF(V+U,12);let ae=nI.d,oe=rI.d,se=rI.s,W={parent:this,id:gie++,property:s,target:t,_value:null,_toFunc:aI.func,_fromFunc:oI.func,_ease:tI(j),_fromNumbers:ae?sF(ae):TP,_toNumbers:oe?sF(oe):TP,_strings:se?sF(se):TP,_fromNumber:nI.n,_toNumber:rI.n,_numbers:ae?sF(ae):TP,_number:nI.n,_unit:rI.u,_modifier:I,_currentTime:0,_startTime:V,_delay:+F,_updateDuration:U,_changeDuration:U,_absoluteStartTime:te,_absoluteUpdateStartTime:ne,_absoluteEndTime:rF(k+_,12),_hasFromValue:L||z?1:0,_tweenType:a,_setter:ie,_valueType:rI.t,_composition:u,_isOverlapped:0,_isOverridden:0,_renderTransforms:0,_inlineValue:re,_prevRep:null,_nextRep:null,_prevAdd:null,_nextAdd:null,_prev:null,_next:null};u!==_P.none&&zF(W,m);let G=W._valueType;if(G===hP.COMPLEX)W._value=EF(W,1,-1);else if(G===hP.UNIT)W._value=`${I(W._toNumber)}${W._unit}`;else if(G===hP.COLOR){let e=rI.d;W._value=`rgba(${rF(e[0],0)},${rF(e[1],0)},${rF(e[2],0)},${e[3]})`}else W._value=I(W._toNumber);isNaN(g)&&(g=W._startTime),h=W,M++,uF(this,W)}(isNaN(j)||g<j)&&(j=g),(isNaN(A)||_>A)&&(A=_),a===mP.TRANSFORM&&(l=M-v,d=M)}if(!isNaN(l)){let e=0;cF(this,t=>{e>=l&&e<d&&(t._renderTransforms=1,t._composition===_P.blend&&cF(MF.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?(cF(this,e=>{e._startTime-e._delay||(e._delay-=j),e._startTime-=j}),A-=j):j=0,A||(A=SP,this.iterationCount=0),this.targets=s,this.id=VP(d)?uI:d,this.duration=A===1e-11?SP:aF((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===oF(e))return this;let n=e/t;return cF(this,e=>{e._updateDuration=oF(e._updateDuration*n),e._changeDuration=oF(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 cF(this,e=>{let t=e._toFunc,n=e._fromFunc;(t||n)&&(n?(CF(n(),nI),nI.u!==e._unit&&e.target[yP]&&KF(e.target,nI,e._unit,!0),e._fromNumbers=sF(nI.d),e._fromNumber=nI.n):t&&(CF(bF(e.target,e.property,e._tweenType),TF),e._fromNumbers=sF(TF.d),e._fromNumber=TF.n),t&&(CF(t(),rI),e._toNumbers=sF(rI.d),e._strings=sF(rI.s),e._toNumber=rI.o?xF(e._fromNumber,rI.n,rI.o):rI.n))}),this.duration===1e-11&&this.restart(),this}revert(){return super.revert(),AF(this)}then(e){return super.then(e)}},pI=(e,t)=>MP.editor?MP.editor.addAnimation(e,t):new vie(e,t,null,0,!1).init(),mI=wP*10,yie=class{constructor(e={}){let t=!VP(e.bounce)||!VP(e.duration);this.timeStep=.02,this.restThreshold=5e-4,this.restDuration=200,this.maxDuration=6e4,this.maxRestSteps=this.restDuration/this.timeStep/wP,this.maxIterations=this.maxDuration/this.timeStep/wP,this.bn=nF(hF(e.bounce,.5),-1,1),this.pd=nF(hF(e.duration,628),10*MP.timeScale,mI*MP.timeScale),this.m=nF(hF(e.mass,1),1,mI),this.s=nF(hF(e.stiffness,100),SP,mI),this.d=nF(hF(e.damping,10),SP,mI),this.v=nF(hF(e.velocity,0),-mI,mI),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||OP,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?QP(-a*t*n)*(1*ZP(r*a)+i*XP(r*a)):t===1?(1+i*a)*QP(-a*n):((1+i)*QP((-t*n+r)*a)+(1-i)*QP((-t*n-r)*a))/2,1-a}calculateSDFromBD(){let e=MP.timeScale===1?this.pd/wP:this.pd;this.m=1,this.v=0,this.s=JP(2*eF/e,2),this.d=this.bn>=0?(1-this.bn)*4*eF/e:4*eF/(e*(1+this.bn)),this.s=rF(nF(this.s,SP,mI),3),this.d=rF(nF(this.d,SP,300),3)}calculateBDFromSD(){let e=2*eF/YP(this.s);this.pd=e*(MP.timeScale===1?wP:1),this.bn=this.d/(2*YP(this.s))<=1?1-this.d*e/(4*eF):4*eF/(this.d*e)-1,this.bn=rF(nF(this.bn,-1,1),3),this.pd=rF(nF(this.pd,10*MP.timeScale,mI*MP.timeScale),3)}compute(){let{maxRestSteps:e,maxIterations:t,restThreshold:n,timeStep:r,m:i,d:a,s:o,v:s}=this,c=this.w0=nF(YP(o/i),SP,wP),l=this.zeta=a/(2*YP(o*i));l<1?(this.wd=c*YP(1-l*l),this.b=(l*c+-s)/this.wd):l===1?(this.wd=0,this.b=-s+c):(this.wd=c*YP(l*l-1),this.b=(l*c+-s)/this.wd);let u=0,d=0,f=0;for(;d<=e&&f<=t;)Jre(1-this.solve(u))<n?d++:d=0,this.solverDuration=u,u+=r,f++;this.settlingDuration=rF(this.solverDuration*wP,0)*MP.timeScale}get bounce(){return this.bn}set bounce(e){this.bn=nF(hF(e,1),-1,1),this.calculateSDFromBD(),this.compute()}get duration(){return this.pd}set duration(e){this.pd=nF(hF(e,1),10*MP.timeScale,mI*MP.timeScale),this.calculateSDFromBD(),this.compute()}get stiffness(){return this.s}set stiffness(e){this.s=nF(hF(e,100),SP,mI),this.calculateBDFromSD(),this.compute()}get damping(){return this.d}set damping(e){this.d=nF(hF(e,10),SP,mI),this.calculateBDFromSD(),this.compute()}get mass(){return this.m}set mass(e){this.m=nF(hF(e,1),1,mI),this.compute()}get velocity(){return this.v}set velocity(e){this.v=nF(hF(e,0),-mI,mI),this.compute()}},hI=e=>new yie(e),gI=(e=10,t)=>{let n=t?Yre:$P;return t=>n(nF(t,0,1)*e)*(1/e)},bie=s({animate:()=>pI,spring:()=>hI}),_I=(0,K.forwardRef)(function({id:e,transform:t},n){return(0,X.jsxs)(`radialGradient`,{ref:n,id:e,gradientUnits:`userSpaceOnUse`,cx:`-1.2`,cy:`-1.6`,r:`5.6`,gradientTransform:t,children:[(0,X.jsx)(`stop`,{offset:`0`,stopColor:`color-mix(in oklab, var(--color-white) calc(var(--depth) * 50%), currentColor)`}),(0,X.jsx)(`stop`,{offset:`1`,stopColor:`currentColor`})]})});function vI({id:e}){return(0,X.jsx)(`filter`,{id:e,x:`-50%`,y:`-50%`,width:`200%`,height:`200%`,children:(0,X.jsx)(`feDropShadow`,{dx:`0`,dy:`1.5`,stdDeviation:`1`,floodColor:`currentColor`,style:{floodOpacity:`calc(var(--depth) * 0.6)`}})})}function yI({id:e}){return(0,X.jsxs)(`filter`,{id:e,x:`-10%`,y:`-10%`,width:`120%`,height:`120%`,colorInterpolationFilters:`sRGB`,children:[(0,X.jsx)(`feGaussianBlur`,{in:`SourceAlpha`,stdDeviation:`0.3`,result:`soft-edge`}),(0,X.jsx)(`feOffset`,{in:`soft-edge`,dx:`0.25`,dy:`0.45`,result:`lower-edge`}),(0,X.jsx)(`feComposite`,{in:`SourceAlpha`,in2:`lower-edge`,operator:`out`,result:`inner-shadow`}),(0,X.jsx)(`feFlood`,{floodColor:`var(--color-black)`,floodOpacity:`calc(var(--depth) * 0.28)`}),(0,X.jsx)(`feComposite`,{in2:`inner-shadow`,operator:`in`,result:`shade`}),(0,X.jsx)(`feOffset`,{in:`soft-edge`,dx:`-0.2`,dy:`-0.35`,result:`upper-edge`}),(0,X.jsx)(`feComposite`,{in:`SourceAlpha`,in2:`upper-edge`,operator:`out`,result:`inner-highlight`}),(0,X.jsx)(`feFlood`,{floodColor:`var(--color-white)`,floodOpacity:`calc(var(--depth) * 0.7)`}),(0,X.jsx)(`feComposite`,{in2:`inner-highlight`,operator:`in`,result:`highlight`}),(0,X.jsxs)(`feMerge`,{children:[(0,X.jsx)(`feMergeNode`,{in:`SourceGraphic`}),(0,X.jsx)(`feMergeNode`,{in:`shade`}),(0,X.jsx)(`feMergeNode`,{in:`highlight`})]})]})}var bI=Object.freeze({alphaIntercept:-8,alphaSlope:18,blurStdDeviation:2});function xI({id:e,values:t=TM}){return(0,X.jsxs)(`filter`,{id:e,x:`-50%`,y:`-50%`,width:`200%`,height:`200%`,children:[(0,X.jsx)(`feGaussianBlur`,{in:`SourceGraphic`,stdDeviation:t.blurStdDeviation,result:`blur`}),(0,X.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,X.jsx)(`feComposite`,{in:`SourceGraphic`,in2:`gooey`,operator:`atop`})]})}function SI(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 CI(e){let t=Math.max(0,Math.min(1,e));return t*t*(3-2*t)}function wI(e,t){let n=Math.max(0,Math.min(1,(t-(e-1)*.085)/.68));return Math.sin(n*Math.PI)**2}function TI(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=CI(n/.66)*Math.PI*2,o=Math.min(e,t*Math.PI/8)-Math.PI/2,s=CI((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+wI(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=wI(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 xie={line:1700,square:1900,donut:3e3,wander:4600,bloom:2800};function Sie({variant:e}){let t=`caps-loader-${(0,K.useId)().replaceAll(`:`,``)}`,n=(0,K.useRef)(null),r=(0,K.useRef)(null),i=iP(r),{reduced:a}=i,o=e===`donut`?16:e===`bloom`?5:e===`square`?4:3;return(0,K.useLayoutEffect)(()=>{if(a||!n.current||!r.current)return;let t=[...n.current.querySelectorAll(`ellipse`)].map((t,n)=>pI(t,{keyframes:Array.from({length:48},(t,r)=>({...TI(e,n,(r+1)/48),duration:aP(i,xie[e])/48})),ease:`linear`,loop:!0})),o=SI(r.current,e=>{for(let n of t)e?n.resume():n.pause()});return()=>{o();for(let e of t)e.revert()}},[e,a,i]),(0,X.jsxs)(`svg`,{ref:r,"aria-hidden":`true`,focusable:`false`,viewBox:e===`line`?`-20 -10 40 20`:`-20 -20 40 40`,children:[(0,X.jsxs)(`defs`,{children:[(0,X.jsx)(xI,{id:t,values:bI}),(0,X.jsx)(_I,{id:`${t}-surface`,transform:e===`line`?`matrix(3.4 0 0 1.4 0 0)`:`matrix(3 0 0 3 0 0)`}),(0,X.jsx)(vI,{id:`${t}-shadow`}),(0,X.jsx)(`mask`,{id:`${t}-mask`,maskUnits:`userSpaceOnUse`,x:`-20`,y:`-20`,width:`40`,height:`40`,style:{maskType:`alpha`},children:(0,X.jsx)(`g`,{ref:n,fill:`currentColor`,filter:`url(#${t})`,children:Array.from({length:o},(t,n)=>(0,X.jsx)(`ellipse`,{...TI(e,n,0)},n))})})]}),(0,X.jsx)(`g`,{filter:`url(#${t}-shadow)`,children:(0,X.jsx)(`rect`,{x:`-20`,y:`-20`,width:`40`,height:`40`,fill:`url(#${t}-surface)`,mask:`url(#${t}-mask)`})})]})}var Cie={sm:`caps-loader-sm`,md:`caps-loader-md`,lg:`caps-loader-lg`,fill:`caps-loader-fill`},wie={neutral:`text-base-content`,accent:`text-accent`,primary:`text-primary`,success:`text-success`},EI=(0,K.forwardRef)(function({"aria-label":e,"aria-labelledby":t,className:n,decorative:r=!1,label:i=`Loading`,size:a=`md`,variant:o=`line`,tone:s=`neutral`,...c},l){let u=`${(0,K.useId)()}-label`,d=!r&&e===void 0&&t===void 0;return(0,X.jsxs)(`span`,{...c,"aria-label":r?void 0:e,"aria-hidden":r||void 0,"aria-labelledby":r?void 0:t??(e===void 0?u:void 0),className:Z(`caps-loader`,Cie[a],wie[s],n),"data-variant":o,role:r?void 0:`status`,ref:l,children:[(0,X.jsx)(Sie,{variant:o}),d?(0,X.jsx)(uP,{id:u,children:i}):null]})}),DI=`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`,Tie=jM(`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 ${DI}`,ghost:`btn-ghost`,"ghost-destructive":`btn-ghost caps-button-ghost-destructive`,link:`btn-link ${DI}`},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`}}),OI=(0,K.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=Z(Tie({size:c,variant:l}),n),p=(0,K.useRef)(a).current,m=(0,K.useRef)(null);return(0,K.useImperativeHandle)(d,()=>m.current),Eie(m,i,a),e?(0,X.jsx)(QN,{...u,"aria-busy":i?!0:u[`aria-busy`],"aria-disabled":r===!0||i?!0:void 0,className:f,ref:m,children:t}):(0,X.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,X.jsxs)(X.Fragment,{children:[i?(0,X.jsx)(EI,{className:`size-3`,decorative:!0,size:`sm`}):null,t]}):(0,X.jsx)(Aie,{label:o,loading:i,onResultEnd:s,result:a,settled:p,children:t})})});function Eie(e,t,n){let r=(0,K.useRef)(null),i=(0,K.useRef)(null),a=(0,K.useRef)(null);(0,K.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||!sP(o))return;let f=rP(o);if(f.reduced)return;let p=o.animate([{width:`${String(u)}px`},{width:`${String(d)}px`}],{duration:f.normal,easing:oP(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 Die=1100;function Oie(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:oP(t,`ease-out`)})}function kie(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:oP(t,`linear`)})}function kI(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:oP(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:oP(n,n.ease),fill:`backwards`})]}function Aie({children:e,label:t,loading:n,onResultEnd:r,result:i,settled:a}){let o=(0,K.useRef)(null),s=lP(),[c,l]=(0,K.useState)(!1),[u,d]=(0,K.useState)(!1);c&&!u&&d(!0);let f=(0,K.useRef)(a),p=(0,K.useRef)(r);(0,K.useEffect)(()=>{p.current=r},[r]),(0,K.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)},Die);return()=>{clearTimeout(e)}}l(!1);let t=o.current;if(i!==`failed`||!t||!sP(t))return;let n=rP(t);if(n.shake<=0)return;let r=kie(t,n);return()=>{r.cancel()}},[i,s]);let m=(0,K.useRef)(c);return(0,K.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||!sP(e)){c||d(!1);return}let r=rP(e),i=c?kI(t,n,r):kI(n,t,r);if(c||i[0]?.addEventListener(`finish`,()=>{d(!1)}),c&&!r.reduced){i.push(Oie(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:oP(r,r.ease),fill:`backwards`}))}return()=>{for(let e of i)e.cancel()}},[c,s]),(0,X.jsxs)(`span`,{ref:o,className:`caps-button-faces`,"data-showing":c?`result`:`label`,children:[(0,X.jsxs)(`span`,{className:`caps-button-face`,"data-face":`label`,"aria-hidden":c?!0:void 0,children:[n||c?(0,X.jsx)(EI,{className:`size-3`,decorative:!0,size:`sm`}):null,e]}),u?(0,X.jsxs)(`span`,{className:`caps-button-face`,"data-face":`result`,"aria-hidden":!c||void 0,children:[(0,X.jsx)(`svg`,{className:`caps-button-check`,viewBox:`0 0 24 24`,"aria-hidden":`true`,focusable:`false`,children:(0,X.jsx)(`path`,{d:`M4.5 12.5 9.5 17.5 19.5 6.5`,pathLength:1})}),t===void 0?e:t]}):null]})}var jie={xs:`size-3`,sm:`size-[var(--stipe-icon-size-sm)]`,md:`size-[var(--stipe-icon-size-md)]`,lg:`size-[var(--stipe-icon-size-lg)]`},AI=(0,K.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,X.jsx)(OI,{...c,resultLabel:c.result===void 0?void 0:null,ref:l,size:u?`sm`:a,variant:s,className:Z(`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,X.jsx)(`span`,{"aria-hidden":`true`,className:Z(`inline-flex shrink-0 [&>svg]:size-full [&>svg]:[stroke-width:var(--stipe-icon-stroke)]`,jie[n]),children:t})})}),jI=(0,K.forwardRef)(function({className:e,size:t=`md`,depth:n=`shallow`,placement:r=`standalone`,...i},a){return(0,X.jsx)(`div`,{...i,ref:a,"data-surface-size":t,"data-surface-depth":n,"data-surface-placement":r,className:Z(`caps-surface`,e)})}),MI=(0,K.forwardRef)(function({className:e,...t},n){return(0,X.jsx)(`div`,{...t,ref:n,className:Z(`caps-screen`,e)})});(0,K.forwardRef)(function({children:e,className:t,depth:n=`deep`,fit:r=`content`,density:i=`normal`,...a},o){let s=r===`fill`;return(0,X.jsx)(jI,{...a,className:Z(t,s&&`flex min-h-0 flex-1`),depth:n,ref:o,children:(0,X.jsx)(`div`,{className:Z(`caps-display-gasket`,s&&`flex min-h-0 min-w-0 flex-1`),"data-display-density":i,children:(0,X.jsx)(MI,{className:Z(s&&`flex min-h-0 min-w-0 flex-1 overflow-hidden`),children:e})})})}),(0,K.forwardRef)(function({className:e,icon:t,status:n,title:r,...i},a){return(0,X.jsxs)(`header`,{...i,className:Z(`caps-screen-header`,e),ref:a,children:[t?(0,X.jsx)(`span`,{className:`caps-screen-header-icon`,"aria-hidden":`true`,children:t}):null,(0,X.jsx)(`span`,{className:`caps-screen-header-title`,children:r}),n?(0,X.jsx)(`span`,{className:`caps-screen-header-status`,children:n}):null]})}),(0,K.forwardRef)(function({appearance:e,className:t,...n},r){return(0,X.jsx)(`div`,{...n,className:Z(`caps-screen-cells`,t),"data-appearance":e===`compact`?e:void 0,ref:r})}),(0,K.forwardRef)(function({children:e,className:t,legend:n,readout:r,icon:i,appearance:a,wide:o=!1,...s},c){return(0,X.jsxs)(`div`,{...s,className:Z(`caps-screen-cell`,t),"data-wide":o||void 0,"data-appearance":a===`compact`?a:void 0,ref:c,children:[i?(0,X.jsx)(`span`,{className:`caps-screen-cell-icon`,children:i}):null,n?(0,X.jsx)(`span`,{className:`caps-screen-cell-legend`,children:n}):null,r?(0,X.jsx)(`span`,{className:`caps-screen-cell-readout`,children:r}):null,a===`compact`?(0,X.jsx)(`div`,{className:`caps-screen-cell-controls`,children:e}):e]})});var Mie=(0,K.forwardRef)(function({className:e,density:t=`regular`,...n},r){return(0,X.jsx)(`ul`,{...n,className:Z(`list`,t===`compact`&&`list-sm`,e),ref:r})}),Nie=(0,K.forwardRef)(function({className:e,...t},n){return(0,X.jsx)(`li`,{...t,className:Z(`list-row`,e),ref:n})}),NI=(0,K.forwardRef)(function({aside:e,children:t,className:n,level:r=2,...i},a){return(0,X.jsxs)(r===3?`h3`:`h2`,{...i,className:Z(`caps-data-list-heading`,n),ref:a,children:[(0,X.jsx)(`span`,{children:t}),e===void 0?null:(0,X.jsx)(`span`,{className:`caps-data-list-heading-aside`,children:e})]})}),PI={coral:`var(--stipe-art-coral, #ff6558)`,blue:`var(--stipe-art-blue, #43a6f2)`,mint:`var(--stipe-art-mint, #63cfaa)`,grape:`var(--stipe-art-grape, #a66cc1)`,yellow:`var(--stipe-art-yellow, #ffd05d)`,cream:`var(--stipe-art-cream, #fff4de)`,ink:`var(--stipe-art-ink, #242c28)`,graphite:`var(--stipe-art-graphite, #49423f)`,inkcap:`var(--stipe-art-inkcap, #80499d)`},FI=`light-dark(var(--stipe-sketch-ink, #242c28), var(--stipe-art-cream, #fff4de))`,Pie=`var(--color-base-100, light-dark(#fff4de, #242c28))`;function II({transform:e,fill:t=FI}){return(0,X.jsx)(`path`,{transform:e,style:{fill:t},d:`M-1.264-9.479C-2.098-8.643-1.802-1.057-.907-.332.47.782 1.6-.446 1.618-3.075 1.623-3.888 1.691-5.398 1.77-6.429 1.979-9.202 1.596-10 .055-10-.588-10-.843-9.9-1.264-9.479Z`})}function Fie(){return(0,X.jsxs)(`g`,{children:[(0,X.jsx)(II,{transform:`translate(25.4 19.8) rotate(-39) scale(.95 .76)`}),(0,X.jsx)(II,{transform:`translate(32.1 17.8) scale(.96 .95)`}),(0,X.jsx)(II,{transform:`translate(38.8 19.9) rotate(39) scale(.95 .77)`})]})}function Iie(){return(0,X.jsxs)(`g`,{style:{fill:PI.blue},children:[(0,X.jsx)(`path`,{d:`M10.574 .604C9.804 1.375 9.867-.885 9.961 22.81 10.054 47.202 9.722 45.378 14.193 45.94 25.813 47.399 38.465 52.211 44.662 57.532 47.653 60.097 48.082 59.411 47.967 52.242L47.734 19.335C47.734 17.523 47.13 16.616 45.964 15.076 40.604 8.018 30.127 2.767 16.804 .462 13.045-.184 11.326-.148 10.574 .604Z`}),(0,X.jsx)(`path`,{d:`M81.571 .746C71.063 2.665 62.221 6.713 56.562 12.199 54.242 14.45 52 17.356 52.115 19.335L52.033 52.628C51.927 59.934 51.979 59.994 55.74 57.091 62.423 51.931 71.272 48.541 84.103 46.221 90.625 45.039 89.967 47.631 90.145 22.432 90.326-3.079 91.148-1 81.571 .746Z`}),(0,X.jsx)(`path`,{d:`M1.906 12.692C.1 13.42 .151 12.804 .151 33.825 .151 54.097 .163 54.302 1.447 55.498 2.71 56.674 3.384 56.81 7.937 56.816 20.943 56.834 30.647 58.293 38.776 61.45 45.964 64.242 46.435 61.924 39.526 57.773 32.296 53.429 26.656 51.544 14.943 49.553 5.958 48.027 6.535 49.414 6.408 29.003 6.32 14.74 6.263 13.103 5.816 12.764 5.254 12.335 2.9 12.293 1.906 12.692Z`}),(0,X.jsx)(`path`,{d:`M94.326 12.858C93.656 13.326 93.656 13.326 93.653 28.492 93.653 48.882 93.997 48.063 84.743 49.556 73.574 51.36 64.45 54.695 57.801 59.405 54.082 62.039 55.384 63.864 59.722 62.1 68.897 58.372 76.363 57.115 90.03 56.994 100.405 56.903 99.489 58.976 99.773 34.976 100.018 14.142 100.006 13.958 98.399 12.979 97.236 12.269 95.251 12.208 94.326 12.858Z`})]})}function LI(){return(0,X.jsxs)(`g`,{children:[(0,X.jsx)(`path`,{style:{fill:PI.cream},d:`M-8.572-25.123C-21.412-23.39-33.235-17.39-44.235-7.027-51.235-.433-51.251 .358-44.524 6.749-20.77 29.316 10.23 31.893 36.364 13.487 41.043 10.187 48.193 3.551 49.235 1.524 50.358-.642 49.471-2.102 43.738-7.497 29.257-21.128 9.968-27.631-8.572-25.123Z`}),(0,X.jsx)(`path`,{style:{fill:PI.ink},d:`M-6.225-16.807C-17.727-13.267-21.176 4.433-12.08 13.257-1.118 23.898 16.829 16.102 17.032 .604 17.209-12.412 6.219-20.642-6.225-16.807Z`})]})}function Lie(){return(0,X.jsxs)(`g`,{children:[(0,X.jsx)(`path`,{style:{fill:PI.mint},d:`M540 342C520 340 497 355 477 374C450 399 440 421 456 444C465 458 480 462 492 464C503 466 500 477 494 486C487 500 508 496 522 478L530 468C557 468 578 464 591 451C601 442 599 429 585 427C572 425 556 432 547 418C538 403 550 390 568 385C579 382 589 380 584 368C576 352 557 341 540 342Z`}),(0,X.jsx)(`path`,{style:{fill:PI.coral},d:`M589 396C614 380 659 381 683 392C709 404 721 428 710 451C704 464 693 472 685 479C680 487 684 498 689 503C695 514 684 513 675 507C667 502 662 497 657 491C637 496 610 495 594 486C584 480 583 469 595 464C607 460 622 454 622 441C622 428 612 423 597 420C580 417 578 407 589 396Z`})]})}function RI({fill:e}){return(0,X.jsx)(`path`,{style:{fill:e},d:`M44.648 .288C26.645 1.615 13.263 8.266 5.942 19.529-4.299 35.277-.917 57.684 13.224 67.784 16.958 70.452 16.936 71.742 13.064 77.665 11.28 80.391 10.895 81.565 11.341 82.914 13.163 88.435 25.022 86.396 36.307 78.62L38.681 76.986 41.294 77.335C45.371 77.878 59.645 77.789 64.125 77.191 89.213 73.837 100.562 61.427 99.92 38.044 99.18 11.1 79.587-2.285 44.648 .288Z`})}function zI({onFigure:e=!1}){return(0,X.jsxs)(`g`,{style:{fill:e?Pie:PI.ink},children:[(0,X.jsx)(`rect`,{x:`-15`,y:`-11`,width:`10`,height:`22`,rx:`5`}),(0,X.jsx)(`rect`,{x:`5`,y:`-11`,width:`10`,height:`22`,rx:`5`})]})}function Rie(){return(0,X.jsx)(`path`,{style:{fill:PI.cream},d:`M18.125 .621C.039 1.574-2.575 4.791 2.264 20.133 17.454 68.284 77.345 69.396 96.119 21.875 100.749 10.154 100.318 4.348 94.605 1.513 91.981 .21 37.878-.421 18.125 .621Z`})}function zie(){return(0,X.jsxs)(`g`,{children:[(0,X.jsx)(`path`,{style:{fill:PI.yellow},d:`M31.42 5.279C29.108 5.983 28.068 6.993 25.817 10.732 24.033 13.687 24.027 13.762 25.58 14.265 30.375 15.821 36.711 20.506 39.938 24.885 42.077 27.788 41.835 27.806 45.281 24.463 48.633 21.213 49.164 20.185 48.982 17.325 48.812 14.643 48.174 13.872 42.68 9.741 36.737 5.273 34.439 4.361 31.42 5.279Z`}),(0,X.jsx)(`path`,{style:{fill:PI.yellow},d:`M22.538 16.207C22.093 16.652 19.732 20.231 13.309 30.196 10.737 34.188 10.723 33.911 13.589 35.351 16.461 36.798 19.778 39.28 21.825 41.523L22.6 42.37Q23.34 43.186 24.05 42.538L24.711 41.933C31.278 35.937 38.928 28.484 38.928 28.083 38.928 24.656 24.521 14.219 22.538 16.207Z`}),(0,X.jsx)(`path`,{style:{fill:PI.cream},d:`M8.89 38.053C8.203 39.566 6.598 44.473 6.598 45.056 6.598 45.137 6.887 45.125 7.236 45.036 9.655 44.404 13.526 47.475 13.526 50.027 13.526 51.132 13.361 51.164 16.187 49.49 21.421 46.387 21.966 45.665 20.575 43.659 19.002 41.387 14.975 38.238 11.909 36.881 9.799 35.949 9.854 35.926 8.89 38.053Z`}),(0,X.jsx)(`path`,{style:{fill:PI.graphite},d:`M6.598 45.056C5.732 46.866 5.155 49.464 6.309 50.907 8.041 53.505 10.928 52.639 13.526 50.907 13.526 48.021 9.978 44.404 7.236 45.036Z`})]})}function Bie(){return(0,X.jsx)(`path`,{style:{fill:PI.coral},d:`M40.804 40.625C38.238 41.462 37.291 41.953 31.169 45.625 15.743 54.871 8.047 56.158 5.879 49.856 5.501 48.754 5.501 48.754 4.843 50.913 1.673 61.302 12.377 61.671 30.386 51.796 39.649 46.719 41.142 46.647 40.81 51.291 40.565 54.775 41.168 56.135 43.486 57.31 49.556 60.387 62.035 54.816 59.605 50.116 58.502 47.983 56.1 47.882 52.163 49.799 47.082 52.273 45.983 51.652 47.998 47.449 50.89 41.416 47.686 38.376 40.804 40.625Z`})}function BI({transform:e}){return(0,X.jsx)(`path`,{style:{fill:PI.mint},transform:e,d:`M0 0C3 -2 5 -5 5 -8 5 -10.5 3 -12 0 -12S-5 -10.5 -5 -8C-5 -5 -3 -2 0 0Z`})}function Vie(){return(0,X.jsxs)(`g`,{children:[(0,X.jsx)(`path`,{fillRule:`evenodd`,style:{fill:FI},d:`M25.3 17.69C14.8 19.34 10.66 20.18 9.05 20.99 5.51 22.78 4.2 27.21 6.71 28.9 7.47 29.42 8.48 29.4 10.25 28.84 12.41 28.15 12.56 27.57 11.02 25.85 10 24.71 10.53 23.62 11.79 24.27 13.9 25.36 15.02 28.98 15.63 36.66 16.18 43.48 17.33 47.43 19.69 50.49 22.76 54.48 27.69 55.73 30.31 53.19 33 50.57 31.24 46.04 28.44 48.38 26.29 50.17 26.16 47.08 28.3 45.14 29.61 43.95 30.78 43.58 38.92 41.75 39.45 41.63 39.41 41.52 38.39 40.01 36.87 37.78 36.04 35.22 34.72 28.69 33.37 22 32.04 19.3 29.5 18.07 28.69 17.68 26.59 17.49 25.3 17.69M24.11 26.51C18.61 27.67 18.16 27.82 17.98 28.55 17.64 29.91 18.54 30.44 20.51 30.05 25.4 29.08 30.11 28.03 30.49 27.83 31.65 27.23 31 25.33 29.66 25.4 29.5 25.4 27 25.91 24.11 26.51M29.2 31.42C28.64 31.54 26.23 32.07 23.85 32.58 20.01 33.41 19.48 33.57 19.15 33.96 18.67 34.5 18.66 35.05 19.12 35.63 19.61 36.26 19.86 36.23 26.05 34.88 29.05 34.23 31.53 33.7 31.57 33.7 31.82 33.7 32.34 32.88 32.34 32.5 32.34 31.25 31.37 30.92 29.2 31.42M29.79 37.19C28.81 37.41 26.45 37.94 24.53 38.37 22.62 38.8 20.84 39.23 20.58 39.33 19.61 39.71 19.35 40.62 19.98 41.41 20.48 42.05 21 41.99 27.59 40.5 33.85 39.09 34.21 38.91 33.45 37.44 33.02 36.61 32.51 36.58 29.79 37.19M45.41 41.95C44.89 42.09 41.61 42.89 38.12 43.73 30.94 45.45 29.81 45.84 31.05 46.15 33.2 46.69 34.11 50.18 32.77 52.76 32.23 53.79 32.23 54.03 32.76 54.16 33.34 54.31 45.35 51.3 46.72 50.67 50.19 49.06 51.76 45.01 49.79 42.76 48.8 41.64 47.46 41.39 45.41 41.95`}),(0,X.jsx)(`path`,{style:{fill:PI.grape},d:`M48.21 10.15C47.92 10.41 47.5 11.27 46.96 12.74 45.52 16.61 45.24 16.99 43.01 18.15 39.18 20.15 39.05 20.99 42.28 22.73 45.37 24.39 45.68 24.79 47.12 28.95 48.3 32.32 49.28 32.2 50.65 28.52 52.23 24.25 52.26 24.22 55.2 22.56 57.53 21.24 57.79 21 57.79 20.16 57.79 19.49 57.55 19.31 55.01 18.06 52.16 16.66 52.2 16.72 50.31 11.56 49.7 9.89 49.03 9.44 48.21 10.15M32.59 13.92C31.78 14.73 32.28 15.89 33.58 16.22 35.07 16.6 36.19 17.1 37.17 17.84 38.42 18.77 39.23 18.86 39.79 18.15 39.99 17.9 40.15 17.53 40.15 17.32 40.15 15.29 33.99 12.52 32.59 13.92M42.48 34.38C40.96 35.96 40.65 36.88 41.39 37.57 42.2 38.33 43.36 37.74 44.55 35.95 45.2 34.97 45.22 34.35 44.62 33.88 43.89 33.31 43.41 33.42 42.48 34.38`}),(0,X.jsx)(`path`,{style:{fill:PI.yellow},d:`M40.75 25.96C39.69 27.07 38.11 30.69 38.11 31.98 38.11 32.66 38.55 33.19 39.12 33.19 39.8 33.19 40.24 32.73 40.58 31.66 40.95 30.46 41.65 29.09 42.42 28.01 43.77 26.14 42.29 24.32 40.75 25.96M54.85 27.67C54.71 27.81 54.47 28.32 54.31 28.82 53.67 30.76 53.19 31.37 51.67 32.13 50.25 32.85 50.34 33.36 52.04 34.21 53.25 34.82 53.57 35.23 54.24 37.01 54.98 38.98 55.47 39.08 56.03 37.37 56.7 35.32 57.08 34.81 58.64 33.87 60.18 32.95 60.14 32.65 58.38 31.78 57.02 31.11 56.68 30.66 56.02 28.65 55.69 27.64 55.25 27.27 54.85 27.67`})]})}function Hie(){return(0,X.jsxs)(`g`,{children:[(0,X.jsx)(`path`,{fillRule:`evenodd`,style:{fill:FI},d:`M42.24 14.07C41.52 14.24 40.53 14.54 35.06 16.26 33.33 16.8 31.2 17.47 30.34 17.74 29.47 18.01 27.86 18.52 26.75 18.88 25.64 19.23 24.03 19.74 23.16 20.01 20.16 20.94 19.45 21.4 18.97 22.71 18.71 23.44 18.45 26.33 17.83 35.41 17.64 38.25 17.44 41.03 17.41 41.58 17.32 42.77 17.24 42.69 18.79 42.84L20.01 42.95 21.98 39.97C24.69 35.88 24.85 35.82 27.05 37.9 27.9 38.7 28.43 39.08 28.61 39.02 28.76 38.96 28.91 38.91 28.94 38.91 28.98 38.91 29.38 38.38 29.84 37.73 30.3 37.08 31.47 35.48 32.43 34.17 33.4 32.86 34.86 30.85 35.67 29.71 36.49 28.56 37.5 27.29 37.91 26.88 39.73 25.07 41.01 26.43 43.32 32.67 43.76 33.84 44.3 35.28 44.52 35.86 44.74 36.44 44.97 37.28 45.04 37.74 45.19 38.71 45.17 38.71 46.63 38.03 47.69 37.53 47.77 37.46 47.68 37.02 47.58 36.52 46.97 30.64 46.79 28.41 46.73 27.69 46.62 26.43 46.53 25.61 46.44 24.79 46.24 22.87 46.09 21.32 45.61 16.44 45.5 15.66 45.22 15.12 44.72 14.15 43.59 13.76 42.24 14.07M29.38 22.45C26.04 23.47 24.49 27.62 26.6 29.91 29.17 32.7 34.15 30.16 34.16 26.05 34.16 23.38 31.9 21.68 29.38 22.45M46.7 41.5C39.3 44.23 28.33 46.04 20.1 45.88L17.21 45.82 17.16 46.88C17.08 48.22 17.33 49.03 18.01 49.68 18.73 50.37 19.73 50.35 23.77 49.53 25.46 49.19 29.12 48.47 31.91 47.93 46.31 45.14 46.9 44.99 47.57 43.91 47.95 43.3 48.25 41.29 47.99 41.15 47.91 41.11 47.33 41.26 46.7 41.5`}),(0,X.jsx)(`path`,{style:{fill:PI.coral},d:`M29.72 22.45C25.84 23.34 24.28 28.36 27.25 30.42 29.34 31.88 32.91 30.43 33.83 27.75 34.92 24.55 32.75 21.76 29.72 22.45`}),(0,X.jsx)(`path`,{style:{fill:PI.mint},d:`M12.96 14.29C12.87 14.41 12.7 15.03 12.58 15.68 12.37 16.82 11.59 18.26 11.18 18.26 11.08 18.26 10.88 18.46 10.72 18.7 10.36 19.25 10.59 19.58 11.45 19.74 12.18 19.88 13.08 20.63 13.54 21.49 14.23 22.76 14.75 22.53 15.15 20.79 15.39 19.71 15.51 19.51 16.4 18.66 17.54 17.58 17.51 17.36 16.18 16.85 15.16 16.47 14.84 16.19 14.14 15.1 13.56 14.2 13.22 13.96 12.96 14.29M49.04 24.13C48.56 24.86 48.91 25.31 50.59 26.09 53.89 27.64 54.85 29.82 53.45 32.6 52.01 35.43 46.84 38.54 40.51 40.39 39.73 40.62 38.88 40.89 38.62 40.99 37.24 41.52 30.85 42.64 27.54 42.93 20.72 43.52 13.63 42.49 10.57 40.46 5.81 37.3 7.51 32.32 14.74 28.24 15.84 27.61 16.17 27.1 15.9 26.4 15.66 25.78 15.35 25.84 13.19 26.94 6 30.61 2.97 35.32 4.95 39.74 7.86 46.21 22.78 47.8 40.05 43.46 51.97 40.47 58.57 36.38 59.47 31.43 60.09 27.97 57.74 25.34 52.93 24.12 50.6 23.53 49.43 23.54 49.04 24.13`}),(0,X.jsx)(`path`,{style:{fill:PI.grape},d:`M34.82 8.91C33.48 10.04 34.21 12.14 35.94 12.14 37.29 12.14 38.18 10.99 37.77 9.77 37.36 8.53 35.81 8.08 34.82 8.91M53.15 43.16C53 43.28 52.74 43.86 52.57 44.45 52.18 45.78 51.76 46.32 50.64 46.93 49.52 47.53 49.45 47.89 50.33 48.34 51.34 48.85 52.24 49.95 52.56 51.04 53.13 53.01 53.6 53 54.21 50.99 54.61 49.69 55.13 48.93 55.91 48.54 57.17 47.91 57.23 47.51 56.15 46.96 55.23 46.49 54.67 45.76 54.23 44.44 53.8 43.15 53.54 42.84 53.15 43.16M24.18 53.18C22.45 53.9 22.87 56.59 24.71 56.59 26.79 56.59 27.2 53.67 25.2 53.09 24.89 53.01 24.51 53.04 24.18 53.18`}),(0,X.jsx)(`path`,{style:{fill:PI.yellow},d:`M51.76 11.04C51.21 12.77 50.56 13.61 49.24 14.34 48.6 14.69 48.72 15.07 49.59 15.48 50.54 15.93 51.11 16.69 51.62 18.22 52.06 19.57 52.26 19.54 52.79 18.08 53.29 16.69 53.87 15.91 54.86 15.31 55.76 14.77 55.77 14.48 54.92 14.02 53.91 13.46 53.5 12.99 52.89 11.66 52.23 10.21 52.06 10.12 51.76 11.04M11.06 48.22C10.99 48.35 10.71 48.88 10.46 49.41 9.95 50.48 9.45 50.99 8.59 51.33 7.89 51.61 7.85 52.1 8.52 52.37 9.51 52.79 10.3 53.85 10.89 55.58 11.09 56.18 11.48 55.88 11.87 54.84 12.24 53.87 13.33 52.56 13.79 52.56 14 52.56 14.5 52.06 14.5 51.85 14.5 51.77 14.19 51.54 13.81 51.34 12.98 50.92 12.36 50.14 11.93 48.99 11.6 48.09 11.31 47.83 11.06 48.22`})]})}function Uie(){return(0,X.jsxs)(`g`,{transform:`translate(2 8) scale(.114) translate(-125 -122)`,children:[(0,X.jsx)(`path`,{style:{fill:PI.coral},d:`M278 155 482 123C517 117 527 135 530 167L542 309Q543 329 561 341L631 404Q649 419 646 444 645 465 623 472L407 521Q374 531 345 519L156 436Q115 418 128 375L221 191Q238 163 278 155Z`}),(0,X.jsx)(`path`,{style:{fill:PI.ink},d:`M317 183 461 161Q493 155 497 188L504 288Q508 320 478 326L318 356Q289 362 286 331L281 226Q278 194 317 183Z`}),(0,X.jsx)(`path`,{style:{fill:PI.cream},d:`M304 386 553 340Q562 337 570 346L631 404Q649 419 646 444Q645 448 629 452L411 483Q382 492 367 474Z`}),(0,X.jsxs)(`g`,{style:{fill:PI.cream},children:[(0,X.jsx)(`rect`,{x:`319`,y:`236`,width:`26`,height:`59`,rx:`13`}),(0,X.jsx)(`rect`,{x:`364`,y:`229`,width:`26`,height:`59`,rx:`13`})]}),(0,X.jsxs)(`g`,{style:{fill:PI.ink},transform:`rotate(-11 470 411)`,children:[(0,X.jsx)(`rect`,{x:`369`,y:`380`,width:`61`,height:`25`,rx:`13`}),(0,X.jsx)(`rect`,{x:`444`,y:`380`,width:`61`,height:`25`,rx:`13`}),(0,X.jsx)(`rect`,{x:`518`,y:`380`,width:`57`,height:`25`,rx:`13`}),(0,X.jsx)(`rect`,{x:`392`,y:`421`,width:`58`,height:`25`,rx:`13`}),(0,X.jsx)(`rect`,{x:`462`,y:`421`,width:`65`,height:`25`,rx:`13`}),(0,X.jsx)(`rect`,{x:`539`,y:`421`,width:`58`,height:`25`,rx:`13`})]})]})}function Wie(){return(0,X.jsxs)(`g`,{transform:`translate(3 10) scale(.114) translate(-760 -140)`,children:[(0,X.jsx)(`path`,{style:{fill:PI.blue},d:`M1226 153C1257 153 1273 195 1267 231Q1263 265 1237 268L1176 270V215C1176 178 1195 153 1226 153Z`}),(0,X.jsx)(`path`,{style:{fill:PI.blue},d:`M824 376Q908 372 871 400C842 427 866 442 902 450L1113 480Q1188 479 1199 392C1207 447 1204 497 1163 511Q1134 521 1097 516C1055 510 991 507 957 507S869 511 826 512C781 513 758 483 760 441Q760 385 824 376Z`}),(0,X.jsx)(`path`,{style:{fill:PI.cream},d:`M824 376 857 184Q864 133 911 141C1039 169 1124 151 1226 153Q1179 159 1184 241L1199 377C1202 434 1174 482 1117 480L902 450C864 445 849 429 871 400Q908 372 824 376Z`}),(0,X.jsxs)(`g`,{style:{fill:PI.coral},children:[(0,X.jsx)(`path`,{d:`M982 198C1008 190 1030 197 1028 220L1023 265Q1020 295 1000 279C981 261 951 223 963 210Q970 202 982 198Z`}),(0,X.jsx)(`path`,{d:`M1063 220C1077 215 1100 237 1102 251Q1107 267 1084 282L1063 295Q1037 307 1040 278L1045 245Q1049 224 1063 220Z`}),(0,X.jsx)(`path`,{d:`M911 252C925 240 939 254 957 269L978 291Q995 311 961 316C938 318 907 316 898 308Q884 296 911 252Z`}),(0,X.jsx)(`path`,{d:`M1106 289Q1127 281 1134 304C1142 327 1146 352 1125 350Q1097 348 1073 335C1051 324 1072 311 1084 302Z`}),(0,X.jsx)(`path`,{d:`M927 338C946 334 972 334 985 343Q1004 353 984 384C970 408 957 418 940 403C922 389 896 356 913 345Z`}),(0,X.jsx)(`path`,{d:`M1010 375Q1025 363 1037 384C1049 407 1064 438 1044 442Q1025 448 1002 436C984 428 991 410 997 393Z`}),(0,X.jsx)(`path`,{d:`M1068 357C1084 359 1110 376 1120 389Q1130 402 1107 419C1090 432 1082 418 1073 401C1062 383 1043 355 1068 357Z`}),(0,X.jsx)(`path`,{d:`M1018 311C1037 312 1050 334 1034 343C1018 351 998 337 1005 320Q1009 311 1018 311Z`})]})]})}function Gie(){return(0,X.jsxs)(`g`,{transform:`translate(2 7) scale(.11) translate(-1380 -96)`,children:[(0,X.jsx)(`path`,{style:{fill:PI.inkcap},d:`M1384 276C1394 238 1445 200 1497 158C1547 119 1604 97 1647 97C1690 97 1720 109 1745 138C1772 170 1791 184 1833 194C1870 201 1919 220 1922 257C1923 307 1891 339 1853 336C1801 335 1767 299 1701 294C1666 291 1620 294 1642 303Q1670 307 1675 333C1681 367 1697 389 1717 413C1735 434 1738 443 1719 464C1700 485 1692 502 1686 520Q1682 541 1653 541L1626 541Q1598 541 1594 519C1590 495 1578 474 1563 458C1545 440 1544 429 1559 410C1585 377 1608 337 1572 326C1554 320 1529 333 1506 340C1461 356 1428 357 1402 340Q1371 319 1384 276Z`}),(0,X.jsx)(`path`,{style:{fill:PI.cream},d:`M1634 362Q1641 346 1649 362C1660 390 1676 404 1705 424Q1721 435 1704 453C1685 475 1677 490 1671 513Q1670 526 1653 525L1626 525Q1611 525 1610 513C1606 492 1592 465 1575 449Q1562 437 1577 424C1604 404 1620 390 1634 362Z`}),(0,X.jsx)(`path`,{style:{fill:PI.inkcap},d:`M1634 456A18 18 0 1 1 1648 456V492Q1648 500 1641 500T1634 492Z`}),(0,X.jsx)(`path`,{style:{fill:PI.inkcap},d:`M1780 391Q1786 386 1793 396C1810 420 1828 444 1827 467C1826 508 1768 510 1753 480C1741 456 1762 413 1780 391Z`})]})}var{coral:VI,blue:HI,mint:UI,grape:WI,yellow:GI,cream:KI,ink:qI}=PI,Kie={bonsai:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`path`,{fill:`none`,stroke:UI,strokeWidth:`3.7`,strokeLinecap:`round`,d:`M35 27.5C36 25 35.5 22.5 34 21S31.5 17.5 31.5 14M36 27C40 26.8 43 26 45 24S47 20.5 47.5 18.5M30.5 31C32.5 26.5 30.5 24.6 26.5 24 22 23.5 18.5 21.6 16.8 18.5M29 37C26.5 34.5 25 33.7 21.5 33.2S15.5 32 13 31.6M36 39.5C38 38 40 37.5 42 36.5S47 34 51 32.2`}),(0,X.jsx)(`path`,{fill:UI,d:`M25.5 43.5C28 40.5 28 37 27.5 33 27.3 29.5 29.5 27 33.5 26.3L37.5 26V29.5C35 29.8 34.2 31.5 34.3 34 34.5 37.5 37 39.5 41 43.5Z`}),(0,X.jsx)(`circle`,{fill:HI,cx:`31.5`,cy:`10.7`,r:`4.8`}),(0,X.jsx)(`circle`,{fill:WI,cx:`16.6`,cy:`18.3`,r:`4.6`}),(0,X.jsx)(`circle`,{fill:GI,cx:`47.9`,cy:`17.7`,r:`4.6`}),(0,X.jsx)(`circle`,{fill:GI,cx:`12.8`,cy:`31.5`,r:`4.6`}),(0,X.jsx)(`circle`,{fill:HI,cx:`50.9`,cy:`32.1`,r:`4.6`}),(0,X.jsx)(`path`,{fill:VI,d:`M16 46H47.5C47.5 54 44 58 38 58H25.5C19.5 58 16 54 16 46Z`}),(0,X.jsx)(`rect`,{fill:VI,x:`14`,y:`43`,width:`35.5`,height:`4.6`,rx:`2.3`})]}),computer:(0,X.jsx)(Uie,{}),prints:(0,X.jsx)(Wie,{}),inkcap:(0,X.jsx)(Gie,{}),vishnu:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`path`,{style:{fill:VI},d:`M6 37C6 21 17.5 9 32 9s26 12 26 28c0 2.2-1.8 4-4 4H10c-2.2 0-4-1.8-4-4Z`}),(0,X.jsx)(`circle`,{style:{fill:KI},cx:`19`,cy:`25`,r:`4`}),(0,X.jsx)(`circle`,{style:{fill:KI},cx:`33`,cy:`19.5`,r:`4.8`}),(0,X.jsx)(`circle`,{style:{fill:KI},cx:`46`,cy:`28`,r:`3.4`}),(0,X.jsx)(`rect`,{style:{fill:HI},x:`13`,y:`39`,width:`38`,height:`18`,rx:`9`}),(0,X.jsx)(`rect`,{style:{fill:KI},x:`18.5`,y:`46.2`,width:`10`,height:`3.6`,rx:`1.8`}),(0,X.jsx)(`rect`,{style:{fill:KI},x:`21.7`,y:`43`,width:`3.6`,height:`10`,rx:`1.8`}),(0,X.jsx)(`circle`,{style:{fill:GI},cx:`39`,cy:`50.5`,r:`2.7`}),(0,X.jsx)(`circle`,{style:{fill:KI},cx:`45`,cy:`45.5`,r:`2.7`})]}),generateText:(0,X.jsx)(Vie,{}),generateMedia:(0,X.jsx)(Hie,{}),buyApps:(0,X.jsxs)(`g`,{transform:`rotate(-6 32 32)`,children:[(0,X.jsx)(`circle`,{fill:GI,cx:`32`,cy:`20`,r:`12`}),(0,X.jsx)(`circle`,{stroke:KI,strokeWidth:`4`,cx:`32`,cy:`20`,r:`6`}),(0,X.jsx)(II,{fill:GI,transform:`translate(15.5 12) rotate(-60) scale(1.1 .85)`}),(0,X.jsx)(II,{fill:GI,transform:`translate(48.5 12) rotate(60) scale(1.1 .85)`}),(0,X.jsx)(`path`,{fill:HI,d:`M10 35H54L50 53Q49 58 44 58H20Q15 58 14 53Z`}),(0,X.jsx)(`rect`,{fill:VI,x:`5`,y:`27`,width:`54`,height:`10`,rx:`5`}),(0,X.jsxs)(`g`,{fill:KI,children:[(0,X.jsx)(`rect`,{x:`20`,y:`41`,width:`5`,height:`11`,rx:`2.5`}),(0,X.jsx)(`rect`,{x:`29.5`,y:`41`,width:`5`,height:`11`,rx:`2.5`}),(0,X.jsx)(`rect`,{x:`39`,y:`41`,width:`5`,height:`11`,rx:`2.5`})]})]}),browseBazaar:(0,X.jsxs)(`g`,{transform:`rotate(-5 32 32)`,children:[(0,X.jsx)(`rect`,{fill:HI,x:`10`,y:`14`,width:`44`,height:`38`,rx:`6`}),(0,X.jsx)(`rect`,{fill:HI,x:`5`,y:`47`,width:`54`,height:`12`,rx:`6`}),(0,X.jsx)(`rect`,{fill:KI,x:`12`,y:`50.5`,width:`40`,height:`4.5`,rx:`2.25`}),(0,X.jsx)(`rect`,{fill:VI,x:`2`,y:`4`,width:`60`,height:`9`,rx:`4.5`}),(0,X.jsx)(`path`,{fill:VI,d:`M3 9H14.6V18A5.8 5.8 0 0 1 3 18Z`}),(0,X.jsx)(`path`,{fill:KI,d:`M14.6 9H26.2V18A5.8 5.8 0 0 1 14.6 18Z`}),(0,X.jsx)(`path`,{fill:VI,d:`M26.2 9H37.8V18A5.8 5.8 0 0 1 26.2 18Z`}),(0,X.jsx)(`path`,{fill:KI,d:`M37.8 9H49.4V18A5.8 5.8 0 0 1 37.8 18Z`}),(0,X.jsx)(`path`,{fill:VI,d:`M49.4 9H61V18A5.8 5.8 0 0 1 49.4 18Z`}),(0,X.jsx)(`g`,{transform:`translate(32 36.5) scale(.34)`,children:(0,X.jsx)(LI,{})})]}),agent:(0,X.jsxs)(`g`,{transform:`translate(32 33) scale(2.02) translate(-47.2 -41.8)`,children:[(0,X.jsx)(`path`,{fill:HI,d:`M46.666 29.533C39.623 30.116 34.627 34.849 34.603 40.96 34.585 45.387 36.412 47.971 40.602 49.445 42.036 49.95 42.076 50.049 41.491 51.666 40.968 53.111 41.167 53.761 42.201 53.988 43.463 54.265 46.679 52.293 47.929 50.475 48.134 50.178 48.268 50.13 49.332 49.977 56.938 48.882 60.956 43.889 59.582 37.237 58.622 32.59 53.42 29.07 48.034 29.424 47.904 29.432 47.289 29.482 46.666 29.533Z`}),(0,X.jsx)(`g`,{transform:`translate(47.3 40) scale(.36 .34)`,children:(0,X.jsx)(zI,{})})]}),list:(0,X.jsxs)(`g`,{transform:`rotate(-7 32 32)`,children:[(0,X.jsx)(`path`,{style:{fill:HI},d:`M12 13Q6 13 6 19V50Q6 57 13 57H47Q53 57 53 50V20Q53 13 47 13Z`}),(0,X.jsx)(`path`,{style:{fill:KI},d:`M19 7H39Q42 7 44 9L55 20Q57 22 57 26V44Q57 50 51 50H19Q13 50 13 44V13Q13 7 19 7Z`}),(0,X.jsx)(`path`,{style:{fill:VI},d:`M39 7V18Q39 24 45 24H57Q57 22 55 20L44 9Q42 7 39 7Z`}),(0,X.jsxs)(`g`,{style:{fill:VI},children:[(0,X.jsx)(`circle`,{cx:`22`,cy:`21`,r:`3`}),(0,X.jsx)(`circle`,{cx:`22`,cy:`31`,r:`3`}),(0,X.jsx)(`circle`,{cx:`22`,cy:`41`,r:`3`})]}),(0,X.jsx)(`path`,{style:{stroke:HI},strokeWidth:`5`,strokeLinecap:`round`,d:`M31 21H32M31 31H46M31 41H42`})]}),chat:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`g`,{transform:`translate(3 11) scale(.22) translate(-449 -327)`,children:(0,X.jsx)(Lie,{})}),(0,X.jsx)(II,{transform:`translate(38.2 18) rotate(16) scale(.95 .6)`}),(0,X.jsx)(II,{transform:`translate(44.4 20.5) rotate(47) scale(.95 .6)`})]}),read:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`g`,{transform:`translate(4 20.5) scale(.56)`,children:(0,X.jsx)(Iie,{})}),(0,X.jsx)(`g`,{transform:`translate(32 38.6) scale(.3164)`,children:(0,X.jsx)(LI,{})}),(0,X.jsx)(Fie,{})]}),readConversations:(0,X.jsxs)(`g`,{transform:`translate(32 32) scale(.9) translate(-32 -32)`,children:[(0,X.jsx)(`g`,{transform:`translate(4 7.88) scale(.56)`,children:(0,X.jsx)(RI,{fill:HI})}),(0,X.jsx)(`g`,{transform:`translate(32.2 30.3) scale(.352)`,children:(0,X.jsx)(LI,{})})]}),listAgents:(0,X.jsxs)(`g`,{transform:`translate(32 32) scale(1.04) translate(-32 -32)`,children:[(0,X.jsx)(`path`,{style:{fill:FI},d:`M32.059 10.146C23.878 10.646 18.949 14.844 18.925 21.331 18.912 24.856 20.167 27.259 22.274 27.74 24.437 28.233 26.097 29.061 27.481 30.337 28.275 31.068 28.328 31.096 29.352 31.306 31.161 31.677 31.653 32.094 32.115 33.651 32.392 34.582 32.557 34.868 32.915 35.041 33.919 35.523 35.864 33.733 36.539 31.706L36.775 30.997 38.008 30.681C42.663 29.489 45.29 26.142 45.468 21.176 45.734 13.784 40.673 9.62 32.059 10.146Z`}),(0,X.jsx)(`g`,{transform:`translate(32.4 21.2) scale(.39)`,children:(0,X.jsx)(zI,{onFigure:!0})}),(0,X.jsx)(`path`,{style:{fill:VI},d:`M14.375 27.586C8.014 28.591 4.363 32.396 4.355 38.027 4.347 43.93 8.071 47.469 15.239 48.368L16.828 48.568 17.873 49.568C19.854 51.464 22.469 52.496 23.691 51.864 24.384 51.506 24.431 51.044 23.924 49.606 23.337 47.943 23.479 47.492 24.749 46.977 32.756 43.73 32.643 31.899 24.573 28.49 22.238 27.504 17.535 27.087 14.375 27.586Z`}),(0,X.jsx)(`g`,{transform:`translate(17.6 37.7) scale(.38 .36)`,children:(0,X.jsx)(zI,{})}),(0,X.jsx)(`path`,{style:{fill:HI},d:`M46.666 29.533C39.623 30.116 34.627 34.849 34.603 40.96 34.585 45.387 36.412 47.971 40.602 49.445 42.036 49.95 42.076 50.049 41.491 51.666 40.968 53.111 41.167 53.761 42.201 53.988 43.463 54.265 46.679 52.293 47.929 50.475 48.134 50.178 48.268 50.13 49.332 49.977 56.938 48.882 60.956 43.889 59.582 37.237 58.622 32.59 53.42 29.07 48.034 29.424 47.904 29.432 47.289 29.482 46.666 29.533Z`}),(0,X.jsx)(`g`,{transform:`translate(47.3 40) scale(.36 .34)`,children:(0,X.jsx)(zI,{})})]}),createAgents:(0,X.jsxs)(`g`,{transform:`translate(32 32) scale(1.08) translate(-32 -32)`,children:[(0,X.jsx)(`path`,{style:{fill:FI},d:`M20.436 24.499C13.35 25.216 7.504 28.799 5.442 33.687 3.114 39.208 4.438 45.791 8.593 49.358 10.446 50.949 10.34 50.831 10.34 51.301 10.34 51.796 10.106 52.294 9.281 53.558 7.191 56.76 12.108 56.905 16.701 53.777 17.517 53.221 17.715 53.135 18.015 53.201 20.013 53.639 25.739 53.051 28.595 52.113 35.47 49.857 39.129 44.162 37.83 37.738C37 31 33 26 26.717 24.428L24.075 24.413C22.623 24.405 20.985 24.444 20.436 24.499Z`}),(0,X.jsx)(`g`,{transform:`translate(21.9 40) scale(.46 .43)`,children:(0,X.jsx)(zI,{onFigure:!0})}),(0,X.jsx)(`path`,{style:{fill:UI},d:`M37.987 15.734C32.277 16.627 28.675 20.713 28.92 26.022 29.062 29.118 30.627 31.606 33.331 33.036 34.675 33.747 34.761 34.018 34.237 35.923 33.376 39.051 36.878 38.551 39.174 35.218 39.574 34.637 39.65 34.583 40.058 34.583 46.203 34.583 50.414 30.91 50.424 25.543 50.435 18.989 44.932 14.649 37.987 15.734Z`}),(0,X.jsx)(`g`,{transform:`translate(38.9 24.9) scale(.31)`,children:(0,X.jsx)(zI,{})}),(0,X.jsx)(II,{fill:GI,transform:`translate(48.1 15.7) rotate(31) scale(1.25 .85)`}),(0,X.jsx)(II,{fill:GI,transform:`translate(52.2 19.8) rotate(70) scale(1.25 .85)`})]}),sendPrompts:(0,X.jsxs)(`g`,{transform:`translate(32 32) scale(1.08) translate(-32 -32)`,children:[(0,X.jsx)(`g`,{transform:`translate(4 13.2) scale(.412 .436)`,children:(0,X.jsx)(RI,{fill:VI})}),(0,X.jsx)(`g`,{transform:`translate(17.1 28.7) scale(.19)`,children:(0,X.jsx)(Rie,{})}),(0,X.jsx)(II,{fill:UI,transform:`translate(48.1 26.4) rotate(65) scale(1.7 1.28)`}),(0,X.jsx)(II,{fill:UI,transform:`translate(48.4 33.8) rotate(110) scale(1.7 1.28)`})]}),write:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(zie,{}),(0,X.jsx)(Bie,{})]}),run:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`rect`,{style:{fill:HI},x:`6`,y:`9`,width:`52`,height:`43`,rx:`7`}),(0,X.jsx)(`path`,{style:{stroke:KI},strokeWidth:`5`,strokeLinecap:`round`,strokeLinejoin:`round`,d:`m17 22 9 8-9 8m17 0h12`})]}),connected:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`path`,{fill:`none`,style:{stroke:HI},strokeWidth:`12`,strokeLinecap:`round`,d:`M34 37Q43 21 26 20H18Q3 20 6 37q2 10 15 9`}),(0,X.jsx)(`path`,{fill:`none`,style:{stroke:VI},strokeWidth:`12`,strokeLinecap:`round`,d:`M29 33Q20 50 38 53h8q16-1 12-17-2-11-14-10`}),(0,X.jsx)(`path`,{style:{stroke:GI},strokeWidth:`4`,strokeLinecap:`round`,d:`m27 4 2 6m10-5-2 7m12 0-5 4`})]}),working:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`ellipse`,{style:{fill:UI},cx:`23`,cy:`14`,rx:`13`,ry:`8`,transform:`rotate(-30 23 14)`}),(0,X.jsx)(`ellipse`,{style:{fill:GI},cx:`48`,cy:`36`,rx:`13`,ry:`8`,transform:`rotate(35 48 36)`}),(0,X.jsx)(`ellipse`,{style:{fill:WI},cx:`22`,cy:`48`,rx:`13`,ry:`8`,transform:`rotate(45 22 48)`}),(0,X.jsx)(`path`,{fill:`none`,style:{stroke:FI},strokeWidth:`3`,strokeLinecap:`round`,d:`M42 8q13 2 13 13M43 55q-5 5-12 4M5 39q-5-9 1-17`})]}),complete:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`path`,{style:{fill:UI},d:`M32 6q5-8 10 0 9-3 10 6 9 2 5 11 8 6 0 12 3 9-6 11-1 9-10 6-6 8-12 0-9 3-11-6-9-2-6-11-8-6 0-12-3-9 6-11 1-9 10-6Z`}),(0,X.jsx)(`path`,{fill:`none`,style:{stroke:qI},strokeWidth:`6`,strokeLinecap:`round`,strokeLinejoin:`round`,d:`m23 29 7 7 13-15`}),(0,X.jsx)(`path`,{style:{stroke:FI},strokeWidth:`3`,strokeLinecap:`round`,d:`m4 8 5 6m48-4 5-5M2 24l6 1`})]}),installApps:(0,X.jsxs)(`g`,{transform:`rotate(-6 32 32)`,children:[(0,X.jsx)(`rect`,{style:{fill:HI},x:`9`,y:`26`,width:`46`,height:`32`,rx:`10`}),(0,X.jsx)(`rect`,{style:{fill:KI},x:`17`,y:`33`,width:`30`,height:`18`,rx:`5`}),(0,X.jsx)(`path`,{style:{fill:UI},d:`M22 38h8v8h-8z`}),(0,X.jsx)(`path`,{style:{fill:WI},d:`M34 38h8v8h-8z`}),(0,X.jsx)(`path`,{style:{stroke:VI},strokeWidth:`6`,strokeLinecap:`round`,strokeLinejoin:`round`,d:`M32 4v17m-8-7 8 8 8-8`})]}),restricted:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`path`,{fill:`none`,style:{stroke:VI},strokeWidth:`9`,strokeLinecap:`round`,d:`M16 23V19q0-17 16-17t16 17v4`}),(0,X.jsx)(`rect`,{style:{fill:VI},x:`8`,y:`26`,width:`48`,height:`36`,rx:`9`}),(0,X.jsx)(`path`,{style:{fill:KI},d:`M32 34a7 7 0 0 0-4 13v7h8v-7a7 7 0 0 0-4-13Z`})]}),error:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`path`,{style:{fill:VI},d:`M32 6q5-8 10 0 9-3 10 6 9 2 5 11 8 6 0 12 3 9-6 11-1 9-10 6-6 8-12 0-9 3-11-6-9-2-6-11-8-6 0-12-3-9 6-11 1-9 10-6Z`}),(0,X.jsx)(`path`,{fill:`none`,style:{stroke:KI},strokeWidth:`7`,strokeLinecap:`round`,d:`M32 18v15`}),(0,X.jsx)(`circle`,{style:{fill:KI},cx:`32`,cy:`45`,r:`4`})]}),trellis:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`g`,{fill:GI,children:[(0,X.jsx)(`rect`,{x:`17.25`,y:`9`,width:`3.9`,height:`49.2`,rx:`1.95`}),(0,X.jsx)(`rect`,{x:`42.95`,y:`9`,width:`3.9`,height:`49.2`,rx:`1.95`}),(0,X.jsx)(`rect`,{x:`30.4`,y:`18`,width:`3.2`,height:`26`}),(0,X.jsx)(`rect`,{x:`14.8`,y:`15.75`,width:`34.4`,height:`3.1`,rx:`1.55`}),(0,X.jsx)(`rect`,{x:`14.8`,y:`28.85`,width:`34.4`,height:`3.1`,rx:`1.55`}),(0,X.jsx)(`rect`,{x:`14.8`,y:`42.55`,width:`34.4`,height:`3.1`,rx:`1.55`})]}),(0,X.jsx)(`path`,{fill:`none`,stroke:UI,strokeWidth:`3`,strokeLinecap:`round`,d:`M21.9 56.1C31.5 54.4 32.9 47 32.1 45.8`}),(0,X.jsx)(`path`,{fill:`none`,stroke:UI,strokeWidth:`3`,strokeLinecap:`round`,d:`M32 44.2C28.7 41.8 25.2 35.7 32 32.3 38.8 28 38.9 24 31.9 18.8 32.4 16.3 32.8 14.7 34.5 12.2`}),(0,X.jsx)(BI,{transform:`translate(32.1 14.1) rotate(45) scale(0.45 0.86)`}),(0,X.jsx)(BI,{transform:`translate(32.2 14.7) rotate(-60) scale(0.42 0.58)`}),(0,X.jsx)(BI,{transform:`translate(34.8 28.3) rotate(65) scale(0.38 0.8)`}),(0,X.jsx)(BI,{transform:`translate(28.2 33.1) rotate(-51) scale(0.5 0.57)`}),(0,X.jsx)(BI,{transform:`translate(28.6 53.3) rotate(-48) scale(0.47 0.6)`}),(0,X.jsx)(`circle`,{fill:VI,cx:`31.9`,cy:`18.8`,r:`4`}),(0,X.jsx)(`circle`,{fill:HI,cx:`32`,cy:`32.3`,r:`4`}),(0,X.jsx)(`circle`,{fill:WI,cx:`32`,cy:`44.2`,r:`4`})]}),games:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`path`,{fill:HI,d:`M18.5 28.5H45.5C49.5 29.5 53 32 54 35 55 37.5 56.8 45.5 56.6 48 56.5 53 52.5 57.5 47 58H15C9.5 56.5 6.6 51 7.6 45.5 8.6 39.5 9.3 35 10.5 33 12 31 14.5 29.5 18.5 28.5Z`}),(0,X.jsx)(`ellipse`,{fill:KI,cx:`26.8`,cy:`37.9`,rx:`9.1`,ry:`5.6`}),(0,X.jsx)(`ellipse`,{fill:qI,cx:`27`,cy:`37.6`,rx:`4.7`,ry:`2.2`}),(0,X.jsx)(`path`,{fill:qI,d:`M23.1 26V35.4A4 4.2 0 0 0 31.1 35.4V26Z`}),(0,X.jsx)(`circle`,{fill:VI,cx:`27.1`,cy:`18.3`,r:`12.4`}),(0,X.jsx)(`circle`,{fill:KI,cx:`22.6`,cy:`14.3`,r:`3.05`}),(0,X.jsx)(`ellipse`,{fill:GI,cx:`45.1`,cy:`37.2`,rx:`5.6`,ry:`3.95`}),(0,X.jsx)(`ellipse`,{fill:KI,cx:`40.1`,cy:`46.6`,rx:`6.2`,ry:`4.4`})]}),oyster:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`path`,{fill:WI,d:`M35.5 6C33.7 6.3 32.3 7.6 31.4 9.4 30.9 10.3 30.4 10.3 29.5 10 25.5 9 20.6 11.6 19.6 15.9 19.4 16.6 19 17 18 17.1 14.5 17.6 12 20.6 12.1 24.2 12.2 25.4 12 25.9 11.5 26.5 7.5 30 10.5 34.5 17.5 34.4 15.3 32.6 16 31 19 29 26 24 37 19.5 43.5 19 46 19 46 22 43 25.5 46.5 23.5 51.5 18.5 53.5 15 55 11 50 7 45 9 43.8 9.4 43.3 9.2 42.5 8 40.7 6.3 38 5.6 35.5 6Z`}),(0,X.jsx)(`circle`,{fill:KI,cx:`34.9`,cy:`41.9`,r:`11.3`}),(0,X.jsxs)(`g`,{fill:qI,children:[(0,X.jsx)(`rect`,{x:`29.9`,y:`33.2`,width:`3.2`,height:`5.6`,rx:`1.6`}),(0,X.jsx)(`rect`,{x:`36.7`,y:`33.2`,width:`3.2`,height:`5.6`,rx:`1.6`})]}),(0,X.jsx)(`path`,{fill:WI,d:`M49.5 39C47.9 39.3 46.5 40 46.1 41.6 45.8 43.2 45.5 43.5 44 43.5 38.5 43.5 35 48 39 49.5 40 50 39.5 50.5 38 51 35.5 52.5 32.5 52 30 51 29 50.5 28.5 50 29.5 50 33 47.5 30 43.5 24.5 43.5 23.3 43.5 22.9 43.3 22.5 43 20.5 40.5 19 40 17.5 39.5 13 39.5 13 44 17 47.5 18.3 48.4 18.6 48.7 19 49.5 20.5 53 23 55 26 55 26.8 55 27 55.3 27.5 56 31 58.5 36.5 58.5 40 56 40.8 55.2 41.2 55 42 55 45 55 47.5 53 49 49.5 49.6 48.5 50 48 50.5 47.5 56 43.5 55 38.5 49.5 39Z`}),(0,X.jsx)(`path`,{fill:`none`,stroke:GI,strokeWidth:`3`,strokeLinecap:`round`,d:`M46.6 31.8 49.2 27.8 M49.4 35.5 52.8 33.7 M21.5 32.5 22.9 33.5 M19.3 37.5 21.1 38.1`})]}),tourtois:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`rect`,{fill:KI,x:`11.07`,y:`35.73`,width:`26.8`,height:`9.7`,rx:`3.25`,transform:`rotate(-5 24.47 40.58)`}),(0,X.jsx)(`path`,{fill:GI,d:`M14.8 16C19 14.6 23 13.5 26.5 12.6 28.4 12.1 29.6 13.4 30.1 15.3L31.6 21 17.4 37.6C13.8 38.2 10.6 37.8 10.1 35.4L9.2 27.8C9.1 26.1 10.1 24.7 11.6 24.1 11.4 22.4 11.4 20.6 11.8 19.1 12.3 17.4 13.3 16.5 14.8 16Z`}),(0,X.jsx)(`path`,{fill:VI,d:`M14.0 24.1Q13.3 21.2 16.2 20.4L30.7 16.2Q33.6 15.4 34.6 18.2L36.0 22.7Q37.0 25.5 34.7 27.4L20.2 39.7Q17.9 41.6 17.2 38.7Z`}),(0,X.jsx)(`path`,{fill:HI,d:`M21 23.4 35.5 20.6C37.3 20.2 38.6 21 38.9 22.6L40 34.5C40.1 36.2 39.1 37.3 37.5 37.7 32.6 39.9 26 41 21 41 16 41 12.2 40.2 11 38.8 10.4 37.6 10.8 36.4 12.4 37L19.6 38.4 18.4 27C18.2 25.2 19.3 23.7 21 23.4Z`}),(0,X.jsx)(`path`,{fill:KI,d:`M22.8 29.6 34.8 26.9C36.2 26.6 37 27.3 37.2 28.6L37.9 33C38.1 34.2 37.5 35 36.3 35.3L24.3 37.8C23 38.1 22.3 37.5 22.1 36.3L21.3 31.6C21.1 30.6 21.7 29.8 22.8 29.6Z`}),(0,X.jsxs)(`g`,{fill:KI,children:[(0,X.jsx)(`circle`,{cx:`14.7`,cy:`18.45`,r:`1`}),(0,X.jsx)(`circle`,{cx:`17.6`,cy:`17.65`,r:`1`}),(0,X.jsx)(`circle`,{cx:`20.5`,cy:`16.85`,r:`1`}),(0,X.jsx)(`circle`,{cx:`17.9`,cy:`22.2`,r:`1`}),(0,X.jsx)(`circle`,{cx:`21`,cy:`21.5`,r:`1`}),(0,X.jsx)(`circle`,{cx:`24.1`,cy:`20.75`,r:`1`}),(0,X.jsx)(`circle`,{cx:`28.2`,cy:`25.3`,r:`1`})]}),(0,X.jsx)(`circle`,{fill:VI,cx:`21.7`,cy:`26.6`,r:`1`}),(0,X.jsx)(`circle`,{fill:GI,cx:`24.9`,cy:`25.9`,r:`1.05`}),(0,X.jsxs)(`g`,{fill:UI,children:[(0,X.jsx)(`ellipse`,{cx:`8.8`,cy:`36.6`,rx:`3.6`,ry:`1.9`,transform:`rotate(22 8.8 36.6)`}),(0,X.jsx)(`path`,{d:`M12 41C10 41.5 7.5 44.5 7 46.5 7 48 8.5 49.5 10.5 50 12.5 50.5 13.5 50 15 48 15.5 47 16.5 47.5 19 50 22 49.5 22 46.5 22 45.5 20.5 45.5 17 45 16.5 44.5 16.5 44 16.5 42 13.5 40.5 12 41Z`}),(0,X.jsx)(`path`,{d:`M40 33C39 38 36 42 34.5 41.5 32.5 40.5 29.5 42 28.5 44 26 49 27.5 51.5 32.5 51 36 51 37 50 36 46.5 36 45 37 44.5 38 44.5 38.5 45.5 40.5 49 43.5 50 46.5 47.5 47.5 46.5 46 43.5 44 42 43 41.5 43.5 40.5 44.5 39.5 46 38 47 37.5L47 33Z`})]}),(0,X.jsx)(`ellipse`,{fill:UI,cx:`46.4`,cy:`30.6`,rx:`8.1`,ry:`8.3`}),(0,X.jsxs)(`g`,{fill:qI,children:[(0,X.jsx)(`rect`,{x:`45.05`,y:`26.95`,width:`2.25`,height:`4.6`,rx:`1.1`,transform:`rotate(-6 46.2 29.3)`}),(0,X.jsx)(`rect`,{x:`49.25`,y:`26.4`,width:`2.25`,height:`4.6`,rx:`1.1`,transform:`rotate(-6 50.4 28.7)`})]}),(0,X.jsx)(`path`,{fill:VI,d:`M46.8 32.2H51C51 34.3 50 35.4 48.9 35.4S46.8 34.3 46.8 32.2Z`,transform:`rotate(-8 48.9 33.5)`}),(0,X.jsx)(`path`,{fill:`none`,stroke:GI,strokeWidth:`3`,strokeLinecap:`round`,d:`M50.9 17.7 50.5 19.7 M55.2 20.1 53.4 21.9 M56.5 24.5 55.7 24.7`})]}),allApps:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`rect`,{fill:VI,x:`7`,y:`7.25`,width:`23.2`,height:`22.7`,rx:`4.6`,transform:`rotate(-6.2 18.6 18.6)`}),(0,X.jsx)(`rect`,{fill:HI,x:`33.9`,y:`7.25`,width:`23.2`,height:`22.7`,rx:`4.6`,transform:`rotate(6.2 45.5 18.6)`}),(0,X.jsx)(`rect`,{fill:UI,x:`7`,y:`34.15`,width:`23.2`,height:`22.7`,rx:`4.6`,transform:`rotate(6.2 18.6 45.5)`}),(0,X.jsx)(`rect`,{fill:GI,x:`33.9`,y:`34.15`,width:`23.2`,height:`22.7`,rx:`4.6`,transform:`rotate(-6.2 45.5 45.5)`})]}),search:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`path`,{fill:`none`,stroke:HI,strokeWidth:`6.5`,d:`M37 37.5 43 43.5`}),(0,X.jsx)(`path`,{fill:`none`,stroke:VI,strokeWidth:`12.6`,strokeLinecap:`round`,d:`M44.2 43.8 51.4 51.8`}),(0,X.jsx)(`path`,{fill:`none`,stroke:GI,strokeWidth:`3`,strokeLinecap:`round`,d:`M47.2 42.4 52.8 47.8`}),(0,X.jsx)(`ellipse`,{fill:HI,cx:`25.6`,cy:`24.6`,rx:`19.25`,ry:`18.6`}),(0,X.jsx)(`ellipse`,{fill:KI,cx:`25.2`,cy:`24.1`,rx:`14.2`,ry:`13.6`})]}),browser:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`rect`,{fill:VI,x:`5.9`,y:`6.15`,width:`52.2`,height:`51.7`,rx:`5.5`}),(0,X.jsx)(`path`,{fill:KI,d:`M10 16.5H29.4C30.3 16.1 31 14.4 31.8 12.5 32.5 10.9 33.2 10 34.5 10H52.2C53.4 10 54 10.7 54 12V16.5C55.2 16.5 56 17.1 56 18.3V52.4C56 53.7 55.1 54.6 53.8 54.6H10.2C8.9 54.6 8 53.7 8 52.4V18.2C8 17.1 8.7 16.5 10 16.5Z`}),(0,X.jsx)(`circle`,{fill:GI,cx:`12.2`,cy:`11.9`,r:`1.95`}),(0,X.jsx)(`circle`,{fill:HI,cx:`18.6`,cy:`11.9`,r:`1.95`}),(0,X.jsx)(`circle`,{fill:WI,cx:`25.1`,cy:`11.9`,r:`1.95`}),(0,X.jsx)(`circle`,{fill:UI,cx:`32`,cy:`34.9`,r:`14.5`}),(0,X.jsxs)(`g`,{fill:`none`,stroke:KI,strokeWidth:`3`,children:[(0,X.jsx)(`ellipse`,{cx:`32`,cy:`34.9`,rx:`7.7`,ry:`13.3`}),(0,X.jsx)(`path`,{d:`M17.5 34.9H46.5`})]})]}),internet:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`ellipse`,{fill:`none`,stroke:GI,strokeWidth:`4.4`,cx:`32.2`,cy:`30.2`,rx:`25.6`,ry:`8.1`,transform:`rotate(-20.8 32.2 30.2)`}),(0,X.jsx)(`circle`,{fill:HI,cx:`32`,cy:`32`,r:`21.1`}),(0,X.jsxs)(`g`,{fill:`none`,stroke:KI,strokeWidth:`3`,children:[(0,X.jsx)(`ellipse`,{cx:`32`,cy:`31.8`,rx:`12.2`,ry:`18.7`}),(0,X.jsx)(`path`,{d:`M32 13.1V50.5M15 20.4Q32 29 49 20.4M12.5 39Q32 44.6 51.5 39`})]}),(0,X.jsx)(`path`,{fill:`none`,stroke:GI,strokeWidth:`4.4`,d:`M6.6 30.2A25.6 8.1 0 0 0 57.8 30.2`,transform:`rotate(-20.8 32.2 30.2)`})]}),members:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`circle`,{fill:HI,cx:`41.9`,cy:`22.85`,r:`12.2`}),(0,X.jsx)(`path`,{fill:HI,d:`M36 34C33.8 34.8 32.2 35.8 31 37 37.5 39.5 40.5 43.5 40.5 49.5V53.5H54.5C57 53.5 58 51 58 47.5 58 40 55 35.5 49 34Z`}),(0,X.jsx)(`circle`,{fill:VI,cx:`22.95`,cy:`27.6`,r:`12.85`}),(0,X.jsx)(`path`,{fill:VI,d:`M15.5 38C10.5 39 7.5 42.5 6.5 47 5.5 50.5 6 53.5 8.5 53.5H38.5C42 52 40 43 36 40 34.5 39 32 38 31 38Z`}),(0,X.jsxs)(`g`,{fill:qI,children:[(0,X.jsx)(`circle`,{cx:`18.3`,cy:`28`,r:`1.6`}),(0,X.jsx)(`circle`,{cx:`27.9`,cy:`28`,r:`1.6`}),(0,X.jsx)(`circle`,{cx:`39.1`,cy:`23.05`,r:`1.55`}),(0,X.jsx)(`circle`,{cx:`47.25`,cy:`23.05`,r:`1.55`})]})]}),sell:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`path`,{fill:GI,d:`M6.4 41.2V48.4C6.4 51.4 13.2 54 21.8 54S37.2 51.4 37.2 48.4V41.2C37.2 37.8 30.4 35 21.8 35S6.4 37.8 6.4 41.2Z`}),(0,X.jsx)(`ellipse`,{fill:KI,cx:`21.9`,cy:`40.8`,rx:`13.2`,ry:`3.6`}),(0,X.jsxs)(`g`,{transform:`rotate(-3 22.5 30) translate(0.5 0)`,children:[(0,X.jsx)(`path`,{fill:GI,d:`M7.5 26V34C7.5 37.3 14.2 40 22.5 40S37.5 37.3 37.5 34V26C37.5 22.7 30.8 20 22.5 20S7.5 22.7 7.5 26Z`}),(0,X.jsx)(`ellipse`,{fill:KI,cx:`23.7`,cy:`26.55`,rx:`13.05`,ry:`4.4`})]}),(0,X.jsxs)(`g`,{transform:`translate(46.3 40.3) rotate(-25)`,children:[(0,X.jsx)(`path`,{fill:VI,d:`M-8.5-10Q-8.5-12-7-13L-1.5-16.3Q0-17.2 1.5-16.3L7-13Q8.5-12 8.5-10V9Q8.5 12 5.5 12H-5.5Q-8.5 12-8.5 9Z`}),(0,X.jsx)(`circle`,{fill:KI,cx:`0`,cy:`-10.7`,r:`2.2`})]}),(0,X.jsx)(II,{fill:GI,transform:`translate(38.2 18.6) scale(1.1 .86)`}),(0,X.jsx)(II,{fill:GI,transform:`translate(42.8 21.2) rotate(45) scale(1.1 .85)`})]}),schedule:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`rect`,{fill:KI,x:`6`,y:`11`,width:`47.6`,height:`44`,rx:`6`}),(0,X.jsx)(`path`,{fill:VI,d:`M12 11H47.6Q53.6 11 53.6 17V21.5H6V17Q6 11 12 11Z`}),(0,X.jsxs)(`g`,{fill:KI,children:[(0,X.jsx)(`circle`,{cx:`16.1`,cy:`16.15`,r:`3.4`}),(0,X.jsx)(`circle`,{cx:`43.4`,cy:`16.15`,r:`3.4`})]}),(0,X.jsxs)(`g`,{fill:HI,children:[(0,X.jsx)(`rect`,{x:`13.6`,y:`6`,width:`5`,height:`11.2`,rx:`2.5`}),(0,X.jsx)(`rect`,{x:`40.9`,y:`6`,width:`5`,height:`11.2`,rx:`2.5`})]}),(0,X.jsxs)(`g`,{fill:UI,children:[(0,X.jsx)(`rect`,{x:`11.1`,y:`25.1`,width:`6.9`,height:`6.6`,rx:`1.8`}),(0,X.jsx)(`rect`,{x:`20.7`,y:`25.1`,width:`6.9`,height:`6.6`,rx:`1.8`}),(0,X.jsx)(`rect`,{x:`30.4`,y:`25.1`,width:`6.9`,height:`6.6`,rx:`1.8`}),(0,X.jsx)(`rect`,{x:`20.7`,y:`33.9`,width:`6.9`,height:`6.6`,rx:`1.8`}),(0,X.jsx)(`rect`,{x:`30.4`,y:`33.9`,width:`6.9`,height:`6.6`,rx:`1.8`}),(0,X.jsx)(`rect`,{x:`11.1`,y:`42.7`,width:`6.9`,height:`6.6`,rx:`1.8`}),(0,X.jsx)(`rect`,{x:`30.4`,y:`42.7`,width:`6.9`,height:`6.6`,rx:`1.8`})]}),(0,X.jsxs)(`g`,{fill:WI,children:[(0,X.jsx)(`rect`,{x:`40.4`,y:`25.1`,width:`6.9`,height:`6.6`,rx:`1.8`}),(0,X.jsx)(`rect`,{x:`11.1`,y:`33.9`,width:`6.9`,height:`6.6`,rx:`1.8`}),(0,X.jsx)(`rect`,{x:`20.7`,y:`42.7`,width:`6.9`,height:`6.6`,rx:`1.8`})]}),(0,X.jsx)(`circle`,{fill:GI,cx:`45.5`,cy:`45.6`,r:`12.2`}),(0,X.jsx)(`path`,{fill:`none`,stroke:qI,strokeWidth:`3`,strokeLinecap:`round`,strokeLinejoin:`round`,d:`M45.1 39.3V46.2L51.3 49.8`}),(0,X.jsx)(`circle`,{fill:qI,cx:`45.1`,cy:`46.2`,r:`2.5`})]}),fungi:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`ellipse`,{fill:KI,cx:`33.5`,cy:`43.6`,rx:`18.6`,ry:`14.4`,transform:`rotate(-6 33.5 43.6)`}),(0,X.jsx)(`path`,{fill:VI,d:`M29.5 6.5C22 7.5 16 11 11 18.5 4 29 4.6 39.6 13.5 42.2 24 45 44 40.5 54 34.6 57.6 32.6 58.6 29.2 57.5 25 56.5 20 53 16 48.5 13 43.5 8 37 5.5 29.5 6.5Z`}),(0,X.jsxs)(`g`,{fill:KI,children:[(0,X.jsx)(`ellipse`,{cx:`29`,cy:`15.7`,rx:`8.7`,ry:`6.3`,transform:`rotate(-15.5 29 15.7)`}),(0,X.jsx)(`ellipse`,{cx:`50.8`,cy:`20.1`,rx:`6.5`,ry:`3.5`,transform:`rotate(51.6 50.8 20.1)`}),(0,X.jsx)(`ellipse`,{cx:`13`,cy:`26.8`,rx:`4.2`,ry:`3.3`,transform:`rotate(-54.5 13 26.8)`})]}),(0,X.jsxs)(`g`,{fill:qI,transform:`translate(26.6 46.6) scale(1.1) translate(-33.7 -38.5)`,children:[(0,X.jsx)(`rect`,{x:`31.85`,y:`35.9`,width:`3.75`,height:`5.25`,rx:`1.85`}),(0,X.jsx)(`path`,{d:`M 47.4 34.3 C 46 35 44.6 35.8 43.5 36.7 42.9 37.2 43.2 38.3 44 38.4 45.2 38.6 46.5 38.6 47.7 38.4 48.4 38.3 48.3 37.3 47.6 37.3 46.6 37.4 45.7 37.4 45 37.3 45.9 36.7 46.9 36.1 48 35.6 48.7 35.3 48.2 34 47.4 34.3 Z`}),(0,X.jsx)(`path`,{d:`M 37.4 41.1 C 38.6 44.3 42.6 44.3 43.6 40.5 43.7 40 43.1 39.8 42.9 40.3 41.9 42.8 39.1 42.9 38.3 40.7 38.1 40.2 37.3 40.5 37.4 41.1 Z`})]})]})};function qie({name:e,size:t}){return(0,X.jsx)(`svg`,{viewBox:`0 0 64 64`,width:t,height:t,fill:`none`,stroke:`none`,"aria-hidden":`true`,focusable:`false`,"data-sigil":e,children:Kie[e]})}var Jie=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),JI=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),Yie={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`},Xie=(0,K.forwardRef)(({color:e=`currentColor`,size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:i=``,children:a,iconNode:o,...s},c)=>(0,K.createElement)(`svg`,{ref:c,...Yie,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:JI(`lucide`,i),...s},[...o.map(([e,t])=>(0,K.createElement)(e,t)),...Array.isArray(a)?a:[a]])),YI=(e,t)=>{let n=(0,K.forwardRef)(({className:n,...r},i)=>(0,K.createElement)(Xie,{ref:i,iconNode:t,className:JI(`lucide-${Jie(e)}`,n),...r}));return n.displayName=`${e}`,n},Zie=YI(`ArrowUp`,[[`path`,{d:`m5 12 7-7 7 7`,key:`hav0vg`}],[`path`,{d:`M12 19V5`,key:`x0mq9r`}]]),XI=YI(`Check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),ZI=YI(`ChevronDown`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]),Qie=YI(`Clapperboard`,[[`path`,{d:`M20.2 6 3 11l-.9-2.4c-.3-1.1.3-2.2 1.3-2.5l13.5-4c1.1-.3 2.2.3 2.5 1.3Z`,key:`1tn4o7`}],[`path`,{d:`m6.2 5.3 3.1 3.9`,key:`iuk76l`}],[`path`,{d:`m12.4 3.4 3.1 4`,key:`6hsd6n`}],[`path`,{d:`M3 11h18v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2Z`,key:`ltgou9`}]]),$ie=YI(`Download`,[[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}],[`polyline`,{points:`7 10 12 15 17 10`,key:`2ggqvy`}],[`line`,{x1:`12`,x2:`12`,y1:`15`,y2:`3`,key:`1vk2je`}]]),QI=YI(`EyeOff`,[[`path`,{d:`M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49`,key:`ct8e1f`}],[`path`,{d:`M14.084 14.158a3 3 0 0 1-4.242-4.242`,key:`151rxh`}],[`path`,{d:`M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143`,key:`13bj9a`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),$I=YI(`Eye`,[[`path`,{d:`M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0`,key:`1nclc0`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),eL=YI(`FileImage`,[[`path`,{d:`M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z`,key:`1rqfz7`}],[`path`,{d:`M14 2v4a2 2 0 0 0 2 2h4`,key:`tnqrlb`}],[`circle`,{cx:`10`,cy:`12`,r:`2`,key:`737tya`}],[`path`,{d:`m20 17-1.296-1.296a2.41 2.41 0 0 0-3.408 0L9 22`,key:`wt3hpn`}]]),tL=YI(`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`}]]),nL=YI(`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`}]]),rL=YI(`Info`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 16v-4`,key:`1dtifu`}],[`path`,{d:`M12 8h.01`,key:`e9boi3`}]]),iL=YI(`Minus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}]]),aL=YI(`Plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]),oL=YI(`RotateCcw`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}]]),sL=YI(`Shuffle`,[[`path`,{d:`M2 18h1.4c1.3 0 2.5-.6 3.3-1.7l6.1-8.6c.7-1.1 2-1.7 3.3-1.7H22`,key:`1wmou1`}],[`path`,{d:`m18 2 4 4-4 4`,key:`pucp1d`}],[`path`,{d:`M2 6h1.9c1.5 0 2.9.9 3.6 2.2`,key:`10bdb2`}],[`path`,{d:`M22 18h-5.9c-1.3 0-2.6-.7-3.3-1.8l-.5-.8`,key:`vgxac0`}],[`path`,{d:`m18 14 4 4-4 4`,key:`10pe0f`}]]),cL=YI(`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`}]]),lL=YI(`Square`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}]]),uL=YI(`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`}]]),dL=YI(`X`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]);function fL(e,t){return e.computerId===void 0||e.computerId===t}var pL=`@cf/black-forest-labs/flux-2-klein-4b`,mL={landscape:{height:768,width:1024},portrait:{height:1024,width:768},square:{height:1024,width:1024}},hL=[`landscape`,`portrait`,`square`];function gL(e){return e instanceof KA&&e.stage===`provider`&&e.provider!==void 0&&`reason`in e.provider&&e.provider.reason===`credits_exhausted`}function _L(e){return gL(e)?{title:`AI Gateway credits unavailable`,message:`Cloudflare AI Gateway couldn't fund this request. Check the account's credits and billing in the Cloudflare dashboard under AI Gateway, or choose a Workers AI model such as Flux.${e.code===`MEDIA_PROVIDER_FAILURE_UNCHARGED`?` You weren't charged.`:``}`,retryable:!1}:ox(e,{INSUFFICIENT_CREDIT:{title:`Couldn’t create image`,message:`Media generation needs Team credits. Add credits in Billing, then retry.`}})}function vL(){return{destination:void 0,height:768,model:pL,prompt:``,references:[],steps:void 0,width:1024}}function yL(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 bL(e,t,n){let r=e.destination?.trim();if(r)return r;let i=n?.outputFormats.includes(`png`)?`png`:n?.outputFormats[0]??`png`,a=n?.kind===`video`?`mp4`:i===`jpeg`?`jpg`:i;return yL(aA({count:4}),t,a)}function xL(e){return e?.kind===`video`?`Generate video`:`Generate image`}function SL(e,t,n=!1){if(e===void 0)return`Creating media…`;if(e.kind!==`video`)return`Creating image…`;if(t===void 0)return`Creating video… Videos take about 2 minutes`;let r=Math.max(0,Math.floor(t/1e3));return`Creating video… ${String(Math.floor(r/60))}:${String(r%60).padStart(2,`0`)} elapsed${n?` since reopening`:``} · Videos take about 2 minutes`}var CL=(e,t)=>t===0?e:CL(t,e%t),wL=(e,t,n)=>{if(n!==void 0)return`${String(e)} × ${String(t)} · ${String(n[0])}:${String(n[1])}`;let r=CL(e,t);return`${String(e)} × ${String(t)} · ${String(e/r)}:${String(t/r)}`},TL=[[16,9],[21,9]],EL=16;function DL(e){let t=e.input.maxDimension;if(e.kind!==`image`||e.input.dimensions!==`own`||!e.input.maxDimensionDocumented||t===null)return[];let n=Math.floor(t/EL)*EL;return TL.map(([e,t])=>{let r=Math.round(n*t/e/EL)*EL;return{value:`${String(n)}x${String(r)}`,label:wL(n,r,[e,t]),width:n,height:r}})}function OL(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=CL(t,n),a=t/i,o=n/i;return a<=21&&o<=21?`${String(a)}:${String(o)}`:`${String(t)} × ${String(n)}`}function kL(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:wL(n,r),width:n,height:r}]}):[...hL.map(e=>({value:e,label:wL(mL[e].width,mL[e].height),...mL[e]})),...e===void 0?[]:DL(e)]}function AL(e,t,n){return n?.kind===`video`&&t.kind===`video`||t.input.dimensions!==`none`&&Td(eb(BL(()=>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 jL(e){return e.label.split(` — `)[0]??e.label}function ML(e,t){return e.find(e=>e.id===t)}function NL(e,t){return{...e,height:t.input.defaultHeight,model:t.id,steps:t.input.steps===`fixed`?void 0:t.input.defaultSteps??void 0,durationSeconds:t.video?.defaultSeconds,generateAudio:t.video?.defaultGenerateAudio??void 0,width:t.input.defaultWidth}}var PL={"first-frame":`First frame`,"last-frame":`Last frame`,reference:`Reference`};function FL(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 IL(e){return e?.video?.referenceRoles??[]}function LL(e,t){let n=IL(t);if(t?.video==null)return e.map(({path:e,computerId:t})=>t===void 0?{path:e}:{path:e,computerId:t});let r=e.map(e=>e.role!==void 0&&n.includes(e.role)?e.role:void 0),i=e=>r.includes(e),a=n.includes(`last-frame`),o=i(`reference`)||!i(`first-frame`)&&!i(`last-frame`)&&e.length>(a?2:1);return e.map((e,t)=>{let s=r[t];return s===void 0&&(s=o&&n.includes(`reference`)?`reference`:!i(`first-frame`)&&n.includes(`first-frame`)?`first-frame`:a&&!i(`last-frame`)?`last-frame`:n.includes(`reference`)?`reference`:`first-frame`,r[t]=s),{...e,role:s}})}function RL(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 zL(e,t){let n=t.video?.formats.find(t=>t.width===e.width&&t.height===e.height);if(t.kind===`video`&&n===void 0)throw Error(`Choose a supported video resolution and aspect ratio.`);let r={height:e.height,model:e.model,prompt:e.prompt.trim(),width:e.width};return n!==void 0&&(r.resolution=n.resolution,r.aspectRatio=n.aspectRatio),e.steps!==void 0&&(r.steps=e.steps),e.durationSeconds!==void 0&&(r.durationSeconds=e.durationSeconds),e.references.length>0&&(r.references=LL(e.references,t)),t.video?.supportsAudio===!0&&e.generateAudio!==void 0&&(r.generateAudio=e.generateAudio),{destination:{path:e.destination?.trim()??``},settings:r}}function BL(e){return q({model:lb,width:ub,height:ub,durationSeconds:rb(yb(ub)),steps:rb(yb(ub))}).check(wb(t=>{let n=e(t.model);if(!Number.isSafeInteger(t.width)||t.width<1)return{path:[`width`],issue:`Width must be a positive integer.`};if(!Number.isSafeInteger(t.height)||t.height<1)return{path:[`height`],issue:`Height must be a positive integer.`};if(n!==void 0){if(n.input.dimensions===`own`){let e=n.input.maxDimension??4096;if(t.width<256||t.height<256)return{path:[t.width<256?`width`:`height`],issue:`${n.label} requires dimensions of at least 256 × 256.`};if(t.width>e||t.height>e)return{path:[t.width>e?`width`:`height`],issue:`${n.label} accepts dimensions up to ${String(e)}.`}}if(n.sizes!==null&&!n.sizes.includes(`${String(t.width)}x${String(t.height)}`))return{path:[`width`],issue:`${n.label} accepts only these sizes: ${n.sizes.join(`, `)}.`};if(n.video!==null&&t.durationSeconds!==void 0&&(!Number.isSafeInteger(t.durationSeconds)||t.durationSeconds<n.video.minSeconds||t.durationSeconds>n.video.maxSeconds))return{path:[`durationSeconds`],issue:`${n.label} makes clips from ${String(n.video.minSeconds)} to ${String(n.video.maxSeconds)} seconds.`};if(n.input.steps===`fixed`&&t.steps!==void 0)return{path:[`steps`],issue:`${n.label} uses fixed steps.`};if(t.steps!==void 0&&(!Number.isSafeInteger(t.steps)||t.steps<1||n.input.maxSteps!==null&&t.steps>n.input.maxSteps))return{path:[`steps`],issue:`${n.label} accepts at most ${String(n.input.maxSteps??`the provider limit`)} steps.`}}}))}function VL(e,t){let n=e.trim().length;return n>t.maxPromptLength?{length:n,excess:n-t.maxPromptLength}:null}function HL(e,t){if(e.destination?.trim().length===0)return`A destination file path is required.`;if(e.prompt.trim().length===0)return t?.kind===`video`?`Describe the video to generate.`:`Describe the image to generate.`;if(t===void 0)return`Choose a model from the granted registry.`;let n=VL(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=eb(BL(()=>t))(e);if(wd(r))return Ih()(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 RL(LL(e.references,t),t,n?.resolution)}}var UL=$y(qb(q({error:ab(`too_large`)})));async function WL(e,t){let n,r=()=>n??=e.close(),i=()=>{r().catch(e=>{jS(`files.read.abort-close`,e)})};t.signal?.addEventListener(`abort`,i,{once:!0});try{t.signal?.throwIfAborted();let n=await e.response();try{let e=tb(Sb(Response))(n);if(e.status===413)throw new Y(`App file exceeds the read bound`,{code:UL(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{YO(n)}}finally{t.signal?.removeEventListener(`abort`,i);try{await r()}finally{e[Symbol.dispose]()}}}async function GL(e,t,n){let r,i=()=>r??=e.close(),a=()=>{i().catch(e=>{jS(`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){jS(`files.write.remote-close`,e)}try{e[Symbol.dispose]()}catch(e){jS(`files.write.local-dispose`,e)}}}var KL=q({path:lb,entries:mb(q({name:lb,type:_b([`file`,`directory`,`symlink`]),size:ub,modifiedAt:ub})),nextOffset:vb(ub)}),qL=Kk(`computer.list`,1,Po(()=>qk({list:Yk(Jk(Ha().transform(e=>tb(KL)(e))))}))),JL=gb([q({state:_b([`running`,`sleeping`,`starting`])}),q({state:ab(`queued`),position:ub.pipe(J(Rb()),J(Pb(0)))})]),YL=q({enabled:db,effective:db,blockedBy:vb(_b([`team`,`global`]))}),XL=q({computerId:Gb,name:Gb,runtime:JL,backends:mb(q({id:Gb,kind:_b([`platform-container`,`on-box-vm`,`local`]),status:_b([`ready`,`queued`,`online`,`offline`]),queuePosition:vb(ub.pipe(J(Rb()),J(Pb(0)))),hostId:vb(lb),hostLabel:vb(lb),folderLabel:vb(lb),detachable:db})),internet:YL});Kk(`computer.instrument.read`,1,Po(()=>qk({read:Yk(Jk(Ha().transform(e=>tb(XL)(e))))}))),Kk(`computer.instrument.control`,1,Po(()=>qk({start:Yk(Jk(Ha().transform(e=>tb(JL)(e)))),setInternetAccess:Yk(Jk(Ha().transform(e=>tb(YL)(e)))),detachLocal:Yk(Jk(Ha().transform(e=>tb(q({detached:db}))(e))))})));var ZL=gb([q({ports:mb(q({port:ub.pipe(J(Rb()),J(Lb({minimum:1,maximum:65535}))),previewUrl:Gb,openMode:_b([`inline`,`external-only`]),expiresAt:ub.pipe(J(Rb()),J(Pb(0)))})).pipe(J(Ub(64)))}),q({error:ab(`port_previews_not_configured`)})]),QL=q({port:ub.annotate({message:`Use a port from 1 to 65535.`}).check(Rb({message:`Use a port from 1 to 65535.`}),Lb({minimum:1,maximum:65535},{message:`Use a port from 1 to 65535.`})),exposed:db}),$L=q({port:ub.pipe(J(Rb()),J(Lb({minimum:1,maximum:65535}))),removed:db});Kk(`computer.ports`,2,Po(()=>qk({list:Yk(Jk(Ha().transform(e=>tb(ZL)(e)))),expose:Yk(Jk(Ha().transform(e=>tb(QL)(e)))),unexpose:Yk(Jk(Ha().transform(e=>tb($L)(e))))})));var eR=_b([`synced`,`pending`,`unknown`]),tR=q({port:vb(QL.fields.port),id:Gb,command:Gb,cwd:vb(lb),startedAt:ub.pipe(J(Rb()),J(Fb(0))),state:_b([`running`,`exited`,`uncertain`]),exitCode:vb(ub.pipe(J(Rb()))),sync:eR,endedAt:vb(ub.pipe(J(Rb()),J(Fb(0))))}),nR=q({processes:mb(tR)}),rR=q({process:tR,signalled:db});q({requestId:Gb.pipe(J(Ub(256))),command:Gb.pipe(J(Ub(16384))),cwd:rb(lb),port:rb(QL.fields.port)}),Kk(`computer.processes`,1,Po(()=>qk({start:Yk(Jk(Ha().transform(e=>tb(tR)(e)))),list:Yk(Jk(Ha().transform(e=>tb(nR)(e)))),kill:Yk(Jk(Ha().transform(e=>tb(rR)(e))))})));var iR=Kk(`computer.readFile`,1,Po(()=>qk({open:Yk(qk({response:Yk(Ho(Response)),close:Xk}))})));async function aR(e,t,n){return await WL(await e.require(iR).open(t),{...n,name:t.path.split(`/`).at(-1)??`file`})}async function oR(e,t){return tb(KL)(await e.require(qL).list(t))}var sR=Kk(`computer.writeFile`,3,Po(()=>qk({open:Yk(qk({write:Xk,close:Xk})),mkdir:Xk,replace:Yk(Jk(Ha().transform(e=>tb(cR)(e))))}))),cR=gb([q({kind:ab(`replaced`),path:Gb,bytes:ub.pipe(J(Rb()),J(Fb(0)))}),q({kind:ab(`conflict`)})]),lR=q({computerName:Gb.pipe(J(Ub(256))),teamName:Gb.pipe(J(Ub(256))),modelDoor:Gb.pipe(J(Ub(256))),uptimeSeconds:ub.pipe(J(Rb()),J(Fb(0))),version:Gb.pipe(J(Ub(64)))});Kk(`computer.terminal`,2,Po(()=>qk({open:Yk(qk({information:Yk(Jk(Ha().transform(e=>tb(lR)(e)))),output:Yk(Ho(ReadableStream).transform(e=>e.pipeThrough(new TransformStream({transform(e,t){t.enqueue(Ho(Uint8Array).parse(e))}})))),input:Yk(Ho(WritableStream)),resize:Xk,close:Xk}))})));async function uR(e,t,n){await GL(await e.require(sR).open({path:t.path}),t.content,n)}var dR=o((e=>{function t(e,t,n){if(n===void 0&&(n=Array.prototype),e&&typeof n.find==`function`)return n.find.call(e,t);for(var i=0;i<e.length;i++)if(r(e,i)){var a=e[i];if(t.call(void 0,a,i,e))return a}}function n(e,t){return t===void 0&&(t=Object),t&&typeof t.getOwnPropertyDescriptors==`function`&&(e=t.create(null,t.getOwnPropertyDescriptors(e))),t&&typeof t.freeze==`function`?t.freeze(e):e}function r(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function i(e,t){if(typeof e!=`object`||!e)throw TypeError(`target is not an object`);for(var n in t)r(t,n)&&(e[n]=t[n]);return e}var a=n({allowfullscreen:!0,async:!0,autofocus:!0,autoplay:!0,checked:!0,controls:!0,default:!0,defer:!0,disabled:!0,formnovalidate:!0,hidden:!0,ismap:!0,itemscope:!0,loop:!0,multiple:!0,muted:!0,nomodule:!0,novalidate:!0,open:!0,playsinline:!0,readonly:!0,required:!0,reversed:!0,selected:!0});function o(e){return r(a,e.toLowerCase())}var s=n({area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function c(e){return r(s,e.toLowerCase())}var l=n({script:!1,style:!1,textarea:!0,title:!0});function u(e){var t=e.toLowerCase();return r(l,t)&&!l[t]}function d(e){var t=e.toLowerCase();return r(l,t)&&l[t]}function f(e){return e===m.HTML}function p(e){return f(e)||e===m.XML_XHTML_APPLICATION}var m=n({HTML:`text/html`,XML_APPLICATION:`application/xml`,XML_TEXT:`text/xml`,XML_XHTML_APPLICATION:`application/xhtml+xml`,XML_SVG_IMAGE:`image/svg+xml`}),h=Object.keys(m).map(function(e){return m[e]});function g(e){return h.indexOf(e)>-1}var _=n({HTML:`http://www.w3.org/1999/xhtml`,SVG:`http://www.w3.org/2000/svg`,XML:`http://www.w3.org/XML/1998/namespace`,XMLNS:`http://www.w3.org/2000/xmlns/`});e.assign=i,e.find=t,e.freeze=n,e.HTML_BOOLEAN_ATTRIBUTES=a,e.HTML_RAW_TEXT_ELEMENTS=l,e.HTML_VOID_ELEMENTS=s,e.hasDefaultHTMLNamespace=p,e.hasOwn=r,e.isHTMLBooleanAttribute=o,e.isHTMLRawTextElement=u,e.isHTMLEscapableRawTextElement=d,e.isHTMLMimeType=f,e.isHTMLVoidElement=c,e.isValidMimeType=g,e.MIME_TYPE=m,e.NAMESPACE=_})),fR=o((e=>{var t=dR();function n(e,t){e.prototype=Object.create(Error.prototype,{constructor:{value:e},name:{value:e.name,enumerable:!0,writable:t}})}var r=t.freeze({Error:`Error`,IndexSizeError:`IndexSizeError`,DomstringSizeError:`DomstringSizeError`,HierarchyRequestError:`HierarchyRequestError`,WrongDocumentError:`WrongDocumentError`,InvalidCharacterError:`InvalidCharacterError`,NoDataAllowedError:`NoDataAllowedError`,NoModificationAllowedError:`NoModificationAllowedError`,NotFoundError:`NotFoundError`,NotSupportedError:`NotSupportedError`,InUseAttributeError:`InUseAttributeError`,InvalidStateError:`InvalidStateError`,SyntaxError:`SyntaxError`,InvalidModificationError:`InvalidModificationError`,NamespaceError:`NamespaceError`,InvalidAccessError:`InvalidAccessError`,ValidationError:`ValidationError`,TypeMismatchError:`TypeMismatchError`,SecurityError:`SecurityError`,NetworkError:`NetworkError`,AbortError:`AbortError`,URLMismatchError:`URLMismatchError`,QuotaExceededError:`QuotaExceededError`,TimeoutError:`TimeoutError`,InvalidNodeTypeError:`InvalidNodeTypeError`,DataCloneError:`DataCloneError`,EncodingError:`EncodingError`,NotReadableError:`NotReadableError`,UnknownError:`UnknownError`,ConstraintError:`ConstraintError`,DataError:`DataError`,TransactionInactiveError:`TransactionInactiveError`,ReadOnlyError:`ReadOnlyError`,VersionError:`VersionError`,OperationError:`OperationError`,NotAllowedError:`NotAllowedError`,OptOutError:`OptOutError`}),i=Object.keys(r);function a(e){return typeof e==`number`&&e>=1&&e<=25}function o(e){return typeof e==`string`&&e.substring(e.length-r.Error.length)===r.Error}function s(e,t){a(e)?(this.name=i[e],this.message=t||``):(this.message=e,this.name=o(t)?t:r.Error),Error.captureStackTrace&&Error.captureStackTrace(this,s)}n(s,!0),Object.defineProperties(s.prototype,{code:{enumerable:!0,get:function(){var e=i.indexOf(this.name);return a(e)?e:0}}});for(var c={INDEX_SIZE_ERR:1,DOMSTRING_SIZE_ERR:2,HIERARCHY_REQUEST_ERR:3,WRONG_DOCUMENT_ERR:4,INVALID_CHARACTER_ERR:5,NO_DATA_ALLOWED_ERR:6,NO_MODIFICATION_ALLOWED_ERR:7,NOT_FOUND_ERR:8,NOT_SUPPORTED_ERR:9,INUSE_ATTRIBUTE_ERR:10,INVALID_STATE_ERR:11,SYNTAX_ERR:12,INVALID_MODIFICATION_ERR:13,NAMESPACE_ERR:14,INVALID_ACCESS_ERR:15,VALIDATION_ERR:16,TYPE_MISMATCH_ERR:17,SECURITY_ERR:18,NETWORK_ERR:19,ABORT_ERR:20,URL_MISMATCH_ERR:21,QUOTA_EXCEEDED_ERR:22,TIMEOUT_ERR:23,INVALID_NODE_TYPE_ERR:24,DATA_CLONE_ERR:25},l=Object.entries(c),u=0;u<l.length;u++){var d=l[u][0];s[d]=l[u][1]}function f(e,t,n){this.message=e,this.locator=t,this.cause=n,Error.captureStackTrace&&Error.captureStackTrace(this,f)}n(f),e.DOMException=s,e.DOMExceptionName=r,e.ExceptionCode=c,e.ParseError=f})),pR=o((e=>{function t(e){try{typeof e!=`function`&&(e=RegExp);var t=new e(`𝌆`,`u`).exec(`𝌆`);return!!t&&t[0].length===2}catch{}return!1}var n=t();function r(e){if(e.source[0]!==`[`)throw Error(e+` can not be used with chars`);return e.source.slice(1,e.source.lastIndexOf(`]`))}function i(e,t){if(e.source[0]!==`[`)throw Error(`/`+e.source+`/ can not be used with chars_without`);if(!t||typeof t!=`string`)throw Error(JSON.stringify(t)+` is not a valid search`);if(e.source.indexOf(t)===-1)throw Error(`"`+t+`" is not is /`+e.source+`/`);if(t===`-`&&e.source.indexOf(t)!==1)throw Error(`"`+t+`" is not at the first postion of /`+e.source+`/`);return new RegExp(e.source.replace(t,``),n?`u`:``)}function a(e){var t=this;return new RegExp(Array.prototype.slice.call(arguments).map(function(e){var n=typeof e==`string`;if(n&&t===void 0&&e===`|`)throw Error("use regg instead of reg to wrap expressions with `|`!");return n?e:e.source}).join(``),n?`u`:``)}function o(e){if(arguments.length===0)throw Error(`no parameters provided`);return a.apply(o,[`(?:`].concat(Array.prototype.slice.call(arguments),[`)`]))}var s=`�`,c=/[-\x09\x0A\x0D\x20-\x2C\x2E-\uD7FF\uE000-\uFFFD]/;n&&(c=a(`[`,r(c),`\\u{10000}-\\u{10FFFF}`,`]`));var l=RegExp(`[^`+r(c)+`]`,n?`u`:``),u=/[\x20\x09\x0D\x0A]/,d=r(u),f=a(u,`+`),p=a(u,`*`),m=/[:_a-zA-Z\xC0-\xD6\xD8-\xF6\xF8-\u02FF\u0370-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/;n&&(m=a(`[`,r(m),`\\u{10000}-\\u{10FFFF}`,`]`));var h=a(`[`,r(m),r(/[-.0-9\xB7]/),r(/[\u0300-\u036F\u203F-\u2040]/),`]`),g=a(m,h,`*`),_=a(`^`,g,`$`),v=a(h,`+`),y=o(a(`&`,g,`;`),`|`,o(/&#[0-9]+;|&#x[0-9a-fA-F]+;/)),b=a(`%`,g,`;`),x=o(a(`"`,o(/[^%&"]/,`|`,b,`|`,y),`*`,`"`),`|`,a(`'`,o(/[^%&']/,`|`,b,`|`,y),`*`,`'`)),S=o(`"`,o(/[^<&"]/,`|`,y),`*`,`"`,`|`,`'`,o(/[^<&']/,`|`,y),`*`,`'`),C=a(i(m,`:`),i(h,`:`),`*`),w=a(`^`,C,`$`),T=a(C,o(`:`,C),`?`),E=a(`^`,T,`$`),D=a(`(`,T,`)`),O=o(/"[^"]*"|'[^']*'/),k=a(/^<\?/,`(`,g,`)`,o(f,`(?!`,u,`)(`,c,`*?)`),`?`,/\?>/),A=/[\x20\x0D\x0Aa-zA-Z0-9-'()+,./:=?;!*#@$_%]/,j=o(`"`,A,`*"`,`|`,`'`,i(A,`'`),`*'`),M=`<!--`,N=`-->`,P=a(M,o(i(c,`-`),`|`,a(`-`,i(c,`-`))),`*`,N),F=`#PCDATA`,I=o(`EMPTY`,`|`,`ANY`,`|`,o(a(/\(/,p,F,o(p,/\|/,p,T),`*`,p,/\)\*/),`|`,a(/\(/,p,F,p,/\)/)),`|`,a(/\([^>]+\)/,/[?*+]?/)),L=a(`<!ELEMENT`,f,o(T,`|`,b),f,o(I,`|`,b),p,`>`),R=a(`<!ATTLIST`,f,g,o(f,g,f,o(/CDATA|ID|IDREF|IDREFS|ENTITY|ENTITIES|NMTOKEN|NMTOKENS/,`|`,o(a(`NOTATION`,f,/\(/,p,g,o(p,/\|/,p,g),`*`,p,/\)/),`|`,a(/\(/,p,v,o(p,/\|/,p,v),`*`,p,/\)/))),f,o(/#REQUIRED|#IMPLIED/,`|`,o(o(`#FIXED`,f),`?`,S))),`*`,p,`>`),z=`about:legacy-compat`,ee=o(`"`+z+`"`,`|`,`'`+z+`'`),B=`SYSTEM`,V=`PUBLIC`,te=o(o(B,f,O),`|`,o(V,f,j,f,O)),ne=a(`^`,o(o(B,f,`(?<SystemLiteralOnly>`,O,`)`),`|`,o(V,f,`(?<PubidLiteral>`,j,`)`,f,`(?<SystemLiteral>`,O,`)`))),H=a(`^`,j,`$`),U=a(`^`,O,`$`),re=o(x,`|`,o(te,o(f,`NDATA`,f,g),`?`)),ie=`<!ENTITY`,ae=o(a(ie,f,g,f,re,p,`>`),`|`,a(ie,f,`%`,f,g,f,o(x,`|`,te),p,`>`)),oe=a(`<!NOTATION`,f,g,f,o(te,`|`,a(V,f,j)),p,`>`),se=a(p,`=`,p),W=/1[.]\d+/,G=a(f,`version`,se,o(`'`,W,`'`,`|`,`"`,W,`"`)),ce=/[A-Za-z][-A-Za-z0-9._]*/,le=a(/^<\?xml/,G,o(f,`encoding`,se,o(`"`,ce,`"`,`|`,`'`,ce,`'`)),`?`,o(f,`standalone`,se,o(`'`,o(`yes`,`|`,`no`),`'`,`|`,`"`,o(`yes`,`|`,`no`),`"`)),`?`,p,/\?>/),ue=`<!DOCTYPE`,de=`<![CDATA[`,fe=`]]>`,pe=a(/<!\[CDATA\[/,a(c,`*?`,/\]\]>/));e.chars=r,e.chars_without=i,e.detectUnicodeSupport=t,e.reg=a,e.regg=o,e.ABOUT_LEGACY_COMPAT=z,e.ABOUT_LEGACY_COMPAT_SystemLiteral=ee,e.AttlistDecl=R,e.CDATA_START=de,e.CDATA_END=fe,e.CDSect=pe,e.Char=c,e.Comment=P,e.COMMENT_START=M,e.COMMENT_END=N,e.DOCTYPE_DECL_START=ue,e.elementdecl=L,e.EntityDecl=ae,e.EntityValue=x,e.ExternalID=te,e.ExternalID_match=ne,e.Name=g,e.Name_exact=_,e.NCName_exact=w,e.NotationDecl=oe,e.Reference=y,e.PEReference=b,e.PI=k,e.PUBLIC=V,e.PubidLiteral=j,e.PubidLiteral_match=H,e.QName=T,e.QName_exact=E,e.QName_group=D,e.S=f,e.SChar_s=d,e.S_OPT=p,e.SYSTEM=B,e.SystemLiteral=O,e.SystemLiteral_match=U,e.InvalidChar=l,e.UNICODE_REPLACEMENT_CHARACTER=s,e.UNICODE_SUPPORT=n,e.XMLDecl=le})),mR=o((e=>{var t=dR(),n=t.find,r=t.hasDefaultHTMLNamespace,i=t.hasOwn,a=t.isHTMLMimeType,o=t.isHTMLRawTextElement,s=t.isHTMLVoidElement,c=t.MIME_TYPE,l=t.NAMESPACE,u=Symbol(),d=fR(),f=d.DOMException,p=d.DOMExceptionName,m=pR();function h(e){if(e!==u)throw TypeError(`Illegal constructor`)}function g(e){return e!==``}function _(e){return e?e.split(/[\t\n\f\r ]+/).filter(g):[]}function v(e,t){return i(e,t)||(e[t]=!0),e}function y(e){if(!e)return[];var t=_(e);return Object.keys(t.reduce(v,{}))}function b(e){return function(t){return e&&e.indexOf(t)!==-1}}function x(e){if(!m.QName_exact.test(e))throw new f(f.INVALID_CHARACTER_ERR,`invalid character in qualified name "`+e+`"`)}function S(e,n){x(n),e||=null;var r=null,i=n;if(n.indexOf(`:`)>=0){var a=n.split(`:`);r=a[0],i=a[1]}if(r!==null&&e===null)throw new f(f.NAMESPACE_ERR,`prefix is non-null and namespace is null`);if(r===`xml`&&e!==t.NAMESPACE.XML)throw new f(f.NAMESPACE_ERR,`prefix is "xml" and namespace is not the XML namespace`);if((r===`xmlns`||n===`xmlns`)&&e!==t.NAMESPACE.XMLNS)throw new f(f.NAMESPACE_ERR,`either qualifiedName or prefix is "xmlns" and namespace is not the XMLNS namespace`);if(e===t.NAMESPACE.XMLNS&&r!==`xmlns`&&n!==`xmlns`)throw new f(f.NAMESPACE_ERR,`namespace is the XMLNS namespace and neither qualifiedName nor prefix is "xmlns"`);return[e,r,i]}function C(e,t){for(var n in e)i(e,n)&&(t[n]=e[n])}function w(e,t){var n=e.prototype;if(!(n instanceof t)){function r(){}r.prototype=t.prototype,r=new r,C(n,r),e.prototype=n=r}n.constructor!=e&&(typeof e!=`function`&&console.error(`unknown Class:`+e),n.constructor=e)}var T={},E=T.ELEMENT_NODE=1,D=T.ATTRIBUTE_NODE=2,O=T.TEXT_NODE=3,k=T.CDATA_SECTION_NODE=4,A=T.ENTITY_REFERENCE_NODE=5,j=T.ENTITY_NODE=6,M=T.PROCESSING_INSTRUCTION_NODE=7,N=T.COMMENT_NODE=8,P=T.DOCUMENT_NODE=9,F=T.DOCUMENT_TYPE_NODE=10,I=T.DOCUMENT_FRAGMENT_NODE=11,L=T.NOTATION_NODE=12,R=t.freeze({DOCUMENT_POSITION_DISCONNECTED:1,DOCUMENT_POSITION_PRECEDING:2,DOCUMENT_POSITION_FOLLOWING:4,DOCUMENT_POSITION_CONTAINS:8,DOCUMENT_POSITION_CONTAINED_BY:16,DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC:32});function z(e,t){if(t.length<e.length)return z(t,e);var n=null;for(var r in e){if(e[r]!==t[r])return n;n=e[r]}return n}function ee(e){return e.guid||=Math.random(),e.guid}function B(){}B.prototype={length:0,item:function(e){return e>=0&&e<this.length?this[e]:null},toString:function(e){for(var t=typeof e==`function`?{requireWellFormed:!1,splitCDATASections:!0,nodeFilter:e}:e?{requireWellFormed:!!e.requireWellFormed,splitCDATASections:e.splitCDATASections!==!1,nodeFilter:e.nodeFilter||null}:{requireWellFormed:!1,splitCDATASections:!0,nodeFilter:null},n=[],r=0;r<this.length;r++)Ue(this[r],n,null,t);return n.join(``)},filter:function(e){return Array.prototype.filter.call(this,e)},indexOf:function(e){return Array.prototype.indexOf.call(this,e)}},B.prototype[Symbol.iterator]=function(){var e=this,t=0;return{next:function(){return t<e.length?{value:e[t++],done:!1}:{done:!0}},return:function(){return{done:!0}}}};function V(e,t){this._node=e,this._refresh=t,te(this)}function te(e){var t=e._node._inc||e._node.ownerDocument._inc;if(e._inc!==t){var n=e._refresh(e._node);if(Ke(e,`length`,n.length),!e.$$length||n.length<e.$$length)for(var r=n.length;r in e;r++)i(e,r)&&delete e[r];C(n,e),e._inc=t}}V.prototype.item=function(e){return te(this),this[e]||null},w(V,B);function ne(){this._nsIndex=Object.create(null),this._noNsIndex=Object.create(null)}function H(e,t){for(var n=0;n<e.length;){if(e[n]===t)return n;n++}}function U(e,t,n){if(!t)return e._noNsIndex;var r=e._nsIndex[t];return!r&&n&&(r=e._nsIndex[t]=Object.create(null)),r}function re(e,t,n){var r=U(e,t,!1);return r&&r[n]||null}function ie(e,t){U(e,t.namespaceURI,!0)[t.localName]=t}function ae(e,t){var n=U(e,t.namespaceURI,!1);n&&delete n[t.localName]}function oe(e,t,n,r){if(r?t[H(t,r)]=n:(t[t.length]=n,t.length++),ie(t,n),e){n.ownerElement=e;var i=e.ownerDocument;i&&(r&&pe(i,e,r),fe(i,e,n))}}function se(e,t,n){var r=H(t,n);if(r>=0){for(var i=t.length-1;r<=i;)t[r]=t[++r];if(t.length=i,ae(t,n),e){var a=e.ownerDocument;a&&pe(a,e,n),n.ownerElement=null}}}ne.prototype={length:0,item:B.prototype.item,getNamedItem:function(e){this._ownerElement&&this._ownerElement._isInHTMLDocumentAndNamespace()&&(e=e.toLowerCase());for(var t=0;t<this.length;){var n=this[t];if(n.nodeName===e)return n;t++}return null},setNamedItem:function(e){var t=e.ownerElement;if(t&&t!==this._ownerElement)throw new f(f.INUSE_ATTRIBUTE_ERR);var n=re(this,e.namespaceURI,e.localName);return n===e?e:(oe(this._ownerElement,this,e,n),n)},setNamedItemNS:function(e){return this.setNamedItem(e)},removeNamedItem:function(e){var t=this.getNamedItem(e);if(!t)throw new f(f.NOT_FOUND_ERR,e);return se(this._ownerElement,this,t),t},removeNamedItemNS:function(e,t){var n=this.getNamedItemNS(e,t);if(!n)throw new f(f.NOT_FOUND_ERR,e?e+` : `+t:t);return se(this._ownerElement,this,n),n},getNamedItemNS:function(e,t){e||=null;for(var n=0;n<this.length;){var r=this[n];if(r.localName===t&&r.namespaceURI===e)return r;n++}return null}},ne.prototype[Symbol.iterator]=function(){var e=this,t=0;return{next:function(){return t<e.length?{value:e[t++],done:!1}:{done:!0}},return:function(){return{done:!0}}}};function W(){}W.prototype={hasFeature:function(e,t){return!0},createDocument:function(e,t,n){var r=c.XML_APPLICATION;e===l.HTML?r=c.XML_XHTML_APPLICATION:e===l.SVG&&(r=c.XML_SVG_IMAGE);var i=new de(u,{contentType:r});if(i.implementation=this,i.childNodes=new B,i.doctype=n||null,n&&i.appendChild(n),t){var a=i.createElementNS(e,t);i.appendChild(a)}return i},createDocumentType:function(e,t,n,r){x(e);var i=new Ne(u);return i.name=e,i.nodeName=e,i.publicId=t||``,i.systemId=n||``,i.internalSubset=r||``,i.childNodes=new B,i},createHTMLDocument:function(e){var t=new de(u,{contentType:c.HTML});if(t.implementation=this,t.childNodes=new B,e!==!1){t.doctype=this.createDocumentType(`html`),t.doctype.ownerDocument=t,t.appendChild(t.doctype);var n=t.createElement(`html`);t.appendChild(n);var r=t.createElement(`head`);if(n.appendChild(r),typeof e==`string`){var i=t.createElement(`title`);i.appendChild(t.createTextNode(e)),r.appendChild(i)}n.appendChild(t.createElement(`body`))}return t}};function G(e){h(e)}G.prototype={firstChild:null,lastChild:null,previousSibling:null,nextSibling:null,parentNode:null,get parentElement(){return this.parentNode&&this.parentNode.nodeType===this.ELEMENT_NODE?this.parentNode:null},childNodes:null,ownerDocument:null,nodeValue:null,namespaceURI:null,prefix:null,localName:null,baseURI:`about:blank`,get isConnected(){var e=this.getRootNode();return e&&e.nodeType===e.DOCUMENT_NODE},contains:function(e){if(!e)return!1;var t=e;do{if(this===t)return!0;t=t.parentNode}while(t);return!1},getRootNode:function(e){var t=this;do{if(!t.parentNode)return t;t=t.parentNode}while(t)},isEqualNode:function(e){if(!e)return!1;for(var t=[{node:this,other:e}];t.length>0;){var n=t.pop(),r=n.node,i=n.other;if(r.nodeType!==i.nodeType)return!1;switch(r.nodeType){case r.DOCUMENT_TYPE_NODE:if(r.name!==i.name||r.publicId!==i.publicId||r.systemId!==i.systemId)return!1;break;case r.ELEMENT_NODE:if(r.namespaceURI!==i.namespaceURI||r.prefix!==i.prefix||r.localName!==i.localName||r.attributes.length!==i.attributes.length)return!1;for(var a=0;a<r.attributes.length;a++){var o=r.attributes.item(a),s=i.getAttributeNodeNS(o.namespaceURI,o.localName);if(!s)return!1;t.push({node:o,other:s})}break;case r.ATTRIBUTE_NODE:if(r.namespaceURI!==i.namespaceURI||r.localName!==i.localName||r.value!==i.value)return!1;break;case r.PROCESSING_INSTRUCTION_NODE:if(r.target!==i.target||r.data!==i.data)return!1;break;case r.TEXT_NODE:case r.CDATA_SECTION_NODE:case r.COMMENT_NODE:if(r.data!==i.data)return!1}if(r.childNodes.length!==i.childNodes.length)return!1;for(var a=r.childNodes.length-1;a>=0;a--)t.push({node:r.childNodes[a],other:i.childNodes[a]})}return!0},isSameNode:function(e){return this===e},insertBefore:function(e,t){return Ee(this,e,t)},replaceChild:function(e,t){Ee(this,e,t,Te),t&&this.removeChild(t)},removeChild:function(e){return he(this,e)},appendChild:function(e){return this.insertBefore(e,null)},hasChildNodes:function(){return this.firstChild!=null},cloneNode:function(e){return Ge(this.ownerDocument||this,this,e)},normalize:function(){ue(this,null,{enter:function(e){for(var t=e.firstChild;t;){var n=t.nextSibling;if(n!==null&&n.nodeType===O&&t.nodeType===O){for(var r=[],i=n;i!==null&&i.nodeType===O;)r.push(i.data),i=i.nextSibling;for(var a=t.nextSibling;a!==i;){var o=a.nextSibling;a.parentNode=null,a.previousSibling=null,a.nextSibling=null,a=o}t.nextSibling=i,i===null?e.lastChild=t:i.previousSibling=t,t.appendData(r.join(``)),me(e.ownerDocument,e),t=i}else t=n}return!0}})},isSupported:function(e,t){return this.ownerDocument.implementation.hasFeature(e,t)},lookupPrefix:function(e){for(var t=this;t;){var n=t._nsMap;if(n){for(var r in n)if(i(n,r)&&n[r]===e)return r}t=t.nodeType==D?t.ownerDocument:t.parentNode}return null},lookupNamespaceURI:function(e){for(var t=this;t;){var n=t._nsMap;if(n&&i(n,e))return n[e];t=t.nodeType==D?t.ownerDocument:t.parentNode}return null},isDefaultNamespace:function(e){return this.lookupPrefix(e)==null},compareDocumentPosition:function(e){if(this===e)return 0;var t=e,n=this,r=null,i=null;if(t instanceof Oe&&(r=t,t=r.ownerElement),n instanceof Oe&&(i=n,n=i.ownerElement,r&&t&&n===t))for(var a=0,o;o=n.attributes[a];a++){if(o===r)return R.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC+R.DOCUMENT_POSITION_PRECEDING;if(o===i)return R.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC+R.DOCUMENT_POSITION_FOLLOWING}if(!t||!n||n.ownerDocument!==t.ownerDocument)return R.DOCUMENT_POSITION_DISCONNECTED+R.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC+(ee(n.ownerDocument)>ee(t.ownerDocument)?R.DOCUMENT_POSITION_FOLLOWING:R.DOCUMENT_POSITION_PRECEDING);if(i&&t===n)return R.DOCUMENT_POSITION_CONTAINS+R.DOCUMENT_POSITION_PRECEDING;if(r&&t===n)return R.DOCUMENT_POSITION_CONTAINED_BY+R.DOCUMENT_POSITION_FOLLOWING;for(var s=[],c=t.parentNode;c;){if(!i&&c===n)return R.DOCUMENT_POSITION_CONTAINED_BY+R.DOCUMENT_POSITION_FOLLOWING;s.push(c),c=c.parentNode}s.reverse();for(var l=[],u=n.parentNode;u;){if(!r&&u===t)return R.DOCUMENT_POSITION_CONTAINS+R.DOCUMENT_POSITION_PRECEDING;l.push(u),u=u.parentNode}l.reverse();var d=z(s,l);for(var f in d.childNodes){var p=d.childNodes[f];if(p===n)return R.DOCUMENT_POSITION_FOLLOWING;if(p===t)return R.DOCUMENT_POSITION_PRECEDING;if(l.indexOf(p)>=0)return R.DOCUMENT_POSITION_FOLLOWING;if(s.indexOf(p)>=0)return R.DOCUMENT_POSITION_PRECEDING}return 0}};function ce(e){return e==`<`&&`<`||e==`>`&&`>`||e==`&`&&`&`||e==`"`&&`"`||`&#`+e.charCodeAt()+`;`}C(T,G),C(T,G.prototype),C(R,G),C(R,G.prototype);function le(e,t){ue(e,null,{enter:function(e){return!t(e)||ue.STOP}})}function ue(e,t,n){for(var r=[{node:e,context:t,phase:ue.ENTER}];r.length>0;){var i=r.pop();if(i.phase===ue.ENTER){var a=n.enter(i.node,i.context);if(a===ue.STOP)return ue.STOP;if(r.push({node:i.node,context:a,phase:ue.EXIT}),a==null)continue;for(var o=i.node.lastChild;o;)r.push({node:o,context:a,phase:ue.ENTER}),o=o.previousSibling}else n.exit&&n.exit(i.node,i.context)}}ue.STOP=Symbol(`walkDOM.STOP`),ue.ENTER=0,ue.EXIT=1;function de(e,t){h(e);var n=t||{};this.ownerDocument=this,this.contentType=n.contentType||c.XML_APPLICATION,this.type=a(this.contentType)?`html`:`xml`}function fe(e,t,n){e&&e._inc++,n.namespaceURI===l.XMLNS&&(t._nsMap[n.prefix?n.localName:``]=n.value)}function pe(e,t,n,r){e&&e._inc++,n.namespaceURI===l.XMLNS&&delete t._nsMap[n.prefix?n.localName:``]}function me(e,t,n){if(e&&e._inc){e._inc++;var r=t.childNodes;if(n&&!n.nextSibling)r[r.length++]=n;else{for(var i=t.firstChild,a=0;i;)r[a++]=i,i=i.nextSibling;r.length=a,delete r[r.length]}}}function he(e,t){if(e!==t.parentNode)throw new f(f.NOT_FOUND_ERR,`child's parent is not parent`);var n=t.previousSibling,r=t.nextSibling;return n?n.nextSibling=r:e.firstChild=r,r?r.previousSibling=n:e.lastChild=n,me(e.ownerDocument,e),t.parentNode=null,t.previousSibling=null,t.nextSibling=null,t}function ge(e){return e&&(e.nodeType===G.DOCUMENT_NODE||e.nodeType===G.DOCUMENT_FRAGMENT_NODE||e.nodeType===G.ELEMENT_NODE)}function _e(e){return e&&(e.nodeType===G.CDATA_SECTION_NODE||e.nodeType===G.COMMENT_NODE||e.nodeType===G.DOCUMENT_FRAGMENT_NODE||e.nodeType===G.DOCUMENT_TYPE_NODE||e.nodeType===G.ELEMENT_NODE||e.nodeType===G.PROCESSING_INSTRUCTION_NODE||e.nodeType===G.TEXT_NODE)}function ve(e){return e&&e.nodeType===G.DOCUMENT_TYPE_NODE}function ye(e){return e&&e.nodeType===G.ELEMENT_NODE}function be(e){return e&&e.nodeType===G.TEXT_NODE}function xe(e,t){var r=e.childNodes||[];if(n(r,ye)||ve(t))return!1;var i=n(r,ve);return!(t&&i&&r.indexOf(i)>r.indexOf(t))}function Se(e,t){var r=e.childNodes||[];function i(e){return ye(e)&&e!==t}if(n(r,i))return!1;var a=n(r,ve);return!(t&&a&&r.indexOf(a)>r.indexOf(t))}function Ce(e,t,n){if(!ge(e))throw new f(f.HIERARCHY_REQUEST_ERR,`Unexpected parent node type `+e.nodeType);if(n&&n.parentNode!==e)throw new f(f.NOT_FOUND_ERR,`child not in parent`);if(!_e(t)||ve(t)&&e.nodeType!==G.DOCUMENT_NODE)throw new f(f.HIERARCHY_REQUEST_ERR,`Unexpected node type `+t.nodeType+` for parent node type `+e.nodeType)}function we(e,t,r){var i=e.childNodes||[],a=t.childNodes||[];if(t.nodeType===G.DOCUMENT_FRAGMENT_NODE){var o=a.filter(ye);if(o.length>1||n(a,be))throw new f(f.HIERARCHY_REQUEST_ERR,`More than one element or text in fragment`);if(o.length===1&&!xe(e,r))throw new f(f.HIERARCHY_REQUEST_ERR,`Element in fragment can not be inserted before doctype`)}if(ye(t)&&!xe(e,r))throw new f(f.HIERARCHY_REQUEST_ERR,`Only one element can be added and only after doctype`);if(ve(t)){if(n(i,ve))throw new f(f.HIERARCHY_REQUEST_ERR,`Only one doctype is allowed`);var s=n(i,ye);if(r&&i.indexOf(s)<i.indexOf(r))throw new f(f.HIERARCHY_REQUEST_ERR,`Doctype can only be inserted before an element`);if(!r&&s)throw new f(f.HIERARCHY_REQUEST_ERR,`Doctype can not be appended since element is present`)}}function Te(e,t,r){var i=e.childNodes||[],a=t.childNodes||[];if(t.nodeType===G.DOCUMENT_FRAGMENT_NODE){var o=a.filter(ye);if(o.length>1||n(a,be))throw new f(f.HIERARCHY_REQUEST_ERR,`More than one element or text in fragment`);if(o.length===1&&!Se(e,r))throw new f(f.HIERARCHY_REQUEST_ERR,`Element in fragment can not be inserted before doctype`)}if(ye(t)&&!Se(e,r))throw new f(f.HIERARCHY_REQUEST_ERR,`Only one element can be added and only after doctype`);if(ve(t)){function e(e){return ve(e)&&e!==r}if(n(i,e))throw new f(f.HIERARCHY_REQUEST_ERR,`Only one doctype is allowed`);var s=n(i,ye);if(r&&i.indexOf(s)<i.indexOf(r))throw new f(f.HIERARCHY_REQUEST_ERR,`Doctype can only be inserted before an element`)}}function Ee(e,t,n,r){Ce(e,t,n),e.nodeType===G.DOCUMENT_NODE&&(r||we)(e,t,n);var i=t.parentNode;if(i&&i.removeChild(t),t.nodeType===I){var a=t.firstChild;if(a==null)return t;var o=t.lastChild}else a=o=t;var s=n?n.previousSibling:e.lastChild;a.previousSibling=s,o.nextSibling=n,s?s.nextSibling=a:e.firstChild=a,n==null?e.lastChild=o:n.previousSibling=o;do a.parentNode=e;while(a!==o&&(a=a.nextSibling));return me(e.ownerDocument||e,e,t),t.nodeType==I&&(t.firstChild=t.lastChild=null),t}de.prototype={implementation:null,nodeName:`#document`,nodeType:P,doctype:null,documentElement:null,_inc:1,insertBefore:function(e,t){if(e.nodeType===I){for(var n=e.firstChild;n;){var r=n.nextSibling;this.insertBefore(n,t),n=r}return e}return Ee(this,e,t),e.ownerDocument=this,this.documentElement===null&&e.nodeType===E&&(this.documentElement=e),e},removeChild:function(e){var t=he(this,e);return t===this.documentElement&&(this.documentElement=null),t},replaceChild:function(e,t){Ee(this,e,t,Te),e.ownerDocument=this,t&&this.removeChild(t),ye(e)&&(this.documentElement=e)},importNode:function(e,t){return We(this,e,t)},getElementById:function(e){var t=null;return le(this.documentElement,function(n){if(n.nodeType==E&&n.getAttribute(`id`)==e)return t=n,!0}),t},createElement:function(e){var t=new De(u);t.ownerDocument=this,this.type===`html`&&(e=e.toLowerCase()),r(this.contentType)&&(t.namespaceURI=l.HTML),t.nodeName=e,t.tagName=e,t.localName=e,t.childNodes=new B;var n=t.attributes=new ne;return n._ownerElement=t,t},createDocumentFragment:function(){var e=new Le(u);return e.ownerDocument=this,e.childNodes=new B,e},createTextNode:function(e){var t=new Ae(u);return t.ownerDocument=this,t.childNodes=new B,t.appendData(e),t},createComment:function(e){var t=new je(u);return t.ownerDocument=this,t.childNodes=new B,t.appendData(e),t},createCDATASection:function(e){if(e.indexOf(`]]>`)!==-1)throw new f(f.INVALID_CHARACTER_ERR,`data contains "]]>"`);var t=new Me(u);return t.ownerDocument=this,t.childNodes=new B,t.appendData(e),t},createProcessingInstruction:function(e,t){var n=new Re(u);return n.ownerDocument=this,n.childNodes=new B,n.nodeName=n.target=e,n.nodeValue=n.data=t,n},createAttribute:function(e){if(!m.QName_exact.test(e))throw new f(f.INVALID_CHARACTER_ERR,`invalid character in name "`+e+`"`);return this.type===`html`&&(e=e.toLowerCase()),this._createAttribute(e)},_createAttribute:function(e){var t=new Oe(u);return t.ownerDocument=this,t.childNodes=new B,t.name=e,t.nodeName=e,t.localName=e,t.specified=!0,t},createEntityReference:function(e){if(!m.Name_exact.test(e))throw new f(f.INVALID_CHARACTER_ERR,`not a valid xml name "`+e+`"`);if(this.type===`html`)throw new f(`document is an html document`,p.NotSupportedError);var t=new Ie(u);return t.ownerDocument=this,t.childNodes=new B,t.nodeName=e,t},createElementNS:function(e,t){var n=S(e,t),r=new De(u),i=r.attributes=new ne;return r.childNodes=new B,r.ownerDocument=this,r.nodeName=t,r.tagName=t,r.namespaceURI=n[0],r.prefix=n[1],r.localName=n[2],i._ownerElement=r,r},createAttributeNS:function(e,t){var n=S(e,t),r=new Oe(u);return r.ownerDocument=this,r.childNodes=new B,r.nodeName=t,r.name=t,r.specified=!0,r.namespaceURI=n[0],r.prefix=n[1],r.localName=n[2],r}},w(de,G);function De(e){h(e),this._nsMap=Object.create(null)}De.prototype={nodeType:E,attributes:null,getQualifiedName:function(){return this.prefix?this.prefix+`:`+this.localName:this.localName},_isInHTMLDocumentAndNamespace:function(){return this.ownerDocument.type===`html`&&this.namespaceURI===l.HTML},hasAttributes:function(){return!!(this.attributes&&this.attributes.length)},hasAttribute:function(e){return!!this.getAttributeNode(e)},getAttribute:function(e){var t=this.getAttributeNode(e);return t?t.value:null},getAttributeNode:function(e){return this._isInHTMLDocumentAndNamespace()&&(e=e.toLowerCase()),this.attributes.getNamedItem(e)},setAttribute:function(e,t){this._isInHTMLDocumentAndNamespace()&&(e=e.toLowerCase());var n=this.getAttributeNode(e);n?n.value=n.nodeValue=``+t:(n=this.ownerDocument._createAttribute(e),n.value=n.nodeValue=``+t,this.setAttributeNode(n))},removeAttribute:function(e){var t=this.getAttributeNode(e);t&&this.removeAttributeNode(t)},setAttributeNode:function(e){return this.attributes.setNamedItem(e)},setAttributeNodeNS:function(e){return this.attributes.setNamedItemNS(e)},removeAttributeNode:function(e){return this.attributes.removeNamedItem(e.nodeName)},removeAttributeNS:function(e,t){var n=this.getAttributeNodeNS(e,t);n&&this.removeAttributeNode(n)},hasAttributeNS:function(e,t){return this.getAttributeNodeNS(e,t)!=null},getAttributeNS:function(e,t){var n=this.getAttributeNodeNS(e,t);return n?n.value:null},setAttributeNS:function(e,t,n){var r=S(e,t)[2],i=this.getAttributeNodeNS(e,r);i?i.value=i.nodeValue=``+n:(i=this.ownerDocument.createAttributeNS(e,t),i.value=i.nodeValue=``+n,this.setAttributeNode(i))},getAttributeNodeNS:function(e,t){return this.attributes.getNamedItemNS(e,t)},getElementsByClassName:function(e){var t=y(e);return new V(this,function(n){var r=[];return t.length>0&&le(n,function(i){if(i!==n&&i.nodeType===E){var a=i.getAttribute(`class`);if(a){var o=e===a;if(!o){var s=y(a);o=t.every(b(s))}o&&r.push(i)}}}),r})},getElementsByTagName:function(e){var t=(this.nodeType===P?this:this.ownerDocument).type===`html`,n=e.toLowerCase();return new V(this,function(r){var i=[];return le(r,function(a){a!==r&&a.nodeType===E&&(e===`*`||a.getQualifiedName()===(t&&a.namespaceURI===l.HTML?n:e))&&i.push(a)}),i})},getElementsByTagNameNS:function(e,t){return new V(this,function(n){var r=[];return le(n,function(i){i!==n&&i.nodeType===E&&(e===`*`||i.namespaceURI===e)&&(t===`*`||i.localName==t)&&r.push(i)}),r})}},de.prototype.getElementsByClassName=De.prototype.getElementsByClassName,de.prototype.getElementsByTagName=De.prototype.getElementsByTagName,de.prototype.getElementsByTagNameNS=De.prototype.getElementsByTagNameNS,w(De,G);function Oe(e){h(e),this.namespaceURI=null,this.prefix=null,this.ownerElement=null}Oe.prototype.nodeType=D,w(Oe,G);function ke(e){h(e)}ke.prototype={data:``,substringData:function(e,t){return this.data.substring(e,e+t)},appendData:function(e){e=this.data+e,this.nodeValue=this.data=e,this.length=e.length},insertData:function(e,t){this.replaceData(e,0,t)},deleteData:function(e,t){this.replaceData(e,t,``)},replaceData:function(e,t,n){var r=this.data.substring(0,e),i=this.data.substring(e+t);n=r+n+i,this.nodeValue=this.data=n,this.length=n.length}},w(ke,G);function Ae(e){h(e)}Ae.prototype={nodeName:`#text`,nodeType:O,splitText:function(e){var t=this.data,n=t.substring(e);t=t.substring(0,e),this.data=this.nodeValue=t,this.length=t.length;var r=this.ownerDocument.createTextNode(n);return this.parentNode&&this.parentNode.insertBefore(r,this.nextSibling),r}},w(Ae,ke);function je(e){h(e)}je.prototype={nodeName:`#comment`,nodeType:N},w(je,ke);function Me(e){h(e)}Me.prototype={nodeName:`#cdata-section`,nodeType:k},w(Me,Ae);function Ne(e){h(e)}Ne.prototype.nodeType=F,w(Ne,G);function Pe(e){h(e)}Pe.prototype.nodeType=L,w(Pe,G);function Fe(e){h(e)}Fe.prototype.nodeType=j,w(Fe,G);function Ie(e){h(e)}Ie.prototype.nodeType=A,w(Ie,G);function Le(e){h(e)}Le.prototype.nodeName=`#document-fragment`,Le.prototype.nodeType=I,w(Le,G);function Re(e){h(e)}Re.prototype.nodeType=M,w(Re,ke);function ze(){}ze.prototype.serializeToString=function(e,t){return Be.call(e,t)},G.prototype.toString=Be;function Be(e){var t=typeof e==`function`?{requireWellFormed:!1,splitCDATASections:!0,nodeFilter:e}:e==null?{requireWellFormed:!1,splitCDATASections:!0,nodeFilter:null}:{requireWellFormed:!!e.requireWellFormed,splitCDATASections:e.splitCDATASections!==!1,nodeFilter:e.nodeFilter||null},n=[],r=this.nodeType===P&&this.documentElement||this,i=r.prefix,a=r.namespaceURI;if(a&&i==null){var i=r.lookupPrefix(a);if(i==null)var o=[{namespace:a,prefix:null}]}return Ue(this,n,o,t),n.join(``)}function Ve(e,t,n){var r=e.prefix||``,i=e.namespaceURI;if(!i||r===`xml`&&i===l.XML||i===l.XMLNS)return!1;for(var a=n.length;a--;){var o=n[a];if(o.prefix===r)return o.namespace!==i}return!0}function He(e,t,n,r){if(r&&!m.QName_exact.test(t))throw new f(`The attribute name "`+t+`" is not a valid XML QName`,p.InvalidStateError);e.push(` `,t,`="`,n.replace(/[<>&"\t\n\r]/g,ce),`"`)}function Ue(e,t,n,r){n||=[];var i=r.nodeFilter,a=r.requireWellFormed,c=r.splitCDATASections,u=(e.nodeType===P?e:e.ownerDocument).type===`html`;ue(e,{ns:n},{enter:function(e,n){var d=n.ns;if(i){if(e=i(e),e){if(typeof e==`string`)return t.push(e),null}else return null}switch(e.nodeType){case E:var h=e.attributes,g=h.length,_=e.tagName,v=_;if(!u&&!e.prefix&&e.namespaceURI){for(var y,b=0;b<h.length;b++)if(h.item(b).name===`xmlns`){y=h.item(b).value;break}if(!y)for(var x=d.length-1;x>=0;x--){var S=d[x];if(S.prefix===``&&S.namespace===e.namespaceURI){y=S.namespace;break}}if(y!==e.namespaceURI)for(var x=d.length-1;x>=0;x--){var S=d[x];if(S.namespace===e.namespaceURI){S.prefix&&(v=S.prefix+`:`+_);break}}}if(a&&!m.QName_exact.test(v))throw new f(`The element name "`+v+`" is not a valid XML QName`,p.InvalidStateError);t.push(`<`,v);for(var C=d.slice(),w=0;w<g;w++){var T=h.item(w);T.prefix==`xmlns`?C.push({prefix:T.localName,namespace:T.value}):T.nodeName==`xmlns`&&C.push({prefix:``,namespace:T.value})}for(var w=0;w<g;w++){var T=h.item(w);if(Ve(T,u,C)){var j=T.prefix||``,L=T.namespaceURI;He(t,j?`xmlns:`+j:`xmlns`,L,a),C.push({prefix:j,namespace:L})}var R=i?i(T):T;R&&(typeof R==`string`?t.push(R):He(t,R.name,R.value,a))}if(_===v&&Ve(e,u,C)){var z=e.prefix||``,L=e.namespaceURI;He(t,z?`xmlns:`+z:`xmlns`,L,a),C.push({prefix:z,namespace:L})}var ee=!e.firstChild;if(ee&&(u||e.namespaceURI===l.HTML)&&(ee=s(_)),ee)return t.push(`/>`),null;if(t.push(`>`),u&&o(_)){for(var B=e.firstChild;B;)B.data?t.push(B.data):Ue(B,t,C.slice(),r),B=B.nextSibling;return t.push(`</`,v,`>`),null}return{ns:C,tag:v};case P:case I:if(a&&e.nodeType===P&&e.documentElement==null)throw new f(`The Document has no documentElement`,p.InvalidStateError);return{ns:d};case D:return He(t,e.name,e.value,a),null;case O:if(a&&m.InvalidChar.test(e.data))throw new f(`The Text node data contains characters outside the XML Char production`,p.InvalidStateError);return t.push(e.data.replace(/[<&>]/g,ce)),null;case k:if(a&&e.data.indexOf(`]]>`)!==-1)throw new f(`The CDATASection data contains "]]>"`,p.InvalidStateError);return c?t.push(m.CDATA_START,e.data.replace(/]]>/g,`]]]]><![CDATA[>`),m.CDATA_END):t.push(m.CDATA_START,e.data,m.CDATA_END),null;case N:if(a){if(m.InvalidChar.test(e.data))throw new f(`The comment node data contains characters outside the XML Char production`,p.InvalidStateError);if(e.data.indexOf(`--`)!==-1||e.data[e.data.length-1]===`-`)throw new f(`The comment node data contains "--" or ends with "-"`,p.InvalidStateError)}return t.push(m.COMMENT_START,e.data,m.COMMENT_END),null;case F:var V=e.publicId,te=e.systemId;if(a){if(!m.Name_exact.test(e.name))throw new f(`The doctype name "`+e.name+`" is not a valid XML Name`,p.InvalidStateError);if(V&&!m.PubidLiteral_match.test(V))throw new f(`DocumentType publicId is not a valid PubidLiteral`,p.InvalidStateError);if(te&&te!==`.`&&!m.SystemLiteral_match.test(te))throw new f(`DocumentType systemId is not a valid SystemLiteral`,p.InvalidStateError);if(e.internalSubset&&e.internalSubset.indexOf(`]>`)!==-1)throw new f(`DocumentType internalSubset contains "]>"`,p.InvalidStateError)}return t.push(m.DOCTYPE_DECL_START,` `,e.name),V?(t.push(` `,m.PUBLIC,` `,V),te&&te!==`.`&&t.push(` `,te)):te&&te!==`.`&&t.push(` `,m.SYSTEM,` `,te),e.internalSubset&&t.push(` [`,e.internalSubset,`]`),t.push(`>`),null;case M:if(a){if(!m.NCName_exact.test(e.target)||e.target.toLowerCase()===`xml`)throw new f(`The processing instruction target "`+e.target+`" is not a valid XML NCName or is reserved`,p.InvalidStateError);if(m.InvalidChar.test(e.data))throw new f(`The ProcessingInstruction data contains characters outside the XML Char production`,p.InvalidStateError);if(e.data.indexOf(`?>`)!==-1)throw new f(`The ProcessingInstruction data contains "?>"`,p.InvalidStateError)}return t.push(`<?`,e.target,` `,e.data,`?>`),null;case A:if(a&&!m.Name_exact.test(e.nodeName))throw new f(`The entity reference name "`+e.nodeName+`" is not a valid XML Name`,p.InvalidStateError);return t.push(`&`,e.nodeName,`;`),null;default:return t.push(`??`,e.nodeName),null}},exit:function(e,n){n&&n.tag&&t.push(`</`,n.tag,`>`)}})}function We(e,t,n){var r;return ue(t,null,{enter:function(t,i){var a=t.cloneNode(!1);return a.ownerDocument=e,a.parentNode=null,i===null?r=a:i.appendChild(a),t.nodeType===D||n?a:null}}),r}function Ge(e,t,n){var r;return ue(t,null,{enter:function(t,a){var o=new t.constructor(u);for(var s in t)if(i(t,s)){var c=t[s];typeof c!=`object`&&c!=o[s]&&(o[s]=c)}t.childNodes&&(o.childNodes=new B),o.ownerDocument=e;var l=n;switch(o.nodeType){case E:var d=t.attributes,f=o.attributes=new ne,p=d.length;f._ownerElement=o;for(var m=0;m<p;m++)o.setAttributeNode(Ge(e,d.item(m),!0));break;case D:l=!0}return a===null?r=o:a.appendChild(o),l?o:null}}),r}function Ke(e,t,n){e[t]=n}function qe(e){for(var t=[],n=e.firstChild;n;)n.nodeType===E&&t.push(n),n=n.nextSibling;return t}try{Object.defineProperty&&(Object.defineProperty(V.prototype,"length",{get:function(){return te(this),this.$$length}}),Object.defineProperty(G.prototype,"textContent",{get:function(){if(this.nodeType===E||this.nodeType===I){var e=[];return ue(this,null,{enter:function(t){if(t.nodeType===E||t.nodeType===I)return!0;if(t.nodeType===M||t.nodeType===N)return null;e.push(t.nodeValue)}}),e.join(``)}return this.nodeValue},set:function(e){switch(this.nodeType){case E:case I:for(;this.firstChild;)this.removeChild(this.firstChild);(e||String(e))&&this.appendChild(this.ownerDocument.createTextNode(e));break;default:this.data=e,this.value=e,this.nodeValue=e}}}),Object.defineProperty(ke.prototype,"data",{get:function(){return this._data==null?``:this._data},set:function(e){this._data=e,this.length=typeof e==`string`?e.length:0}}),Object.defineProperty(ke.prototype,"nodeValue",{get:function(){return this.data},set:function(e){this.data=e},enumerable:!0,configurable:!0}),Object.defineProperty(De.prototype,"children",{get:function(){return new V(this,qe)}}),Object.defineProperty(de.prototype,"children",{get:function(){return new V(this,qe)}}),Object.defineProperty(Le.prototype,"children",{get:function(){return new V(this,qe)}}),Ke=function(e,t,n){e[`$$`+t]=n})}catch{}e._updateLiveList=te,e.Attr=Oe,e.CDATASection=Me,e.CharacterData=ke,e.Comment=je,e.Document=de,e.DocumentFragment=Le,e.DocumentType=Ne,e.DOMImplementation=W,e.Element=De,e.Entity=Fe,e.EntityReference=Ie,e.LiveNodeList=V,e.NamedNodeMap=ne,e.Node=G,e.NodeList=B,e.Notation=Pe,e.Text=Ae,e.ProcessingInstruction=Re,e.walkDOM=ue,e.XMLSerializer=ze})),hR=o((e=>{var t=dR().freeze;e.XML_ENTITIES=t({amp:`&`,apos:`'`,gt:`>`,lt:`<`,quot:`"`}),e.HTML_ENTITIES=t({Aacute:`Á`,aacute:`á`,Abreve:`Ă`,abreve:`ă`,ac:`∾`,acd:`∿`,acE:`∾̳`,Acirc:`Â`,acirc:`â`,acute:`´`,Acy:`А`,acy:`а`,AElig:`Æ`,aelig:`æ`,af:``,Afr:`𝔄`,afr:`𝔞`,Agrave:`À`,agrave:`à`,alefsym:`ℵ`,aleph:`ℵ`,Alpha:`Α`,alpha:`α`,Amacr:`Ā`,amacr:`ā`,amalg:`⨿`,AMP:`&`,amp:`&`,And:`⩓`,and:`∧`,andand:`⩕`,andd:`⩜`,andslope:`⩘`,andv:`⩚`,ang:`∠`,ange:`⦤`,angle:`∠`,angmsd:`∡`,angmsdaa:`⦨`,angmsdab:`⦩`,angmsdac:`⦪`,angmsdad:`⦫`,angmsdae:`⦬`,angmsdaf:`⦭`,angmsdag:`⦮`,angmsdah:`⦯`,angrt:`∟`,angrtvb:`⊾`,angrtvbd:`⦝`,angsph:`∢`,angst:`Å`,angzarr:`⍼`,Aogon:`Ą`,aogon:`ą`,Aopf:`𝔸`,aopf:`𝕒`,ap:`≈`,apacir:`⩯`,apE:`⩰`,ape:`≊`,apid:`≋`,apos:`'`,ApplyFunction:``,approx:`≈`,approxeq:`≊`,Aring:`Å`,aring:`å`,Ascr:`𝒜`,ascr:`𝒶`,Assign:`≔`,ast:`*`,asymp:`≈`,asympeq:`≍`,Atilde:`Ã`,atilde:`ã`,Auml:`Ä`,auml:`ä`,awconint:`∳`,awint:`⨑`,backcong:`≌`,backepsilon:`϶`,backprime:`‵`,backsim:`∽`,backsimeq:`⋍`,Backslash:`∖`,Barv:`⫧`,barvee:`⊽`,Barwed:`⌆`,barwed:`⌅`,barwedge:`⌅`,bbrk:`⎵`,bbrktbrk:`⎶`,bcong:`≌`,Bcy:`Б`,bcy:`б`,bdquo:`„`,becaus:`∵`,Because:`∵`,because:`∵`,bemptyv:`⦰`,bepsi:`϶`,bernou:`ℬ`,Bernoullis:`ℬ`,Beta:`Β`,beta:`β`,beth:`ℶ`,between:`≬`,Bfr:`𝔅`,bfr:`𝔟`,bigcap:`⋂`,bigcirc:`◯`,bigcup:`⋃`,bigodot:`⨀`,bigoplus:`⨁`,bigotimes:`⨂`,bigsqcup:`⨆`,bigstar:`★`,bigtriangledown:`▽`,bigtriangleup:`△`,biguplus:`⨄`,bigvee:`⋁`,bigwedge:`⋀`,bkarow:`⤍`,blacklozenge:`⧫`,blacksquare:`▪`,blacktriangle:`▴`,blacktriangledown:`▾`,blacktriangleleft:`◂`,blacktriangleright:`▸`,blank:`␣`,blk12:`▒`,blk14:`░`,blk34:`▓`,block:`█`,bne:`=⃥`,bnequiv:`≡⃥`,bNot:`⫭`,bnot:`⌐`,Bopf:`𝔹`,bopf:`𝕓`,bot:`⊥`,bottom:`⊥`,bowtie:`⋈`,boxbox:`⧉`,boxDL:`╗`,boxDl:`╖`,boxdL:`╕`,boxdl:`┐`,boxDR:`╔`,boxDr:`╓`,boxdR:`╒`,boxdr:`┌`,boxH:`═`,boxh:`─`,boxHD:`╦`,boxHd:`╤`,boxhD:`╥`,boxhd:`┬`,boxHU:`╩`,boxHu:`╧`,boxhU:`╨`,boxhu:`┴`,boxminus:`⊟`,boxplus:`⊞`,boxtimes:`⊠`,boxUL:`╝`,boxUl:`╜`,boxuL:`╛`,boxul:`┘`,boxUR:`╚`,boxUr:`╙`,boxuR:`╘`,boxur:`└`,boxV:`║`,boxv:`│`,boxVH:`╬`,boxVh:`╫`,boxvH:`╪`,boxvh:`┼`,boxVL:`╣`,boxVl:`╢`,boxvL:`╡`,boxvl:`┤`,boxVR:`╠`,boxVr:`╟`,boxvR:`╞`,boxvr:`├`,bprime:`‵`,Breve:`˘`,breve:`˘`,brvbar:`¦`,Bscr:`ℬ`,bscr:`𝒷`,bsemi:`⁏`,bsim:`∽`,bsime:`⋍`,bsol:`\\`,bsolb:`⧅`,bsolhsub:`⟈`,bull:`•`,bullet:`•`,bump:`≎`,bumpE:`⪮`,bumpe:`≏`,Bumpeq:`≎`,bumpeq:`≏`,Cacute:`Ć`,cacute:`ć`,Cap:`⋒`,cap:`∩`,capand:`⩄`,capbrcup:`⩉`,capcap:`⩋`,capcup:`⩇`,capdot:`⩀`,CapitalDifferentialD:`ⅅ`,caps:`∩︀`,caret:`⁁`,caron:`ˇ`,Cayleys:`ℭ`,ccaps:`⩍`,Ccaron:`Č`,ccaron:`č`,Ccedil:`Ç`,ccedil:`ç`,Ccirc:`Ĉ`,ccirc:`ĉ`,Cconint:`∰`,ccups:`⩌`,ccupssm:`⩐`,Cdot:`Ċ`,cdot:`ċ`,cedil:`¸`,Cedilla:`¸`,cemptyv:`⦲`,cent:`¢`,CenterDot:`·`,centerdot:`·`,Cfr:`ℭ`,cfr:`𝔠`,CHcy:`Ч`,chcy:`ч`,check:`✓`,checkmark:`✓`,Chi:`Χ`,chi:`χ`,cir:`○`,circ:`ˆ`,circeq:`≗`,circlearrowleft:`↺`,circlearrowright:`↻`,circledast:`⊛`,circledcirc:`⊚`,circleddash:`⊝`,CircleDot:`⊙`,circledR:`®`,circledS:`Ⓢ`,CircleMinus:`⊖`,CirclePlus:`⊕`,CircleTimes:`⊗`,cirE:`⧃`,cire:`≗`,cirfnint:`⨐`,cirmid:`⫯`,cirscir:`⧂`,ClockwiseContourIntegral:`∲`,CloseCurlyDoubleQuote:`”`,CloseCurlyQuote:`’`,clubs:`♣`,clubsuit:`♣`,Colon:`∷`,colon:`:`,Colone:`⩴`,colone:`≔`,coloneq:`≔`,comma:`,`,commat:`@`,comp:`∁`,compfn:`∘`,complement:`∁`,complexes:`ℂ`,cong:`≅`,congdot:`⩭`,Congruent:`≡`,Conint:`∯`,conint:`∮`,ContourIntegral:`∮`,Copf:`ℂ`,copf:`𝕔`,coprod:`∐`,Coproduct:`∐`,COPY:`©`,copy:`©`,copysr:`℗`,CounterClockwiseContourIntegral:`∳`,crarr:`↵`,Cross:`⨯`,cross:`✗`,Cscr:`𝒞`,cscr:`𝒸`,csub:`⫏`,csube:`⫑`,csup:`⫐`,csupe:`⫒`,ctdot:`⋯`,cudarrl:`⤸`,cudarrr:`⤵`,cuepr:`⋞`,cuesc:`⋟`,cularr:`↶`,cularrp:`⤽`,Cup:`⋓`,cup:`∪`,cupbrcap:`⩈`,CupCap:`≍`,cupcap:`⩆`,cupcup:`⩊`,cupdot:`⊍`,cupor:`⩅`,cups:`∪︀`,curarr:`↷`,curarrm:`⤼`,curlyeqprec:`⋞`,curlyeqsucc:`⋟`,curlyvee:`⋎`,curlywedge:`⋏`,curren:`¤`,curvearrowleft:`↶`,curvearrowright:`↷`,cuvee:`⋎`,cuwed:`⋏`,cwconint:`∲`,cwint:`∱`,cylcty:`⌭`,Dagger:`‡`,dagger:`†`,daleth:`ℸ`,Darr:`↡`,dArr:`⇓`,darr:`↓`,dash:`‐`,Dashv:`⫤`,dashv:`⊣`,dbkarow:`⤏`,dblac:`˝`,Dcaron:`Ď`,dcaron:`ď`,Dcy:`Д`,dcy:`д`,DD:`ⅅ`,dd:`ⅆ`,ddagger:`‡`,ddarr:`⇊`,DDotrahd:`⤑`,ddotseq:`⩷`,deg:`°`,Del:`∇`,Delta:`Δ`,delta:`δ`,demptyv:`⦱`,dfisht:`⥿`,Dfr:`𝔇`,dfr:`𝔡`,dHar:`⥥`,dharl:`⇃`,dharr:`⇂`,DiacriticalAcute:`´`,DiacriticalDot:`˙`,DiacriticalDoubleAcute:`˝`,DiacriticalGrave:"`",DiacriticalTilde:`˜`,diam:`⋄`,Diamond:`⋄`,diamond:`⋄`,diamondsuit:`♦`,diams:`♦`,die:`¨`,DifferentialD:`ⅆ`,digamma:`ϝ`,disin:`⋲`,div:`÷`,divide:`÷`,divideontimes:`⋇`,divonx:`⋇`,DJcy:`Ђ`,djcy:`ђ`,dlcorn:`⌞`,dlcrop:`⌍`,dollar:`$`,Dopf:`𝔻`,dopf:`𝕕`,Dot:`¨`,dot:`˙`,DotDot:`⃜`,doteq:`≐`,doteqdot:`≑`,DotEqual:`≐`,dotminus:`∸`,dotplus:`∔`,dotsquare:`⊡`,doublebarwedge:`⌆`,DoubleContourIntegral:`∯`,DoubleDot:`¨`,DoubleDownArrow:`⇓`,DoubleLeftArrow:`⇐`,DoubleLeftRightArrow:`⇔`,DoubleLeftTee:`⫤`,DoubleLongLeftArrow:`⟸`,DoubleLongLeftRightArrow:`⟺`,DoubleLongRightArrow:`⟹`,DoubleRightArrow:`⇒`,DoubleRightTee:`⊨`,DoubleUpArrow:`⇑`,DoubleUpDownArrow:`⇕`,DoubleVerticalBar:`∥`,DownArrow:`↓`,Downarrow:`⇓`,downarrow:`↓`,DownArrowBar:`⤓`,DownArrowUpArrow:`⇵`,DownBreve:`̑`,downdownarrows:`⇊`,downharpoonleft:`⇃`,downharpoonright:`⇂`,DownLeftRightVector:`⥐`,DownLeftTeeVector:`⥞`,DownLeftVector:`↽`,DownLeftVectorBar:`⥖`,DownRightTeeVector:`⥟`,DownRightVector:`⇁`,DownRightVectorBar:`⥗`,DownTee:`⊤`,DownTeeArrow:`↧`,drbkarow:`⤐`,drcorn:`⌟`,drcrop:`⌌`,Dscr:`𝒟`,dscr:`𝒹`,DScy:`Ѕ`,dscy:`ѕ`,dsol:`⧶`,Dstrok:`Đ`,dstrok:`đ`,dtdot:`⋱`,dtri:`▿`,dtrif:`▾`,duarr:`⇵`,duhar:`⥯`,dwangle:`⦦`,DZcy:`Џ`,dzcy:`џ`,dzigrarr:`⟿`,Eacute:`É`,eacute:`é`,easter:`⩮`,Ecaron:`Ě`,ecaron:`ě`,ecir:`≖`,Ecirc:`Ê`,ecirc:`ê`,ecolon:`≕`,Ecy:`Э`,ecy:`э`,eDDot:`⩷`,Edot:`Ė`,eDot:`≑`,edot:`ė`,ee:`ⅇ`,efDot:`≒`,Efr:`𝔈`,efr:`𝔢`,eg:`⪚`,Egrave:`È`,egrave:`è`,egs:`⪖`,egsdot:`⪘`,el:`⪙`,Element:`∈`,elinters:`⏧`,ell:`ℓ`,els:`⪕`,elsdot:`⪗`,Emacr:`Ē`,emacr:`ē`,empty:`∅`,emptyset:`∅`,EmptySmallSquare:`◻`,emptyv:`∅`,EmptyVerySmallSquare:`▫`,emsp:` `,emsp13:` `,emsp14:` `,ENG:`Ŋ`,eng:`ŋ`,ensp:` `,Eogon:`Ę`,eogon:`ę`,Eopf:`𝔼`,eopf:`𝕖`,epar:`⋕`,eparsl:`⧣`,eplus:`⩱`,epsi:`ε`,Epsilon:`Ε`,epsilon:`ε`,epsiv:`ϵ`,eqcirc:`≖`,eqcolon:`≕`,eqsim:`≂`,eqslantgtr:`⪖`,eqslantless:`⪕`,Equal:`⩵`,equals:`=`,EqualTilde:`≂`,equest:`≟`,Equilibrium:`⇌`,equiv:`≡`,equivDD:`⩸`,eqvparsl:`⧥`,erarr:`⥱`,erDot:`≓`,Escr:`ℰ`,escr:`ℯ`,esdot:`≐`,Esim:`⩳`,esim:`≂`,Eta:`Η`,eta:`η`,ETH:`Ð`,eth:`ð`,Euml:`Ë`,euml:`ë`,euro:`€`,excl:`!`,exist:`∃`,Exists:`∃`,expectation:`ℰ`,ExponentialE:`ⅇ`,exponentiale:`ⅇ`,fallingdotseq:`≒`,Fcy:`Ф`,fcy:`ф`,female:`♀`,ffilig:`ffi`,fflig:`ff`,ffllig:`ffl`,Ffr:`𝔉`,ffr:`𝔣`,filig:`fi`,FilledSmallSquare:`◼`,FilledVerySmallSquare:`▪`,fjlig:`fj`,flat:`♭`,fllig:`fl`,fltns:`▱`,fnof:`ƒ`,Fopf:`𝔽`,fopf:`𝕗`,ForAll:`∀`,forall:`∀`,fork:`⋔`,forkv:`⫙`,Fouriertrf:`ℱ`,fpartint:`⨍`,frac12:`½`,frac13:`⅓`,frac14:`¼`,frac15:`⅕`,frac16:`⅙`,frac18:`⅛`,frac23:`⅔`,frac25:`⅖`,frac34:`¾`,frac35:`⅗`,frac38:`⅜`,frac45:`⅘`,frac56:`⅚`,frac58:`⅝`,frac78:`⅞`,frasl:`⁄`,frown:`⌢`,Fscr:`ℱ`,fscr:`𝒻`,gacute:`ǵ`,Gamma:`Γ`,gamma:`γ`,Gammad:`Ϝ`,gammad:`ϝ`,gap:`⪆`,Gbreve:`Ğ`,gbreve:`ğ`,Gcedil:`Ģ`,Gcirc:`Ĝ`,gcirc:`ĝ`,Gcy:`Г`,gcy:`г`,Gdot:`Ġ`,gdot:`ġ`,gE:`≧`,ge:`≥`,gEl:`⪌`,gel:`⋛`,geq:`≥`,geqq:`≧`,geqslant:`⩾`,ges:`⩾`,gescc:`⪩`,gesdot:`⪀`,gesdoto:`⪂`,gesdotol:`⪄`,gesl:`⋛︀`,gesles:`⪔`,Gfr:`𝔊`,gfr:`𝔤`,Gg:`⋙`,gg:`≫`,ggg:`⋙`,gimel:`ℷ`,GJcy:`Ѓ`,gjcy:`ѓ`,gl:`≷`,gla:`⪥`,glE:`⪒`,glj:`⪤`,gnap:`⪊`,gnapprox:`⪊`,gnE:`≩`,gne:`⪈`,gneq:`⪈`,gneqq:`≩`,gnsim:`⋧`,Gopf:`𝔾`,gopf:`𝕘`,grave:"`",GreaterEqual:`≥`,GreaterEqualLess:`⋛`,GreaterFullEqual:`≧`,GreaterGreater:`⪢`,GreaterLess:`≷`,GreaterSlantEqual:`⩾`,GreaterTilde:`≳`,Gscr:`𝒢`,gscr:`ℊ`,gsim:`≳`,gsime:`⪎`,gsiml:`⪐`,Gt:`≫`,GT:`>`,gt:`>`,gtcc:`⪧`,gtcir:`⩺`,gtdot:`⋗`,gtlPar:`⦕`,gtquest:`⩼`,gtrapprox:`⪆`,gtrarr:`⥸`,gtrdot:`⋗`,gtreqless:`⋛`,gtreqqless:`⪌`,gtrless:`≷`,gtrsim:`≳`,gvertneqq:`≩︀`,gvnE:`≩︀`,Hacek:`ˇ`,hairsp:` `,half:`½`,hamilt:`ℋ`,HARDcy:`Ъ`,hardcy:`ъ`,hArr:`⇔`,harr:`↔`,harrcir:`⥈`,harrw:`↭`,Hat:`^`,hbar:`ℏ`,Hcirc:`Ĥ`,hcirc:`ĥ`,hearts:`♥`,heartsuit:`♥`,hellip:`…`,hercon:`⊹`,Hfr:`ℌ`,hfr:`𝔥`,HilbertSpace:`ℋ`,hksearow:`⤥`,hkswarow:`⤦`,hoarr:`⇿`,homtht:`∻`,hookleftarrow:`↩`,hookrightarrow:`↪`,Hopf:`ℍ`,hopf:`𝕙`,horbar:`―`,HorizontalLine:`─`,Hscr:`ℋ`,hscr:`𝒽`,hslash:`ℏ`,Hstrok:`Ħ`,hstrok:`ħ`,HumpDownHump:`≎`,HumpEqual:`≏`,hybull:`⁃`,hyphen:`‐`,Iacute:`Í`,iacute:`í`,ic:``,Icirc:`Î`,icirc:`î`,Icy:`И`,icy:`и`,Idot:`İ`,IEcy:`Е`,iecy:`е`,iexcl:`¡`,iff:`⇔`,Ifr:`ℑ`,ifr:`𝔦`,Igrave:`Ì`,igrave:`ì`,ii:`ⅈ`,iiiint:`⨌`,iiint:`∭`,iinfin:`⧜`,iiota:`℩`,IJlig:`IJ`,ijlig:`ij`,Im:`ℑ`,Imacr:`Ī`,imacr:`ī`,image:`ℑ`,ImaginaryI:`ⅈ`,imagline:`ℐ`,imagpart:`ℑ`,imath:`ı`,imof:`⊷`,imped:`Ƶ`,Implies:`⇒`,in:`∈`,incare:`℅`,infin:`∞`,infintie:`⧝`,inodot:`ı`,Int:`∬`,int:`∫`,intcal:`⊺`,integers:`ℤ`,Integral:`∫`,intercal:`⊺`,Intersection:`⋂`,intlarhk:`⨗`,intprod:`⨼`,InvisibleComma:``,InvisibleTimes:``,IOcy:`Ё`,iocy:`ё`,Iogon:`Į`,iogon:`į`,Iopf:`𝕀`,iopf:`𝕚`,Iota:`Ι`,iota:`ι`,iprod:`⨼`,iquest:`¿`,Iscr:`ℐ`,iscr:`𝒾`,isin:`∈`,isindot:`⋵`,isinE:`⋹`,isins:`⋴`,isinsv:`⋳`,isinv:`∈`,it:``,Itilde:`Ĩ`,itilde:`ĩ`,Iukcy:`І`,iukcy:`і`,Iuml:`Ï`,iuml:`ï`,Jcirc:`Ĵ`,jcirc:`ĵ`,Jcy:`Й`,jcy:`й`,Jfr:`𝔍`,jfr:`𝔧`,jmath:`ȷ`,Jopf:`𝕁`,jopf:`𝕛`,Jscr:`𝒥`,jscr:`𝒿`,Jsercy:`Ј`,jsercy:`ј`,Jukcy:`Є`,jukcy:`є`,Kappa:`Κ`,kappa:`κ`,kappav:`ϰ`,Kcedil:`Ķ`,kcedil:`ķ`,Kcy:`К`,kcy:`к`,Kfr:`𝔎`,kfr:`𝔨`,kgreen:`ĸ`,KHcy:`Х`,khcy:`х`,KJcy:`Ќ`,kjcy:`ќ`,Kopf:`𝕂`,kopf:`𝕜`,Kscr:`𝒦`,kscr:`𝓀`,lAarr:`⇚`,Lacute:`Ĺ`,lacute:`ĺ`,laemptyv:`⦴`,lagran:`ℒ`,Lambda:`Λ`,lambda:`λ`,Lang:`⟪`,lang:`⟨`,langd:`⦑`,langle:`⟨`,lap:`⪅`,Laplacetrf:`ℒ`,laquo:`«`,Larr:`↞`,lArr:`⇐`,larr:`←`,larrb:`⇤`,larrbfs:`⤟`,larrfs:`⤝`,larrhk:`↩`,larrlp:`↫`,larrpl:`⤹`,larrsim:`⥳`,larrtl:`↢`,lat:`⪫`,lAtail:`⤛`,latail:`⤙`,late:`⪭`,lates:`⪭︀`,lBarr:`⤎`,lbarr:`⤌`,lbbrk:`❲`,lbrace:`{`,lbrack:`[`,lbrke:`⦋`,lbrksld:`⦏`,lbrkslu:`⦍`,Lcaron:`Ľ`,lcaron:`ľ`,Lcedil:`Ļ`,lcedil:`ļ`,lceil:`⌈`,lcub:`{`,Lcy:`Л`,lcy:`л`,ldca:`⤶`,ldquo:`“`,ldquor:`„`,ldrdhar:`⥧`,ldrushar:`⥋`,ldsh:`↲`,lE:`≦`,le:`≤`,LeftAngleBracket:`⟨`,LeftArrow:`←`,Leftarrow:`⇐`,leftarrow:`←`,LeftArrowBar:`⇤`,LeftArrowRightArrow:`⇆`,leftarrowtail:`↢`,LeftCeiling:`⌈`,LeftDoubleBracket:`⟦`,LeftDownTeeVector:`⥡`,LeftDownVector:`⇃`,LeftDownVectorBar:`⥙`,LeftFloor:`⌊`,leftharpoondown:`↽`,leftharpoonup:`↼`,leftleftarrows:`⇇`,LeftRightArrow:`↔`,Leftrightarrow:`⇔`,leftrightarrow:`↔`,leftrightarrows:`⇆`,leftrightharpoons:`⇋`,leftrightsquigarrow:`↭`,LeftRightVector:`⥎`,LeftTee:`⊣`,LeftTeeArrow:`↤`,LeftTeeVector:`⥚`,leftthreetimes:`⋋`,LeftTriangle:`⊲`,LeftTriangleBar:`⧏`,LeftTriangleEqual:`⊴`,LeftUpDownVector:`⥑`,LeftUpTeeVector:`⥠`,LeftUpVector:`↿`,LeftUpVectorBar:`⥘`,LeftVector:`↼`,LeftVectorBar:`⥒`,lEg:`⪋`,leg:`⋚`,leq:`≤`,leqq:`≦`,leqslant:`⩽`,les:`⩽`,lescc:`⪨`,lesdot:`⩿`,lesdoto:`⪁`,lesdotor:`⪃`,lesg:`⋚︀`,lesges:`⪓`,lessapprox:`⪅`,lessdot:`⋖`,lesseqgtr:`⋚`,lesseqqgtr:`⪋`,LessEqualGreater:`⋚`,LessFullEqual:`≦`,LessGreater:`≶`,lessgtr:`≶`,LessLess:`⪡`,lesssim:`≲`,LessSlantEqual:`⩽`,LessTilde:`≲`,lfisht:`⥼`,lfloor:`⌊`,Lfr:`𝔏`,lfr:`𝔩`,lg:`≶`,lgE:`⪑`,lHar:`⥢`,lhard:`↽`,lharu:`↼`,lharul:`⥪`,lhblk:`▄`,LJcy:`Љ`,ljcy:`љ`,Ll:`⋘`,ll:`≪`,llarr:`⇇`,llcorner:`⌞`,Lleftarrow:`⇚`,llhard:`⥫`,lltri:`◺`,Lmidot:`Ŀ`,lmidot:`ŀ`,lmoust:`⎰`,lmoustache:`⎰`,lnap:`⪉`,lnapprox:`⪉`,lnE:`≨`,lne:`⪇`,lneq:`⪇`,lneqq:`≨`,lnsim:`⋦`,loang:`⟬`,loarr:`⇽`,lobrk:`⟦`,LongLeftArrow:`⟵`,Longleftarrow:`⟸`,longleftarrow:`⟵`,LongLeftRightArrow:`⟷`,Longleftrightarrow:`⟺`,longleftrightarrow:`⟷`,longmapsto:`⟼`,LongRightArrow:`⟶`,Longrightarrow:`⟹`,longrightarrow:`⟶`,looparrowleft:`↫`,looparrowright:`↬`,lopar:`⦅`,Lopf:`𝕃`,lopf:`𝕝`,loplus:`⨭`,lotimes:`⨴`,lowast:`∗`,lowbar:`_`,LowerLeftArrow:`↙`,LowerRightArrow:`↘`,loz:`◊`,lozenge:`◊`,lozf:`⧫`,lpar:`(`,lparlt:`⦓`,lrarr:`⇆`,lrcorner:`⌟`,lrhar:`⇋`,lrhard:`⥭`,lrm:``,lrtri:`⊿`,lsaquo:`‹`,Lscr:`ℒ`,lscr:`𝓁`,Lsh:`↰`,lsh:`↰`,lsim:`≲`,lsime:`⪍`,lsimg:`⪏`,lsqb:`[`,lsquo:`‘`,lsquor:`‚`,Lstrok:`Ł`,lstrok:`ł`,Lt:`≪`,LT:`<`,lt:`<`,ltcc:`⪦`,ltcir:`⩹`,ltdot:`⋖`,lthree:`⋋`,ltimes:`⋉`,ltlarr:`⥶`,ltquest:`⩻`,ltri:`◃`,ltrie:`⊴`,ltrif:`◂`,ltrPar:`⦖`,lurdshar:`⥊`,luruhar:`⥦`,lvertneqq:`≨︀`,lvnE:`≨︀`,macr:`¯`,male:`♂`,malt:`✠`,maltese:`✠`,Map:`⤅`,map:`↦`,mapsto:`↦`,mapstodown:`↧`,mapstoleft:`↤`,mapstoup:`↥`,marker:`▮`,mcomma:`⨩`,Mcy:`М`,mcy:`м`,mdash:`—`,mDDot:`∺`,measuredangle:`∡`,MediumSpace:` `,Mellintrf:`ℳ`,Mfr:`𝔐`,mfr:`𝔪`,mho:`℧`,micro:`µ`,mid:`∣`,midast:`*`,midcir:`⫰`,middot:`·`,minus:`−`,minusb:`⊟`,minusd:`∸`,minusdu:`⨪`,MinusPlus:`∓`,mlcp:`⫛`,mldr:`…`,mnplus:`∓`,models:`⊧`,Mopf:`𝕄`,mopf:`𝕞`,mp:`∓`,Mscr:`ℳ`,mscr:`𝓂`,mstpos:`∾`,Mu:`Μ`,mu:`μ`,multimap:`⊸`,mumap:`⊸`,nabla:`∇`,Nacute:`Ń`,nacute:`ń`,nang:`∠⃒`,nap:`≉`,napE:`⩰̸`,napid:`≋̸`,napos:`ʼn`,napprox:`≉`,natur:`♮`,natural:`♮`,naturals:`ℕ`,nbsp:`\xA0`,nbump:`≎̸`,nbumpe:`≏̸`,ncap:`⩃`,Ncaron:`Ň`,ncaron:`ň`,Ncedil:`Ņ`,ncedil:`ņ`,ncong:`≇`,ncongdot:`⩭̸`,ncup:`⩂`,Ncy:`Н`,ncy:`н`,ndash:`–`,ne:`≠`,nearhk:`⤤`,neArr:`⇗`,nearr:`↗`,nearrow:`↗`,nedot:`≐̸`,NegativeMediumSpace:``,NegativeThickSpace:``,NegativeThinSpace:``,NegativeVeryThinSpace:``,nequiv:`≢`,nesear:`⤨`,nesim:`≂̸`,NestedGreaterGreater:`≫`,NestedLessLess:`≪`,NewLine:`
|
|
84
|
+
`,nexist:`∄`,nexists:`∄`,Nfr:`𝔑`,nfr:`𝔫`,ngE:`≧̸`,nge:`≱`,ngeq:`≱`,ngeqq:`≧̸`,ngeqslant:`⩾̸`,nges:`⩾̸`,nGg:`⋙̸`,ngsim:`≵`,nGt:`≫⃒`,ngt:`≯`,ngtr:`≯`,nGtv:`≫̸`,nhArr:`⇎`,nharr:`↮`,nhpar:`⫲`,ni:`∋`,nis:`⋼`,nisd:`⋺`,niv:`∋`,NJcy:`Њ`,njcy:`њ`,nlArr:`⇍`,nlarr:`↚`,nldr:`‥`,nlE:`≦̸`,nle:`≰`,nLeftarrow:`⇍`,nleftarrow:`↚`,nLeftrightarrow:`⇎`,nleftrightarrow:`↮`,nleq:`≰`,nleqq:`≦̸`,nleqslant:`⩽̸`,nles:`⩽̸`,nless:`≮`,nLl:`⋘̸`,nlsim:`≴`,nLt:`≪⃒`,nlt:`≮`,nltri:`⋪`,nltrie:`⋬`,nLtv:`≪̸`,nmid:`∤`,NoBreak:``,NonBreakingSpace:`\xA0`,Nopf:`ℕ`,nopf:`𝕟`,Not:`⫬`,not:`¬`,NotCongruent:`≢`,NotCupCap:`≭`,NotDoubleVerticalBar:`∦`,NotElement:`∉`,NotEqual:`≠`,NotEqualTilde:`≂̸`,NotExists:`∄`,NotGreater:`≯`,NotGreaterEqual:`≱`,NotGreaterFullEqual:`≧̸`,NotGreaterGreater:`≫̸`,NotGreaterLess:`≹`,NotGreaterSlantEqual:`⩾̸`,NotGreaterTilde:`≵`,NotHumpDownHump:`≎̸`,NotHumpEqual:`≏̸`,notin:`∉`,notindot:`⋵̸`,notinE:`⋹̸`,notinva:`∉`,notinvb:`⋷`,notinvc:`⋶`,NotLeftTriangle:`⋪`,NotLeftTriangleBar:`⧏̸`,NotLeftTriangleEqual:`⋬`,NotLess:`≮`,NotLessEqual:`≰`,NotLessGreater:`≸`,NotLessLess:`≪̸`,NotLessSlantEqual:`⩽̸`,NotLessTilde:`≴`,NotNestedGreaterGreater:`⪢̸`,NotNestedLessLess:`⪡̸`,notni:`∌`,notniva:`∌`,notnivb:`⋾`,notnivc:`⋽`,NotPrecedes:`⊀`,NotPrecedesEqual:`⪯̸`,NotPrecedesSlantEqual:`⋠`,NotReverseElement:`∌`,NotRightTriangle:`⋫`,NotRightTriangleBar:`⧐̸`,NotRightTriangleEqual:`⋭`,NotSquareSubset:`⊏̸`,NotSquareSubsetEqual:`⋢`,NotSquareSuperset:`⊐̸`,NotSquareSupersetEqual:`⋣`,NotSubset:`⊂⃒`,NotSubsetEqual:`⊈`,NotSucceeds:`⊁`,NotSucceedsEqual:`⪰̸`,NotSucceedsSlantEqual:`⋡`,NotSucceedsTilde:`≿̸`,NotSuperset:`⊃⃒`,NotSupersetEqual:`⊉`,NotTilde:`≁`,NotTildeEqual:`≄`,NotTildeFullEqual:`≇`,NotTildeTilde:`≉`,NotVerticalBar:`∤`,npar:`∦`,nparallel:`∦`,nparsl:`⫽⃥`,npart:`∂̸`,npolint:`⨔`,npr:`⊀`,nprcue:`⋠`,npre:`⪯̸`,nprec:`⊀`,npreceq:`⪯̸`,nrArr:`⇏`,nrarr:`↛`,nrarrc:`⤳̸`,nrarrw:`↝̸`,nRightarrow:`⇏`,nrightarrow:`↛`,nrtri:`⋫`,nrtrie:`⋭`,nsc:`⊁`,nsccue:`⋡`,nsce:`⪰̸`,Nscr:`𝒩`,nscr:`𝓃`,nshortmid:`∤`,nshortparallel:`∦`,nsim:`≁`,nsime:`≄`,nsimeq:`≄`,nsmid:`∤`,nspar:`∦`,nsqsube:`⋢`,nsqsupe:`⋣`,nsub:`⊄`,nsubE:`⫅̸`,nsube:`⊈`,nsubset:`⊂⃒`,nsubseteq:`⊈`,nsubseteqq:`⫅̸`,nsucc:`⊁`,nsucceq:`⪰̸`,nsup:`⊅`,nsupE:`⫆̸`,nsupe:`⊉`,nsupset:`⊃⃒`,nsupseteq:`⊉`,nsupseteqq:`⫆̸`,ntgl:`≹`,Ntilde:`Ñ`,ntilde:`ñ`,ntlg:`≸`,ntriangleleft:`⋪`,ntrianglelefteq:`⋬`,ntriangleright:`⋫`,ntrianglerighteq:`⋭`,Nu:`Ν`,nu:`ν`,num:`#`,numero:`№`,numsp:` `,nvap:`≍⃒`,nVDash:`⊯`,nVdash:`⊮`,nvDash:`⊭`,nvdash:`⊬`,nvge:`≥⃒`,nvgt:`>⃒`,nvHarr:`⤄`,nvinfin:`⧞`,nvlArr:`⤂`,nvle:`≤⃒`,nvlt:`<⃒`,nvltrie:`⊴⃒`,nvrArr:`⤃`,nvrtrie:`⊵⃒`,nvsim:`∼⃒`,nwarhk:`⤣`,nwArr:`⇖`,nwarr:`↖`,nwarrow:`↖`,nwnear:`⤧`,Oacute:`Ó`,oacute:`ó`,oast:`⊛`,ocir:`⊚`,Ocirc:`Ô`,ocirc:`ô`,Ocy:`О`,ocy:`о`,odash:`⊝`,Odblac:`Ő`,odblac:`ő`,odiv:`⨸`,odot:`⊙`,odsold:`⦼`,OElig:`Œ`,oelig:`œ`,ofcir:`⦿`,Ofr:`𝔒`,ofr:`𝔬`,ogon:`˛`,Ograve:`Ò`,ograve:`ò`,ogt:`⧁`,ohbar:`⦵`,ohm:`Ω`,oint:`∮`,olarr:`↺`,olcir:`⦾`,olcross:`⦻`,oline:`‾`,olt:`⧀`,Omacr:`Ō`,omacr:`ō`,Omega:`Ω`,omega:`ω`,Omicron:`Ο`,omicron:`ο`,omid:`⦶`,ominus:`⊖`,Oopf:`𝕆`,oopf:`𝕠`,opar:`⦷`,OpenCurlyDoubleQuote:`“`,OpenCurlyQuote:`‘`,operp:`⦹`,oplus:`⊕`,Or:`⩔`,or:`∨`,orarr:`↻`,ord:`⩝`,order:`ℴ`,orderof:`ℴ`,ordf:`ª`,ordm:`º`,origof:`⊶`,oror:`⩖`,orslope:`⩗`,orv:`⩛`,oS:`Ⓢ`,Oscr:`𝒪`,oscr:`ℴ`,Oslash:`Ø`,oslash:`ø`,osol:`⊘`,Otilde:`Õ`,otilde:`õ`,Otimes:`⨷`,otimes:`⊗`,otimesas:`⨶`,Ouml:`Ö`,ouml:`ö`,ovbar:`⌽`,OverBar:`‾`,OverBrace:`⏞`,OverBracket:`⎴`,OverParenthesis:`⏜`,par:`∥`,para:`¶`,parallel:`∥`,parsim:`⫳`,parsl:`⫽`,part:`∂`,PartialD:`∂`,Pcy:`П`,pcy:`п`,percnt:`%`,period:`.`,permil:`‰`,perp:`⊥`,pertenk:`‱`,Pfr:`𝔓`,pfr:`𝔭`,Phi:`Φ`,phi:`φ`,phiv:`ϕ`,phmmat:`ℳ`,phone:`☎`,Pi:`Π`,pi:`π`,pitchfork:`⋔`,piv:`ϖ`,planck:`ℏ`,planckh:`ℎ`,plankv:`ℏ`,plus:`+`,plusacir:`⨣`,plusb:`⊞`,pluscir:`⨢`,plusdo:`∔`,plusdu:`⨥`,pluse:`⩲`,PlusMinus:`±`,plusmn:`±`,plussim:`⨦`,plustwo:`⨧`,pm:`±`,Poincareplane:`ℌ`,pointint:`⨕`,Popf:`ℙ`,popf:`𝕡`,pound:`£`,Pr:`⪻`,pr:`≺`,prap:`⪷`,prcue:`≼`,prE:`⪳`,pre:`⪯`,prec:`≺`,precapprox:`⪷`,preccurlyeq:`≼`,Precedes:`≺`,PrecedesEqual:`⪯`,PrecedesSlantEqual:`≼`,PrecedesTilde:`≾`,preceq:`⪯`,precnapprox:`⪹`,precneqq:`⪵`,precnsim:`⋨`,precsim:`≾`,Prime:`″`,prime:`′`,primes:`ℙ`,prnap:`⪹`,prnE:`⪵`,prnsim:`⋨`,prod:`∏`,Product:`∏`,profalar:`⌮`,profline:`⌒`,profsurf:`⌓`,prop:`∝`,Proportion:`∷`,Proportional:`∝`,propto:`∝`,prsim:`≾`,prurel:`⊰`,Pscr:`𝒫`,pscr:`𝓅`,Psi:`Ψ`,psi:`ψ`,puncsp:` `,Qfr:`𝔔`,qfr:`𝔮`,qint:`⨌`,Qopf:`ℚ`,qopf:`𝕢`,qprime:`⁗`,Qscr:`𝒬`,qscr:`𝓆`,quaternions:`ℍ`,quatint:`⨖`,quest:`?`,questeq:`≟`,QUOT:`"`,quot:`"`,rAarr:`⇛`,race:`∽̱`,Racute:`Ŕ`,racute:`ŕ`,radic:`√`,raemptyv:`⦳`,Rang:`⟫`,rang:`⟩`,rangd:`⦒`,range:`⦥`,rangle:`⟩`,raquo:`»`,Rarr:`↠`,rArr:`⇒`,rarr:`→`,rarrap:`⥵`,rarrb:`⇥`,rarrbfs:`⤠`,rarrc:`⤳`,rarrfs:`⤞`,rarrhk:`↪`,rarrlp:`↬`,rarrpl:`⥅`,rarrsim:`⥴`,Rarrtl:`⤖`,rarrtl:`↣`,rarrw:`↝`,rAtail:`⤜`,ratail:`⤚`,ratio:`∶`,rationals:`ℚ`,RBarr:`⤐`,rBarr:`⤏`,rbarr:`⤍`,rbbrk:`❳`,rbrace:`}`,rbrack:`]`,rbrke:`⦌`,rbrksld:`⦎`,rbrkslu:`⦐`,Rcaron:`Ř`,rcaron:`ř`,Rcedil:`Ŗ`,rcedil:`ŗ`,rceil:`⌉`,rcub:`}`,Rcy:`Р`,rcy:`р`,rdca:`⤷`,rdldhar:`⥩`,rdquo:`”`,rdquor:`”`,rdsh:`↳`,Re:`ℜ`,real:`ℜ`,realine:`ℛ`,realpart:`ℜ`,reals:`ℝ`,rect:`▭`,REG:`®`,reg:`®`,ReverseElement:`∋`,ReverseEquilibrium:`⇋`,ReverseUpEquilibrium:`⥯`,rfisht:`⥽`,rfloor:`⌋`,Rfr:`ℜ`,rfr:`𝔯`,rHar:`⥤`,rhard:`⇁`,rharu:`⇀`,rharul:`⥬`,Rho:`Ρ`,rho:`ρ`,rhov:`ϱ`,RightAngleBracket:`⟩`,RightArrow:`→`,Rightarrow:`⇒`,rightarrow:`→`,RightArrowBar:`⇥`,RightArrowLeftArrow:`⇄`,rightarrowtail:`↣`,RightCeiling:`⌉`,RightDoubleBracket:`⟧`,RightDownTeeVector:`⥝`,RightDownVector:`⇂`,RightDownVectorBar:`⥕`,RightFloor:`⌋`,rightharpoondown:`⇁`,rightharpoonup:`⇀`,rightleftarrows:`⇄`,rightleftharpoons:`⇌`,rightrightarrows:`⇉`,rightsquigarrow:`↝`,RightTee:`⊢`,RightTeeArrow:`↦`,RightTeeVector:`⥛`,rightthreetimes:`⋌`,RightTriangle:`⊳`,RightTriangleBar:`⧐`,RightTriangleEqual:`⊵`,RightUpDownVector:`⥏`,RightUpTeeVector:`⥜`,RightUpVector:`↾`,RightUpVectorBar:`⥔`,RightVector:`⇀`,RightVectorBar:`⥓`,ring:`˚`,risingdotseq:`≓`,rlarr:`⇄`,rlhar:`⇌`,rlm:``,rmoust:`⎱`,rmoustache:`⎱`,rnmid:`⫮`,roang:`⟭`,roarr:`⇾`,robrk:`⟧`,ropar:`⦆`,Ropf:`ℝ`,ropf:`𝕣`,roplus:`⨮`,rotimes:`⨵`,RoundImplies:`⥰`,rpar:`)`,rpargt:`⦔`,rppolint:`⨒`,rrarr:`⇉`,Rrightarrow:`⇛`,rsaquo:`›`,Rscr:`ℛ`,rscr:`𝓇`,Rsh:`↱`,rsh:`↱`,rsqb:`]`,rsquo:`’`,rsquor:`’`,rthree:`⋌`,rtimes:`⋊`,rtri:`▹`,rtrie:`⊵`,rtrif:`▸`,rtriltri:`⧎`,RuleDelayed:`⧴`,ruluhar:`⥨`,rx:`℞`,Sacute:`Ś`,sacute:`ś`,sbquo:`‚`,Sc:`⪼`,sc:`≻`,scap:`⪸`,Scaron:`Š`,scaron:`š`,sccue:`≽`,scE:`⪴`,sce:`⪰`,Scedil:`Ş`,scedil:`ş`,Scirc:`Ŝ`,scirc:`ŝ`,scnap:`⪺`,scnE:`⪶`,scnsim:`⋩`,scpolint:`⨓`,scsim:`≿`,Scy:`С`,scy:`с`,sdot:`⋅`,sdotb:`⊡`,sdote:`⩦`,searhk:`⤥`,seArr:`⇘`,searr:`↘`,searrow:`↘`,sect:`§`,semi:`;`,seswar:`⤩`,setminus:`∖`,setmn:`∖`,sext:`✶`,Sfr:`𝔖`,sfr:`𝔰`,sfrown:`⌢`,sharp:`♯`,SHCHcy:`Щ`,shchcy:`щ`,SHcy:`Ш`,shcy:`ш`,ShortDownArrow:`↓`,ShortLeftArrow:`←`,shortmid:`∣`,shortparallel:`∥`,ShortRightArrow:`→`,ShortUpArrow:`↑`,shy:``,Sigma:`Σ`,sigma:`σ`,sigmaf:`ς`,sigmav:`ς`,sim:`∼`,simdot:`⩪`,sime:`≃`,simeq:`≃`,simg:`⪞`,simgE:`⪠`,siml:`⪝`,simlE:`⪟`,simne:`≆`,simplus:`⨤`,simrarr:`⥲`,slarr:`←`,SmallCircle:`∘`,smallsetminus:`∖`,smashp:`⨳`,smeparsl:`⧤`,smid:`∣`,smile:`⌣`,smt:`⪪`,smte:`⪬`,smtes:`⪬︀`,SOFTcy:`Ь`,softcy:`ь`,sol:`/`,solb:`⧄`,solbar:`⌿`,Sopf:`𝕊`,sopf:`𝕤`,spades:`♠`,spadesuit:`♠`,spar:`∥`,sqcap:`⊓`,sqcaps:`⊓︀`,sqcup:`⊔`,sqcups:`⊔︀`,Sqrt:`√`,sqsub:`⊏`,sqsube:`⊑`,sqsubset:`⊏`,sqsubseteq:`⊑`,sqsup:`⊐`,sqsupe:`⊒`,sqsupset:`⊐`,sqsupseteq:`⊒`,squ:`□`,Square:`□`,square:`□`,SquareIntersection:`⊓`,SquareSubset:`⊏`,SquareSubsetEqual:`⊑`,SquareSuperset:`⊐`,SquareSupersetEqual:`⊒`,SquareUnion:`⊔`,squarf:`▪`,squf:`▪`,srarr:`→`,Sscr:`𝒮`,sscr:`𝓈`,ssetmn:`∖`,ssmile:`⌣`,sstarf:`⋆`,Star:`⋆`,star:`☆`,starf:`★`,straightepsilon:`ϵ`,straightphi:`ϕ`,strns:`¯`,Sub:`⋐`,sub:`⊂`,subdot:`⪽`,subE:`⫅`,sube:`⊆`,subedot:`⫃`,submult:`⫁`,subnE:`⫋`,subne:`⊊`,subplus:`⪿`,subrarr:`⥹`,Subset:`⋐`,subset:`⊂`,subseteq:`⊆`,subseteqq:`⫅`,SubsetEqual:`⊆`,subsetneq:`⊊`,subsetneqq:`⫋`,subsim:`⫇`,subsub:`⫕`,subsup:`⫓`,succ:`≻`,succapprox:`⪸`,succcurlyeq:`≽`,Succeeds:`≻`,SucceedsEqual:`⪰`,SucceedsSlantEqual:`≽`,SucceedsTilde:`≿`,succeq:`⪰`,succnapprox:`⪺`,succneqq:`⪶`,succnsim:`⋩`,succsim:`≿`,SuchThat:`∋`,Sum:`∑`,sum:`∑`,sung:`♪`,Sup:`⋑`,sup:`⊃`,sup1:`¹`,sup2:`²`,sup3:`³`,supdot:`⪾`,supdsub:`⫘`,supE:`⫆`,supe:`⊇`,supedot:`⫄`,Superset:`⊃`,SupersetEqual:`⊇`,suphsol:`⟉`,suphsub:`⫗`,suplarr:`⥻`,supmult:`⫂`,supnE:`⫌`,supne:`⊋`,supplus:`⫀`,Supset:`⋑`,supset:`⊃`,supseteq:`⊇`,supseteqq:`⫆`,supsetneq:`⊋`,supsetneqq:`⫌`,supsim:`⫈`,supsub:`⫔`,supsup:`⫖`,swarhk:`⤦`,swArr:`⇙`,swarr:`↙`,swarrow:`↙`,swnwar:`⤪`,szlig:`ß`,Tab:` `,target:`⌖`,Tau:`Τ`,tau:`τ`,tbrk:`⎴`,Tcaron:`Ť`,tcaron:`ť`,Tcedil:`Ţ`,tcedil:`ţ`,Tcy:`Т`,tcy:`т`,tdot:`⃛`,telrec:`⌕`,Tfr:`𝔗`,tfr:`𝔱`,there4:`∴`,Therefore:`∴`,therefore:`∴`,Theta:`Θ`,theta:`θ`,thetasym:`ϑ`,thetav:`ϑ`,thickapprox:`≈`,thicksim:`∼`,ThickSpace:` `,thinsp:` `,ThinSpace:` `,thkap:`≈`,thksim:`∼`,THORN:`Þ`,thorn:`þ`,Tilde:`∼`,tilde:`˜`,TildeEqual:`≃`,TildeFullEqual:`≅`,TildeTilde:`≈`,times:`×`,timesb:`⊠`,timesbar:`⨱`,timesd:`⨰`,tint:`∭`,toea:`⤨`,top:`⊤`,topbot:`⌶`,topcir:`⫱`,Topf:`𝕋`,topf:`𝕥`,topfork:`⫚`,tosa:`⤩`,tprime:`‴`,TRADE:`™`,trade:`™`,triangle:`▵`,triangledown:`▿`,triangleleft:`◃`,trianglelefteq:`⊴`,triangleq:`≜`,triangleright:`▹`,trianglerighteq:`⊵`,tridot:`◬`,trie:`≜`,triminus:`⨺`,TripleDot:`⃛`,triplus:`⨹`,trisb:`⧍`,tritime:`⨻`,trpezium:`⏢`,Tscr:`𝒯`,tscr:`𝓉`,TScy:`Ц`,tscy:`ц`,TSHcy:`Ћ`,tshcy:`ћ`,Tstrok:`Ŧ`,tstrok:`ŧ`,twixt:`≬`,twoheadleftarrow:`↞`,twoheadrightarrow:`↠`,Uacute:`Ú`,uacute:`ú`,Uarr:`↟`,uArr:`⇑`,uarr:`↑`,Uarrocir:`⥉`,Ubrcy:`Ў`,ubrcy:`ў`,Ubreve:`Ŭ`,ubreve:`ŭ`,Ucirc:`Û`,ucirc:`û`,Ucy:`У`,ucy:`у`,udarr:`⇅`,Udblac:`Ű`,udblac:`ű`,udhar:`⥮`,ufisht:`⥾`,Ufr:`𝔘`,ufr:`𝔲`,Ugrave:`Ù`,ugrave:`ù`,uHar:`⥣`,uharl:`↿`,uharr:`↾`,uhblk:`▀`,ulcorn:`⌜`,ulcorner:`⌜`,ulcrop:`⌏`,ultri:`◸`,Umacr:`Ū`,umacr:`ū`,uml:`¨`,UnderBar:`_`,UnderBrace:`⏟`,UnderBracket:`⎵`,UnderParenthesis:`⏝`,Union:`⋃`,UnionPlus:`⊎`,Uogon:`Ų`,uogon:`ų`,Uopf:`𝕌`,uopf:`𝕦`,UpArrow:`↑`,Uparrow:`⇑`,uparrow:`↑`,UpArrowBar:`⤒`,UpArrowDownArrow:`⇅`,UpDownArrow:`↕`,Updownarrow:`⇕`,updownarrow:`↕`,UpEquilibrium:`⥮`,upharpoonleft:`↿`,upharpoonright:`↾`,uplus:`⊎`,UpperLeftArrow:`↖`,UpperRightArrow:`↗`,Upsi:`ϒ`,upsi:`υ`,upsih:`ϒ`,Upsilon:`Υ`,upsilon:`υ`,UpTee:`⊥`,UpTeeArrow:`↥`,upuparrows:`⇈`,urcorn:`⌝`,urcorner:`⌝`,urcrop:`⌎`,Uring:`Ů`,uring:`ů`,urtri:`◹`,Uscr:`𝒰`,uscr:`𝓊`,utdot:`⋰`,Utilde:`Ũ`,utilde:`ũ`,utri:`▵`,utrif:`▴`,uuarr:`⇈`,Uuml:`Ü`,uuml:`ü`,uwangle:`⦧`,vangrt:`⦜`,varepsilon:`ϵ`,varkappa:`ϰ`,varnothing:`∅`,varphi:`ϕ`,varpi:`ϖ`,varpropto:`∝`,vArr:`⇕`,varr:`↕`,varrho:`ϱ`,varsigma:`ς`,varsubsetneq:`⊊︀`,varsubsetneqq:`⫋︀`,varsupsetneq:`⊋︀`,varsupsetneqq:`⫌︀`,vartheta:`ϑ`,vartriangleleft:`⊲`,vartriangleright:`⊳`,Vbar:`⫫`,vBar:`⫨`,vBarv:`⫩`,Vcy:`В`,vcy:`в`,VDash:`⊫`,Vdash:`⊩`,vDash:`⊨`,vdash:`⊢`,Vdashl:`⫦`,Vee:`⋁`,vee:`∨`,veebar:`⊻`,veeeq:`≚`,vellip:`⋮`,Verbar:`‖`,verbar:`|`,Vert:`‖`,vert:`|`,VerticalBar:`∣`,VerticalLine:`|`,VerticalSeparator:`❘`,VerticalTilde:`≀`,VeryThinSpace:` `,Vfr:`𝔙`,vfr:`𝔳`,vltri:`⊲`,vnsub:`⊂⃒`,vnsup:`⊃⃒`,Vopf:`𝕍`,vopf:`𝕧`,vprop:`∝`,vrtri:`⊳`,Vscr:`𝒱`,vscr:`𝓋`,vsubnE:`⫋︀`,vsubne:`⊊︀`,vsupnE:`⫌︀`,vsupne:`⊋︀`,Vvdash:`⊪`,vzigzag:`⦚`,Wcirc:`Ŵ`,wcirc:`ŵ`,wedbar:`⩟`,Wedge:`⋀`,wedge:`∧`,wedgeq:`≙`,weierp:`℘`,Wfr:`𝔚`,wfr:`𝔴`,Wopf:`𝕎`,wopf:`𝕨`,wp:`℘`,wr:`≀`,wreath:`≀`,Wscr:`𝒲`,wscr:`𝓌`,xcap:`⋂`,xcirc:`◯`,xcup:`⋃`,xdtri:`▽`,Xfr:`𝔛`,xfr:`𝔵`,xhArr:`⟺`,xharr:`⟷`,Xi:`Ξ`,xi:`ξ`,xlArr:`⟸`,xlarr:`⟵`,xmap:`⟼`,xnis:`⋻`,xodot:`⨀`,Xopf:`𝕏`,xopf:`𝕩`,xoplus:`⨁`,xotime:`⨂`,xrArr:`⟹`,xrarr:`⟶`,Xscr:`𝒳`,xscr:`𝓍`,xsqcup:`⨆`,xuplus:`⨄`,xutri:`△`,xvee:`⋁`,xwedge:`⋀`,Yacute:`Ý`,yacute:`ý`,YAcy:`Я`,yacy:`я`,Ycirc:`Ŷ`,ycirc:`ŷ`,Ycy:`Ы`,ycy:`ы`,yen:`¥`,Yfr:`𝔜`,yfr:`𝔶`,YIcy:`Ї`,yicy:`ї`,Yopf:`𝕐`,yopf:`𝕪`,Yscr:`𝒴`,yscr:`𝓎`,YUcy:`Ю`,yucy:`ю`,Yuml:`Ÿ`,yuml:`ÿ`,Zacute:`Ź`,zacute:`ź`,Zcaron:`Ž`,zcaron:`ž`,Zcy:`З`,zcy:`з`,Zdot:`Ż`,zdot:`ż`,zeetrf:`ℨ`,ZeroWidthSpace:``,Zeta:`Ζ`,zeta:`ζ`,Zfr:`ℨ`,zfr:`𝔷`,ZHcy:`Ж`,zhcy:`ж`,zigrarr:`⇝`,Zopf:`ℤ`,zopf:`𝕫`,Zscr:`𝒵`,zscr:`𝓏`,zwj:``,zwnj:``}),e.entityMap=e.HTML_ENTITIES})),gR=o((e=>{var t=dR(),n=pR(),r=fR(),i=t.isHTMLEscapableRawTextElement,a=t.isHTMLMimeType,o=t.isHTMLRawTextElement,s=t.hasOwn,c=t.NAMESPACE,l=r.ParseError,u=r.DOMException,d=0,f=1,p=2,m=3,h=4,g=5,_=6,v=7;function y(){}y.prototype={parse:function(e,t,n){var r=this.domBuilder;r.startDocument(),E(t,t=Object.create(null)),x(e,t,n,r,this.errorHandler),r.endDocument()}};var b=/&#?\w+;?/g;function x(e,r,i,o,c){var d=a(o.mimeType);e.indexOf(n.UNICODE_REPLACEMENT_CHARACTER)>=0&&c.warning(`Unicode replacement character detected, source encoding issues?`);function f(e){if(e>65535){e-=65536;var t=55296+(e>>10),n=56320+(e&1023);return String.fromCharCode(t,n)}return String.fromCharCode(e)}function p(e){var t=e[e.length-1]===`;`?e:e+`;`;if(!d&&t!==e)return c.error(`EntityRef: expecting ;`),e;var r=n.Reference.exec(t);if(!r||r[0].length!==t.length)return c.error(`entity not matching Reference production: `+e),e;var a=t.slice(1,-1);return s(i,a)?i[a]:a.charAt(0)===`#`?f(parseInt(a.substring(1).replace(`x`,`0x`))):(c.error(`entity not found:`+e),e)}function m(t){if(t>D){var n=e.substring(D,t).replace(b,p);v&&y(D),o.characters(n,0,t-D),D=t}}var h=0,g=0,_=/\r\n?|\n|$/g,v=o.locator;function y(t,n){for(;t>=g&&(n=_.exec(e));)h=g,g=n.index+n[0].length,v.lineNumber++;v.columnNumber=t-h+1}for(var x=[{currentNSMap:r}],E=[],D=0;;){try{var O=e.indexOf(`<`,D);if(O<0){if(!d&&E.length>0)return c.fatalError(`unclosed xml tag(s): `+E.join(`, `));if(!e.substring(D).match(/^\s*$/)){var M=o.doc,N=M.createTextNode(e.substring(D));if(M.documentElement)return c.error(`Extra content at the end of the document`);M.appendChild(N),o.currentElement=N}return}if(O>D){var P=e.substring(D,O);!d&&E.length===0&&(P=P.replace(new RegExp(n.S_OPT.source,`g`),``),P&&c.error(`Unexpected content outside root element: '`+P+`'`)),m(O)}switch(e.charAt(O+1)){case`/`:var F=e.indexOf(`>`,O+2),I=e.substring(O+2,F>0?F:void 0);if(!I)return c.fatalError(`end tag name missing`);var L=n.reg(`^`,n.QName_group,n.S_OPT,`$`),R=F>0&&L.exec(I);if(!R){var z=F>0&&n.reg(`^`,n.QName_group).exec(I);if(d&&z)c.warning(`end tag name contains invalid trailing characters: "`+I+`"`),R=z;else if(z&&new RegExp(L.source,L.flags+`m`).test(I))c.error(`end tag name is followed by a line break and trailing content: "`+I+`"`),R=z;else return c.fatalError(`end tag name contains invalid characters: "`+I+`"`)}if(!o.currentElement&&!o.doc.documentElement)return;var ee=E[E.length-1]||o.currentElement.tagName||o.doc.documentElement.tagName||``;if(ee!==R[1]){var B=R[1].toLowerCase();if(!d||ee.toLowerCase()!==B)return c.fatalError(`Opening and ending tag mismatch: "`+ee+`" != "`+I+`"`)}var V=x.pop();E.pop();var te=V.localNSMap;if(o.endElement(V.uri,V.localName,ee),te)for(var ne in te)s(te,ne)&&o.endPrefixMapping(ne);F++;break;case`?`:v&&y(O),F=A(e,O,o,c);break;case`!`:v&&y(O),F=k(e,O,o,c,d);break;default:v&&y(O);var H=new j,U=x[x.length-1].currentNSMap,F=C(e,O,H,U,p,c,d),re=H.length;if(H.closed||(d&&t.isHTMLVoidElement(H.tagName)?H.closed=!0:E.push(H.tagName)),v&&re){for(var ie=S(v,{}),ae=0;ae<re;ae++){var oe=H[ae];y(oe.offset),oe.locator=S(v,{})}o.locator=ie,w(H,o,U)&&x.push(H),o.locator=v}else w(H,o,U)&&x.push(H);d&&!H.closed?F=T(e,F,H.tagName,p,o):F++}}catch(e){if(e instanceof l)throw e;if(e instanceof u)return c.fatalError(`Error constructing the DOM: `+e.name+`: `+e.message,e);c.error(`element parse error: `+e),F=-1}F>D?D=F:m(Math.max(O,D)+1)}}function S(e,t){return t.lineNumber=e.lineNumber,t.columnNumber=e.columnNumber,t}function C(e,t,n,r,i,a,o){function c(e,t,r){if(s(n.attributeNames,e))return a.fatalError(`Attribute `+e+` redefined`);if(!o&&t.indexOf(`<`)>=0)return a.fatalError(`Unescaped '<' not allowed in attributes values`);n.addValue(e,t.replace(/[\t\n\r]/g,` `).replace(b,i),r)}for(var l,u,y=++t,x=d;;){var S=e.charAt(y);if(x===d&&S===`<`)throw Error(`unexpected < in tag name: `+e.slice(t,y));switch(S){case`=`:if(x===f)l=e.slice(t,y),x=m;else if(x===p)x=m;else throw Error(`attribute equal must after attrName`);break;case`'`:case`"`:if(x===m||x===f){if(x===f&&(a.warning(`attribute value must after "="`),l=e.slice(t,y)),t=y+1,y=e.indexOf(S,t),y>0)u=e.slice(t,y),c(l,u,t-1),x=g;else throw Error(`attribute value no end '`+S+`' match`)}else if(x==h)u=e.slice(t,y),c(l,u,t),a.warning(`attribute "`+l+`" missed start quot(`+S+`)!!`),t=y+1,x=g;else throw Error(`attribute value must after "="`);break;case`/`:switch(x){case d:n.setTagName(e.slice(t,y));case g:case _:case v:x=v,n.closed=!0;case h:case f:break;case p:n.closed=!0;break;default:throw Error(`attribute invalid close char('/')`)}break;case``:return a.error(`unexpected end of input`),x==d&&n.setTagName(e.slice(t,y)),y;case`>`:switch(x){case d:n.setTagName(e.slice(t,y));case g:case _:case v:break;case h:case f:u=e.slice(t,y),u.slice(-1)===`/`&&(n.closed=!0,u=u.slice(0,-1));case p:x===p&&(u=l),x==h?(a.warning(`attribute "`+u+`" missed quot(")!`),c(l,u,t)):(o||a.warning(`attribute "`+u+`" missed value!! "`+u+`" instead!!`),c(u,u,t));break;case m:if(!o)return a.fatalError(`AttValue: ' or " expected`)}return y;case``:S=` `;default:if(S<=` `)switch(x){case d:n.setTagName(e.slice(t,y)),x=_;break;case f:l=e.slice(t,y),x=p;break;case h:var u=e.slice(t,y);a.warning(`attribute "`+u+`" missed quot(")!!`),c(l,u,t);case g:x=_}else switch(x){case p:o||a.warning(`attribute "`+l+`" missed value!! "`+l+`" instead2!!`),c(l,l,t),t=y,x=f;break;case g:a.warning(`attribute space is required"`+l+`"!!`);case _:x=f,t=y;break;case m:x=h,t=y;break;case v:throw Error(`elements closed character '/' and '>' must be connected to`)}}y++}}function w(e,t,n){for(var r=e.tagName,i=null,a=e.length;a--;){var o=e[a],l=o.qName,u=o.value,d=l.indexOf(`:`);if(d>0)var f=o.prefix=l.slice(0,d),p=l.slice(d+1),m=f===`xmlns`&&p;else p=l,f=null,m=l===`xmlns`&&``;o.localName=p,m!==!1&&(i??(i=Object.create(null),n=Object.create(n)),n[m]=i[m]=u,o.uri=c.XMLNS,t.startPrefixMapping(m,u))}for(var a=e.length;a--;)o=e[a],o.prefix&&(o.prefix===`xml`&&(o.uri=c.XML),o.prefix!==`xmlns`&&(o.uri=n[o.prefix]));var d=r.indexOf(`:`);d>0?(f=e.prefix=r.slice(0,d),p=e.localName=r.slice(d+1)):(f=null,p=e.localName=r);var h=e.uri=n[f||``];if(t.startElement(h,p,r,e),e.closed){if(t.endElement(h,p,r),i)for(f in i)s(i,f)&&t.endPrefixMapping(f)}else return e.currentNSMap=n,e.localNSMap=i,!0}function T(e,t,n,r,a){var s=i(n);if(s||o(n)){var c=RegExp(`</`+n.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)+`>`,`ig`);c.lastIndex=t;var l=c.exec(e),u=l?l.index:-1;if(u<0)return t+1;var d=e.substring(t+1,u);return s&&(d=d.replace(b,r)),a.characters(d,0,d.length),u}return t+1}function E(e,t){for(var n in e)s(e,n)&&(t[n]=e[n])}function D(e,t){var r=t;function i(t){return t||=0,e.charAt(r+t)}function a(e){e||=1,r+=e}function o(){for(var t=0;r<e.length;){var n=i();if(n!==` `&&n!==`
|
|
85
|
+
`&&n!==` `&&n!==`\r`)return t;t++,a()}return-1}function s(){return e.substring(r)}function c(t){return e.substring(r,r+t.length)===t}function l(t){return e.substring(r,r+t.length).toUpperCase()===t.toUpperCase()}function u(e){var t=n.reg(`^`,e).exec(s());return t?(a(t[0].length),t[0]):null}return{char:i,getIndex:function(){return r},getMatch:u,getSource:function(){return e},skip:a,skipBlanks:o,substringFromIndex:s,substringStartsWith:c,substringStartsWithCaseInsensitive:l}}function O(e,t){function r(e,t){var r=n.PI.exec(e.substringFromIndex());return r?r[1].toLowerCase()===`xml`?t.fatalError(`xml declaration is only allowed at the start of the document, but found at position `+e.getIndex()):(e.skip(r[0].length),r[0]):t.fatalError(`processing instruction is not well-formed at position `+e.getIndex())}var i=e.getSource();if(e.char()===`[`){e.skip(1);for(var a=e.getIndex();e.getIndex()<i.length;){if(e.skipBlanks(),e.char()===`]`){var o=i.substring(a,e.getIndex());return e.skip(1),o}var s=null;if(e.char()===`<`&&e.char(1)===`!`)switch(e.char(2)){case`E`:e.char(3)===`L`?s=e.getMatch(n.elementdecl):e.char(3)===`N`&&(s=e.getMatch(n.EntityDecl));break;case`A`:s=e.getMatch(n.AttlistDecl);break;case`N`:s=e.getMatch(n.NotationDecl);break;case`-`:s=e.getMatch(n.Comment)}else if(e.char()===`<`&&e.char(1)===`?`)s=r(e,t);else if(e.char()===`%`)s=e.getMatch(n.PEReference);else return t.fatalError(`Error detected in Markup declaration`);if(!s)return t.fatalError(`Error in internal subset at position `+e.getIndex())}return t.fatalError(`doctype internal subset is not well-formed, missing ]`)}}function k(e,t,r,i,a){var o=D(e,t);switch(a?o.char(2).toUpperCase():o.char(2)){case`-`:var s=o.getMatch(n.Comment);return s?(r.comment(s,n.COMMENT_START.length,s.length-n.COMMENT_START.length-n.COMMENT_END.length),o.getIndex()):i.fatalError(`comment is not well-formed at position `+o.getIndex());case`[`:var c=o.getMatch(n.CDSect);return c?!a&&!r.currentElement?i.fatalError(`CDATA outside of element`):(r.startCDATA(),r.characters(c,n.CDATA_START.length,c.length-n.CDATA_START.length-n.CDATA_END.length),r.endCDATA(),o.getIndex()):i.fatalError(`Invalid CDATA starting at position `+t);case`D`:if(r.doc&&r.doc.documentElement)return i.fatalError(`Doctype not allowed inside or after documentElement at position `+o.getIndex());if(a?!o.substringStartsWithCaseInsensitive(n.DOCTYPE_DECL_START):!o.substringStartsWith(n.DOCTYPE_DECL_START))return i.fatalError(`Expected `+n.DOCTYPE_DECL_START+` at position `+o.getIndex());if(o.skip(n.DOCTYPE_DECL_START.length),o.skipBlanks()<1)return i.fatalError(`Expected whitespace after `+n.DOCTYPE_DECL_START+` at position `+o.getIndex());var l={name:void 0,publicId:void 0,systemId:void 0,internalSubset:void 0};if(l.name=o.getMatch(n.Name),!l.name)return i.fatalError(`doctype name missing or contains unexpected characters at position `+o.getIndex());if(a&&l.name.toLowerCase()!==`html`&&i.warning(`Unexpected DOCTYPE in HTML document at position `+o.getIndex()),o.skipBlanks(),o.substringStartsWith(n.PUBLIC)||o.substringStartsWith(n.SYSTEM)){var u=n.ExternalID_match.exec(o.substringFromIndex());if(!u)return i.fatalError(`doctype external id is not well-formed at position `+o.getIndex());u.groups.SystemLiteralOnly===void 0?(l.systemId=u.groups.SystemLiteral,l.publicId=u.groups.PubidLiteral):l.systemId=u.groups.SystemLiteralOnly,o.skip(u[0].length)}else if(a&&o.substringStartsWithCaseInsensitive(n.SYSTEM)){if(o.skip(n.SYSTEM.length),o.skipBlanks()<1)return i.fatalError(`Expected whitespace after `+n.SYSTEM+` at position `+o.getIndex());if(l.systemId=o.getMatch(n.ABOUT_LEGACY_COMPAT_SystemLiteral),!l.systemId)return i.fatalError(`Expected `+n.ABOUT_LEGACY_COMPAT+` in single or double quotes after `+n.SYSTEM+` at position `+o.getIndex())}return a&&l.systemId&&!n.ABOUT_LEGACY_COMPAT_SystemLiteral.test(l.systemId)&&i.warning(`Unexpected doctype.systemId in HTML document at position `+o.getIndex()),a||(o.skipBlanks(),l.internalSubset=O(o,i)),o.skipBlanks(),o.char()===`>`?(o.skip(1),r.startDTD(l.name,l.publicId,l.systemId,l.internalSubset),r.endDTD(),o.getIndex()):i.fatalError(`doctype not terminated with > at position `+o.getIndex());default:return i.fatalError(`Not well-formed XML starting with "<!" at position `+t)}}function A(e,t,r,i){var a=e.substring(t).match(n.PI);if(!a)return i.fatalError(`Invalid processing instruction starting at position `+t);if(a[1].toLowerCase()===`xml`){if(t>0)return i.fatalError(`processing instruction at position `+t+` is an xml declaration which is only at the start of the document`);if(!n.XMLDecl.test(e.substring(t)))return i.fatalError(`xml declaration is not well-formed`)}return r.processingInstruction(a[1],a[2]),t+a[0].length}function j(){this.attributeNames=Object.create(null)}j.prototype={setTagName:function(e){if(!n.QName_exact.test(e))throw Error(`invalid tagName:`+e);this.tagName=e},addValue:function(e,t,r){if(!n.QName_exact.test(e))throw Error(`invalid attribute:`+e);this.attributeNames[e]=this.length,this[this.length++]={qName:e,value:t,offset:r}},length:0,getLocalName:function(e){return this[e].localName},getLocator:function(e){return this[e].locator},getQName:function(e){return this[e].qName},getURI:function(e){return this[e].uri},getValue:function(e){return this[e].value}},e.XMLReader=y,e.parseUtils=D,e.parseDoctypeCommentOrCData=k})),_R=o((e=>{var t=dR(),n=mR(),r=fR(),i=hR(),a=gR(),o=n.DOMImplementation,s=t.hasDefaultHTMLNamespace,c=t.isHTMLMimeType,l=t.isValidMimeType,u=t.MIME_TYPE,d=t.NAMESPACE,f=r.ParseError,p=a.XMLReader;function m(e){return e.replace(/\r[\n\u0085]/g,`
|
|
86
|
+
`).replace(/[\r\u0085\u2028\u2029]/g,`
|
|
87
|
+
`)}function h(e){if(e||={},e.locator===void 0&&(e.locator=!0),this.assign=e.assign||t.assign,this.domHandler=e.domHandler||g,this.onError=e.onError||e.errorHandler,e.errorHandler&&typeof e.errorHandler!=`function`)throw TypeError(`errorHandler object is no longer supported, switch to onError!`);e.errorHandler&&e.errorHandler(`warning`,"The `errorHandler` option has been deprecated, use `onError` instead!",this),this.normalizeLineEndings=e.normalizeLineEndings||m,this.locator=!!e.locator,this.xmlns=this.assign(Object.create(null),e.xmlns)}h.prototype.parseFromString=function(e,n){if(!l(n))throw TypeError(`DOMParser.parseFromString: the provided mimeType "`+n+`" is not valid.`);var r=this.assign(Object.create(null),this.xmlns),a=i.XML_ENTITIES,o=r[``]||null;s(n)?(a=i.HTML_ENTITIES,o=d.HTML):n===u.XML_SVG_IMAGE&&(o=d.SVG),r[``]=o,r.xml=r.xml||d.XML;var c=new this.domHandler({mimeType:n,defaultNamespace:o,onError:this.onError}),f=this.locator?{}:void 0;this.locator&&c.setDocumentLocator(f);var m=new p;return m.errorHandler=c,m.domBuilder=c,!t.isHTMLMimeType(n)&&typeof e!=`string`&&m.errorHandler.fatalError(`source is not a string`),m.parse(this.normalizeLineEndings(String(e)),r,a),c.doc.documentElement||m.errorHandler.fatalError(`missing root element`),c.doc};function g(e){var t=e||{};this.mimeType=t.mimeType||u.XML_APPLICATION,this.defaultNamespace=t.defaultNamespace||null,this.cdata=!1,this.currentElement=void 0,this.doc=void 0,this.locator=void 0,this.onError=t.onError}function _(e,t){t.lineNumber=e.lineNumber,t.columnNumber=e.columnNumber}g.prototype={startDocument:function(){var e=new o;this.doc=c(this.mimeType)?e.createHTMLDocument(!1):e.createDocument(this.defaultNamespace,``)},startElement:function(e,t,n,r){var i=this.doc,a=i.createElementNS(e,n||t),o=r.length;b(this,a),this.currentElement=a,this.locator&&_(this.locator,a);for(var s=0;s<o;s++){var e=r.getURI(s),c=r.getValue(s),n=r.getQName(s),l=i.createAttributeNS(e,n);this.locator&&_(r.getLocator(s),l),l.value=l.nodeValue=c,a.setAttributeNode(l)}},endElement:function(e,t,n){this.currentElement=this.currentElement.parentNode},startPrefixMapping:function(e,t){},endPrefixMapping:function(e){},processingInstruction:function(e,t){var n=this.doc.createProcessingInstruction(e,t);this.locator&&_(this.locator,n),b(this,n)},ignorableWhitespace:function(e,t,n){},characters:function(e,t,n){if(e=y.apply(this,arguments),e){if(this.cdata)var r=this.doc.createCDATASection(e);else var r=this.doc.createTextNode(e);this.currentElement?this.currentElement.appendChild(r):/^\s*$/.test(e)&&this.doc.appendChild(r),this.locator&&_(this.locator,r)}},skippedEntity:function(e){},endDocument:function(){this.doc.normalize()},setDocumentLocator:function(e){e&&(e.lineNumber=0),this.locator=e},comment:function(e,t,n){e=y.apply(this,arguments);var r=this.doc.createComment(e);this.locator&&_(this.locator,r),b(this,r)},startCDATA:function(){this.cdata=!0},endCDATA:function(){this.cdata=!1},startDTD:function(e,t,n,r){var i=this.doc.implementation;if(i&&i.createDocumentType){var a=i.createDocumentType(e,t,n,r);this.locator&&_(this.locator,a),b(this,a),this.doc.doctype=a}},reportError:function(e,t){if(typeof this.onError==`function`)try{this.onError(e,t,this)}catch(n){throw new f(`Reporting `+e+` "`+t+`" caused `+n,this.locator)}else console.error(`[xmldom `+e+`] `+t,v(this.locator))},warning:function(e){this.reportError(`warning`,e)},error:function(e){this.reportError(`error`,e)},fatalError:function(e,t){throw this.reportError(`fatalError`,e),new f(e,this.locator,t)}};function v(e){if(e)return`
|
|
88
|
+
@#[line:`+e.lineNumber+`,col:`+e.columnNumber+`]`}function y(e,t,n){return typeof e==`string`?e.substr(t,n):e.length>=t+n||t?new java.lang.String(e,t,n)+``:e}`endDTD,startEntity,endEntity,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,resolveEntity,getExternalSubset,notationDecl,unparsedEntityDecl`.replace(/\w+/g,function(e){g.prototype[e]=function(){return null}});function b(e,t){e.currentElement?e.currentElement.appendChild(t):e.doc.appendChild(t)}function x(e){if(e===`error`)throw`onErrorStopParsing`}function S(){throw`onWarningStopParsing`}e.__DOMHandler=g,e.DOMParser=h,e.normalizeLineEndings=m,e.onErrorStopParsing=x,e.onWarningStopParsing=S})),vR=o((e=>{var t=dR();e.assign=t.assign,e.hasDefaultHTMLNamespace=t.hasDefaultHTMLNamespace,e.isHTMLMimeType=t.isHTMLMimeType,e.isValidMimeType=t.isValidMimeType,e.MIME_TYPE=t.MIME_TYPE,e.NAMESPACE=t.NAMESPACE;var n=fR();e.DOMException=n.DOMException,e.DOMExceptionName=n.DOMExceptionName,e.ExceptionCode=n.ExceptionCode,e.ParseError=n.ParseError;var r=mR();e.Attr=r.Attr,e.CDATASection=r.CDATASection,e.CharacterData=r.CharacterData,e.Comment=r.Comment,e.Document=r.Document,e.DocumentFragment=r.DocumentFragment,e.DocumentType=r.DocumentType,e.DOMImplementation=r.DOMImplementation,e.Element=r.Element,e.Entity=r.Entity,e.EntityReference=r.EntityReference,e.LiveNodeList=r.LiveNodeList,e.NamedNodeMap=r.NamedNodeMap,e.Node=r.Node,e.NodeList=r.NodeList,e.Notation=r.Notation,e.ProcessingInstruction=r.ProcessingInstruction,e.Text=r.Text,e.XMLSerializer=r.XMLSerializer;var i=_R();e.DOMParser=i.DOMParser,e.normalizeLineEndings=i.normalizeLineEndings,e.onErrorStopParsing=i.onErrorStopParsing,e.onWarningStopParsing=i.onWarningStopParsing}))(),yR=class{constructor(e){if(bR(e))throw Error(`DataView: Passed buffer type is unsupported.`);this.buffer=e,this.byteLength=this.buffer.length}getUint8(e){return this.buffer.readUInt8(e)}getUint16(e,t){return t?this.buffer.readUInt16LE(e):this.buffer.readUInt16BE(e)}getUint32(e,t){return t?this.buffer.readUInt32LE(e):this.buffer.readUInt32BE(e)}getInt32(e,t){return t?this.buffer.readInt32LE(e):this.buffer.readInt32BE(e)}};function bR(e){return typeof e!=`object`||e.length===void 0||e.readUInt8===void 0||e.readUInt16LE===void 0||e.readUInt16BE===void 0||e.readUInt32LE===void 0||e.readUInt32BE===void 0||e.readInt32LE===void 0||e.readInt32BE===void 0}function xR(e,t,n){try{return new DataView(e,t,n)}catch{return new yR(e,t,n)}}function SR(e,t,n){let r=[];for(let i=0;i<n&&t+i<e.byteLength;i++)r.push(e.getUint8(t+i));return ER(r)}function CR(e,t){let n=[],r=0;for(;t+r<e.byteLength;){let i=e.getUint8(t+r);if(i===0)break;n.push(i),r++}return ER(n)}function wR(e,t,n){let r=[];for(let i=0;i+2<=n&&t+i+2<=e.byteLength;i+=2)r.push(e.getUint16(t+i));return r[r.length-1]===0&&r.pop(),ER(r)}function TR(e,t){let n=e.getUint8(t);return[n,SR(e,t+1,n)]}function ER(e){return e.map(e=>String.fromCharCode(e)).join(``)}function DR(e){let t=OR(e);return t===void 0?e:t}function OR(e){try{return decodeURIComponent(escape(e))}catch{return}}function kR(e,t,n,r){e&&t&&e.push({type:t,start:n,end:r})}function AR(){if(typeof Promise>`u`)throw Error(`Promise is required when async mode is enabled.`)}function jR(){for(let e=1;e<arguments.length;e++)for(let t in arguments[e])MR(arguments[0],t,arguments[e][t]);return arguments[0]}function MR(e,t,n){if(t===`__proto__`){Object.defineProperty(e,t,{value:n,enumerable:!0,writable:!0,configurable:!0});return}e[t]=n}function NR(e,t,n){let r=!1;Object.defineProperty(e,t,{get(){return r||(r=!0,Object.defineProperty(e,t,{configurable:!0,enumerable:!0,value:n.apply(e),writable:!0})),e[t]},configurable:!0,enumerable:!0})}function PR(e){if(typeof btoa<`u`)return btoa(typeof e==`string`?e:Array.prototype.reduce.call(new Uint8Array(e),(e,t)=>e+String.fromCharCode(t),``));if(!(typeof Buffer>`u`))return Buffer.from===void 0?new Buffer(e).toString(`base64`):Buffer.from(e).toString(`base64`)}function FR(e){let t=e.substring(e.indexOf(`,`)+1);if(e.indexOf(`;base64`)!==-1)return typeof atob<`u`?Uint8Array.from(atob(t),e=>e.charCodeAt(0)).buffer:typeof Buffer>`u`?void 0:Buffer.from===void 0?new Buffer(t,`base64`):Buffer.from(t,`base64`);let n=decodeURIComponent(t);return typeof Buffer<`u`?Buffer.from===void 0?new Buffer(n):Buffer.from(n):Uint8Array.from(n,e=>e.charCodeAt(0)).buffer}function IR(e,t,n){return RR(n,Math.max(0,t-e.length))+e}function LR(e,t){return parseInt(e.replace(`.`,``),t)/t**+(e.split(`.`)[1]||``).length}function RR(e,t){return Array(t+1).join(e)}var zR=`brotli`,BR=134217728;function VR(e,t,n,r=`string`,i){let a=HR(i);if(i&&t!==void 0){let o=i[t===0?`deflate`:`brotli`];if(typeof o==`function`){let t=new Uint8Array(e.buffer,e.byteOffset,e.byteLength);return Promise.resolve(o(t)).then(e=>KR(e)>a?qR(a):r===`dataview`?e instanceof ArrayBuffer?new DataView(e):e.byteOffset===0&&e.byteLength===e.buffer.byteLength?new DataView(e.buffer):new DataView(e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength)):new TextDecoder(n).decode(e))}}if(t===0&&typeof DecompressionStream==`function`)return UR(e,`deflate`,a).then(e=>GR(e,r,n));if(t===`brotli`){if(typeof DecompressionStream==`function`)try{return UR(e,`brotli`,a).then(e=>GR(e,r,n))}catch{}return Promise.reject(`Brotli decompression is not supported in this environment. Pass in a brotli decompression function via the decompress option.`)}if(t!==void 0)return Promise.reject(`Unknown compression method ${t}.`);if(r===`string`)try{return new TextDecoder(n).decode(e)}catch{let t=new Uint8Array(e.buffer,e.byteOffset,e.byteLength);return Array.from(t,e=>String.fromCharCode(e)).join(``)}return e}function HR(e){return e&&typeof e.maxDecompressedSize==`number`?e.maxDecompressedSize:BR}function UR(e,t,n){let r=new DecompressionStream(t),i=new Blob([e]).stream().pipeThrough(r).getReader(),a=[],o=0;return s();function s(){return i.read().then(({done:e,value:t})=>e?WR(a,o):(o+=t.byteLength,o>n?i.cancel().then(()=>qR(n)):(a.push(t),s())))}}function WR(e,t){let n=new Uint8Array(t),r=0;for(let t=0;t<e.length;t++)n.set(e[t],r),r+=e[t].byteLength;return n.buffer}function GR(e,t,n){return t===`dataview`?new DataView(e):new TextDecoder(n).decode(e)}function KR(e){return e&&typeof e.byteLength==`number`?e.byteLength:0}function qR(e){return typeof console<`u`&&typeof console.warn==`function`&&console.warn(`ExifReader: skipped a compressed metadata block that would exceed the maximum decompressed size of ${e} bytes.`),Promise.reject(`Decompressed metadata exceeded the maximum allowed size of ${e} bytes.`)}function JR(e){return typeof e==`string`}function YR(e){return typeof File<`u`&&e instanceof File}function XR(e){return/^data:[^;,]*(;base64)?,/.test(e)}function ZR(e,t){return/^\w+:\/\//.test(e)?typeof fetch<`u`?ez(e,$R(t)).then(e=>e.buffer):iz(e,$R(t)).then(e=>e.buffer):XR(e)?Promise.resolve(FR(e)):cz(e,$R(t)).then(e=>e.buffer)}function QR(e,t){return fz(e,$R(t)).then(e=>e.buffer)}function $R(e){return e&&Number.isInteger(e.length)&&e.length>=0?{start:0,end:e.length}:{start:0}}function ez(e,{start:t=0,end:n}={}){let r={method:`GET`};return(t>0||n!==void 0&&n!==1/0)&&(r.headers={range:tz(t,n)}),fetch(e,r).then(e=>{let t=e&&typeof e.status==`number`?e.status:void 0;if(t!==void 0&&!rz(t)){let n=e.statusText||``;return Promise.reject(Error(`Could not fetch file: ${t} ${n}`.trim()))}let n=nz(e);return Promise.resolve(e.arrayBuffer()).then(e=>({buffer:e,totalSize:n,status:t}))})}function tz(e,t){return t===void 0||t===1/0?`bytes=${e}-`:`bytes=${e}-${t-1}`}function nz(e){if(!(!e||!e.headers||typeof e.headers.get!=`function`))return oz(e.headers.get(`Content-Range`),e.headers.get(`Content-Length`))}function rz(e){return e>=200&&e<=299||e===416}function iz(e,{start:t=0,end:n}={}){return new Promise((r,i)=>{let a={};(t>0||n!==void 0&&n!==1/0)&&(a.headers={range:tz(t,n)}),sz(e)(e,a,e=>{if(e.statusCode>=200&&e.statusCode<=299){let t=az(e),n=[];e.on(`data`,e=>n.push(Buffer.from(e))),e.on(`error`,e=>i(e)),e.on(`end`,()=>r({buffer:Buffer.concat(n),totalSize:t,status:e.statusCode}))}else e.statusCode===416?(e.resume(),r({buffer:Buffer.alloc(0),totalSize:az(e),status:e.statusCode})):(i(Error(`Could not fetch file: ${e.statusCode} ${e.statusMessage}`)),e.resume())}).on(`error`,e=>i(e))})}function az(e){if(!(!e||!e.headers))return oz(e.headers[`content-range`],e.headers[`content-length`])}function oz(e,t){if(e){let t=/\/(\d+|\*)$/.exec(e);if(t&&t[1]!==`*`)return parseInt(t[1],10)}if(t){let e=parseInt(t,10);if(Number.isFinite(e))return e}}function sz(e){return/^https:\/\//.test(e)?__non_webpack_require__(`https`).get:__non_webpack_require__(`http`).get}function cz(e,{start:t=0,end:n,totalSize:r}={}){return new Promise((i,a)=>{let o=dz();o.open(e,(s,c)=>{if(s)return a(s);lz(o,e,r,(r,s)=>{if(r)return o.close(c,()=>a(r));let l=n===void 0||n===1/0||n>s?s:n,u=Math.min(Math.max(0,t),l),d=l-u,f=Buffer.alloc(d);if(d===0)return o.close(c,t=>uz(e,t,f,s,i));o.read(c,{buffer:f,length:d,position:u},t=>{if(t)return o.close(c,()=>a(t));o.close(c,t=>uz(e,t,f,s,i))})})})})}function lz(e,t,n,r){if(n!==void 0)return r(null,n);e.stat(t,(e,t)=>r(e,e?void 0:t.size))}function uz(e,t,n,r,i){t&&console.warn(`Could not close file ${e}:`,t),i({buffer:n,totalSize:r})}function dz(){try{return __non_webpack_require__(`fs`)}catch{return}}function fz(e,{start:t=0,end:n}={}){return new Promise((r,i)=>{let a=new FileReader,o=typeof e.size==`number`?e.size:void 0;if(a.onload=e=>r({buffer:e.target.result,totalSize:o}),a.onerror=()=>i(a.error),e&&typeof e.slice==`function`&&(t>0||n!==void 0&&n!==1/0)){let r=n===void 0||n===1/0?o:n;a.readAsArrayBuffer(e.slice(t,r))}else a.readAsArrayBuffer(e)})}function pz(e,t){if(!e)return t;if(!t)return e;if(typeof Buffer<`u`&&Buffer.isBuffer(e)&&Buffer.isBuffer(t))return Buffer.concat([e,t]);let n=mz(e),r=mz(t),i=new Uint8Array(n.byteLength+r.byteLength);return i.set(n,0),i.set(r,n.byteLength),i.buffer}function mz(e){return e instanceof ArrayBuffer?new Uint8Array(e):typeof Buffer<`u`&&Buffer.isBuffer(e)||ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):new Uint8Array(e)}var hz=131072,gz=4,_z=`length: "auto" could not locate metadata in this file (no metadata blocks found after reading the file — e.g. plain TIFF, bare JPEG XL codestream, or a file with no recognizable metadata).`,vz=`length: "auto" is not supported for this file type (no leading metadata container — e.g. plain TIFF or bare JPEG XL codestream).`;function yz(e){if(e.expanded!==!0||e.includeOffsets!==!0)throw Error(`length: "auto" requires both expanded: true and includeOffsets: true.`)}function bz(e){return function(e,i){AR();let a=jR({},i,{async:!0});return JR(e)?t(e,a):YR(e)?n(e,a):r(e,a)};function t(e,t){return/^\w+:\/\//.test(e)?i(typeof fetch<`u`?{readRange:(t,n)=>ez(e,{start:t,end:n}),options:t}:{readRange:(t,n)=>iz(e,{start:t,end:n}),options:t}):XR(e)?r(FR(e),t):i({readRange:(t,n,r)=>cz(e,{start:t,end:n,totalSize:r?r.totalSize:void 0}),options:t})}function n(e,t){return i({readRange:(t,n)=>fz(e,{start:t,end:n}),options:t})}function r(t,n){return Promise.resolve().then(()=>e(t,n)).then(e=>{if(!e||!e.metadataRange)throw Error(vz);let n=e.metadataRange.end;return e.metadataRange.buffer=Tz(t,n),e.metadataRange.fetched=Ez(e.metadataRange.buffer),e.metadataRange.requests=0,e})}function i({readRange:e,options:t}){return a({readRange:e,options:t,buffer:null,fetched:0,requests:0,totalSize:void 0,need:hz,iter:0})}function a(t){return t.iter>=gz||(t.totalSize!==void 0&&(t.need=Math.min(t.need,t.totalSize)),t.need<=t.fetched)?c(t):t.readRange(t.fetched,t.need,{totalSize:t.totalSize}).then(n=>(t.requests++,n.status===416?s(t):(xz(t,n),Promise.resolve(e(t.buffer,t.options)).then(e=>o(t,e)))))}function o(e,t){let n=t&&t.metadataRange;if(n&&n.complete)return Sz(t,e.buffer,e.fetched,e.requests);let r=e.totalSize!==void 0&&e.fetched>=e.totalSize;if(!n&&r)throw Error(_z);let i=Cz({range:n,totalSize:e.totalSize,fetched:e.fetched});if(i<=e.fetched){if(n)return Sz(t,e.buffer,e.fetched,e.requests);throw Error(_z)}return e.need=i,e.iter++,a(e)}function s(t){return t.readRange(0,1/0,{totalSize:void 0}).then(n=>(t.requests++,t.buffer=n.buffer,t.fetched=Ez(t.buffer),n.totalSize!==void 0&&(t.totalSize=n.totalSize),Promise.resolve(e(t.buffer,t.options)))).then(e=>{if(!e||!e.metadataRange)throw Error(_z);return Sz(e,t.buffer,t.fetched,t.requests)})}function c(t){console.warn(`ExifReader: length:"auto" did not converge in ${gz} iterations; falling back to full read.`);let n;return n=t.totalSize!==void 0&&t.fetched<t.totalSize?t.readRange(t.fetched,t.totalSize,{totalSize:t.totalSize}).then(e=>{t.requests++,xz(t,e)}):t.totalSize===void 0?t.readRange(t.fetched,1/0,{totalSize:t.totalSize}).then(e=>{t.requests++,xz(t,e)}):Promise.resolve(),n.then(()=>Promise.resolve(e(t.buffer,t.options))).then(e=>{if(!e||!e.metadataRange)throw Error(_z);return Sz(e,t.buffer,t.fetched,t.requests)})}}function xz(e,t){if(t.status===200&&e.fetched>0){e.buffer=t.buffer,e.fetched=Ez(e.buffer),t.totalSize!==void 0&&(e.totalSize=t.totalSize);return}t.totalSize!==void 0&&e.totalSize===void 0&&(e.totalSize=t.totalSize),e.buffer=pz(e.buffer,t.buffer),e.fetched=Ez(e.buffer)}function Sz(e,t,n,r){let i=e.metadataRange.end;return e.metadataRange.buffer=wz(t,i),e.metadataRange.fetched=n,e.metadataRange.requests=r,e}function Cz({range:e,totalSize:t,fetched:n}){return e?Math.min(Math.max(e.end,n*2),t===void 0?1/0:t):t===void 0?n*2:t}function wz(e,t){return!e||typeof t!=`number`||t<0?e:typeof Buffer<`u`&&Buffer.isBuffer(e)?Buffer.from(e.subarray(0,Math.min(t,e.length))):e instanceof ArrayBuffer||typeof SharedArrayBuffer<`u`&&e instanceof SharedArrayBuffer?e.slice(0,Math.min(t,e.byteLength)):e}function Tz(e,t){if(typeof Buffer<`u`&&Buffer.isBuffer(e))return Buffer.from(e.subarray(0,t));if(e instanceof ArrayBuffer||typeof SharedArrayBuffer<`u`&&e instanceof SharedArrayBuffer)return e.slice(0,t);if(ArrayBuffer.isView(e)){let n=Math.max(0,Math.min(t,e.byteLength));return e.buffer.slice(e.byteOffset,e.byteOffset+n)}return e}function Ez(e){return e?typeof e.byteLength==`number`?e.byteLength:typeof e.length==`number`?e.length:0:0}var Q={USE_FILE:!0,USE_JFIF:!0,USE_PNG_FILE:!0,USE_EXIF:!0,USE_IPTC:!0,USE_XMP:!0,USE_ICC:!0,USE_MPF:!0,USE_PHOTOSHOP:!0,USE_THUMBNAIL:!0,USE_TIFF:!0,USE_JPEG:!0,USE_PNG:!0,USE_HEIC:!0,USE_AVIF:!0,USE_JXL:!0,USE_WEBP:!0,USE_GIF:!0,USE_MAKER_NOTES:!0};function Dz(e){if(e.length>=8){let t=ER(e.slice(0,8));if(t===`ASCII\0\0\0`)return ER(e.slice(8));if(t===`JIS\0\0\0\0\0`)return`[JIS encoded text]`;if(t===`UNICODE\0`)return`[Unicode encoded text]`;if(t===`\0\0\0\0\0\0\0\0`){let t=ER(e.slice(8));return/[\x20-\x7e]/.test(t)?t:`[Undefined encoding]`}}return`Undefined`}function Oz(e){return e[0][0]/e[0][1]+e[1][0]/e[1][1]/60+e[2][0]/e[2][1]/3600}var kz=18761,Az=19789,jz={BIG_ENDIAN:Az,LITTLE_ENDIAN:kz,getByteOrder:Mz};function Mz(e,t){if(e.getUint16(t)===kz)return kz;if(e.getUint16(t)===Az)return Az;throw Error(`Illegal byte order value. Faulty image.`)}function Nz(e,t){return e.getUint32(t+4)}function Pz(e,t,n){return t+n<=e.byteLength}var Fz=1048576;function Iz(e,t,n,r,i,a){let{offsets:o,sizes:s}=Lz(n,r+3),c=e.getUint8(o.offsetSize)>>4;s.item.extent.extentOffset=c;let l=e.getUint8(o.lengthSize)&15;s.item.extent.extentLength=l;let u=e.getUint8(o.baseOffsetSize)>>4;s.item.baseOffset=u;let d=Rz(e,o.indexSize,n);s.item.extent.extentIndex=d===void 0?0:d;let f=zz(e,o.itemCount,n);return{type:`iloc`,items:Bz(e,Math.min(t+i,a),n,o,s,c,l,d,f),length:i}}function Lz(e,t){let n={item:{dataReferenceIndex:2,extentCount:2,extent:{}}};e<2?(n.itemCount=2,n.item.itemId=2):e===2&&(n.itemCount=4,n.item.itemId=4),e===1||e===2?n.item.constructionMethod=2:n.item.constructionMethod=0;let r={offsetSize:t,lengthSize:t,baseOffsetSize:t+1,indexSize:t+1};return r.itemCount=t+2,r.items=r.itemCount+n.itemCount,r.item={itemId:0},r.item.constructionMethod=r.item.itemId+n.item.itemId,r.item.dataReferenceIndex=r.item.constructionMethod+n.item.constructionMethod,{offsets:r,sizes:n}}function Rz(e,t,n){if(n===1||n===2)return e.getUint8(t)&15}function zz(e,t,n){if(n<2)return e.getUint16(t);if(n===2)return e.getUint32(t)}function Bz(e,t,n,r,i,a,o,s,c){if(c===void 0)return[];let l=[],u=r.items,d=i.item.extent.extentIndex+i.item.extent.extentOffset+i.item.extent.extentLength,f=i.item.itemId+i.item.constructionMethod+i.item.dataReferenceIndex+i.item.baseOffset+i.item.extentCount,p=0;for(let r=0;r<c&&!(u+f>t);r++){let r={extents:[]};r.itemId=Hz(e,u,n),u+=i.item.itemId,r.constructionMethod=n===1||n===2?e.getUint16(u)&15:void 0,u+=i.item.constructionMethod,r.dataReferenceIndex=e.getUint16(u),u+=i.item.dataReferenceIndex,r.baseOffset=Wz(e,u,i.item.baseOffset),u+=i.item.baseOffset,r.extentCount=e.getUint16(u),u+=i.item.extentCount;let c=Vz(r.extentCount,d,u,t,Fz-p);for(let t=0;t<c;t++){let t={};t.extentIndex=Uz(e,n,u,s),u+=i.item.extent.extentIndex,t.extentOffset=Wz(e,u,a),u+=i.item.extent.extentOffset,t.extentLength=Wz(e,u,o),u+=i.item.extent.extentLength,r.extents.push(t)}if(p+=c,l.push(r),(r.extentCount-c)*d>0)break}return l}function Vz(e,t,n,r,i){if(t===0)return 0;let a=Math.floor((r-n)/t);return Math.max(0,Math.min(e,a,i))}function Hz(e,t,n){if(n<2)return e.getUint16(t);if(n===2)return e.getUint32(t)}function Uz(e,t,n,r){if((t===1||t===2)&&r>0)return Wz(e,n,r)}function Wz(e,t,n){return n===4?e.getUint32(t):n===8?(console.warn(`This file uses an 8-bit offset which is currently not supported by ExifReader. Contact the maintainer to get it fixed.`),Nz(e,t)):0}var Gz=1718909296,Kz=1768977008,qz=1835365473,Jz=1768714083,Yz=1768186228,Xz=1768517222,Zz=1768842853,Qz=1768973167,$z=1668246642,eB=1165519206,tB=1835625829,nB=1970432288;function rB(e,t,n=e.byteLength){if(Pz(e,t,8))try{let{length:r,contentOffset:i}=aB(e,t);if(r<8)return;let a=e.getUint32(t+4);if(a===Gz)return CB(e,i,r);if(a===Kz)return wB(e,t,i,r,n);if(a===Qz)return TB(e,t,i,r,n);if(a===$z)return EB(e,i,r);if(a===Yz)return kB(i,r);if(!Pz(e,i,1))return;let o=e.getUint8(i);return a===qz?OB(e,t,i+1,r,n):a===Jz?Iz(e,t,o,i+1,r,n):a===Xz?jB(e,t,o,i+1,r,n):a===Zz?MB(e,t,o,i+1,r):{type:void 0,length:r}}catch{return}}function iB(e,t){if(!e)return!1;try{let n=rB(e,0);return n!==void 0&&t.indexOf(n.majorBrand)!==-1}catch{return!1}}function aB(e,t){let n=e.getUint32(t);if(oB(n))return{length:e.byteLength-t,contentOffset:t+4+4};if(sB(n)){if(!Pz(e,t,16))return{length:0,contentOffset:t+4+4};if(cB(e,t))return{length:e.getUint32(t+12),contentOffset:t+4+4+8}}return{length:n,contentOffset:t+4+4}}function oB(e){return e===0}function sB(e){return e===1}function cB(e,t){return e.getUint32(t+8)===0}function lB(e,t){if(Q.USE_EXIF||Q.USE_XMP||Q.USE_ICC){let n={},r=uB(e);if(!r)return{hasAppMarkers:!1};if(Q.USE_EXIF){let i=dB(e,r,t);i!==void 0&&(n.tiffHeaderOffset=i.tiffHeaderOffset,i.dataView!==void 0&&(n.exifDataView=i.dataView))}if(Q.USE_XMP){let i=bB(e,r,t);i!==void 0&&(n.xmpChunks=i.chunks,i.dataView!==void 0&&(n.xmpDataView=i.dataView))}return Q.USE_ICC&&(n.iccChunks=SB(r,t)),n.hasAppMarkers=n.tiffHeaderOffset!==void 0||n.xmpChunks!==void 0||n.iccChunks!==void 0,n}return{}}function uB(e){let t=0;for(;t+4+4<=e.byteLength;){let n=rB(e,t);if(n===void 0)break;if(n.type===`meta`)return n;t+=n.length}}function dB(e,t,n){try{let r=_B(t).itemId,i=vB(t,r);hB(i);let a=mB(t);if(fB(n,i,`exif`,a),i.extents.length>1){let t=gB(e,i,a);return t===void 0?void 0:{tiffHeaderOffset:yB(t,0),dataView:t}}let o=pB(i,i.extents[0],a);return o===void 0?void 0:{tiffHeaderOffset:yB(e,o)}}catch{return}}function fB(e,t,n,r){if(e)for(let i=0;i<t.extents.length;i++){let a=t.extents[i],o=pB(t,a,r);o!==void 0&&kR(e,n,o,o+a.extentLength)}}function pB(e,t,n){let r=e.constructionMethod;if(r===void 0||r===0)return e.baseOffset+t.extentOffset;if(r===1&&n!==void 0)return n+e.baseOffset+t.extentOffset}function mB(e){let t=e.subBoxes.find(e=>e.type===`idat`);return t?t.contentOffset:void 0}function hB(e){e.constructionMethod===2&&console.warn(`This file uses iloc constructionMethod 2 (item_offset) which is currently not supported by ExifReader. Contact the maintainer to get it fixed.`)}function gB(e,t,n){let r=[],i=0;for(let a=0;a<t.extents.length;a++){let o=t.extents[a],s=pB(t,o,n);if(s===void 0||s+o.extentLength>e.byteLength||(r.push({start:s,length:o.extentLength}),i+=o.extentLength,i>e.byteLength))return}let a=new Uint8Array(i),o=0;for(let t=0;t<r.length;t++){let{start:n,length:i}=r[t];for(let t=0;t<i;t++)a[o+t]=e.getUint8(n+t);o+=i}return new DataView(a.buffer)}function _B(e){return e.subBoxes.find(e=>e.type===`iinf`).itemInfos.find(e=>e.itemType===eB)}function vB(e,t){return e.subBoxes.find(e=>e.type===`iloc`).items.find(e=>e.itemId===t)}function yB(e,t){return t+4+e.getUint32(t)}function bB(e,t,n){try{let r=xB(t).itemId,i=vB(t,r);hB(i);let a=mB(t);if(fB(n,i,`xmp`,a),i.extents.length>1){let t=gB(e,i,a);return t===void 0?void 0:{chunks:[{dataOffset:0,length:t.byteLength}],dataView:t}}let o=i.extents[0],s=pB(i,o,a);return s===void 0?void 0:{chunks:[{dataOffset:s,length:o.extentLength}]}}catch{return}}function xB(e){return e.subBoxes.find(e=>e.type===`iinf`).itemInfos.find(e=>e.itemType===1835625829&&e.contentType===`application/rdf+xml`)}function SB(e,t){try{let n=e.subBoxes.find(e=>e.type===`iprp`).subBoxes.find(e=>e.type===`ipco`).properties.find(e=>e.type===`colr`).icc;if(n)return kR(t,`icc`,n.offset,n.offset+n.length),[n]}catch{}}function CB(e,t,n){return{type:`ftyp`,majorBrand:SR(e,t,4),length:n}}function wB(e,t,n,r,i){return{type:`iprp`,subBoxes:AB(e,n,r-(n-t),i),length:r}}function TB(e,t,n,r,i){return{type:`ipco`,properties:AB(e,n,r-(n-t),i),length:r}}function EB(e,t,n){return{type:`colr`,icc:DB(e,t),length:n}}function DB(e,t){let n=SR(e,t,4);if(n===`prof`||n===`rICC`)return{offset:t+4,length:e.getUint32(t+4),chunkNumber:1,chunksTotal:1}}function OB(e,t,n,r,i){return{type:`meta`,subBoxes:AB(e,n+3,r-(n+3-t),i),length:r}}function kB(e,t){return{type:`idat`,contentOffset:e,length:t}}function AB(e,t,n,r){let i=[eB,tB],a=Math.min(t+n,r),o=[],s=t;for(;s+8<=a;){let t=rB(e,s,a);if(t===void 0)break;t.type!==void 0&&(t.itemType===void 0||i.indexOf(t.itemType)!==-1)&&o.push(t),s+=t.length}return o}function jB(e,t,n,r,i,a){let o=n===0?2:4,s=r+3+o;return{type:`iinf`,itemInfos:AB(e,s,i-(s-t),a),length:i}}function MB(e,t,n,r,i){r+=3;let a={type:`infe`,length:i};return(n===0||n===1)&&(a.itemId=e.getUint16(r),r+=2,a.itemProtectionIndex=e.getUint16(r),r+=2,a.itemName=CR(e,r),r+=a.itemName.length+1),n>=2&&(n===2?(a.itemId=e.getUint16(r),r+=2):n===3&&(a.itemId=e.getUint32(r),r+=4),a.itemProtectionIndex=e.getUint16(r),r+=2,a.itemType=e.getUint32(r),r+=4,a.itemName=CR(e,r),r+=a.itemName.length+1,a.itemType===1835625829?(a.contentType=CR(e,r),r+=a.contentType.length+1,t+i>r&&(a.contentEncoding=CR(e,r),r+=a.contentEncoding.length+1)):a.itemType===nB&&(a.itemUri=CR(e,r),r+=a.itemUri.length+1)),a}var NB={isTiffFile:PB,findTiffOffsets:IB};function PB(e){return!!e&&e.byteLength>=4&&FB(e)}function FB(e){let t=e.getUint16(0)===jz.LITTLE_ENDIAN;return e.getUint16(2,t)===42}function IB(){return Q.USE_EXIF?{hasAppMarkers:!0,tiffHeaderOffset:0}:{}}var LB={isJpegFile:bV,findJpegOffsets:xV},RB=2,zB=65496,BB=2,VB=4,HB=2,UB=2,WB=10,GB=18,KB=33,qB=79,JB=18,YB=8,XB=`ICC_PROFILE\0`,ZB=16,QB=17,$B=255,eV=`MPF\0`,tV=65472,nV=65474,rV=65476,iV=65499,aV=65501,oV=65498,sV=65504,cV=65505,lV=65506,uV=65517,dV=65519,fV=65534,pV=65535,mV=`JFIF`,hV=`Exif`,gV=`http://ns.adobe.com/xap/1.0/\0`,_V=`http://ns.adobe.com/xmp/extension/\0`,vV=`Photoshop 3.0`,yV=`8BIM`;function bV(e){return!!e&&e.byteLength>=RB&&e.getUint16(0)===zB}function xV(e,t){let n=BB,r,i,a,o,s,c,l,u,d,f=0,p,m=!1;for(;n+VB+5<=e.byteLength;){let h;if(e.getUint16(n)===oV&&(m=!0),Q.USE_FILE&&SV(e,n))r=e.getUint16(n+HB),i=n+HB,h=`file`;else if(Q.USE_FILE&&CV(e,n))r=e.getUint16(n+HB),a=n+HB,h=`file`;else if(Q.USE_JFIF&&EV(e,n))r=e.getUint16(n+HB),o=n+UB,h=`jfif`;else if(Q.USE_EXIF&&DV(e,n)){r=e.getUint16(n+HB),f++;let t=n+WB;if(f===1)p={appMarkerPosition:n,fieldLength:r,tiffHeaderOffset:t,score:void 0};else{p.score===void 0&&(p.score=LV(e,p.appMarkerPosition,p.fieldLength,p.tiffHeaderOffset));let i=LV(e,n,r,t);i>p.score&&(p={appMarkerPosition:n,fieldLength:r,tiffHeaderOffset:t,score:i})}s=p.tiffHeaderOffset,h=`exif`}else if(Q.USE_XMP&&OV(e,n))l||=[],r=e.getUint16(n+HB),l.push(MV(n,r)),h=`xmp`;else if(Q.USE_XMP&&AV(e,n))l||=[],r=e.getUint16(n+HB),l.push(NV(n,r)),h=`xmp`;else if(Q.USE_IPTC&&PV(e,n))r=e.getUint16(n+HB),c=n+GB,h=`iptc`;else if(Q.USE_ICC&&wV(e,n)){if(r=e.getUint16(n+HB),u||=[],u.length<$B){let t=n+JB,i=r-16,a=e.getUint8(n+ZB),o=e.getUint8(n+QB);u.push({offset:t,length:i,chunkNumber:a,chunksTotal:o})}h=`icc`}else if(Q.USE_MPF&&TV(e,n))r=e.getUint16(n+HB),d=n+YB,h=`mpf`;else if(FV(e,n))r=e.getUint16(n+HB);else if(IV(e,n)){n++;continue}else break;kR(t,h,n,n+HB+r),n+=HB+r}return f>1&&zV(f),t&&(!m&&n+HB<=e.byteLength&&e.getUint16(n)===oV&&(m=!0),t.truncated=!m),{hasAppMarkers:n>BB,fileDataOffset:i||a,jfifDataOffset:o,tiffHeaderOffset:s,iptcDataOffset:c,xmpChunks:l,iccChunks:u,mpfDataOffset:d}}function SV(e,t){return e.getUint16(t)===tV}function CV(e,t){return e.getUint16(t)===nV}function wV(e,t){return e.getUint16(t)===lV&&t+QB<e.byteLength&&SR(e,t+VB,12)===XB}function TV(e,t){return e.getUint16(t)===lV&&SR(e,t+VB,4)===eV}function EV(e,t){return e.getUint16(t)===sV&&SR(e,t+VB,4)===mV&&e.getUint8(t+VB+4)===0}function DV(e,t){return e.getUint16(t)===cV&&SR(e,t+VB,4)===hV&&e.getUint8(t+VB+4)===0}function OV(e,t){return e.getUint16(t)===cV&&kV(e,t)}function kV(e,t){return SR(e,t+VB,29)===gV}function AV(e,t){return e.getUint16(t)===cV&&jV(e,t)}function jV(e,t){return SR(e,t+VB,35)===_V}function MV(e,t){return{dataOffset:e+KB,length:t-31}}function NV(e,t){return{dataOffset:e+qB,length:t-77}}function PV(e,t){let n=t+VB+13+1;return n+4<=e.byteLength&&e.getUint16(t)===uV&&SR(e,t+VB,13)===vV&&e.getUint8(t+VB+13)===0&&SR(e,n,4)===yV}function FV(e,t){let n=e.getUint16(t);return n>=sV&&n<=dV||n===fV||n===tV||n===nV||n===rV||n===iV||n===aV||n===oV}function IV(e,t){return e.getUint16(t)===pV}function LV(e,t,n,r){let i=RV(e,r,t+HB+n);if(!i)return 0;let a=Number.isInteger(i.ifdEntries)?i.ifdEntries:0;return(i.isValid?1e9:0)+a*1e6+n}function RV(e,t,n){try{if(t+8>n)return;let r=e.getUint16(t+0),i=r===jz.LITTLE_ENDIAN;if(!i&&r!==jz.BIG_ENDIAN||e.getUint16(t+2,i)!==42)return;let a=t+e.getUint32(t+4,i);if(a+2>n)return;let o=e.getUint16(a,i);return{ifdEntries:o,isValid:a+(2+o*12+4)<=n&&o>0}}catch{return}}function zV(e){typeof console>`u`||typeof console.warn!=`function`||console.warn(`ExifReader: Found ${e} Exif segments (APP1). Will pick the best candidate segment.`)}var BV={isPngFile:JV,findPngOffsets:YV},VV=`PNG\r
|
|
89
|
+
|
|
90
|
+
`,HV=4,UV=`XML:com.adobe.xmp\0`,WV=`pHYs`,GV=`tIME`,KV=`eXIf`,qV=`iCCP`;function JV(e){return!!e&&SR(e,0,8)===VV}function YV(e,t,n){let r={hasAppMarkers:!1},i=8,a=!1;for(;i+HV+4<=e.byteLength;){let o,s=e.getUint32(i+0);if(n&&SR(e,i+4,4)===`IEND`&&(a=!0),Q.USE_PNG_FILE&&XV(e,i))r.hasAppMarkers=!0,r.pngHeaderOffset=i+8,o=`file`;else if(Q.USE_XMP&&ZV(e,i)){let t=nH(e,i);t!==void 0&&(r.hasAppMarkers=!0,r.xmpChunks=[{dataOffset:t,length:s-(t-(i+8))}],o=`xmp`)}else if(QV(e,i,t)){r.hasAppMarkers=!0;let t=SR(e,i+4,4);r.pngTextChunks||=[],r.pngTextChunks.push({length:s,type:t,offset:i+8}),o=`png`}else if($V(e,i))r.hasAppMarkers=!0,r.tiffHeaderOffset=i+8,o=`exif`;else if(Q.USE_ICC&&t&&eH(e,i)){let t=i+8,n=rH(e,t);n!==void 0&&(r.hasAppMarkers=!0,r.iccChunks||=[],r.iccChunks.push({offset:n.compressedProfileOffset,length:s-(n.compressedProfileOffset-t),chunkNumber:1,chunksTotal:1,profileName:n.profileName,compressionMethod:n.compressionMethod}),o=`icc`)}else tH(e,i)&&(r.hasAppMarkers=!0,r.pngChunkOffsets||=[],r.pngChunkOffsets.push(i+0),o=`png`);let c=s+HV+4+4;kR(n,o,i,i+c),i+=c}return n&&(n.truncated=!a),r}function XV(e,t){return SR(e,t+4,4)===`IHDR`}function ZV(e,t){return SR(e,t+4,4)===`iTXt`&&SR(e,t+8,18)===UV}function QV(e,t,n){let r=SR(e,t+4,4);return r===`tEXt`||r===`iTXt`||r===`zTXt`&&n}function $V(e,t){return SR(e,t+4,4)===KV}function eH(e,t){return SR(e,t+4,4)===qV}function tH(e,t){let n=[WV,GV],r=SR(e,t+4,4);return n.includes(r)}function nH(e,t){t+=28;let n=0;for(;n<2&&t<e.byteLength;)e.getUint8(t)===0&&n++,t++;if(!(n<2))return t}function rH(e,t){let n=CR(e,t);if(t+=n.length+1,t+1>e.byteLength)return;let r=e.getUint8(t);return t+=1,{profileName:n,compressionMethod:r,compressedProfileOffset:t}}var iH={isHeicFile:oH,findHeicOffsets:sH},aH=[`heic`,`heix`,`hevc`,`hevx`,`heim`,`heis`,`hevm`,`hevs`,`mif1`];function oH(e){return iB(e,aH)}function sH(e,t){return lB(e,t)}var cH={isAvifFile:uH,findAvifOffsets:dH},lH=[`avif`];function uH(e){return iB(e,lH)}function dH(e,t){return lB(e,t)}var fH={isJxlFile:SH,findJxlOffsets:TH},pH=[0,0,0,12,74,88,76,32,13,10,135,10],mH=[255,10],hH=1165519206,gH=2020437024,_H=1651666786,vH=1786276963,yH=1786276976,bH=4,xH=4;function SH(e){try{return CH(e)||wH(e)}catch{return!1}}function CH(e){if(!e||e.byteLength<pH.length)return!1;for(let t=0;t<pH.length;t++)if(e.getUint8(t)!==pH[t])return!1;return!0}function wH(e){return!e||e.byteLength<mH.length?!1:e.getUint8(0)===mH[0]&&e.getUint8(1)===mH[1]}function TH(e,t){let n=0,r,i,a,o,s;if(wH(e))return{hasAppMarkers:!0,tiffHeaderOffset:void 0,xmpChunks:void 0,brobExifChunk:void 0,brobXmpChunk:void 0,jxlCodestreamOffset:0};for(;n+8<=e.byteLength;){let{length:c,contentOffset:l}=aB(e,n);if(c<8)break;let u=e.getUint32(n+4),d;if(Q.USE_EXIF&&u===hH){try{r=yB(e,l)}catch{}d=`exif`}if(Q.USE_XMP&&u===gH&&(i=[{dataOffset:l,length:c-(l-n)}],d=`xmp`),u===vH&&s===void 0&&(s=l),u===yH&&s===void 0&&l+bH<=e.byteLength&&(e.getUint32(l)&2147483647||(s=l+bH)),u===_H&&l+xH<=e.byteLength){let t=e.getUint32(l),s=l+xH,u=c-(s-n);Q.USE_EXIF&&t===hH&&(d=`exif`,r===void 0&&!a&&(a={dataOffset:s,length:u})),Q.USE_XMP&&t===gH&&(d=`xmp`,!i&&!o&&(o={dataOffset:s,length:u}))}kR(t,d,n,n+c),n+=c}return{hasAppMarkers:r!==void 0||i!==void 0||a!==void 0||o!==void 0||s!==void 0,tiffHeaderOffset:r,xmpChunks:i,brobExifChunk:a,brobXmpChunk:o,jxlCodestreamOffset:s}}var EH={isWebpFile:DH,findOffsets:OH};function DH(e){return!!e&&SR(e,0,4)===`RIFF`&&SR(e,8,4)===`WEBP`}function OH(e,t){let n=12,r=!1,i,a,o,s;for(;n+8<e.byteLength;){let c=SR(e,n,4),l=e.getUint32(n+4,!0),u;Q.USE_EXIF&&c===`EXIF`?(r=!0,i=SR(e,n+8,6)===`Exif\0\0`?n+8+6:n+8,u=`exif`):Q.USE_XMP&&c===`XMP `?(r=!0,a=[{dataOffset:n+8,length:l}],u=`xmp`):Q.USE_ICC&&c===`ICCP`?(r=!0,o=[{offset:n+8,length:l,chunkNumber:1,chunksTotal:1}],u=`icc`):c===`VP8X`&&(r=!0,s=n+8,u=`riff`);let d=8+(l%2==0?l:l+1);kR(t,u,n,n+d),n+=d}return{hasAppMarkers:r,tiffHeaderOffset:i,xmpChunks:a,iccChunks:o,vp8xChunkOffset:s}}var kH={isGifFile:NH,findOffsets:PH},AH=6,jH=[`GIF87a`,`GIF89a`],MH=13;function NH(e){return!!e&&jH.includes(SR(e,0,AH))}function PH(e,t){return kR(t,`gif`,0,MH),{gifHeaderOffset:0}}var FH={isXMLFile:zH,findOffsets:BH},IH=0,LH=`<?xpacket begin`,RH=[`<?xpacket end=`,`</x:xmpmeta>`];function zH(e){return!!e&&SR(e,IH,15)===LH}function BH(e,t){let n=[];return n.push({dataOffset:IH,length:e.byteLength}),kR(t,`xmp`,0,e.byteLength),t&&(t.truncated=!VH(e)),{xmpChunks:n}}function VH(e){let t=SR(e,0,e.byteLength);for(let e=0;e<RH.length;e++)if(t.indexOf(RH[e])!==-1)return!0;return!1}var HH={parseAppMarkers:UH};function UH(e,t,n){let r=n?[]:void 0;if(Q.USE_TIFF&&NB.isTiffFile(e))return WH(NB.findTiffOffsets(),`tiff`,`TIFF`,r);if(Q.USE_JPEG&&LB.isJpegFile(e))return WH(LB.findJpegOffsets(e,r),`jpeg`,`JPEG`,r);if(Q.USE_PNG&&BV.isPngFile(e))return WH(BV.findPngOffsets(e,t,r),`png`,`PNG`,r);if(Q.USE_HEIC&&iH.isHeicFile(e))return WH(iH.findHeicOffsets(e,r),`heic`,`HEIC`,r);if(Q.USE_AVIF&&cH.isAvifFile(e))return WH(cH.findAvifOffsets(e,r),`avif`,`AVIF`,r);if(Q.USE_JXL&&fH.isJxlFile(e))return WH(fH.findJxlOffsets(e,r),`jxl`,`JPEG XL`,r);if(Q.USE_WEBP&&EH.isWebpFile(e))return WH(EH.findOffsets(e,r),`webp`,`WebP`,r);if(Q.USE_GIF&&kH.isGifFile(e))return WH(kH.findOffsets(e,r),`gif`,`GIF`,r);if(Q.USE_XMP&&FH.isXMLFile(e))return WH(FH.findOffsets(e,r),`xml`,`XML`,r);throw Error(`Invalid image format`)}function WH(e,t,n,r){let i=jR({},e,{fileType:{value:t,description:n}});return r!==void 0&&(i.metadataBlocks=r,i.metadataTruncated=!!r.truncated),i}var GH={ApertureValue:e=>(Math.sqrt(2)**+(e[0]/e[1])).toFixed(2),ColorSpace(e){return e===1?`sRGB`:e===65535?`Uncalibrated`:`Unknown`},ComponentsConfiguration(e){return e.map(e=>{if(e===49)return`Y`;if(e===50)return`Cb`;if(e===51)return`Cr`;if(e===52)return`R`;if(e===53)return`G`;if(e===54)return`B`}).join(``)},Contrast(e){return e===0?`Normal`:e===1?`Soft`:e===2?`Hard`:`Unknown`},CustomRendered(e){return e===0?`Normal process`:e===1?`Custom process`:`Unknown`},ExposureMode(e){return e===0?`Auto exposure`:e===1?`Manual exposure`:e===2?`Auto bracket`:`Unknown`},ExposureProgram(e){return e===0?`Undefined`:e===1?`Manual`:e===2?`Normal program`:e===3?`Aperture priority`:e===4?`Shutter priority`:e===5?`Creative program`:e===6?`Action program`:e===7?`Portrait mode`:e===8?`Landscape mode`:e===9?`Bulb`:`Unknown`},ExposureTime(e){if(e[0]/e[1]>.25){let t=e[0]/e[1];return Number.isInteger(t)?``+t:t.toFixed(1)}return e[0]===0?`0/${e[1]}`:`1/${Math.round(e[1]/e[0])}`},FNumber:e=>`f/${Number(e[0]/e[1]).toFixed(1)}`,FocalLength:e=>e[0]/e[1]+` mm`,FocalPlaneResolutionUnit(e){return e===2?`inches`:e===3?`centimeters`:e===4?`millimeters`:`Unknown`},LightSource:e=>e===1?`Daylight`:e===2?`Fluorescent`:e===3?`Tungsten (incandescent light)`:e===4?`Flash`:e===9?`Fine weather`:e===10?`Cloudy weather`:e===11?`Shade`:e===12?`Daylight fluorescent (D 5700 – 7100K)`:e===13?`Day white fluorescent (N 4600 – 5400K)`:e===14?`Cool white fluorescent (W 3900 – 4500K)`:e===15?`White fluorescent (WW 3200 – 3700K)`:e===17?`Standard light A`:e===18?`Standard light B`:e===19?`Standard light C`:e===20?`D55`:e===21?`D65`:e===22?`D75`:e===23?`D50`:e===24?`ISO studio tungsten`:e===255?`Other light source`:`Unknown`,MeteringMode(e){return e===1?`Average`:e===2?`CenterWeightedAverage`:e===3?`Spot`:e===4?`MultiSpot`:e===5?`Pattern`:e===6?`Partial`:e===255?`Other`:`Unknown`},ResolutionUnit(e){return e===2?`inches`:e===3?`centimeters`:`Unknown`},Saturation(e){return e===0?`Normal`:e===1?`Low saturation`:e===2?`High saturation`:`Unknown`},FocalLengthIn35mmFilm(e){return e===0?`Unknown`:e+` mm`},SceneCaptureType(e){return e===0?`Standard`:e===1?`Landscape`:e===2?`Portrait`:e===3?`Night scene`:`Unknown`},Sharpness(e){return e===0?`Normal`:e===1?`Soft`:e===2?`Hard`:`Unknown`},ShutterSpeedValue(e){let t=2**(e[0]/e[1]);return t<=1?`${Math.round(1/t)}`:`1/${Math.round(t)}`},WhiteBalance(e){return e===0?`Auto white balance`:e===1?`Manual white balance`:`Unknown`},XResolution:e=>``+Math.round(e[0]/e[1]),YResolution:e=>``+Math.round(e[0]/e[1])},KH={11:`ProcessingSoftware`,254:{name:`SubfileType`,description:e=>({0:`Full-resolution image`,1:`Reduced-resolution image`,2:`Single page of multi-page image`,3:`Single page of multi-page reduced-resolution image`,4:`Transparency mask`,5:`Transparency mask of reduced-resolution image`,6:`Transparency mask of multi-page image`,7:`Transparency mask of reduced-resolution multi-page image`,65537:`Alternate reduced-resolution image`,4294967295:`Invalid`})[e]||`Unknown`},255:{name:`OldSubfileType`,description:e=>({0:`Full-resolution image`,1:`Reduced-resolution image`,2:`Single page of multi-page image`})[e]||`Unknown`},256:`ImageWidth`,257:`ImageLength`,258:`BitsPerSample`,259:`Compression`,262:`PhotometricInterpretation`,263:{name:`Thresholding`,description:e=>({1:`No dithering or halftoning`,2:`Ordered dither or halfton`,3:`Randomized dither`})[e]||`Unknown`},264:`CellWidth`,265:`CellLength`,266:{name:`FillOrder`,description:e=>({1:`Normal`,2:`Reversed`})[e]||`Unknown`},269:`DocumentName`,270:`ImageDescription`,271:`Make`,272:`Model`,273:`StripOffsets`,274:{name:`Orientation`,description:e=>e===1?`top-left`:e===2?`top-right`:e===3?`bottom-right`:e===4?`bottom-left`:e===5?`left-top`:e===6?`right-top`:e===7?`right-bottom`:e===8?`left-bottom`:`Undefined`},277:`SamplesPerPixel`,278:`RowsPerStrip`,279:`StripByteCounts`,280:`MinSampleValue`,281:`MaxSampleValue`,282:{name:`XResolution`,description:GH.XResolution},283:{name:`YResolution`,description:GH.YResolution},284:`PlanarConfiguration`,285:`PageName`,286:{name:`XPosition`,description:e=>``+Math.round(e[0]/e[1])},287:{name:`YPosition`,description:e=>``+Math.round(e[0]/e[1])},290:{name:`GrayResponseUnit`,description:e=>({1:`0.1`,2:`0.001`,3:`0.0001`,4:`1e-05`,5:`1e-06`})[e]||`Unknown`},296:{name:`ResolutionUnit`,description:GH.ResolutionUnit},297:`PageNumber`,301:`TransferFunction`,305:`Software`,306:`DateTime`,315:`Artist`,316:`HostComputer`,317:`Predictor`,318:{name:`WhitePoint`,description:e=>e.map(e=>`${e[0]}/${e[1]}`).join(`, `)},319:{name:`PrimaryChromaticities`,description:e=>e.map(e=>`${e[0]}/${e[1]}`).join(`, `)},321:`HalftoneHints`,322:`TileWidth`,323:`TileLength`,330:`A100DataOffset`,332:{name:`InkSet`,description:e=>({1:`CMYK`,2:`Not CMYK`})[e]||`Unknown`},337:`TargetPrinter`,338:{name:`ExtraSamples`,description:e=>({0:`Unspecified`,1:`Associated Alpha`,2:`Unassociated Alpha`})[e]||`Unknown`},339:{name:`SampleFormat`,description:e=>{let t={1:`Unsigned`,2:`Signed`,3:`Float`,4:`Undefined`,5:`Complex int`,6:`Complex float`};return Array.isArray(e)?e.map(e=>t[e]||`Unknown`).join(`, `):`Unknown`}},513:`JPEGInterchangeFormat`,514:`JPEGInterchangeFormatLength`,529:{name:`YCbCrCoefficients`,description:e=>e.map(e=>``+e[0]/e[1]).join(`/`)},530:`YCbCrSubSampling`,531:{name:`YCbCrPositioning`,description:e=>e===1?`centered`:e===2?`co-sited`:`undefined `+e},532:{name:`ReferenceBlackWhite`,description:e=>e.map(e=>``+e[0]/e[1]).join(`, `)},700:`ApplicationNotes`,18246:`Rating`,18249:`RatingPercent`,33432:{name:`Copyright`,description:e=>e.join(`; `)},33550:`PixelScale`,33723:`IPTC-NAA`,33920:`IntergraphMatrix`,33922:`ModelTiePoint`,34118:`SEMInfo`,34264:`ModelTransform`,34377:`PhotoshopSettings`,34665:`Exif IFD Pointer`,34675:`ICC_Profile`,34735:`GeoTiffDirectory`,34736:`GeoTiffDoubleParams`,34737:`GeoTiffAsciiParams`,34853:`GPS Info IFD Pointer`,40091:{name:`XPTitle`,description:qH},40092:{name:`XPComment`,description:qH},40093:{name:`XPAuthor`,description:qH},40094:{name:`XPKeywords`,description:qH},40095:{name:`XPSubject`,description:qH},42112:`GDALMetadata`,42113:`GDALNoData`,50341:`PrintIM`,50707:`DNGBackwardVersion`,50708:`UniqueCameraModel`,50709:`LocalizedCameraModel`,50721:`ColorMatrix1`,50722:`ColorMatrix2`,50723:`CameraCalibration1`,50724:`CameraCalibration2`,50725:`ReductionMatrix1`,50726:`ReductionMatrix2`,50727:`AnalogBalance`,50728:`AsShotNeutral`,50729:`AsShotWhiteXY`,50730:`BaselineExposure`,50731:`BaselineNoise`,50732:`BaselineSharpness`,50734:`LinearResponseLimit`,50735:`CameraSerialNumber`,50736:`DNGLensInfo`,50739:`ShadowScale`,50741:{name:`MakerNoteSafety`,description:e=>({0:`Unsafe`,1:`Safe`})[e]||`Unknown`},50778:{name:`CalibrationIlluminant1`,description:GH.LightSource},50779:{name:`CalibrationIlluminant2`,description:GH.LightSource},50781:`RawDataUniqueID`,50827:`OriginalRawFileName`,50828:`OriginalRawFileData`,50831:`AsShotICCProfile`,50832:`AsShotPreProfileMatrix`,50833:`CurrentICCProfile`,50834:`CurrentPreProfileMatrix`,50879:`ColorimetricReference`,50885:`SRawType`,50898:`PanasonicTitle`,50899:`PanasonicTitle2`,50931:`CameraCalibrationSig`,50932:`ProfileCalibrationSig`,50933:`ProfileIFD`,50934:`AsShotProfileName`,50936:`ProfileName`,50937:`ProfileHueSatMapDims`,50938:`ProfileHueSatMapData1`,50939:`ProfileHueSatMapData2`,50940:`ProfileToneCurve`,50941:{name:`ProfileEmbedPolicy`,description:e=>({0:`Allow Copying`,1:`Embed if Used`,2:`Never Embed`,3:`No Restrictions`})[e]||`Unknown`},50942:`ProfileCopyright`,50964:`ForwardMatrix1`,50965:`ForwardMatrix2`,50966:`PreviewApplicationName`,50967:`PreviewApplicationVersion`,50968:`PreviewSettingsName`,50969:`PreviewSettingsDigest`,50970:{name:`PreviewColorSpace`,description:e=>({1:`Gray Gamma 2.2`,2:`sRGB`,3:`Adobe RGB`,4:`ProPhoto RGB`})[e]||`Unknown`},50971:`PreviewDateTime`,50972:`RawImageDigest`,50973:`OriginalRawFileDigest`,50981:`ProfileLookTableDims`,50982:`ProfileLookTableData`,51043:`TimeCodes`,51044:`FrameRate`,51058:`TStop`,51081:`ReelName`,51089:`OriginalDefaultFinalSize`,51090:`OriginalBestQualitySize`,51091:`OriginalDefaultCropSize`,51105:`CameraLabel`,51107:{name:`ProfileHueSatMapEncoding`,description:e=>({0:`Linear`,1:`sRGB`})[e]||`Unknown`},51108:{name:`ProfileLookTableEncoding`,description:e=>({0:`Linear`,1:`sRGB`})[e]||`Unknown`},51109:`BaselineExposureOffset`,51110:{name:`DefaultBlackRender`,description:e=>({0:`Auto`,1:`None`})[e]||`Unknown`},51111:`NewRawImageDigest`,51112:`RawToPreviewGain`};function qH(e){return new TextDecoder(`utf-16`).decode(new Uint8Array(e)).replace(/\u0000+$/,``)}var JH={33434:{name:`ExposureTime`,description:GH.ExposureTime},33437:{name:`FNumber`,description:GH.FNumber},34850:{name:`ExposureProgram`,description:GH.ExposureProgram},34852:`SpectralSensitivity`,34855:`ISOSpeedRatings`,34856:{name:`OECF`,description:()=>`[Raw OECF table data]`},34858:`TimeZoneOffset`,34859:`SelfTimerMode`,34864:{name:`SensitivityType`,description:e=>({1:`Standard Output Sensitivity`,2:`Recommended Exposure Index`,3:`ISO Speed`,4:`Standard Output Sensitivity and Recommended Exposure Index`,5:`Standard Output Sensitivity and ISO Speed`,6:`Recommended Exposure Index and ISO Speed`,7:`Standard Output Sensitivity, Recommended Exposure Index and ISO Speed`})[e]||`Unknown`},34865:`StandardOutputSensitivity`,34866:`RecommendedExposureIndex`,34867:`ISOSpeed`,34868:`ISOSpeedLatitudeyyy`,34869:`ISOSpeedLatitudezzz`,36864:{name:`ExifVersion`,description:e=>ER(e)},36867:`DateTimeOriginal`,36868:`DateTimeDigitized`,36873:`GooglePlusUploadCode`,36880:`OffsetTime`,36881:`OffsetTimeOriginal`,36882:`OffsetTimeDigitized`,37121:{name:`ComponentsConfiguration`,description:GH.ComponentsConfiguration},37122:`CompressedBitsPerPixel`,37377:{name:`ShutterSpeedValue`,description:GH.ShutterSpeedValue},37378:{name:`ApertureValue`,description:GH.ApertureValue},37379:`BrightnessValue`,37380:`ExposureBiasValue`,37381:{name:`MaxApertureValue`,description:e=>(Math.sqrt(2)**+(e[0]/e[1])).toFixed(2)},37382:{name:`SubjectDistance`,description:e=>e[0]/e[1]+` m`},37383:{name:`MeteringMode`,description:GH.MeteringMode},37384:{name:`LightSource`,description:GH.LightSource},37385:{name:`Flash`,description:e=>e===0?`Flash did not fire`:e===1?`Flash fired`:e===5?`Strobe return light not detected`:e===7?`Strobe return light detected`:e===9?`Flash fired, compulsory flash mode`:e===13?`Flash fired, compulsory flash mode, return light not detected`:e===15?`Flash fired, compulsory flash mode, return light detected`:e===16?`Flash did not fire, compulsory flash mode`:e===24?`Flash did not fire, auto mode`:e===25?`Flash fired, auto mode`:e===29?`Flash fired, auto mode, return light not detected`:e===31?`Flash fired, auto mode, return light detected`:e===32?`No flash function`:e===65?`Flash fired, red-eye reduction mode`:e===69?`Flash fired, red-eye reduction mode, return light not detected`:e===71?`Flash fired, red-eye reduction mode, return light detected`:e===73?`Flash fired, compulsory flash mode, red-eye reduction mode`:e===77?`Flash fired, compulsory flash mode, red-eye reduction mode, return light not detected`:e===79?`Flash fired, compulsory flash mode, red-eye reduction mode, return light detected`:e===89?`Flash fired, auto mode, red-eye reduction mode`:e===93?`Flash fired, auto mode, return light not detected, red-eye reduction mode`:e===95?`Flash fired, auto mode, return light detected, red-eye reduction mode`:`Unknown`},37386:{name:`FocalLength`,description:GH.FocalLength},37393:`ImageNumber`,37394:{name:`SecurityClassification`,description:e=>({C:`Confidential`,R:`Restricted`,S:`Secret`,T:`Top Secret`,U:`Unclassified`})[e]||`Unknown`},37395:`ImageHistory`,37396:{name:`SubjectArea`,description:e=>e.length===2?`Location; X: ${e[0]}, Y: ${e[1]}`:e.length===3?`Circle; X: ${e[0]}, Y: ${e[1]}, diameter: ${e[2]}`:e.length===4?`Rectangle; X: ${e[0]}, Y: ${e[1]}, width: ${e[2]}, height: ${e[3]}`:`Unknown`},37500:{name:`MakerNote`,description:()=>`[Raw maker note data]`},37510:{name:`UserComment`,description:Dz},37520:`SubSecTime`,37521:`SubSecTimeOriginal`,37522:`SubSecTimeDigitized`,37724:`ImageSourceData`,37888:{name:`AmbientTemperature`,description:e=>e[0]/e[1]+` °C`},37889:{name:`Humidity`,description:e=>e[0]/e[1]+` %`},37890:{name:`Pressure`,description:e=>e[0]/e[1]+` hPa`},37891:{name:`WaterDepth`,description:e=>e[0]/e[1]+` m`},37892:{name:`Acceleration`,description:e=>e[0]/e[1]+` mGal`},37893:{name:`CameraElevationAngle`,description:e=>e[0]/e[1]+` °`},40960:{name:`FlashpixVersion`,description:e=>e.map(e=>String.fromCharCode(e)).join(``)},40961:{name:`ColorSpace`,description:GH.ColorSpace},40962:`PixelXDimension`,40963:`PixelYDimension`,40964:`RelatedSoundFile`,40965:`Interoperability IFD Pointer`,41483:`FlashEnergy`,41484:{name:`SpatialFrequencyResponse`,description:()=>`[Raw SFR table data]`},41486:`FocalPlaneXResolution`,41487:`FocalPlaneYResolution`,41488:{name:`FocalPlaneResolutionUnit`,description:GH.FocalPlaneResolutionUnit},41492:{name:`SubjectLocation`,description:([e,t])=>`X: ${e}, Y: ${t}`},41493:`ExposureIndex`,41495:{name:`SensingMethod`,description:e=>e===1?`Undefined`:e===2?`One-chip color area sensor`:e===3?`Two-chip color area sensor`:e===4?`Three-chip color area sensor`:e===5?`Color sequential area sensor`:e===7?`Trilinear sensor`:e===8?`Color sequential linear sensor`:`Unknown`},41728:{name:`FileSource`,description:e=>e===3?`DSC`:`Unknown`},41729:{name:`SceneType`,description:e=>e===1?`A directly photographed image`:`Unknown`},41730:{name:`CFAPattern`,description:()=>`[Raw CFA pattern table data]`},41985:{name:`CustomRendered`,description:GH.CustomRendered},41986:{name:`ExposureMode`,description:GH.ExposureMode},41987:{name:`WhiteBalance`,description:GH.WhiteBalance},41988:{name:`DigitalZoomRatio`,description:e=>e[0]===0?`Digital zoom was not used`:``+e[0]/e[1]},41989:{name:`FocalLengthIn35mmFilm`,description:GH.FocalLengthIn35mmFilm},41990:{name:`SceneCaptureType`,description:GH.SceneCaptureType},41991:{name:`GainControl`,description:e=>e===0?`None`:e===1?`Low gain up`:e===2?`High gain up`:e===3?`Low gain down`:e===4?`High gain down`:`Unknown`},41992:{name:`Contrast`,description:GH.Contrast},41993:{name:`Saturation`,description:GH.Saturation},41994:{name:`Sharpness`,description:GH.Sharpness},41995:{name:`DeviceSettingDescription`,description:()=>`[Raw device settings table data]`},41996:{name:`SubjectDistanceRange`,description:e=>e===1?`Macro`:e===2?`Close view`:e===3?`Distant view`:`Unknown`},42016:`ImageUniqueID`,42032:`CameraOwnerName`,42033:`BodySerialNumber`,42034:{name:`LensSpecification`,description:e=>{let t=`${parseFloat((e[0][0]/e[0][1]).toFixed(5))}-${parseFloat((e[1][0]/e[1][1]).toFixed(5))} mm`;if(e[3][1]===0)return`${t} f/?`;let n=1/(e[2][1]/e[2][1]/(e[3][0]/e[3][1]));return`${t} f/${parseFloat(n.toFixed(5))}`}},42035:`LensMake`,42036:`LensModel`,42037:`LensSerialNumber`,42080:{name:`CompositeImage`,description:e=>({1:`Not a Composite Image`,2:`General Composite Image`,3:`Composite Image Captured While Shooting`})[e]||`Unknown`},42081:`SourceImageNumberOfCompositeImage`,42082:`SourceExposureTimesOfCompositeImage`,42240:`Gamma`,59932:`Padding`,59933:`OffsetSchema`,65e3:`OwnerName`,65001:`SerialNumber`,65002:`Lens`,65100:`RawFile`,65101:`Converter`,65102:`WhiteBalance`,65105:`Exposure`,65106:`Shadows`,65107:`Brightness`,65108:`Contrast`,65109:`Saturation`,65110:`Sharpness`,65111:`Smoothness`,65112:`MoireFilter`},YH={0:{name:`GPSVersionID`,description:e=>e[0]===2&&e[1]===2&&e[2]===0&&e[3]===0?`Version 2.2`:`Unknown`},1:{name:`GPSLatitudeRef`,description:e=>{let t=e.join(``);return t===`N`?`North latitude`:t===`S`?`South latitude`:`Unknown`}},2:{name:`GPSLatitude`,description:Oz},3:{name:`GPSLongitudeRef`,description:e=>{let t=e.join(``);return t===`E`?`East longitude`:t===`W`?`West longitude`:`Unknown`}},4:{name:`GPSLongitude`,description:Oz},5:{name:`GPSAltitudeRef`,description:e=>e===0?`Sea level`:e===1?`Sea level reference (negative value)`:`Unknown`},6:{name:`GPSAltitude`,description:e=>e[0]/e[1]+` m`},7:{name:`GPSTimeStamp`,description:e=>e.map(([e,t])=>{let n=e/t;return/^\d(\.|$)/.test(`${n}`)?`0${n}`:n}).join(`:`)},8:`GPSSatellites`,9:{name:`GPSStatus`,description:e=>{let t=e.join(``);return t===`A`?`Measurement in progress`:t===`V`?`Measurement Interoperability`:`Unknown`}},10:{name:`GPSMeasureMode`,description:e=>{let t=e.join(``);return t===`2`?`2-dimensional measurement`:t===`3`?`3-dimensional measurement`:`Unknown`}},11:`GPSDOP`,12:{name:`GPSSpeedRef`,description:e=>{let t=e.join(``);return t===`K`?`Kilometers per hour`:t===`M`?`Miles per hour`:t===`N`?`Knots`:`Unknown`}},13:`GPSSpeed`,14:{name:`GPSTrackRef`,description:e=>{let t=e.join(``);return t===`T`?`True direction`:t===`M`?`Magnetic direction`:`Unknown`}},15:`GPSTrack`,16:{name:`GPSImgDirectionRef`,description:e=>{let t=e.join(``);return t===`T`?`True direction`:t===`M`?`Magnetic direction`:`Unknown`}},17:`GPSImgDirection`,18:`GPSMapDatum`,19:{name:`GPSDestLatitudeRef`,description:e=>{let t=e.join(``);return t===`N`?`North latitude`:t===`S`?`South latitude`:`Unknown`}},20:{name:`GPSDestLatitude`,description:e=>e[0][0]/e[0][1]+e[1][0]/e[1][1]/60+e[2][0]/e[2][1]/3600},21:{name:`GPSDestLongitudeRef`,description:e=>{let t=e.join(``);return t===`E`?`East longitude`:t===`W`?`West longitude`:`Unknown`}},22:{name:`GPSDestLongitude`,description:e=>e[0][0]/e[0][1]+e[1][0]/e[1][1]/60+e[2][0]/e[2][1]/3600},23:{name:`GPSDestBearingRef`,description:e=>{let t=e.join(``);return t===`T`?`True direction`:t===`M`?`Magnetic direction`:`Unknown`}},24:`GPSDestBearing`,25:{name:`GPSDestDistanceRef`,description:e=>{let t=e.join(``);return t===`K`?`Kilometers`:t===`M`?`Miles`:t===`N`?`Knots`:`Unknown`}},26:`GPSDestDistance`,27:{name:`GPSProcessingMethod`,description:Dz},28:{name:`GPSAreaInformation`,description:Dz},29:`GPSDateStamp`,30:{name:`GPSDifferential`,description:e=>e===0?`Measurement without differential correction`:e===1?`Differential correction applied`:`Unknown`},31:`GPSHPositioningError`},XH={1:`InteroperabilityIndex`,2:{name:`InteroperabilityVersion`,description:e=>ER(e)},4096:`RelatedImageFileFormat`,4097:`RelatedImageWidth`,4098:`RelatedImageHeight`},ZH={45056:{name:`MPFVersion`,description:e=>ER(e)},45057:`NumberOfImages`,45058:`MPEntry`,45059:`ImageUIDList`,45060:`TotalFrames`},QH={1:{name:`CameraSettings`,description:e=>e},4:{name:`ShotInfo`,description:e=>e},149:`LensModel`},$H={0:{name:`PentaxVersion`,description:e=>e.join(`.`)},5:`PentaxModelID`,555:`LevelInfo`},eU=Q.USE_EXIF?jR({},KH,JH):{},tU=`exif`,nU=`interoperability`,rU=`canon`,iU=`pentax`,aU={"0th":eU,"1st":Q.USE_EXIF?KH:{},[tU]:eU,gps:Q.USE_EXIF?YH:{},[nU]:Q.USE_EXIF?XH:{},mpf:Q.USE_MPF?ZH:{},[rU]:Q.USE_MAKER_NOTES?QH:{},[iU]:Q.USE_MAKER_NOTES?$H:{}},oU={1:1,2:1,3:2,4:4,5:8,7:1,9:4,10:8,13:4},sU={BYTE:1,ASCII:2,SHORT:3,LONG:4,RATIONAL:5,UNDEFINED:7,SLONG:9,SRATIONAL:10,IFD:13},$={getAsciiValue:cU,getByteAt:lU,getAsciiAt:uU,getShortAt:dU,getLongAt:fU,getRationalAt:pU,getUndefinedAt:mU,getSlongAt:hU,getSrationalAt:gU,getIfdPointerAt:_U,typeSizes:oU,tagTypes:sU,getTypeSize:vU};function cU(e){return e.map(e=>String.fromCharCode(e))}function lU(e,t){return e.getUint8(t)}function uU(e,t){return e.getUint8(t)}function dU(e,t,n){return e.getUint16(t,n===jz.LITTLE_ENDIAN)}function fU(e,t,n){return e.getUint32(t,n===jz.LITTLE_ENDIAN)}function pU(e,t,n){return[fU(e,t,n),fU(e,t+4,n)]}function mU(e,t){return lU(e,t)}function hU(e,t,n){return e.getInt32(t,n===jz.LITTLE_ENDIAN)}function gU(e,t,n){return[hU(e,t,n),hU(e,t+4,n)]}function _U(e,t,n){return fU(e,t,n)}function vU(e){if(sU[e]===void 0)throw Error(`No such type found.`);return oU[sU[e]]}var yU={exif:!0,iptc:!0,photoshop:!0,mpf:!0,makerNotes:!0},bU={exif:!0,iptc:!0,xmp:!0,icc:!0,photoshop:!0,makerNotes:!0,mpf:!0,file:!0,jfif:!0,png:!0,riff:!0,gif:!0,gps:!0,composite:!0,thumbnail:!0},xU={exifIfdPointer:`Exif IFD Pointer`,gpsInfoIfdPointer:`GPS Info IFD Pointer`,interoperabilityIfdPointer:`Interoperability IFD Pointer`},SU={thumbnail:[`JPEGInterchangeFormat`,`JPEGInterchangeFormatLength`],iptc:[`IPTC-NAA`],xmp:[`ApplicationNotes`],icc:[`ICC_Profile`],photoshop:[`ImageSourceData`,`PhotoshopSettings`],makerNotes:[`MakerNote`,`Make`],gps:[`GPSLatitude`,`GPSLatitudeRef`,`GPSLongitude`,`GPSLongitudeRef`,`GPSAltitude`,`GPSAltitudeRef`]},CU={file:[`Image Width`,`Image Height`],exif:[`FocalLength`,`FocalPlaneXResolution`,`FocalPlaneYResolution`,`FocalPlaneResolutionUnit`,`FocalLengthIn35mmFilm`]};function wU(e){let t=Object.create(null);if(!e)return t;Array.isArray(e.exif)&&e.exif.length>0&&(t[xU.exifIfdPointer]=!0,n(t,e.exif));for(let n in SU)if(TU(e[n])){let e=SU[n];for(let n=0;n<e.length;n++)t[e[n]]=!0;t[xU.exifIfdPointer]=!0}return TU(e.gps)&&(t[xU.gpsInfoIfdPointer]=!0,t[xU.exifIfdPointer]=!0),t;function n(e,t){for(let n=0;n<t.length;n++){let r=t[n];if(typeof r!=`string`)continue;let i=r.toLowerCase();i.indexOf(`gps`)===0&&(e[xU.gpsInfoIfdPointer]=!0),(i.indexOf(`interoperability`)===0||i.indexOf(`relatedimage`)===0)&&(e[xU.interoperabilityIfdPointer]=!0)}}}function TU(e){return e===!0||Array.isArray(e)&&e.length>0}function EU({includeTags:e,excludeTags:t}={}){let n=!!e,r=!!t,i=n||r,a=Object.create(null),o=Object.create(null),s=Object.create(null);if(!i)return DU();let c=n&&(MU(e,`iptc`)||MU(e,`xmp`)||MU(e,`icc`)||MU(e,`photoshop`)||MU(e,`makerNotes`)||MU(e,`thumbnail`)||MU(e,`gps`)||MU(e,`composite`)),l=n&&MU(e,`composite`),u=Object.create(null);n&&(u=kU(e));let d=Object.create(null);n&&l&&(d=RU(CU.file));for(let i in bU){let f=n&&Object.prototype.hasOwnProperty.call(e,i),p=r&&Object.prototype.hasOwnProperty.call(t,i),m;p&&!f&&(m=t[i]);let h=PU({groupKey:i,includeValue:f?e[i]:void 0,excludeValue:m,extraIncludeNames:Object.create(null)});a[i]=!n||f,f&&NU(e[i])&&(a[i]=!1),h.excludeAll&&(a[i]=!1),o[i]=h,s[i]=PU({groupKey:i,includeValue:AU({groupKey:i,hasIncludeTags:n,hasIncludeEntry:f,includeTags:e,shouldParseExif:c,shouldParseFile:l}),excludeValue:m,extraIncludeNames:jU({groupKey:i,hasIncludeTags:n,hasIncludeEntry:f,shouldParseExif:c,shouldParseFile:l,exifIncludeDependencies:u,fileIncludeDependencies:d})})}return{isActive:i,shouldReturnGroup:f,shouldParseGroup:p,shouldReturnTag:m,shouldParseTag:h};function f(e){return!bU[e]||!!a[e]}function p(e){return!bU[e]||f(e)?!0:e===`exif`?c:e===`file`&&l}function m(e,t,n){return bU[e]?f(e)?FU(o[e],t,n):!1:!0}function h(e,t,n){return bU[e]?p(e)?FU(s[e],t,n):!1:!0}}function DU(){return{isActive:!1,shouldReturnGroup:e,shouldParseGroup:e,shouldReturnTag:e,shouldParseTag:e};function e(){return!0}}var OU=DU();function kU(e){let t=wU(e);return MU(e,`composite`)&&zU(t,CU.exif),t}function AU({groupKey:e,hasIncludeTags:t,hasIncludeEntry:n,includeTags:r,shouldParseExif:i,shouldParseFile:a}){if(!t)return!0;if(n)return e===`thumbnail`&&Array.isArray(r[e])?!0:r[e];if(e===`exif`&&i||e===`file`&&a)return[]}function jU({groupKey:e,hasIncludeTags:t,hasIncludeEntry:n,shouldParseExif:r,shouldParseFile:i,exifIncludeDependencies:a,fileIncludeDependencies:o}){return t?e===`exif`&&(r||n&&Object.keys(a).length>0)?a:e===`file`&&i?o:Object.create(null):Object.create(null)}function MU(e,t){if(!e||!Object.prototype.hasOwnProperty.call(e,t))return!1;let n=e[t];return n===!0||Array.isArray(n)&&n.length>0}function NU(e){return Array.isArray(e)&&e.length===0}function PU({groupKey:e,includeValue:t,excludeValue:n,extraIncludeNames:r}){let i=!!yU[e],a={includeAll:!1,includeNames:void 0,includeIds:void 0,excludeAll:!1,excludeNames:void 0,excludeIds:void 0};if(t===!0)a.includeAll=!0;else if(Array.isArray(t)){a.includeNames=Object.create(null),i&&(a.includeIds=Object.create(null));for(let e=0;e<t.length;e++)o(a,t[e]);for(let e in r)a.includeNames[e.toLowerCase()]=!0}else if(r&&Object.keys(r).length>0){a.includeNames=Object.create(null);for(let e in r)a.includeNames[e.toLowerCase()]=!0}if(n===!0)return a.excludeAll=!0,a;if(Array.isArray(n)){a.excludeNames=Object.create(null),i&&(a.excludeIds=Object.create(null));for(let e=0;e<n.length;e++)s(a,n[e])}return a;function o(e,t){if(typeof t==`number`&&e.includeIds){e.includeIds[String(t)]=!0;return}typeof t==`string`&&(e.includeNames[t.toLowerCase()]=!0)}function s(e,t){if(typeof t==`number`&&e.excludeIds){e.excludeIds[String(t)]=!0;return}typeof t==`string`&&(e.excludeNames[t.toLowerCase()]=!0)}}function FU(e,t,n){return e.excludeAll?!1:e.includeAll||!e.includeNames&&!e.includeIds||IU(e,t,n)?!LU(e,t,n):!1}function IU(e,t,n){return!!(n!==void 0&&e.includeIds&&e.includeIds[String(n)]||t&&e.includeNames&&e.includeNames[String(t).toLowerCase()])}function LU(e,t,n){return!!(n!==void 0&&e.excludeIds&&e.excludeIds[String(n)]||t&&e.excludeNames&&e.excludeNames[String(t).toLowerCase()])}function RU(e){let t=Object.create(null);for(let n=0;n<e.length;n++)t[e[n].toLowerCase()]=!0;return t}function zU(e,t){for(let n=0;n<t.length;n++)e[t[n]]=!0}var BU=4,VU={1:$.getByteAt,2:$.getAsciiAt,3:$.getShortAt,4:$.getLongAt,5:$.getRationalAt,7:$.getUndefinedAt,9:$.getSlongAt,10:$.getSrationalAt,13:$.getIfdPointerAt};function HU(e,t,n){let r=t+4;if(!(r+$.getTypeSize(`LONG`)>e.byteLength))return t+$.getLongAt(e,r,n)}function UU(e,t,n,r,i,a,o=!1,s=OU,c=`exif`,l=WU(e)){let u=$.getTypeSize(`SHORT`),d={},f=GU(e,r,i);r+=u;for(let u=0;u<f&&!(r+12>e.byteLength);u++){let u=KU(e,t,n,r,i,a,s,c,l);u!==void 0&&(d[u.name]={id:u.id,value:u.value,description:u.description},o&&(d[u.name].computed=tW(u.tagType,u.value)),(u.name===`MakerNote`||t===`pentax`&&u.name===`LevelInfo`)&&(d[u.name].__offset=u.__offset)),r+=12}if(Q.USE_THUMBNAIL&&r<e.byteLength-$.getTypeSize(`LONG`)){let c=$.getLongAt(e,r,i);c!==0&&t===`0th`&&s.shouldParseGroup(`thumbnail`)&&(d.Thumbnail=UU(e,`1st`,n,n+c,i,a,o,s,`thumbnail`,l))}return d}function WU(e){return{remaining:e.byteLength*BU}}function GU(e,t,n){return t+$.getTypeSize(`SHORT`)<=e.byteLength?$.getShortAt(e,t,n):0}function KU(e,t,n,r,i,a=!1,o=OU,s=`exif`,c){let l=$.getTypeSize(`SHORT`),u=l+$.getTypeSize(`SHORT`),d=u+$.getTypeSize(`LONG`),f=$.getShortAt(e,r,i),p=$.getShortAt(e,r+l,i),m=$.getLongAt(e,r+u,i),h,g;if($.typeSizes[p]===void 0||!a&&aU[t][f]===void 0)return;let _=qU(t,f);if(!o.shouldParseTag(s,_,f))return;if(JU(p,m))g=r+d,h=YU(e,g,p,m,i);else if(g=$.getLongAt(e,r+d,i),XU(e,n,g,p,m)){let t=f===33723,r=ZU(c.remaining,p,m);c.remaining-=r*$.typeSizes[p],h=YU(e,n+g,p,r,i,t)}else h=`<faulty value>`;p===$.tagTypes.ASCII&&(h=QU(h),h=$U(h));let v=h;if(aU[t][f]!==void 0){if(aU[t][f].name!==void 0&&aU[t][f].description!==void 0)try{v=aU[t][f].description(h)}catch{v=eW(h)}else v=p===$.tagTypes.RATIONAL||p===$.tagTypes.SRATIONAL?``+h[0]/h[1]:eW(h)}return{id:f,name:_,value:h,description:v,tagType:p,__offset:g}}function qU(e,t){if(aU[e][t]!==void 0){if(typeof aU[e][t]==`string`)return aU[e][t];if(aU[e][t].name)return aU[e][t].name}return`undefined-${t}`}function JU(e,t){return $.typeSizes[e]*t<=$.getTypeSize(`LONG`)}function YU(e,t,n,r,i,a=!1){let o=[];a&&(r*=$.typeSizes[n],n=$.tagTypes.BYTE);for(let a=0;a<r;a++)o.push(VU[n](e,t,i)),t+=$.typeSizes[n];return n===$.tagTypes.ASCII?o=$.getAsciiValue(o):o.length===1&&(o=o[0]),o}function XU(e,t,n,r,i){return t+n+$.typeSizes[r]*i<=e.byteLength}function ZU(e,t,n){let r=Math.min(n,Math.floor(e/$.typeSizes[t]));return r===1&&n>1?0:r}function QU(e){let t=[],n=0;for(let r=0;r<e.length;r++){if(e[r]===`\0`){n++;continue}t[n]===void 0&&(t[n]=``),t[n]+=e[r]}return t}function $U(e){return e.map(e=>DR(e))}function eW(e){return e instanceof Array?e.join(`, `):e}function tW(e,t){return e===$.tagTypes.ASCII?Array.isArray(t)&&t.length===1?t[0]:t:e===$.tagTypes.RATIONAL||e===$.tagTypes.SRATIONAL?nW(t)?rW(t):Array.isArray(t)?t.map(e=>rW(e)):t:t}function nW(e){return!Array.isArray(e)||e.length!==2?!1:typeof e[0]==`number`&&typeof e[1]==`number`}function rW(e){if(!Array.isArray(e)||e.length!==2)return e;let t=e[0],n=e[1];return!Number.isFinite(t)||!Number.isFinite(n)?e:n===0?null:t/n}var iW=[{pointerKey:`Exif IFD Pointer`,ifdType:tU},{pointerKey:`GPS Info IFD Pointer`,ifdType:`gps`},{pointerKey:`Interoperability IFD Pointer`,ifdType:nU}],aW={read:oW};function oW(e,t,n,r=!1,i=void 0){let a=jz.getByteOrder(e,t),o=WU(e),s=sW(e,t,a,n,r,i,o);for(let c=0;c<iW.length;c++)s=cW(iW[c],s,e,t,a,n,r,i,o);return{tags:s,byteOrder:a}}function sW(e,t,n,r,i,a,o){let s=HU(e,t,n);return s===void 0?{}:UU(e,`0th`,t,s,n,r,i,a,`exif`,o)}function cW(e,t,n,r,i,a,o,s,c){let l=t[e.pointerKey];return l===void 0?t:jR(t,UU(n,e.ifdType,r,r+l.value,i,a,o,s,`exif`,c))}var lW={read:fW},uW=16,dW=8;function fW(e,t,n,r=!1,i=void 0){try{let a=jz.getByteOrder(e,t),o=HU(e,t,a);return o===void 0?{}:pW(e,t,UU(e,`mpf`,t,o,a,n,r,i,`mpf`),a)}catch{return{}}}function pW(e,t,n,r){if(!n.MPEntry)return n;let i=e.byteLength,a=e.byteOffset||0,o=i*dW,s=[];for(let c=0;c<Math.ceil(n.MPEntry.value.length/uW);c++){s[c]={};let l=mW(n.MPEntry.value,c*uW,$.getTypeSize(`LONG`),r);s[c].ImageFlags=hW(l),s[c].ImageFormat=gW(l),s[c].ImageType=_W(l);let u=mW(n.MPEntry.value,c*uW+4,$.getTypeSize(`LONG`),r);s[c].ImageSize={value:u,description:``+u};let d=vW(c,n.MPEntry,r,t);s[c].ImageOffset={value:d,description:``+d};let f=mW(n.MPEntry.value,c*uW+12,$.getTypeSize(`SHORT`),r);s[c].DependentImage1EntryNumber={value:f,description:``+f};let p=mW(n.MPEntry.value,c*uW+14,$.getTypeSize(`SHORT`),r);s[c].DependentImage2EntryNumber={value:p,description:``+p};let m=Math.min(Math.max(d,0),i),h=Math.min(m+Math.max(u,0),i,m+o);s[c].image=e.buffer.slice(a+m,a+h),o-=h-m,NR(s[c],`base64`,function(){return PR(this.image)})}return n.Images=s,n}function mW(e,t,n,r){if(r===jz.LITTLE_ENDIAN){let r=0;for(let i=0;i<n;i++)r+=e[t+i]<<8*i;return r}let i=0;for(let r=0;r<n;r++)i+=e[t+r]<<8*(n-1-r);return i}function hW(e){let t=[e>>31&1,e>>30&1,e>>29&1],n=[];return t[0]&&n.push(`Dependent Parent Image`),t[1]&&n.push(`Dependent Child Image`),t[2]&&n.push(`Representative Image`),{value:t,description:n.join(`, `)||`None`}}function gW(e){let t=e>>24&7;return{value:t,description:t===0?`JPEG`:`Unknown`}}function _W(e){let t=e&16777215;return{value:t,description:{196608:`Baseline MP Primary Image`,65537:`Large Thumbnail (VGA equivalent)`,65538:`Large Thumbnail (Full HD equivalent)`,131073:`Multi-Frame Image (Panorama)`,131074:`Multi-Frame Image (Disparity)`,131075:`Multi-Frame Image (Multi-Angle)`,0:`Undefined`}[t]||`Unknown`}}function vW(e,t,n,r){return yW(e)?0:mW(t.value,e*uW+8,$.getTypeSize(`LONG`),n)+r}function yW(e){return e===0}var bW={read:xW};function xW(e,t){let n=SW(e,t),r=EW(e,t,n);return{"Bits Per Sample":CW(e,t,n),"Image Height":wW(e,t,n),"Image Width":TW(e,t,n),"Color Components":r,Subsampling:r&&DW(e,t,r.value,n)}}function SW(e,t){return Math.min($.getShortAt(e,t),e.byteLength-t)}function CW(e,t,n){if(3>n)return;let r=$.getByteAt(e,t+2);return{value:r,description:``+r}}function wW(e,t,n){if(5>n)return;let r=$.getShortAt(e,t+3);return{value:r,description:`${r}px`}}function TW(e,t,n){if(7>n)return;let r=$.getShortAt(e,t+5);return{value:r,description:`${r}px`}}function EW(e,t,n){if(8>n)return;let r=$.getByteAt(e,t+7);return{value:r,description:``+r}}function DW(e,t,n,r){if(8+3*n>r)return;let i=[];for(let r=0;r<n;r++){let n=t+8+r*3;i.push([$.getByteAt(e,n),$.getByteAt(e,n+1),$.getByteAt(e,n+2)])}return{value:i,description:i.length>1?OW(i)+kW(i):``}}function OW(e){let t={1:`Y`,2:`Cb`,3:`Cr`,4:`I`,5:`Q`};return e.map(e=>t[e[0]]).join(``)}function kW(e){let t={17:`4:4:4 (1 1)`,18:`4:4:0 (1 2)`,20:`4:4:1 (1 4)`,33:`4:2:2 (2 1)`,34:`4:2:0 (2 2)`,36:`4:2:1 (2 4)`,65:`4:1:1 (4 1)`,66:`4:1:0 (4 2)`};return e.length===0||e[0][1]===void 0||t[e[0][1]]===void 0?``:t[e[0][1]]}var AW={read:PW},jW=2,MW=[9,13,18,30],NW=[0,1,12/10,4/3,3/2,16/9,5/4,2];function PW(e,t){let n={};try{let{height:r,width:i}=FW(LW(e,t+jW));n[`Image Height`]={value:r,description:`${r}px`},n[`Image Width`]={value:i,description:`${i}px`}}catch{}return n}function FW(e){let t=e.readBits(1),n,r;if(t){n=(e.readBits(5)+1)*8;let t=e.readBits(3);r=t===0?(e.readBits(5)+1)*8:Math.ceil(n*NW[t])}else{n=IW(e);let t=e.readBits(3);r=t===0?IW(e):Math.ceil(n*NW[t])}return{height:n,width:r}}function IW(e){let t=e.readBits(2);return 1+e.readBits(MW[t])}function LW(e,t){let n=t,r=0;return{readBits(t){let i=0;for(let a=0;a<t;a++){if(n>=e.byteLength)throw Error(`Unexpected end of data`);let t=e.getUint8(n)>>r&1;i|=t<<a,r++,r>=8&&(r=0,n++)}return i}}}var RW={read:zW};function zW(e,t){let n=BW(e,t),r=KW(e,t,n),i=qW(e,t,n),a={"JFIF Version":VW(e,t,n),"Resolution Unit":HW(e,t,n),XResolution:WW(e,t,n),YResolution:GW(e,t,n),"JFIF Thumbnail Width":r,"JFIF Thumbnail Height":i};if(r!==void 0&&i!==void 0){let o=JW(e,t,3*r.value*i.value,n);o&&(a[`JFIF Thumbnail`]=o)}for(let e in a)a[e]===void 0&&delete a[e];return a}function BW(e,t){return Math.min($.getShortAt(e,t),e.byteLength-t)}function VW(e,t,n){if(9>n)return;let r=$.getByteAt(e,t+7),i=$.getByteAt(e,t+7+1);return{value:r*256+i,description:r+`.`+i}}function HW(e,t,n){if(10>n)return;let r=$.getByteAt(e,t+9);return{value:r,description:UW(r)}}function UW(e){return e===0?`None`:e===1?`inches`:e===2?`cm`:`Unknown`}function WW(e,t,n){if(12>n)return;let r=$.getShortAt(e,t+10);return{value:r,description:``+r}}function GW(e,t,n){if(14>n)return;let r=$.getShortAt(e,t+12);return{value:r,description:``+r}}function KW(e,t,n){if(15>n)return;let r=$.getByteAt(e,t+14);return{value:r,description:`${r}px`}}function qW(e,t,n){if(16>n)return;let r=$.getByteAt(e,t+15);return{value:r,description:`${r}px`}}function JW(e,t,n,r){if(n===0||16+n>r)return;let i=e.byteOffset||0;return{value:e.buffer.slice(i+t+16,i+t+16+n),description:`<24-bit RGB pixel data>`}}var YW={iptc:{256:{name:`Model Version`,description:e=>((e[0]<<8)+e[1]).toString()},261:{name:`Destination`,repeatable:!0},276:{name:`File Format`,description:e=>((e[0]<<8)+e[1]).toString()},278:{name:`File Format Version`,description:e=>((e[0]<<8)+e[1]).toString()},286:`Service Identifier`,296:`Envelope Number`,306:`Product ID`,316:`Envelope Priority`,326:{name:`Date Sent`,description:XW},336:{name:`Time Sent`,description:ZW},346:{name:`Coded Character Set`,description:QW,encoding_name:QW},356:`UNO`,376:{name:`ARM Identifier`,description:e=>((e[0]<<8)+e[1]).toString()},378:{name:`ARM Version`,description:e=>((e[0]<<8)+e[1]).toString()},512:{name:`Record Version`,description:e=>((e[0]<<8)+e[1]).toString()},515:`Object Type Reference`,516:`Object Attribute Reference`,517:`Object Name`,519:`Edit Status`,520:{name:`Editorial Update`,description:e=>ER(e)===`01`?`Additional Language`:`Unknown`},522:`Urgency`,524:{name:`Subject Reference`,repeatable:!0,description:e=>{let t=ER(e).split(`:`);return t[2]+(t[3]?`/`+t[3]:``)+(t[4]?`/`+t[4]:``)}},527:`Category`,532:{name:`Supplemental Category`,repeatable:!0},534:`Fixture Identifier`,537:{name:`Keywords`,repeatable:!0},538:{name:`Content Location Code`,repeatable:!0},539:{name:`Content Location Name`,repeatable:!0},542:`Release Date`,547:`Release Time`,549:`Expiration Date`,550:`Expiration Time`,552:`Special Instructions`,554:{name:`Action Advised`,description:e=>{let t=ER(e);return t===`01`?`Object Kill`:t===`02`?`Object Replace`:t===`03`?`Object Append`:t===`04`?`Object Reference`:`Unknown`}},557:{name:`Reference Service`,repeatable:!0},559:{name:`Reference Date`,repeatable:!0},562:{name:`Reference Number`,repeatable:!0},567:{name:`Date Created`,description:XW},572:{name:`Time Created`,description:ZW},574:{name:`Digital Creation Date`,description:XW},575:{name:`Digital Creation Time`,description:ZW},577:`Originating Program`,582:`Program Version`,587:{name:`Object Cycle`,description:e=>{let t=ER(e);return t===`a`?`morning`:t===`p`?`evening`:t===`b`?`both`:`Unknown`}},592:{name:`By-line`,repeatable:!0},597:{name:`By-line Title`,repeatable:!0},602:`City`,604:`Sub-location`,607:`Province/State`,612:`Country/Primary Location Code`,613:`Country/Primary Location Name`,615:`Original Transmission Reference`,617:`Headline`,622:`Credit`,627:`Source`,628:`Copyright Notice`,630:{name:`Contact`,repeatable:!0},632:`Caption/Abstract`,634:{name:`Writer/Editor`,repeatable:!0},637:{name:`Rasterized Caption`,description:e=>e},642:`Image Type`,643:{name:`Image Orientation`,description:e=>{let t=ER(e);return t===`P`?`Portrait`:t===`L`?`Landscape`:t===`S`?`Square`:`Unknown`}},647:`Language Identifier`,662:{name:`Audio Type`,description:e=>{let t=ER(e),n=t.charAt(0),r=t.charAt(1),i=``;return n===`1`?i+=`Mono`:n===`2`&&(i+=`Stereo`),r===`A`?i+=`, actuality`:r===`C`?i+=`, question and answer session`:r===`M`?i+=`, music, transmitted by itself`:r===`Q`?i+=`, response to a question`:r===`R`?i+=`, raw sound`:r===`S`?i+=`, scener`:r===`V`?i+=`, voicer`:r===`W`&&(i+=`, wrap`),i===``?t:i}},663:{name:`Audio Sampling Rate`,description:e=>parseInt(ER(e),10)+` Hz`},664:{name:`Audio Sampling Resolution`,description:e=>{let t=parseInt(ER(e),10);return t+(t===1?` bit`:` bits`)}},665:{name:`Audio Duration`,description:e=>{let t=ER(e);return t.length>=6?t.substr(0,2)+`:`+t.substr(2,2)+`:`+t.substr(4,2):t}},666:`Audio Outcue`,698:`Short Document ID`,699:`Unique Document ID`,700:`Owner ID`,712:{name:e=>e.length===2?`ObjectData Preview File Format`:`Record 2 destination`,description:e=>{if(e.length===2){let t=(e[0]<<8)+e[1];return t===0?`No ObjectData`:t===1?`IPTC-NAA Digital Newsphoto Parameter Record`:t===2?`IPTC7901 Recommended Message Format`:t===3?`Tagged Image File Format (Adobe/Aldus Image data)`:t===4?`Illustrator (Adobe Graphics data)`:t===5?`AppleSingle (Apple Computer Inc)`:t===6?`NAA 89-3 (ANPA 1312)`:t===7?`MacBinary II`:t===8?`IPTC Unstructured Character Oriented File Format (UCOFF)`:t===9?`United Press International ANPA 1312 variant`:t===10?`United Press International Down-Load Message`:t===11?`JPEG File Interchange (JFIF)`:t===12?`Photo-CD Image-Pac (Eastman Kodak)`:t===13?`Microsoft Bit Mapped Graphics File [*.BMP]`:t===14?`Digital Audio File [*.WAV] (Microsoft & Creative Labs)`:t===15?`Audio plus Moving Video [*.AVI] (Microsoft)`:t===16?`PC DOS/Windows Executable Files [*.COM][*.EXE]`:t===17?`Compressed Binary File [*.ZIP] (PKWare Inc)`:t===18?`Audio Interchange File Format AIFF (Apple Computer Inc)`:t===19?`RIFF Wave (Microsoft Corporation)`:t===20?`Freehand (Macromedia/Aldus)`:t===21?`Hypertext Markup Language "HTML" (The Internet Society)`:t===22?`MPEG 2 Audio Layer 2 (Musicom), ISO/IEC`:t===23?`MPEG 2 Audio Layer 3, ISO/IEC`:t===24?`Portable Document File (*.PDF) Adobe`:t===25?`News Industry Text Format (NITF)`:t===26?`Tape Archive (*.TAR)`:t===27?`Tidningarnas Telegrambyrå NITF version (TTNITF DTD)`:t===28?`Ritzaus Bureau NITF version (RBNITF DTD)`:t===29?`Corel Draw [*.CDR]`:`Unknown format ${t}`}return ER(e)}},713:{name:`ObjectData Preview File Format Version`,description:(e,t)=>{let n={"00":{"00":`1`},"01":{"01":`1`,"02":`2`,"03":`3`,"04":`4`},"02":{"04":`4`},"03":{"01":`5.0`,"02":`6.0`},"04":{"01":`1.40`},"05":{"01":`2`},"06":{"01":`1`},11:{"01":`1.02`},20:{"01":`3.1`,"02":`4.0`,"03":`5.0`,"04":`5.5`},21:{"02":`2.0`}},r=ER(e);if(t[`ObjectData Preview File Format`]){let e=ER(t[`ObjectData Preview File Format`].value);if(n[e]&&n[e][r])return n[e][r]}return r}},714:`ObjectData Preview Data`,1802:{name:`Size Mode`,description:e=>e[0].toString()},1812:{name:`Max Subfile Size`,description:e=>{let t=0;for(let n=0;n<e.length;n++)t=(t<<8)+e[n];return t.toString()}},1882:{name:`ObjectData Size Announced`,description:e=>{let t=0;for(let n=0;n<e.length;n++)t=(t<<8)+e[n];return t.toString()}},1887:{name:`Maximum ObjectData Size`,description:e=>{let t=0;for(let n=0;n<e.length;n++)t=(t<<8)+e[n];return t.toString()}}}};function XW(e){let t=ER(e);return t.length>=8?t.substr(0,4)+`-`+t.substr(4,2)+`-`+t.substr(6,2):t}function ZW(e){let t=ER(e),n=t;return t.length>=6&&(n=t.substr(0,2)+`:`+t.substr(2,2)+`:`+t.substr(4,2),t.length===11&&(n+=t.substr(6,1)+t.substr(7,2)+`:`+t.substr(9,2))),n}function QW(e){let t=ER(e);return t===`\x1B%G`?`UTF-8`:t===`\x1B%5`?`Windows-1252`:t===`\x1B%/G`?`UTF-8 Level 1`:t===`\x1B%/H`?`UTF-8 Level 2`:t===`\x1B%/I`?`UTF-8 Level 3`:t===`\x1B/A`?`ISO-8859-1`:t===`\x1B/B`?`ISO-8859-2`:t===`\x1B/C`?`ISO-8859-3`:t===`\x1B/D`?`ISO-8859-4`:t===`\x1B/@`?`ISO-8859-5`:t===`\x1B/G`?`ISO-8859-6`:t===`\x1B/F`?`ISO-8859-7`:t===`\x1B/H`?`ISO-8859-8`:`Unknown`}var $W={get:eG};function eG(){if(typeof TextDecoder<`u`)return TextDecoder}var tG=5,nG={128:8364,130:8218,131:402,132:8222,133:8230,134:8224,135:8225,136:710,137:8240,138:352,139:8249,140:338,142:381,145:8216,146:8217,147:8220,148:8221,149:8226,150:8211,151:8212,152:732,153:8482,154:353,155:8250,156:339,158:382,159:376},rG={decode:iG,TAG_HEADER_SIZE:tG};function iG(e,t){if(typeof t==`string`)return DR(t);let n=$W.get();if(n!==void 0&&e!==void 0)try{return new n(e).decode(t instanceof DataView?t.buffer:Uint8Array.from(t))}catch{}let r=t.map(e=>String.fromCharCode(e)).join(``);try{return decodeURIComponent(escape(r))}catch{return aG(t)}}function aG(e){let t=e instanceof DataView,n=t?e.byteLength:e.length,r=t?t=>e.getUint8(t):t=>e[t],i=Array(n);for(let e=0;e<n;e++){let t=r(e),n=nG[t];i[e]=n===void 0?t:n}return String.fromCharCode.apply(null,i)}var oG=943868237,sG=4,cG=2,lG=1,uG=4,dG=12,fG=1028,pG=5,mG={read:hG};function hG(e,t,n,r=OU){try{if(Array.isArray(e))return bG(new DataView(Uint8Array.from(e).buffer),{size:e.length},0,n,r);let{naaBlock:i,dataOffset:a}=gG(e,t);return bG(e,i,a,n,r)}catch{return{}}}function gG(e,t){for(;t+dG<=e.byteLength;){let n=_G(e,t);if(vG(n))return{naaBlock:n,dataOffset:t+n.headerSize};t+=n.headerSize+n.size+yG(n)}throw Error(`No IPTC NAA resource block.`)}function _G(e,t){if(e.getUint32(t,!1)!==oG)throw Error(`Not an IPTC resource block.`);let n=e.getUint8(t+sG+cG),r=(n%2==0?n+1:n)+lG;return{headerSize:6+r+uG,type:e.getUint16(t+sG),size:e.getUint32(t+sG+cG+r)}}function vG(e){return e.type===fG}function yG(e){return e.size%2==0?0:1}function bG(e,t,n,r,i){let a={},o,s=n+t.size;for(;n<s&&n<e.byteLength;){let{tag:t,tagSize:s}=xG(e,n,a,o,r,i);if(t===null)break;t&&(`encoding`in t&&(o=t.encoding),a[t.name]===void 0||t.repeatable===void 0?a[t.name]={id:t.id,value:t.value,description:t.description}:(a[t.name]instanceof Array||(a[t.name]=[{id:a[t.name].id,value:a[t.name].value,description:a[t.name].description}]),a[t.name].push({id:t.id,value:t.value,description:t.description}))),n+=pG+s}return a}function xG(e,t,n={},r=void 0,i=!1,a=OU){if(CG(e,t))return{tag:null,tagSize:0};let o=e.getUint16(t+1),s=e.getUint16(t+3);if(!i&&!YW.iptc[o]||!a.shouldParseTag(`iptc`,SG(o,i),o))return{tag:void 0,tagSize:s};let c=wG(e,t+pG,s),l={id:o,name:TG(YW.iptc[o],o,c),value:c,description:OG(YW.iptc[o],c,n,r)};return jG(o)&&(l.repeatable=!0),MG(o)&&(l.encoding=YW.iptc[o].encoding_name(c)),{tag:l,tagSize:s}}function SG(e,t){let n=YW.iptc[e];if(!n)return t?`undefined-${e}`:void 0;if(typeof n==`string`)return n;if(n&&typeof n.name==`string`)return n.name}function CG(e,t){return e.getUint8(t)!==28}function wG(e,t,n){let r=[];for(let i=0;i<n;i++)r.push(e.getUint8(t+i));return r}function TG(e,t,n){return e?EG(e)?e:DG(e)?e.name(n):e.name:`undefined-${t}`}function EG(e){return typeof e==`string`}function DG(e){return typeof e.name==`function`}function OG(e,t,n,r){if(AG(e))try{return e.description(t,n)}catch{}return kG(e,t)?rG.decode(r,t):t}function kG(e,t){return e&&t instanceof Array}function AG(e){return e&&e.description!==void 0}function jG(e){return YW.iptc[e]&&YW.iptc[e].repeatable}function MG(e){return YW.iptc[e]&&YW.iptc[e].encoding_name!==void 0}var NG={"tiff:Orientation"(e){return e===`1`?`Horizontal (normal)`:e===`2`?`Mirror horizontal`:e===`3`?`Rotate 180`:e===`4`?`Mirror vertical`:e===`5`?`Mirror horizontal and rotate 270 CW`:e===`6`?`Rotate 90 CW`:e===`7`?`Mirror horizontal and rotate 90 CW`:e===`8`?`Rotate 270 CW`:e},"tiff:ResolutionUnit":e=>GH.ResolutionUnit(parseInt(e,10)),"tiff:XResolution":e=>PG(GH.XResolution,e),"tiff:YResolution":e=>PG(GH.YResolution,e),"exif:ApertureValue":e=>PG(GH.ApertureValue,e),"exif:GPSLatitude":LG,"exif:GPSLongitude":LG,"exif:FNumber":e=>PG(GH.FNumber,e),"exif:FocalLength":e=>PG(GH.FocalLength,e),"exif:FocalPlaneResolutionUnit":e=>GH.FocalPlaneResolutionUnit(parseInt(e,10)),"exif:ColorSpace":e=>GH.ColorSpace(FG(e)),"exif:ComponentsConfiguration"(e,t){if(/^\d, \d, \d, \d$/.test(t)){let e=t.split(`, `).map(e=>e.charCodeAt(0));return GH.ComponentsConfiguration(e)}return t},"exif:Contrast":e=>GH.Contrast(parseInt(e,10)),"exif:CustomRendered":e=>GH.CustomRendered(parseInt(e,10)),"exif:ExposureMode":e=>GH.ExposureMode(parseInt(e,10)),"exif:ExposureProgram":e=>GH.ExposureProgram(parseInt(e,10)),"exif:ExposureTime"(e){return IG(e)?GH.ExposureTime(e.split(`/`).map(e=>parseInt(e,10))):e},"exif:MeteringMode":e=>GH.MeteringMode(parseInt(e,10)),"exif:Saturation":e=>GH.Saturation(parseInt(e,10)),"exif:SceneCaptureType":e=>GH.SceneCaptureType(parseInt(e,10)),"exif:Sharpness":e=>GH.Sharpness(parseInt(e,10)),"exif:ShutterSpeedValue":e=>PG(GH.ShutterSpeedValue,e),"exif:WhiteBalance":e=>GH.WhiteBalance(parseInt(e,10))};function PG(e,t){return IG(t)?e(t.split(`/`)):t}function FG(e){return e.substring(0,2)===`0x`?parseInt(e.substring(2),16):parseInt(e,10)}function IG(e){return/^-?\d+\/-?\d+$/.test(e)}function LG(e){let[t,n]=e.split(`,`);if(t!==void 0&&n!==void 0){let e=parseFloat(t),r=parseFloat(n),i=n.charAt(n.length-1);if(!Number.isNaN(e)&&!Number.isNaN(r))return``+(e+r/60)+i}return e}var RG={get:zG};function zG(e){if(e)return e;if(typeof DOMParser<`u`)return new DOMParser;try{let{DOMParser:e,onErrorStopParsing:t}=__non_webpack_require__(`@xmldom/xmldom`);return new e({onError:t})}catch{return}}function BG(e){let t=[`prefix is non-null and namespace is null`,`prefix not bound to a namespace`,`prefix inte bundet till en namnrymd`,/Namespace prefix .+ is not defined/];for(let n=0;n<t.length;n++)if(new RegExp(t[n]).test(e.message))return!0;return!1}function VG(e){let t=HG(e);if(t===-1)return e;let{insertionIndex:n,attributeValueSpans:r}=UG(e,t+1);if(n===-1)return e;let i=KG(e,t,n,r),a=JG(e).filter(e=>i[e]===void 0);if(a.length===0)return e;let o=XG(a);return e.slice(0,n)+o+e.slice(n)}function HG(e){let t=0;for(;t<e.length;){if(t=e.indexOf(`<`,t),t===-1)return-1;if(/[A-Za-z_]/.test(e.charAt(t+1)))return t;WG(e,`<!--`,t)?t=GG(e,t+4,`-->`):WG(e,`<![CDATA[`,t)?t=GG(e,t+9,`]]>`):e.charAt(t+1)===`?`?t=GG(e,t+2,`?>`):t++}return-1}function UG(e,t){let n=[],r,i;for(let a=t;a<e.length;a++){let t=e.charAt(a);if(r!==void 0)t===r&&(n.push({start:i,end:a}),r=void 0);else if(t===`"`||t===`'`)r=t,i=a+1;else if(t===`>`)return e.charAt(a-1)===`/`?{insertionIndex:a-1,attributeValueSpans:n}:{insertionIndex:a,attributeValueSpans:n}}return{insertionIndex:-1,attributeValueSpans:n}}function WG(e,t,n){return e.slice(n,n+t.length)===t}function GG(e,t,n){let r=e.indexOf(n,t);return r===-1?e.length:r+n.length}function KG(e,t,n,r){let i=Object.create(null),a=/xmlns:([A-Za-z_][A-Za-z0-9._-]*)\s*=\s*["']([^"']*)["']/g,o,s=0;for(;(o=a.exec(e))!==null;){for(;s<r.length&&r[s].end<=o.index;)s++;if(s<r.length&&r[s].start<=o.index){a.lastIndex=r[s].end;continue}(o[2]!==``||qG(o.index,t,n))&&(i[o[1]]=!0)}return i}function qG(e,t,n){return e>t&&e<n}function JG(e){let t=[],n=Object.create(null),r=/(?:^|[^A-Za-z0-9._-])([A-Za-z_][A-Za-z0-9._-]*):[A-Za-z_][A-Za-z0-9._-]*/g,i;for(;(i=r.exec(e))!==null;){let e=i[1];e!==`xmlns`&&e!==`xml`&&n[e]===void 0&&(n[e]=!0,t.push(e))}return t}var YG={xmp:`http://ns.adobe.com/xap/1.0/`,tiff:`http://ns.adobe.com/tiff/1.0/`,exif:`http://ns.adobe.com/exif/1.0/`,dc:`http://purl.org/dc/elements/1.1/`,xmpMM:`http://ns.adobe.com/xap/1.0/mm/`,stEvt:`http://ns.adobe.com/xap/1.0/sType/ResourceEvent#`,stRef:`http://ns.adobe.com/xap/1.0/sType/ResourceRef#`,photoshop:`http://ns.adobe.com/photoshop/1.0/`};function XG(e){let t=[];for(let n=0;n<e.length;n++){let r=e[n];t.push(` xmlns:`+r+`="`+ZG(r)+`"`)}return t.join(``)}function ZG(e){return Object.prototype.hasOwnProperty.call(YG,e)?YG[e]:`http://fallback.namespace/`+e}var QG={read:eK},$G=class extends Error{constructor(e){super(e),this.name=`ParseError`}};function eK(e,t,n){let r={};if(typeof e==`string`)return iK(r,e,n),r;let[i,a]=tK(e,t),o=iK(r,i,n);if(a){let i=iK(r,a,n);!o&&!i&&(delete r._raw,iK(r,nK(e,t),n))}return r}function tK(e,t){if(t.length===0)return[];let n=[nK(e,t.slice(0,1))];return t.length>1&&n.push(nK(e,t.slice(1))),n}function nK(e,t){let n=t.map(t=>rK(e,t)),r=n.reduce((e,t)=>e+t.length,0),i=new Uint8Array(r),a=0;for(let e=0;e<n.length;e++)i.set(n[e],a),a+=n[e].length;return new DataView(i.buffer)}function rK(e,t){let n=e.byteLength,r=e.byteOffset||0,i=Math.min(Math.max(t.dataOffset,0),n),a=Math.min(i+Math.max(t.length,0),n);return new Uint8Array(e.buffer.slice(r+i,r+a))}function iK(e,t,n){try{let{doc:r,raw:i,decodeValue:a}=aK(t,n);return e._raw=(e._raw||``)+i,jR(e,bK(fK(dK(r),!0,a))),!0}catch{return!1}}function aK(e,t){let n=RG.get(t);if(!n)throw console.warn(`Warning: DOMParser is not available. It is needed to be able to parse XMP tags.`),Error();let{xmlString:r,decodeValue:i}=oK(e);return{doc:uK(n,lK(r)),raw:r,decodeValue:i}}function oK(e){if(typeof e==`string`)return sK(e);let t=$W.get();if(t!==void 0)try{return{xmlString:new t(`utf-8`,{fatal:!0}).decode(e),decodeValue:cK}}catch{}return sK(SR(e,0,e.byteLength))}function sK(e){let t=OR(e);return t===void 0?{xmlString:e,decodeValue:DR}:{xmlString:t,decodeValue:cK}}function cK(e){return e}function lK(e){return e.replace(/^.+(<\?xpacket begin)/,`$1`).replace(/(<\?xpacket end=".*"\?>).+$/,`$1`)}function uK(e,t,n=!1){try{let n=e.parseFromString(t,`application/xml`),r=n.getElementsByTagName(`parsererror`);if(r.length>0)throw new $G(r[0].textContent);return n}catch(r){if(r.name===`ParseError`&&BG(r)&&!n)return uK(e,VG(t),!0);throw r}}function dK(e){for(let t=0;t<e.childNodes.length;t++){if(e.childNodes[t].tagName===`x:xmpmeta`)return dK(e.childNodes[t]);if(e.childNodes[t].tagName===`rdf:RDF`)return e.childNodes[t]}throw Error()}function fK(e,t,n){let r=pK(e);return mK(r)?t?{}:n(hK(r[0])):gK(r,n)}function pK(e){let t=[];for(let n=0;n<e.childNodes.length;n++)t.push(e.childNodes[n]);return t}function mK(e){return e.length===1&&e[0].nodeName===`#text`}function hK(e){return e.nodeValue}function gK(e,t){let n=Object.create(null);return e.forEach(e=>{if(_K(e)){let r=vK(e,t);n[e.nodeName]===void 0?n[e.nodeName]=r:(Array.isArray(n[e.nodeName])||(n[e.nodeName]=[n[e.nodeName]]),n[e.nodeName].push(r))}}),n}function _K(e){return e.nodeName&&e.nodeName!==`#text`}function vK(e,t){return{attributes:yK(e,t),value:fK(e,!1,t)}}function yK(e,t){let n={};for(let r=0;r<e.attributes.length;r++)MR(n,e.attributes[r].nodeName,t(e.attributes[r].value));return n}function bK(e){let t={};if(typeof e==`string`)return e;for(let n in e){let r=e[n];Array.isArray(r)||(r=[r]),r.forEach(e=>{jR(t,xK(e.attributes)),typeof e.value==`object`&&jR(t,AK(e.value))})}return t}function xK(e){let t={};for(let n in e)try{SK(n)&&MR(t,wK(n),{value:e[n],attributes:{},description:TK(e[n],n)})}catch{}return t}function SK(e){return e!==`rdf:parseType`&&!CK(e)}function CK(e){return e.split(`:`)[0]===`xmlns`}function wK(e){return/^MicrosoftPhoto(_\d+_)?:Rating$/i.test(e)?`RatingPercent`:e.split(`:`)[1]}function TK(e,t=void 0){if(Array.isArray(e)){let n=EK(e);if(DK(t))try{let r=NG[t](e,n);if(typeof r==`string`)return r}catch{}return n}if(typeof e==`object`)return OK(e);if(DK(t))try{return NG[t](e)}catch{return e}return e}function EK(e){return e.map(e=>e.value===void 0?TK(e):TK(e.value)).join(`, `)}function DK(e){return Object.prototype.hasOwnProperty.call(NG,e)&&typeof NG[e]==`function`}function OK(e){let t=[];for(let n in e)t.push(`${kK(n)}: ${TK(e[n].value)}`);return t.join(`; `)}function kK(e){return e===`CiAdrCity`?`CreatorCity`:e===`CiAdrCtry`?`CreatorCountry`:e===`CiAdrExtadr`?`CreatorAddress`:e===`CiAdrPcode`?`CreatorPostalCode`:e===`CiAdrRegion`?`CreatorRegion`:e===`CiEmailWork`?`CreatorWorkEmail`:e===`CiTelWork`?`CreatorWorkPhone`:e===`CiUrlWork`?`CreatorWorkUrl`:e}function AK(e,t={}){for(let n in e)try{CK(n)||MR(t,wK(n),jK(e[n],n))}catch{}return t}function jK(e,t){return NK(e)?PK(e,t):MK(e)?{value:``,attributes:{},description:``}:FK(e)?IK(e,t):HK(e)?UK(e,t):WK(e)?GK(e,t):KK(e)?JK(e,t):XK(e,t)}function MK(e){return e.attributes[`rdf:parseType`]===`Resource`&&typeof e.value==`string`&&e.value.trim()===``}function NK(e){return Array.isArray(e)}function PK(e,t){return XK(e[e.length-1],t)}function FK(e){return e.attributes[`rdf:parseType`]===`Resource`&&e.value[`rdf:value`]!==void 0||e.value[`rdf:Description`]!==void 0&&e.value[`rdf:Description`].value[`rdf:value`]!==void 0}function IK(e,t){let n=LK(e);e.value[`rdf:Description`]!==void 0&&(e=e.value[`rdf:Description`]),jR(n,LK(e),RK(e));let r=zK(e);return{value:r,attributes:n,description:TK(r,t)}}function LK(e){let t={};for(let n in e.attributes)n!==`rdf:parseType`&&n!==`rdf:resource`&&!CK(n)&&MR(t,wK(n),e.attributes[n]);return t}function RK(e){let t={};for(let n in e.value)n!==`rdf:value`&&!CK(n)&&MR(t,wK(n),e.value[n].value);return t}function zK(e){let t=BK(e.value[`rdf:value`]);return ZK(t)||VK(t)}function BK(e){return NK(e)?e[e.length-1]:e}function VK(e){return KK(e)?JK(e).value:typeof e.value==`object`?AK(e.value,Object.create(null)):e.value}function HK(e){return e.attributes[`rdf:parseType`]===`Resource`||e.value[`rdf:Description`]!==void 0&&e.value[`rdf:Description`].value[`rdf:value`]===void 0}function UK(e,t){let n={value:{},attributes:{}};return e.value[`rdf:Description`]!==void 0&&(jR(n.value,xK(e.value[`rdf:Description`].attributes)),jR(n.attributes,LK(e)),e=e.value[`rdf:Description`]),jR(n.value,AK(e.value)),n.description=TK(n.value,t),n}function WK(e){return Object.keys(e.value).length===0&&e.attributes[`xml:lang`]===void 0&&e.attributes[`rdf:resource`]===void 0}function GK(e,t){let n=xK(e.attributes);return{value:n,attributes:{},description:TK(n,t)}}function KK(e){return qK(e.value)!==void 0}function qK(e){return BK(e[`rdf:Bag`]||e[`rdf:Seq`]||e[`rdf:Alt`])}function JK(e,t){let n=qK(e.value).value[`rdf:li`],r=LK(e),i=[];return n===void 0?n=[]:Array.isArray(n)||(n=[n]),n.forEach(e=>{i.push(YK(e))}),{value:i,attributes:r,description:TK(i,t)}}function YK(e){return FK(e)?IK(e):HK(e)?UK(e).value:WK(e)?GK(e).value:XK(e)}function XK(e,t){let n=ZK(e)||bK(e.value);return{value:n,attributes:LK(e),description:TK(n,t)}}function ZK(e){return e.attributes&&e.attributes[`rdf:resource`]}var QK={CLOSED_SUBPATH_LENGTH:0,CLOSED_SUBPATH_BEZIER_LINKED:1,CLOSED_SUBPATH_BEZIER_UNLINKED:2,OPEN_SUBPATH_LENGTH:3,OPEN_SUBPATH_BEZIER_LINKED:4,OPEN_SUBPATH_BEZIER_UNLINKED:5,FILL_RULE:6,CLIPBOARD:7,INITIAL_FILL_RULE:8},$K=24,eq={2e3:{name:`PathInformation`,description:tq},2999:{name:`ClippingPathName`,description(e){let[,t]=TR(e,0);return t}}};function tq(e){let t={},n=[];for(let r=0;r<e.byteLength;r+=26){let i=$.getShortAt(e,r);nq[i]&&(t[i]||(t[i]=nq[i].description),n.push({type:i,path:nq[i].path(e,r+2)}))}return JSON.stringify({types:t,paths:n})}var nq={[QK.CLOSED_SUBPATH_LENGTH]:{description:`Closed subpath length`,path:(e,t)=>[$.getShortAt(e,t)]},[QK.CLOSED_SUBPATH_BEZIER_LINKED]:{description:`Closed subpath Bezier knot, linked`,path:rq},[QK.CLOSED_SUBPATH_BEZIER_UNLINKED]:{description:`Closed subpath Bezier knot, unlinked`,path:rq},[QK.OPEN_SUBPATH_LENGTH]:{description:`Open subpath length`,path:(e,t)=>[$.getShortAt(e,t)]},[QK.OPEN_SUBPATH_BEZIER_LINKED]:{description:`Open subpath Bezier knot, linked`,path:rq},[QK.OPEN_SUBPATH_BEZIER_UNLINKED]:{description:`Open subpath Bezier knot, unlinked`,path:rq},[QK.FILL_RULE]:{description:`Path fill rule`,path:()=>[]},[QK.INITIAL_FILL_RULE]:{description:`Initial fill rule`,path:(e,t)=>[$.getShortAt(e,t)]},[QK.CLIPBOARD]:{description:`Clipboard`,path:aq}};function rq(e,t){let n=[];for(let r=0;r<$K;r+=8)n.push(iq(e,t+r));return n}function iq(e,t){let n=oq(e,t,8);return[oq(e,t+4,8),n]}function aq(e,t){return[[oq(e,t,8),oq(e,t+4,8),oq(e,t+8,8),oq(e,t+12,8)],oq(e,t+16,8)]}function oq(e,t,n){let r=$.getLongAt(e,t),i=r>>>31?-1:1,a=(r&2130706432)>>>32-n,o=r&parseInt(RR(`1`,32-n),2);return i*LR(a.toString(2)+`.`+IR(o.toString(2),32-n,`0`),2)}var sq={read:pq},cq=`8BIM`,lq=2,uq=4,dq=4,fq=12;function pq(e,t,n=OU){if(!Array.isArray(e))return{};let r=xR(new Uint8Array(e).buffer),i={},a=0;for(;a+fq<=r.byteLength;){let e=SR(r,a,dq);a+=dq;let o=$.getShortAt(r,a);a+=lq;let{tagName:s,tagNameSize:c}=hq(r,a);if(a+=c,a+uq>r.byteLength)break;let l=$.getLongAt(r,a);a+=uq;let u=Math.min(l,r.byteLength-a);if(e===cq){let e=mq(o,s,t);if(!n.shouldParseTag(`photoshop`,e,o)){a+=u+u%2;continue}let c=xR(r.buffer,a,u),l={id:o,value:SR(c,0,u)};if(eq[o]){try{l.description=eq[o].description(c)}catch{l.description=`<no description formatter>`}i[s||eq[o].name]=l}else t&&(i[`undefined-${o}`]=l)}a+=u+u%2}return i}function mq(e,t,n){if(t)return t;if(eq[e]&&eq[e].name)return eq[e].name;if(n)return`undefined-${e}`}function hq(e,t){let[n,r]=TR(e,t);return{tagName:r,tagNameSize:1+n+ +(n%2==0)}}var gq={desc:{name:`ICC Description`},cprt:{name:`ICC Copyright`},dmdd:{name:`ICC Device Model Description`},vued:{name:`ICC Viewing Conditions Description`},dmnd:{name:`ICC Device Manufacturer for Display`},tech:{name:`Technology`}},_q={4:{name:`Preferred CMM type`,value:(e,t)=>SR(e,t,4),description:e=>e===null?``:xq(e)},8:{name:`Profile Version`,value:(e,t)=>e.getUint8(t).toString(10)+`.`+(e.getUint8(t+1)>>4).toString(10)+`.`+(e.getUint8(t+1)%16).toString(10)},12:{name:`Profile/Device class`,value:(e,t)=>SR(e,t,4),description:e=>{switch(e.toLowerCase()){case`scnr`:return`Input Device profile`;case`mntr`:return`Display Device profile`;case`prtr`:return`Output Device profile`;case`link`:return`DeviceLink profile`;case`abst`:return`Abstract profile`;case`spac`:return`ColorSpace profile`;case`nmcl`:return`NamedColor profile`;case`cenc`:return`ColorEncodingSpace profile`;case`mid `:return`MultiplexIdentification profile`;case`mlnk`:return`MultiplexLink profile`;case`mvis`:return`MultiplexVisualization profile`;default:return e}}},16:{name:`Color Space`,value:(e,t)=>SR(e,t,4)},20:{name:`Connection Space`,value:(e,t)=>SR(e,t,4)},24:{name:`ICC Profile Date`,value:(e,t)=>vq(e,t).toISOString()},36:{name:`ICC Signature`,value:(e,t)=>bq(e.buffer.slice(t,t+4))},40:{name:`Primary Platform`,value:(e,t)=>SR(e,t,4),description:e=>xq(e)},48:{name:`Device Manufacturer`,value:(e,t)=>SR(e,t,4),description:e=>xq(e)},52:{name:`Device Model Number`,value:(e,t)=>SR(e,t,4)},64:{name:`Rendering Intent`,value:(e,t)=>e.getUint32(t),description:e=>{switch(e){case 0:return`Perceptual`;case 1:return`Relative Colorimetric`;case 2:return`Saturation`;case 3:return`Absolute Colorimetric`;default:return e}}},80:{name:`Profile Creator`,value:(e,t)=>SR(e,t,4)}};function vq(e,t){let n=e.getUint16(t),r=e.getUint16(t+2)-1,i=e.getUint16(t+4),a=e.getUint16(t+6),o=e.getUint16(t+8),s=e.getUint16(t+10);return new Date(Date.UTC(n,r,i,a,o,s))}var yq=8192;function bq(e){let t=new Uint8Array(e),n=[];for(let e=0;e<t.length;e+=yq)n.push(String.fromCharCode.apply(null,t.subarray(e,e+yq)));return n.join(``)}function xq(e){switch(e.toLowerCase()){case`appl`:return`Apple`;case`adbe`:return`Adobe`;case`msft`:return`Microsoft`;case`sunw`:return`Sun Microsystems`;case`sgi`:return`Silicon Graphics`;case`tgnt`:return`Taligent`;default:return e}}var Sq={read:Lq},Cq=84,wq=128,Tq=`acsp`,Eq=`desc`,Dq=`mluc`,Oq=`text`,kq=`sig `,Aq=12,jq=12,Mq=12,Nq=16,Pq=1e3,Fq=1e3,Iq=1048576;function Lq(e,t,n,r){return n&&t[0].compressionMethod!==void 0?Rq(e,t,r):Bq(e,t)}function Rq(e,t,n){if(!zq(t[0].compressionMethod))return{};let r=e.byteOffset||0,i=e.buffer.slice(r+t[0].offset,r+t[0].offset+t[0].length);return VR(new DataView(new Uint8Array(i).buffer),t[0].compressionMethod,`utf-8`,`dataview`,n).then(Gq).catch(()=>({}))}function zq(e){return e===0}function Bq(e,t){try{let n=Vq(e),r=e.byteOffset||0,i=t.reduce((e,t)=>e+t.length,0),a=Math.min(i,n.byteLength),o=new Uint8Array(a),s=0,c=Hq(t);for(let e=1;e<=t.length;e++){let t=c[e];if(!t)throw Error(`ICC chunk ${e} not found`);let i=n.slice(r+t.offset,r+t.offset+t.length),a=new Uint8Array(i);o.set(a,s),s+=a.length}return Gq(new DataView(o.buffer))}catch{return{}}}function Vq(e){return Array.isArray(e)?new DataView(Uint8Array.from(e).buffer).buffer:e.buffer}function Hq(e){let t=Object.create(null);for(let n=0;n<e.length;n++)t[e[n].chunkNumber]===void 0&&(t[e[n].chunkNumber]=e[n]);return t}function Uq(e){return e.byteLength<132}function Wq(e,t){return e.byteLength<t+Aq}function Gq(e){let t=e.buffer,n=e.getUint32();if(e.byteLength!==n)throw Error(`ICC profile length not matching`);if(e.byteLength<Cq)throw Error(`ICC profile too short`);let r={},i=Object.keys(_q);for(let t=0;t<i.length;t++){let n=i[t],a=_q[n],o=a.value(e,parseInt(n,10)),s=o;a.description&&(s=a.description(o)),r[a.name]={value:o,description:s}}if(bq(t.slice(36,40))!==Tq)throw Error(`ICC profile: missing signature`);if(Uq(e))return r;let a=Math.min(e.getUint32(wq),Fq),o=132,s={remaining:Math.min(e.byteLength,Iq)};for(let n=0;n<a;n++){if(Wq(e,o))return r;let n=SR(e,o,4),i=e.getUint32(o+4),a=e.getUint32(o+8);if(i>e.byteLength)return r;let c=SR(e,i,4);if(c===Eq){if(i+jq>e.byteLength)return r;let t=e.getUint32(i+8);if(t>a)return r;qq(r,n,Kq(e,i+12,t-1,s))}else if(c===Dq){if(i+Nq>e.byteLength)return r;let t=e.getUint32(i+8),o=e.getUint32(i+12);if(o<Mq||t>Pq)return r;let c=t*o;if(c>e.byteLength-i-Nq||c>s.remaining)return r;s.remaining-=c;let l=Math.min(a,e.byteLength-i),u=i+Nq,d=[];for(let n=0;n<t;n++){let t=SR(e,u+0,2),n=SR(e,u+2,2),r=e.getUint32(u+4),a=e.getUint32(u+8),c=Math.max(0,l-a),f=Math.min(r,c,s.remaining);s.remaining-=f;let p=wR(e,i+a,f);d.push({languageCode:t,countryCode:n,text:p}),u+=o}if(t===1)qq(r,n,d[0].text);else{let e={};for(let t=0;t<d.length;t++)e[`${d[t].languageCode}-${d[t].countryCode}`]=d[t].text;qq(r,n,e)}}else if(c===Oq){let t=Kq(e,i+8,a-8,s),o=t.indexOf(`\0`);qq(r,n,o===-1?t:t.slice(0,o))}else c===kq&&qq(r,n,bq(t.slice(i+8,i+12)));o+=12}return r}function Kq(e,t,n,r){let i=Math.max(0,Math.min(n,e.byteLength-t,r.remaining));return r.remaining-=i,bq(e.buffer.slice(t,t+i))}function qq(e,t,n){gq[t]?e[gq[t].name]={value:n,description:n}:e[t]={value:n,description:n}}var Jq=27,Yq=22,Xq={read:Zq,SHOT_INFO_AUTO_ROTATE:Jq,CAMERA_SETTINGS_LENS_TYPE:Yq};function Zq(e,t,n,r,i,a=!1,o=void 0){let s=UU(e,rU,t,t+n,r,i,a,o,`makerNotes`);return s.ShotInfo&&(s=jR({},s,Qq(s.ShotInfo.value)),delete s.ShotInfo),s.CameraSettings&&(s=jR({},s,$q(s.CameraSettings.value)),delete s.CameraSettings),s}function Qq(e){let t={};return e[Jq]!==void 0&&(t.AutoRotate={value:e[Jq],description:eJ(e[Jq])}),t}function $q(e){let t={};if(!Array.isArray(e))return t;let n=e[Yq];return Number.isFinite(n)&&(t.LensType={value:n,description:`${n}`}),t}function eJ(e){return e===0?`None`:e===1?`Rotate 90 CW`:e===2?`Rotate 180`:e===3?`Rotate 270 CW`:`Unknown`}var tJ=8,nJ=10,rJ={K3_III:78420},iJ={CAMERA_ORIENTATION:1,ROLL_ANGLE:3,PITCH_ANGLE:5},aJ={read:oJ,PENTAX_IFD_OFFSET:nJ,MODEL_ID:rJ,LIK3III:iJ};function oJ(e,t,n,r,i=!1,a=void 0){try{let o=jz.getByteOrder(e,t+n+tJ),s=t+n,c=UU(e,iU,s,s+nJ,o,r,i,a,`makerNotes`);return sJ(c)&&(c=jR({},c,cJ(e,s+c.LevelInfo.__offset,o)),delete c.LevelInfo),c}catch{return{}}}function sJ(e){return e.PentaxModelID&&e.PentaxModelID.value===rJ.K3_III&&e.LevelInfo}function cJ(e,t,n){let r={};if(t+7>e.byteLength)return r;let i=e.getInt8(t+iJ.CAMERA_ORIENTATION);r.CameraOrientation={value:i,description:lJ(i)};let a=e.getInt16(t+iJ.ROLL_ANGLE,n===jz.LITTLE_ENDIAN);r.RollAngle={value:a,description:uJ(a)};let o=e.getInt16(t+iJ.PITCH_ANGLE,n===jz.LITTLE_ENDIAN);return r.PitchAngle={value:o,description:dJ(o)},r}function lJ(e){return e===0?`Horizontal (normal)`:e===1?`Rotate 270 CW`:e===2?`Rotate 180`:e===3?`Rotate 90 CW`:e===4?`Upwards`:e===5?`Downwards`:`Unknown`}function uJ(e){return``+e*-.5}function dJ(e){return``+e*-.5}var fJ={read:gJ},pJ={0:`Grayscale`,2:`RGB`,3:`Palette`,4:`Grayscale with Alpha`,6:`RGB with Alpha`},mJ={0:`Noninterlaced`,1:`Adam7 Interlace`},hJ=[{name:`Image Width`,offset:0,size:4,read:$.getLongAt,description:e=>`${e}px`},{name:`Image Height`,offset:4,size:4,read:$.getLongAt,description:e=>`${e}px`},{name:`Bit Depth`,offset:8,size:1,read:$.getByteAt,description:e=>`${e}`},{name:`Color Type`,offset:9,size:1,read:$.getByteAt,description:e=>pJ[e]||`Unknown`},{name:`Compression`,offset:10,size:1,read:$.getByteAt,description:e=>e===0?`Deflate/Inflate`:`Unknown`},{name:`Filter`,offset:11,size:1,read:$.getByteAt,description:e=>e===0?`Adaptive`:`Unknown`},{name:`Interlace`,offset:12,size:1,read:$.getByteAt,description:e=>mJ[e]||`Unknown`}];function gJ(e,t){let n={};for(let r=0;r<hJ.length;r++)n[hJ[r].name]=_J(e,t,hJ[r]);return n}function _J(e,t,n){if(t+n.offset+n.size>e.byteLength)return;let r=n.read(e,t+n.offset);return{value:r,description:n.description(r)}}var vJ={read:DJ},yJ=`STATE_KEYWORD`,bJ=`STATE_COMPRESSION`,xJ=`STATE_LANG`,SJ=`STATE_TRANSLATED_KEYWORD`,CJ=`STATE_TEXT`,wJ=1,TJ=1,EJ=6;function DJ(e,t,n,r,i=!1,a=OU,o){let s={},c=[];for(let l=0;l<t.length;l++){let{offset:u,length:d,type:f}=t[l],p=OJ(e,u,d,f,n,o);if(p instanceof Promise)c.push(p.then(({name:e,value:t,description:n})=>{try{if(Q.USE_EXIF&&IJ(e,t))return a.shouldParseGroup(`exif`)?{__exif:aW.read(RJ(t),EJ,r,i,a).tags}:{};if(Q.USE_IPTC&&LJ(e,t))return a.shouldParseGroup(`iptc`)?{__iptc:mG.read(RJ(t),0,r,a)}:{};if(e&&!IJ(e,t)&&!LJ(e,t))return a.shouldParseGroup(`png`)?{[e]:{value:t,description:n}}:{}}catch{}return{}}));else{let{name:e,value:t,description:n}=p;e&&a.shouldParseGroup(`png`)&&(s[e]={value:t,description:n})}}return{readTags:s,readTagsPromise:c.length>0?Promise.all(c):void 0}}function OJ(e,t,n,r,i,a){let o=[],s=[],c=[],l,u=yJ,d,f=e.byteOffset||0;for(let i=0;i<n&&t+i<e.byteLength;i++){if(u===bJ){d=kJ({type:r,dataView:e,offset:t+i}),r===`iTXt`&&(i+=wJ),u=AJ(r,u);continue}if(u===CJ){let r=e.buffer.slice(f+t+i,f+t+n);l=new DataView(new Uint8Array(r).buffer);break}let a=e.getUint8(t+i);a===0?u=AJ(r,u):u===yJ?o.push(a):u===xJ?s.push(a):u===SJ&&c.push(a)}if(d!==void 0&&!i)return{};let p=VR(l,d,jJ(r),`string`,a);return p instanceof Promise?p.then(e=>MJ(e,r,s,o)).catch(()=>MJ(`<text using unknown compression>`.split(``),r,s,o)):MJ(p,r,s,o)}function kJ({type:e,dataView:t,offset:n}){if(e===`iTXt`){if(n+1<t.byteLength&&t.getUint8(n)===TJ)return t.getUint8(n+1)}else if(e===`zTXt`)return t.getUint8(n)}function AJ(e,t){return t===yJ&&[`iTXt`,`zTXt`].includes(e)?bJ:t===bJ?e===`iTXt`?xJ:CJ:t===xJ?SJ:CJ}function jJ(e){return e===`tEXt`||e===`zTXt`?`latin1`:`utf-8`}function MJ(e,t,n,r){let i=PJ(e);return{name:NJ(t,n,r),value:i,description:t===`iTXt`?FJ(e):i}}function NJ(e,t,n){let r=ER(n);return e===`tEXt`||t.length===0?r:`${r} (${ER(t)})`}function PJ(e){return e instanceof DataView?SR(e,0,e.byteLength):e}function FJ(e){return rG.decode(`UTF-8`,e)}function IJ(e,t){return e.toLowerCase()===`raw profile type exif`&&t.substring(1,5)===`exif`}function LJ(e,t){return e.toLowerCase()===`raw profile type iptc`&&t.substring(1,5)===`iptc`}function RJ(e){return zJ(e.match(/\n(exif|iptc)\n\s*\d+\n([\s\S]*)$/)[2].replace(/\n/g,``))}function zJ(e){let t=new DataView(new ArrayBuffer(e.length/2));for(let n=0;n<e.length;n+=2)t.setUint8(n/2,parseInt(e.substring(n,n+2),16));return t}var BJ={read:VJ};function VJ(e,t){let n={};for(let r=0;r<t.length;r++){let i=$.getLongAt(e,t[r]+0),a=SR(e,t[r]+4,4);a===`pHYs`?(n[`Pixels Per Unit X`]=HJ(e,t[r],i),n[`Pixels Per Unit Y`]=UJ(e,t[r],i),n[`Pixel Units`]=WJ(e,t[r],i)):a===`tIME`&&(n[`Modify Date`]=GJ(e,t[r],i))}return n}function HJ(e,t,n){if(!KJ(e,t,n,0,4))return;let r=$.getLongAt(e,t+8+0);return{value:r,description:``+r}}function UJ(e,t,n){if(!KJ(e,t,n,4,4))return;let r=$.getLongAt(e,t+8+4);return{value:r,description:``+r}}function WJ(e,t,n){if(!KJ(e,t,n,8,1))return;let r=$.getByteAt(e,t+8+8);return{value:r,description:r===1?`meters`:`Unknown`}}function GJ(e,t,n){if(!KJ(e,t,n,0,7))return;let r=$.getShortAt(e,t+8),i=$.getByteAt(e,t+8+2),a=$.getByteAt(e,t+8+3),o=$.getByteAt(e,t+8+4),s=$.getByteAt(e,t+8+5),c=$.getByteAt(e,t+8+6);return{value:[r,i,a,o,s,c],description:`${qJ(r,4)}-${qJ(i,2)}-${qJ(a,2)} ${qJ(o,2)}:${qJ(s,2)}:${qJ(c,2)}`}}function KJ(e,t,n,r,i){return r+i<=n&&t+8+r+i<=e.byteLength}function qJ(e,t){return IR(``+e,t,`0`)}var JJ={read:QJ},YJ=4,XJ=7,ZJ=10;function QJ(e,t){let n={};if(t+ZJ>e.byteLength)return n;let r=$.getByteAt(e,t);return n.Alpha=$J(r),n.Animation=eY(r),n.ImageWidth=tY(e,t+YJ),n.ImageHeight=tY(e,t+XJ),n}function $J(e){let t=e&16;return{value:+!!t,description:t?`Yes`:`No`}}function eY(e){let t=e&2;return{value:+!!t,description:t?`Yes`:`No`}}function tY(e,t){let n=$.getByteAt(e,t)+256*$.getByteAt(e,t+1)+65536*$.getByteAt(e,t+2)+1;return{value:n,description:n+`px`}}var nY={read:aY},rY=e=>`${e} ${e===1?`bit`:`bits`}`,iY=[{name:`GIF Version`,offset:3,size:3,getValue:(e,t)=>SR(e,t,3),description:e=>e},{name:`Image Width`,offset:6,size:2,getValue:(e,t)=>e.getUint16(t,!0),description:e=>`${e}px`},{name:`Image Height`,offset:8,size:2,getValue:(e,t)=>e.getUint16(t,!0),description:e=>`${e}px`},{name:`Global Color Map`,offset:10,size:1,getValue:(e,t)=>(e.getUint8(t)&128)>>>7,description:e=>e===1?`Yes`:`No`},{name:`Bits Per Pixel`,offset:10,size:1,getValue:(e,t)=>(e.getUint8(t)&7)+1,description:rY},{name:`Color Resolution Depth`,offset:10,size:1,getValue:(e,t)=>((e.getUint8(t)&112)>>>4)+1,description:rY}];function aY(e){let t={};for(let n=0;n<iY.length;n++)t[iY[n].name]=oY(e,iY[n]);return t}function oY(e,t){if(t.offset+t.size>e.byteLength)return;let n=t.getValue(e,t.offset);return{value:n,description:t.description(n)}}var sY=[6,7,99],cY={get:lY};function lY(e,t,n){if(uY(t)){let r=n+t.JPEGInterchangeFormat.value,i=t.JPEGInterchangeFormatLength.value;if(dY(e,r,i)){t.type=`image/jpeg`;let n=e.byteOffset||0;t.image=e.buffer.slice(n+r,n+r+i),NR(t,`base64`,function(){return PR(this.image)})}}return t}function uY(e){return e&&(e.Compression===void 0||sY.includes(e.Compression.value))&&e.JPEGInterchangeFormat&&e.JPEGInterchangeFormat.value&&e.JPEGInterchangeFormatLength&&e.JPEGInterchangeFormatLength.value}function dY(e,t,n){return fY(t)&&fY(n)&&t+n<=e.byteLength}function fY(e){return typeof e==`number`&&e>=0&&e%1==0}var pY={INCHES:2,CENTIMETERS:3,MILLIMETERS:4},mY={INCHES_TO_MM:25.4,CM_TO_MM:10,MM_TO_MM:1},hY={get:gY};function gY(e,t){let n={},r=!1,i=_Y(e,`exif`,`FocalLength`,t),a=_Y(e,`exif`,`FocalPlaneXResolution`,t),o=_Y(e,`exif`,`FocalPlaneYResolution`,t),s=_Y(e,`exif`,`FocalPlaneResolutionUnit`,t),c=_Y(e,`file`,`Image Width`,t),l=_Y(e,`file`,`Image Height`,t),u=_Y(e,`exif`,`FocalLengthIn35mmFilm`,t)||vY(a,o,s,c,l,i);u&&(n.FocalLength35efl={value:u,description:GH.FocalLengthIn35mmFilm(u)},r=!0);let d=yY(i,u);d&&(n.ScaleFactorTo35mmEquivalent=d,r=!0);let f=bY(u);if(f&&(n.FieldOfView=f,r=!0),r)return n}function _Y(e,t,n,r){if(r&&e[t]&&e[t][n])return e[t][n].value;if(!r&&e[n])return e[n].value}function vY(e,t,n,r,i,a){if(e&&t&&n&&r&&i&&a)try{let o;switch(n){case pY.INCHES:o=mY.INCHES_TO_MM;break;case pY.CENTIMETERS:o=mY.CM_TO_MM;break;case pY.MILLIMETERS:o=mY.MM_TO_MM;break;default:return}let s=e[0]/e[1]*o,c=t[0]/t[1]*o,l=r/s,u=i/c,d=Math.sqrt(l**2+u**2);return a[0]/a[1]*(43.27/d)}catch{}}function yY(e,t){if(e&&t)try{let n=t/(e[0]/e[1]);return{value:n,description:n.toFixed(1)}}catch{}}function bY(e){if(e)try{let t=2*Math.atan(36/(2*e))*(180/Math.PI);return{value:t,description:t.toFixed(1)+` deg`}}catch{}}function xY({mergeSteps:e,deferredResults:t,parsedGroups:n,expanded:r,tagFilter:i,dataView:a,tiffHeaderOffset:o,exifDataView:s,fileType:c,pngTextChunks:l,pngTextIsAsync:u,thumbnailIfdTags:d,deps:f}){let p={};for(let l=0;l<e.length;l++)p=SY({step:e[l],deferredResults:t,parsedGroups:n,expanded:r,tagFilter:i,dataView:a,tiffHeaderOffset:o,exifDataView:s,fileType:c,thumbnailIfdTags:d,tags:p,deps:f});return Q.USE_PNG&&r&&u&&i.shouldReturnGroup(`png`)&&p.png&&(p.pngText=f.objectAssign({},p.png)),Q.USE_PNG&&r&&i.shouldReturnGroup(`png`)&&f.hasPngTextData(l)&&p.png&&!p.pngText&&(p.pngText=f.objectAssign({},p.png)),p}function SY({step:e,deferredResults:t,parsedGroups:n,expanded:r,tagFilter:i,dataView:a,tiffHeaderOffset:o,exifDataView:s,fileType:c,thumbnailIfdTags:l,tags:u,deps:d}){if(e.type===`mergeGroupAssign`){let t=d.filterTagsForReturn(e.groupKey,e.parsedTags,i);return CY(u,e.groupKey,t,r,d)}if(e.type===`mergeGroupMerge`){let t=d.filterTagsForReturn(e.groupKey,e.parsedTags,i);return TY(u,e.groupKey,t,r,d)}if(Q.USE_XMP&&e.type===`mergeXmpGroupAssign`){let t=d.filterTagsForReturn(`xmp`,e.parsedTags,i);return wY(u,t,r,d)}if(Q.USE_ICC&&e.type===`mergeIccDeferred`){let a=t[e.deferredKey],o=d.filterTagsForParse(`icc`,a,i);if(n.icc=o,!i.shouldReturnGroup(`icc`))return u;let s=d.filterTagsForReturn(`icc`,o,i);return CY(u,`icc`,s,r,d)}if(Q.USE_JXL&&e.type===`mergeBrobExifDeferred`){let a=t[e.deferredKey];if(!a||Object.keys(a).length===0)return u;let o=d.filterTagsForParse(`exif`,a,i);if(n.exif=n.exif?d.objectAssign({},n.exif,o):o,!i.shouldReturnGroup(`exif`))return u;let s=d.filterTagsForReturn(`exif`,o,i);return CY(u,`exif`,s,r,d)}if(Q.USE_JXL&&e.type===`mergeBrobXmpDeferred`){let a=t[e.deferredKey];if(!a||Object.keys(a).length===0)return u;let o=d.filterTagsForParse(`xmp`,a,i);if(n.xmp=o,!i.shouldReturnGroup(`xmp`))return u;let s=d.filterTagsForReturn(`xmp`,o,i);return wY(u,s,r,d)}if(Q.USE_PNG&&e.type===`mergePngFile`){let t=d.filterTagsForReturn(`png`,e.parsedTags,i);return i.shouldReturnGroup(`png`)?r?(u.png=u.png?d.objectAssign({},u.png,t):t,u.pngFile=t,u):d.objectAssign({},u,t):u}if(Q.USE_PNG&&e.type===`mergePngChunk`){let t=d.filterTagsForReturn(`png`,e.parsedTags,i);return i.shouldReturnGroup(`png`)?r?(u.png=u.png?d.objectAssign({},u.png,t):t,u):d.objectAssign({},u,t):u}if(Q.USE_PNG&&e.type===`processPngTextReadTags`)return EY({readTags:e.readTags,parsedGroups:n,expanded:r,tagFilter:i,tags:u,deps:d});if(Q.USE_PNG&&e.type===`processPngTextReadTagsDeferredList`){let a=t[e.deferredKey]||[];for(let e=0;e<a.length;e++)u=EY({readTags:a[e],parsedGroups:n,expanded:r,tagFilter:i,tags:u,deps:d});return u}if(Q.USE_EXIF&&e.type===`gps`){if(r&&i.shouldReturnGroup(`gps`)&&n.exif){let e=d.getGpsGroupFromExifTags(n.exif);if(e){let t=d.filterTagsForReturn(`gps`,e,i);u.gps=t}}return u}if((Q.USE_EXIF||Q.USE_XMP)&&e.type===`composite`){if(!i.shouldReturnGroup(`composite`))return u;let e=u,t=r;i.isActive&&(e={exif:n.exif,file:n.file},t=!0);let a=d.Composite.get(e,t);if(!a)return u;let o=d.filterTagsForReturn(`composite`,a,i);return CY(u,`composite`,o,r,d)}if(e.type===`thumbnail`){if(!i.shouldReturnGroup(`thumbnail`)||!i.shouldReturnTag(`thumbnail`,`Thumbnail`))return delete u.Thumbnail,u;if(!l)return u;let e=d.filterTagsForParse(`thumbnail`,l,i),t=Q.USE_EXIF&&Q.USE_THUMBNAIL&&d.Thumbnail.get(s||a,e,o);return t?u.Thumbnail=t:delete u.Thumbnail,u}if(e.type===`metadataRange`){if(!r)return u;let t=OY(e.metadataBlocks,e.metadataTruncated,a,n);return t&&(u.metadataRange=t),u}return e.type===`fileType`&&c&&i.shouldReturnGroup(`file`)&&i.shouldReturnTag(`file`,`FileType`)&&(r?(u.file||(u.file={}),u.file.FileType=c):u.FileType=c),u}function CY(e,t,n,r,i){return r?(e[t]=n,e):i.objectAssign({},e,n)}function wY(e,t,n,r){if(n)return e.xmp=t,e;let i=r.objectAssign({},t);return delete i._raw,r.objectAssign({},e,i)}function TY(e,t,n,r,i){return r?(e[t]=e[t]?i.objectAssign({},e[t],n):n,e):i.objectAssign({},e,n)}function EY({readTags:e,parsedGroups:t,expanded:n,tagFilter:r,tags:i,deps:a}){let o=e.__exif,s=e.__iptc;if(delete e.__exif,delete e.__iptc,o){let e=a.filterTagsForParse(`exif`,o,r);if(t.exif=t.exif?a.objectAssign({},t.exif,e):e,r.shouldReturnGroup(`exif`)){let t=a.filterTagsForReturn(`exif`,e,r);if(n)i.exif=i.exif?a.objectAssign({},i.exif,t):t;else{let e=a.objectAssign({},t);delete e.Thumbnail,i=a.objectAssign({},i,e)}}}if(s){let e=a.filterTagsForParse(`iptc`,s,r);if(t.iptc=t.iptc?a.objectAssign({},t.iptc,e):e,r.shouldReturnGroup(`iptc`)){let t=a.filterTagsForReturn(`iptc`,e,r);n?i.iptc=i.iptc?a.objectAssign({},i.iptc,t):t:i=a.objectAssign({},i,t)}}if(r.shouldReturnGroup(`png`)){let o=a.filterTagsForParse(`png`,e,r),s=a.filterTagsForReturn(`png`,o,r);t.pngText=o,n?(i.png=i.png?a.objectAssign({},i.png,s):s,s&&Object.keys(s).length>0&&(i.pngText=i.pngText?a.objectAssign({},i.pngText,s):s)):i=a.objectAssign({},i,s)}return i}function DY(e){return!!e&&typeof e.then==`function`}function OY(e,t,n,r){let i=(e||[]).slice(),a=!!t;if(r&&r.mpf&&Array.isArray(r.mpf.Images))for(let e=0;e<r.mpf.Images.length;e++){let t=r.mpf.Images[e];if(!t||!t.ImageOffset||!t.ImageSize)continue;let n=t.ImageOffset.value,a=t.ImageSize.value;typeof n!=`number`||n<=0||typeof a!=`number`||a<=0||i.push({type:`mpfImage`,start:n,end:n+a})}if(i.length===0)return;i.sort((e,t)=>e.start-t.start);let o=i[0].start,s=i[0].end;for(let e=1;e<i.length;e++)i[e].end>s&&(s=i[e].end);let c=n&&typeof n.byteLength==`number`?n.byteLength:0;return{start:o,end:s,complete:!a&&s<=c,blocks:i}}function kY(e){this.name=`MetadataMissingError`,this.message=e||`No Exif data`,this.stack=Error().stack}kY.prototype=Error();var AY={MetadataMissingError:kY},jY={load:MY,loadView:FY,errors:AY};function MY(e,t={}){if(t.length===`auto`)return yz(t),bz(NY)(e,t);if(JR(e)||YR(e)){AR();let n=JR(e)?ZR:QR,r=jR({},t,{async:!0});return n(e,r).then(e=>NY(e,r))}return NY(e,t)}function NY(e,t){return PY(e)&&(e=new Uint8Array(e).buffer),FY(xR(e),t)}function PY(e){try{return Buffer.isBuffer(e)}catch{return!1}}function FY(e,{expanded:t=!1,async:n=!1,computed:r=!1,includeUnknown:i=!1,includeOffsets:a=!1,domParser:o=void 0,includeTags:s=void 0,excludeTags:c=void 0,decompress:l=void 0}={}){e=IY(e);let u=EU({includeTags:s,excludeTags:c}),d=Object.create(null),f=[],p=Object.create(null),m=[],h=!1,g,_,{fileType:v,fileDataOffset:y,jfifDataOffset:b,tiffHeaderOffset:x,iptcDataOffset:S,xmpChunks:C,iccChunks:w,mpfDataOffset:T,pngHeaderOffset:E,pngTextChunks:D,pngChunkOffsets:O,vp8xChunkOffset:k,gifHeaderOffset:A,brobExifChunk:j,brobXmpChunk:M,jxlCodestreamOffset:N,metadataBlocks:P,metadataTruncated:F,exifDataView:I,xmpDataView:L}=HH.parseAppMarkers(e,n,t&&a),R=WY({fileType:v,fileDataOffset:y,jfifDataOffset:b,tiffHeaderOffset:x,iptcDataOffset:S,xmpChunks:C,iccChunks:w,mpfDataOffset:T,pngHeaderOffset:E,pngTextChunks:D,pngChunkOffsets:O,vp8xChunkOffset:k,gifHeaderOffset:A,jxlCodestreamOffset:N});if(Q.USE_JPEG&&Q.USE_FILE&&y!==void 0&&u.shouldParseGroup(`file`)&&ee(s)){let t=VY(`file`,bW.read(e,y),u);d.file=t,u.shouldReturnGroup(`file`)&&f.push({type:`mergeGroupAssign`,groupKey:`file`,parsedTags:t})}if(Q.USE_JPEG&&Q.USE_JFIF&&b!==void 0&&u.shouldParseGroup(`jfif`)){let t=VY(`jfif`,RW.read(e,b),u);d.jfif=t,u.shouldReturnGroup(`jfif`)&&f.push({type:`mergeGroupAssign`,groupKey:`jfif`,parsedTags:t})}if(Q.USE_EXIF&&x!==void 0&&u.shouldParseGroup(`exif`)){let{tags:n,byteOrder:a}=BY(I||e,x,i,r,u);n.Thumbnail&&(g=n.Thumbnail,delete n.Thumbnail);let s=VY(`exif`,n,u);if(d.exif=s,Q.USE_IPTC&&s[`IPTC-NAA`]&&S===void 0&&u.shouldParseGroup(`iptc`)){let e=VY(`iptc`,mG.read(s[`IPTC-NAA`].value,0,i,u),u);d.iptc=e,u.shouldReturnGroup(`iptc`)&&f.push({type:`mergeGroupAssign`,groupKey:`iptc`,parsedTags:e})}if(Q.USE_XMP&&s.ApplicationNotes&&Array.isArray(s.ApplicationNotes.value)&&!KY(C)&&u.shouldParseGroup(`xmp`)){let e=VY(`xmp`,QG.read(ER(s.ApplicationNotes.value),void 0,o),u);if(d.xmp=e,u.shouldReturnGroup(`xmp`)){let n={type:`mergeXmpGroupAssign`,parsedTags:e};t?f.push(n):_=n}}if(Q.USE_PHOTOSHOP&&s.ImageSourceData&&s.PhotoshopSettings&&Array.isArray(s.PhotoshopSettings.value)&&u.shouldParseGroup(`photoshop`)){let e=VY(`photoshop`,sq.read(s.PhotoshopSettings.value,i,u),u);d.photoshop=e,u.shouldReturnGroup(`photoshop`)&&f.push({type:`mergeGroupAssign`,groupKey:`photoshop`,parsedTags:e})}if(Q.USE_ICC&&s.ICC_Profile&&!qY(w)&&u.shouldParseGroup(`icc`)){let e=VY(`icc`,Sq.read(s.ICC_Profile.value,[{offset:0,length:s.ICC_Profile.value.length,chunkNumber:1,chunksTotal:1}]),u);d.icc=e,u.shouldReturnGroup(`icc`)&&f.push({type:`mergeGroupAssign`,groupKey:`icc`,parsedTags:e})}if(Q.USE_MAKER_NOTES&&s.MakerNote&&u.shouldParseGroup(`makerNotes`)){if(JY(s)){let t=Xq.read(I||e,x,s.MakerNote.__offset,a,i,r,u);d.makerNotes=t,u.shouldReturnGroup(`makerNotes`)&&f.push({type:`mergeGroupAssign`,groupKey:`makerNotes`,parsedTags:t})}else if(YY(s)){let t=aJ.read(I||e,x,s.MakerNote.__offset,i,r,u);d.makerNotes=t,u.shouldReturnGroup(`makerNotes`)&&f.push({type:`mergeGroupAssign`,groupKey:`makerNotes`,parsedTags:t})}}s.MakerNote&&delete s.MakerNote.__offset,u.shouldReturnGroup(`exif`)&&f.push({type:`mergeGroupAssign`,groupKey:`exif`,parsedTags:s}),!t&&_&&(f.push(_),_=void 0)}if(Q.USE_JPEG&&Q.USE_IPTC&&S!==void 0&&u.shouldParseGroup(`iptc`)){let t=VY(`iptc`,mG.read(e,S,i,u),u);d.iptc=t,u.shouldReturnGroup(`iptc`)&&f.push({type:`mergeGroupAssign`,groupKey:`iptc`,parsedTags:t})}if(Q.USE_XMP&&KY(C)&&u.shouldParseGroup(`xmp`)){let t=VY(`xmp`,QG.read(L||e,C,o),u);d.xmp=t,u.shouldReturnGroup(`xmp`)&&f.push({type:`mergeXmpGroupAssign`,parsedTags:t})}if(Q.USE_JXL&&Q.USE_EXIF&&j&&x===void 0&&u.shouldParseGroup(`exif`)&&n){let t=zY(e,j);m.push(VR(t,zR,void 0,`dataview`,l).then(e=>{let t=yB(e,0),{tags:n}=aW.read(e,t,i,r,u);n.Thumbnail&&delete n.Thumbnail,p.brobExif=n}).catch(()=>{p.brobExif={}})),f.push({type:`mergeBrobExifDeferred`,deferredKey:`brobExif`})}if(Q.USE_JXL&&Q.USE_XMP&&M&&!KY(C)&&u.shouldParseGroup(`xmp`)&&n){let t=zY(e,M);m.push(VR(t,zR,void 0,`dataview`,l).then(e=>{p.brobXmp=QG.read(e,[{dataOffset:0,length:e.byteLength}],o)}).catch(()=>{p.brobXmp={}})),f.push({type:`mergeBrobXmpDeferred`,deferredKey:`brobXmp`})}if(Q.USE_ICC&&qY(w)&&u.shouldParseGroup(`icc`)){let t=Sq.read(e,w,n,l);if(DY(t)){if(!n)throw Error(`Promise is required when async mode is enabled.`);m.push(t.then(e=>{p.iccApp=e})),f.push({type:`mergeIccDeferred`,deferredKey:`iccApp`})}else{let e=VY(`icc`,t,u);d.icc=e,u.shouldReturnGroup(`icc`)&&f.push({type:`mergeGroupAssign`,groupKey:`icc`,parsedTags:e})}}if(Q.USE_MPF&&T!==void 0&&u.shouldParseGroup(`mpf`)){let t=VY(`mpf`,lW.read(e,T,i,r,u),u);d.mpf=t,u.shouldReturnGroup(`mpf`)&&f.push({type:`mergeGroupAssign`,groupKey:`mpf`,parsedTags:t})}if(Q.USE_PNG&&Q.USE_PNG_FILE&&E!==void 0&&u.shouldParseGroup(`png`)){let t=VY(`png`,fJ.read(e,E),u);d.pngFile=t,u.shouldReturnGroup(`png`)&&f.push({type:`mergePngFile`,parsedTags:t})}if(Q.USE_PNG&&XY(D)&&(u.shouldParseGroup(`png`)||u.shouldParseGroup(`exif`)||u.shouldParseGroup(`iptc`))){let{readTags:t,readTagsPromise:a}=vJ.read(e,D,n,i,r,u,l);h=!!a,f.push({type:`processPngTextReadTags`,readTags:t}),a&&(m.push(a.then(e=>{p.pngTextTagList=e})),f.push({type:`processPngTextReadTagsDeferredList`,deferredKey:`pngTextTagList`}))}if(Q.USE_PNG&&O!==void 0&&u.shouldParseGroup(`png`)){let t=VY(`png`,BJ.read(e,O),u);d.pngChunk=t,u.shouldReturnGroup(`png`)&&f.push({type:`mergePngChunk`,parsedTags:t})}if(Q.USE_WEBP&&k!==void 0&&u.shouldParseGroup(`riff`)){let t=VY(`riff`,JJ.read(e,k),u);d.riff=t,u.shouldReturnGroup(`riff`)&&f.push({type:`mergeGroupMerge`,groupKey:`riff`,parsedTags:t})}if(Q.USE_GIF&&A!==void 0&&u.shouldParseGroup(`gif`)){let t=VY(`gif`,nY.read(e,A),u);d.gif=t,u.shouldReturnGroup(`gif`)&&f.push({type:`mergeGroupMerge`,groupKey:`gif`,parsedTags:t})}if(Q.USE_JXL&&N!==void 0&&u.shouldParseGroup(`file`)){let t=VY(`file`,AW.read(e,N),u);d.file=t,u.shouldReturnGroup(`file`)&&f.push({type:`mergeGroupAssign`,groupKey:`file`,parsedTags:t})}if(Q.USE_EXIF&&f.push({type:`gps`}),(Q.USE_EXIF||Q.USE_XMP)&&f.push({type:`composite`}),f.push({type:`thumbnail`}),f.push({type:`fileType`}),t&&a&&f.push({type:`metadataRange`,metadataBlocks:P,metadataTruncated:!!F}),!R)throw new AY.MetadataMissingError;let z={objectAssign:jR,hasPngTextData:XY,filterTagsForParse:VY,filterTagsForReturn:HY,getGpsGroupFromExifTags:Q.USE_EXIF?GY:void 0,Composite:Q.USE_EXIF||Q.USE_XMP?hY:void 0,Thumbnail:cY};if(n)return AR(),Promise.all(m).then(()=>xY({mergeSteps:f,deferredResults:p,parsedGroups:d,expanded:t,tagFilter:u,dataView:e,tiffHeaderOffset:x,exifDataView:I,fileType:v,pngTextChunks:D,pngTextIsAsync:h,thumbnailIfdTags:g,deps:z}));return xY({mergeSteps:f,deferredResults:p,parsedGroups:d,expanded:t,tagFilter:u,dataView:e,tiffHeaderOffset:x,exifDataView:I,fileType:v,pngTextChunks:D,pngTextIsAsync:h,thumbnailIfdTags:g,deps:z});function ee(e){if(!e)return!0;let{composite:t,file:n}=e;return t===!0||Array.isArray(t)&&t.length>0?!0:!(Array.isArray(n)&&n.length===1&&n[0]===`FileType`)}}function IY(e){return LY(e)?xR(e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength)):e}function LY(e){return RY(e)&&(e.byteOffset>0||e.byteLength<e.buffer.byteLength)}function RY(e){return!!e&&typeof e.getUint8==`function`&&typeof e.byteOffset==`number`&&typeof e.byteLength==`number`&&!!e.buffer&&typeof e.buffer.slice==`function`}function zY(e,t){let n=Math.max(0,Math.min(t.length,e.byteLength-t.dataOffset));return new DataView(e.buffer,e.byteOffset+t.dataOffset,n)}function BY(e,t,n,r,i){try{return aW.read(e,t,n,r,i)}catch{return{tags:{},byteOrder:jz.BIG_ENDIAN}}}function VY(e,t,n){return n.isActive?UY(e,t,n.shouldParseTag):t}function HY(e,t,n){return n.isActive?UY(e,t,n.shouldReturnTag):t}function UY(e,t,n){if(!t)return t;let r={};for(let a in t){let o=t[a];n(e,a,i(o))&&(r[a]=o)}return r;function i(e){if(e)return Array.isArray(e)?e.length===0?void 0:e[0].id:e.id}}function WY({fileType:e,fileDataOffset:t,jfifDataOffset:n,tiffHeaderOffset:r,iptcDataOffset:i,xmpChunks:a,iccChunks:o,mpfDataOffset:s,pngHeaderOffset:c,pngTextChunks:l,pngChunkOffsets:u,vp8xChunkOffset:d,gifHeaderOffset:f,jxlCodestreamOffset:p}){return!!e||Q.USE_JPEG&&Q.USE_FILE&&t!==void 0||Q.USE_JPEG&&Q.USE_JFIF&&n!==void 0||Q.USE_EXIF&&r!==void 0||Q.USE_JPEG&&Q.USE_IPTC&&i!==void 0||Q.USE_XMP&&KY(a)||Q.USE_ICC&&qY(o)||Q.USE_MPF&&s!==void 0||Q.USE_PNG&&Q.USE_PNG_FILE&&c!==void 0||Q.USE_PNG&&XY(l)||Q.USE_PNG&&u!==void 0||Q.USE_WEBP&&d!==void 0||Q.USE_GIF&&f!==void 0||Q.USE_JXL&&p!==void 0}function GY(e){let t;if(e.GPSLatitude&&e.GPSLatitudeRef){t||={};try{t.Latitude=Oz(e.GPSLatitude.value),e.GPSLatitudeRef.value.join(``)===`S`&&(t.Latitude=-t.Latitude)}catch{}}if(e.GPSLongitude&&e.GPSLongitudeRef){t||={};try{t.Longitude=Oz(e.GPSLongitude.value),e.GPSLongitudeRef.value.join(``)===`W`&&(t.Longitude=-t.Longitude)}catch{}}if(e.GPSAltitude&&e.GPSAltitudeRef){t||={};try{t.Altitude=e.GPSAltitude.value[0]/e.GPSAltitude.value[1],e.GPSAltitudeRef.value===1&&(t.Altitude=-t.Altitude)}catch{}}if(t)return t}function KY(e){return Array.isArray(e)&&e.length>0}function qY(e){return Array.isArray(e)&&e.length>0}function JY(e){return e.Make&&e.Make.value&&Array.isArray(e.Make.value)&&e.Make.value[0]===`Canon`&&e.MakerNote&&e.MakerNote.__offset}function YY(e){return Array.isArray(e.MakerNote.value)&&e.MakerNote.value.length>7&&ER(e.MakerNote.value.slice(0,7))===`PENTAX `&&e.MakerNote.__offset}function XY(e){return Array.isArray(e)&&e.length>0}var ZY=new Uint8Array([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,14,14,15,15,16,16,17,17,18,18]);new Uint32Array([1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,32769,49153,65537,98305,131073,196609,262145,393217,524289,786433])[39]+(1<<ZY[39])-1;var QY=new Uint8Array([24,7,23,25,40,6,39,41,22,26,38,42,56,5,55,57,21,27,54,58,37,43,72,4,71,73,20,28,53,59,70,74,36,44,88,69,75,52,60,3,87,89,19,29,86,90,35,45,68,76,85,91,51,61,104,2,103,105,18,30,102,106,34,46,84,92,67,77,101,107,50,62,120,1,119,121,83,93,17,31,100,108,66,78,118,122,33,47,117,123,49,63,99,109,82,94,0,116,124,65,79,16,32,98,110,48,115,125,81,95,64,114,126,97,111,80,113,127,96,112]);(()=>{let e=new Map;for(let t=0;t<120;t++)e.set(QY[t],t+1);return e})(),new Int32Array([17,18,0,1,2,3,4,5,16,6,7,8,9,10,11,12,13,14,15]);var $Y=new Uint8Array([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10]);new Uint16Array([1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073])[23]+(1<<$Y[23])-1;function eX(e){if(e.length<12)throw Error(`Invalid RIFF file: shorter than 12-byte container header`);let t=new DataView(e.buffer,e.byteOffset,e.byteLength);if(e[0]!==82||e[1]!==73||e[2]!==70||e[3]!==70)throw Error(`Invalid RIFF file: missing RIFF signature`);if(e[8]!==87||e[9]!==69||e[10]!==66||e[11]!==80)throw Error(`Invalid WebP file: missing WEBP signature`);let n=[],r=12;for(;r+8<=e.length;){let i=String.fromCharCode(e[r],e[r+1],e[r+2],e[r+3]),a=t.getUint32(r+4,!0),o=r+8,s=Math.min(o+a,e.length);n.push({fourCC:i,size:a,data:e.subarray(o,s),offset:o});let c=a+(a&1),l=r+8+c;if(l<=r)break;r=l}return n}function tX(e){let t=4;for(let n of e){let e=n.data.length+(n.data.length&1);t+=8+e}let n=new Uint8Array(8+t),r=new DataView(n.buffer);n[0]=82,n[1]=73,n[2]=70,n[3]=70,r.setUint32(4,t,!0),n[8]=87,n[9]=69,n[10]=66,n[11]=80;let i=12;for(let t of e){n[i]=t.fourCC.charCodeAt(0),n[i+1]=t.fourCC.charCodeAt(1),n[i+2]=t.fourCC.charCodeAt(2),n[i+3]=t.fourCC.charCodeAt(3),r.setUint32(i+4,t.data.length,!0),n.set(t.data,i+8);let e=t.data.length+(t.data.length&1);i+=8+e}return n}new Uint8Array([0,1,2,3,6,4,5,6,6,6,6,6,6,6,6,7,0]),new Uint8Array([0,1,4,8,5,2,3,6,9,12,13,10,7,11,14,15]),new Uint8Array([173,148,140,0]),new Uint8Array([176,155,140,135,0]),new Uint8Array([180,157,141,134,130,0]),new Uint8Array([254,254,243,230,196,177,153,140,133,130,129,0]),(()=>{let e=new Uint8Array(1056),t=[[[[128,128,128,128,128,128,128,128,128,128,128],[128,128,128,128,128,128,128,128,128,128,128],[128,128,128,128,128,128,128,128,128,128,128]],[[253,136,254,255,228,219,128,128,128,128,128],[189,129,242,255,227,213,255,219,128,128,128],[106,126,227,252,214,209,255,255,128,128,128]],[[1,98,248,255,236,226,255,255,128,128,128],[181,133,238,254,221,234,255,154,128,128,128],[78,134,202,247,198,180,255,219,128,128,128]],[[1,185,249,255,243,255,128,128,128,128,128],[184,150,247,255,236,224,128,128,128,128,128],[77,110,216,255,236,230,128,128,128,128,128]],[[1,101,251,255,241,255,128,128,128,128,128],[170,139,241,252,236,209,255,255,128,128,128],[37,116,196,243,228,255,255,255,128,128,128]],[[1,204,254,255,245,255,128,128,128,128,128],[207,160,250,255,238,128,128,128,128,128,128],[102,103,231,255,211,171,128,128,128,128,128]],[[1,152,252,255,240,255,128,128,128,128,128],[177,135,243,255,234,225,128,128,128,128,128],[80,129,211,255,194,224,128,128,128,128,128]],[[1,1,255,128,128,128,128,128,128,128,128],[246,1,255,128,128,128,128,128,128,128,128],[255,128,128,128,128,128,128,128,128,128,128]]],[[[198,35,237,223,193,187,162,160,145,155,62],[131,45,198,221,172,176,220,157,252,221,1],[68,47,146,208,149,167,221,162,255,223,128]],[[1,149,241,255,221,224,255,255,128,128,128],[184,141,234,253,222,220,255,199,128,128,128],[81,99,181,242,176,190,249,202,255,255,128]],[[1,129,232,253,214,197,242,196,255,255,128],[99,121,210,250,201,198,255,202,128,128,128],[23,91,163,242,170,187,247,210,255,255,128]],[[1,200,246,255,234,255,128,128,128,128,128],[109,178,241,255,231,245,255,255,128,128,128],[44,130,201,253,205,192,255,255,128,128,128]],[[1,132,239,251,219,209,255,165,128,128,128],[94,136,225,251,218,190,255,255,128,128,128],[22,100,174,245,186,161,255,199,128,128,128]],[[1,182,249,255,232,235,128,128,128,128,128],[124,143,241,255,227,234,128,128,128,128,128],[35,77,181,251,193,211,255,205,128,128,128]],[[1,157,247,255,236,231,255,255,128,128,128],[121,141,235,255,225,227,255,255,128,128,128],[45,99,188,251,195,217,255,224,128,128,128]],[[1,1,251,255,213,255,128,128,128,128,128],[203,1,248,255,255,128,128,128,128,128,128],[137,1,177,255,224,255,128,128,128,128,128]]],[[[253,9,248,251,207,208,255,192,128,128,128],[175,13,224,243,193,185,249,198,255,255,128],[73,17,171,221,161,179,236,167,255,234,128]],[[1,95,247,253,212,183,255,255,128,128,128],[239,90,244,250,211,209,255,255,128,128,128],[155,77,195,248,188,195,255,255,128,128,128]],[[1,24,239,251,218,219,255,205,128,128,128],[201,51,219,255,196,186,128,128,128,128,128],[69,46,190,239,201,218,255,228,128,128,128]],[[1,191,251,255,255,128,128,128,128,128,128],[223,165,249,255,213,255,128,128,128,128,128],[141,124,248,255,255,128,128,128,128,128,128]],[[1,16,248,255,255,128,128,128,128,128,128],[190,36,230,255,236,255,128,128,128,128,128],[149,1,255,128,128,128,128,128,128,128,128]],[[1,226,255,128,128,128,128,128,128,128,128],[247,192,255,128,128,128,128,128,128,128,128],[240,128,255,128,128,128,128,128,128,128,128]],[[1,134,252,255,255,128,128,128,128,128,128],[213,62,250,255,255,128,128,128,128,128,128],[55,93,255,128,128,128,128,128,128,128,128]],[[128,128,128,128,128,128,128,128,128,128,128],[128,128,128,128,128,128,128,128,128,128,128],[128,128,128,128,128,128,128,128,128,128,128]]],[[[202,24,213,235,186,191,220,160,240,175,255],[126,38,182,232,169,184,228,174,255,187,128],[61,46,138,219,151,178,240,170,255,216,128]],[[1,112,230,250,199,191,247,159,255,255,128],[166,109,228,252,211,215,255,174,128,128,128],[39,77,162,232,172,180,245,178,255,255,128]],[[1,52,220,246,198,199,249,220,255,255,128],[124,74,191,243,183,193,250,221,255,255,128],[24,71,130,219,154,170,243,182,255,255,128]],[[1,182,225,249,219,240,255,224,128,128,128],[149,150,226,252,216,205,255,171,128,128,128],[28,108,170,242,183,194,254,223,255,255,128]],[[1,81,230,252,204,203,255,192,128,128,128],[123,102,209,247,188,196,255,233,128,128,128],[20,95,153,243,164,173,255,203,128,128,128]],[[1,222,248,255,216,213,128,128,128,128,128],[168,175,246,252,235,205,255,255,128,128,128],[47,116,215,255,211,212,255,255,128,128,128]],[[1,121,236,253,212,214,255,255,128,128,128],[141,84,213,252,201,202,255,219,128,128,128],[42,80,160,240,162,185,255,205,128,128,128]],[[1,1,255,128,128,128,128,128,128,128,128],[244,1,255,128,128,128,128,128,128,128,128],[238,1,255,128,128,128,128,128,128,128,128]]]],n=0;for(let r=0;r<4;r++)for(let i=0;i<8;i++)for(let a=0;a<3;a++)for(let o=0;o<11;o++)e[n++]=t[r][i][a][o];return e})(),(()=>{let e=new Uint8Array(1056),t=[[[[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]],[[176,246,255,255,255,255,255,255,255,255,255],[223,241,252,255,255,255,255,255,255,255,255],[249,253,253,255,255,255,255,255,255,255,255]],[[255,244,252,255,255,255,255,255,255,255,255],[234,254,254,255,255,255,255,255,255,255,255],[253,255,255,255,255,255,255,255,255,255,255]],[[255,246,254,255,255,255,255,255,255,255,255],[239,253,254,255,255,255,255,255,255,255,255],[254,255,254,255,255,255,255,255,255,255,255]],[[255,248,254,255,255,255,255,255,255,255,255],[251,255,254,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]],[[255,253,254,255,255,255,255,255,255,255,255],[251,254,254,255,255,255,255,255,255,255,255],[254,255,254,255,255,255,255,255,255,255,255]],[[255,254,253,255,254,255,255,255,255,255,255],[250,255,254,255,254,255,255,255,255,255,255],[254,255,255,255,255,255,255,255,255,255,255]],[[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]]],[[[217,255,255,255,255,255,255,255,255,255,255],[225,252,241,253,255,255,254,255,255,255,255],[234,250,241,250,253,255,253,254,255,255,255]],[[255,254,255,255,255,255,255,255,255,255,255],[223,254,254,255,255,255,255,255,255,255,255],[238,253,254,254,255,255,255,255,255,255,255]],[[255,248,254,255,255,255,255,255,255,255,255],[249,254,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]],[[255,253,255,255,255,255,255,255,255,255,255],[247,254,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]],[[255,253,254,255,255,255,255,255,255,255,255],[252,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]],[[255,254,254,255,255,255,255,255,255,255,255],[253,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]],[[255,254,253,255,255,255,255,255,255,255,255],[250,255,255,255,255,255,255,255,255,255,255],[254,255,255,255,255,255,255,255,255,255,255]],[[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]]],[[[186,251,250,255,255,255,255,255,255,255,255],[234,251,244,254,255,255,255,255,255,255,255],[251,251,243,253,254,255,254,255,255,255,255]],[[255,253,254,255,255,255,255,255,255,255,255],[236,253,254,255,255,255,255,255,255,255,255],[251,253,253,254,254,255,255,255,255,255,255]],[[255,254,254,255,255,255,255,255,255,255,255],[254,254,254,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]],[[255,254,255,255,255,255,255,255,255,255,255],[254,254,255,255,255,255,255,255,255,255,255],[254,255,255,255,255,255,255,255,255,255,255]],[[255,255,255,255,255,255,255,255,255,255,255],[254,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]],[[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]],[[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]],[[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]]],[[[248,255,255,255,255,255,255,255,255,255,255],[250,254,252,254,255,255,255,255,255,255,255],[248,254,249,253,255,255,255,255,255,255,255]],[[255,253,253,255,255,255,255,255,255,255,255],[246,253,253,255,255,255,255,255,255,255,255],[252,254,251,254,254,255,255,255,255,255,255]],[[255,254,252,255,255,255,255,255,255,255,255],[248,254,253,255,255,255,255,255,255,255,255],[253,255,254,254,255,255,255,255,255,255,255]],[[255,251,254,255,255,255,255,255,255,255,255],[245,251,254,255,255,255,255,255,255,255,255],[253,253,254,255,255,255,255,255,255,255,255]],[[255,251,253,255,255,255,255,255,255,255,255],[252,253,254,255,255,255,255,255,255,255,255],[255,254,255,255,255,255,255,255,255,255,255]],[[255,252,255,255,255,255,255,255,255,255,255],[249,255,254,255,255,255,255,255,255,255,255],[255,255,254,255,255,255,255,255,255,255,255]],[[255,255,253,255,255,255,255,255,255,255,255],[250,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]],[[255,255,255,255,255,255,255,255,255,255,255],[254,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]]]],n=0;for(let r=0;r<4;r++)for(let i=0;i<8;i++)for(let a=0;a<3;a++)for(let o=0;o<11;o++)e[n++]=t[r][i][a][o];return e})(),new Uint16Array([4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,60,62,64,66,68,70,72,74,76,78,80,82,84,86,88,90,92,94,96,98,100,102,104,106,108,110,112,114,116,119,122,125,128,131,134,137,140,143,146,149,152,155,158,161,164,167,170,173,177,181,185,189,193,197,201,205,209,213,217,221,225,229,234,239,245,249,254,259,264,269,274,279,284]),new Uint16Array([4,5,6,7,8,9,10,10,11,12,13,14,15,16,17,17,18,19,20,20,21,21,22,22,23,23,24,25,25,26,27,28,29,30,31,32,33,34,35,36,37,37,38,39,40,41,42,43,44,45,46,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,76,77,78,79,80,81,82,83,84,85,86,87,88,89,91,93,95,96,98,100,101,102,104,106,108,110,112,114,116,118,122,124,126,128,130,132,134,136,138,140,143,145,148,151,154,157]),new Int8Array([-10,2,4,6,-0,-2,-3,-1]),new Uint8Array([145,156,163,128]),new Int8Array([-0,2,-2,4,-3,-1]),new Uint8Array([142,114,183]),new Int8Array([-0,2,-1,4,-2,6,8,12,-3,10,-4,-5,-6,14,-7,16,-8,-9]),(()=>{let e=[[[231,120,48,89,115,113,120,152,112],[152,179,64,126,170,118,46,70,95],[175,69,143,80,85,82,72,155,103],[56,58,10,171,218,189,17,13,152],[114,26,17,163,44,195,21,10,173],[121,24,80,195,26,62,44,64,85],[144,71,10,38,171,213,144,34,26],[170,46,55,19,136,160,33,206,71],[63,20,8,114,114,208,12,9,226],[81,40,11,96,182,84,29,16,36]],[[134,183,89,137,98,101,106,165,148],[72,187,100,130,157,111,32,75,80],[66,102,167,99,74,62,40,234,128],[41,53,9,178,241,141,26,8,107],[74,43,26,146,73,166,49,23,157],[65,38,105,160,51,52,31,115,128],[104,79,12,27,217,255,87,17,7],[87,68,71,44,114,51,15,186,23],[47,41,14,110,182,183,21,17,194],[66,45,25,102,197,189,23,18,22]],[[88,88,147,150,42,46,45,196,205],[43,97,183,117,85,38,35,179,61],[39,53,200,87,26,21,43,232,171],[56,34,51,104,114,102,29,93,77],[39,28,85,171,58,165,90,98,64],[34,22,116,206,23,34,43,166,73],[107,54,32,26,51,1,81,43,31],[68,25,106,22,64,171,36,225,114],[34,19,21,102,132,188,16,76,124],[62,18,78,95,85,57,50,48,51]],[[193,101,35,159,215,111,89,46,111],[60,148,31,172,219,228,21,18,111],[112,113,77,85,179,255,38,120,114],[40,42,1,196,245,209,10,25,109],[88,43,29,140,166,213,37,43,154],[61,63,30,155,67,45,68,1,209],[100,80,8,43,154,1,51,26,71],[142,78,78,16,255,128,34,197,171],[41,40,5,102,211,183,4,1,221],[51,50,17,168,209,192,23,25,82]],[[138,31,36,171,27,166,38,44,229],[67,87,58,169,82,115,26,59,179],[63,59,90,180,59,166,93,73,154],[40,40,21,116,143,209,34,39,175],[47,15,16,183,34,223,49,45,183],[46,17,33,183,6,98,15,32,183],[57,46,22,24,128,1,54,17,37],[65,32,73,115,28,128,23,128,205],[40,3,9,115,51,192,18,6,223],[87,37,9,115,59,77,64,21,47]],[[104,55,44,218,9,54,53,130,226],[64,90,70,205,40,41,23,26,57],[54,57,112,184,5,41,38,166,213],[30,34,26,133,152,116,10,32,134],[39,19,53,221,26,114,32,73,255],[31,9,65,234,2,15,1,118,73],[75,32,12,51,192,255,160,43,51],[88,31,35,67,102,85,55,186,85],[56,21,23,111,59,205,45,37,192],[55,38,70,124,73,102,1,34,98]],[[125,98,42,88,104,85,117,175,82],[95,84,53,89,128,100,113,101,45],[75,79,123,47,51,128,81,171,1],[57,17,5,71,102,57,53,41,49],[38,33,13,121,57,73,26,1,85],[41,10,67,138,77,110,90,47,114],[115,21,2,10,102,255,166,23,6],[101,29,16,10,85,128,101,196,26],[57,18,10,102,102,213,34,20,43],[117,20,15,36,163,128,68,1,26]],[[102,61,71,37,34,53,31,243,192],[69,60,71,38,73,119,28,222,37],[68,45,128,34,1,47,11,245,171],[62,17,19,70,146,85,55,62,70],[37,43,37,154,100,163,85,160,1],[63,9,92,136,28,64,32,201,85],[75,15,9,9,64,255,184,119,16],[86,6,28,5,64,255,25,248,1],[56,8,17,132,137,255,55,116,128],[58,15,20,82,135,57,26,121,40]],[[164,50,31,137,154,133,25,35,218],[51,103,44,131,131,123,31,6,158],[86,40,64,135,148,224,45,183,128],[22,26,17,131,240,154,14,1,209],[45,16,21,91,64,222,7,1,197],[56,21,39,155,60,138,23,102,213],[83,12,13,54,192,255,68,47,28],[85,26,85,85,128,128,32,146,171],[18,11,7,63,144,171,4,4,246],[35,27,10,146,174,171,12,26,128]],[[190,80,35,99,180,80,126,54,45],[85,126,47,87,176,51,41,20,32],[101,75,128,139,118,146,116,128,85],[56,41,15,176,236,85,37,9,62],[71,30,17,119,118,255,17,18,138],[101,38,60,138,55,70,43,26,142],[146,36,19,30,171,255,97,27,20],[138,45,61,62,219,1,81,188,64],[32,41,20,117,151,142,20,21,163],[112,19,12,61,195,128,48,4,24]]],t=new Uint8Array(900),n=0;for(let r=0;r<10;r++)for(let i=0;i<10;i++)for(let a=0;a<9;a++)t[n++]=e[r][i][a];return t})(),new Uint16Array([0,4,8,12,128,132,136,140,256,260,264,268,384,388,392,396]),new Uint8Array([7,6,6,5,5,5,5,4,4,4,4,4,4,4,4,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0]),new Uint8Array([127,127,191,127,159,191,223,127,143,159,175,191,207,223,239,127,135,143,151,159,167,175,183,191,199,207,215,223,231,239,247,127,131,135,139,143,147,151,155,159,163,167,171,175,179,183,187,191,195,199,203,207,211,215,219,223,227,231,235,239,243,247,251,127,129,131,133,135,137,139,141,143,145,147,149,151,153,155,157,159,161,163,165,167,169,171,173,175,177,179,181,183,185,187,189,191,193,195,197,199,201,203,205,207,209,211,213,215,217,219,221,223,225,227,229,231,233,235,237,239,241,243,245,247,249,251,253,127]);var nX;(function(e){e[e.Literal=0]=`Literal`,e[e.Backref=1]=`Backref`,e[e.Cache=2]=`Cache`})(nX||={});var rX=o((e=>{(function(t){typeof DO_NOT_EXPORT_CRC>`u`?typeof e==`object`?t(e):typeof define==`function`&&define.amd?define(function(){var e={};return t(e),e}):t({}):t({})})(function(e){e.version=`0.3.0`;function t(){for(var e=0,t=Array(256),n=0;n!=256;++n)e=n,e=e&1?-306674912^e>>>1:e>>>1,e=e&1?-306674912^e>>>1:e>>>1,e=e&1?-306674912^e>>>1:e>>>1,e=e&1?-306674912^e>>>1:e>>>1,e=e&1?-306674912^e>>>1:e>>>1,e=e&1?-306674912^e>>>1:e>>>1,e=e&1?-306674912^e>>>1:e>>>1,e=e&1?-306674912^e>>>1:e>>>1,t[n]=e;return typeof Int32Array<`u`?new Int32Array(t):t}var n=t(),r=typeof Buffer<`u`;function i(e){if(e.length>32768&&r)return o(new Buffer(e));for(var t=-1,i=e.length-1,a=0;a<i;)t=n[(t^e.charCodeAt(a++))&255]^t>>>8,t=n[(t^e.charCodeAt(a++))&255]^t>>>8;return a===i&&(t=t>>>8^n[(t^e.charCodeAt(a))&255]),t^-1}function a(e){if(e.length>1e4)return o(e);for(var t=-1,r=0,i=e.length-3;r<i;)t=t>>>8^n[(t^e[r++])&255],t=t>>>8^n[(t^e[r++])&255],t=t>>>8^n[(t^e[r++])&255],t=t>>>8^n[(t^e[r++])&255];for(;r<i+3;)t=t>>>8^n[(t^e[r++])&255];return t^-1}function o(e){for(var t=-1,r=0,i=e.length-7;r<i;)t=t>>>8^n[(t^e[r++])&255],t=t>>>8^n[(t^e[r++])&255],t=t>>>8^n[(t^e[r++])&255],t=t>>>8^n[(t^e[r++])&255],t=t>>>8^n[(t^e[r++])&255],t=t>>>8^n[(t^e[r++])&255],t=t>>>8^n[(t^e[r++])&255],t=t>>>8^n[(t^e[r++])&255];for(;r<i+7;)t=t>>>8^n[(t^e[r++])&255];return t^-1}function s(e){for(var t=-1,r=0,i=e.length,a,o;r<i;)a=e.charCodeAt(r++),a<128?t=t>>>8^n[(t^a)&255]:a<2048?(t=t>>>8^n[(t^(192|a>>6&31))&255],t=t>>>8^n[(t^(128|a&63))&255]):a>=55296&&a<57344?(a=(a&1023)+64,o=e.charCodeAt(r++)&1023,t=t>>>8^n[(t^(240|a>>8&7))&255],t=t>>>8^n[(t^(128|a>>2&63))&255],t=t>>>8^n[(t^(128|o>>6&15|a&3))&255],t=t>>>8^n[(t^(128|o&63))&255]):(t=t>>>8^n[(t^(224|a>>12&15))&255],t=t>>>8^n[(t^(128|a>>6&63))&255],t=t>>>8^n[(t^(128|a&63))&255]);return t^-1}e.table=n,e.bstr=i,e.buf=a,e.str=s})})),iX=o(((e,t)=>{var n=rX();t.exports=o;var r=new Uint8Array(4),i=new Int32Array(r.buffer),a=new Uint32Array(r.buffer);function o(e){if(e[0]!==137||e[1]!==80||e[2]!==78||e[3]!==71)throw Error(`Invalid .png file header`);if(e[4]!==13||e[5]!==10)throw Error(`Invalid .png file header: possibly caused by DOS-Unix line ending conversion?`);if(e[6]!==26)throw Error(`Invalid .png file header`);if(e[7]!==10)throw Error(`Invalid .png file header: possibly caused by DOS-Unix line ending conversion?`);for(var t=!1,o=[],s=8;s<e.length;){r[3]=e[s++],r[2]=e[s++],r[1]=e[s++],r[0]=e[s++];var c=a[0]+4,l=new Uint8Array(c);l[0]=e[s++],l[1]=e[s++],l[2]=e[s++],l[3]=e[s++];var u=String.fromCharCode(l[0])+String.fromCharCode(l[1])+String.fromCharCode(l[2])+String.fromCharCode(l[3]);if(!o.length&&u!==`IHDR`)throw Error(`IHDR header missing`);if(u===`IEND`){t=!0,o.push({name:u,data:new Uint8Array});break}for(var d=4;d<c;d++)l[d]=e[s++];r[3]=e[s++],r[2]=e[s++],r[1]=e[s++],r[0]=e[s++];var f=i[0];if(n.buf(l)!==f)throw Error(`CRC values for `+u+` header do not match, PNG file is likely corrupted`);var p=new Uint8Array(l.buffer.slice(4));o.push({name:u,data:p})}if(!t)throw Error(`.png file ended prematurely: no IEND header was found`);return o}})),aX=o(((e,t)=>{t.exports=function(e,t,n){var r=[],i=e.length;if(i===0)return r;var a=t<0?Math.max(0,t+i):t||0;for(n!==void 0&&(i=n<0?n+i:n);i-->a;)r[i-a]=e[i];return r}})),oX=o(((e,t)=>{var n=aX(),r=rX();t.exports=s;var i=new Uint8Array(4),a=new Int32Array(i.buffer),o=new Uint32Array(i.buffer);function s(e){var t=8,s=t,c;for(c=0;c<e.length;c++)t+=e[c].data.length,t+=12;var l=new Uint8Array(t);for(l[0]=137,l[1]=80,l[2]=78,l[3]=71,l[4]=13,l[5]=10,l[6]=26,l[7]=10,c=0;c<e.length;c++){var u=e[c],d=u.name,f=u.data,p=f.length,m=[d.charCodeAt(0),d.charCodeAt(1),d.charCodeAt(2),d.charCodeAt(3)];o[0]=p,l[s++]=i[3],l[s++]=i[2],l[s++]=i[1],l[s++]=i[0],l[s++]=m[0],l[s++]=m[1],l[s++]=m[2],l[s++]=m[3];for(var h=0;h<p;)l[s++]=f[h++];var g=m.concat(n(f));a[0]=r.buf(g),l[s++]=i[3],l[s++]=i[2],l[s++]=i[1],l[s++]=i[0]}return l}})),sX=l(iX(),1),cX=l(oX(),1);function lX(e){let t=new Uint8Array(e.reduce((e,t)=>e+t.length,0)),n=0;for(let r of e)t.set(r,n),n+=r.length;return t}function uX(e,t){let n=new TextEncoder().encode(t);return e.length>=n.length&&n.every((t,n)=>e[n]===t)}function dX(e,t){let n=(0,sX.default)(e),r=`XML:com.adobe.xmp\0`,i=n.filter(e=>!([`iTXt`,`tEXt`,`zTXt`].includes(e.name)&&uX(e.data,r))),a=i.findIndex(e=>e.name===`IDAT`);if(a<0)throw Error(`PNG has no image data`);return i.splice(a,0,{name:`iTXt`,data:lX([new TextEncoder().encode(r),new Uint8Array(4),new TextEncoder().encode(t)])}),(0,cX.default)(i)}var fX=`http://ns.adobe.com/xap/1.0/\0`,pX=`http://ns.adobe.com/xmp/extension/\0`;function mX(e,t){let n=e,r=new DataView(e.buffer,e.byteOffset,e.byteLength);if(n.length<4||r.getUint16(0)!==65496||r.getUint16(n.length-2)!==65497)throw Error(`Invalid JPEG envelope`);let i=new TextEncoder().encode(`${fX}${t}`);if(i.length>65533)throw Error(`XMP exceeds one JPEG APP1 segment`);let a=new Uint8Array(4),o=new DataView(a.buffer);o.setUint16(0,65505),o.setUint16(2,i.length+2);let s=lX([a,i]),c=[n.subarray(0,2)],l=1,u=!0,d=!1,f=2;for(;f+4<=n.length;){let e=f;if(n[f]!==255)throw Error(`Invalid JPEG marker`);for(;n[f]===255;)f++;let t=n[f];if(t===void 0||t===0||t===216||t===217)throw Error(`JPEG ended before its scan`);if(t===1||t>=208&&t<=215){c.push(n.subarray(e,f+1)),f++,u=!1;continue}if(f+3>n.length)throw Error(`Truncated JPEG length`);let i=r.getUint16(f+1),a=f+1+i;if(i<2||a>n.length)throw Error(`Truncated JPEG segment`);if(t>=192&&t<=207&&![196,200,204].includes(t)&&(d=!0),t===218){if(!d)throw Error(`JPEG has no frame`);return c.splice(l,0,s),c.push(n.subarray(e)),lX(c)}let o=n.subarray(f+3,a);t===225&&[fX,pX].some(e=>uX(o,e))||(c.push(n.subarray(e,a)),u&&(t===224||t===225&&uX(o,`Exif\0\0`))?l=c.length:u=!1),f=a}throw Error(`JPEG has no scan`)}var hX=`https://fungi.computer/ns/provenance/1.0/`,gX=`http://iptc.org/std/Iptc4xmpExt/2008-02-29/`,_X=`http://www.w3.org/1999/02/22-rdf-syntax-ns#`;function vX(e){let t=new vR.DOMParser({onError:()=>{throw Error(`Invalid provenance XML`)}}),n=e?t.parseFromString(e,`application/xml`):void 0,r=(e,t)=>{let r=n?.getElementsByTagNameNS(e,t).item(0);if(r?.textContent)return r.textContent;let i=n?.getElementsByTagNameNS(_X,`Description`);if(i)for(let n=0;n<i.length;n++){let r=i.item(n)?.getAttributeNS(e,t);if(r)return r}},i=t.parseFromString(`<x:xmpmeta xmlns:x="adobe:ns:meta/"><rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"><rdf:Description rdf:about=""/></rdf:RDF></x:xmpmeta>`,`application/xml`),a=i.getElementsByTagNameNS(_X,`Description`).item(0);if(!a)throw Error(`Missing provenance description`);let o=[{namespace:hX,name:`printId`,qualified:`fungi:printId`},{namespace:gX,name:`DigitalSourceType`,qualified:`Iptc4xmpExt:DigitalSourceType`}];for(let{namespace:e,name:t,qualified:n}of o){let o=r(e,t);if(o===void 0)continue;let s=i.createElementNS(e,n);s.textContent=o,a.appendChild(s)}return new vR.XMLSerializer().serializeToString(i)}var yX=33554432,bX=class extends Error{reason;name=`ProvenanceExportError`;constructor(e,t){super(`Print export refused: ${e}`,t),this.reason=e}};function xX(e,t){let n=eX(e);if(n.some(e=>e.size!==e.data.length)||n.reduce((e,t)=>e+8+t.size+t.size%2,12)!==e.length)throw Error(`Incomplete extended WebP`);if(!n.some(e=>e.fourCC===`XMP `))return e;if(!n.some(e=>e.fourCC===`VP8X`))throw Error(`XMP without extended WebP header`);let r=!1;return tX(n.flatMap(e=>e.fourCC===`XMP `?r?[]:(r=!0,[{fourCC:`XMP `,data:new TextEncoder().encode(t)}]):[{fourCC:e.fourCC,data:e.data}]))}async function SX(e){if(e.length>33554432)throw new bX(`too-large`);let t=new TextDecoder(`latin1`).decode(e);if(t.includes(`c2pa`)||t.includes(`caBX`))throw new bX(`signed-image`);try{let t=await jY.loadView(new DataView(e.buffer,e.byteOffset,e.byteLength),{expanded:!0,async:!0,domParser:new vR.DOMParser,includeTags:{xmp:!0,png:!0,file:!0},decompress:{maxDecompressedSize:yX}}),n=t.file?.FileType?.value;if(n!==`png`&&n!==`jpeg`&&n!==`webp`&&n!==`gif`)throw new bX(`unsupported-format`);let r={type:`image/${n}`,extension:n===`jpeg`?`jpg`:n};if(n===`gif`&&!t.xmp)return{bytes:e,...r};let i=vX(t.xmp?._raw??t.pngText?.[`XML:com.adobe.xmp`]?.value),a=n===`png`?dX(e,i):n===`jpeg`?mX(e,i):n===`webp`?xX(e,i):void 0;if(!a)throw new bX(`unsupported-format`);if(a.length>33554432)throw new bX(`too-large`);return{bytes:a,...r}}catch(e){throw e instanceof bX?e:new bX(`invalid-image`,{cause:e})}}function CX(e){return/\.mp4$/iu.test(e)}async function wX(e,t){if(CX(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}}let n=new Image;return n.src=t,await n.decode(),{file:e,url:t,width:n.naturalWidth,height:n.naturalHeight}}var TX={title:`Image too large`,message:`Download supports images up to 32 MiB. Choose a smaller image.`};async function EX(e,t){let n=()=>{if(t.throwIfAborted(),e.kind===`computer`&&e.connection.app.context.get().computerId!==e.computerId)throw new Y(`Print Computer changed`,{code:`SELECTION_CHANGED`,retryable:!1})};if(n(),e.file.size>33554432)throw new bX(`too-large`);let r=e.kind===`computer`?await aR(e.connection.app.capabilities,{path:e.path},{signal:t}):e.file;if(n(),r.size>33554432)throw new bX(`too-large`);let i=e.kind===`computer`?e.path:r.name,a=(i.split(`/`).at(-1)??`print`).replace(/\.[^.]*$/,``)||`print`;if(CX(i))return n(),new File([r],`${a}.mp4`,{type:`video/mp4`});let o=await SX(new Uint8Array(await r.arrayBuffer()));return n(),new File([Uint8Array.from(o.bytes)],`${a}.${o.extension}`,{type:o.type})}function DX(e){return e instanceof bX?{...{"too-large":TX,"signed-image":{title:`Download unavailable`,message:`This image has signed metadata that Prints cannot safely remove.`},"invalid-image":{title:`Couldn't prepare the image`,message:`Prints couldn't remove this image's private details. Choose another image.`},"unsupported-format":{title:`Download unavailable`,message:`Prints cannot safely export this file format yet.`}}[e.reason],retryable:!1}:ox(e,{FILE_TOO_LARGE:TX})}function OX(e){return{...{"no-user-gesture":{title:`Click to download`,message:`Click Download in Prints to save this image.`},"too-large":TX,"invalid-request":{title:`Download unavailable`,message:`The prepared image could not be saved. Reopen its information and try again.`},unavailable:{title:`Download unavailable`,message:`The host cannot save files right now. Reopen Prints and try again.`},denied:{title:`Download denied`,message:`Your browser did not allow this download. Check its download settings and try again.`},busy:{title:`Download busy`,message:`Wait for the current browser action to finish, then try again.`}}[e.reason],retryable:!1}}function kX(e,t){console.error(`Prints operation failed`,JSON.stringify({operation:e,errorKind:t instanceof Error?`error`:`non-error`,stage:t instanceof KA?t.stage:null,provider:t instanceof KA?t.provider:void 0}),Xm(t))}var AX=Xa({print:Xa({kind:lo([`image`,`video`]),model:da(),width:Pa().nullable(),height:Pa().nullable(),steps:Pa().nullable(),createdAt:Pa()}),typed:Xa({prompt:da(),references:Pa()}),references:Ja(Xa({path:da(),computerId:da().optional()})),characters:Ja(da())}),jX=(e,t)=>({style:t,kind:e.print.kind,model:e.print.model,typed:e.typed,references:e.references,steps:e.print.steps,width:e.print.width,height:e.print.height}),MX=(e,t)=>t===0?e:MX(t,e%t),NX=(e,t)=>{let n=MX(e,t);return`${String(e/n)}:${String(t/n)}`},PX=new Intl.DateTimeFormat(`en`,{dateStyle:`medium`,timeStyle:`short`});function FX(e,t){let n=e.source,r=n.kind===`computer`?n.path:null,i=n.kind===`computer`?n.computerId:null;return ES({...gA(t,yA,pA.of(t,`prints`,`output-details`,i,r),async(e,t)=>{let n=await e.call(`getOutput`,JSON.stringify({path:r}));t.throwIfAborted();let i=AX.safeParse(n);return i.success?i.data:null}),enabled:!!(t&&r&&i&&t.capabilities.has(yA)),retry:!1})}function IX(e,t){let n=(0,K.useRef)(null),r=OS({gcTime:0,mutationFn:async t=>{let n=await EX(e,t.signal),r=new Uint8Array(await n.arrayBuffer());return t.signal.throwIfAborted(),{kind:`saveFile`,name:n.name,mime:n.type,bytes:r}},onError:(e,t)=>{t.signal.aborted||kX(`prepare-print-download`,e)}}),{mutate:i,reset:a}=r;(0,K.useEffect)(()=>{let r=new AbortController;n.current=r;let o=()=>{r.abort(),a()},s=t?.context.subscribe(t=>{e.kind===`computer`&&t.computerId!==e.computerId&&o()}),c=t?.lifecycle.subscribe(e=>{(e===`disconnected`||e===`disposing`||e===`disposed`)&&o()});return i(r),()=>{s?.(),c?.(),r.abort(),n.current===r&&(n.current=null)}},[e,t,i,a]);let o=OS({gcTime:0,mutationFn:e=>e,onError:e=>{kX(`download-print`,e)}}),s=r.error??o.error,c=s?DX(s):o.data?.kind===`refused`?OX(o.data):null;return{preparing:r.isIdle||r.isPending,isPending:o.isPending,disabled:!r.data||o.isPending,failure:c,start:()=>{if(r.data&&!o.isPending&&!n.current?.signal.aborted){let e=t?t.ui.requestBrowserAction(r.data):Promise.resolve({kind:`refused`,reason:`unavailable`});o.mutate(e)}}}}function LX({sigil:e,label:t,children:n}){return(0,X.jsxs)(Nie,{children:[(0,X.jsxs)(`span`,{className:`prints-info-label`,children:[(0,X.jsx)(qie,{name:e,size:16}),t]}),(0,X.jsx)(`span`,{className:`prints-info-value`,children:n})]})}function RX({name:e}){let t=e.length>zX?e.slice(-zX):``;return(0,X.jsxs)(`span`,{className:`prints-info-file`,title:e,"data-print-file":!0,children:[(0,X.jsx)(`span`,{className:`prints-info-file-head`,children:e.slice(0,e.length-t.length)}),t?(0,X.jsx)(`span`,{className:`prints-info-file-tail`,children:t}):null]})}var zX=10;function BX({image:e,app:t,referenceImages:n,models:r,canAnimate:i,onIterate:a,onClose:o}){let[s,c]=(0,K.useState)(null),l=(0,K.useRef)(null),u=IX(e.source,t),d=u.failure,f=ES(CM(t,e.source.kind===`computer`?e.source.path:null)),p=FX(e,t).data,m=p?jX(p,f.data?.style??null):null,h=p?ML(r,p.print.model):null;return(0,K.useEffect)(()=>{let e=document.activeElement;return l.current?.focus(),()=>{e instanceof HTMLElement&&e.isConnected&&e.focus()}},[]),(0,X.jsxs)(jI,{ref:l,className:`prints-info-drawer`,role:`region`,"aria-label":`Image information`,tabIndex:-1,onKeyDown:e=>{e.key===`Escape`&&(e.stopPropagation(),o())},children:[(0,X.jsxs)(`div`,{className:`flex items-center justify-between gap-sm`,children:[(0,X.jsx)(`h2`,{className:`text-base font-semibold`,children:`Image info`}),(0,X.jsx)(AI,{"aria-label":`Close image information`,icon:(0,X.jsx)(dL,{}),onClick:o})]}),(0,X.jsxs)(Mie,{density:`compact`,className:`prints-info-facts`,children:[(0,X.jsx)(LX,{sigil:`list`,label:`File`,children:(0,X.jsx)(RX,{name:e.file.name})}),(0,X.jsxs)(LX,{sigil:`prints`,label:`Size`,children:[e.width,` × `,e.height,` · `,NX(e.width,e.height)]}),f.data?.style?(0,X.jsx)(LX,{sigil:`write`,label:`Style`,children:f.data.style}):null,p?(0,X.jsx)(LX,{sigil:`sendPrompts`,label:`Prompt`,children:(0,X.jsx)(`span`,{className:`whitespace-pre-wrap`,"data-print-prompt":!0,children:p.typed.prompt})}):null,p?(0,X.jsx)(LX,{sigil:`generateMedia`,label:`Model`,children:(0,X.jsx)(`span`,{"data-print-model":!0,children:h?jL(h):`${p.print.model} (no longer available)`})}):null,p&&p.characters.length>0?(0,X.jsx)(LX,{sigil:`members`,label:`Characters`,children:(0,X.jsx)(`span`,{"data-print-characters":!0,children:p.characters.map(e=>`@${e}`).join(`, `)})}):null,p&&p.references.length>0?(0,X.jsx)(LX,{sigil:`read`,label:`References`,children:(0,X.jsx)(`ul`,{className:`prints-info-references`,"data-print-references":!0,"aria-label":`${String(p.references.length)} references`,children:p.references.map((t,r)=>{let i=t.path.split(`/`).at(-1),a=e.source.kind===`computer`&&fL(t,e.source.computerId)?n.find(e=>e.path===t.path):void 0;return(0,X.jsx)(`li`,{title:t.path,children:a?(0,X.jsx)(`img`,{src:a.url,alt:i}):i},`${String(r)}:${t.path}`)})})}):null,p?(0,X.jsx)(LX,{sigil:`schedule`,label:`Made`,children:PX.format(p.print.createdAt)}):null]}),(0,X.jsxs)(`div`,{className:`prints-info-actions`,role:`group`,"aria-label":`Image actions`,children:[m&&e.source.kind===`computer`?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(XN,{label:`Reuse`,icon:(0,X.jsx)(oL,{}),disabled:f.isPending,onClick:()=>{c(a(`reuse`,m))}}),(0,X.jsx)(XN,{label:`Remix`,icon:(0,X.jsx)(sL,{}),disabled:f.isPending,onClick:()=>{c(a(`remix`,m))}}),i&&m.kind===`image`?(0,X.jsx)(XN,{label:`Animate`,icon:(0,X.jsx)(Qie,{}),disabled:f.isPending,onClick:()=>{c(a(`animate`,m))}}):null]}):null,(0,X.jsx)(XN,{label:`Download`,icon:(0,X.jsx)($ie,{}),title:u.preparing?`Preparing download…`:u.isPending?`Downloading…`:void 0,onClick:u.start,disabled:u.disabled,"aria-busy":u.preparing||u.isPending})]}),s?(0,X.jsx)(`p`,{role:`alert`,className:`text-sm`,children:s}):null,d?(0,X.jsxs)(`p`,{role:`alert`,className:`text-sm`,children:[d.title,`. `,d.message]}):null]})}var VX=24,HX={all:e=>pA.of(e,`prints`,`gallery`),listings:e=>[...HX.all(e),`listing`],listing:(e,t)=>[...HX.listings(e),t],file:(e,t)=>[...HX.all(e),`file`,t]};function UX(e,t){let n=e?.context.get().computerId;return lne({queryKey:HX.listing(e,t),initialPageParam:0,enabled:!!(n&&t&&e.capabilities.has(qL)&&e.capabilities.has(iR)),queryFn:async({pageParam:r,signal:i})=>{if(!e||!n||!t)throw new Y(`No Computer folder selected`,{code:`SELECTION_CHANGED`,retryable:!1});let a=[],o=r;do{if(i.throwIfAborted(),e.context.get().computerId!==n)throw new Y(`Computer selection changed`,{code:`SELECTION_CHANGED`,retryable:!1});let r=await oR(e.capabilities,{path:t,limit:VX-a.length,offset:o});if(i.throwIfAborted(),r.nextOffset!==null&&r.nextOffset<=o)throw new Y(`Directory pagination did not advance`,{code:`PROTOCOL`,retryable:!1});a.push(...r.entries.filter(e=>e.type===`file`&&/\.(avif|gif|jpe?g|png|svg|webp|mp4)$/i.test(e.name)).map(e=>({...e,path:`${r.path.replace(/\/$/,``)}/${e.name}`}))),o=r.nextOffset}while(a.length<VX&&o!==null);return{entries:a,nextOffset:o}},getNextPageParam:e=>e.nextOffset})}function WX(e,t,n){return{...gA(e,iR,[...HX.file(e,t.path),t.modifiedAt,t.size],async(n,r)=>{if(!e)throw new Y(`Prints disconnected`,{code:`DISCONNECTED`,retryable:!0});let i=await aR(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(iR)),structuralSharing:!1}}function GX(e,t){let n=e?.app??null,r=Hk(n),i=mx(),[a,o]=(0,K.useState)(()=>new Set),s=(0,K.useCallback)(e=>{if(!r)return;let t=`${r}:${e}`;o(e=>e.has(t)?e:new Set([...e,t]))},[r]),c=UX(n,t),l=kS(c),u=(0,K.useMemo)(()=>c.enabled?l.data?.pages.flatMap(e=>e.entries)??[]:[],[l.data,c.enabled]),d=(0,K.useCallback)(e=>({files:e.flatMap((e,t)=>e.data?[{path:u[t].path,file:e.data}]:[]),failures:e.flatMap((e,t)=>e.isError?[u[t].name]:[]),loading:e.some(e=>e.isLoading)}),[u]),f=sne({queries:u.map(e=>WX(n,e,!!(r&&a.has(`${r}:${e.path}`)))),combine:d});return(0,K.useEffect)(()=>{if(!n)return;let e=HX.all(n),t=HX.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:u,loadFile:s,files:f.files,failures:f.failures,error:l.error,loading:l.isFetching||f.loading,hasNextPage:l.hasNextPage,nextPageReady:l.hasNextPage&&!l.isFetching&&!l.error,refresh:()=>{l.refetch({cancelRefetch:!1})},loadMore:()=>{l.isFetching||l.fetchNextPage({cancelRefetch:!1})}}}function KX(e){return e.replace(/\s/gu,` `).replace(/ +/g,` `).trim()}function qX(e,t){let[n,r]=(0,K.useState)([]),i=(0,K.useRef)(new Map),a=(0,K.useRef)(Promise.resolve()),[o,s]=(0,K.useState)(null),c=(0,K.useRef)(new Map),l=(0,K.useRef)(e);l.current=e;let u=(0,K.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,K.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 wX(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){kX(`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 uR(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){kX(`refresh-upload-preview`,t),d(e.id,`complete`,`Written; fresh preview unavailable`)}}catch(t){n()||kX(`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,K.useCallback)(()=>{for(let e of c.current.values())e.abort()},[]);return(0,K.useEffect)(()=>()=>{m();for(let e of i.current.values())URL.revokeObjectURL(e.previewUrl)},[m]),{items:n,error:o,cancelAll:m,add(e,t,n){s(null);let r=[...i.current.values()].reduce((e,t)=>e+t.file.size,0);for(let a of e){if(!a.type.startsWith(`image/`)){s(`Only image files can be uploaded here`);continue}if(i.current.size>=8||r+a.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 o=`${t.replace(/\/$/,``)}/upload-${tA(8)}-${KX(a.name)}`;if(i.current.has(o)){s(`This path is already in the queue. Retry or remove its existing row.`);continue}let c={computerId:e,id:o,file:a,previewUrl:URL.createObjectURL(a),app:n,path:o,status:`queued`,message:`Queued`};i.current.set(c.id,c),r+=a.size,p(c)}},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 JX(e,t){let n=t.path,r=Hk(e?.app),i=(0,K.useRef)(new Set),a=(0,K.useRef)(0),o=(0,K.useRef)(e);o.current=e;let s=e?.app.capabilities.has(qL)===!0,c=e?.app.capabilities.has(iR)===!0,l=e?.app.capabilities.has(sR)===!0,u=GX(e,t.galleryPath),[d,f]=(0,K.useState)([]),[p,m]=(0,K.useState)([]),[h,g]=(0,K.useState)([]),[_,v]=(0,K.useState)([]);(0,K.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,K.useState)(!1),S=(0,K.useMemo)(()=>[...u.error?[`Could not refresh the Media gallery`]:[],...u.failures],[u.error,u.failures]),C=(0,K.useRef)(new WeakMap),w=(0,K.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,K.useCallback)(()=>{a.current+=1;for(let e of i.current)e.abort();i.current.clear()},[]);(0,K.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,K.useEffect)(()=>{if(e)return e.app.context.subscribe(e=>{e.computerId!==r&&T()})},[e,r,T]),(0,K.useEffect)(()=>{v([]),f(e=>e.filter(e=>e.kind===`local`))},[r]);let E=async(e,t,n,r)=>{let s=r??n.app.context.get().computerId;if(!s){g([`The selected Computer is unavailable`]);return}if(t===`open`){try{await(o.current??n).app.ui.openNavigation({computerId:s,path:e})}catch(t){kX(`open-computer-file`,t),g([`Could not open ${e} in Inkcap`])}return}if(o.current!==n){g([`Computer selection changed`]);return}if(n.app.context.get().computerId!==s){g([`Computer selection changed before the preview was loaded`]);return}let c=a.current,l=new AbortController;i.current.add(l);try{let t=await aR(n.app.capabilities,{path:e},{signal:l.signal});if(l.signal.aborted||c!==a.current)return;v(n=>n.map(n=>n.key===`${s}:${e}`?{...n,previewFile:t}:n)),f(r=>[...r.filter(t=>t.kind!==`computer`||t.path!==e||t.computerId!==s),{kind:`computer`,computerId:s,file:t,path:e,connection:n}])}catch(t){l.signal.aborted||(kX(`read-computer-file`,t),g([`Could not read ${e}`]),v(t=>t.map(t=>t.key===`${s}:${e}`?{...t,error:`Saved; preview unavailable. Retry loading it.`}:t)))}finally{i.current.delete(l)}},D=(0,K.useRef)(new Set),O=(0,K.useRef)(new Set),k=(0,K.useCallback)(e=>{URL.revokeObjectURL(e),D.current.delete(e)},[]);(0,K.useEffect)(()=>{let e=!0,t=new Set,n=new Map,r=new Set,i=[...w].sort((e,t)=>t.file.lastModified-e.file.lastModified||e.file.name.localeCompare(t.file.name)).map(e=>{let t=URL.createObjectURL(e.file);return D.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 wX(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&&(kX(`decode-gallery-image`,t),k(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(e)}},[w,S,k]),(0,K.useEffect)(()=>{let e=new Set(p.map(e=>e.url));for(let t of O.current)e.has(t)||k(t);O.current=e},[p,k]),(0,K.useEffect)(()=>{let e=D.current;return()=>{for(let t of e)URL.revokeObjectURL(t);e.clear()}},[]);let A=qX(async(e,t,n)=>{let r=o.current,i=r?.app===t&&t.context.get().computerId===n?r:null;i&&await E(e,`add`,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,K.useEffect)(()=>{let t=A.cancelAll,n=e?.app.lifecycle.subscribe(e=>{(e===`disposing`||e===`disconnected`||e===`disposed`)&&t()});return()=>{n?.(),t()}},[e,A.cancelAll]),{images:p,failed:h,loading:b,gallery:u,gallerySlots:_,canBrowse:s,canRead:c,canWrite:l,reserveSlot:y,openComputerFile:E,uploads:A,uploadFiles:async i=>{if(!e||!l||n===null)return;let a=e,s=r,c=await t.ensureCreated();if(c){g([c]);return}o.current===a&&a.app.context.get().computerId===s&&A.add(i,n,a.app)},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 YX=e=>lb.pipe(J(Bb(1)),J(Ub(e))),XX=ub.pipe(J(Rb()),J(wb(Number.isSafeInteger,{message:`Expected a safe integer`}))),ZX=XX.pipe(J(Pb(0))),QX=q({bytes:ZX,costMilliunits:XX.pipe(J(Fb(0))),destination:q({computerId:YX(256),path:YX(4096)}),format:_b([`png`,`jpeg`,`gif`,`webp`,`mp4`]),height:ZX,model:YX(256),width:ZX}),$X=q({operation:ab(`complete-generation`),reference:JA,result:QX,derivedFrom:ib(YX(256)),references:ib(mb(vb(YX(256))))}),eZ=q({reference:JA,input:uj,typed:q({prompt:Gb,references:zb.pipe(J(Fb(0)))}),style:ib(Nj),characters:ib(mb(Xj))});gb([q({operation:ab(`remember-generation`),record:eZ}),q({operation:ab(`forget-generation`),reference:JA}),q({operation:ab(`list-generations`),after:vb(lb)})]);function tZ(e){return{reference:e.reference,input:yj(e.input),typed:e.typed,style:e.style,characters:e.characters}}async function nZ(e,t){let n=tZ(tb(eZ,{onExcessProperty:`error`})(t)),r=tZ(tb(eZ,{onExcessProperty:`error`})(await e.require(vA).request(JSON.stringify({operation:`remember-generation`,record:n}))));if(JSON.stringify(r)!==JSON.stringify(n))throw new Y(`Prints did not confirm the original generation command`,{code:`PROTOCOL`,retryable:!1});return r}async function rZ(e,t){tb(q({removed:db}))(await e.require(vA).request(JSON.stringify({operation:`forget-generation`,reference:t})))}async function iZ(e,t=null){let n=tb(q({records:mb(eZ),next:vb(lb)}),{onExcessProperty:`error`})(await e.require(vA).request(JSON.stringify({operation:`list-generations`,after:t})));return{records:n.records.map(tZ),next:n.next}}async function aZ(e,t,n){let r=tb($X,{onExcessProperty:`error`})({operation:`complete-generation`,reference:t,result:n}),i=tb(q({printId:lb,computerId:lb}))(await e.require(vA).request(JSON.stringify(r)));if(i.printId!==t.requestId||i.computerId!==t.computerId)throw new Y(`Prints did not confirm the saved generation`,{code:`PROTOCOL`,retryable:!1})}var oZ=$y(q({reference:JA}));function sZ({connection:e,folder:t,effects:n,styles:r,characters:i}){let a=e?.app??null,o=Hk(a),s=(0,K.useRef)(e);s.current=e;let c=(0,K.useRef)(n);c.current=n;let l=mx(),u=pA.of(a,`prints`,`generation`),d=[...u,`recovery`],f=ES(yM(a)),p=f.isError?void 0:f.data,m=p?.models??[],h=a?.capabilities.has(hj)===!0,g=p?.canGenerate??!1,_=f.error?ox(f.error).message:p?.models.length===0?`The granted Media model registry is empty.`:null,v=kS({queryKey:d,enabled:a!==null&&o!==null,initialPageParam:null,queryFn:async({pageParam:e,signal:t})=>{if(!a)throw new Y(`Prints disconnected`,{code:`DISCONNECTED`,retryable:!0});if(a.context.get().computerId!==o)throw new Y(`Computer selection changed`,{code:`SELECTION_CHANGED`,retryable:!1});let n=await iZ(a.capabilities,e);return t.throwIfAborted(),n},getNextPageParam:e=>e.next}),y=(0,K.useMemo)(()=>Array.from(new Map(v.data?.pages.flatMap(e=>e.records).map(e=>[e.reference.requestId,e])??[]).values()),[v.data]),b=(0,K.useRef)(new Map),x=(0,K.useRef)(new Set),S=(0,K.useRef)(0),C=(0,K.useRef)(null),[w,T]=(0,K.useState)(null),[E,D]=(0,K.useState)(null),O=e=>{T(e),c.current.notifyFailure(e.message)},k=e=>{D(e),c.current.notifyFailure(e)},A=(0,K.useRef)(null);(0,K.useEffect)(()=>{A.current!==v.error&&(A.current=v.error,v.error&&c.current.notifyFailure(ox(v.error).message))},[v.error]);let j=e=>s.current===e.connection&&e.connection.app.context.get().computerId===e.reference.computerId,M=(e,t)=>{l.setQueryData(e,e=>e&&{...e,pages:e.pages.map(e=>({...e,records:e.records.filter(e=>e.reference.requestId!==t)}))})},N=OS({mutationKey:[...u,`run`],mutationFn:async e=>{e.controller.signal.throwIfAborted();let t=tZ({reference:e.reference,input:e.input,typed:e.typed,style:e.style,characters:e.characters});await nZ(e.connection.app.capabilities,t),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 aZ(e.connection.app.capabilities,t.reference,r),{input:e.input,result:r}},onMutate:e=>{if(!j(e)||e.controller.signal.aborted)return;let t=ML(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,width:e.draft.width,height:e.draft.height,pendingLabel:SL(t)};t?.kind===`video`&&(n.startedAt=Date.now(),n.resumed=e.resumed===!0),c.current.reserve(n)},onSuccess:(e,t)=>{M(t.recoveryKey,t.reference.requestId),C.current?.reference.requestId===t.reference.requestId&&(C.current=null),!(!j(t)||t.controller.signal.aborted)&&c.current.saved(e,t.connection)},onError:(e,n)=>{if(kX(`generate-media`,e),!j(n)||n.controller.signal.aborted)return;t.recheck();let r=_L(e).message;c.current.failed(`${n.reference.computerId}:${n.input.destination.path}`,r),c.current.notifyFailure(r)},onSettled:(e,t,n)=>{b.current.get(n.reference.requestId)===n.controller&&b.current.delete(n.reference.requestId)}}),P=OS({mutationKey:[...u,`discard`],mutationFn:async e=>{await rZ(e.connection.app.capabilities,e.reference)},onSuccess:(e,t)=>{M(t.recoveryKey,t.reference.requestId),C.current?.reference.requestId===t.reference.requestId&&(C.current=null)},onError:(e,t)=>{j(t)&&k(ox(e).message)},onSettled:(e,t,n)=>{b.current.get(n.reference.requestId)===n.controller&&b.current.delete(n.reference.requestId)}}),F=une({filters:{mutationKey:u,status:`pending`},select:e=>yd(oZ(e.state.variables))?.reference.requestId}),I=new Set(F.filter(e=>e!==void 0));(0,K.useEffect)(()=>{x.current.clear(),T(null),D(null),C.current=null;let e=pA.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()}},[a,o,e,l]);let L=e=>{let t=e.reference.requestId;if(b.current.has(t))return!1;if(!j(e))return k(`Select the original Computer to retry this generation.`),!1;if(p?.computerId!==e.reference.computerId)return k(`Media access is unavailable for the original Computer.`),!1;let n=new AbortController;return b.current.set(t,n),C.current=e,T(null),D(null),S.current+=1,N.mutate({...e,session:p,controller:n,ticket:S.current,recoveryKey:d}),!0};(0,K.useEffect)(()=>{if(!(!e||!p||!v.isSuccess))for(let t of y){let n=t.reference.requestId;x.current.has(n)||t.reference.computerId!==o||ML(p.models,t.input.settings.model)?.kind!==`video`||L({connection:e,...t,resumed:!0,draft:{...t.input.settings,references:t.input.settings.references??[],destination:t.input.destination.path}})&&x.current.add(n)}},[e,o,p,v.isSuccess,y]);let R=async n=>{if(!e?.app.capabilities.has(sR)||!g)return!1;if(t.path===null)return t.setEditing(!0),!1;C.current=null;let a=ML(m,n.model);if(a===void 0)return O({kind:`error`,mediaKind:null,message:`Choose a model from the granted registry.`}),!1;let c=lM({prompt:n.prompt,saved:i,references:n.references,computerId:o,model:{label:a.label,maxReferences:a.input.maxReferences}});if(c.kind===`refused`)return O({kind:`error`,mediaKind:a.kind,message:c.message}),!1;let l=HL({...n,references:c.references},a);if(l)return O({kind:`error`,mediaKind:a.kind,message:l}),!1;let u=n.style===void 0?void 0:r.find(e=>e.name===n.style);if(n.style!==void 0&&u===void 0)return O({kind:`error`,mediaKind:a.kind,message:`The "${n.style}" style no longer exists. Pick another or none.`}),!1;let d=c.characters.map(e=>e.name),f=zj(u?.text,c.prompt),_=Vj(f,Bj(a),u?.name,d);if(_!==void 0)return O({kind:`error`,mediaKind:a.kind,message:_}),!1;if(!h||!p)return T(null),!1;let v=e,y=v.app.context.get().computerId,b=S.current,x={...n,prompt:f,references:c.references,destination:bL(n,t.path,a)},w=zL(x,a),E;try{let e=await t.ensureCreated();if(e)return O({kind:`error`,mediaKind:a.kind,message:e}),!1;if(S.current!==b||s.current!==v||v.app.context.get().computerId!==y)return!1;let n=await p.createAttempt();E=n.reference,n[Symbol.dispose]()}catch(e){return S.current===b&&s.current===v&&v.app.context.get().computerId===y&&O({kind:`error`,mediaKind:a.kind,..._L(e)}),!1}return S.current!==b||s.current!==v||v.app.context.get().computerId!==y?!1:L({connection:v,reference:E,input:w,draft:x,typed:{prompt:n.prompt.trim(),references:n.references.length},style:u?.name,characters:d})},z=N.variables;return{state:w??(z&&j(z)&&z.ticket===S.current?N.isPending?{kind:`pending`,draft:z.draft}:N.isError?{kind:`error`,mediaKind:ML(z.session.models,z.input.settings.model)?.kind??null,..._L(N.error)}:{kind:`completed`,record:N.data}: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,modelsLoading:f.isFetching,modelsError:_,canGenerate:g,mediaCapability:h,retryModels:()=>{f.refetch()},submit:R,isRunning:()=>b.current.size>0,activeGenerations:I,pendingGenerations:y,recoveryError:E??(v.error?ox(v.error).message:null),reportRecoveryError:e=>{k(ox(e).message)},hasMore:v.hasNextPage,loadMore:()=>{v.isFetching||v.fetchNextPage()},resume:t=>{if(!e||p?.computerId!==t.reference.computerId){k(`Select the original Computer to retry this generation.`);return}L({connection:e,...t,draft:{...t.input.settings,references:t.input.settings.references??[],destination:t.input.destination.path}})},discard:t=>{if(!e||b.current.has(t.reference.requestId))return;let n=new AbortController;b.current.set(t.reference.requestId,n),P.mutate({...t,connection:e,controller:n,draft:{...t.input.settings,references:t.input.settings.references??[]},recoveryKey:d})},retryPath:e=>{let t=C.current;return t?.input.destination.path!==e||!j(t)?!1:(L(t),!0)},retry:C.current&&j(C.current)?()=>{C.current&&L(C.current)}:void 0,errorKey:`generation:${C.current?.reference.requestId??`draft`}:${String(S.current)}`}}function cZ({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 lZ(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 uZ=[],dZ=0,{link:fZ,unlink:pZ,propagate:mZ,checkDirty:hZ,shallowPropagate:gZ}=cZ({update(e){return e._update()},notify(e){uZ[vZ++]=e,e.flags&=-3},unwatched(e){e.depsTail!==void 0&&(e.depsTail=void 0,e.flags=17,SZ(e))}}),_Z=0,vZ=0,yZ,bZ=0;function xZ(e){try{++bZ,e()}finally{--bZ||CZ()}}function SZ(e){let t=e.depsTail,n=t===void 0?e.deps:t.nextDep;for(;n!==void 0;)n=pZ(n,e)}function CZ(){if(!(bZ>0)){for(;_Z<vZ;){let e=uZ[_Z];uZ[_Z++]=void 0,e.notify()}_Z=0,vZ=0}}function wZ(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 yZ!==void 0&&fZ(i,yZ,dZ),i._snapshot},subscribe(e){let t=lZ(e),n={current:!1},r=TZ(()=>{i.get(),n.current?t.next?.(i._snapshot):n.current=!0});return{unsubscribe:()=>{r.stop()}}},_update(e){let a=yZ,o=t?.compare??Object.is;if(n)yZ=i,++dZ,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{yZ=a,n&&(i.flags&=-5),SZ(i)}}};return n?(i.flags=17,i.get=function(){let e=i.flags;if(e&16||e&32&&hZ(i.deps,i)){if(i._update()){let e=i.subs;e!==void 0&&gZ(e)}}else e&32&&(i.flags=e&-33);return yZ!==void 0&&fZ(i,yZ,dZ),i._snapshot}):i.set=function(e){if(i._update(e)){let e=i.subs;e!==void 0&&(mZ(e),gZ(e),CZ())}},i}function TZ(e){let t=()=>{let t=yZ;yZ=n,++dZ,n.depsTail=void 0,n.flags=6;try{return e()}finally{yZ=t,n.flags&=-5,SZ(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&&hZ(this.deps,this)?t():this.flags=2},stop(){this.flags=0,this.depsTail=void 0,SZ(this)}};return t(),n}var EZ=class{constructor(e,t){this.atom=wZ(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(lZ(e))}},DZ=class{constructor(e){this.atom=wZ(e)}get state(){return this.atom.get()}get(){return this.state}subscribe(e){return this.atom.subscribe(lZ(e))}};function OZ(e,t){return typeof e==`function`?new DZ(e):t?new EZ(e,t):new EZ(e)}var kZ=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 AZ(e,t){return new kZ(e,t).maybeExecute}var jZ=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)}},MZ=new class extends jZ{constructor(){super({pluginId:`form-devtools`,reconnectEveryMs:1e3})}};function NZ(e,t){return typeof e==`function`?e(t):e}function PZ(e,t){return HZ(t).reduce((e,t)=>{if(e===null)return null;if(e!==void 0)return e[t]},e)}function FZ(e,t,n){let r=HZ(t);function i(e){if(!r.length)return NZ(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 IZ(e,t){let n=HZ(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 LZ=46,RZ=91,zZ=93,BZ=48,VZ=57;function HZ(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)===RZ),i=!0,a=-1;for(let o=r;o<=t;o++){let s=o<t?e.charCodeAt(o):-1;if(o===t||s===LZ||s===RZ||s===zZ){let t=o-r;if(t>0){let a=i&&(t===1||e.charCodeAt(r)!==BZ),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!==zZ&&(a!==-1||s!==zZ)&&(a!==s||s!==LZ&&s!==RZ)&&n.push(``);r=o+1,i=!0}else(s<BZ||s>VZ)&&(i=!1);a=s}return n.length||n.push(``),n}function UZ(e){return!(Array.isArray(e)&&e.length===0)}function WZ(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 GZ(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 KZ=e=>!!e&&typeof e==`object`&&`fields`in e;function qZ(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)||!qZ(e[i],t[i]))return!1;return!0}var JZ=({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},YZ=({formLevelError:e,fieldLevelError:t})=>t?{newErrorValue:t,newSource:`field`}:e?{newErrorValue:e,newSource:`form`}:{newErrorValue:void 0,newSource:void 0};function XZ(e,t){return e==null?t:{...e,...t}}for(var ZZ=256,QZ=[],$Z;ZZ--;)QZ[ZZ]=(ZZ+256).toString(16).substring(1);function eQ(){let e=0,t,n=``;if(!$Z||ZZ+16>256){for($Z=Array(256),e=256;e--;)$Z[e]=256*Math.random()|0;e=0,ZZ=0}for(;e<16;e++)t=$Z[ZZ+e],n+=e===6?QZ[t&15|64]:e===8?QZ[t&63|128]:QZ[t],e&1&&e>1&&e<11&&(n+=`-`);return ZZ++,n}var tQ=AZ(e=>MZ.emit(`form-state`,{id:e.formId,state:e.store.state}),{wait:300});function nQ(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]=nQ(e[n]);return t}if(e instanceof Map){let t=new Map;return e.forEach((e,n)=>{t.set(n,nQ(e))}),t}if(e instanceof Set){let t=new Set;return e.forEach(e=>{t.add(nQ(e))}),t}let t={};for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=nQ(e[n]));return t}function rQ(e,t){return t===e||t.startsWith(`${e}.`)||t.startsWith(`${e}[`)}var iQ=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 aQ(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 oQ=(e,t)=>{let n=aQ(e,t);return{form:n,fields:n}},sQ={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:oQ(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:oQ(r.issues,e)}},cQ=e=>!!e&&`~standard`in e,lQ={isValidating:!1,isTouched:!1,isBlurred:!1,isDirty:!1,isPristine:!0,isValid:!0,isDefaultValue:!0,errors:[],errorMap:{},errorSourceMap:{},_arrayVersion:0,_pendingValidationsCount:0};function uQ(e){function t(t){let n=e.getFieldMeta(t)??lQ;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=()=>lQ;return{bumpArrayVersion:t,handleArrayMove:n,handleArrayRemove:r,handleArraySwap:i,handleArrayInsert:a}}function dQ(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 fQ=class{constructor(e){this.options={},this.fieldInfo={},this.formGroupApis=new Set,this.mount=()=>{let e=this.store.subscribe(()=>{tQ(this)}),t=MZ.on(`request-form-state`,e=>{e.payload.id===this._formId&&MZ.emit(`form-api`,{id:this._formId,state:this.store.state,options:this.options})}),n=MZ.on(`request-form-reset`,e=>{e.payload.id===this._formId&&this.reset()}),r=MZ.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(),MZ.emit(`form-unmounted`,{id:this._formId})};this.options.listeners?.onMount?.({formApi:this});let{onMount:a}=this.options.validators||{};return MZ.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&&!qZ(e.defaultValues,t.defaultValues)&&!this.state.isTouched,r=!qZ(e.defaultState,t.defaultState)&&!this.state.isTouched;if(!(!n&&!r)){if(xZ(()=>{this.baseStore.setState(()=>dQ(Object.assign({},this.state,r?e.defaultState:{},n?{values:e.defaultValues}:{})))}),n){let e=uQ(this);for(let t of Object.keys(this.fieldInfo))Array.isArray(this.getFieldValue(t))&&e.bumpArrayVersion(t)}MZ.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=FZ(t,e.instance.name,e.instance.options.defaultValue))}),dQ({...this.options.defaultState,values:t,fieldMetaBase:r})})},this.validateAllFields=async e=>{let t=[];return xZ(()=>{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 xZ(()=>{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=WZ(e,{...this.options,form:this,group:t?.group,validationLogic:this.options.validationLogic||iQ}),r=!1,i={};return xZ(()=>{for(let e of n){if(!e.validate)continue;let{formError:n,fieldErrors:a}=pQ(this.runValidator({validate:e.validate,value:{value:this.state.values,formApi:this,validationSource:`form`},type:`validate`})),o=mQ(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)??lQ,r=a?.[e],{newErrorValue:s,newSource:c}=JZ({newFormValidatorError:r,isPreviousErrorFromFormValidator:n?.[o]===`form`,previousErrorValue:t?.[o]});c===`form`&&(i[e]={...i[e],[o]:r}),t?.[o]!==s&&this.setFieldMeta(e,(e=lQ)=>({...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=mQ(`submit`);this.state.errorMap?.[a]&&e!==`submit`&&!r&&this.baseStore.setState(e=>({...e,errorMap:{...e.errorMap,[a]:void 0}}));let o=mQ(`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=GZ(e,{...this.options,form:this,group:t?.group,validationLogic:this.options.validationLogic||iQ});this.state.isFormValidating||this.baseStore.setState(e=>({...e,isFormValidating:!0}));let r=[],i;for(let e of n){if(!e.validate)continue;let n=mQ(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}=pQ(r);s&&(i=i?{...i,...s}:s);let c=mQ(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)??lQ,r=i?.[e],{newErrorValue:a,newSource:o}=JZ({newFormValidatorError:r,isPreviousErrorFromFormValidator:n?.[c]===`form`,previousErrorValue:t?.[c]});t?.[c]!==a&&this.setFieldMeta(e,(e=lQ)=>({...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})),xZ(()=>{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}),MZ.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}),MZ.emit(`form-submission`,{id:this._formId,submissionAttempt:this.state.submissionAttempts,successful:!1,stage:`validate`,errors:this.state.errors});return}xZ(()=>{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}),xZ(()=>{this.baseStore.setState(e=>({...e,isSubmitted:!0,isSubmitSuccessful:!0})),MZ.emit(`form-submission`,{id:this._formId,submissionAttempt:this.state.submissionAttempts,successful:!0}),n()})}catch(e){throw this.baseStore.setState(e=>({...e,isSubmitSuccessful:!1})),MZ.emit(`form-submission`,{id:this._formId,submissionAttempt:this.state.submissionAttempts,successful:!1,stage:`inflight`,onError:e}),n(),e}},this.getFieldValue=e=>PZ(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]:NZ(t,n.fieldMetaBase[e])}}))},this.resetFieldMeta=e=>Object.keys(e).reduce((e,t)=>{let n=t;return e[n]=lQ,e},{}),this.setFieldValue=(e,t,n)=>{let r=n?.dontUpdateMeta??!1,i=n?.dontRunListeners??!1,a=n?.dontValidate??!1;xZ(()=>{r||this.setFieldMeta(e,e=>({...e,isTouched:!0,isDirty:!0,errorMap:{...e?.errorMap,onMount:void 0}})),this.baseStore.setState(n=>({...n,values:FZ(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=IZ(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),uQ(this).bumpArrayVersion(e)},this.insertFieldValue=async(e,t,n,r)=>{this.setFieldValue(e,e=>[...e.slice(0,t),n,...e.slice(t)],XZ(r,{dontValidate:!0}));let i=r?.dontValidate??!1;i||await this.validateField(e,`change`),uQ(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),XZ(r,{dontValidate:!0})),uQ(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),XZ(n,{dontValidate:!0})),uQ(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 FZ(FZ(e,`${t}`,i),`${n}`,r)},XZ(r,{dontValidate:!0})),uQ(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},XZ(r,{dontValidate:!0})),uQ(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,[],XZ(t,{dontValidate:!0})),uQ(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=PZ(this.options.defaultValues,e),i=n??r;return{...t,fieldMetaBase:{...t.fieldMetaBase,[e]:lQ},values:i===void 0?t.values:FZ(t.values,e,i)}})},this.setErrorMap=e=>{xZ(()=>{Object.entries(e).forEach(([e,t])=>{let n=e;if(KZ(t)){let{formError:e,fieldErrors:r}=pQ(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=>sQ.validate({value:this.state.values,validationSource:`form`},e),this.parseValuesWithSchemaAsync=e=>sQ.validateAsync({value:this.state.values,validationSource:`form`},e),this.timeoutIds={validations:{},listeners:{},formListeners:{}},this._formId=e?.formId??eQ(),this._devtoolsSubmissionOverride=!1;let t=dQ({...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||!KZ(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=OZ(t);let n;this.fieldMetaDerived=OZ(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=PZ(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=!UZ(u),f=!o.isDirty,p=qZ(l,this.getFieldInfo(a)?.instance?.options.defaultValue??PZ(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=OZ(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||!rQ(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&&rQ(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=OZ(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&&KZ(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&&qZ(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 cQ(e.validate)?sQ[e.type](e.value,e.validate):e.validate(e.value)}handleSubmit(e){return this._handleSubmit(e)}};function pQ(e){return e?KZ(e)?{formError:pQ(e.form).formError,fieldErrors:e.fields}:{formError:e}:{formError:void 0}}function mQ(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 hQ=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]:{...lQ,isTouched:e.fieldMetaBase[this.name]?.isTouched??lQ.isTouched,isBlurred:e.fieldMetaBase[this.name]?.isBlurred??lQ.isBlurred,isDirty:e.fieldMetaBase[this.name]?.isDirty??lQ.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&&(qZ(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,XZ(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,XZ(t,{dontRunListeners:!0})),t?.dontRunListeners||this.triggerOnChangeListener()},this.insertValue=(e,t,n)=>{this.form.insertFieldValue(this.name,e,t,XZ(n,{dontRunListeners:!0})),n?.dontRunListeners||this.triggerOnChangeListener()},this.replaceValue=(e,t,n)=>{this.form.replaceFieldValue(this.name,e,t,XZ(n,{dontRunListeners:!0})),n?.dontRunListeners||this.triggerOnChangeListener()},this.removeValue=(e,t)=>{this.form.removeFieldValue(this.name,e,XZ(t,{dontRunListeners:!0})),t?.dontRunListeners||this.triggerOnChangeListener()},this.swapValues=(e,t,n)=>{this.form.swapFieldValues(this.name,e,t,XZ(n,{dontRunListeners:!0})),n?.dontRunListeners||this.triggerOnChangeListener()},this.moveValue=(e,t,n)=>{this.form.moveFieldValues(this.name,e,t,XZ(n,{dontRunListeners:!0})),n?.dontRunListeners||this.triggerOnChangeListener()},this.clearValues=e=>{this.form.clearFieldValues(this.name,XZ(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=WZ(e,{...this.options,form:this.form,fieldName:this.name,validationLogic:this.form.options.validationLogic||iQ}),r=this.getLinkedFields(e).reduce((t,n)=>{let r=WZ(e,{...n.options,form:n.form,fieldName:n.name,validationLogic:n.form.options.validationLogic||iQ});return r.forEach(e=>{e.field=n}),t.concat(r)},[]),i=!1;xZ(()=>{let e=(e,n)=>{let r=_Q(n.cause),a=n.validate?gQ(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}=YZ({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=_Q(`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=GZ(e,{...this.options,form:this.form,fieldName:this.name,validationLogic:this.form.options.validationLogic||iQ}),r=await t,i=this.getLinkedFields(e).reduce((t,n)=>{let r=GZ(e,{...n.options,form:n.form,fieldName:n.name,validationLogic:n.form.options.validationLogic||iQ});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)));xZ(()=>{s&&this.startValidation();for(let e of c)e.startValidation()});let l=(e,t,n)=>{let i=_Q(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=gQ(a),c=r[e.name]?.[i],{newErrorValue:l,newSource:u}=YZ({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)),xZ(()=>{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=>rQ(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[_Q(e)]?.lastAbortController.abort();let t=[];for(let r of n)r.getInfo().validationMetaMap[_Q(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=>sQ.validate({value:this.state.value,validationSource:`field`},e),this.parseValueWithSchemaAsync=e=>sQ.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)rQ(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=OZ(e=>{this.form.store.get();let n=this.form.getFieldMeta(this.name)??{...lQ,...t.defaultMeta},r=this.form.getFieldValue(this.name);return!n.isTouched&&r===void 0&&this.options.defaultValue!==void 0&&!qZ(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 cQ(e.validate)?sQ[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 gQ(e){if(e)return e}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`}}function vQ(e){return{isSubmitted:e.isSubmitted??!1,isSubmitting:e.isSubmitting??!1,isValidating:e.isValidating??!1,submissionAttempts:e.submissionAttempts??0,isSubmitSuccessful:e.isSubmitSuccessful??!1}}function yQ(e){return{...lQ,...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 bQ=class e{constructor(t){this.options={},this.setFormGroupState=e=>{this.form.baseStore.setState(t=>{let n=t.formGroupStateBase[this.name]??vQ({});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&&(qZ(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,{...lQ,...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]??vQ({...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;SQ(t)&&(n=t.group,r=t.fields);let i=xQ(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]:vQ({})}})),this.fieldInfo.instance=null,this.options.listeners?.onUnmount?.({value:this.state.value,groupApi:this})}}},this.setValue=(e,t)=>{this.form.setFieldValue(this.name,e,XZ(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 hQ&&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&&rQ(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}=JZ({newFormValidatorError:i,isPreviousErrorFromFormValidator:o?.errorSourceMap[e]===`form`,previousErrorValue:s});c&&(a=!0),(s!==c||o?.errorSourceMap[e]!==l)&&this.form.setFieldMeta(n,(t=lQ)=>({...t,errorMap:{...t.errorMap,[e]:c},errorSourceMap:{...t.errorSourceMap,[e]:l}}))}return this._lastDistributedFieldNames[e]=r,a},this.validateSync=(t,n,r={})=>{let i=WZ(t,{...this.options,form:this.form,group:this,validationLogic:this.options.validationLogic||this.form.options.validationLogic||iQ}),a=(r.skipRelatedFieldValidation?[]:this.getRelatedFields()).reduce((e,n)=>{let r=WZ(t,{...n.options,form:n.form,validationLogic:n.form.options.validationLogic||iQ});return r.forEach(e=>{e.field=n}),e.concat(r)},[]),o=!1;xZ(()=>{let t=(t,r)=>{let i=wQ(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&&SQ(s)&&(c=s.group,l=s.fields);let u=xQ(c),d=n[i],{newErrorValue:f,newSource:p}=YZ({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=wQ(`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=GZ(t,{...this.options,form:this.form,group:this,validationLogic:this.options.validationLogic||this.form.options.validationLogic||iQ}),a=await n,o=r.skipRelatedFieldValidation?[]:this.getRelatedFields(),s=o.reduce((e,n)=>{let r=GZ(t,{...n.options,form:n.form,validationLogic:n.form.options.validationLogic||iQ});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=wQ(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&&SQ(o)&&(l=o.group,u=o.fields);let d=xQ(l),f=a[t.name]?.[i],{newErrorValue:p,newSource:m}=YZ({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 xZ(()=>{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=>rQ(this.name,e)}),{hasErrored:r}=this.validateSync(e,n[this.name]??{},{skipRelatedFieldValidation:t?.skipRelatedFieldValidation});if(r&&!this.options.asyncAlways)return this.getInfo().validationMetaMap[wQ(e)]?.lastAbortController.abort(),this.state.meta.errors;let i=t?.skipFormValidation?Promise.resolve({}):this.form.validateAsync(e,{dontUpdateFormErrorMap:!0,filterFieldNames:e=>rQ(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})),xZ(()=>{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}xZ(()=>{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}),xZ(()=>{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=OZ(e=>{this.form.formGroupMetaDerived.get(),this.form.baseStore.get();let n=this.form.getFormGroupMeta(this.name)??yQ(t.defaultMeta),r=this.form.getFieldValue(this.name);return!n.isTouched&&r===void 0&&this.options.defaultValue!==void 0&&!qZ(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(cQ(e.validate)){let t=sQ[e.type](e.value,e.validate);return e.type===`validate`?CQ(t):t.then(CQ)}return e.validate(e.value)}handleSubmit(e){return this._handleSubmit(e)}};function xQ(e){if(e)return e}function SQ(e){return!!e&&typeof e==`object`&&`fields`in e}function CQ(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 wQ(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 TQ(e,t){if(!t)return;let n=Object.assign({},e,{state:nQ(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 xZ(()=>{Object.keys(r).length&&e.baseStore.setState(e=>({...e,...r})),n.state.errorMap!==e.state.errorMap&&e.setErrorMap(n.state.errorMap)}),n}var EQ=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})),DQ=o(((e,t)=>{t.exports=EQ()})),OQ=o((e=>{var t=d(),n=DQ();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}})),kQ=o(((e,t)=>{t.exports=OQ()}))();function AQ(e,t){return e===t}function jQ(e,t=e=>e,n){let r=n?.compare??AQ,i=(0,K.useCallback)(t=>{let{unsubscribe:n}=e.subscribe(t);return n},[e]),a=(0,K.useCallback)(()=>e.get(),[e]);return(0,kQ.useSyncExternalStoreWithSelector)(i,a,a,t,r)}var MQ=typeof window<`u`?K.useLayoutEffect:K.useEffect;function NQ(e){let[t,n]=(0,K.useState)(()=>({form:e.form,name:e.name})),[r,i]=(0,K.useState)(()=>new hQ({...e})),a=r;(t.form!==e.form||t.name!==e.name)&&(a=new hQ({...e}),i(a),n({form:e.form,name:e.name}));let o=jQ(a.store,e.mode===`array`?e=>e.meta._arrayVersion||0:e=>e.value),s=jQ(a.store,e=>e.meta.isTouched),c=jQ(a.store,e=>e.meta.isBlurred),l=jQ(a.store,e=>e.meta.isDirty),u=jQ(a.store,e=>e.meta.errorMap),d=jQ(a.store,e=>e.meta.errorSourceMap),f=jQ(a.store,e=>e.meta.isValidating),p=(0,K.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 MQ(a.mount,[a]),MQ(()=>{a.update(e)}),p}var PQ=(({children:e,...t})=>{let n=NQ(t),r=(0,K.useMemo)(()=>NZ(e,n),[e,n]);return(0,X.jsx)(X.Fragment,{children:r})});function FQ(){return(0,K.useState)(()=>eQ())[0]}var IQ=K,LQ=`18.3.1`.split(`.`)[0]===`17`?FQ:IQ.useId;function RQ(e){let[t,n]=(0,K.useState)(()=>({form:e.form,name:e.name})),[r,i]=(0,K.useState)(()=>new bQ({...e}));(t.form!==e.form||t.name!==e.name)&&(i(new bQ({...e})),n({form:e.form,name:e.name}));let a=jQ(r.store,e=>e.value),o=jQ(r.store,e=>e.meta.isTouched),s=jQ(r.store,e=>e.meta.isBlurred),c=jQ(r.store,e=>e.meta.isDirty),l=jQ(r.store,e=>e.meta.errorMap),u=jQ(r.store,e=>e.meta.errorSourceMap),d=jQ(r.store,e=>e.meta.isValidating),f=jQ(r.store,e=>e.meta.isSubmitting),p=jQ(r.store,e=>e.meta.isSubmitted),m=jQ(r.store,e=>e.meta.submissionAttempts),h=jQ(r.store,e=>e.meta.isSubmitSuccessful),g=jQ(r.store,e=>e.meta.canSubmit),_=jQ(r.store,e=>e.meta.isValid),v=jQ(r.store,e=>e.meta.isFieldsValid),y=jQ(r.store,e=>e.meta.isFieldsValidating),b=jQ(r.store,e=>e.meta.isGroupValid),x=(0,K.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 MQ(r.mount,[r]),MQ(()=>{r.update(e)}),x}var zQ=(({children:e,...t})=>{let n=RQ(t),r=(0,K.useMemo)(()=>NZ(e,n),[e,n]);return(0,X.jsx)(X.Fragment,{children:r})});function BQ({form:e,selector:t=e=>e,children:n}){let r=jQ(e.store,t);return(0,X.jsx)(X.Fragment,{children:NZ(n,r)})}function VQ(e){let t=LQ(),[n,r]=(0,K.useState)(e?.formId),[i,a]=(0,K.useState)(()=>new fQ({...e,formId:e?.formId??t}));if(n!==e?.formId){let n=e?.formId??t;a(new fQ({...e,formId:n})),r(n)}let o=(0,K.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,X.jsx)(PQ,{...e,form:i})},e.FormGroup=function(e){return(0,X.jsx)(zQ,{...e,form:i})},e.Subscribe=function(e){return(0,X.jsx)(BQ,{form:i,selector:e.selector,children:e.children})},e},[i]);MQ(i.mount,[]),MQ(()=>{i.update(e)});let s=(0,K.useRef)(!1);return MQ(()=>{s.current&&e?.transform&&TQ(i,e.transform)},[i,e?.transform]),MQ(()=>{s.current=!0}),o}var HQ={...K},UQ={};function WQ(e,t){let n=K.useRef(UQ);return n.current===UQ&&(n.current=e(t)),n}var GQ=HQ.useInsertionEffect,KQ=GQ&&GQ!==HQ.useLayoutEffect?GQ:e=>e();function qQ(e){let t=WQ(JQ).current;return t.next=e,KQ(t.effect),t.trampoline}function JQ(){let e={next:void 0,callback:YQ,trampoline:(...t)=>e.callback?.(...t),effect:()=>{e.callback=e.next}};return e}function YQ(){}function XQ(){}var ZQ=Object.freeze([]),QQ=Object.freeze({});function $Q(e){K.useEffect(e,ZQ)}var e$=0,t$=class e{static create(){return new e}currentId=e$;start(e,t){this.clear(),this.currentId=setTimeout(()=>{this.currentId=e$,t()},e)}isStarted(){return this.currentId!==e$}clear=()=>{this.currentId!==e$&&(clearTimeout(this.currentId),this.currentId=e$)};disposeEffect=()=>this.clear};function n$(){let e=WQ(t$.create).current;return $Q(e.disposeEffect),e}function r$(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 i$=r$(`https://base-ui.com/production-error`,`Base UI`),a$=K.createContext(void 0);function o$(){let e=K.useContext(a$);if(e===void 0)throw Error(i$(53));return e}function s$(e,t,n,r){let i=WQ(l$).current;return u$(i,e,t,n,r)&&f$(i,[e,t,n,r]),i.callback}function c$(e){let t=WQ(l$).current;return d$(t,e)&&f$(t,e),t.callback}function l$(){return{callback:null,cleanup:null,refs:[]}}function u$(e,t,n,r,i){return e.refs[0]!==t||e.refs[1]!==n||e.refs[2]!==r||e.refs[3]!==i}function d$(e,t){return e.refs.length!==t.length||e.refs.some((e,n)=>e!==t[n])}function f$(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 p$=18;function m$(e){return p$>=e}function h$(e){if(!K.isValidElement(e))return null;let t=e,n=t.props;return(m$(19)?n?.ref:t.ref)??null}function g$(e,t){if(e&&!t)return e;if(!e&&t)return t;if(e||t)return{...e,...t}}function _$(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 v$(e,t){return typeof e==`function`?e(t):e}function y$(e,t){return typeof e==`function`?e(t):e}var b$={};function x$(e,t,n,r,i){if(!n&&!r&&!i&&!e)return C$(t);let a=C$(e);return t&&(a=w$(a,t)),n&&(a=w$(a,n)),r&&(a=w$(a,r)),i&&(a=w$(a,i)),a}function S$(e){if(e.length===0)return b$;if(e.length===1)return C$(e[0]);let t=C$(e[0]);for(let n=1;n<e.length;n+=1)t=w$(t,e[n]);return t}function C$(e){return O$(e)?{...e(b$)}:T$(e)}function w$(e,t){return O$(t)?t(e):E$(e,t)}function T$(e){let t={...e};for(let e in t){let n=t[e];D$(e,n)&&(t[e]=A$(n))}return t}function E$(e,t){if(!t)return e;for(let n in t){let r=t[n];switch(n){case`style`:e[n]=g$(e.style,r);break;case`className`:e[n]=M$(e.className,r);break;default:e[n]=D$(n,r)?k$(e[n],r):r}}return e}function D$(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 O$(e){return typeof e==`function`}function k$(e,t){return t?e?(...n)=>{let r=n[0];if(N$(r)){let i=r;j$(i);let a=t(...n);return i.baseUIHandlerPrevented||e?.(...n),a}let i=t(...n);return e?.(...n),i}:A$(t):e}function A$(e){return e&&((...t)=>{let n=t[0];return N$(n)&&j$(n),e(...t)})}function j$(e){return e.preventBaseUIHandler=()=>{e.baseUIHandlerPrevented=!0},e}function M$(e,t){return t?e?t+` `+e:t:e}function N$(e){return typeof e==`object`&&!!e&&`nativeEvent`in e}function P$(e,t,n={}){let r=t.render;n.enabled!==!1&&(r=R$(r));let i=F$(t,n,r);if(n.enabled===!1)return null;let a=n.state??QQ;return z$(e,r,i,a)}function F$(e,t,n){let{className:r,style:i}=e,{state:a=QQ,ref:o,props:s,stateAttributesMapping:c,enabled:l=!0}=t,u=l?v$(r,a):void 0,d=l?y$(i,a):void 0,f=l?_$(a,c):QQ,p=l&&s?I$(s):void 0,m=l?g$(f,p)??{}:QQ;return typeof document<`u`&&(l?m.ref=Array.isArray(o)?c$([m.ref,h$(n),...o]):s$(m.ref,h$(n),o):s$(null,null)),l?(u!==void 0&&(m.className=M$(m.className,u)),d!==void 0&&(m.style=g$(m.style,d)),m):QQ}function I$(e){return Array.isArray(e)?S$(e):x$(void 0,e)}var L$=Symbol.for(`react.lazy`);function R$(e){if(e?.$$typeof!==L$)return e;let t=K.Children.toArray(e)[0];return K.isValidElement(t)?t:e}function z$(e,t,n,r){if(t){if(typeof t==`function`)return t(n,r);let e=x$(n,t.props);return e.ref=n.ref,K.cloneElement(t,e)}return B$(e,n)}function B$(e,t){return e===`button`?(0,K.createElement)(`button`,{type:`button`,...t,key:t.key}):e===`img`?(0,K.createElement)(`img`,{alt:``,...t,key:t.key}):K.createElement(e,t)}function V$(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 H$=`base-ui-disable-scrollbar`,U$={className:H$,getElement(e){return(0,X.jsx)(`style`,{nonce:e,href:H$,precedence:`base-ui:low`,children:`.${H$}{scrollbar-width:none}.${H$}::-webkit-scrollbar{display:none}`})}};function W$(){let[,e]=K.useState({});return K.useCallback(()=>{e({})},[])}var G$=0;function K$(e,t=`mui`){let n=K.useRef(void 0),r=W$(),i=e??n.current;return K.useEffect(()=>{n.current??(G$+=1,n.current=`${t}-${G$}`,e??r())},[e,t,r]),i}var q$=HQ.useId;function J$(e,t){if(q$!==void 0){let n=q$();return e??(t?`${t}-${n}`:n)}return K$(e,t)}function Y$(e){return J$(e,`base-ui`)}var X$=`data-has-overflow-x`,Z$=`data-has-overflow-y`,Q$=`data-overflow-x-start`,$$=`data-overflow-x-end`,e1=`data-overflow-y-start`,t1=`data-overflow-y-end`,n1=e=>t=>t?{[e]:``}:null,r1={hasOverflowX:n1(X$),hasOverflowY:n1(Z$),overflowXStart:n1(Q$),overflowXEnd:n1($$),overflowYStart:n1(e1),overflowYEnd:n1(t1),cornerHidden:()=>null};function i1(){return typeof window<`u`}function a1(e){return c1(e)?(e.nodeName||``).toLowerCase():`#document`}function o1(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function s1(e){return((c1(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function c1(e){return i1()?e instanceof Node||e instanceof o1(e).Node:!1}function l1(e){return i1()?e instanceof Element||e instanceof o1(e).Element:!1}function u1(e){return i1()?e instanceof HTMLElement||e instanceof o1(e).HTMLElement:!1}function d1(e){return!i1()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof o1(e).ShadowRoot}function f1(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=C1(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function p1(e){return/^(table|td|th)$/.test(a1(e))}function m1(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var h1=/transform|translate|scale|rotate|perspective|filter/,g1=/paint|layout|strict|content/,_1=e=>!!e&&e!==`none`,v1;function y1(e){let t=l1(e)?C1(e):e;return _1(t.transform)||_1(t.translate)||_1(t.scale)||_1(t.rotate)||_1(t.perspective)||!x1()&&(_1(t.backdropFilter)||_1(t.filter))||h1.test(t.willChange||``)||g1.test(t.contain||``)}function b1(e){let t=T1(e);for(;u1(t)&&!S1(t);){if(y1(t))return t;if(m1(t))return null;t=T1(t)}return null}function x1(){return v1??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),v1}function S1(e){return/^(html|body|#document)$/.test(a1(e))}function C1(e){return o1(e).getComputedStyle(e)}function w1(e){return l1(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function T1(e){if(a1(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||d1(e)&&e.host||s1(e);return d1(t)?t.host:t}function E1(e){let t=T1(e);return S1(t)?(e.ownerDocument||e).body:u1(t)&&f1(t)?t:E1(t)}function D1(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=E1(e),i=r===e.ownerDocument?.body,a=o1(r);if(i){let e=O1(a);return t.concat(a,a.visualViewport||[],f1(r)?r:[],e&&n?D1(e):[])}return t.concat(r,D1(r,[],n))}function O1(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function k1(){return typeof navigator>`u`?{userAgent:``,platform:``,maxTouchPoints:0}:{userAgent:navigator.userAgent,platform:navigator.platform??``,maxTouchPoints:navigator.maxTouchPoints??0}}var{userAgent:A1,platform:j1,maxTouchPoints:M1}=k1(),N1=A1.toLowerCase(),P1=j1.toLowerCase(),F1=/^i(os$|p)/.test(P1)||P1===`macintel`&&M1>1,I1=`android`,L1=P1===I1||N1.includes(I1),R1=!F1&&P1.startsWith(`mac`);P1.startsWith(`win`),!L1&&/^(linux|chrome os)/.test(P1);var z1=R1||F1,B1=typeof CSS<`u`&&!!CSS.supports?.(`-webkit-backdrop-filter:none`);!B1&&N1.includes(`firefox`),!B1&&N1.includes(`chrom`);var V1=z1,H1=/jsdom|happydom/.test(N1);function U1(e){let t=e.activeElement;for(;t?.shadowRoot?.activeElement!=null;)t=t.shadowRoot.activeElement;return t}function W1(e,t){if(!e||!t)return!1;let n=t.getRootNode?.();if(e.contains(t))return!0;if(n&&d1(n)){let n=t;for(;n;){if(e===n)return!0;n=n.parentNode||n.host}}return!1}function G1(e,t){let n=e;for(;n;){if(l1(n)&&n.matches(t))return n;n=n.assignedSlot??n.parentNode??(d1(n)?n.host:null)}return null}function K1(e){return`composedPath`in e?e.composedPath()[0]??e.target:e.target}var q1=`data-base-ui-focusable`,J1=`input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])`,Y1=`ArrowLeft`,X1=`ArrowRight`,Z1=`ArrowUp`,Q1=`ArrowDown`,$1=`data-starting-style`,e0=`data-ending-style`,t0={[$1]:``},n0={[e0]:``},r0={transitionStatus(e){return e===`starting`?t0:e===`ending`?n0:null}},i0=`data-open`,a0=`data-closed`,o0=`data-anchor-hidden`,s0=`data-popup-open`,c0=`data-pressed`,l0={[s0]:``},u0={[s0]:``,[c0]:``},d0={[i0]:``},f0={[a0]:``},p0={[o0]:``},m0={open(e){return e?l0:null}},h0={open(e){return e?u0:null}},g0={open(e){return e?d0:f0},anchorHidden(e){return e?p0:null}},_0={...g0,...r0},v0=`data-trigger-disabled`;function y0(e,t){if(!l1(e))return!1;let n=e;if(t.hasElement(n))return!n.hasAttribute(v0);for(let[,e]of t.entries())if(W1(e,n))return!e.hasAttribute(v0);return!1}function b0(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 x0(e){return e.matches(`html,body`)}function S0(e){return u1(e)&&e.matches(`input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])`)}function C0(e){return G1(e,`button,a[href],[role="button"],select,[tabindex]:not([tabindex="-1"]),${J1}`)!=null}function w0(e){return e?e.getAttribute(`role`)===`combobox`&&S0(e):!1}function T0(e){if(!e||H1)return!0;try{return e.matches(`:focus-visible`)}catch{return!0}}function E0(e){return e?e.hasAttribute(`data-base-ui-focusable`)?e:e.querySelector(`[data-base-ui-focusable]`)||e:null}function D0(e,t,n=!0){return e.filter(e=>e.parentId===t).flatMap(t=>[...!n||t.context?.open?[t]:[],...D0(e,t.id,n)])}function O0(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 k0(e){e.preventDefault(),e.stopPropagation()}function A0(e){return`nativeEvent`in e}function j0(e){return e.pointerType===``&&e.isTrusted?!0:L1&&e.pointerType?e.type===`click`&&e.buttons===1:e.detail===0&&!e.pointerType}function M0(e){return H1?!1:!L1&&e.width===0&&e.height===0||e.type===`pointerdown`&&e.width===1&&e.height===1&&e.pressure===0&&e.detail===0&&e.pointerType===`mouse`&&(L1||e.buttons===0)||e.width<1&&e.height<1&&e.pressure===0&&e.detail===0&&e.pointerType===`touch`}function N0(e,t){let n=[`mouse`,`pen`];return t||n.push(``,void 0),n.includes(e)}function P0(e){let t=e.type;return t===`click`||t===`mousedown`||t===`keydown`||t===`keyup`}var F0=Math.min,I0=Math.max,L0=Math.round,R0=Math.floor,z0=e=>({x:e,y:e}),B0={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function V0(e,t,n){return I0(e,F0(t,n))}function H0(e,t){return typeof e==`function`?e(t):e}function U0(e){return e.split(`-`)[0]}function W0(e){return e.split(`-`)[1]}function G0(e){return e===`x`?`y`:`x`}function K0(e){return e===`y`?`height`:`width`}function q0(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function J0(e){return G0(q0(e))}function Y0(e,t,n){n===void 0&&(n=!1);let r=W0(e),i=J0(e),a=K0(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=r2(o)),[o,r2(o)]}function X0(e){let t=r2(e);return[Z0(e),t,Z0(t)]}function Z0(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var Q0=[`left`,`right`],$0=[`right`,`left`],e2=[`top`,`bottom`],t2=[`bottom`,`top`];function eae(e,t,n){switch(e){case`top`:case`bottom`:return n?t?$0:Q0:t?Q0:$0;case`left`:case`right`:return t?e2:t2;default:return[]}}function n2(e,t,n,r){let i=W0(e),a=eae(U0(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(Z0)))),a}function r2(e){let t=U0(e);return B0[t]+e.slice(t.length)}function i2(e){return{top:e.top??0,right:e.right??0,bottom:e.bottom??0,left:e.left??0}}function a2(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:i2(e)}function o2(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 s2(e,t){return t<0||t>=e.length}function c2(e,t){return d2(e.current,{disabledIndices:t})}function l2(e,t){return d2(e.current,{decrement:!0,startingIndex:e.current.length,disabledIndices:t})}function u2(e,t,n){let{decrement:r,loopFocus:i,allowEscape:a,disabledIndices:o,minIndex:s,maxIndex:c}=n,l=()=>d2(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:s2(e,u)?-1:u,wrapped:d}}function d2(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&&f2(e,a,r));return a}function f2(e,t,n){if(typeof n==`function`?n(t):n?.includes(t)??!1)return!0;let r=e[t];return r?!m2(r)||r.matches(`:disabled`)?!0:!n&&(r.hasAttribute(`disabled`)||r.getAttribute(`aria-disabled`)===`true`):!1}function p2(e){return e.visibility===`hidden`||e.visibility===`collapse`}function m2(e,t=e?C1(e):null){return!e||!e.isConnected||!t||p2(t)?!1:typeof e.checkVisibility==`function`?e.checkVisibility():t.display!==`none`&&t.display!==`contents`}function h2(e){return e?.ownerDocument||document}var g2=`a[href],button,input,select,textarea,summary,details,iframe,object,embed,[tabindex],[contenteditable]:not([contenteditable="false"]),audio[controls],video[controls]`;function _2(e){let t=e.assignedSlot;if(t)return t;if(e.parentElement)return e.parentElement;let n=e.getRootNode();return d1(n)?n.host:null}function v2(e){for(let t of Array.from(e.children))if(a1(t)===`summary`)return t;return null}function y2(e,t){let n=v2(t);return!!n&&(e===n||W1(n,e))}function b2(e){let t=e?a1(e):``;return e!=null&&e.matches(g2)&&(t!==`summary`||e.parentElement!=null&&a1(e.parentElement)===`details`&&v2(e.parentElement)===e)&&(t!==`details`||v2(e)==null)&&(t!==`input`||e.type!==`hidden`)}function x2(e){if(!b2(e)||!e.isConnected||e.matches(`:disabled`))return!1;for(let t=e;t;t=_2(t)){let n=t!==e,r=a1(t)===`slot`;if(t.hasAttribute(`inert`)||n&&a1(t)===`details`&&!t.open&&!y2(e,t)||t.hasAttribute(`hidden`)||!r&&!S2(t,n))return!1}return!0}function S2(e,t){let n=C1(e);return t?n.display!==`none`:m2(e,n)}function C2(e){let t=e.tabIndex;if(t<0){let t=a1(e);if(t===`details`||t===`audio`||t===`video`||u1(e)&&e.isContentEditable)return 0}return t}function w2(e){if(a1(e)!==`input`)return null;let t=e;return t.type===`radio`&&t.name!==``?t:null}function T2(e,t){let n=w2(e);if(!n)return!0;let r=t.find(e=>{let t=w2(e);return t?.name===n.name&&t.form===n.form&&t.checked});return r?r===n:t.find(e=>{let t=w2(e);return t?.name===n.name&&t.form===n.form})===n}function E2(e){if(u1(e)&&a1(e)===`slot`){let t=e.assignedElements({flatten:!0});if(t.length>0)return t}return u1(e)&&e.shadowRoot?Array.from(e.shadowRoot.children):Array.from(e.children)}function D2(e,t){E2(e).forEach(e=>{b2(e)&&t.push(e),D2(e,t)})}function O2(e,t,n){E2(e).forEach(e=>{u1(e)&&e.matches(t)&&n.push(e),O2(e,t,n)})}function k2(e){return x2(e)&&C2(e)>=0}function A2(e){let t=[];return D2(e,t),t.filter(x2)}function j2(e){let t=A2(e);return t.filter(e=>C2(e)>=0&&T2(e,t))}function M2(e,t){let n=j2(e),r=n.length;if(r===0)return;let i=U1(h2(e)),a=n.indexOf(i);return n[a===-1?t===1?0:r-1:a+t]}function N2(e){return M2(h2(e).body,1)||e}function P2(e){return M2(h2(e).body,-1)||e}function F2(e,t,n){if(!e)return null;let r=[];D2(h2(e).body,r);let i=r.indexOf(e);if(i===-1)return null;let a=r.filter(x2);for(let e=1;e<r.length;e+=1){let o=r[(i+t*e+r.length)%r.length];if(!W1(n,o)&&k2(o)&&T2(o,a))return o}return r[i]}function I2(e,t){let n=t||e.currentTarget,r=e.relatedTarget;return!r||!W1(n,r)}function L2(e){j2(e).forEach(e=>{e.dataset.tabindex=e.getAttribute(`tabindex`)||``,e.setAttribute(`tabindex`,`-1`)})}function R2(e){let t=[];O2(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 z2=K.createContext(void 0),B2={disableStyleElements:!1};function V2(){return K.useContext(z2)??B2}var H2=`--scroll-area-corner-height`,U2=`--scroll-area-corner-width`,W2=`data-orientation`,G2={x:0,y:0},K2={width:0,height:0},q2={xStart:!1,xEnd:!1,yStart:!1,yEnd:!1},J2={x:!0,y:!0,corner:!0},Y2=K.forwardRef(function(e,t){let{render:n,className:r,overflowEdgeThreshold:i,style:a,...o}=e,{xStart:s,xEnd:c,yStart:l,yEnd:u}=X2(i),d=Y$(),f=n$(),p=n$(),{nonce:m,disableStyleElements:h}=V2(),[g,_]=K.useState(!1),[v,y]=K.useState(!1),[b,x]=K.useState(!1),[S,C]=K.useState(!1),[w,T]=K.useState(!1),[E,D]=K.useState(K2),[O,k]=K.useState(K2),[A,j]=K.useState(q2),[M,N]=K.useState(J2),P=K.useRef(null),F=K.useRef(null),I=K.useRef(null),L=K.useRef(null),R=K.useRef(null),z=K.useRef(null),ee=K.useRef(null),B=K.useRef(null),V=K.useRef(0),te=K.useRef(0),ne=K.useRef(0),H=K.useRef(0),U=K.useRef(`vertical`),re=K.useRef(G2),ie=K.useRef(null);function ae(e){let t=e?x:y,n=e?f:p;t(!0),n.start(500,()=>{t(!1)})}let oe=qQ(e=>{let t=e.x-re.current.x,n=e.y-re.current.y;re.current=e,n!==0&&ae(!0),t!==0&&ae(!1)}),se=qQ(()=>{let e=F.current;e&&ie.current===null&&(ie.current=e.style.scrollSnapType,e.style.scrollSnapType=`none`)}),W=qQ(e=>{if(e.button!==0||B.current!==null&&(U.current===`vertical`?R.current:z.current)?.hasPointerCapture(B.current))return;B.current=e.pointerId,V.current=e.clientY,te.current=e.clientX,U.current=e.currentTarget.getAttribute(W2);let t=F.current;t&&(ne.current=t.scrollTop,H.current=t.scrollLeft,se()),(U.current===`vertical`?R.current:z.current)?.setPointerCapture(e.pointerId)}),G=qQ(e=>{if(e.pointerId!==B.current)return;B.current=null,(U.current===`vertical`?x:y)(!1),ie.current!==null&&(F.current&&(F.current.style.scrollSnapType=ie.current),ie.current=null);let t=U.current===`vertical`?R.current:z.current;t?.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId)}),ce=qQ(e=>{if(e.pointerId!==B.current)return;if(e.buttons%2==0){G(e);return}let t=F.current;if(!t)return;let n=U.current===`vertical`,r=n?R.current:z.current,i=n?I.current:L.current;if(!r||!i)return;let a=n?`y`:`x`,o=V$(i,`padding`,a),s=V$(r,`margin`,a),c=n?r.offsetHeight:r.offsetWidth,l=(n?i.offsetHeight:i.offsetWidth)-c-o-s,u=n?e.clientY-V.current:e.clientX-te.current,d=l<=0?0:u/l,f=n?t.scrollHeight:t.scrollWidth,p=n?t.clientHeight:t.clientWidth,m=(n?ne.current:H.current)+d*(f-p);n?t.scrollTop=m:t.scrollLeft=m,e.preventDefault(),ae(n)});function le(e){C(e.pointerType===`touch`)}function ue(e){if(le(e),e.pointerType!==`touch`){let t=W1(P.current,e.target);_(t)}}let de=K.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]),fe={role:`presentation`,onPointerEnter:ue,onPointerMove:ue,onPointerDown:le,onPointerLeave(){_(!1)},style:{position:`relative`,[H2]:`${E.height}px`,[U2]:`${E.width}px`}},pe=P$(`div`,e,{state:de,ref:[t,P],props:[fe,o],stateAttributesMapping:r1}),me=K.useMemo(()=>({handlePointerDown:W,handlePointerMove:ce,handlePointerUp:G,handleScroll:oe,disableViewportSnap:se,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:de,overflowEdgeThreshold:{xStart:s,xEnd:c,yStart:l,yEnd:u}}),[W,ce,G,oe,se,E,O,w,S,v,b,g,d,M,A,de,s,c,l,u]);return(0,X.jsxs)(a$.Provider,{value:me,children:[!h&&U$.getElement(m),pe]})});function X2(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 Z2=typeof document<`u`?K.useLayoutEffect:()=>{};function Q2(e,t=-(2**53-1),n=2**53-1){return Math.max(t,Math.min(e,n))}var $2=K.createContext(void 0);function e4(){let e=K.useContext($2);if(e===void 0)throw Error(i$(55));return e}var t4=K.createContext(void 0);function n4(){return K.useContext(t4)?.direction??`ltr`}function r4(e,t){if(t<=0)return 0;let n=Q2(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 i4(e,t){return e.getAnimations(t).filter(e=>{let t=e.effect?.getTiming();return t?.duration!==1/0&&t?.iterations!==1/0})}var a4=`--scroll-area-overflow-x-start`,o4=`--scroll-area-overflow-x-end`,s4=`--scroll-area-overflow-y-start`,c4=`--scroll-area-overflow-y-end`,l4=`--scroll-area-thumb-height`,u4=`--scroll-area-thumb-width`,d4=[a4,o4,s4,c4],f4=!1;function p4(){f4||B1||(typeof CSS<`u`&&`registerProperty`in CSS&&d4.forEach(e=>{try{CSS.registerProperty({name:e,syntax:`<length>`,inherits:!1,initialValue:`0px`})}catch{}}),f4=!0)}var m4=K.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}=o$(),T=n4(),E=K.useRef(!0),D=K.useRef([NaN,NaN,NaN,NaN]),O=n$(),k=n$(),A=qQ(()=>{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=h4(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=r4(T===`rtl`?-w:w,P),L=P-I);let R=A?0:r4(x,F),z=A?0:F-R,ee=j?0:b,B=A?0:y,V=0,te=0;!j&&!A&&(V=t?.offsetWidth||0,te=n?.offsetHeight||0);let ne=f.width===0&&f.height===0,H=ne?V:0,U=ne?te:0,re=V$(n,`padding`,`x`),ie=V$(t,`padding`,`y`),ae=V$(i,`margin`,`x`),oe=V$(r,`margin`,`y`),se=ee-re-ae,W=B-ie-oe,G=n?Math.min(n.offsetWidth-H,se):se,ce=t?Math.min(t.offsetHeight-U,W):W,le=Math.max(16,G*M),ue=Math.max(16,ce*N);if(m(e=>g4(e,{width:le,height:ue})),t&&r){let e=_4(r,l4,x,F,h,ue,t.offsetHeight-ue-ie-oe);r.style.transform=`translate3d(0,${e}px,0)`}if(n&&i){let e=n.offsetWidth-le-re-ae,t=_4(i,u4,T===`rtl`?-w:w,P,_,le,e);i.style.transform=`translate3d(${T===`rtl`?-t:t}px,0,0)`}let de=[I,L,R,z];d4.forEach((t,n)=>{e.style.setProperty(t,`${de[n]}px`)}),a&&p(e=>g4(e,{width:V,height:te})),g(e=>g4(e,k));let fe={xStart:!j&&I>C.xStart,xEnd:!j&&L>C.xEnd,yStart:!A&&R>C.yStart,yEnd:!A&&z>C.yEnd};S(e=>g4(e,fe))});Z2(()=>{p4()},[]),Z2(()=>{queueMicrotask(A)},[A,_,T,C.xStart,C.xEnd,C.yStart,C.yEnd]),Z2(()=>{o.current?.matches(`:hover`)&&x(!0)},[o,x]),Z2(()=>{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=i4(e,{subtree:!0});t.length!==0&&Promise.allSettled(t.map(e=>e.finished.then(XQ))).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:U$.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=P$(`div`,e,{ref:[t,o],state:w,props:[M,a],stateAttributesMapping:r1}),P=K.useMemo(()=>({computeThumbPosition:A}),[A]);return(0,X.jsx)($2.Provider,{value:P,children:N})});function h4(e){let t=e.clientHeight>=e.scrollHeight,n=e.clientWidth>=e.scrollWidth;return{y:t,x:n,corner:t||n}}function g4(e,t){for(let n in t)if(e[n]!==t[n])return t;return e}function _4(e,t,n,r,i,a,o){let s=Q2(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 v4(e,t,n,r){return e.addEventListener(t,n,r),()=>{e.removeEventListener(t,n,r)}}var y4=K.createContext(void 0);function b4(){let e=K.useContext(y4);if(e===void 0)throw Error(i$(54));return e}var x4=K.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}=o$(),T=i===`vertical`,E={...w,hovering:c,scrolling:T?u:l,orientation:i},D=n4(),O=!C&&!a,k=T?d.y:d.x,A=a||!k;K.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 v4(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=K1(e.nativeEvent),n=T?h.current:g.current;if(n&&W1(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=V$(n,`margin`,a),s=V$(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(${H2})`,insetInlineEnd:0,[l4]:`${S.height}px`}:{insetInlineStart:0,insetInlineEnd:`var(${U2})`,bottom:0,[u4]:`${S.width}px`}}},M=P$(`div`,e,{ref:[t,T?f:p],state:E,props:[j,s],stateAttributesMapping:r1});return A?(0,X.jsx)(y4.Provider,{value:i,children:M}):null}),S4=K.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,{computeThumbPosition:o}=e4(),{hasMeasuredScrollbar:s,viewportState:c}=o$(),l=K.useRef(null),u=K.useRef(s);return Z2(()=>{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]),P$(`div`,e,{ref:[t,l],state:c,stateAttributesMapping:r1,props:[{role:`presentation`,style:{minWidth:`fit-content`}},a]})}),C4=K.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}=o$(),m=b4(),h=m===`vertical`;return P$(`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]})}),w4=Object.freeze({ease:`linear`,duration:0});function T4(e,t){let n=Ore(e,t.duration);return n<=0?w4:e.steps>0?{ease:gI(e.steps),duration:n}:{ease:hI({bounce:Dre(e,t.bounce),duration:n}),duration:n}}function E4(e,t){let n=aP(e,t.duration);return{ease:e.steps>0?gI(e.steps):t.ease,duration:n}}function D4(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 O4(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 k4=(0,K.forwardRef)(function({children:e,className:t,surface:n=!1,surfaceSize:r,surfaceDepth:i,screen:a=!1,...o},s){let c=(0,K.useRef)(null),l=(0,K.useRef)(null),u=lP();(0,K.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=rP(t),i=E4(r,{ease:`outQuad`,duration:45}),a=T4(r,{bounce:.18,duration:180});n=pI(t,{scaleY:[{to:e.scaleY,...i},{to:1,...a}],scaleX:[{to:e.scaleX,...i},{to:1,...a}]})},d=(e,t)=>{let n=D4(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=O4(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,X.jsx)(m4,{render:a?(0,X.jsx)(MI,{}):(0,X.jsx)(`div`,{}),...o,ref:s,className:`caps-scroll-viewport`,children:(0,X.jsx)(S4,{style:{minWidth:0},children:e})});return(0,X.jsxs)(Y2,{render:n?(0,X.jsx)(jI,{size:r??`md`,depth:i??`shallow`}):(0,X.jsx)(`div`,{}),ref:c,className:Z(`caps-scroll-area`,t),children:[a?(0,X.jsx)(`div`,{className:`caps-display-gasket caps-scroll-display`,children:d}):d,(0,X.jsx)(jI,{size:`sm`,depth:`deep`,placement:`embedded`,className:`caps-scroll-track-surface`,children:(0,X.jsx)(x4,{className:`caps-scroll-track`,children:(0,X.jsx)(C4,{className:`caps-scroll-thumb`,children:(0,X.jsx)(`span`,{className:`caps-scroll-thumb-surface`,ref:l})})})})]})}),A4=(0,K.forwardRef)(function({className:e,invalid:t,...n},r){return(0,X.jsx)(`input`,{...n,"aria-invalid":t?!0:n[`aria-invalid`]===!1?void 0:n[`aria-invalid`],className:Z(`input caps-input w-full`,e),ref:r})});(0,K.forwardRef)(function({leading:e,className:t,...n},r){return(0,X.jsxs)(`span`,{className:`caps-search-input`,"data-leading":e?`true`:void 0,children:[e?(0,X.jsx)(`span`,{className:`caps-search-leading`,"aria-hidden":`true`,children:e}):null,(0,X.jsx)(A4,{...n,type:`search`,className:t,ref:r})]})});var j4=l(AS(),1);function M4(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 N4=e=>{switch(e){case`success`:return I4;case`info`:return R4;case`warning`:return L4;case`error`:return z4;default:return null}},P4=Array(12).fill(0),F4=({visible:e,className:t})=>K.createElement(`div`,{className:[`sonner-loading-wrapper`,t].filter(Boolean).join(` `),"data-visible":e},K.createElement(`div`,{className:`sonner-spinner`},P4.map((e,t)=>K.createElement(`div`,{className:`sonner-loading-bar`,key:`spinner-bar-${t}`})))),I4=K.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 20 20`,fill:`currentColor`,height:`20`,width:`20`,"aria-hidden":`true`},K.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`})),L4=K.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,fill:`currentColor`,height:`20`,width:`20`,"aria-hidden":`true`},K.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`})),R4=K.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 20 20`,fill:`currentColor`,height:`20`,width:`20`,"aria-hidden":`true`},K.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`})),z4=K.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 20 20`,fill:`currentColor`,height:`20`,width:`20`,"aria-hidden":`true`},K.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`})),B4=K.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`},K.createElement(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),K.createElement(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})),V4=()=>{let[e,t]=K.useState(document.hidden);return K.useEffect(()=>{let e=()=>{t(document.hidden)};return document.addEventListener(`visibilitychange`,e),()=>document.removeEventListener(`visibilitychange`,e)},[]),e},H4=1,U4=100,W4=e=>typeof e?.id==`number`||e?.id?.length>0?e.id:H4++,G4=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-U4;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=W4(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],K.isValidElement(e))i=!1,this.create({id:n,type:`default`,message:e});else if(q4(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`&&!K.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`&&!K.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`&&!K.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`&&!K.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=W4(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}},K4=(e,t)=>G4.message(e,t),q4=e=>e&&typeof e==`object`&&`ok`in e&&typeof e.ok==`boolean`&&`status`in e&&typeof e.status==`number`,J4=Object.assign(K4,{success:G4.success,info:G4.info,warning:G4.warning,error:G4.error,custom:G4.custom,message:G4.message,promise:G4.promise,dismiss:G4.dismiss,loading:G4.loading},{getHistory:()=>G4.toasts,getToasts:()=>G4.getActiveToasts()});M4(`[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 Y4(e){return e.label!==void 0}var X4=3,Z4=`24px`,Q4=`16px`,$4=4e3,e3=356,t3=14,n3=45,r3=200;function i3(...e){return e.filter(Boolean).join(` `)}function a3(e){let[t,n]=e.split(`-`),r=[];return t&&r.push(t),n&&r.push(n),r}var o3=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]=K.useState(null),[O,k]=K.useState(null),[A,j]=K.useState(!1),[M,N]=K.useState(!1),[P,F]=K.useState(!1),[I,L]=K.useState(!1),[R,z]=K.useState(!1),[ee,B]=K.useState(0),[V,te]=K.useState(0),ne=K.useRef(n.duration||y||$4),H=K.useRef(null),U=K.useRef(null),re=c===0,ie=c+1<=o,ae=n.type,oe=ae??`default`,se=n.dismissible!==!1,W=n.className||``,G=n.descriptionClassName||``,ce=K.useMemo(()=>s.findIndex(e=>e.toastId===n.id)||0,[s,n.id]),le=K.useMemo(()=>n.closeButton??p,[n.closeButton,p]),ue=K.useMemo(()=>n.duration||y||$4,[n.duration,y]),de=K.useRef(0),fe=K.useRef(0),pe=K.useRef(0),me=K.useRef(null),[he,ge]=b.split(`-`),_e=K.useMemo(()=>s.reduce((e,t,n)=>n>=ce?e:e+t.height,0),[s,ce]),ve=V4(),ye=K.useMemo(()=>e.swipeDirections??a3(b),[e.swipeDirections,b]),be=n.invert||t,xe=ae===`loading`;fe.current=K.useMemo(()=>ce*x+_e,[ce,_e]),K.useEffect(()=>{ne.current=ue},[ue]),K.useEffect(()=>{j(!0)},[]),K.useEffect(()=>{let e=U.current;if(e){let t=e.getBoundingClientRect().height;return te(t),a(e=>[{toastId:n.id,height:t,position:n.position},...e]),()=>a(e=>e.filter(e=>e.toastId!==n.id))}},[a,n.id]),K.useLayoutEffect(()=>{if(!A)return;let e=U.current,t=e.style.height;e.style.height=`auto`;let r=e.getBoundingClientRect().height;e.style.height=t,te(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 Se=K.useCallback(()=>{N(!0),B(fe.current),a(e=>e.filter(e=>e.toastId!==n.id)),setTimeout(()=>{d(n)},r3)},[n,d,a,fe]);K.useEffect(()=>{if(n.promise&&ae===`loading`||n.duration===1/0||n.type===`loading`)return;let e;return u||i||ve?(()=>{if(pe.current<de.current){let e=new Date().getTime()-de.current;ne.current-=e}pe.current=new Date().getTime()})():ne.current!==1/0&&(de.current=new Date().getTime(),e=setTimeout(()=>{n.onAutoClose==null||n.onAutoClose.call(n,n),Se()},ne.current)),()=>clearTimeout(e)},[u,i,n,ae,ve,Se]),K.useEffect(()=>{n.delete&&(Se(),n.onDismiss==null||n.onDismiss.call(n,n))},[Se,n.delete]);function Ce(){return w?.loading?K.createElement(`div`,{className:i3(C?.loader,n?.classNames?.loader,`sonner-loader`),"data-visible":ae===`loading`},w.loading):K.createElement(F4,{className:i3(C?.loader,n?.classNames?.loader),visible:ae===`loading`})}let we=n.icon||w?.[ae]||N4(ae);return K.createElement(`li`,{tabIndex:0,ref:U,className:i3(_,W,C?.toast,n?.classNames?.toast,C?.[oe],n?.classNames?.[oe]),"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":ie,"data-y-position":he,"data-x-position":ge,"data-index":c,"data-front":re,"data-swiping":P,"data-dismissible":se,"data-type":ae,"data-invert":be,"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:fe.current}px`,"--initial-height":S?`auto`:`${V}px`,...m,...n.style},onDragEnd:()=>{F(!1),D(null),me.current=null},onPointerDown:e=>{e.button!==2&&(xe||!se||(H.current=new Date,B(fe.current),e.target.setPointerCapture(e.pointerId),e.target.tagName!==`BUTTON`&&(F(!0),me.current={x:e.clientX,y:e.clientY})))},onPointerUp:()=>{if(I||!se)return;me.current=null;let e=Number(U.current?.style.getPropertyValue(`--swipe-amount-x`).replace(`px`,``)||0),t=Number(U.current?.style.getPropertyValue(`--swipe-amount-y`).replace(`px`,``)||0),r=new Date().getTime()-H.current?.getTime(),i=E===`x`?e:t,a=Math.abs(i)/r;if((E===`x`?ye.includes(e>0?`right`:`left`):ye.includes(t>0?`bottom`:`top`))&&(Math.abs(i)>=n3||a>.11)){B(fe.current),n.onDismiss==null||n.onDismiss.call(n,n),k(E===`x`?e>0?`right`:`left`:t>0?`down`:`up`),Se(),L(!0);return}var o,s;(o=U.current)==null||o.style.setProperty(`--swipe-amount-x`,`0px`),(s=U.current)==null||s.style.setProperty(`--swipe-amount-y`,`0px`),z(!1),F(!1),D(null)},onPointerMove:e=>{var t,n;if(!me.current||!se||window.getSelection()?.toString().length>0)return;let r=e.clientY-me.current.y,i=e.clientX-me.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(ye.includes(`top`)||ye.includes(`bottom`)){if(ye.includes(`top`)&&r<0||ye.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`&&(ye.includes(`left`)||ye.includes(`right`))){if(ye.includes(`left`)&&i<0||ye.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=U.current)==null||t.style.setProperty(`--swipe-amount-x`,`${a.x}px`),(n=U.current)==null||n.style.setProperty(`--swipe-amount-y`,`${a.y}px`)}},le&&!n.jsx&&ae!==`loading`?K.createElement(`button`,{"aria-label":T,"data-disabled":xe,"data-close-button":!0,onClick:xe||!se?()=>{}:()=>{Se(),n.onDismiss==null||n.onDismiss.call(n,n)},className:i3(C?.closeButton,n?.classNames?.closeButton)},w?.close??B4):null,(ae||n.icon||n.promise)&&n.icon!==null&&(w?.[ae]!==null||n.icon)?K.createElement(`div`,{"data-icon":``,className:i3(C?.icon,n?.classNames?.icon)},ae===`loading`?n.icon||Ce():n.promise?Ce():null,ae===`loading`?null:we):null,K.createElement(`div`,{"data-content":``,className:i3(C?.content,n?.classNames?.content)},K.createElement(`div`,{"data-title":``,className:i3(C?.title,n?.classNames?.title)},n.jsx?n.jsx:typeof n.title==`function`?n.title():n.title),n.description?K.createElement(`div`,{"data-description":``,className:i3(v,G,C?.description,n?.classNames?.description)},typeof n.description==`function`?n.description():n.description):null),K.isValidElement(n.cancel)?n.cancel:n.cancel&&Y4(n.cancel)?K.createElement(`button`,{"data-button":!0,"data-cancel":!0,style:n.cancelButtonStyle||h,onClick:e=>{Y4(n.cancel)&&se&&(n.cancel.onClick==null||n.cancel.onClick.call(n.cancel,e),Se())},className:i3(C?.cancelButton,n?.classNames?.cancelButton)},n.cancel.label):null,K.isValidElement(n.action)?n.action:n.action&&Y4(n.action)?K.createElement(`button`,{"data-button":!0,"data-action":!0,style:n.actionButtonStyle||g,onClick:e=>{Y4(n.action)&&(n.action.onClick==null||n.action.onClick.call(n.action,e),!e.defaultPrevented&&Se())},className:i3(C?.actionButton,n?.classNames?.actionButton)},n.action.label):null)};function s3(){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 c3(e,t){let n={};return[e,t].forEach((e,t)=>{let r=t===1,i=r?`--mobile-offset`:`--offset`,a=r?Q4:Z4;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 l3=K.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=X4,toastOptions:g,dir:_=s3(),gap:v=t3,icons:y,customAriaLabel:b,containerAriaLabel:x=`Notifications`}=e,[S,C]=K.useState([]),w=K.useMemo(()=>n?S.filter(e=>e.toasterId===n):S.filter(e=>!e.toasterId),[S,n]),T=K.useMemo(()=>Array.from(new Set([i].concat(w.filter(e=>e.position).map(e=>e.position)))),[w,i]),[E,D]=K.useState([]),[O,k]=K.useState(!1),[A,j]=K.useState(!1),[M,N]=K.useState(d===`system`?typeof window<`u`&&window.matchMedia&&window.matchMedia(`(prefers-color-scheme: dark)`).matches?`dark`:`light`:d),P=K.useRef(null),F=a.join(`+`).replace(/Key/g,``).replace(/Digit/g,``),I=K.useRef(null),L=K.useRef(!1),R=K.useCallback(e=>{C(t=>(t.find(t=>t.id===e.id)?.delete||G4.dismiss(e.id),t.filter(({id:t})=>t!==e.id)))},[]);return K.useEffect(()=>G4.subscribe(e=>{if(e.dismiss){requestAnimationFrame(()=>{C(t=>t.map(t=>t.id===e.id?{...t,delete:!0}:t))});return}setTimeout(()=>{j4.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)]})})})}),[]),K.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]),K.useEffect(()=>{S.length<=1&&k(!1)},[S]),K.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]),K.useEffect(()=>{if(P.current)return()=>{I.current&&(I.current.focus({preventScroll:!0}),I.current=null,L.current=!1)}},[P.current]),K.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?K.createElement(`ol`,{key:t,dir:_===`auto`?s3():_,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":`${e3}px`,"--gap":`${v}px`,...m,...c3(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)=>K.createElement(o3,{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}))}),u3=(0,K.createContext)(void 0),d3=(0,K.createContext)(null);function f3(e){let t=(0,K.useContext)(d3);return t===null?Object.hasOwn(globalThis,`document`)?document.body:null:t[e]}function p3(e){let t=(0,K.useContext)(u3),n=(0,K.useRef)(e);n.current=e,(0,K.useEffect)(()=>t?.(()=>{n.current()}),[t])}function m3({className:e,...t}){let n=f3(`toast`);return n?(0,j4.createPortal)((0,X.jsx)(l3,{position:`top-right`,swipeDirections:[`right`,`top`],offset:16,gap:8,className:Z(`caps-toaster`,e),...t}),n):null}var h3=(0,K.forwardRef)(function({children:e,className:t,optional:n,required:r,...i},a){return(0,X.jsxs)(`label`,{...i,className:Z(`label caps-label cursor-pointer justify-start gap-sm text-sm font-semibold text-base-content`,t),ref:a,children:[e,r?(0,X.jsx)(`span`,{"aria-hidden":`true`,className:`text-error`,children:`*`}):null,n&&!r?(0,X.jsx)(`span`,{className:`caps-label-optional`,children:`Optional`}):null]})}),g3=(0,K.forwardRef)(function({children:e,className:t,...n},r){return(0,X.jsx)(`div`,{...n,className:Z(`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:K.Children.map(e,e=>(0,K.isValidElement)(e)?(0,K.cloneElement)(e,{className:Z(`join-item caps-input-group-control`,e.props.className)}):e)})}),_3=(0,K.forwardRef)(function({className:e,...t},n){return(0,X.jsx)(`div`,{...t,className:Z(`join-item flex items-center border border-base-300 bg-base-200 px-md text-sm text-base-content`,e),ref:n})});function v3(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,K.forwardRef)(function({show:e,appear:t=!1,children:n,className:r,...i},a){let o=(0,K.useRef)(null);(0,K.useImperativeHandle)(a,()=>o.current);let s=lP(),[c,l]=(0,K.useState)(e),u=(0,K.useRef)(!0);return e&&!c&&l(!0),(0,K.useLayoutEffect)(()=>{let n=o.current,r=u.current;if(u.current=!1,!n||r&&!t)return;if(!sP(n)){e||l(!1);return}let i=rP(n),a=`translateY(${String(i.distance)}px)`,c=oP(i,i.ease),d=n.getBoundingClientRect().height,f=v3(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:oP(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,X.jsx)(`div`,{...i,ref:o,className:Z(`caps-presence`,r),"data-present":e,"aria-hidden":!e||void 0,children:n}):null});var y3=(0,K.forwardRef)(function({open:e,children:t,className:n,...r},i){return(0,X.jsx)(`div`,{...r,ref:i,className:Z(`caps-collapse`,n),"data-open":e,"aria-hidden":!e||void 0,children:(0,X.jsx)(`div`,{className:`caps-collapse-clip`,children:t})})});(0,K.forwardRef)(function({swapKey:e,anchor:t=`start`,children:n,className:r,...i},a){let o=(0,K.useRef)(null);(0,K.useImperativeHandle)(a,()=>o.current);let s=lP(),[c,l]=(0,K.useState)({key:e,content:n}),[u,d]=(0,K.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,K.useRef)(null);return(0,K.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,K.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(!sP(e)){d([]);return}let r=f.current,i=e.getBoundingClientRect(),a=rP(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:oP(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:oP(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:oP(a,a.ease)})),()=>{for(let e of c)e.cancel()}},[e,s]),(0,X.jsx)(`div`,{...i,ref:o,className:Z(`caps-swap`,r),"data-anchor":t,children:[...u.map(e=>(0,X.jsx)(`div`,{className:`caps-swap-layer`,"data-swap-leaving":e.key,"aria-hidden":`true`,children:e.content},e.key)),(0,X.jsx)(`div`,{className:`caps-swap-layer`,"data-swap-current":``,children:n},e)]})});function b3({children:e,...t}){let[n,r]=(0,K.useState)(e);return e&&e!==n&&r(e),(0,X.jsx)(y3,{...t,className:Z(`caps-field-error-reveal`,t.className),open:!!e,children:(0,X.jsx)(`div`,{className:`caps-field-error`,role:`alert`,"aria-hidden":!e,children:n})})}function x3({children:e,divider:t=!0,error:n,layout:r=`end`,status:i,...a}){return(0,X.jsxs)(`footer`,{...a,className:Z(`caps-form-footer`,a.className),"data-divider":t,"data-layout":r,children:[(0,X.jsx)(b3,{children:n}),(0,X.jsxs)(`div`,{className:`caps-form-footer-row`,children:[i?(0,X.jsx)(`div`,{className:`caps-form-footer-status`,role:`status`,children:i}):null,(0,X.jsx)(`div`,{className:`caps-form-footer-actions`,children:e})]})]})}var S3=(0,K.forwardRef)(function({busy:e=!1,children:t,className:n,layout:r,...i},a){return(0,X.jsx)(`form`,{...i,"aria-busy":e||void 0,className:Z(`caps-form`,n),"data-layout":r,ref:a,children:(0,X.jsx)(`fieldset`,{className:`caps-form-body`,disabled:e,children:t})})}),C3={2:`h2`,3:`h3`,4:`h4`},w3=(0,K.forwardRef)(function({children:e,className:t,description:n,layout:r,level:i=3,title:a,...o},s){let c=(0,K.useId)(),l=C3[i];return(0,X.jsxs)(`section`,{...o,"aria-labelledby":`${c}-title`,className:Z(`caps-form-section`,t),"data-layout":r,ref:s,children:[(0,X.jsxs)(`header`,{className:`caps-form-section-copy`,children:[(0,X.jsx)(l,{className:`caps-form-section-title`,id:`${c}-title`,children:a}),n?(0,X.jsx)(`p`,{className:`caps-form-section-description`,children:n}):null]}),(0,X.jsx)(`div`,{className:`caps-form-section-fields`,children:e})]})}),T3=(0,K.forwardRef)(function({children:e,className:t,description:n,error:r,layout:i,legend:a,legendTitle:o,...s},c){let l=(0,K.useId)(),u=[n?`${l}-description`:s[`aria-describedby`],r?`${l}-error`:null].filter(Boolean).join(` `)||void 0;return(0,X.jsxs)(`fieldset`,{...s,"aria-describedby":u,"aria-invalid":r?!0:s[`aria-invalid`],className:Z(`caps-fieldset`,t),"data-layout":i,ref:c,children:[(0,X.jsx)(`legend`,{className:`caps-fieldset-legend`,title:o,children:a}),n?(0,X.jsx)(`p`,{className:`caps-fieldset-description`,id:`${l}-description`,children:n}):null,(0,X.jsx)(`div`,{className:`caps-fieldset-fields`,children:e}),r===void 0?null:(0,X.jsx)(b3,{id:`${l}-error`,children:r})]})});function E3(e){let t=[];return K.Children.forEach(e.props.children,e=>{(0,K.isValidElement)(e)&&e.type!==_3&&t.push(e)}),t[0]??null}var D3=(0,K.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,K.useId)(),m=(0,K.isValidElement)(e)?e:null,h=m?.type===g3,g=h?E3(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,K.cloneElement)(m,void 0,K.Children.map(m.props.children,e=>e===g?(0,K.cloneElement)(g,w):e)):(0,K.cloneElement)(m,w):e,E=a?(0,X.jsx)(h3,{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,X.jsxs)(`div`,{className:`caps-field-copy`,children:[E,n?(0,X.jsx)(`p`,{className:`caps-field-description`,id:v,children:n}):null]}):null,O=i?(0,X.jsxs)(`div`,{className:`caps-field-lead`,children:[(0,X.jsx)(`span`,{className:`caps-field-icon`,"aria-hidden":`true`,children:i}),D]}):D;return(0,X.jsxs)(`div`,{...d,className:Z(`caps-field`,t),"data-orientation":c,ref:f,children:[c===`horizontal`?(0,X.jsxs)(`div`,{className:`caps-field-row`,children:[O,T]}):c===`inline`?(0,X.jsxs)(`div`,{className:`caps-field-row`,children:[T,O]}):(0,X.jsxs)(X.Fragment,{children:[O,T]}),(0,X.jsx)(b3,{id:y,children:r})]})});function O3(e){let t=String(e),n=t.indexOf(`.`);return n===-1?0:t.length-n-1}var k3=`M 9.86 38.14 A 20 20 0 1 1 38.14 38.14`,A3=6,j3=new Map([[`ArrowUp`,1],[`ArrowDown`,-1],[`PageUp`,10],[`PageDown`,-10]]),M3=(0,K.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,K.useState)(n),[y,b]=(0,K.useState)(null),x=p===void 0?_:p,S=O3(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,K.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)/A3),n=C(A.current.value+t*d);n!==x&&w(n)},P=()=>{A.current=null};return(0,X.jsxs)(`span`,{className:Z(`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,X.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,X.jsx)(`path`,{className:`caps-number-field-dial-track`,d:k3,pathLength:100}),(0,X.jsx)(`path`,{className:`caps-number-field-dial-level`,d:k3,pathLength:100,strokeDasharray:`${String(Math.max(.5,j*100))} 100`})]}),(0,X.jsx)(OI,{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,X.jsx)(iL,{"aria-hidden":`true`})}),(0,X.jsxs)(`span`,{className:`caps-number-field-readout`,children:[(0,X.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=j3.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,X.jsx)(`span`,{className:`caps-number-field-unit`,"aria-hidden":`true`,children:f}):null]}),(0,X.jsx)(OI,{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,X.jsx)(aL,{"aria-hidden":`true`})})]})}),N3=(0,K.forwardRef)(function({className:e,invalid:t,...n},r){return(0,X.jsxs)(`span`,{className:`caps-select-shell`,children:[(0,X.jsx)(`select`,{...n,"aria-invalid":t?!0:n[`aria-invalid`]===!1?void 0:n[`aria-invalid`],className:Z(`select select-bordered caps-select w-full`,t&&`select-error`,e),ref:r}),!n.multiple&&(!n.size||n.size<=1)?(0,X.jsx)(ZI,{className:`caps-select-chevron`,"aria-hidden":`true`}):null]})});function P3({checked:e}){let t=`caps-switch-${(0,K.useId)().replaceAll(`:`,``)}`,n=(0,K.useRef)(null),r=(0,K.useRef)(null),i=(0,K.useRef)(e).current,a=(0,K.useRef)(e),o=lP();return(0,K.useLayoutEffect)(()=>{if(!n.current||!r.current)return;let t=o||a.current===e;a.current=e;let i=e?16:8,s=rP(n.current),c=T4(s,{bounce:.25,duration:440}),l=E4(s,{ease:`inOutSine`,duration:100}),u=pI(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=pI(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,X.jsxs)(`svg`,{className:`caps-switch-visual`,width:`40`,height:`24`,viewBox:`0 0 20 12`,"aria-hidden":`true`,focusable:`false`,children:[(0,X.jsxs)(`defs`,{children:[(0,X.jsx)(_I,{ref:r,id:`${t}-surface`,transform:i?`matrix(2 0 0 1 10 6)`:`matrix(1 0 0 1 6 6)`}),(0,X.jsx)(vI,{id:`${t}-shadow`}),(0,X.jsx)(yI,{id:`${t}-inset`}),(0,X.jsx)(`clipPath`,{id:`${t}-track`,children:(0,X.jsx)(`rect`,{x:`1`,y:`1`,width:`18`,height:`10`,rx:`5`})})]}),(0,X.jsx)(`rect`,{className:`caps-switch-track`,filter:`url(#${t}-inset)`,x:`0.5`,y:`0.5`,width:`19`,height:`11`,rx:`5.5`}),(0,X.jsx)(`g`,{clipPath:`url(#${t}-track)`,children:(0,X.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 F3=(0,K.forwardRef)(function({className:e,checked:t,defaultChecked:n=!1,onChange:r,onCheckedChange:i,...a},o){let s=(0,K.useRef)(null),[c,l]=(0,K.useState)(n),u=t??c;return(0,K.useImperativeHandle)(o,()=>{if(!s.current)throw Error(`Switch input is not mounted`);return s.current},[]),(0,K.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,X.jsxs)(`span`,{className:`caps-switch`,"data-checked":u,children:[(0,X.jsx)(`input`,{...a,checked:u,className:Z(`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,X.jsx)(P3,{checked:u})]})}),I3={2:`h2`,3:`h3`,4:`h4`};function L3(e,t){let{reduced:n}=t,r=e&&!n,i=aP(t,600),[a,o]=(0,K.useState)(r);return(0,K.useEffect)(()=>{if(o(r),!r)return;let e=globalThis.setTimeout(()=>{o(!1)},i);return()=>{globalThis.clearTimeout(e)}},[r,i]),a}var R3=(0,K.forwardRef)(function({actions:e,className:t,description:n,headingLevel:r=2,suggestions:i,thinking:a=!1,title:o,visual:s,renderVisual:c,variant:l=`plain`,...u},d){let f=(0,K.useId)(),p=(0,K.useRef)(null),m=iP(p),h=L3(l===`speech`,m)&&!a,g=I3[r],_=c?c({speaking:h,thinking:a}):s,v=(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(g,{ref:p,className:`empty-state-title`,id:u[`aria-labelledby`]?void 0:f,children:o}),(0,X.jsx)(`p`,{children:n}),i&&i.length>0?(0,X.jsx)(`ul`,{"aria-label":`Try one of these`,className:`empty-state-suggestions`,children:i.map(e=>(0,X.jsx)(`li`,{children:(0,X.jsx)(OI,{size:`sm`,variant:`outline`,onClick:e.onSelect,children:e.label})},e.label))}):null,e?(0,X.jsx)(`div`,{className:`empty-state-actions`,children:e}):null]});return(0,X.jsxs)(`section`,{...u,"aria-labelledby":u[`aria-labelledby`]??f,className:Z(`empty-state`,l!==`plain`&&`empty-state-${l}`,t),ref:d,children:[_?(0,X.jsx)(`div`,{"aria-hidden":`true`,className:`empty-state-visual`,children:_}):null,l===`speech`?(0,X.jsx)(`div`,{className:`empty-state-bubble`,children:v}):v]})});function z3(e,t){return{kind:`button`,id:`folder`,text:t.checking?`Checking…`:`prints`,icon:`folder`,title:e===null?`Choose where Prints saves images`:EC(`Save prints to ${e}`,1024),opens:`dialog`,expanded:t.editing}}var B3=`modulepreload`,V3=function(e,t){return new URL(e,t).href},H3={},U3=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=V3(t,n),t=s(t),t in H3)return;H3[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`:B3,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 W3(e,t=/Mac|iPhone|iPad/u.test(globalThis.navigator.userAgent)){return e.startsWith(`<leader>`)?`Ctrl K ${e.slice(8)}`: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 G3(e){let t=new Map;for(let n of e.bindings)t.set(n.commandId,[...t.get(n.commandId)??[],W3(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 K3(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 q3(e,t,n,r){return e.map(e=>({entry:e,match:K3(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 J3=[`help`,`login`,`model`];function Y3(e,t,n={}){if(!t.startsWith(`/`)||t.includes(`
|
|
91
|
+
`))return{kind:`none`};let r=t.search(/\s/u);if(r<0){let r=t.slice(1);return{kind:`commands`,query:r,items:q3(e.filter(e=>e.availability.status===`available`&&(r.length===0?e.category===(n.idleCategory??`Conversation`)||J3.includes(e.alias):e.category!==`Advanced`||e.alias.toLocaleLowerCase().startsWith(r.toLocaleLowerCase()))),e=>e.alias,r,e=>{let t=J3.indexOf(e.alias);return r.length===0&&t>=0?t-J3.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 X3=K.createContext(void 0);function Z3(e){let t=K.useContext(X3);if(!e&&t===void 0)throw Error(i$(27));return t}var Q3=K.forwardRef(function(e,t){let{render:n,className:r,style:i,forceRender:a=!1,...o}=e,s=Z3(),c=s.useState(`open`),l=s.useState(`nested`),u=s.useState(`mounted`);return P$(`div`,e,{state:{open:c,transitionStatus:s.useState(`transitionStatus`)},ref:[s.context.backdropRef,t],stateAttributesMapping:_0,props:[{role:`presentation`,hidden:!u,style:{userSelect:`none`,WebkitUserSelect:`none`}},o],enabled:a||!l})}),$3=K.createContext(void 0);function e6(e=!1){let t=K.useContext($3);if(t===void 0&&!e)throw Error(i$(16));return t}function tae(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:K.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 t6(e,t,{detail:n=0,pointerType:r=``}={}){e.dispatchEvent(new(o1(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 n6(e={}){let{disabled:t=!1,focusableWhenDisabled:n,tabIndex:r=0,native:i=!0,composite:a}=e,o=K.useRef(null),s=e6(!0),c=a??s!==void 0,{props:l}=tae({focusableWhenDisabled:n,disabled:t,composite:c,tabIndex:r,isNativeButton:i}),u=K.useCallback(()=>{let e=o.current;r6(e)&&c&&t&&l.disabled===void 0&&e.disabled&&(e.disabled=!1)},[t,l.disabled,c]);return Z2(u,[u]),{getButtonProps:K.useCallback((e={})=>{let{onClick:n,onMouseDown:r,onKeyUp:a,onKeyDown:o,onPointerDown:s,...u}=e;return x$({onClick(e){if(t){e.preventDefault();return}n?.(e)},onMouseDown(e){t||r?.(e)},onKeyDown(e){if(t||(j$(e),o?.(e),e.baseUIHandlerPrevented))return;let n=e.target===e.currentTarget,r=e.currentTarget,a=r6(r),s=!i&&nae(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(),t6(r,e));return}if(!l||i||!d&&!u){n&&s&&d&&e.preventDefault();return}e.defaultPrevented||(e.preventDefault(),u&&(e.preventBaseUIHandler(),t6(r,e)))},onKeyUp(e){if(!t){if(j$(e),a?.(e),e.target===e.currentTarget&&i&&c&&r6(e.currentTarget)&&e.key===` `){e.preventDefault();return}e.baseUIHandlerPrevented||e.target===e.currentTarget&&!i&&!c&&!e.defaultPrevented&&e.key===` `&&(e.preventBaseUIHandler(),t6(e.currentTarget,e))}},onPointerDown(e){if(t){e.preventDefault();return}s?.(e)}},i?{type:`button`}:{role:`button`},l,u)},[t,l,c,i]),buttonRef:qQ(e=>{o.current=e,u()})}}function r6(e){return u1(e)&&e.tagName===`BUTTON`}function nae(e){return u1(e)&&e.tagName===`A`&&!!e.href}function i6(e,t,n,r){let i=!1,a=!1,o=r??QQ;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 rae(e,t,n){let r=n??QQ;return{reason:e,event:t??new Event(`base-ui`),...r}}var a6=`none`,o6=`trigger-press`,s6=`trigger-hover`,c6=`trigger-focus`,iae=`outside-press`,l6=`item-press`,aae=`close-press`,u6=`focus-out`,oae=`escape-key`,d6=`list-navigation`,f6=`keyboard`,sae=`pointer`,cae=`cancel-open`,p6=`sibling-open`,m6=`imperative-action`,lae=K.forwardRef(function(e,t){let{render:n,className:r,style:i,disabled:a=!1,nativeButton:o=!0,...s}=e,c=Z3(),l=c.useState(`open`),{getButtonProps:u,buttonRef:d}=n6({disabled:a,native:o}),f={disabled:a};function p(e){l&&c.setOpen(!1,i6(aae,e.nativeEvent))}return P$(`button`,e,{state:f,ref:[t,d],props:[{onClick:p},s,u]})}),uae=K.forwardRef(function(e,t){let{render:n,className:r,style:i,id:a,...o}=e,s=Z3(),c=Y$(a);return s.useSyncedValueWithCleanup(`descriptionElementId`,c),P$(`p`,e,{ref:t,props:[{id:c},o]})});function dae(e,t){return t!=null&&!N0(t)?0:typeof e==`function`?e():e}function h6(e,t,n){let r=dae(e,n);return typeof r==`number`?r:r?.[t]}function g6(e){return typeof e==`function`?e():e}function _6(e,t){return t||e===`click`||e===`mousedown`}function fae(e){return e?.includes(`mouse`)&&e!==`mousedown`}function v6(...e){return()=>{for(let t=0;t<e.length;t+=1){let n=e[t];n&&n()}}}function y6(e){let t=WQ(pae,e).current;return t.next=e,Z2(t.effect),t}function pae(e){let t={current:e,next:e,effect:()=>{t.current=t.next}};return t}var b6=null;globalThis.requestAnimationFrame;var x6=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)}},S6=class e{static create(){return new e}static request(e){return x6.request(e)}static cancel(e){return x6.cancel(e)}currentId=b6;request(e){this.cancel(),this.currentId=x6.request(()=>{this.currentId=b6,e()})}cancel=()=>{this.currentId!==b6&&(x6.cancel(this.currentId),this.currentId=b6)};disposeEffect=()=>this.cancel};function C6(){let e=WQ(S6.create).current;return $Q(e.disposeEffect),e}var w6={clipPath:`inset(50%)`,overflow:`hidden`,whiteSpace:`nowrap`,border:0,padding:0,width:1,height:1,margin:-1},mae={...w6,position:`fixed`,margin:0,top:0,left:0};({...w6});var T6=K.forwardRef(function(e,t){let[n,r]=K.useState();Z2(()=>{V1&&B1&&r(`button`)},[]);let i={tabIndex:0,role:n};return(0,X.jsx)(`span`,{...e,ref:t,style:mae,"aria-hidden":!n||void 0,...i,"data-base-ui-focus-guard":``})});function E6(e){return`data-base-ui-${e}`}var D6=0;function O6(e,t={}){let{preventScroll:n=!1,sync:r=!1,shouldFocus:i}=t;cancelAnimationFrame(D6);function a(){i&&!i()||e?.focus({preventScroll:n})}if(r)return a(),XQ;let o=requestAnimationFrame(a);return D6=o,()=>{D6===o&&(cancelAnimationFrame(o),D6=0)}}var k6=`data-base-ui-inert`,A6=new WeakMap,j6=new WeakSet,M6=new WeakMap,N6=0;function P6(e){return e?d1(e)?e.host:P6(e.parentNode):null}var F6=(e,t)=>t.map(t=>{if(e.contains(t))return t;let n=P6(t);return e.contains(n)?n:null}).filter(e=>e!=null),I6=e=>{let t=new Set;return e.forEach(e=>{let n=e;for(;n&&!t.has(n);)t.add(n),n=n.parentNode}),t},L6=(e,t,n)=>{let r=[],i=e=>{!e||n.has(e)||Array.from(e.children).forEach(e=>{a1(e)!==`script`&&(t.has(e)?i(e):r.push(e))})};return i(e),r};function hae(e,t,n,{mark:r=!0}){let i=F6(t,e),a=r?L6(t,I6(i),new Set(i)):[],o=[],s=[];if(n){let e=F6(t,Array.from(t.querySelectorAll(`[aria-live]`))),n=i.concat(e);L6(t,I6(n),new Set(n)).forEach(e=>{let t=e.getAttribute(`aria-hidden`),n=t!==null&&t!==`false`,r=(A6.get(e)||0)+1;A6.set(e,r),o.push(e),r===1&&n&&j6.add(e),n||e.setAttribute(`aria-hidden`,`true`)})}return r&&a.forEach(e=>{let t=(M6.get(e)||0)+1;M6.set(e,t),s.push(e),t===1&&e.setAttribute(k6,``)}),N6+=1,()=>{o.forEach(e=>{let t=(A6.get(e)||0)-1;A6.set(e,t),t||(j6.has(e)||e.removeAttribute(`aria-hidden`),j6.delete(e))}),r&&s.forEach(e=>{let t=(M6.get(e)||0)-1;M6.set(e,t),t||e.removeAttribute(k6)}),--N6,N6||(A6=new WeakMap,j6=new WeakSet,M6=new WeakMap)}}function R6(e,t={}){let{ariaHidden:n=!1,mark:r=!0}=t,i=h2(e[0]).body;return hae(e,i,n,{mark:r})}var gae={style:{transition:`none`}},z6=`data-base-ui-click-trigger`,_ae={fallbackAxisSide:`none`},B6={fallbackAxisSide:`end`},vae={clipPath:`inset(50%)`,position:`fixed`,top:0,left:0},V6=K.createContext(null),H6=()=>K.useContext(V6),yae=E6(`portal`);function bae(e={}){let{ref:t,container:n,componentProps:r=QQ,elementProps:i}=e,a=J$(),o=H6()?.portalNode,[s,c]=K.useState(null),[l,u]=K.useState(null),d=qQ(e=>{e!==null&&u(e)}),f=K.useRef(null);Z2(()=>{if(n===null){f.current&&(f.current=null,u(null),c(null));return}let e=(n&&(c1(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=P$(`div`,r,{ref:[t,d],props:[{id:a,[yae]:``},i]}),m=s&&p?j4.createPortal(p,s):null;return{node:l,nodeId:K.isValidElement(p)?p.props.id:void 0,subtree:m}}var U6=K.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}=bae({container:o,ref:t,componentProps:e,elementProps:c}),f=K.useRef(null),p=K.useRef(null),m=K.useRef(null),h=K.useRef(null),[g,_]=K.useState(null),v=K.useRef(!1),y=g?.modal,b=g?.open,x=!!g&&!g.modal&&g.open&&!!l;K.useEffect(()=>{if(!l||y)return;function e(e){l&&e.relatedTarget&&I2(e)&&(e.type===`focusin`?v.current&&=(R2(l),!1):(L2(l),v.current=!0))}return v6(v4(l,`focusin`,e,!0),v4(l,`focusout`,e,!0))},[l,y]),Z2(()=>{!l||b!==!0||!v.current||(R2(l),v.current=!1)},[b,l]);let S=K.useMemo(()=>({beforeOutsideRef:f,afterOutsideRef:p,beforeInsideRef:m,afterInsideRef:h,portalNode:l,setFocusManagerState:_}),[l]);return(0,X.jsxs)(K.Fragment,{children:[d,(0,X.jsxs)(V6.Provider,{value:S,children:[x&&l&&(0,X.jsx)(T6,{"data-type":`outside`,ref:f,onFocus:e=>{I2(e,l)?m.current?.focus():P2(g?g.domReference:null)?.focus()}}),x&&l&&(0,X.jsx)(`span`,{role:s,"aria-owns":u,style:vae}),l&&j4.createPortal(a,l),x&&l&&(0,X.jsx)(T6,{"data-type":`outside`,ref:p,onFocus:e=>{I2(e,l)?h.current?.focus():(N2(g?g.domReference:null)?.focus(),g?.closeOnFocusOut&&g?.onOpenChange(!1,i6(`focus-out`,e.nativeEvent)))}})]})]})});function W6(){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 G6=class{nodesRef={current:[]};events=W6();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)}},K6=K.createContext(null),q6=K.createContext(null),J6=()=>K.useContext(K6)?.id||null,Y6=e=>{let t=K.useContext(q6);return e??t};function X6(e){let t=J$(),n=Y6(e),r=J6();return Z2(()=>{if(!t)return;let e={id:t,parentId:r};return n?.addNode(e),()=>{n?.removeNode(e)}},[n,t,r]),t}function Z6(e){let{children:t,id:n}=e,r=J6();return(0,X.jsx)(K6.Provider,{value:K.useMemo(()=>({id:n,parentId:r}),[n,r]),children:t})}function Q6(e){let{children:t,externalTree:n}=e,r=WQ(()=>n??new G6).current;return(0,X.jsx)(q6.Provider,{value:r,children:t})}function $6(e){return e==null?e:`current`in e?e.current:e}function xae(e,t){let n=o1(K1(e));return e instanceof n.KeyboardEvent?`keyboard`:e instanceof n.FocusEvent?t||`keyboard`:`pointerType`in e?e.pointerType||(j0(e)?`keyboard`:t||`mouse`):`touches`in e?`touch`:e instanceof n.MouseEvent?t||(e.detail===0?`keyboard`:`mouse`):``}var Sae=20,e8=[];function t8(){e8=e8.filter(e=>e.deref()?.isConnected)}function n8(e){t8(),e&&a1(e)!==`body`&&(e8.push(new WeakRef(e)),e8.length>Sae&&(e8=e8.slice(-20)))}function r8(){return t8(),e8[e8.length-1]?.deref()}function Cae(e){return e?k2(e)?e:j2(e)[0]||e:null}function i8(e){if(e.hasAttribute(`tabindex`)&&!e.hasAttribute(`data-tabindex`)||!e.getAttribute(`role`)?.includes(`dialog`))return;let t=A2(e).filter(e=>{let t=e.getAttribute(`data-tabindex`)||``;return k2(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 a8(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=qQ(()=>b.current.floatingContext?.nodeId),S=i===!1,C=w0(_)&&S,w=y6(i),T=y6(a),E=y6(o),D=y6(u),O=y6(g),k=Y6(m),A=H6(),j=K.useRef(!1),M=K.useRef(!1),N=K.useRef(!1),P=K.useRef(null),F=K.useRef(``),I=K.useRef(``),L=K.useRef(null),R=K.useRef(null),z=s$(L,p,A?.beforeInsideRef),ee=s$(R,A?.afterInsideRef),B=n$(),V=n$(),te=C6(),ne=A!=null,H=E0(v),U=qQ((e=H)=>e?j2(e):[]),re=qQ(()=>h?.().filter(e=>e!=null)??[]);K.useEffect(()=>{if(r||!c)return;function e(e){e.key===`Tab`&&W1(H,U1(h2(H)))&&U().length===0&&!C&&k0(e)}return v4(h2(H),`keydown`,e)},[r,H,c,C,U]),K.useEffect(()=>{if(r||!g)return;let e=h2(H);function t(){N.current=!1}function n(e){let t=K1(e),n=re(),r=W1(v,t)||W1(_,t)||W1(A?.portalNode,t)||n.some(e=>e===t||W1(e,t));N.current=!r,I.current=e.pointerType||`keyboard`,G1(t,`[data-base-ui-click-trigger]`)&&(M.current=!0,V.start(0,()=>{M.current=!1}))}function i(){I.current=`keyboard`}return v6(v4(e,`pointerdown`,n,!0),v4(e,`pointerup`,t,!0),v4(e,`pointercancel`,t,!0),v4(e,`keydown`,i,!0),t)},[r,v,_,H,g,A,V,re]),K.useEffect(()=>{if(r||!l)return;let e=h2(H);function n(){M.current=!0,V.start(0,()=>{M.current=!1})}function i(e){let t=K1(e);k2(t)&&(P.current=t)}function a(n){let r=n.relatedTarget,i=n.currentTarget,a=K1(n);c&&r==null&&a!=null&&W1(v,a)&&n8(a),queueMicrotask(()=>{let o=x(),l=t.context.triggerElements,u=re(),p=r?.hasAttribute(E6(`focus-guard`))&&[L.current,R.current,A?.beforeInsideRef.current,A?.afterInsideRef.current,A?.beforeOutsideRef.current,A?.afterOutsideRef.current,$6(f),$6(d)].includes(r),m=!(W1(_,r)||W1(v,r)||W1(r,v)||W1(A?.portalNode,r)||u.some(e=>e===r||W1(e,r))||l.hasMatchingElement(e=>W1(e,r))||p||k&&(D0(k.nodesRef.current,o).find(e=>W1(e.context?.elements.floating,r)||W1(e.context?.elements.domReference,r))||O0(k.nodesRef.current,o).find(e=>[e.context?.elements.floating,E0(e.context?.elements.floating)].includes(r)||e.context?.elements.domReference===r)));if(i===_&&H&&i8(H),s&&i!==_&&!m2(a)&&U1(e)===e.body){if(u1(H)&&(H.focus(),s===`popup`)){te.request(()=>{H.focus()});return}let e=U(),t=P.current,n=(t&&e.includes(t)?t:null)||e[e.length-1]||H;u1(n)&&n.focus()}if(b.current.insideReactTree){b.current.insideReactTree=!1;return}(C||!c)&&r&&m&&!M.current&&(C||r!==r8())&&(j.current=!0,t.setOpen(!1,i6(u6,n)))})}function o(){N.current||(b.current.insideReactTree=!0,B.start(0,()=>{b.current.insideReactTree=!1}))}let u=u1(_)?_:null;if(!(!v&&!u))return v6(u&&v4(u,`focusout`,a),u&&v4(u,`pointerdown`,n),v&&v4(v,`focusin`,i),v&&v4(v,`focusout`,a),v&&A&&v4(v,`focusout`,o,!0))},[r,_,v,H,c,k,A,t,l,s,U,C,x,b,B,V,te,d,f,re]),K.useEffect(()=>{if(r||!v||!g)return;let e=Array.from(A?.portalNode?.querySelectorAll(`[${E6(`portal`)}]`)||[]),t=(k?O0(k.nodesRef.current,x()):[]).find(e=>w0(e.context?.elements.domReference||null))?.context?.elements.domReference,n=R6([v,...e,L.current,R.current,A?.beforeOutsideRef.current,A?.afterOutsideRef.current,...re(),t,$6(f),$6(d),C?_:null].filter(e=>e!=null),{ariaHidden:c||C,mark:!1}),i=R6([v,...e].filter(e=>e!=null));return()=>{i(),n()}},[g,r,_,v,c,A,C,k,x,d,f,re]),Z2(()=>{if(!g||r||!u1(H))return;F.current=``,I.current=``;let e=h2(H),t=U1(e);queueMicrotask(()=>{let n=w.current,r=typeof n==`function`?n(D.current||``):n;if(r===void 0||r===!1||W1(H,t))return;let i=null,a=()=>(i??=U(H),i[0]||H),o;o=r===!0||r===null?a():$6(r),o||=a();let s=W1(H,U1(e)),c=b.current.openEvent,l=c?.type===`mousedown`&&j0(c);O6(o,{sync:l,preventScroll:o===H,shouldFocus(){if(!O.current)return!1;if(s)return!0;let t=U1(e);return!(t!==o&&W1(H,t))}})})},[r,g,H,U,w,D,O,b]);let ie=K.useRef(null);Z2(()=>{if(r||!H){ie.current=null;return}ie.current&&=(ie.current.cancelled=!0,null);let e=h2(H),t=U1(e),n=D.current==null;n8(t);function i(e){if(e.open||(F.current=xae(e.nativeEvent,I.current)),(e.reason===`focus-out`&&e.triggerElement?.hasAttribute(E6(`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(j0(e.nativeEvent)||M0(e.nativeEvent))j.current=!1;else{let e=!1;h2(H).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&&a1(t)!==`body`?t:null,s=n?o||a:a||o;return s||=r8()||null,typeof i==`boolean`?s:$6(i)||s||null}return()=>{y.off(`openchange`,i);let t=U1(e),n=re(),r=W1(v,t)||n.some(e=>e===t||W1(e,t))||k&&D0(k.nodesRef.current,x(),!1).some(e=>W1(e.context?.elements.floating,t)),o=T.current,s=F.current,c=a(s),l={cancelled:!1};ie.current=l,queueMicrotask(()=>{ie.current===l&&(ie.current=null);let n=Cae(c),i=E.current??typeof o!=`boolean`;if(!l.cancelled&&o&&!j.current&&u1(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,H,T,E,D,y,k,_,x,re]),Z2(()=>{if(!B1||g||!v)return;let e=U1(h2(v));!u1(e)||!S0(e)||W1(v,e)&&e.blur()},[g,v]),Z2(()=>{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,_]),Z2(()=>{if(!(r||!H))return i8(H),()=>{queueMicrotask(t8)}},[r,H]);let ae=!r&&(!c||!C)&&(ne||c);return(0,X.jsxs)(K.Fragment,{children:[ae&&(0,X.jsx)(T6,{"data-type":`inside`,ref:z,onFocus:e=>{if(c){let e=U();O6(e[e.length-1])}else A?.portalNode&&(j.current=!1,I2(e,A.portalNode)?N2(_)?.focus():$6(f??A.beforeOutsideRef)?.focus())}}),n,ae&&(0,X.jsx)(T6,{"data-type":`inside`,ref:ee,onFocus:e=>{c?O6(U()[0]):A?.portalNode&&(l&&(j.current=!0),I2(e,A.portalNode)?P2(_)?.focus():$6(d??A.afterOutsideRef)?.focus())}})]})}function o8(e,t={}){let{enabled:n=!0,event:r=`click`,toggle:i=!0,ignoreMouse:a=!1,stickIfOpen:o=!0,touchOpenDelay:s=0,reason:c=o6}=t,l=e.context.dataRef,u=K.useRef(void 0),d=C6(),f=n$(),p=K.useMemo(()=>{function t(t,n,r,i){let a=i6(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=N0(e.pointerType,!0)&&M0(e.nativeEvent)?`virtual`:e.pointerType},onMouseDown(i){let o=u.current,s=i.nativeEvent,c=e.select(`open`);if(i.button!==0||r===`click`||N0(o,!0)&&a)return;let l=n(c,i.currentTarget,e=>e===`click`||e===`mousedown`),f=K1(s),p=S0(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}N0(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 K.useMemo(()=>n?{reference:p}:QQ,[n,p])}function wae(){return!1}function Tae(e){return{escapeKey:typeof e==`boolean`?e:e?.escapeKey??!1,outsidePress:typeof e==`boolean`?e:e?.outsidePress??!0}}function s8(e,t={}){let{enabled:n=!0,escapeKey:r=!0,outsidePress:i=!0,outsidePressEvent:a=`sloppy`,referencePress:o=wae,bubbles:s,externalTree:c}=t,l=e.useState(`open`),u=e.useState(`floatingElement`),{dataRef:d,events:f}=e.context,p=Y6(c),m=qQ(typeof i==`function`?i:()=>!1),h=typeof i==`function`?m:i,g=h!==!1,_=qQ(()=>a),{escapeKey:v,outsidePress:y}=Tae(s),b=K.useRef(!1),x=K.useRef(!1),S=K.useRef(!1),C=K.useRef(!1),w=K.useRef(!1),T=K.useRef(``),E=K.useRef(null),D=n$(),O=n$(),k=n$(),A=qQ(()=>{O.clear(),d.current.insideReactTree=!1}),j=qQ(e=>{let t=d.current.floatingContext?.nodeId;return(p?D0(p.nodesRef.current,t):[]).some(t=>t.context?.open&&!t.context.dataRef.current[e])}),M=qQ(t=>b0(t,e.select(`floatingElement`))||b0(t,e.select(`domReferenceElement`))),N=qQ(t=>{o()&&e.setOpen(!1,i6(o6,t.nativeEvent))}),P=qQ(t=>{if(!l||!n||!r||t.key!==`Escape`)return;let i=A0(t)?t.nativeEvent:t;if(w.current||i.isComposing||!v&&j(`__escapeKeyBubbles`))return;let a=i6(oae,i);e.setOpen(!1,a),a.isCanceled||t.preventDefault(),!v&&!a.isPropagationAllowed&&t.stopPropagation()}),F=qQ(()=>{d.current.insideReactTree=!0,O.start(0,A)}),I=qQ(t=>{if(!l||!n||t.button!==0)return;let r=K1(t.nativeEvent);W1(e.select(`floatingElement`),r)&&(b.current||(b.current=!0,x.current=!1))}),L=qQ(e=>{!l||!n||(e.defaultPrevented||e.nativeEvent.defaultPrevented)&&b.current&&(x.current=!0)});K.useEffect(()=>{function e(e){e.open||(C.current=!1)}return f.on(`openchange`,e),()=>{f.off(`openchange`,e)}},[f]),K.useEffect(()=>A,[A]),K.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 t$,i=h2(u);function a(){k.clear(),w.current=!0}function o(){w.current=!0,k.start(B1?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&&D0(p.nodesRef.current,t).some(t=>b0(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=K1(n),i=`[${E6(`inert`)}]`,a=l1(r)?r.getRootNode():null,o=Array.from((d1(a)?a:h2(e.select(`floatingElement`))).querySelectorAll(i)),s=e.context.triggerElements;if(r&&(s.hasElement(r)||s.hasMatchingElement(e=>W1(e,r))))return;let c=l1(r)?r:null;for(;c&&!S1(c);){let e=T1(c);if(S1(e)||!l1(e))break;c=e}if(!(o.length&&l1(r)&&!x0(r)&&!W1(r,e.select(`floatingElement`))&&o.every(e=>!W1(c,e)))){if(u1(r)&&!(`touches`in n)){let e=S1(r),t=C1(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&&!j0(n)&&!C.current)return;if(S.current){t.clear(),S.current=!1;return}}typeof h==`function`&&!h(n)||j(`__outsidePressBubbles`)||(e.setOpen(!1,i6(iae,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=K1(e);if(!n)return;let r=v4(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 B(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 V(e){L(e,B)}function te(e){f()!==`sloppy`||!E.current||M(e)||(E.current.dismissOnTouchEnd&&N(e),D.clear(),E.current=null)}function ne(e){L(e,te)}let H=v6(r&&v6(v4(i,`keydown`,P),v4(i,`compositionstart`,a),v4(i,`compositionend`,o)),g&&v6(v4(i,`click`,z,!0),v4(i,`pointerdown`,z,!0),v4(i,`pointerup`,ee,!0),v4(i,`pointercancel`,ee,!0),v4(i,`mousedown`,z,!0),v4(i,`mouseup`,ee,!0),v4(i,`touchstart`,R,{capture:!0,passive:!0}),v4(i,`touchmove`,V,{capture:!0,passive:!0}),v4(i,`touchend`,ne,{capture:!0,passive:!0})));return()=>{H(),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=K.useMemo(()=>({onKeyDown:P,onPointerDown:N,onClick:N}),[P,N]),z=K.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 K.useMemo(()=>n?{reference:R,floating:z,trigger:R}:{},[n,R,z])}function c8(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),Z2(()=>{let e={open:s,floatingId:i,referenceElement:c,floatingElement:l};l1(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 l8(e,t=!1,n=!1,r=!1){let[i,a]=K.useState(e&&t?`idle`:void 0),[o,s]=K.useState(e&&!r);return e&&!o&&(s(!0),a(`starting`)),!e&&o&&i!==`ending`&&!n&&a(`ending`),!e&&!o&&i===`ending`&&a(void 0),Z2(()=>{if(!e&&o&&i!==`ending`&&n){let e=S6.request(()=>{a(`ending`)});return()=>{S6.cancel(e)}}},[e,o,i,n]),Z2(()=>{if(!e||t||i===void 0)return;let n=S6.request(()=>{a(void 0)});return()=>{S6.cancel(n)}},[t,e,i]),Z2(()=>{if(!e||!t)return;e&&o&&i!==`idle`&&a(`starting`);let n=S6.request(()=>{a(`idle`)});return()=>{S6.cancel(n)}},[t,e,o,i]),{mounted:o,setMounted:s,transitionStatus:i}}var u8=null;function Eae(e){if(!u8){let e=[];u8=e,queueMicrotask(()=>{u8=null,j4.flushSync(()=>{for(let t of e)t()})})}u8.push(e)}function d8(e,t=!1,n=!1){let r=C6();return qQ((i,a=null)=>{r.cancel();let o=$6(e);if(o==null)return;let s=o,c=()=>{if(!n){j4.flushSync(i);return}Eae(()=>{a?.aborted||i()})};if(typeof s.getAnimations!=`function`||globalThis.BASE_UI_ANIMATIONS_DISABLED){i();return}function l(){Promise.all(i4(s).map(e=>e.finished.then(XQ))).then(()=>{a?.aborted||c()},()=>{if(!a?.aborted){if(i4(s).some(e=>e.pending||e.playState!==`finished`)){l();return}c()}})}if(t){let e=$1;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 f8(e){let{enabled:t=!0,open:n,ref:r,batch:i=!1,onComplete:a}=e,o=qQ(a),s=d8(r,n,i);K.useEffect(()=>{if(!t)return;let e=new AbortController;return s(o,e.signal),()=>{e.abort()}},[t,n,o,s])}function Dae(e){let{open:t,ref:n,preventUnmountOnClose:r,setPreventUnmountOnClose:i,onUnmount:a,animateInitialOpen:o}=e,s=qQ(i),{mounted:c,setMounted:l,transitionStatus:u}=l8(t,!1,!1,o),d=!t&&r;Z2(()=>{t&&s(!1)},[t,s]);let f=K.useRef(c),p=K.useRef(!1),m=W$(),h=()=>{f.current=!1,l(!1),a()};Z2(()=>{f.current=c,p.current&&(p.current=!1,!t&&c&&h())});let g=qQ(()=>{if(f.current){if(t){p.current=!0,m();return}h()}});return f8({enabled:c&&!t&&!d,open:t,ref:n,onComplete(){t||g()}}),{mounted:c,transitionStatus:u,preventUnmountingOnClose:d,forceUnmount:g}}var p8={tabIndex:-1,[q1]:``};function m8(e){return t=>t!==`touch`||e.current}function h8(e,t=!1){let n=J$(),r=J6()!=null,i=WQ(()=>e(n,r)).current;return c8({popupStore:i,treatPopupAsFloatingElement:t,floatingRootContext:i.state.floatingRootContext,floatingId:n,nested:r,onOpenChange:i.setOpen}),i}function g8({handle:e,store:t}){return Z2(()=>e.attachStore(t),[e,t]),null}function _8(e){let t=e.context.triggerElements.size;e.select(`open`)&&e.state.triggerCount!==t&&e.set(`triggerCount`,t)}function Oae(e,t){let n=K.useRef(null);return qQ(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),_8(a))}r!==null&&e!==void 0&&(n.current={store:t,id:e,element:r},t.context.triggerElements.add(e,r),_8(t))})}function v8(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 y8(e){let t=!1;return e.preventUnmountOnClose=()=>{t=!0},()=>t}function b8(e,t,n,r){let i=n.useState(`isMountedByTrigger`,e),a=Oae(e,n),o=qQ(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=qQ(e=>{a(e),e&&o(e)});return Z2(()=>(s(t.current),()=>s(null)),[s,t,n,e]),Z2(()=>{if(i){let e={activeTriggerElement:t.current,...r};n.update(e)}},[i,n,t,...Object.values(r)]),{registerTrigger:s,isMountedByThisTrigger:i}}function x8(e,t={}){let{closeOnActiveTriggerUnmount:n=!1}=t,r=K.useRef(null),i=e.useState(`open`);Z2(()=>{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=i6(a6);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 S8(e,t,n,r){let{mounted:i,transitionStatus:a,forceUnmount:o}=Dae({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 WQ(()=>(t.set(`mounted`,i),null)),t.useSyncedValues({mounted:i,transitionStatus:a}),{forceUnmount:o,transitionStatus:a}}function C8(e,t){e.useSyncedValues(t),Z2(()=>()=>{e.update({activeTriggerProps:QQ,inactiveTriggerProps:QQ,popupProps:QQ})},[e])}function w8(e,t){Z2(()=>{!t&&e.state.openMethod!==null&&e.set(`openMethod`,null)},[t,e]),Z2(()=>()=>{e.state.openMethod!==null&&e.set(`openMethod`,null)},[e])}var T8=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}},E8=[],D8=void 0;function kae(){return D8}function Aae(e){E8.push(e)}function O8(e){let t=(t,n)=>{let r=WQ(jae).current,i;try{D8=r;for(let e of E8)e.before(r);i=e(t,n);for(let e of E8)e.after(r);r.didInitialize=!0}finally{D8=void 0}return i};return t.displayName=e.displayName||e.name,t}function k8(e){return K.forwardRef(O8(e))}function jae(){return{didInitialize:!1}}var A8=DQ(),Mae=m$(19)?Pae:Fae;function j8(e,t,n,r,i){return Mae(e,t,n,r,i)}function Nae(e,t,n,r,i){let a=K.useCallback(()=>t(e.getSnapshot(),n,r,i),[e,t,n,r,i]);return(0,A8.useSyncExternalStore)(e.subscribe,a,a)}Aae({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,A8.useSyncExternalStore)(e.subscribe,e.getSnapshot,e.getSnapshot))}});function Pae(e,t,n,r,i){let a=kae();if(!a)return Nae(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 Fae(e,t,n,r,i){return(0,kQ.useSyncExternalStoreWithSelector)(e.subscribe,e.getSnapshot,e.getSnapshot,e=>t(e,n,r,i))}var Iae=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 j8(this,e,t,n,r)}},M8=class extends Iae{constructor(e,t={},n){super(e),this.context=t,this.selectors=n}useSyncedValue(e,t){K.useDebugValue(e);let n=this;Z2(()=>{n.state[e]!==t&&n.set(e,t)},[n,e,t])}useSyncedValueWithCleanup(e,t){let n=this;Z2(()=>(n.state[e]!==t&&n.set(e,t),()=>{n.set(e,void 0)}),[n,e,t])}useSyncedValues(e){let t=this;Z2(()=>{t.update(e)},[t,...Object.values(e)])}useControlledProp(e,t){K.useDebugValue(e);let n=this,r=t!==void 0;Z2(()=>{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 K.useDebugValue(e),j8(this,this.selectors[e],t,n,r)}useContextCallback(e,t){K.useDebugValue(e);let n=qQ(t??XQ);this.context[e]=n}useStateSetter(e){let t=K.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)}})}},Lae={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},Rae=class extends M8{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:W6(),nested:n,triggerElements:i},Lae),this.syncOnly=t}syncOpenEvent=(e,t)=>{(!e||!this.state.open||t!=null&&P0(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 N8(e,t,n=!1){return{open:!1,openProp:void 0,mounted:!1,transitionStatus:void 0,floatingRootContext:new Rae({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:QQ,inactiveTriggerProps:QQ,popupProps:QQ}}var P8=e=>e.triggerIdProp??e.activeTriggerId,F8=e=>e.openProp??e.open,I8=e=>(e.popupElement?.id??e.floatingId)||void 0;function L8(e,t){return t!==void 0&&F8(e)&&P8(e)===t}function zae(e,t){return L8(e,t)?!0:t!==void 0&&F8(e)&&P8(e)==null&&!e.openedWithoutTrigger&&e.triggerCount===1}var R8={open:F8,mounted:e=>e.mounted,transitionStatus:e=>F8(e)&&!e.mounted?`starting`:e.transitionStatus,floatingRootContext:e=>e.floatingRootContext,triggerCount:e=>e.triggerCount,preventUnmountingOnClose:e=>e.preventUnmountingOnClose,payload:e=>e.payload,activeTriggerId:P8,activeTriggerElement:e=>e.mounted?e.activeTriggerElement:null,popupId:I8,isTriggerActive:(e,t)=>t!==void 0&&P8(e)===t,isOpenedByTrigger:(e,t)=>L8(e,t),isMountedByTrigger:(e,t)=>t!==void 0&&P8(e)===t&&e.mounted,triggerProps:(e,t)=>t?e.activeTriggerProps:e.inactiveTriggerProps,triggerPopupId:(e,t)=>zae(e,t)?I8(e):void 0,popupProps:e=>e.popupProps,popupElement:e=>e.popupElement,positionerElement:e=>e.positionerElement};function z8(e){let t=K.useCallback(t=>e===void 0?XQ:e.subscribeStore(t),[e]),n=K.useCallback(()=>e===void 0?void 0:e.store,[e]);return(0,A8.useSyncExternalStore)(t,n,()=>e?.serverStore)}var B8=R1&&B1;function Bae(e,t={}){let{enabled:n=!0,delay:r}=t,{events:i,dataRef:a}=e.context,o=K.useRef(!1),s=K.useRef(null),c=K.useRef(!0),l=n$();K.useEffect(()=>{let t=e.select(`domReferenceElement`);if(!n)return;let r=o1(t);function i(){let t=e.select(`domReferenceElement`);!e.select(`open`)&&u1(t)&&t===U1(h2(t))&&(o.current=!0,s.current=t)}function a(){c.current=!0}function l(){c.current=!1}return v6(v4(r,`blur`,i),B8&&v4(r,`keydown`,a,!0),B8&&v4(r,`pointerdown`,l,!0))},[e,n]),K.useEffect(()=>{if(!n)return;function t(t){if(t.reason===`trigger-press`||t.reason===`escape-key`){let t=e.select(`domReferenceElement`);l1(t)&&(s.current=t,o.current=!0)}}return i.on(`openchange`,t),()=>{i.off(`openchange`,t)}},[i,n,e]);let u=K.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=K1(n.nativeEvent);if(l1(a)){if(B8&&!n.relatedTarget){if(!c.current&&!S0(a))return}else if(!T0(a))return}let u=y0(n.relatedTarget,e.context.triggerElements),{nativeEvent:d,currentTarget:f}=n;if(e.select(`open`)&&u||!r){e.setOpen(!0,i6(c6,d,f));return}l.start(r,()=>{o.current||e.setOpen(!0,i6(c6,d,f))})},onBlur(n){t();let r=n.relatedTarget,i=n.nativeEvent,o=l1(r)&&r.hasAttribute(E6(`focus-guard`))&&r.getAttribute(`data-type`)===`outside`;l.start(0,()=>{let t=e.select(`domReferenceElement`),n=U1(h2(t));!r&&n===t||W1(a.current.floatingContext?.refs.floating.current,n)||W1(t,n)||o||y0(r??n,e.context.triggerElements)||e.setOpen(!1,i6(c6,i))})}}},[a,r,e,l]);return K.useMemo(()=>n?{reference:u,trigger:u}:{},[n,u])}var Vae=class e{pointerType=void 0;interactedInside=!1;handler=void 0;blockMouseMove=!0;performedPointerEventsMutation=!1;pointerEventsScopeElement=null;pointerEventsReferenceElement=null;pointerEventsFloatingElement=null;restTimeoutPending=!1;openChangeTimeout=new t$;restTimeout=new t$;handleCloseOptions=void 0;static create(){return new e}dispose=()=>{this.openChangeTimeout.clear(),this.restTimeout.clear()};disposeEffect=()=>this.dispose},V8=new WeakMap;function H8(e){if(!e.performedPointerEventsMutation)return;let t=e.pointerEventsScopeElement;t&&V8.get(t)===e&&(e.pointerEventsScopeElement?.style.removeProperty(`pointer-events`),e.pointerEventsReferenceElement?.style.removeProperty(`pointer-events`),e.pointerEventsFloatingElement?.style.removeProperty(`pointer-events`),V8.delete(t)),e.performedPointerEventsMutation=!1,e.pointerEventsScopeElement=null,e.pointerEventsReferenceElement=null,e.pointerEventsFloatingElement=null}function U8(e,t){let{scopeElement:n,referenceElement:r,floatingElement:i}=t,a=V8.get(n);a&&a!==e&&H8(a),H8(e),e.performedPointerEventsMutation=!0,e.pointerEventsScopeElement=n,e.pointerEventsReferenceElement=r,e.pointerEventsFloatingElement=i,V8.set(n,e),n.style.pointerEvents=`none`,r.style.pointerEvents=`auto`,i.style.pointerEvents=`auto`}function W8(e){let t=e.context.dataRef.current,n=WQ(()=>t.hoverInteractionState??Vae.create()).current;return t.hoverInteractionState||=n,$Q(t.hoverInteractionState.disposeEffect),t.hoverInteractionState}function G8(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=Y6(),u=J6(),d=W8(e),f=n$(),p=qQ(()=>_6(c.current.openEvent?.type,d.interactedInside)),m=qQ(()=>fae(c.current.openEvent?.type)),h=qQ(()=>{H8(d)});Z2(()=>{a||(d.pointerType=void 0,d.restTimeoutPending=!1,d.interactedInside=!1,h())},[a,d,h]),K.useEffect(()=>h,[h]),Z2(()=>{if(n&&a&&d.handleCloseOptions?.blockPointerEvents&&m()&&l1(s)&&o){let e=s,t=o,n=h2(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??G1(e,`[data-rootownerid]`)??n.body;return U8(d,{scopeElement:c,referenceElement:e,floatingElement:t}),()=>{h()}}},[n,a,s,o,d,m,l,u,h]),K.useEffect(()=>{if(!n)return;function t(){return!!(l&&u&&D0(l.nodesRef.current,u).length>0)}function a(t){let n=h6(r,`close`,d.pointerType),i=()=>{e.setOpen(!1,i6(s6,t)),l?.events.emit(`floating.closed`,t)};n?d.openChangeTimeout.start(n,i):(d.openChangeTimeout.clear(),i())}function s(e){let t=K1(e);if(!C0(t)){d.interactedInside=!1;return}d.interactedInside=G1(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(y0(n.relatedTarget,e.context.triggerElements))return;let r=c.current.floatingContext?.nodeId??i,o=n.relatedTarget;if(!(l&&r&&l1(o)&&D0(l.nodesRef.current,r,!1).some(e=>W1(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,i6(s6,n)),l.events.emit(`floating.closed`,n)})}let y=o;return v6(y&&v4(y,`mouseenter`,g),y&&v4(y,`mouseleave`,_),y&&v4(y,`pointerdown`,s,!0),()=>{l?.events.off(`floating.closed`,v)})},[n,o,e,c,r,i,m,p,h,d,l,u,f])}var Hae={current:null};function K8(e,t={}){let{enabled:n=!0,delay:r=0,handleClose:i=null,mouseOnly:a=!1,restMs:o=0,move:s=!0,triggerElementRef:c=Hae,externalTree:l,isActiveTrigger:u=!0,getHandleCloseContext:d,isClosing:f,shouldOpen:p,guardStaleOpen:m=!1}=t,{dataRef:h,events:g}=e.context,_=Y6(l),v=W8(e),y=K.useRef(!1),b=y6(i),x=y6(r),S=y6(o),C=y6(n),w=y6(p),T=y6(f),E=qQ(()=>_6(h.current.openEvent?.type,v.interactedInside)),D=qQ(()=>w.current?.()!==!1),O=qQ((t,n,r)=>{let i=e.context.triggerElements;if(i.hasElement(n))return!t||!W1(t,n);if(!l1(r))return!1;let a=r;return i.hasMatchingElement(e=>W1(e,a))&&(!t||!W1(t,a))}),k=qQ(()=>{v.handler&&=(h2(e.select(`domReferenceElement`)).removeEventListener(`mousemove`,v.handler),void 0)}),A=qQ(()=>{H8(v)});return u&&(v.handleCloseOptions=i?.__options),K.useEffect(()=>k,[k]),K.useEffect(()=>{if(!n)return;function e(e){e.open?y.current=!1:(y.current=e.reason===s6,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]),K.useEffect(()=>{if(!n)return;function t(t,n=!0){let r=h6(x.current,`close`,v.pointerType);r?v.openChangeTimeout.start(r,()=>{e.setOpen(!1,i6(s6,t)),_?.events.emit(`floating.closed`,t)}):n&&(v.openChangeTimeout.clear(),e.setOpen(!1,i6(s6,t)),_?.events.emit(`floating.closed`,t))}let r=c.current??(u?e.select(`domReferenceElement`):null);if(!l1(r))return;function i(t){if(v.openChangeTimeout.clear(),v.blockMouseMove=!1,a&&!N0(v.pointerType))return;let n=g6(S.current),r=h6(x.current,`open`,v.pointerType),i=K1(t),o=t.currentTarget??null,s=e.select(`domReferenceElement`),c=o;if(l1(i)&&!e.context.triggerElements.hasElement(i)){for(let t of e.context.triggerElements.elements())if(W1(t,i)){c=t;break}}l1(o)&&l1(s)&&!e.context.triggerElements.hasElement(o)&&W1(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&&l1(c)&&l1(s)&&W1(s,c)&&f,m=n>0&&!r,h=l&&(u||f)||p,g=!u||l;if(h){D()&&e.setOpen(!0,i6(s6,t,c));return}m||(r?v.openChangeTimeout.start(r,()=>{g&&D()&&e.setOpen(!0,i6(s6,t,c))}):g&&D()&&e.setOpen(!0,i6(s6,t,c)))}function o(n){if(E()){A();return}k();let r=h2(e.select(`domReferenceElement`));v.restTimeout.clear(),v.restTimeoutPending=!1;let i=h.current.floatingContext??d?.();if(!y0(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`||!W1(e.select(`floatingElement`),n.relatedTarget))&&t(n)}}function l(e){W1(r,e.relatedTarget)||(v.openChangeTimeout.clear(),v.restTimeout.clear(),v.restTimeoutPending=!1)}let f=m?v4(r,`mouseout`,l):void 0;return s?v6(v4(r,`mousemove`,i,{once:!0}),v4(r,`mouseenter`,i),v4(r,`mouseleave`,o),f):v6(v4(r,`mouseenter`,i),v4(r,`mouseleave`,o),f)},[k,A,h,x,e,n,b,v,u,O,E,a,s,S,c,_,C,d,T,D,m]),K.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&&!N0(v.pointerType))return;if(o&&s&&v.handleCloseOptions?.blockPointerEvents){let t=e.select(`floatingElement`);if(t){let e=v.handleCloseOptions?.getScope?.()??r.ownerDocument.body;U8(v,{scopeElement:e,referenceElement:r,floatingElement:t})}}let c=g6(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,i6(s6,n,r))}v.pointerType===`touch`?j4.flushSync(()=>{l()}):s&&o?l():(v.restTimeoutPending=!0,v.restTimeout.start(c,l))}}},[n,v,E,O,a,e,S,D])}function q8(e){return B1&&e.movementX===0&&e.movementY===0}function J8(e,t,n){switch(e){case`vertical`:return t;case`horizontal`:return n;default:return t||n}}function Y8(e,t){return J8(t,e===`ArrowUp`||e===`ArrowDown`,e===`ArrowLeft`||e===`ArrowRight`)}function X8(e,t,n){return J8(t,e===`ArrowDown`,n?e===`ArrowLeft`:e===`ArrowRight`)||e===`Enter`||e===` `||e===``}function Uae(e,t,n){return J8(t,n?e===Y1:e===X1,e===Q1)}function Wae(e,t,n,r){return t===`both`||t===`horizontal`&&r?e===`Escape`:J8(t,n?e===X1:e===Y1,e===Z1)}function Gae(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=E0(E),A=w0(D),j=y6(k),M=J6(),N=Y6(x),P=K.useRef(f),F=K.useRef(o??-1),I=K.useRef(null),L=K.useRef(!0),R=qQ(e=>{i(F.current===-1?null:F.current,e)}),z=K.useRef(!!E),ee=K.useRef(T),B=K.useRef(!1),V=K.useRef(!1),te=K.useRef(null),ne=y6(h),H=y6(T),U=y6(o),re=y6(b),ie=C6(),ae=C6(),oe=qQ(()=>{ie.cancel();function e(e){d||(te.current=O6(e,{sync:B.current,preventScroll:!0}))}let t=n.current[F.current],r=V.current;t&&e(t),(B.current?e=>e():e=>ie.request(e))(()=>{let i=n.current[F.current]||t;i&&(t||e(i),ue&&(r||!L.current)&&i.scrollIntoView?.({block:`nearest`,inline:`nearest`}))})});Z2(()=>{O.current.orientation=g},[O,g]),Z2(()=>{T||(I.current=null),(!T||f!==`auto`)&&(P.current=f)},[T,f]),Z2(()=>{a&&(T&&E?(F.current=o??-1,P.current&&o!=null&&(V.current=!0,R())):z.current&&(F.current=-1,R()))},[a,T,E,o,R]),Z2(()=>{if(a){if(!T){B.current=!1;return}if(E){if(r==null){if(B.current=!1,U.current!=null)return;if(z.current&&(F.current=-1,oe()),(!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=>ae.request(e):queueMicrotask)(t),e+=1):(F.current=I.current==null||X8(I.current,_,u)||l?c2(n):l2(n),I.current=null,R())};t()}}else s2(n.current,r)||(F.current=r,oe(),V.current=!1)}}},[a,T,E,r,U,l,n,_,u,R,oe,ae]),Z2(()=>{if(!a||E||!N||d||!z.current)return;let e=N.nodesRef.current,t=e.find(e=>e.id===M)?.context?.elements.floating,n=U1(h2(D??t??null)),r=e.some(e=>e.context&&W1(e.context.elements.floating,n));t&&!r&&L.current&&t.focus({preventScroll:!0})},[a,E,D,N,M,d]),Z2(()=>{ee.current=T,z.current=!!E});let se=r!=null,W=qQ(e=>{if(!H.current)return;let t=n.current.indexOf(e.currentTarget);t!==-1&&(F.current!==t||r!==t)&&(F.current=t,R(e))}),G=qQ(()=>v??N?.nodesRef.current.find(e=>e.id===M)?.context?.dataRef?.current.orientation),ce=qQ(()=>c2(n,ne.current)),le=qQ(t=>{if(L.current=!1,B.current=!0,t.which===229||!H.current&&t.currentTarget===j.current)return;if(l&&Wae(t.key,g,u,w)){Y8(t.key,G())||k0(t),e.setOpen(!1,i6(d6,t.nativeEvent));let n=S?.current??D;u1(n)&&n.focus();return}r!=null&&r!==F.current&&!s2(n.current,r)&&(F.current=r);let i=F.current,a=c2(n,h),o=l2(n,h);if(A||(t.key===`Home`&&(k0(t),F.current=a,R(t)),t.key===`End`&&(k0(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(Y8(t.key,g)){k0(t);let e=U1(t.currentTarget.ownerDocument);if(T&&!d&&W1(t.currentTarget,e)&&!n.current.some(t=>t!=null&&W1(t,e))){F.current=X8(t.key,g,u)?a:o,R(t),r===F.current&&oe();return}let{index:l,wrapped:f}=u2(n.current,i,{decrement:!X8(t.key,g,u),loopFocus:c,allowEscape:s,disabledIndices:h,minIndex:a,maxIndex:o});f&&(B.current=!1),F.current=l,R(t)}}),ue=K.useMemo(()=>({onFocus(e){B.current=!0,W(e)},onClick({currentTarget:e}){d||e.focus({preventScroll:!0})},onMouseMove(e){q8(e)||(B.current=!0,V.current=!1,p&&W(e))},onPointerLeave(e){if(!H.current||!L.current||e.pointerType===`touch`)return;B.current=!0;let t=e.relatedTarget;if(!(!p||n.current.includes(t))&&re.current&&(te.current?.(),te.current=null,F.current=-1,R(e),!d)){let e=j.current,t=U1(h2(e));e&&W1(e,t)&&e.focus({preventScroll:!0})}}}),[W,H,j,p,n,R,re,d]),de=K.useMemo(()=>d&&T&&se&&{"aria-activedescendant":`${y}-${r}`},[d,T,se,y,r]),fe=K.useMemo(()=>({...A?{}:de,onKeyDown(t){if(t.key===`Tab`&&t.shiftKey&&T&&!d){let n=K1(t.nativeEvent);if(n&&!W1(j.current,n))return;k0(t);let r=i6(u6,t.nativeEvent);e.setOpen(!1,r);let i=S?.current??D;!r.isCanceled&&u1(i)&&i.focus();return}le(t)},onPointerMove(e){q8(e)||(L.current=!0)}}),[de,le,j,A,e,T,d,D,S]),pe=K.useMemo(()=>{function t(t){e.setOpen(!0,i6(d6,t.nativeEvent,t.currentTarget))}function n(e){f===`auto`&&j0(e.nativeEvent)&&(P.current=!d)}function r(e){P.current=f,f===`auto`&&M0(e.nativeEvent)&&(P.current=!0)}return{onKeyDown(n){let r=e.select(`open`);L.current=!1;let i=n.key.startsWith(`Arrow`),a=Uae(n.key,G(),u),o=Y8(n.key,r?g:_),s=(l?a:o)||n.key===`Enter`||n.key.trim()===``;if(d&&r&&(!l||S0(n.currentTarget)))return le(n);if(!(!r&&!m&&i)){if(s){let e=Y8(n.key,G());I.current=l&&e?null:n.key}if(l){a&&(k0(n),r?(F.current=ce(),R(n),d&&j.current?.focus()):t(n));return}o&&(U.current!=null&&(F.current=U.current),k0(n),!r&&m?t(n):le(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}},[le,f,ce,l,R,e,m,g,_,G,u,U,d,j]),me=K.useMemo(()=>({...de,...pe}),[de,pe]);return K.useMemo(()=>a?{reference:me,floating:fe,item:ue,trigger:pe}:{},[a,me,fe,pe,ue])}function Kae(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=qQ(s),f=e.useState(`open`),p=n$(),m=K.useRef(``),h=K.useRef(u??i??-1),g=K.useRef(null),_=qQ(e=>{function t(e){return r?.current[e]}function s(e){let n=t(e);return n&&!m2(n)||n?.matches(`:disabled`)?!1:o==null||!f2(ZQ,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===` `&&(k0(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!==` `&&(k0(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=qQ(t=>{let n=t.relatedTarget,r=e.select(`domReferenceElement`),i=e.select(`floatingElement`);W1(r,n)||W1(i,n)||(p.clear(),m.current=``,h.current=g.current,d?.(!1))});Z2(()=>{!f&&u!==null||(p.clear(),g.current=null,m.current!==``&&(m.current=``,d?.(!1)))},[f,u,p,d]);let y=K.useMemo(()=>({onKeyDown:_,onBlur:v}),[_,v]);return K.useMemo(()=>c?{reference:y,floating:y}:{},[c,y])}var Z8=.1,qae=Z8*Z8,Q8=.5;function $8(e,t,n,r,i,a){return r>=t!=a>=t&&e<=(i-n)*(t-r)/(a-r)+n}function e5(e,t,n,r,i,a,o,s,c,l){let u=!1;return $8(e,t,n,r,i,a)&&(u=!u),$8(e,t,i,a,o,s)&&(u=!u),$8(e,t,o,s,c,l)&&(u=!u),$8(e,t,c,l,n,r)&&(u=!u),u}function Jae(e,t,n){return e>=n.x&&e<=n.x+n.width&&t>=n.y&&t<=n.y+n.height}function t5(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 n5(e={}){let{blockPointerEvents:t=!1}=e,n=new t$,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*qae;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=K1(r),g=r.type===`mouseleave`,_=W1(u,h),v=W1(a,h);if(_&&(l=!0,!g))return;if(v&&(l=!1,!g)){l=!0;return}if(g&&l1(r.relatedTarget)&&W1(u,r.relatedTarget))return;function y(){return!!(s&&D0(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=t5(d,f,D,x.top+1,O,S.bottom-1);break;case`bottom`:j=t5(d,f,D,S.top+1,O,x.bottom-1);break;case`left`:j=t5(d,f,S.right-1,A,x.left+1,k);break;case`right`:j=t5(d,f,x.right-1,A,S.left+1,k)}if(j)return;if(l&&!Jae(d,f,x)){b();return}if(!g&&p(d,f)){b();return}let M=!1;switch(c){case`top`:{let n=T?Q8/2:Q8*4,r=T||C?e+n:e-n,i=T?e-n:C?e+n:e-n,a=t+Q8+1,o=C||T?S.bottom-Q8:S.top,s=C?T?S.bottom-Q8:S.top:S.bottom-Q8;M=e5(d,f,r,a,i,a,S.left,o,S.right,s);break}case`bottom`:{let n=T?Q8/2:Q8*4,r=T||C?e+n:e-n,i=T?e-n:C?e+n:e-n,a=t-Q8,o=C||T?S.top+Q8:S.bottom,s=C?T?S.top+Q8:S.bottom:S.top+Q8;M=e5(d,f,r,a,i,a,S.left,o,S.right,s);break}case`left`:{let n=E?Q8/2:Q8*4,r=E||w?t+n:t-n,i=E?t-n:w?t+n:t-n,a=e+Q8+1,o=w||E?S.right-Q8:S.left,s=w?E?S.right-Q8:S.left:S.right-Q8;M=e5(d,f,o,S.top,s,S.bottom,a,r,a,i);break}case`right`:{let n=E?Q8/2:Q8*4,r=E||w?t+n:t-n,i=E?t-n:w?t+n:t-n,a=e-Q8,o=w||E?S.left+Q8:S.right,s=w?E?S.left+Q8:S.right:S.left+Q8;M=e5(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 r5(e,t,n){let{reference:r,floating:i}=e,a=q0(t),o=J0(t),s=K0(o),c=U0(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=W0(t);return m&&(p[o]+=f*(m===`end`?1:-1)*(n&&l?-1:1)),p}async function Yae(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}=H0(t,e),p=a2(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=o2(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=o2(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 Xae=50,Zae=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:Yae},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=r5(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<Xae&&(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}=r5(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},Qae=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}=H0(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=U0(r),_=q0(o),v=U0(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[r2(o)]:X0(o)),x=p!==`none`;!d&&x&&b.push(...n2(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=Y0(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`||_===q0(t)||T.every(e=>q0(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=q0(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{}}}},i5=new Set([`left`,`top`]);async function $ae(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=U0(n),s=W0(n),c=q0(n)===`y`,l=i5.has(o)?-1:1,u=a&&c?-1:1,d=H0(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 eoe=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 $ae(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}}}}},toe=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}=H0(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=q0(i),p=G0(f),m=u[p],h=u[f],g=(e,t)=>V0(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}}}}}},noe=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}=H0(e,t),u={x:n,y:r},d=q0(i),f=G0(d),p=u[f],m=u[d],h=H0(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=i5.has(U0(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}}}},roe=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}=H0(e,t),c=await i.detectOverflow(t,s),l=U0(n),u=W0(n),d=q0(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=F0(p-c[m],g),y=F0(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*I0(c.left,c.right):S=p-2*I0(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 a5(e){let t=C1(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=u1(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=L0(n)!==a||L0(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function o5(e){return l1(e)?e:e.contextElement}function s5(e){let t=o5(e);if(!u1(t))return z0(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=a5(t),o=(a?L0(n.width):n.width)/r,s=(a?L0(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var ioe=z0(0);function c5(e){let t=o1(e);return!x1()||!t.visualViewport?ioe:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function aoe(e,t,n){return t===void 0&&(t=!1),!!n&&t&&n===o1(e)}function l5(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=o5(e),o=z0(1);t&&(r?l1(r)&&(o=s5(r)):o=s5(e));let s=aoe(a,n,r)?c5(a):z0(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=o1(a),t=l1(r)?o1(r):r,n=e,i=O1(n);for(;i&&t!==n;){let e=s5(i),t=i.getBoundingClientRect(),r=C1(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=o1(i),i=O1(n)}}return o2({width:u,height:d,x:c,y:l})}function u5(e,t){let n=w1(e).scrollLeft;return t?t.left+n:l5(s1(e)).left+n}function d5(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-u5(e,n),y:n.top+t.scrollTop}}function ooe(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=s1(r),s=t?m1(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=z0(1),u=z0(0),d=u1(r);if((d||!a)&&((a1(r)!==`body`||f1(o))&&(c=w1(r)),d)){let e=l5(r);l=s5(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?d5(o,c):z0(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 soe(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function coe(e){let t=w1(e),n=e.ownerDocument.body,r=I0(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),i=I0(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight),a=-t.scrollLeft+u5(e),o=-t.scrollTop;return C1(n).direction===`rtl`&&(a+=I0(e.clientWidth,n.clientWidth)-r),{width:r,height:i,x:a,y:o}}var loe=25;function uoe(e,t,n){n===void 0&&(n=`viewport`);let r=n===`layoutViewport`,i=o1(e),a=s1(e),o=i.visualViewport,s=a.clientWidth,c=a.clientHeight,l=0,u=0;if(o){let e=!x1()||t===`fixed`;r?e||(l=-o.offsetLeft,u=-o.offsetTop):(s=o.width,c=o.height,e&&(l=o.offsetLeft,u=o.offsetTop))}if(u5(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<=loe&&(s-=o)}return{width:s,height:c,x:l,y:u}}function doe(e,t){let n=l5(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=s5(e);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function f5(e,t,n){let r;if(t===`viewport`||t===`layoutViewport`)r=uoe(e,n,t);else if(t===`document`)r=coe(s1(e));else if(l1(t))r=doe(t,n);else{let n=c5(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return o2(r)}function foe(e,t){let n=t.get(e);if(n)return n;let r=D1(e,[],!1).filter(e=>l1(e)&&a1(e)!==`body`),i=null,a=C1(e).position===`fixed`,o=a?T1(e):e;for(;l1(o)&&!S1(o);){let e=C1(o),t=y1(o),n=i?i.position:a?`fixed`:``;!t&&(n===`fixed`||n===`absolute`&&e.position===`static`)?r=r.filter(e=>e!==o):i=e,o=T1(o)}return t.set(e,r),r}function poe(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?m1(t)?[]:foe(t,this._c):[].concat(n),r],o=f5(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=f5(t,a[e],i);s=I0(n.top,s),c=F0(n.right,c),l=F0(n.bottom,l),u=I0(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function moe(e){let{width:t,height:n}=a5(e);return{width:t,height:n}}function hoe(e,t,n){let r=u1(t),i=s1(t),a=n===`fixed`,o=l5(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=z0(0);if((r||!a)&&((a1(t)!==`body`||f1(i))&&(s=w1(t)),r)){let e=l5(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}!r&&i&&(c.x=u5(i));let l=i&&!r&&!a?d5(i,s):z0(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 p5(e){return C1(e).position===`static`}function m5(e,t){if(!u1(e)||C1(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return s1(e)===n&&(n=n.ownerDocument.body),n}function h5(e,t){let n=o1(e);if(m1(e))return n;if(!u1(e)){let t=T1(e);for(;t&&!S1(t);){if(l1(t)&&!p5(t))return t;t=T1(t)}return n}let r=m5(e,t);for(;r&&p1(r)&&p5(r);)r=m5(r,t);return r&&S1(r)&&p5(r)&&!y1(r)?n:r||b1(e)||n}var goe=async function(e){let t=this.getOffsetParent||h5,n=this.getDimensions,r=await n(e.floating);return{reference:hoe(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function _oe(e){return C1(e).direction===`rtl`}var voe={convertOffsetParentRelativeRectToViewportRelativeRect:ooe,getDocumentElement:s1,getClippingRect:poe,getOffsetParent:h5,getElementRects:goe,getClientRects:soe,getDimensions:moe,getScale:s5,isElement:l1,isRTL:_oe};function g5(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function yoe(e,t,n){let r=null,i,a=s1(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=R0(d),h=R0(a.clientWidth-(u+f)),g=R0(a.clientHeight-(d+p)),_=R0(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:I0(0,F0(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(!g5(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=o1(e),l=()=>s(n);return c.addEventListener(`resize`,l),s(!0),()=>{c.removeEventListener(`resize`,l),o()}}function _5(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=o5(e),u=i||a?[...l?D1(l):[],...t?D1(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n),a&&e.addEventListener(`resize`,n)});let d=l&&s?yoe(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?l5(e):null;c&&g();function g(){let t=l5(e);h&&!g5(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 boe=eoe,xoe=toe,Soe=Qae,Coe=roe,woe=noe,Toe=(e,t,n)=>{let r=new Map,i=n??{},a={...voe,...i.platform,_c:r};return Zae(e,t,{...i,platform:a})},v5=typeof document<`u`?K.useLayoutEffect:function(){};function y5(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(!y5(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)&&!y5(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function b5(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function x5(e,t){let n=b5(e);return Math.round(t*n)/n}function S5(e){let t=K.useRef(e);return v5(()=>{t.current=e}),t}function Eoe(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]=K.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=K.useState(r);y5(f,r)||p(r);let[m,h]=K.useState(null),[g,_]=K.useState(null),v=K.useCallback(e=>{e!==S.current&&(S.current=e,h(e))},[]),y=K.useCallback(e=>{e!==C.current&&(C.current=e,_(e))},[]),b=a||m,x=o||g,S=K.useRef(null),C=K.useRef(null),w=K.useRef(u),T=c!=null,E=S5(c),D=S5(i),O=S5(l),k=K.useCallback(()=>{if(!S.current||!C.current)return;let e={placement:t,strategy:n,middleware:f};D.current&&(e.platform=D.current),Toe(S.current,C.current,e).then(e=>{let t={...e,isPositioned:O.current!==!1};A.current&&!y5(w.current,t)&&(w.current=t,j4.flushSync(()=>{d(t)}))})},[f,t,n,D,O]);v5(()=>{l===!1&&w.current.isPositioned&&(w.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let A=K.useRef(!1);v5(()=>(A.current=!0,()=>{A.current=!1}),[]),v5(()=>{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=K.useMemo(()=>({reference:S,floating:C,setReference:v,setFloating:y}),[v,y]),M=K.useMemo(()=>({reference:b,floating:x}),[b,x]),N=K.useMemo(()=>{let e={position:n,left:0,top:0};if(!M.floating)return e;let t=x5(M.floating,u.x),r=x5(M.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...b5(M.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,M.floating,u.x,u.y]);return K.useMemo(()=>({...u,update:k,refs:j,elements:M,floatingStyles:N}),[u,k,j,M,N])}var Doe=(e,t)=>{let n=boe(e);return{name:n.name,fn:n.fn,options:[e,t]}},Ooe=(e,t)=>{let n=xoe(e);return{name:n.name,fn:n.fn,options:[e,t]}},koe=(e,t)=>({fn:woe(e).fn,options:[e,t]}),Aoe=(e,t)=>{let n=Soe(e);return{name:n.name,fn:n.fn,options:[e,t]}},joe=(e,t)=>{let n=Coe(e);return{name:n.name,fn:n.fn,options:[e,t]}},C5=K.createContext(void 0);function Moe(){let e=K.useContext(C5);if(e===void 0)throw Error(i$(26));return e}var w5=new Set([`ArrowUp`,`ArrowDown`,`ArrowLeft`,`ArrowRight`,`Home`,`End`]),Noe=`--nested-dialogs`,Poe=`data-nested-dialog-open`,Foe={...g0,...r0,nestedDialogOpen(e){return e?{[Poe]:``}:null}},Ioe=K.forwardRef(function(e,t){let{render:n,className:r,style:i,finalFocus:a,initialFocus:o,...s}=e,c=Z3(),l=c.useState(`descriptionElementId`),u=c.useState(`disablePointerDismissal`),d=c.useState(`floatingRootContext`),f=c.useState(`popupProps`),p=c.useState(`modal`),m=c.useState(`mounted`),h=c.useState(`nested`),g=c.useState(`nestedOpenDialogCount`),_=c.useState(`open`),v=c.useState(`openMethod`),y=c.useState(`titleElementId`),b=c.useState(`transitionStatus`),x=c.useState(`role`),S=d.useState(`floatingId`);Moe(),f8({open:_,ref:c.context.popupRef,onComplete(){_&&c.context.onOpenChangeComplete?.(!0)}});let C=o===void 0?m8(c.context.popupRef):o,w=g>0,T=c.useStateSetter(`popupElement`),E=P$(`div`,e,{state:{open:_,nested:h,transitionStatus:b,nestedDialogOpen:w},props:[f,{id:S,"aria-labelledby":y,"aria-describedby":l,role:x,...p8,hidden:!m,onKeyDown(e){w5.has(e.key)&&e.stopPropagation()},style:{[Noe]:g}},s],ref:[t,c.context.popupRef,T],stateAttributesMapping:Foe});return(0,X.jsx)(a8,{context:d,openInteractionType:v,disabled:!m,closeOnFocusOut:!u,initialFocus:C,returnFocus:a,modal:p!==!1,restoreFocus:`popup`,children:E})});function T5(e){return m$(19)?e:e?`true`:void 0}var E5=K.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,X.jsx)(`div`,{ref:t,role:`presentation`,"data-base-ui-inert":``,...r,style:{position:`fixed`,inset:0,userSelect:`none`,WebkitUserSelect:`none`,clipPath:i}})}),Loe=K.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e,i=Z3(),a=i.useState(`mounted`),o=i.useState(`modal`),s=i.useState(`open`);return a||n?(0,X.jsx)(C5.Provider,{value:n,children:(0,X.jsxs)(U6,{ref:t,...r,children:[a&&o===!0&&(0,X.jsx)(E5,{ref:i.context.internalBackdropRef,inert:T5(!s)}),e.children]})}):null}),D5={},O5={},k5=``;function A5(e,t){return f1(e)?e:t}function j5(e,t,n){return/hidden|clip/.test(e.getComputedStyle(A5(t,n)).overflowY)}function Roe(e){if(typeof document>`u`)return!1;let t=h2(e);return o1(t).innerWidth-t.documentElement.clientWidth>0}function zoe(e){if(!(typeof CSS<`u`&&CSS.supports&&CSS.supports(`scrollbar-gutter`,`stable`))||typeof document>`u`)return!1;let t=h2(e),n=t.documentElement,r=t.body,i=A5(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 Boe(e){let t=h2(e),n=t.documentElement,r=t.body,i=A5(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 Voe(e){let t=h2(e),n=t.documentElement,r=t.body,i=o1(n),a=0,o=0,s=!1,c=S6.create();if(B1&&(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,D5={scrollbarGutter:n.style.scrollbarGutter,overflowY:n.style.overflowY,overflowX:n.style.overflowX},k5=n.style.scrollBehavior,O5={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=A5(n,r);if(s=zoe(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,D5),Object.assign(r.style,O5),s||(n.scrollTop=a,n.scrollLeft=o,n.removeAttribute(`data-base-ui-scroll-locked`),n.style.scrollBehavior=k5)}function d(){u(),c.request(l)}l();let f=v4(i,`resize`,d);return()=>{c.cancel(),u(),typeof i.removeEventListener==`function`&&f()}}var Hoe=new class{lockCount=0;restore=null;timeoutLock=t$.create();timeoutUnlock=t$.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=h2(e),n=t.documentElement,r=t.body,i=o1(n);if(j5(i,n,r)){let t=new i.MutationObserver(()=>{j5(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=F1||!Roe(e);this.restore=a?Boe(e):Voe(e)}};function M5(e=!0,t=null){Z2(()=>{if(e)return Hoe.acquire(t)},[e,t])}function Uoe({store:e,parentContext:t,isDrawer:n}){let r=e.useState(`open`),i=e.useState(`mounted`),a=e.useState(`disablePointerDismissal`),o=e.useState(`modal`),s=e.useState(`popupElement`),c=e.useState(`floatingRootContext`),[l,u]=K.useState(0),[d,f]=K.useState(0),p=l===0,m=s8(c,{outsidePressEvent(){return e.context.internalBackdropRef.current||e.context.backdropRef.current?`intentional`:{mouse:o===`trap-focus`?`sloppy`:`intentional`,touch:`sloppy`}},outsidePress(t){if(!e.context.outsidePressEnabledRef.current||`button`in t&&t.button!==0)return!1;if(`touches`in t){if(t.type===`touchend`){if(t.changedTouches.length!==1||t.touches.length!==0)return!1}else if(t.touches.length!==1)return!1}let n=K1(t);if(p&&!a){if(o){let t=e.context.internalBackdropRef.current,r=e.context.backdropRef.current;return t||r?t===n||r===n||W1(n,s)&&!n?.hasAttribute(`data-base-ui-portal`):!0}return!0}return!1},escapeKey:p});return M5(r&&o===!0,s),e.useContextCallback(`onNestedDialogOpen`,(t,n)=>{!e.select(`open`)&&!e.select(`mounted`)||(u(t),f(n))}),Z2(()=>{!r&&!i&&(u(0),f(0))},[r,i]),Z2(()=>(t?.onNestedDialogOpen&&r&&t.onNestedDialogOpen(l+1,d+ +!!n),()=>{t?.onNestedDialogOpen&&r&&t.onNestedDialogOpen(0,0)}),[n,r,l,d,t]),C8(e,{activeTriggerProps:m.reference,inactiveTriggerProps:m.trigger,popupProps:m.floating,nestedOpenDialogCount:l,nestedOpenDrawerCount:d}),null}var Woe={...R8,modal:e=>e.modal,nested:e=>e.nested,nestedOpenDialogCount:e=>e.nestedOpenDialogCount,nestedOpenDrawerCount:e=>e.nestedOpenDrawerCount,disablePointerDismissal:e=>e.disablePointerDismissal,openMethod:e=>e.openMethod,descriptionElementId:e=>e.descriptionElementId,titleElementId:e=>e.titleElementId,viewportElement:e=>e.viewportElement,role:e=>e.role},Goe=class extends M8{constructor(e,t,n){let r=new T8,i=Koe(e,r,t,n);super(i,qoe(r),Woe)}setOpen=(e,t)=>{t.preventUnmountOnClose=()=>{this.set(`preventUnmountingOnClose`,!0)},!e&&t.trigger==null&&this.state.activeTriggerId!=null&&(t.trigger=this.state.activeTriggerElement??void 0),this.context.onOpenChange?.(e,t),!t.isCanceled&&(this.state.floatingRootContext.dispatchOpenChange(e,t),this.update(v8(this.state,e,t.trigger)))}};function Koe(e,t,n,r=!1){return{...N8(t,n,r),modal:!0,disablePointerDismissal:!1,viewportElement:null,descriptionElementId:void 0,titleElementId:void 0,openMethod:null,nested:!1,nestedOpenDialogCount:0,nestedOpenDrawerCount:0,role:`dialog`,...e}}function qoe(e){return{popupRef:K.createRef(),backdropRef:K.createRef(),internalBackdropRef:K.createRef(),outsidePressEnabledRef:{current:!0},triggerElements:e,onOpenChange:void 0,onOpenChangeComplete:void 0}}function Joe(e,t){let{children:n,open:r,defaultOpen:i=!1,onOpenChange:a,onOpenChangeComplete:o,disablePointerDismissal:s=!1,modal:c=!0,actionsRef:l,handle:u,triggerId:d,defaultTriggerId:f=null}=t,p=e===`drawer`,m=e===`alert-dialog`,h=m?!0:c,g=m||s,_=m?`alertdialog`:`dialog`,v=Z3(!0),y={modal:h,disablePointerDismissal:g,nested:v!=null,role:_},b=h8((e,t)=>new Goe({open:i,openProp:r,activeTriggerId:f,triggerIdProp:d,...y},e,t),!0);b.useControlledProp(`openProp`,r),b.useControlledProp(`triggerIdProp`,d),b.useSyncedValues(y),b.useContextCallback(`onOpenChange`,a),b.useContextCallback(`onOpenChangeComplete`,o);let x=b.useState(`open`),S=b.useState(`mounted`),C=b.useState(`payload`);w8(b,x),x8(b);let{forceUnmount:w}=S8(x,b);K.useImperativeHandle(l,()=>({unmount:w,close:()=>b.setOpen(!1,i6(m6))}),[w,b]);let T=x||S||u!=null;return(0,X.jsxs)(X3.Provider,{value:b,children:[u&&(0,X.jsx)(g8,{handle:u,store:b}),T&&(0,X.jsx)(Uoe,{store:b,parentContext:v?.context,isDrawer:p}),typeof n==`function`?n({payload:C}):n]})}var Yoe=O8(function(e){return Joe(`dialog`,e)}),Xoe=K.forwardRef(function(e,t){let{render:n,className:r,style:i,id:a,...o}=e,s=Z3(),c=Y$(a);return s.useSyncedValueWithCleanup(`titleElementId`,c),P$(`h2`,e,{ref:t,props:[{id:c},o]})});function Zoe(e){let t=K.useRef(``),n=K.useCallback(n=>{n.defaultPrevented||(t.current=n.pointerType,e(n,n.pointerType))},[e]);return{onClick:K.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 Qoe(e,t){let n=K.useRef(e),r=qQ(t);Z2(()=>{n.current!==e&&r(n.current),n.current=e},[e,r])}function N5(e,t){let{onClick:n,onPointerDown:r}=Zoe(qQ((n,r)=>{(typeof e==`function`?e():e)||t(r||(F1?`touch`:``))}));return K.useMemo(()=>({onClick:n,onPointerDown:r}),[n,r])}function $oe(e){let[t,n]=K.useState(null),r=N5(e,n);return Qoe(e,t=>{t&&!e&&n(null)}),K.useMemo(()=>({openMethod:t,triggerProps:r}),[t,r])}var ese=k8(function(e,t){let{render:n,className:r,style:i,disabled:a=!1,nativeButton:o=!0,id:s,payload:c,handle:l,...u}=e,d=Z3(!0),f=z8(l)??d;if(!f)throw Error(i$(79));let p=Y$(s),m=f.useState(`floatingRootContext`),h=f.useState(`isOpenedByTrigger`,p),g=f.useState(`triggerPopupId`,p),_=K.useRef(null),{registerTrigger:v,isMountedByThisTrigger:y}=b8(p,_,f,{payload:c}),{getButtonProps:b,buttonRef:x}=n6({disabled:a,native:o}),S=o8(m),C=N5(()=>f.select(`open`),e=>{f.set(`openMethod`,e)}),w={disabled:a,open:h},T=f.useState(`triggerProps`,y);return P$(`button`,e,{state:w,ref:[x,t,v,_],props:[S.reference,T,C,{[z6]:``,id:p,"aria-haspopup":`dialog`,"aria-expanded":h,"aria-controls":g},u,b],stateAttributesMapping:m0})}),P5=(0,K.createContext)(null);function F5({children:e,interactionOwner:t=`local`,modal:n=!0,onOpenChange:r,...i}){return(0,X.jsx)(P5.Provider,{value:{interactionOwner:t,modal:n},children:(0,X.jsx)(Yoe,{...i,modal:n,onOpenChange:(e,n)=>{if(t===`host`&&!e&&n.reason===`escape-key`){n.cancel(),n.allowPropagation();return}r?.(e,n)},children:e})})}function I5(){let e=(0,K.useContext)(P5);if(!e)throw Error(`Dialog parts must be used inside <Dialog>`);return e}(0,K.forwardRef)(function({className:e,type:t=`button`,...n},r){return(0,X.jsx)(ese,{...n,className:t=>Z(`btn`,YN(e,t)),ref:r,type:t})});var tse=(0,K.forwardRef)(function({container:e,...t},n){let r=f3(`dialog`);return e==null&&r===null?null:(0,X.jsx)(Loe,{...t,container:e??r,ref:n})}),nse=(0,K.forwardRef)(function({className:e,...t},n){return(0,X.jsx)(Q3,{...t,ref:n,className:t=>Z(`caps-dialog-backdrop fixed inset-0 bg-black/40`,YN(e,t))})}),rse=(0,K.forwardRef)(function({className:e,finalFocus:t,...n},r){let i=I5();return(0,X.jsx)(Ioe,{...n,className:t=>Z(`caps-dialog-popup max-h-screen w-11/12 max-w-(--container-lg) overflow-y-auto overscroll-contain rounded-box bg-base-100 p-lg text-base-content shadow-xl`,YN(e,t)),finalFocus:i.interactionOwner===`host`?!1:t??!0,ref:r})}),L5=(0,K.forwardRef)(function({container:e,keepMounted:t=!0,className:n,...r},i){let{modal:a}=I5();return(0,X.jsxs)(tse,{container:e,keepMounted:t,children:[a===!0?(0,X.jsx)(nse,{}):null,(0,X.jsx)(rse,{...r,className:e=>Z(`fixed left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2`,YN(n,e)),ref:i})]})});function R5({className:e,...t}){return(0,X.jsx)(`div`,{...t,className:Z(`flex justify-end gap-sm`,e)})}function z5({className:e,...t}){return(0,X.jsx)(`div`,{...t,className:Z(`flex flex-col gap-sm`,e)})}var B5=(0,K.forwardRef)(function({className:e,...t},n){return(0,X.jsx)(Xoe,{...t,className:t=>Z(`text-lg font-semibold`,YN(e,t)),ref:n})});(0,K.forwardRef)(function({className:e,...t},n){return(0,X.jsx)(uae,{...t,className:t=>Z(`text-sm text-base-content`,YN(e,t)),ref:n})});var V5=(0,K.forwardRef)(function({className:e,type:t=`button`,...n},r){return(0,X.jsx)(lae,{...n,className:t=>Z(`btn btn-ghost`,YN(e,t)),ref:r,type:t})}),ise=cA({keyCode:uA(229)});function H5(e){return e.nativeEvent.isComposing||ye(ise,e.nativeEvent).success}function ase(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:oP(t,t.easeExit),fill:`backwards`})}function ose(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:oP(t,t.ease),fill:`backwards`})}function U5(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:oP(t,t.ease),fill:`backwards`})}function sse(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:oP(t,`ease-out`)})}var cse=(0,K.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,K.useRef)(null);(0,K.useImperativeHandle)(u,()=>d.current);let f=(0,K.useRef)(e);(0,K.useLayoutEffect)(()=>{let t=d.current,n=f.current;if(f.current=e,!t||n===e||!sP(t))return;let r=t.querySelector(`[data-glyph="arrow"]`),i=t.querySelector(`[data-glyph="busy"]`);if(!r||!i)return;let a=rP(t),o=[];return e===`busy`?o.push(ase(r,a),U5(i,a,1)):n===`busy`&&o.push(U5(i,a,0),ose(r,a)),n===`empty`&&e===`ready`&&!a.reduced&&o.push(sse(t,a)),()=>{for(let e of o)e.cancel()}},[e]);let p=e===`busy`,m=p&&t!==void 0;return(0,X.jsx)(XN,{...l,ref:d,className:Z(`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,X.jsxs)(`span`,{className:`caps-send-glyph`,"data-state":e,children:[(0,X.jsx)(`span`,{"data-glyph":`arrow`,children:(0,X.jsx)(Zie,{"aria-hidden":`true`,size:r})}),(0,X.jsx)(`span`,{"data-glyph":`busy`,children:t===void 0?(0,X.jsx)(EI,{decorative:!0,size:`sm`}):(0,X.jsx)(lL,{"aria-hidden":`true`,fill:`currentColor`,size:Math.round(r*.7)})})]})})}),W5={dot:{y:-4,height:8,cy:0},pill:{y:-16,height:32,cy:0},bang:{y:-16,height:20,cy:12}};function lse({className:e,glyph:t,motion:n}){let r=`caps-status-${(0,K.useId)().replaceAll(`:`,``)}`,i=(0,K.useRef)(null),a=(0,K.useRef)(null),o=(0,K.useRef)(null),s=(0,K.useRef)(null),c=(0,K.useRef)(null),l=(0,K.useRef)(null),u=(0,K.useRef)(W5[t]).current,d=(0,K.useRef)(t===`dot`?1:4).current,f=(0,K.useRef)(+(t===`bang`)).current,p=(0,K.useRef)(t),m=iP(s),{reduced:h}=m;return(0,K.useLayoutEffect)(()=>{if(!i.current||!a.current||!c.current||!l.current)return;let e=W5[t],n=h||p.current===t;p.current=t;let r=rP(i.current),o=n?{duration:0}:T4(r,{bounce:.3,duration:360}),s=pI(i.current,{y:e.y,height:e.height,...o}),u=pI(a.current,{cy:e.cy,...n?{duration:0}:{delay:aP(r,35),...T4(r,{bounce:.3,duration:420})}}),d=pI(c.current,{gradientTransform:`matrix(1 0 0 ${t===`dot`?`1`:`4`} 0 0)`,...o}),f=pI(l.current,{opacity:+(t===`bang`),...n?w4:E4(r,{ease:`inOutSine`,duration:220})});return()=>{s.cancel(),u.cancel(),d.cancel(),f.cancel()}},[t,h]),(0,K.useLayoutEffect)(()=>{if(!o.current||!s.current||h||n===`none`)return;let e=n===`pulse`?pI(o.current,{opacity:[1,.45],...E4(m,{ease:`inOutSine`,duration:750}),alternate:!0,loop:!0}):pI(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}},...E4(m,{ease:`inOutSine`,duration:1e3}),loop:!0}),t=SI(s.current,t=>{t?e.resume():e.pause()});return()=>{t(),e.revert()}},[n,h,m]),(0,X.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,X.jsxs)(`defs`,{children:[(0,X.jsx)(xI,{id:r,values:bI}),(0,X.jsx)(_I,{ref:c,id:`${r}-surface`,transform:`matrix(1 0 0 ${String(d)} 0 0)`}),(0,X.jsxs)(`radialGradient`,{id:`${r}-drop-light`,gradientUnits:`userSpaceOnUse`,cx:`-1.2`,cy:`10.4`,r:`5.6`,children:[(0,X.jsx)(`stop`,{offset:`0`,stopColor:`var(--color-white)`,style:{stopOpacity:`calc(var(--depth) * 0.5)`}}),(0,X.jsx)(`stop`,{offset:`1`,stopColor:`var(--color-white)`,stopOpacity:`0`})]}),(0,X.jsx)(vI,{id:`${r}-shadow`}),(0,X.jsx)(`mask`,{id:`${r}-silhouette`,maskUnits:`userSpaceOnUse`,x:`-12`,y:`-24`,width:`24`,height:`48`,style:{maskType:`alpha`},children:(0,X.jsxs)(`g`,{fill:`var(--color-white)`,filter:`url(#${r})`,children:[(0,X.jsx)(`rect`,{ref:i,x:`-4`,y:u.y,width:`8`,height:u.height,rx:`4`}),(0,X.jsx)(`circle`,{ref:a,cx:`0`,cy:u.cy,r:`4`})]})})]}),(0,X.jsx)(`g`,{ref:o,filter:`url(#${r}-shadow)`,children:(0,X.jsxs)(`g`,{mask:`url(#${r}-silhouette)`,children:[(0,X.jsx)(`rect`,{x:`-12`,y:`-24`,width:`24`,height:`48`,fill:`url(#${r}-surface)`}),(0,X.jsx)(`rect`,{ref:l,x:`-12`,y:`-24`,width:`24`,height:`48`,fill:`url(#${r}-drop-light)`,opacity:f})]})})]})}var use=.28;function G5(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?use: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 K5=7.25;function dse({className:e,glyph:t,progress:n}){let r=`caps-status-mark-${(0,K.useId)().replaceAll(`:`,``)}`,i=(0,K.useRef)(null),a=(0,K.useRef)(null),o=(0,K.useRef)(null),s=(0,K.useRef)(null),c=(0,K.useRef)(null),l=(0,K.useRef)(null),u=(0,K.useRef)(null),d=(0,K.useRef)(null),f=(0,K.useRef)(G5(t,n)).current,p=(0,K.useRef)(t),m=lP();(0,K.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=G5(t,n),y=p.current;p.current=t;let b=rP(e),x=m||y===t&&t!==`arc`,S=x?m?{ease:b.ease,duration:b.fast}:w4:E4(b,{ease:`outQuad`,duration:160}),C=(t===`check`||t===`cross`)&&!x,w=E4(b,{ease:`inOutSine`,duration:220}),T=[pI(r,{opacity:v.dashes,...S}),pI(c,{opacity:v.track*.28,...S}),pI(f,{opacity:v.arc,"stroke-dasharray":`${String(v.sweep)} 1`,...x?m?w4:S:w}),pI(h,{r:v.disc*K5,...C?{delay:w.duration*.7,...T4(b,{bounce:.35,duration:360})}:m?w4:E4(b,{ease:`inCubic`,duration:140})}),pI(g,{"stroke-dashoffset":1-v.tick,...C&&v.tick>0?{delay:w.duration*.7+b.fast,...E4(b,{ease:`outCubic`,duration:240})}:w4}),pI(_,{"stroke-dashoffset":1-v.cross,...C&&v.cross>0?{delay:w.duration*.7+b.fast,...E4(b,{ease:`outCubic`,duration:240})}:w4})];return t===`cross`&&C&&b.shake>0&&T.push(pI(e,{translateX:[0,-b.shake,b.shake,-b.shake/2,0],delay:w.duration+b.fast,...E4(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,K.useLayoutEffect)(()=>{if(!h||!c.current||!i.current)return;let e=rP(i.current),t=pI(c.current,{rotate:[0,360],...E4(e,{ease:`linear`,duration:900}),loop:!0}),n=SI(i.current,e=>{e?t.resume():t.pause()});return()=>{n(),t.revert()}},[h]),(0,X.jsxs)(`svg`,{ref:i,"aria-hidden":`true`,className:`caps-status-mark ${e??``}`,viewBox:`0 0 16 16`,focusable:`false`,children:[(0,X.jsxs)(`defs`,{children:[(0,X.jsx)(_I,{id:`${r}-surface`,transform:`matrix(1.6 0 0 1.6 8 8)`}),(0,X.jsxs)(`mask`,{id:`${r}-knock`,maskUnits:`userSpaceOnUse`,x:`0`,y:`0`,width:`16`,height:`16`,children:[(0,X.jsx)(`rect`,{width:`16`,height:`16`,fill:`var(--color-white)`}),(0,X.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,X.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,X.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,X.jsx)(`circle`,{ref:o,cx:`8`,cy:`8`,r:`6.25`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,opacity:f.track*.28}),(0,X.jsx)(`g`,{ref:c,className:`caps-status-mark-spin`,children:(0,X.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,X.jsx)(`circle`,{ref:l,cx:`8`,cy:`8`,r:f.disc*K5,fill:`url(#${r}-surface)`,mask:`url(#${r}-knock)`})]})}var fse=new Set([`ring`,`arc`,`check`,`cross`]);function pse(e){return fse.has(e)}var q5={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`},J5=(0,K.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,X.jsxs)(`span`,{...c,className:Z(`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:[pse(n)?(0,X.jsx)(dse,{className:q5[i],glyph:n,progress:s}):(0,X.jsx)(lse,{className:q5[i],glyph:n,motion:r}),t===void 0?null:(0,X.jsx)(`span`,{children:t})]})}),mse=(0,K.forwardRef)(function({className:e,label:t,...n},r){return(0,X.jsx)(XN,{...n,ref:r,className:Z(`parakeet-composer-model-key`,e),label:t,readout:(0,X.jsx)(ZI,{"aria-hidden":`true`,className:`size-[var(--stipe-icon-size-sm)] shrink-0`})})}),Y5=(0,K.forwardRef)(function({className:e,...t},n){return(0,X.jsx)(`div`,{...t,ref:n,className:Z(`caps-popover-anchor`,e)})}),X5=(0,K.forwardRef)(function({className:e,open:t,side:n=`top`,...r},i){return t?(0,X.jsx)(`div`,{...r,ref:i,className:Z(`caps-popover`,e),"data-side":n}):null}),hse=(0,K.forwardRef)(function({active:e,className:t,onMouseDown:n,...r},i){return(0,X.jsx)(`div`,{role:`option`,"aria-selected":e,...r,ref:i,className:Z(`caps-popover-option`,t),"data-active":e,onMouseDown:e=>{e.preventDefault(),n?.(e)}})});function Z5({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,K.useId)(),f=(0,K.useRef)(null),p=(0,K.useRef)(null),m=(0,K.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,K.useEffect)(()=>{g&&p.current?.focus()},[g]),(0,K.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,K.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)&&n(null)};return document.addEventListener(`keydown`,e),document.addEventListener(`pointerdown`,t),()=>{document.removeEventListener(`keydown`,e),document.removeEventListener(`pointerdown`,t)}},[g,n]),(0,X.jsxs)(Y5,{...u,ref:f,className:Z(`caps-status-tray`,l),"data-placement":o,"data-align":s,children:[h?(0,X.jsxs)(X5,{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,X.jsxs)(`div`,{className:`caps-status-tray-head`,children:[h.tone?(0,X.jsx)(J5,{size:`compact`,tone:h.tone,glyph:h.glyph??`dot`}):null,(0,X.jsx)(`span`,{id:`${d}-title`,className:`caps-status-tray-title`,children:h.title??h.label}),h.actions,(0,X.jsx)(AI,{"aria-label":`Close tray`,icon:(0,X.jsx)(dL,{"aria-hidden":`true`}),onClick:_})]}),(0,X.jsx)(`div`,{className:`caps-status-tray-body`,children:h.content})]}):null,o===`host`?null:(0,X.jsxs)(`div`,{className:`caps-status-tray-row`,children:[r,(0,X.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,X.jsxs)(X.Fragment,{children:[e.tone?(0,X.jsx)(J5,{size:`compact`,glyph:e.glyph??`dot`,motion:e.motion??`none`,tone:e.tone}):null,(0,X.jsx)(`span`,{className:`caps-status-tray-label`,children:e.label}),e.count!==void 0&&e.count>0?(0,X.jsx)(`span`,{className:`caps-status-tray-count`,children:e.count}):null]})};return(0,X.jsxs)(K.Fragment,{children:[a?a(r):(0,X.jsx)(`button`,{...r}),e.after]},e.id)})}),i]})]})}function gse({children:e,className:t,...n}){return(0,X.jsx)(`div`,{...n,className:Z(`caps-status-tray-list`,t),children:e})}function Q5({icon:e,primary:t,secondary:n,actions:r,className:i,...a}){return(0,X.jsxs)(`div`,{...a,className:Z(`caps-status-tray-item`,i),children:[e?(0,X.jsx)(`span`,{className:`caps-status-tray-icon`,children:e}):null,(0,X.jsxs)(`span`,{className:`caps-status-tray-text`,children:[(0,X.jsx)(`span`,{className:`caps-status-tray-primary`,children:t}),n?(0,X.jsx)(`span`,{className:`caps-status-tray-secondary`,children:n}):null]}),r?(0,X.jsx)(`span`,{className:`caps-status-tray-actions`,children:r}):null]})}function $5({children:e=`All caught up.`,title:t}){return(0,X.jsxs)(`div`,{className:`caps-status-tray-note`,children:[t?(0,X.jsx)(`strong`,{className:`caps-status-tray-note-title`,children:t}):null,(0,X.jsx)(`p`,{children:e})]})}var e7=(0,K.forwardRef)(function({className:e,invalid:t,...n},r){return(0,X.jsx)(`textarea`,{...n,"aria-invalid":t?!0:n[`aria-invalid`]===!1?void 0:n[`aria-invalid`],className:Z(`textarea textarea-bordered w-full`,t&&`textarea-error`,e),ref:r})});function t7(e,t){return`${e}-${String(t)}`}function _se(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 vse(e){return{role:`combobox`,"aria-autocomplete":`list`,"aria-expanded":e.open,"aria-controls":e.open?e.listId:void 0,"aria-activedescendant":e.open?t7(e.listId,e.selected):void 0}}function n7({open:e,rows:t,selected:n,listId:r,label:i,kind:a,hint:o,empty:s,onHighlight:c,onChoose:l}){return(0,X.jsx)(X5,{open:e,side:`top`,"data-parakeet-slash":``,children:(0,X.jsxs)(`div`,{className:`parakeet-slash-menu`,"data-kind":a,children:[o===void 0?null:(0,X.jsx)(`p`,{className:`parakeet-slash-hint`,children:o}),t.length===0?s===void 0?null:(0,X.jsx)(`p`,{className:`parakeet-slash-hint`,children:s}):(0,X.jsx)(`div`,{id:r,role:`listbox`,"aria-label":i,children:t.map((e,t)=>(0,X.jsxs)(hse,{id:t7(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,X.jsx)(`span`,{"aria-hidden":`true`,className:`parakeet-slash-media`,children:e.media}),(0,X.jsx)(`span`,{className:`parakeet-slash-label`,children:e.label}),(0,X.jsx)(`span`,{className:`parakeet-slash-detail`,children:e.detail}),e.keys===void 0||e.keys.length===0?null:(0,X.jsx)(`kbd`,{className:`parakeet-slash-keys`,children:e.keys})]},e.key))})]})})}var r7={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`},yse={blurStdDeviation:.22,alphaSlope:18,alphaIntercept:-8};function bse({state:e}){let t=`caps-checkbox-${(0,K.useId)().replaceAll(`:`,``)}`,n=(0,K.useRef)(null),r=(0,K.useRef)(e).current,i=(0,K.useRef)(e),a=lP();return(0,K.useLayoutEffect)(()=>{if(!n.current)return;let t=e!==`unchecked`,r=i.current!==`unchecked`,o=a||i.current===e;i.current=e;let s=rP(n.current),c=E4(s,{ease:`inCubic`,duration:160}),l=pI(n.current,{d:{to:r7[e],...o?w4:E4(s,{ease:`outCubic`,duration:200})},"stroke-dashoffset":{to:+!t,...o?w4:t?E4(s,{ease:`inOutSine`,duration:260}):c},"stroke-width":o?{to:t?2.4:0,duration:0}:t&&!r?[{to:2.2,...E4(s,{ease:`outCubic`,duration:65})},{to:2.4,delay:aP(s,120),...T4(s,{bounce:.35,duration:220})}]:{to:t?2.4:0,...c}});return()=>{l.cancel()}},[e,a]),(0,X.jsxs)(`svg`,{className:`caps-checkbox-visual`,width:`24`,height:`24`,viewBox:`0 0 12 12`,"aria-hidden":`true`,focusable:`false`,children:[(0,X.jsxs)(`defs`,{children:[(0,X.jsx)(_I,{id:`${t}-surface`,transform:`matrix(1 0 0 1 6 6)`}),(0,X.jsx)(vI,{id:`${t}-shadow`}),(0,X.jsx)(yI,{id:`${t}-inset`}),(0,X.jsx)(xI,{id:`${t}-goo`,values:yse}),(0,X.jsxs)(`filter`,{id:`${t}-relief`,x:`-25%`,y:`-25%`,width:`150%`,height:`150%`,colorInterpolationFilters:`sRGB`,children:[(0,X.jsx)(`feGaussianBlur`,{in:`SourceAlpha`,stdDeviation:`0.28`,result:`relief`}),(0,X.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,X.jsx)(`feDistantLight`,{azimuth:`225`,elevation:`55`})}),(0,X.jsx)(`feComposite`,{in:`light`,in2:`SourceAlpha`,operator:`in`,result:`clipped-light`}),(0,X.jsx)(`feBlend`,{in:`SourceGraphic`,in2:`clipped-light`,mode:`screen`})]}),(0,X.jsx)(`mask`,{id:`${t}-contour`,maskUnits:`userSpaceOnUse`,x:`0`,y:`0`,width:`12`,height:`12`,style:{maskType:`alpha`},children:(0,X.jsx)(`path`,{ref:n,d:r7[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,X.jsx)(`clipPath`,{id:`${t}-well`,children:(0,X.jsx)(`rect`,{x:`1`,y:`1`,width:`10`,height:`10`,rx:`2.5`})})]}),(0,X.jsx)(`rect`,{className:`caps-checkbox-track`,x:`0.5`,y:`0.5`,width:`11`,height:`11`,rx:`3`,filter:`url(#${t}-inset)`}),(0,X.jsx)(`g`,{clipPath:`url(#${t}-well)`,children:(0,X.jsx)(`g`,{filter:`url(#${t}-shadow)`,children:(0,X.jsx)(`g`,{filter:`url(#${t}-relief)`,children:(0,X.jsx)(`g`,{mask:`url(#${t}-contour)`,children:(0,X.jsx)(`rect`,{x:`0`,y:`0`,width:`12`,height:`12`,fill:`url(#${t}-surface)`})})})})})]})}var i7=(0,K.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,K.useRef)(null),[d,f]=(0,K.useState)(o),p=a??d,m=i?`mixed`:p?`checked`:`unchecked`;return(0,K.useImperativeHandle)(l,()=>{if(!u.current)throw Error(`Checkbox input is not mounted`);return u.current},[]),(0,K.useLayoutEffect)(()=>{u.current&&(u.current.indeterminate=i)},[i]),(0,K.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,X.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,X.jsx)(`input`,{...c,checked:p,"aria-checked":i?`mixed`:p,"aria-invalid":r?!0:c[`aria-invalid`]===!1?void 0:c[`aria-invalid`],className:Z(`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,X.jsx)(bse,{state:m}):n]})}),a7=`data-glide-stand-in`;function o7(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 s7(e){return{transform:`translate(${String(e.x)}px, ${String(e.y)}px)`,width:`${String(e.width)}px`,height:`${String(e.height)}px`}}function c7(e){let t=(0,K.useRef)(null);return(0,K.useCallback)(n=>{t.current?.(),t.current=n?xse(n,e):null},[e])}function xse(e,t){if(!sP(e))return()=>void 0;let n=e.ownerDocument,r=e.querySelector(t),i=r?o7(e,r):null,a=null,o=null,s=new Set,c=()=>{for(let e of s)e.removeAttribute(a7);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=rP(e),u=o7(e,t),d=o&&a?o7(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(a7,`measure`);let f=getComputedStyle(t),p=f.backgroundColor,m=f.borderRadius;for(let e of[t,n])e&&(e.setAttribute(a7,``),s.add(e));let h=l();h.hidden=!1,h.style.backgroundColor=p,h.style.borderRadius=m;let g=h.animate([s7(d),s7(u)],{duration:r.normal,easing:oP(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 Sse({getKey:e,isDisabled:t=()=>!1,items:n}){let r=(0,K.useMemo)(()=>{let r=n.map(e);if(r.some(e=>!e))throw Error(`Selectable items require non-empty keys`);if(new Set(r).size!==r.length)throw Error(`Selectable items require unique keys`);return n.filter(e=>!t(e))},[e,t,n]),[i,a]=(0,K.useState)(null);(0,K.useEffect)(()=>{i!==null&&!r.some(t=>e(t)===i)&&a(null)},[i,r,e]);let o=r.find(t=>e(t)===i),s=o?r.findIndex(t=>e(t)===i):-1;return{activeIndex:s,activeItem:o,activeKey:i,enabledItems:r,move:(t,n)=>{if(r.length===0)return;let i=n?n===`start`?0:r.length-1:s<0?t>0?0:r.length-1:(s+t+r.length)%r.length,o=r[i];o&&a(e(o))},setActiveKey:a}}function Cse({controlled:e,default:t,name:n,state:r=`value`}){let{current:i}=K.useRef(e!==void 0),[a,o]=K.useState(()=>t);return[i&&e!==void 0?e:a,K.useCallback(e=>{i||o(e)},[])]}var wse=jM(`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`}}),l7=(0,K.forwardRef)(function({className:e,density:t,featured:n=!1,state:r,variant:i,...a},o){return(0,X.jsx)(`div`,{...a,className:Z(wse({density:t,variant:i}),n&&`caps-card-featured`,e),"data-state":r,ref:o})});(0,K.forwardRef)(function({className:e,density:t,variant:n,width:r=`default`,...i},a){return(0,X.jsx)(`main`,{className:`caps-centered-card-stage`,children:(0,X.jsx)(l7,{...i,className:Z(`caps-centered-card`,r===`wide`&&`caps-centered-card-wide`,e),ref:a,variant:n??`surface`,...t?{density:t}:{}})})}),(0,K.forwardRef)(function({alignment:e=`start`,className:t,...n},r){return(0,X.jsx)(`div`,{...n,className:Z(`caps-card-header`,e===`center`&&`caps-card-header-centered`,t),ref:r})}),(0,K.forwardRef)(function({className:e,level:t=3,...n},r){return(0,X.jsx)(t===2?`h2`:`h3`,{...n,className:Z(`caps-card-title`,e),ref:r})}),(0,K.forwardRef)(function({className:e,...t},n){return(0,X.jsx)(`p`,{...t,className:Z(`caps-card-description`,e),ref:n})}),(0,K.forwardRef)(function({className:e,...t},n){return(0,X.jsx)(`div`,{...t,className:Z(`caps-card-content`,e),ref:n})}),(0,K.forwardRef)(function({className:e,...t},n){return(0,X.jsx)(`div`,{...t,className:Z(`caps-card-footer`,e),ref:n})});var Tse=(0,K.forwardRef)(function({action:e,attachments:t,className:n,input:r,toolbar:i,...a},o){return(0,X.jsxs)(`div`,{...a,ref:o,className:Z(`caps-composer`,n),children:[t===void 0?null:(0,X.jsx)(`div`,{className:`caps-composer-attachments`,children:t}),(0,X.jsx)(`div`,{className:`caps-composer-input`,children:r}),i===void 0&&e===void 0?null:(0,X.jsxs)(`div`,{className:`caps-composer-bar`,children:[(0,X.jsx)(`div`,{className:`caps-composer-toolbar`,children:i}),e]})]})});function Ese({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 Dse({attachments:e,action:t,children:n,className:r,input:i,menu:a,row:o,...s}){return(0,X.jsxs)(Y5,{className:`parakeet-composer-anchor`,children:[a,(0,X.jsxs)(l7,{...s,className:Z(`parakeet-composer-shell`,r),children:[(0,X.jsx)(Tse,{action:t,attachments:e,input:i,toolbar:o===void 0?void 0:(0,X.jsx)(Z5,{className:`parakeet-composer-row`,align:`start`,items:o.items,openId:o.openId,onOpenChange:o.onOpenChange,renderTrigger:({children:e,...t})=>(0,X.jsx)(XN,{...t,label:e,expanded:t[`aria-expanded`]===!0}),leading:o.controls,trailing:(0,X.jsxs)(`span`,{className:`parakeet-composer-trailing`,children:[o.status,o.readout==null?null:(0,X.jsx)(`span`,{className:`parakeet-composer-readout`,children:o.readout}),(0,X.jsx)(`span`,{className:`parakeet-composer-action`,children:o.action})]})})}),n]})]})}function Ose(e,t){(0,K.useLayoutEffect)(()=>{let t=e.current;t&&(t.style.height=`auto`,t.style.height=`${String(t.scrollHeight)}px`)},[e,t])}var u7=K.createContext(void 0);function kse(e){let t=K.useContext(u7);if(t===void 0&&!e)throw Error(i$(33));return t}var d7=K.createContext(void 0);function f7(e){let t=K.useContext(d7);if(t===void 0&&!e)throw Error(i$(36));return t}var Ase=K.createContext(void 0);function p7(e=!0){let t=K.useContext(Ase);if(t===void 0&&!e)throw Error(i$(25));return t}var m7=K.createContext(null);function h7(e=`root`){let t=K.useContext(m7),n=K.useContext(d7);return t===null||n===void 0?null:(e===`submenu-trigger`?n.virtualFocus||n.parentVirtualFocus:n.virtualFocus)?t:null}var jse={visible:!0,ref:null};function Mse(){return jse}function g7(e,t,n=`root`){let r=h7(n),i=((n===`submenu-trigger`?r?.useSubmenuTrigger:r?.useItem)??Mse)({label:e.label,children:e.children,render:e.render}),a=s$(t,i.ref);return{visible:i.visible,ref:a,props:i.props}}var _7=K.createContext(void 0);function Nse(){let e=K.useContext(_7);if(e===void 0)throw Error(i$(30));return e}function Pse(e){e.preventDefault()}function Fse(e){let{closeOnClick:t,highlighted:n,id:r,nodeId:i,store:a,typingRef:o,itemRef:s,itemMetadata:c}=e,l=f7(),u=p7(!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 K.useMemo(()=>({id:r,role:`menuitem`,tabIndex:_,"aria-selected":p,onMouseDown:f?Pse: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:l6})},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&&!R1&&e.button===2)return}s.current&&a.context.allowMouseUpTriggerRef.current&&(!g||e.button===2)&&c.type===`regular-item`&&t6(s.current,e,{detail:1,pointerType:`mouse`})}}),[t,_,r,m,i,a.context.allowMouseUpTriggerRef,o,s,u,g,c.type,p,f])}var v7={type:`regular-item`};function y7(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=K.useRef(null),{getButtonProps:d,buttonRef:f}=n6({disabled:n,focusableWhenDisabled:!0,native:s,composite:!0}),p=Fse({closeOnClick:t,highlighted:r,id:i,nodeId:l,store:a,typingRef:o,itemRef:u,itemMetadata:c}),m=K.useCallback(e=>x$(p,{onMouseEnter(e){c.type===`submenu-trigger`&&c.setActive(e.nativeEvent)}},e,d),[p,d,c]),h=s$(u,f);return K.useMemo(()=>({getItemProps:m,itemRef:h}),[m,h])}var b7=K.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},nextIndexRef:{current:0}});function Ise(){return K.useContext(b7)}function x7(e={}){let{guess:t,label:n,metadata:r,textRef:i,index:a}=e,{register:o,unregister:s,subscribeMapChange:c,nextIndexRef:l}=Ise(),u=K.useRef(-1),[d,f]=K.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=K.useRef(null),h=K.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 Z2(()=>{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 Lse=`data-checked`,Rse=`data-unchecked`,S7={checked(e){return e?{[Lse]:``}:{[Rse]:``}},...r0},zse=K.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}=f7(),m=x7({guess:!0,label:a}),h=Y$(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}=y7({closeOnClick:c,disabled:b,highlighted:_,id:h,store:p,nativeButton:o,nodeId:v,itemMetadata:v7}),C=K.useMemo(()=>({disabled:b,highlighted:_,checked:l}),[b,_,l]);function w(e){let t=i6(l6,e.nativeEvent,void 0,{preventUnmountOnClose:XQ});u?.(!l,t)}let T=P$(`div`,e,{state:C,stateAttributesMapping:S7,props:[y,{role:`menuitemcheckbox`,"aria-checked":l,onClick:w},f,x],ref:[S,t,m.ref]});return(0,X.jsx)(_7.Provider,{value:C,children:T})}),Bse=K.forwardRef(function(e,t){let{checked:n,defaultChecked:r,onCheckedChange:i,...a}=e,[o,s]=Cse({controlled:n,default:r??!1,name:`MenuCheckboxItem`,state:`checked`}),c=g7(e,t);function l(e,t){i?.(e,t),t.isCanceled||s(e)}return c.visible?(0,X.jsx)(zse,{...a,checked:o,onCheckedChange:l,ref:c.ref}):null}),Vse=K.forwardRef(function(e,t){let{render:n,className:r,style:i,keepMounted:a=!1,...o}=e,s=Nse(),c=K.useRef(null),{transitionStatus:l,mounted:u,setMounted:d}=l8(s.checked);return f8({batch:!0,enabled:!s.checked,open:s.checked,ref:c,onComplete(){s.checked||d(!1)}}),P$(`span`,e,{state:{checked:s.checked,disabled:s.disabled,highlighted:s.highlighted,transitionStatus:l},ref:[t,c],stateAttributesMapping:S7,props:{"aria-hidden":!0,...o},enabled:a||u})}),Hse=K.createContext(void 0);function Use(){let e=K.useContext(Hse);if(e===void 0)throw Error(i$(31));return e}var Wse=K.forwardRef(function(e,t){let{render:n,className:r,style:i,id:a,...o}=e,s=Y$(a),c=Use();return Z2(()=>(c(s),()=>{c(e=>e===s?void 0:e)}),[c,s]),P$(`div`,e,{ref:t,props:{id:s,"aria-hidden":!0,...o}})}),Gse=K.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}=f7(),f=x7({guess:!0,label:a}),p=Y$(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}=y7({closeOnClick:c,disabled:v,highlighted:h,id:p,store:d,nativeButton:o,nodeId:g,itemMetadata:v7});return P$(`div`,e,{state:{disabled:v,highlighted:h},props:[_,u,y],ref:[b,t,f.ref]})}),Kse=K.forwardRef(function(e,t){let n=g7(e,t);return n.visible?(0,X.jsx)(Gse,{...e,ref:n.ref}):null}),qse=K.createContext(void 0);function C7(e){let t=K.useContext(qse);if(t===void 0&&!e)throw Error(i$(69));return t}function w7(e){return e===`starting`?gae:QQ}var Jse=K.createContext(void 0);function Yse(){return K.useContext(Jse)}function Xse(e,t){let n=R$(e.render);if(K.isValidElement(n)){let e=n.props;if(Object.hasOwn(e,`id`))return e.id??``}return e.id??t}function Zse(e,t,n){let r=Xse(e,t),i=r===t?void 0:r;return[r,K.useCallback(e=>n?.(e?i:void 0),[i,n])]}function Qse(e,t,n){let r=R$(e.render),i=K.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 $se=K.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}=f7(),m=Yse(),{side:h,align:g}=kse(),_=C7(!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]=Zse(e,u,d),L=Qse(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),f8({open:v,ref:l.context.popupRef,onComplete(){v&&l.context.onOpenChangeComplete?.(!0)}}),K.useEffect(()=>{function e(e){l.setOpen(!1,i6(e.reason,e.domEvent))}return O.events.on(`close`,e),()=>{O.events.off(`close`,e)}},[O.events,l]),G8(D,{enabled:A&&!j&&!z&&w.type!==`menubar`,closeDelay:k});let B=l.useStateSetter(`popupElement`),{parentVirtualFocusRef:V,handleFocus:te}=(K.useContext(m7)?.useParentHandoff??tce)(l,w,v,f),ne=P$(`div`,e,{state:{transitionStatus:y,side:h,align:g,open:v,nested:w.type===`menu`,instant:S},ref:[t,l.context.popupRef,B,I],stateAttributesMapping:_0,props:[b,{id:F,...P?{role:`presentation`}:{role:`menu`,"aria-orientation":p===`horizontal`?`horizontal`:void 0,"aria-labelledby":L},onKeyDown(e){R?.onPopupKeyDown?.(e),_&&w5.has(e.key)&&e.stopPropagation()},onFocus:te},w7(y),c,{"data-rootownerid":E}]}),H=w.type===void 0||z;(C||w.type===`menubar`&&T!==`outside-press`)&&(H=!0);let U=R?.getReturnElement??V;return(0,X.jsx)(a8,{context:D,openInteractionType:M,modal:z,disabled:!x,returnFocus:a??U??H,explicitReturnFocus:a===void 0&&U?!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:ne})}),ece={parentVirtualFocusRef:void 0,handleFocus:void 0};function tce(){return ece}var nce=K.forwardRef(function(e,t){let n=h7()?.Popup??$se;return(0,X.jsx)(n,{...e,ref:t})}),T7=K.createContext(void 0);function rce(){let e=K.useContext(T7);if(e===void 0)throw Error(i$(32));return e}var ice=K.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e,{store:i,parent:a}=f7();if(!(i.useState(`mounted`)||n))return null;let o=a.type===`menu`||a.type===`menubar`?`group`:void 0;return(0,X.jsx)(T7.Provider,{value:n,children:(0,X.jsx)(U6,{ref:t,...r,portalOwnerRole:o})})});function ace(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]=K.useState(null),d=K.useRef(null),f=Y6(n),p=K.useMemo(()=>({reference:i,floating:a,domReference:o}),[i,a,o]),m=Eoe({...e,elements:{...p,...l&&{reference:l}}}),h=K.useCallback(e=>{let t=l1(e)?{getBoundingClientRect:()=>e.getBoundingClientRect(),getClientRects:()=>e.getClientRects(),contextElement:e}:e;u(t),m.refs.setReference(t)},[m.refs]),g=K.useMemo(()=>({...m.refs,setPositionReference:h,domReference:d}),[m.refs,h]),_=K.useMemo(()=>({...m.elements,domReference:o}),[m.elements,o]),v=K.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 Z2(()=>{o&&(d.current=o)},[o]),Z2(()=>{r.context.dataRef.current.floatingContext=v;let e=f?.nodesRef.current.find(e=>e.id===t);e&&(e.context=v)}),K.useMemo(()=>({...m,context:v,refs:g,elements:_,rootStore:r}),[m,g,_,v,r])}var oce=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}=H0(e,t)||{};if(l==null)return{};let d=a2(u),f={x:n,y:r},p=J0(i),m=K0(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=V0(D,k,O),j=!c.arrow&&W0(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}}}),sce=(e,t)=>{let{name:n,fn:r}=oce(e);return{name:n,fn:r,options:[e,t]}},cce={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}}}},lce={sideX:`left`,sideY:`top`},uce=`--available-width`,dce=`--available-height`,fce=`--anchor-width`,pce=`--anchor-height`,mce=`--transform-origin`,E7=uce,D7=dce;function O7(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 k7(e,t,n){let{rects:r,placement:i}=e;return{side:O7(t,U0(i),n),align:W0(i)||`center`,anchor:{width:r.reference.width,height:r.reference.height},positioner:{width:r.floating.width,height:r.floating.height}}}function A7(e){return hce(e,ace)}function hce(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=qQ(O),A=O?k:n,j=y6(n),M=y6(g),N=n4()===`rtl`,[P,F]=K.useState(null);!g&&P!==null&&F(null);let I=x===`placement`,L=P?U0(P):null,R=P&&I?W0(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,B=ee===`center`?z:`${z}-${ee}`,V=l;typeof V==`number`?V={top:V,right:V,bottom:V,left:V}:V&&={top:V.top||0,right:V.right||0,bottom:V.bottom||0,left:V.left||0};let te=+(i===`bottom`),ne=+(i===`top`),H=+(i===`right`),U=+(i===`left`),re={boundary:c===`clipping-ancestors`?`clippingAncestors`:c,padding:V},ie=K.useRef(null),ae=y6(a),oe=y6(s),se=typeof a==`function`?0:a,W=typeof s==`function`?0:s,G=[];p&&G.push(p),G.push(Doe(e=>{let t=k7(e,i,N),n=typeof ae.current==`function`?ae.current(t):ae.current,r=typeof oe.current==`function`?oe.current(t):oe.current;return{mainAxis:n,crossAxis:r,alignmentAxis:r}},[se,W,N,i]));let ce=w===`none`&&C!==`shift`,le=!ce&&(u||E||C===`shift`),ue=C===`none`?null:Aoe({...re,padding:{top:V.top+1+te,right:V.right+1+U,bottom:V.bottom+1+ne,left:V.left+1+H},mainAxis:!E&&C===`flip`,crossAxis:w===`flip`&&`alignment`,fallbackAxisSideDirection:T}),de=ce?null:Ooe({...re,rootBoundary:D,mainAxis:w!==`none`,crossAxis:le,limiter:u||E?void 0:koe(e=>{if(!ie.current)return{};let{width:t,height:n}=ie.current.getBoundingClientRect(),r=q0(U0(e.placement)),i=r===`y`?t:n,a=r===`y`?V.left+V.right:V.top+V.bottom;return{offset:i/2+a/2}})},[re,u,E,D,V,w]);C===`shift`||w===`shift`||ee===`center`?G.push(de,ue):G.push(ue,de),G.push(joe({...re,apply({elements:{floating:e},availableWidth:t,availableHeight:n,rects:r}){if(!M.current)return;let i=e.style;i.setProperty(E7,`${t}px`),i.setProperty(D7,`${n}px`);let a=o1(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(fce,`${u}px`),i.setProperty(pce,`${d}px`)}}),sce(e=>({element:ie.current||h2(e.elements.floating).createElement(`div`),padding:ie.current?d:0}),[d]),{name:`transformOrigin`,fn(e){let{elements:{floating:t},middlewareData:n,placement:r,platform:o,rects:s,y:c}=e,l=U0(r),u=W0(r),d=q0(l)===`y`,f=ie.current,p=typeof a==`function`?a(k7(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 le&&d&&Math.abs(n.shift?.y||0)>p&&(h=`${s.reference.y+s.reference.height/2-c}px`),t.style.setProperty(mce,d?`${m} ${h}`:`${h} ${m}`),{}}},cce,b),Z2(()=>{!g&&h&&h.update({referenceElement:null,floatingElement:null,domReferenceElement:null,positionReference:null})},[g,h]);let fe=K.useMemo(()=>({ancestorScroll:!f,elementResize:!f&&typeof ResizeObserver<`u`,layoutShift:!f&&typeof IntersectionObserver<`u`}),[f]),{refs:pe,elements:me,x:he,y:ge,middlewareData:_e,update:ve,placement:ye,context:be,isPositioned:xe,floatingStyles:Se}=t({rootContext:h,open:m?g:void 0,placement:B,middleware:G,strategy:r,whileElementsMounted:m?void 0:(...e)=>_5(...e,fe),nodeId:y,externalTree:S}),{sideX:Ce,sideY:we}=_e.adaptiveOrigin||lce,Te=xe?r:`fixed`,Ee=K.useMemo(()=>{let e;return e=xe?b?{position:Te,[Ce]:he,[we]:ge}:{...Se,position:Te}:{position:Te,top:0,left:0},e[E7]=`100vw`,e[D7]=`100vh`,xe||(e.opacity=0),e},[b,Te,Ce,he,we,ge,Se,xe]),De=K.useRef(null);Z2(()=>{if(!g)return;let e=j.current,t=typeof e==`function`?e():e,n=(j7(t)?t.current:t)||null;n!==De.current&&(pe.setPositionReference(n),De.current=n)},[g,pe,A,j]),K.useEffect(()=>{if(!g)return;let e=j.current;typeof e!=`function`&&j7(e)&&e.current!==De.current&&(pe.setPositionReference(e.current),De.current=e.current)},[g,pe,A,j]),K.useEffect(()=>{if(m&&g&&me.reference&&me.floating)return _5(me.reference,me.floating,ve,fe)},[m,g,me,ve,fe]);let Oe=U0(ye),ke=O7(i,Oe,N),Ae=W0(ye)||`center`,je=!!_e.hide?.referenceHidden;Z2(()=>{x&&g&&xe&&(Oe!==z||I&&Ae!==ee)&&F(ye)},[x,I,g,xe,ye,Oe,Ae,z,ee]);let Me=K.useMemo(()=>({position:`absolute`,top:_e.arrow?.y,left:_e.arrow?.x}),[_e.arrow]),Ne=_e.arrow?.centerOffset!==0;return K.useMemo(()=>({positionerStyles:Ee,arrowStyles:Me,arrowRef:ie,arrowUncentered:Ne,side:ke,align:Ae,physicalSide:Oe,anchorHidden:je,refs:pe,context:be,isPositioned:xe,update:ve}),[Ee,Me,ie,Ne,ke,Ae,Oe,je,pe,be,xe,ve])}function j7(e){return e!=null&&`current`in e}function gce(e){let{children:t,elementsRef:n,labelsRef:r,onMapChange:i}=e,a=qQ(i),[,o]=K.useState(0),s=WQ(vce).current,c=WQ(_ce).current,l=K.useRef(0),u=K.useRef(!0),d=K.useRef(null),f=K.useRef(null),p=qQ(()=>{u.current||(u.current=!0,o(e=>e+1))}),m=qQ((e,t)=>{c.set(e,t),p()}),h=qQ(e=>{c.delete(e),p()}),g=qQ(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(!xce(n))return;let r=null;for(let n of e)if(n.isConnected){if(r&&M7(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=bce(e[t-1],e[t]);r&&n.add(r)}n.forEach(e=>t.observe(e,{childList:!0}))}let v=qQ(()=>{let[e,t]=yce(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))});Z2(()=>(!u.current&&d.current&&g(d.current),()=>{n.current=[],r&&(r.current=[])}),[n,r,g]),Z2(()=>{u.current&&v()}),Z2(()=>()=>{f.current?.disconnect(),u.current=!0},[]);let y=qQ(e=>(s.add(e),()=>{s.delete(e)})),b=K.useMemo(()=>({register:m,unregister:h,subscribeMapChange:y,nextIndexRef:l}),[m,h,y,l]);return(0,X.jsx)(b7.Provider,{value:b,children:t})}function _ce(){return new Map}function vce(){return new Set}function yce(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)=>M7(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 bce(e,t){let n=e.parentElement;for(;n&&!n.contains(t);)n=n.parentElement;return n}function xce(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 M7(e,t){return e.nextElementSibling===t?-1:t.nextElementSibling===e?1:e.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1}function N7(e){let{store:t,domReference:n,positionerElement:r,open:i}=e,a=K.useRef(null),o=K.useRef(null),s=d8(r);Z2(()=>{i||(o.current?.abort(),o.current=null,t.state.instantType===`trigger-change`&&t.set(`instantType`,void 0))},[i,t]),Z2(()=>{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 P7(e,t,{styles:n,transitionStatus:r,props:i,refs:a,hidden:o,inert:s=!1}){let c={...n};return s&&(c.pointerEvents=`none`),P$(`div`,e,{state:t,ref:a,props:[{role:`presentation`,hidden:o,style:c},w7(r),i],stateAttributesMapping:g0})}var Sce=20;function F7(e,t,n,r){let[i,a]=K.useState(!1);Z2(()=>{if(!e||!t||n==null){a(!1);return}let r=h2(n).documentElement.clientWidth,i=n.offsetWidth;a(r>0&&i>0&&i>=r-Sce)},[e,t,n]),M5(e&&(!t||i),r)}var Cce=K.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=_ae,style:g,..._}=e,{store:v,virtualFocus:y,syncHighlightedItem:b}=f7(),x=rce(),S=p7(!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,B=l,V=s,te=h;C.type===`context-menu`&&(z=n??C.context?.anchor,V??=`start`,!o&&V!==`center`&&(B=e.alignOffset??2,ee=e.sideOffset??-5));let ne=o,H=V;C.type===`menu`?(ne??=`inline-end`,H??=`start`,te=e.collisionAvoidance??B6):C.type===`menubar`&&(ne??=C.context.orientation===`vertical`?`inline-end`:`bottom`,H??=`start`);let U=C.type===`context-menu`,re=A7({anchor:z,floatingRootContext:w,positionMethod:S?`fixed`:r,mounted:E,side:ne,sideOffset:ee,align:H,alignOffset:B,arrowPadding:U?0:f,collisionBoundary:u,collisionPadding:d,sticky:p,nodeId:I,keepMounted:x,disableAnchorTracking:m,collisionAvoidance:te,shift:U?{crossAxis:!(`side`in te&&te.side===`flip`),rootBoundary:`layoutViewport`}:void 0,externalTree:T,adaptiveOrigin:P,lazyFlip:y?`placement`:!1});K.useEffect(()=>{function e(e){e.open&&(e.parentNodeId===I&&v.set(`hoverEnabled`,!1),e.nodeId!==I&&e.parentNodeId===v.select(`floatingParentNodeId`)&&v.setOpen(!1,i6(p6)))}return T.events.on(`menuopenchange`,e),()=>{T.events.off(`menuopenchange`,e)}},[v,T.events,I]),K.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,i6(t))}return T.events.on(`menuopenchange`,e),()=>{T.events.off(`menuopenchange`,e)}},[T.events,v]);let ie=n$();K.useEffect(()=>{D||ie.clear()},[D,ie]),K.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?ie.isStarted()||ie.start(e,()=>{v.setOpen(!1,i6(p6))}):v.setOpen(!1,i6(p6))}else ie.clear()}}return T.events.on(`itemhover`,e),()=>{T.events.off(`itemhover`,e)}},[T.events,D,A,v,ie]),K.useEffect(()=>{let e={open:D,nodeId:I,parentNodeId:L,reason:v.select(`lastOpenChangeReason`)};T.events.emit(`menuopenchange`,e)},[T.events,D,v,I,L]),N7({store:v,domReference:R,positionerElement:M,open:D});let ae={open:D,side:re.side,align:re.align,anchorHidden:re.anchorHidden,nested:C.type===`menu`,instant:N},oe=C.type===`menubar`&&C.context.modal;F7(D&&(oe||O&&F!==`trigger-hover`),k===`touch`,M,A);let se=P7(e,ae,{styles:re.positionerStyles,transitionStatus:j,props:_,refs:[t,v.useStateSetter(`positionerElement`)],hidden:!E,inert:!D}),W=E&&C.type!==`menu`&&(C.type!==`menubar`&&O&&F!==`trigger-hover`||C.type===`menubar`&&C.context.modal),G=null;return C.type===`menubar`?G=C.context.contentElement:C.type===void 0&&(G=A),(0,X.jsxs)(u7.Provider,{value:re,children:[W&&(0,X.jsx)(E5,{ref:C.type===`context-menu`||C.type===`nested-context-menu`?C.context.internalBackdropRef:null,inert:T5(!D),cutout:G}),(0,X.jsx)(Z6,{id:I,children:(0,X.jsx)(gce,{elementsRef:v.context.itemDomElements,labelsRef:v.context.itemLabels,onMapChange:b,children:se})})]})}),wce=K.createContext(null);function I7(e){let t=K.useContext(wce);if(t===null&&!e)throw Error(i$(5));return t}function Tce(e){return e==null?a6:e.type.startsWith(`key`)?f6:e.type.startsWith(`mouse`)||e.type.startsWith(`pointer`)?sae:a6}var Ece={...R8,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=R8.triggerPopupId(e,t);return n?e.listElement?.id||n:void 0},filterTriggerProps:e=>e.filterTriggerProps,inputProps:e=>e.inputProps,webkitAriaSelected:(e,t)=>B1&&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`&&!R8.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`)}},Dce=class extends M8{constructor(e,t,n=!1){let r=new T8,i=kce(r,t,n,e);super(i,Oce(r),Ece),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 Oce(e){return{positionerRef:K.createRef(),popupRef:K.createRef(),typingRef:{current:!1},itemDomElements:{current:[]},itemLabels:{current:[]},highlightReason:`none`,highlightEvent:void 0,reportedItem:void 0,allowMouseUpTriggerRef:{current:!1},virtualFocusRef:void 0,triggerFocusTargetRef:K.createRef(),beforeTriggerFocusGuardRef:K.createRef(),beforeContentFocusGuardRef:K.createRef(),onOpenChangeComplete:void 0,triggerElements:e}}function kce(e,t,n=!1,r){return{...N8(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:QQ,inputProps:QQ,inputFocused:!1,highlightedItem:void 0,hoverEnabled:!0,instantType:void 0,openChangeReason:null,floatingTreeRoot:new G6,floatingNodeId:void 0,floatingParentNodeId:null,itemProps:QQ,keyboardEventRelay:void 0,closeDelay:0,adaptiveOrigin:void 0,...r}}var L7=K.createContext(null);function R7(e,t){return(e===`trigger-press`||e===`item-press`)&&t?.detail===0}function Ace(e,t){return e===`list-navigation`||R7(e,t)}var jce=O8(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=p7(!0),C=f7(!0),w=I7(!0),T=C?.store,E=C?.virtualFocus??!1,D=K.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=Y$(),k=Y$(),[A,j]=K.useState(void 0),M=(A??k)||void 0,N=J6(),P=D.type===`menu`?D.store:void 0,F=(n??o)&&P?.state.transitionStatus===`starting`,I=WQ(()=>F?P?.state.instantType:void 0).current,L=WQ(()=>{let e=new Dce({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=X6(R),ee=L.useState(`open`),B=L.useState(`activeTriggerElement`),V=L.useState(`positionerElement`),te=L.useState(`hoverEnabled`),ne=L.useState(`disabled`),H=L.useState(`lastOpenChangeReason`),U=L.useState(`parent`),re=L.useState(`activeIndex`),ie=L.useState(`keyboardOpen`),ae=L.useState(`payload`),oe=L.useState(`floatingParentNodeId`),se=K.useRef(null),W=K.useRef(U.type!==`context-menu`),G=n$(),ce=K.useRef(!0),le=n$(),ue=oe!=null,{openMethod:de,triggerProps:fe}=$oe(ee);L.useSyncedValues({disabled:s,highlightItemOnHover:g,modal:U.type===void 0?c:void 0,openMethod:de,rootId:O}),x8(L);let{forceUnmount:pe,transitionStatus:me}=S8(ee,L,()=>{L.set(`allowMouseEnter`,!1)},F),he=d8(L.context.popupRef);K.useEffect(()=>{if(I===void 0)return;let e=()=>{L.state.instantType===I&&L.set(`instantType`,void 0)};if(!ee){e();return}if(me!==void 0)return;if(L.context.popupRef.current==null){e();return}let t=new AbortController;return he(e,t.signal),()=>{t.abort()}},[I,ee,me,he,L]),Z2(()=>{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,B,L]),K.useEffect(()=>{if(ee||(se.current=null),U.type===`context-menu`){if(!ee){G.clear(),W.current=!1;return}G.start(500,()=>{W.current=!0})}},[G,ee,U.type]),Z2(()=>{!ee&&!te&&L.set(`hoverEnabled`,!0)},[ee,te,L]);let ge=qQ((e,t)=>{let n=t.reason;if(!e&&!L.select(`open`)||ee===e&&t.trigger===B&&H===n)return;let i=y8(t);if(!e&&t.trigger==null&&(t.trigger=B??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`&&!ce.current)return;e&&n===`trigger-focus`?(ce.current=!1,le.start(300,()=>{ce.current=!0})):(ce.current=!0,le.clear());let o=!e&&(n===`escape-key`||n==null);se.current=t.event;let s=v8(L.state,e,t.trigger,i());s.openChangeReason=n,s.keyboardOpen=e&&Ace(n,a),s.instantType=U.type===`menubar`&&(n===`trigger-focus`||n===`focus-out`||n===`trigger-hover`||n===`list-navigation`||n===`sibling-open`)?`group`:R7(n,a)?`click`:o?`dismiss`:void 0,L.update(s)}),_e=c8({popupStore:L,floatingRootContext:L.state.floatingRootContext,floatingId:M,nested:N!=null,onOpenChange:ge}),ve=_e.context.events;Z2(()=>{let e=({open:e,eventDetails:t})=>ge(e,t);return ve.on(`setOpen`,e),()=>{ve?.off(`setOpen`,e)}},[ve,ge]),Z2(()=>L.subscribeToParentMenu(),[L]);let ye=K.useCallback(()=>{L.setOpen(!1,i6(m6))},[L]);K.useImperativeHandle(d,()=>({unmount:pe,close:ye}),[pe,ye]);let be;U.type===`context-menu`&&(be=U.context),K.useImperativeHandle(be?.positionerRef,()=>V,[V]),K.useImperativeHandle(be?.actionsRef,()=>({setOpen:ge}),[ge]);let xe=s8(_e,{enabled:!ne,bubbles:{escapeKey:f&&U.type===`menu`},outsidePress(){return U.type!==`context-menu`||se.current?.type===`contextmenu`||W.current},externalTree:ue?R:void 0}),Se=n4(),Ce=Gae(_e,{enabled:!ne,listRef:L.context.itemDomElements,activeIndex:re,virtual:v,nested:U.type===`menubar`||!v&&U.type!==void 0,parentOrientation:U.type===`menubar`?U.context.orientation:void 0,loopFocus:l,focusItemOnOpen:v?ie:void 0,allowEscape:v&&l&&b,orientation:u,triggerOrientation:v?`vertical`:u,rtl:Se===`rtl`,disabledIndices:ZQ,onNavigate(e,t){L.setActiveIndex(e,Tce(t),t?.nativeEvent)},openOnArrowKeyDown:U.type!==`context-menu`&&!(v&&_),externalTree:!v&&ue?R:void 0,nestedReturnFocusRef:P?.context.virtualFocusRef,focusItemOnHover:g,resetOnPointerLeave:x}),we=K.useCallback(e=>{L.context.typingRef.current=e},[L]),Te=Kae(_e,{enabled:!ne&&!v,listRef:L.context.itemLabels,elementsRef:L.context.itemDomElements,activeIndex:re,resetMs:500,onMatch:(e,t)=>{ee&&e!==re&&L.setActiveIndex(e,f6,t.nativeEvent)},onTyping:we}),Ee=qQ(a),De=K.useRef(-1),Oe=qQ(()=>{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(De.current===n&&L.context.reportedItem===t)return;De.current=n,L.context.reportedItem=t,v&&L.set(`highlightedItem`,t);let{highlightReason:r,highlightEvent:i}=L.context;L.context.highlightReason=a6,L.context.highlightEvent=void 0,a&&Ee(t,rae(r,i,{label:t===void 0?void 0:L.context.itemLabels.current[n]??void 0}))});Z2(()=>{Oe()},[re,Oe]);let ke=K.useMemo(()=>{if(!v)return Ce.reference;if(!Ce.trigger)return QQ;let{onFocus:e,...t}=Ce.trigger;return t},[v,Ce.reference,Ce.trigger]);L.useSyncedValue(`inputProps`,v?Ce.reference??QQ:QQ);let Ae=K.useMemo(()=>{let e=x$(Te.reference,ke,xe.reference,{onMouseMove(){L.set(`allowMouseEnter`,!0)}},fe);return e[`aria-haspopup`]=`menu`,e[`aria-expanded`]=ee,e},[L,Te.reference,ke,xe.reference,fe,ee]),je=K.useMemo(()=>{let e=x$(Ce.trigger,xe.trigger,fe);return e[`aria-haspopup`]=`menu`,e[`aria-expanded`]=!1,e},[Ce.trigger,xe.trigger,fe]);WQ(()=>(L.update({inactiveTriggerProps:je}),null)),C8(L,{floatingRootContext:_e,activeTriggerProps:Ae,inactiveTriggerProps:je,popupProps:K.useMemo(()=>x$(p8,{onMouseMove(){L.set(`allowMouseEnter`,!0),U.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)}},Te.floating,Ce.floating,xe.floating),[U.type,L,Te.floating,Ce.floating,xe.floating]),itemProps:Ce.item??QQ});let Me=K.useMemo(()=>({store:L,parent:D,orientation:u,loopFocus:l,allowEscape:b,defaultFloatingId:k,setRenderedFloatingId:j,virtualFocus:v,parentVirtualFocus:E,syncHighlightedItem:Oe}),[L,D,u,l,b,k,v,E,Oe]),Ne=typeof t==`function`?t({payload:ae}):t,Pe=(0,X.jsxs)(d7.Provider,{value:Me,children:[p&&(0,X.jsx)(g8,{handle:p,store:L}),Ne]});return(U.type===void 0||U.type===`context-menu`)&&(Pe=(0,X.jsx)(Q6,{externalTree:R,children:Pe})),Pe});function Mce(e){let t=K.useContext(L7);if(t===null)return(0,X.jsx)(jce,{...e});let n=t.Root;return(0,X.jsx)(L7.Provider,{value:null,children:(0,X.jsx)(n,{...t.options,...e})})}var z7=5;function Nce(e,t){let n=Pce(t);return e.clientX>=n.left-z7&&e.clientX<=n.right+z7&&e.clientY>=n.top-z7&&e.clientY<=n.bottom+z7}function Pce(e){let t=e.getBoundingClientRect(),n=o1(e);if(H1)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 Fce(e={}){let{highlightItemOnHover:t,highlightedIndex:n,onHighlightedIndexChange:r}=e6(),{ref:i,index:a}=x7(e),o=n===a,s=K.useRef(null),c=s$(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 Ice(e){let{render:t,className:n,style:r,state:i=QQ,props:a=ZQ,refs:o=ZQ,metadata:s,stateAttributesMapping:c,tag:l=`div`,...u}=e,{compositeProps:d,compositeRef:f}=Fce({metadata:s});return P$(l,e,{state:i,ref:[f,...o],props:[d,...a,u],stateAttributesMapping:c})}function B7(e){if(u1(e)&&e.hasAttribute(`data-rootownerid`))return e.getAttribute(`data-rootownerid`);if(!S1(e))return B7(T1(e))}function V7(e,t){function n(n,r,i){let a=n.currentTarget;j4.flushSync(()=>{e.setOpen(!1,i6(u6,n.nativeEvent,a))}),F2(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&&I2(t,r)?e.context.beforeContentFocusGuardRef.current?.focus():n(t,1,r)}return{handlePreFocusGuardFocus:r,handleFocusTargetFocus:i}}function Lce(e){let{enabled:t=!0,mouseDownAction:n,open:r}=e,i=K.useRef(!1);return K.useMemo(()=>t?{onMouseDown:e=>{(n===`open`&&!r||n===`close`&&r)&&(i.current=!0,h2(e.currentTarget).addEventListener(`click`,()=>{i.current=!1},{once:!0}))},onClick:e=>{i.current&&(i.current=!1,e.preventBaseUIHandler())}}:QQ,[t,n,r])}var Rce=k8(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=f7(!0),h=z8(d)??m?.store;if(!h)throw Error(i$(85));let g=Y$(s),_=h.useState(`isTriggerActive`,g),v=h.useState(`floatingRootContext`),y=h.useState(`isOpenedByTrigger`,g),b=h.useState(`triggerControlsId`,g),x=K.useRef(null),S=Bce(),C=e6(!0),w=Y6(),T=K.useMemo(()=>w??new G6,[w]),{registerTrigger:E,isMountedByThisTrigger:D}=b8(g,x,h,{payload:f,closeDelay:u,parent:S,floatingTreeRoot:T,floatingNodeId:X6(T),floatingParentNodeId:J6(),keyboardEventRelay:C?.relayKeyboardEvent}),O=S.type===`menubar`,k=h.useState(`disabled`),A=a||k||O&&S.context.disabled,{getButtonProps:j,buttonRef:M}=n6({disabled:A,native:o});K.useEffect(()=>{!y&&S.type===void 0&&(h.context.allowMouseUpTriggerRef.current=!1)},[h,y,S.type]);let N=K.useRef(null),P=n$(),F=qQ(e=>{if(!N.current)return;P.clear(),h.context.allowMouseUpTriggerRef.current=!1;let t=e.target;W1(N.current,t)||W1(h.select(`positionerElement`),t)||t===N.current||(t==null||B7(t)!==h.select(`rootId`))&&(Nce(e,N.current)||T.events.emit(`close`,{domEvent:e,reason:cae}))});K.useEffect(()=>{let e=h2(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=K8(v,{enabled:(c??I)&&!A&&(!O||I&&!D),handleClose:n5({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=zce(y,h.select(`lastOpenChangeReason`)),z=o8(v,{enabled:!A,event:y&&O?`click`:`mousedown`,toggle:!0,ignoreMouse:!1,stickIfOpen:S.type===void 0&&R}),ee=Bae(v,{enabled:!A&&I}),B=Lce({open:y,enabled:O,mouseDownAction:`open`}),V=K.useMemo(()=>x$(ee.reference,z.reference),[ee.reference,z.reference]),te=h.useState(`triggerProps`,D),ne=h.useState(`filterTriggerProps`),{handlePreFocusGuardFocus:H,handleFocusTargetFocus:U}=V7(h,x),re={disabled:A,open:y},ie=[N,t,M,E,x],ae=[V,L??QQ,te,{"aria-haspopup":`menu`,"aria-controls":b,id:g,onMouseDown:e=>{h.select(`open`)||(P.start(200,()=>{h.context.allowMouseUpTriggerRef.current=!0}),h2(e.currentTarget).addEventListener(`mouseup`,F,{once:!0}))}},ne,O?{role:`menuitem`}:{},B,p,j],oe=P$(`button`,e,{enabled:!O,stateAttributesMapping:h0,state:re,ref:ie,props:ae});return O?(0,X.jsx)(Ice,{tag:`button`,render:n,className:r,style:i,state:re,refs:ie,props:ae,stateAttributesMapping:h0}):y?(0,X.jsxs)(K.Fragment,{children:[(0,X.jsx)(T6,{ref:h.context.beforeTriggerFocusGuardRef,onFocus:H},`${g}-pre-focus-guard`),(0,X.jsx)(K.Fragment,{children:oe},g),(0,X.jsx)(T6,{ref:h.context.triggerFocusTargetRef,onFocus:U},`${g}-post-focus-guard`)]}):(0,X.jsx)(K.Fragment,{children:oe},g)});function zce(e,t){let n=n$(),[r,i]=K.useState(!1);return Z2(()=>{e&&t===`trigger-hover`?(i(!0),n.start(500,()=>{i(!1)})):e||(n.clear(),i(!1))},[e,t,n]),r}function Bce(){let e=I7(!0);return K.useMemo(()=>e?{type:`menubar`,context:e}:{type:void 0},[e])}var Vce=K.forwardRef(function(e,t){let{className:n,render:r,orientation:i=`horizontal`,style:a,...o}=e;return P$(`div`,e,{state:{orientation:i},ref:t,props:[{role:`separator`,"aria-orientation":i},o]})}),H7=(0,K.createContext)(null);function Hce({actionsRef:e,children:t,interactionOwner:n=`local`,onOpenChange:r,...i}){let a=(0,K.useRef)(null),o=e??a;return p3(()=>o.current?.close()),(0,X.jsx)(H7.Provider,{value:{actionsRef:o,interactionOwner:n},children:(0,X.jsx)(Mce,{...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 Uce(){let e=(0,K.useContext)(H7);if(!e)throw Error(`DropdownMenu parts must be used inside <DropdownMenu>`);return e}var Wce=(0,K.forwardRef)(function({className:e,render:t,type:n=`button`,...r},i){return(0,X.jsx)(Rce,{...r,className:t=>Z(`btn caps-dropdown-trigger`,YN(e,t)),ref:i,render:t,type:n})}),Gce=(0,K.forwardRef)(function({container:e,...t},n){let r=f3(`popover`);return e==null&&r===null?null:(0,X.jsx)(ice,{...t,container:e??r,ref:n})}),Kce=(0,K.forwardRef)(function({collisionBoundary:e,...t},n){let r=f3(`popover`);return(0,X.jsx)(Cce,{...t,collisionBoundary:e??(r&&r!==document.body?r:void 0),ref:n})}),qce=(0,K.forwardRef)(function({className:e,finalFocus:t,...n},r){let{interactionOwner:i}=Uce(),a=(0,K.useRef)(null);(0,K.useImperativeHandle)(r,()=>a.current);let o=c7(`.caps-dropdown-item[data-highlighted]`),s=(0,K.useCallback)(e=>{a.current=e,o(e)},[o]);return(0,X.jsx)(nce,{...n,className:t=>Z(`caps-dropdown-popup min-w-40 rounded-box border border-base-300 bg-base-100 p-xs shadow-lg outline-none`,YN(e,t)),finalFocus:i===`host`?!1:t??!0,ref:s})}),Jce=(0,K.forwardRef)(function({align:e=`end`,alignOffset:t,children:n,container:r,keepMounted:i,side:a=`bottom`,sideOffset:o=4,...s},c){return(0,X.jsx)(Gce,{container:r,keepMounted:i,children:(0,X.jsx)(Kce,{align:e,alignOffset:t,side:a,sideOffset:o,children:(0,X.jsx)(qce,{...s,ref:c,children:n})})})}),U7=`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`;(0,K.forwardRef)(function({className:e,onClick:t,onSelect:n,variant:r=`default`,...i},a){return(0,X.jsx)(Kse,{...i,className:t=>Z(U7,r===`destructive`&&`text-error hover:bg-error hover:text-error-content focus-visible:bg-error focus-visible:text-error-content`,YN(e,t)),onClick:e=>{t?.(e),e.defaultPrevented||n?.(e)},ref:a})});var Yce=(0,K.forwardRef)(function({children:e,className:t,onClick:n,onSelect:r,...i},a){return(0,X.jsxs)(Bse,{...i,className:e=>Z(U7,YN(t,e)),onClick:e=>{n?.(e),e.defaultPrevented||r?.(e)},ref:a,children:[(0,X.jsx)(`span`,{className:`min-w-0 flex-1`,children:e}),(0,X.jsx)(Vse,{"aria-hidden":`true`,className:`shrink-0`,children:`✓`})]})});(0,K.forwardRef)(function({className:e,...t},n){return(0,X.jsx)(Vce,{...t,className:t=>Z(`my-xs h-px bg-base-300`,YN(e,t)),ref:n})}),(0,K.forwardRef)(function({className:e,...t},n){return(0,X.jsx)(Wse,{...t,className:t=>Z(`px-md pb-xs pt-sm text-xs font-semibold text-base-content/60`,YN(e,t)),ref:n})});function Xce({disabled:e,emptyLabel:t,models:n,onChange:r,value:i}){let a=n.find(e=>e.id===i),[o,s]=(0,K.useState)(null);return(0,X.jsx)(`span`,{className:`contents`,ref:s,children:(0,X.jsxs)(Hce,{children:[(0,X.jsx)(Wce,{"aria-label":`Generation model`,"data-generation-model":i,disabled:e||n.length===0,render:(e,n)=>(0,X.jsx)(mse,{...e,expanded:n.open,label:a===void 0?t:jL(a)})}),(0,X.jsx)(Jce,{"data-generation-model-menu":!0,container:o,side:`top`,align:`start`,"aria-label":`Generation models`,children:n.map(e=>(0,X.jsx)(Yce,{"data-generation-model-option":e.id,checked:e.id===i,closeOnClick:!0,onSelect:()=>{r(e.id)},children:jL(e)},e.id))})]})})}function Zce(e){let t=Hk(e),n=(0,K.useRef)(e);n.current=e;let r=mx(),i=ES(bM(e)),a=kS(UX(e,i.data?.configured?i.data.path:null)),[o,s]=(0,K.useState)(null),c=n=>n?.app===e&&n.computerId===t,l=OS({mutationKey:vM.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 Y(`Computer selection changed`,{code:`SELECTION_CHANGED`,retryable:!1})};return a(),i&&await e.capabilities.require(sR).mkdir({path:r}),a(),await oR(e.capabilities,{path:r,limit:1,offset:0}),a(),kj(e.capabilities,{operation:`select-folder`,computerId:t,path:r})},onSuccess:(e,t)=>{t.owner===n.current&&t.owner.context.get().computerId===t.id&&s(null)},onSettled:(e,t,n)=>Promise.all([r.invalidateQueries({queryKey:n.queryKey,exact:!0}),r.invalidateQueries({queryKey:HX.listing(n.owner,n.path),exact:!0})])}),u=l.variables?.owner===e&&l.variables.id===t,d=i.isFetching||u&&l.isPending,f=async(n,r)=>{if(!e||!t||d)return`Computer selection changed. Try again.`;let i=n.trim();if(!Zy(UA)(i))return`Enter an absolute Computer folder, such as /media.`;try{return await l.mutateAsync({owner:e,id:t,path:i,create:r,queryKey:vM.folder(e)}),null}catch{return`Could not use this folder. Check its location and your Computer permissions.`}},p=i.isError||a.isError;return{path:p?null:i.data?.path??null,galleryPath:p||!i.data?.configured?null:i.data.path,computerId:t,available:e?.capabilities.has(vA)===!0,writable:e?.capabilities.has(sR)===!0,busy:d,error:p?`Your media folder is unavailable. Choose or create a folder.`:null,editing:c(o),setEditing:n=>{s(n?{app:e,computerId:t}:null)},choose:f,ensureCreated:async()=>i.data?i.data.configured?null:f(i.data.path,!0):`Your Prints library is still loading.`,recheck:()=>{r.invalidateQueries({queryKey:HX.listing(e,i.data?.path??null),exact:!0}),r.invalidateQueries({queryKey:vM.folder(e),exact:!0})}}}var Qce=$y(lb),$ce=$y(q({message:lb}));function ele(e){for(let t of e.errors){let e=bd(vd(xd($ce(t),e=>e.message),()=>Qce(t)));if(e!==void 0&&e.length>0)return e}}var tle={neutral:`progress-neutral`,primary:`progress-primary`,secondary:`progress-secondary`,accent:`progress-accent`,success:`progress-success`,info:`progress-info`,warning:`progress-warning`,error:`progress-error`},W7=(0,K.forwardRef)(function({className:e,tone:t=`primary`,...n},r){return(0,X.jsx)(`progress`,{...n,"data-complete":n.value!==void 0&&Number(n.value)>=Number(n.max??1)?`true`:void 0,className:Z(`progress caps-gooey-motion caps-gooey-progress w-full`,tle[t],e),ref:r})});(0,K.forwardRef)(function({label:e,value:t,max:n,tone:r=`info`,className:i,...a},o){return(0,X.jsxs)(`div`,{...a,ref:o,className:Z(`caps-game-meter`,i),children:[(0,X.jsxs)(`div`,{className:`caps-game-meter-readout`,children:[(0,X.jsx)(`span`,{children:e}),(0,X.jsxs)(`span`,{className:`caps-game-meter-value`,children:[t,` / `,n]})]}),(0,X.jsx)(W7,{"aria-label":e,value:t,max:n,tone:r})]})});function G7({className:e,items:t,onCancel:n,onRemove:r,onRetry:i,rowClassName:a}){return t.length?(0,X.jsx)(`div`,{"aria-live":`polite`,className:`caps-upload-queue flex w-full min-w-0 flex-col gap-sm ${e??``}`,"data-upload-rows":!0,children:t.map(e=>(0,X.jsx)(rle,{item:e,onCancel:n,onRemove:r,onRetry:i,...a===void 0?{}:{rowClassName:a}},e.id))}):null}function K7({action:e,id:t,onAction:n,retry:r=!1}){return e?(0,X.jsx)(AI,{"aria-label":e.accessibleLabel,title:e.label,variant:`ghost`,size:`xs`,className:`motion-reduce:transition-none`,icon:r?(0,X.jsx)(oL,{}):(0,X.jsx)(dL,{}),onClick:()=>void n(t),type:`button`}):null}function nle({item:e}){return(0,X.jsxs)(`div`,{className:`min-w-0`,children:[(0,X.jsx)(`span`,{className:`block min-w-0 truncate`,title:e.name,children:e.name}),(0,X.jsx)(`div`,{className:`caps-upload-details`,children:(0,X.jsxs)(`span`,{"aria-live":e.alert?`assertive`:void 0,className:`caps-upload-status min-w-0 break-words`,"data-upload-status":!0,role:e.alert?`alert`:void 0,children:[e.alert??e.statusLabel,` `,e.progressLabel]})})]})}function rle({item:e,onCancel:t,onRemove:n,onRetry:r,rowClassName:i}){return(0,X.jsxs)(`div`,{className:`caps-upload-row grid w-full min-w-0 max-w-full grid-cols-[2rem_minmax(0,1fr)_auto] items-center gap-sm p-sm text-xs ${i??``}`,children:[e.preview.kind===`image`?(0,X.jsx)(`img`,{alt:``,className:`caps-upload-preview mask mask-squircle size-8 shrink-0 object-cover`,src:e.preview.url}):(0,X.jsx)(`span`,{"aria-hidden":`true`,className:`caps-upload-preview mask mask-squircle flex size-8 shrink-0 items-center justify-center bg-base-300`,children:(0,X.jsx)(eL,{className:`size-4`})}),(0,X.jsx)(nle,{item:e}),(0,X.jsx)(ile,{actions:e.actions,id:e.id,onCancel:t,onRemove:n,onRetry:r}),(0,X.jsx)(W7,{"aria-label":`${e.name} progress`,className:`caps-upload-progress`,tone:e.alert?`error`:e.progress===100?`success`:`accent`,max:100,value:e.progress??(e.alert?0:void 0)})]})}function ile({actions:e,id:t,onCancel:n,onRemove:r,onRetry:i}){return(0,X.jsxs)(`div`,{className:`caps-upload-actions flex min-w-0 flex-wrap justify-end gap-xs`,children:[(0,X.jsx)(K7,{action:e.retry,id:t,onAction:i,retry:!0}),(0,X.jsx)(K7,{action:e.cancel,id:t,onAction:n}),(0,X.jsx)(K7,{action:e.remove,id:t,onAction:r})]})}var q7=K.createContext(void 0);function J7(e){let t=K.useContext(q7);if(t===void 0&&!e)throw Error(i$(47));return t}var ale={...R8,disabled:e=>e.disabled,instantType:e=>e.instantType===`trigger-change`&&!R8.open(e)?void 0:e.instantType,openMethod:e=>e.openMethod,openChangeReason:e=>e.openChangeReason,isPressOpenedByTrigger:(e,t)=>e.openChangeReason===`trigger-press`&&R8.isOpenedByTrigger(e,t),isTouchPressOpen:(e,t)=>t&&e.openMethod===`touch`&&e.openChangeReason===`trigger-press`,hasTriggerFocusGuards:(e,t)=>R8.isOpenedByTrigger(e,t)&&!e.focusManagerModal,modal:e=>e.modal,titleElementId:e=>e.titleElementId,descriptionElementId:e=>e.descriptionElementId,openOnHover:e=>e.openOnHover,closeDelay:e=>e.closeDelay,adaptiveOrigin:e=>e.adaptiveOrigin},ole=class extends M8{constructor(e,t,n){let r=new T8;super(sle(e,r,t,n),cle(r),ale)}setOpen=(e,t)=>{let n=t.reason===s6,r=t.reason===`trigger-press`&&t.event.detail===0,i=!e&&(t.reason===`escape-key`||t.reason==null),a=y8(t),o=this.select(`activeTriggerId`);if(!e&&t.reason===`close-press`&&t.trigger==null&&o!=null&&(t.trigger=this.context.triggerElements.getById(o)??this.select(`activeTriggerElement`)??void 0),this.context.onOpenChange?.(e,t),t.isCanceled)return;this.state.floatingRootContext.dispatchOpenChange(e,t);let s=()=>{let n=v8(this.state,e,t.trigger,a());n.openChangeReason=t.reason,this.update(n)};n?(this.context.stickIfOpen=!0,this.context.stickIfOpenTimeout.start(500,()=>{this.context.stickIfOpen=!1}),j4.flushSync(s)):s();let c;r?c=`click`:i?c=`dismiss`:t.reason===`focus-out`&&(c=`focus`),this.set(`instantType`,c)}};function sle(e,t,n,r=!1){let i={...N8(t,n,r),disabled:!1,modal:!1,focusManagerModal:!1,instantType:void 0,openMethod:null,openChangeReason:null,titleElementId:void 0,descriptionElementId:void 0,openOnHover:!1,closeDelay:0,adaptiveOrigin:void 0,...e};return i.open&&e?.mounted===void 0&&(i.mounted=!0),i}function cle(e){return{popupRef:K.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerFocusTargetRef:K.createRef(),beforeTriggerFocusGuardRef:K.createRef(),beforeContentFocusGuardRef:K.createRef(),stickIfOpenTimeout:new t$,stickIfOpen:!0,triggerElements:e}}var Y7=O8(function({props:e}){let{children:t,open:n,defaultOpen:r=!1,onOpenChange:i,onOpenChangeComplete:a,modal:o=!1,handle:s,triggerId:c,defaultTriggerId:l=null}=e,u=ule(s,{modal:o,open:r,openProp:n,activeTriggerId:l,triggerIdProp:c});u.useControlledProp(`openProp`,n),u.useControlledProp(`triggerIdProp`,c);let d=u.useState(`open`),f=u.useState(`mounted`),p=u.useState(`payload`);u.useContextCallback(`onOpenChange`,i),u.useContextCallback(`onOpenChangeComplete`,a),w8(u,d),x8(u);let{forceUnmount:m}=S8(d,u,()=>{u.context.stickIfOpen=!0,u.set(`openChangeReason`,null)});u.useSyncedValues({modal:o}),K.useEffect(()=>{d||u.context.stickIfOpenTimeout.clear()},[u,d]),K.useImperativeHandle(e.actionsRef,()=>({unmount:m,close:()=>u.setOpen(!1,i6(m6))}),[m,u]);let h=d||f||s!=null;return(0,X.jsxs)(q7.Provider,{value:u,children:[s&&(0,X.jsx)(g8,{handle:s,store:u}),h&&(0,X.jsx)(dle,{store:u,modal:o}),typeof t==`function`?t({payload:p}):t]})});function lle(e){return J7(!0)?(0,X.jsx)(Y7,{props:e}):(0,X.jsx)(Q6,{children:(0,X.jsx)(Y7,{props:e})})}function ule(e,t){let n=h8((e,n)=>new ole(t,e,n));return K.useEffect(()=>n.context.stickIfOpenTimeout.disposeEffect(),[n]),n}function dle({store:e,modal:t}){let n=s8(e.useState(`floatingRootContext`),{outsidePressEvent:{mouse:t===`trap-focus`?`sloppy`:`intentional`,touch:`sloppy`}}),r=n.reference,i=n.floating;return C8(e,{activeTriggerProps:r,inactiveTriggerProps:r,popupProps:i}),null}var fle=k8(function(e,t){let{render:n,className:r,style:i,disabled:a=!1,nativeButton:o=!0,handle:s,payload:c,openOnHover:l=!1,delay:u=300,closeDelay:d=0,id:f,...p}=e,m=J7(!0),h=z8(s)??m;if(!h)throw Error(i$(74));let g=Y$(f),_=h.useState(`isTriggerActive`,g),v=h.useState(`floatingRootContext`),y=h.useState(`isOpenedByTrigger`,g),b=h.useState(`triggerPopupId`,g),x=K.useRef(null),{registerTrigger:S,isMountedByThisTrigger:C}=b8(g,x,h,{payload:c,disabled:a,openOnHover:l,closeDelay:d}),w=h.useState(`isPressOpenedByTrigger`,g),T=h.useState(`isTouchPressOpen`,l),E=h.useState(`hasTriggerFocusGuards`,g),D=K8(v,{enabled:!a&&l&&!T,mouseOnly:!0,move:!1,handleClose:n5(),restMs:u,delay:{close:d},triggerElementRef:x,isActiveTrigger:_,isClosing:()=>h.select(`transitionStatus`)===`ending`}),O=o8(v,{stickIfOpen:qQ(()=>h.context.stickIfOpen)}),k=N5(()=>h.select(`open`),e=>{h.set(`openMethod`,e)}),A=h.useState(`triggerProps`,C),{getButtonProps:j,buttonRef:M}=n6({disabled:a,native:o}),N={open(e){return w?h0.open(e):m0.open(e)}},{handlePreFocusGuardFocus:P,handleFocusTargetFocus:F}=V7(h,x),I=P$(`button`,e,{state:{disabled:a,open:y},ref:[M,t,S,x],props:[O.reference,D,A,k,{[z6]:``,id:g,"aria-haspopup":`dialog`,"aria-expanded":y,"aria-controls":b},p,j],stateAttributesMapping:N}),L=(0,X.jsx)(K.Fragment,{children:I},g);return E?(0,X.jsxs)(K.Fragment,{children:[(0,X.jsx)(T6,{ref:h.context.beforeTriggerFocusGuardRef,onFocus:P}),L,(0,X.jsx)(T6,{ref:h.context.triggerFocusTargetRef,onFocus:F})]}):L}),X7=K.createContext(void 0);function ple(){let e=K.useContext(X7);if(e===void 0)throw Error(i$(45));return e}var mle=K.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e;return J7().useState(`mounted`)||n?(0,X.jsx)(X7.Provider,{value:n,children:(0,X.jsx)(U6,{ref:t,...r})}):null}),Z7=K.createContext(void 0);function hle(){let e=K.useContext(Z7);if(!e)throw Error(i$(46));return e}var gle=K.forwardRef(function(e,t){let{render:n,className:r,style:i,anchor:a,positionMethod:o,side:s,align:c,sideOffset:l,alignOffset:u,collisionBoundary:d=`clipping-ancestors`,collisionPadding:f,arrowPadding:p,sticky:m,disableAnchorTracking:h=!1,collisionAvoidance:g=B6,..._}=e,v=J7(),y=ple(),b=X6(),x=v.useState(`floatingRootContext`),S=v.useState(`mounted`),C=v.useState(`open`),w=v.useState(`openChangeReason`),T=v.useState(`activeTriggerElement`),E=v.useState(`modal`),D=v.useState(`openMethod`),O=v.useState(`positionerElement`),k=v.useState(`instantType`),A=v.useState(`transitionStatus`),j=A7({anchor:a,floatingRootContext:x,positionMethod:o,mounted:S,side:s,sideOffset:l,align:c,alignOffset:u,arrowPadding:p,collisionBoundary:d,collisionPadding:f,sticky:m,disableAnchorTracking:h,keepMounted:y,nodeId:b,collisionAvoidance:g,adaptiveOrigin:v.useState(`adaptiveOrigin`)});N7({store:v,domReference:x.useState(`domReferenceElement`),positionerElement:O,open:C});let M=E===!0&&w!==`trigger-hover`;F7(C&&M,D===`touch`,O,T);let N=v.useStateSetter(`positionerElement`),P=P7(e,{open:C,side:j.side,align:j.align,anchorHidden:j.anchorHidden,instant:k},{styles:j.positionerStyles,transitionStatus:A,props:_,refs:[t,N],hidden:!S,inert:!C});return(0,X.jsxs)(Z7.Provider,{value:j,children:[S&&M&&(0,X.jsx)(E5,{inert:T5(!C),cutout:T}),(0,X.jsx)(Z6,{id:b,children:P})]})}),_le=K.createContext(void 0);function vle(){let[e,t]=K.useState(0),n=qQ(()=>(t(e=>e+1),()=>{t(e=>Math.max(0,e-1))}));return{context:K.useMemo(()=>({register:n}),[n]),hasClosePart:e>0}}var yle=K.forwardRef(function(e,t){let{render:n,className:r,style:i,initialFocus:a,finalFocus:o,...s}=e,c=J7(),l=hle(),u=C7(!0)!=null,{context:d,hasClosePart:f}=vle(),p=c.useState(`open`),m=c.useState(`openMethod`),h=c.useState(`instantType`),g=c.useState(`transitionStatus`),_=c.useState(`popupProps`),v=c.useState(`titleElementId`),y=c.useState(`descriptionElementId`),b=c.useState(`modal`),x=c.useState(`mounted`),S=c.useState(`openChangeReason`),C=c.useState(`activeTriggerElement`),w=c.useState(`floatingRootContext`),T=w.useState(`floatingId`),E=c.useState(`disabled`),D=c.useState(`openOnHover`),O=c.useState(`closeDelay`);f8({open:p,ref:c.context.popupRef,onComplete(){p&&c.context.onOpenChangeComplete?.(!0)}}),G8(w,{enabled:D&&!E,closeDelay:O});let k=a===void 0?m8(c.context.popupRef):a,A=b!==!1&&f;c.useSyncedValue(`focusManagerModal`,A);let j=c.useStateSetter(`popupElement`),M=P$(`div`,e,{state:{open:p,side:l.side,align:l.align,instant:h,transitionStatus:g},ref:[t,c.context.popupRef,j],props:[_,{id:T,role:`dialog`,...p8,"aria-labelledby":v,"aria-describedby":y,onKeyDown(e){u&&w5.has(e.key)&&e.stopPropagation()}},w7(g),s],stateAttributesMapping:_0});return(0,X.jsx)(a8,{context:w,openInteractionType:m,modal:A,disabled:!x||S===`trigger-hover`,initialFocus:k,returnFocus:o,restoreFocus:`popup`,getInsideElements:()=>[c.context.beforeTriggerFocusGuardRef.current],previousFocusableElement:u1(C)?C:void 0,nextFocusableElement:c.context.triggerFocusTargetRef,beforeContentFocusGuardRef:c.context.beforeContentFocusGuardRef,children:(0,X.jsx)(_le.Provider,{value:d,children:M})})}),ble=(0,K.forwardRef)(function({children:e,className:t,type:n=`button`,...r},i){return(0,X.jsxs)(`button`,{...r,ref:i,type:n,className:Z(`select caps-select caps-combobox-trigger w-full`,t),children:[(0,X.jsx)(`span`,{children:e}),(0,X.jsx)(ZI,{className:`caps-select-chevron`,"aria-hidden":`true`})]})});function xle({defaultOpen:e,defaultValue:t,getKey:n,getSearchText:r,groupBy:i,id:a,isDisabled:o,items:s,onOpenChange:c,onCommit:l,multiple:u,controlledOpen:d,controlledKeys:f,trigger:p}){let m=`${a}-listbox`,[h,g]=(0,K.useState)(``),[_,v]=(0,K.useState)(!1),[y,b]=(0,K.useState)(t),[x,S]=(0,K.useState)(e),C=f??(y===null?[]:[y]),w=p?d??x:!0,T=(0,K.useMemo)(()=>{let e=h.trim().toLowerCase();return e?s.filter(t=>r(t).toLowerCase().includes(e)):s},[r,s,h]),E=Sse({getKey:n,isDisabled:o,items:T});(0,K.useEffect)(()=>{if(E.activeKey!==null)return;let e=E.enabledItems.find(e=>C.includes(n(e)))??E.enabledItems[0];e&&E.setActiveKey(n(e))},[E.activeKey,E.enabledItems,E.setActiveKey,n,C]);let D=e=>{v(!1),e||g(``),d===void 0&&S(e),c?.(e)},O=e=>`${m}-option-${encodeURIComponent(e)}`,k=e=>{let t=n(e);f===void 0&&b(t),l(e),p&&!u&&D(!1)},A=e=>{v(!0),g(e.target.value),E.setActiveKey(null)},j=e=>{if(H5(e))return;let t;switch(e.key){case`ArrowDown`:t=[1,void 0];break;case`ArrowUp`:t=[-1,void 0];break;case`End`:t=[1,`end`];break;case`Home`:t=[-1,`start`]}t?(v(!0),e.preventDefault(),E.move(t[0],t[1])):e.key===`Enter`&&E.activeItem&&(e.preventDefault(),k(E.activeItem))},M=(0,K.useMemo)(()=>{if(!i)return[{label:``,items:T}];let e=new Map;for(let t of T){let n=i(t),r=e.get(n);r?r.push(t):e.set(n,[t])}return[...e].map(([e,t])=>({label:e,items:t}))},[T,i]);return{keyboardNavigation:_,onPointerMove:()=>{v(!1)},activeKey:E.activeKey,activeItem:E.activeItem,groups:M,inputValue:h,listboxId:m,onInputChange:A,onInputKeyDown:j,optionId:O,open:w,commit:k,selectedKeys:C,setOpen:D}}function Sle(e){let{"aria-describedby":t,"aria-invalid":n,"aria-label":r,"aria-labelledby":i,"aria-required":a,activeTone:o=`neutral`,container:s,contentClassName:c,defaultOpen:l=!1,defaultValue:u=null,emptyMessage:d=`No matches`,getKey:f,getLabel:p,getSearchText:m=p,groupBy:h,id:g,inputProps:_,inputRef:v,isDisabled:y=()=>!1,items:b,onOpenChange:x,onValueChange:S,multiple:C,open:w,placeholder:T=`Search…`,renderItem:E,rootRef:D,trigger:O,triggerRef:k,value:A,...j}=e,M=e=>{let t=f(e);if(C){let e=A.includes(t)?A.filter(e=>e!==t):[...A,t];S?.(e,b.filter(t=>e.includes(f(t))))}else S?.(t,e)},N;C?N=A:A!==void 0&&(N=A===null?[]:[A]);let P=(0,K.useId)(),F=O?.props??_,I=g??F?.id??P,L={id:I,"aria-describedby":[t,F?.[`aria-describedby`]].filter(Boolean).join(` `)||void 0,"aria-invalid":n??F?.[`aria-invalid`],"aria-label":F?.[`aria-label`]??r,"aria-labelledby":F?.[`aria-labelledby`]??i,"aria-required":a??F?.[`aria-required`]},{keyboardNavigation:R,onPointerMove:z,activeItem:ee,activeKey:B,commit:V,groups:te,inputValue:ne,listboxId:H,onInputChange:U,onInputKeyDown:re,open:ie,optionId:ae,selectedKeys:oe,setOpen:se}=xle({defaultOpen:l,defaultValue:u,getKey:f,getSearchText:m,groupBy:h,id:I,isDisabled:y,items:b,onOpenChange:x,onCommit:M,multiple:C??!1,controlledOpen:w,controlledKeys:N,trigger:O});p3(()=>{O&&se(!1)});let W=f3(`popover`),G=s===void 0?W:s,ce=c7(`.caps-combobox-option[data-active="true"]:not(:disabled), [data-navigation="pointer"] .caps-combobox-option:hover:not(:disabled)`),le=(0,X.jsx)(A4,{..._,...O?{}:L,"aria-activedescendant":ee?ae(f(ee)):void 0,"aria-autocomplete":`list`,"aria-controls":H,"aria-expanded":!0,className:Z(`input-sm`,_?.className),id:O?_?.id??`${I}-input`:I,onChange:e=>{_?.onChange?.(e),U(e)},onKeyDown:e=>{_?.onKeyDown?.(e),e.defaultPrevented||re(e)},placeholder:_?.placeholder??T,ref:v,role:`combobox`,value:ne}),ue=(0,X.jsx)(`div`,{id:H,ref:ce,className:`caps-combobox-list`,"data-navigation":R?`keyboard`:`pointer`,onPointerMove:z,role:`listbox`,"aria-multiselectable":C??void 0,children:te.every(e=>e.items.length===0)?(0,X.jsx)(`div`,{className:`px-md py-md text-sm text-base-content`,children:d}):te.map(e=>(0,X.jsxs)(`div`,{"aria-label":e.label||void 0,role:e.label?`group`:void 0,children:[e.label?(0,X.jsx)(`div`,{className:`px-md pb-xs pt-sm text-xs text-base-content uppercase tracking-wider`,children:e.label}):null,e.items.map(e=>{let t=f(e),n=y(e),r=B===t,i={active:r,disabled:n,selected:oe.includes(t)};return(0,X.jsxs)(`button`,{"aria-disabled":n||void 0,"aria-selected":i.selected,className:`caps-combobox-option`,"data-active":r&&R,disabled:n,id:ae(t),onClick:()=>{V(e)},onMouseDown:e=>{e.preventDefault()},role:`option`,tabIndex:-1,type:`button`,children:[(0,X.jsx)(`span`,{"aria-hidden":`true`,className:`caps-combobox-check`,children:i.selected?(0,X.jsx)(XI,{}):null}),E?.(e,r,i)??p(e)]},t)})]},e.label))});return O?(0,X.jsx)(`div`,{...j,className:Z(j.className),ref:D,children:(0,X.jsxs)(lle,{modal:!0,onOpenChange:se,open:ie,children:[(0,X.jsx)(fle,{...L,"aria-haspopup":`dialog`,className:`btn`,ref:k,render:O}),G===null?null:(0,X.jsx)(mle,{container:G,children:(0,X.jsx)(gle,{align:`start`,side:`bottom`,sideOffset:4,children:(0,X.jsxs)(yle,{"data-active-tone":o,className:Z(`min-w-40 rounded-box border border-base-300 bg-base-100 p-xs shadow-lg outline-none caps-combobox-panel caps-combobox-popup`,c),children:[(0,X.jsx)(`div`,{className:`caps-combobox-search`,children:le}),ue]})})})]})}):(0,X.jsx)(`div`,{...j,className:Z(j.className),ref:D,children:(0,X.jsxs)(`div`,{className:Z(`caps-combobox-panel`,c),"data-active-tone":o,children:[(0,X.jsx)(`div`,{className:`caps-combobox-search`,children:le}),ue]})})}function Q7({icon:e,caption:t}){return(0,X.jsxs)(`span`,{className:`caps-icon-choice-mark`,"aria-hidden":`true`,children:[(0,X.jsx)(`span`,{className:`caps-icon-choice-art`,children:e}),t?(0,X.jsx)(`span`,{className:`caps-icon-choice-caption`,children:t}):null,(0,X.jsx)(`span`,{className:`caps-icon-choice-lamp`})]})}var Cle=(0,K.forwardRef)(function({label:e,icon:t,caption:n,appearance:r,className:i,...a},o){return(0,X.jsx)(`label`,{className:`caps-icon-choice`,"data-appearance":r===`compact`?r:void 0,children:(0,X.jsx)(i7,{...a,appearance:r??`default`,"aria-label":e,className:Z(`caps-icon-choice-input`,i),indicator:(0,X.jsx)(Q7,{icon:t,caption:n}),ref:o})})});function wle({checked:e}){let t=`caps-radio-${(0,K.useId)().replaceAll(`:`,``)}`,n=(0,K.useRef)(null),r=(0,K.useRef)(e).current,i=(0,K.useRef)(e),a=(0,K.useRef)(null),o=iP(a),{reduced:s}=o;return(0,K.useLayoutEffect)(()=>{if(!n.current)return;let t=s||i.current===e;i.current=e;let r=e?4:0,a=E4(o,{ease:`outCubic`,duration:75}),c=e?T4(o,{bounce:.65,duration:300}):E4(o,{ease:`inCubic`,duration:100}),l=pI(n.current,t?{rx:r,ry:r,cy:6,duration:0}:{rx:[{to:e?3.5:4.15,...a},{to:r,...c}],ry:[{to:e?4.5:3.85,...a},{to:r,...c}],cy:[{to:e?5.85:6.1,...a},{to:6,...c}]});return()=>{l.cancel()}},[e,s,o]),(0,X.jsxs)(`svg`,{ref:a,className:`caps-radio-visual`,width:`24`,height:`24`,viewBox:`0 0 12 12`,"aria-hidden":`true`,focusable:`false`,children:[(0,X.jsxs)(`defs`,{children:[(0,X.jsx)(_I,{id:`${t}-surface`,transform:`matrix(1 0 0 1 6 6)`}),(0,X.jsx)(vI,{id:`${t}-shadow`}),(0,X.jsx)(yI,{id:`${t}-inset`}),(0,X.jsx)(`clipPath`,{id:`${t}-well`,children:(0,X.jsx)(`circle`,{cx:`6`,cy:`6`,r:`5`})})]}),(0,X.jsx)(`circle`,{className:`caps-radio-track`,cx:`6`,cy:`6`,r:`5.5`,filter:`url(#${t}-inset)`}),(0,X.jsx)(`g`,{clipPath:`url(#${t}-well)`,children:(0,X.jsx)(`ellipse`,{ref:n,cx:`6`,cy:`6`,rx:r?4:0,ry:r?4:0,fill:`url(#${t}-surface)`,filter:`url(#${t}-shadow)`})})]})}var $7=(0,K.createContext)(null),Tle=(0,K.forwardRef)(function({children:e,className:t,defaultValue:n,disabled:r=!1,name:i,onValueChange:a,orientation:o=`vertical`,value:s,...c},l){let u=(0,K.useId)(),d=(0,K.useRef)(null);(0,K.useImperativeHandle)(l,()=>{if(!d.current)throw Error(`RadioGroup is not mounted`);return d.current},[]);let f=i??`radio-group-${u}`,[p,m]=(0,K.useState)(n),h=s??p;return(0,K.useEffect)(()=>{let e=d.current?.form;if(!e||s!==void 0)return;let t=e=>{queueMicrotask(()=>{e.defaultPrevented||m(n)})};return e.addEventListener(`reset`,t),()=>{e.removeEventListener(`reset`,t)}},[s,n,c.form]),(0,X.jsx)($7.Provider,{value:{disabled:r,name:f,onValueChange:e=>{s===void 0&&m(e),a?.(e)},value:h},children:(0,X.jsx)(`fieldset`,{...c,className:Z(`flex gap-md`,o===`horizontal`?`flex-row flex-wrap`:`flex-col`,t),disabled:r,role:c.role??`radiogroup`,ref:d,children:e})})}),e9=(0,K.forwardRef)(function({className:e,indicator:t,onChange:n,onClick:r,value:i,...a},o){let s=(0,K.useContext)($7);if(!s)throw Error(`RadioGroupItem must be used inside <RadioGroup>`);let c=s.value===i,l=e=>{n?.(e),e.target.checked&&s.onValueChange?.(i)};return(0,X.jsxs)(`span`,{className:`caps-radio`,"data-checked":c,"data-custom-indicator":t!==void 0||void 0,children:[(0,X.jsx)(`input`,{...a,"aria-checked":c,checked:c,className:Z(`caps-radio-input`,e),disabled:s.disabled||a.disabled,name:s.name,onChange:l,onClick:r,ref:o,type:`radio`,value:i}),t===void 0?(0,X.jsx)(wle,{checked:c}):t]})}),Ele=(0,K.forwardRef)(function({description:e,id:t,meta:n,title:r,...i},a){let o=(0,K.useContext)($7),s=(0,K.useId)(),c=t??s,l=o?.value===i.value,u=o?.disabled===!0||i.disabled===!0;return(0,X.jsxs)(`label`,{className:`caps-choice-card`,"data-checked":l,"data-disabled":u||void 0,htmlFor:c,children:[(0,X.jsx)(e9,{...i,"aria-describedby":e?`${c}-description`:void 0,"aria-labelledby":`${c}-title`,id:c,ref:a}),(0,X.jsxs)(`span`,{className:`caps-choice-card-copy`,children:[(0,X.jsx)(`span`,{className:`caps-choice-card-title`,id:`${c}-title`,children:r}),e?(0,X.jsx)(`span`,{className:`caps-choice-card-description`,id:`${c}-description`,children:e}):null]}),n?(0,X.jsx)(`span`,{className:`caps-choice-card-meta`,children:n}):null]})}),Dle=(0,K.forwardRef)(function({label:e,icon:t,caption:n,className:r,...i},a){return(0,X.jsx)(`label`,{className:`caps-icon-choice`,children:(0,X.jsx)(e9,{...i,"aria-label":e,className:Z(`caps-icon-choice-input`,r),indicator:(0,X.jsx)(Q7,{icon:t,caption:n}),ref:a})})}),Ole=$y(lb),kle=$y(db),Ale=$y(vb(Ob)),jle=$y(mb(lb)),t9=mb(Sb(File)),Mle=$y(t9),n9=gb([lb,Ob,db,sb,cb,mb(lb),t9]),Nle=$y(n9),r9=e=>_d(Ole(e.state.value),()=>``),i9=e=>_d(kle(e.state.value),()=>!1),Ple=e=>_d(Ale(e.state.value),()=>null),Fle=e=>_d(jle(e.state.value),()=>[]),Ile=e=>_d(Mle(e.state.value),()=>[]),Lle=e=>_d(Nle(e.state.value),()=>null);function Rle({field:e,spec:t,locked:n,...r}){let[i,a]=(0,K.useState)(!1);return(0,X.jsxs)(g3,{children:[(0,X.jsx)(A4,{...r,name:t.name,disabled:n,type:i?`text`:`password`,autoComplete:`off`,spellCheck:!1,className:`caps-field-secret`,placeholder:t.placeholder,readOnly:t.readOnly,value:r9(e),onBlur:e.handleBlur,onChange:t=>{e.handleChange(t.currentTarget.value)}}),(0,X.jsx)(OI,{type:`button`,variant:`outline`,size:`icon`,"aria-label":i?`Hide`:`Show`,"aria-pressed":i,disabled:n,onClick:()=>{a(e=>!e)},children:i?(0,X.jsx)(QI,{"aria-hidden":`true`}):(0,X.jsx)($I,{"aria-hidden":`true`})})]})}var zle={text:`text`,email:`email`,url:`url`,tel:`tel`};function Ble({spec:e,field:t,locked:n,...r}){let i=Ile(t),a=n||e.readOnly===!0,o=(0,K.useRef)(null);return(0,X.jsxs)(`div`,{className:`flex flex-col gap-sm`,children:[(0,X.jsx)(uP,{asChild:!0,children:(0,X.jsx)(`input`,{...r,ref:o,type:`file`,tabIndex:-1,required:r.required===!0&&i.length===0,name:e.name,accept:e.accept,multiple:e.multiple,disabled:a,onBlur:t.handleBlur,onChange:e=>{t.handleChange(Array.from(e.currentTarget.files??[])),e.currentTarget.value=``}})}),(0,X.jsx)(OI,{type:`button`,variant:`outline`,"aria-label":`Choose files for ${e.label}`,"aria-describedby":r[`aria-describedby`],"aria-invalid":r[`aria-invalid`],disabled:a,onBlur:t.handleBlur,onClick:()=>{o.current?.click()},children:`Choose files`}),(0,X.jsx)(G7,{items:i.map((e,t)=>({id:String(t),name:e.name,preview:{kind:`file`},progress:0,progressLabel:`${String(e.size)} bytes`,statusLabel:`Selected`,actions:a?{}:{remove:{label:`Remove`,accessibleLabel:`Remove ${e.name}`}}})),onRemove:e=>{t.handleChange(i.filter((t,n)=>String(n)!==e))},onCancel:()=>void 0,onRetry:()=>void 0})]})}function Vle({spec:e,field:t,locked:n,...r}){let i=e=>{t.handleChange(e)},a={...r,name:e.name,disabled:n,onBlur:t.handleBlur};switch(e.kind){case`text`:case`email`:case`url`:case`tel`:return(0,X.jsx)(A4,{...a,type:zle[e.kind],inputMode:e.kind===`text`?void 0:e.kind,autoComplete:e.autoComplete,placeholder:e.placeholder,maxLength:e.maxLength,readOnly:e.readOnly,value:r9(t),onChange:e=>{i(e.currentTarget.value)}});case`textarea`:return(0,X.jsx)(e7,{...a,rows:e.rows??3,placeholder:e.placeholder,maxLength:e.maxLength,readOnly:e.readOnly,value:r9(t),onChange:e=>{i(e.currentTarget.value)}});case`secret`:return(0,X.jsx)(Rle,{...r,field:t,spec:e,locked:n});case`money`:return(0,X.jsxs)(g3,{children:[(0,X.jsx)(_3,{className:`caps-field-currency`,children:e.currency??`USD`}),(0,X.jsx)(A4,{...a,inputMode:`decimal`,autoComplete:`off`,className:`caps-field-amount`,placeholder:e.placeholder??`0.00`,readOnly:e.readOnly,value:r9(t),onChange:e=>{i(e.currentTarget.value)}})]});case`date`:return(0,X.jsx)(A4,{...a,type:`date`,readOnly:e.readOnly,value:r9(t),onChange:e=>{i(e.currentTarget.value)}});case`number`:return(0,X.jsx)(M3,{...a,...e.min===void 0?{}:{min:e.min},...e.max===void 0?{}:{max:e.max},...e.step===void 0?{}:{step:e.step},...e.unit===void 0?{}:{unit:e.unit},...e.wrap===void 0?{}:{wrap:e.wrap},disabled:n||e.readOnly===!0,decrementLabel:`Decrease ${e.label}`,incrementLabel:`Increase ${e.label}`,value:Ple(t),onValueChange:e=>{t.handleChange(e)}});case`select`:return(0,X.jsxs)(N3,{...a,value:r9(t),onChange:e=>{i(e.currentTarget.value)},children:[e.placeholder===void 0?null:(0,X.jsx)(`option`,{value:``,disabled:!0,children:e.placeholder}),e.options.map(e=>(0,X.jsx)(`option`,{value:e.value,disabled:e.disabled,children:e.label},e.value))]});case`combobox`:return(0,X.jsx)(Sle,{id:r.id??e.name,"aria-describedby":r[`aria-describedby`],"aria-invalid":r[`aria-invalid`],"aria-required":r[`aria-required`],items:e.options,getKey:e=>e.value,getLabel:e=>e.label,isDisabled:t=>t.disabled||n||e.readOnly===!0,value:r9(t),...e.placeholder===void 0?{}:{placeholder:e.placeholder},trigger:(0,X.jsx)(ble,{name:e.name,disabled:n||e.readOnly===!0,onBlur:t.handleBlur,children:e.options.find(e=>e.value===r9(t))?.label??e.placeholder??`Choose…`}),inputProps:{"aria-label":`Search ${e.label}`,disabled:n||e.readOnly===!0},onValueChange:e=>{i(e??``),t.handleBlur()}});case`file`:return(0,X.jsx)(Ble,{...r,spec:e,field:t,locked:n});case`checkbox`:return(0,X.jsx)(i7,{...a,disabled:n||e.readOnly===!0,checked:i9(t),onChange:e=>{t.handleChange(e.currentTarget.checked)}});case`switch`:return(0,X.jsx)(F3,{...a,disabled:n||e.readOnly===!0,checked:i9(t),onCheckedChange:e=>{t.handleChange(e)}});case`radio`:case`icon-radio`:case`checkboxes`:case`icon-checkboxes`:return null}}var Hle=new Set([`radio`,`icon-radio`,`checkboxes`,`icon-checkboxes`]);function Ule({spec:e,field:t,locked:n,error:r,layout:i}){let a=n||e.readOnly===!0,o=e.label;if(e.kind===`checkboxes`||e.kind===`icon-checkboxes`){let n=Fle(t),s=(e,r)=>{t.handleChange(r?[...n,e]:n.filter(t=>t!==e))};return(0,X.jsx)(T3,{legend:o,layout:i,...i===`columns`?{legendTitle:o}:{},description:e.help,disabled:a,error:r??null,children:e.kind===`icon-checkboxes`?(0,X.jsx)(`div`,{className:`caps-field-icon-choices`,children:e.options.map(r=>(0,X.jsx)(Cle,{name:e.name,value:r.value,label:r.label,...r.caption===void 0?{}:{caption:r.caption},icon:r.icon,disabled:r.disabled,checked:n.includes(r.value),onBlur:t.handleBlur,onChange:e=>{s(r.value,e.currentTarget.checked)}},r.value))}):e.options.map(r=>(0,X.jsx)(D3,{label:r.label,description:r.description,orientation:`inline`,children:(0,X.jsx)(i7,{name:e.name,value:r.value,disabled:r.disabled,checked:n.includes(r.value),onBlur:t.handleBlur,onChange:e=>{s(r.value,e.currentTarget.checked)}})},r.value))})}let s=e.options.some(e=>e.description!==void 0||e.meta!==void 0);return(0,X.jsx)(T3,{legend:o,layout:i,...i===`columns`?{legendTitle:o}:{},description:e.help,disabled:a,error:r??null,children:(0,X.jsx)(Tle,{name:e.name,"aria-label":o,value:r9(t),onValueChange:e=>{t.handleChange(e),t.handleBlur()},orientation:e.kind===`icon-radio`||s?`horizontal`:`vertical`,children:e.options.map(t=>e.kind===`icon-radio`?(0,X.jsx)(Dle,{value:t.value,label:t.label,...t.caption===void 0?{}:{caption:t.caption},icon:t.icon,disabled:t.disabled},t.value):s?(0,X.jsx)(Ele,{value:t.value,title:t.label,description:t.description,meta:t.meta,disabled:t.disabled},t.value):(0,X.jsx)(D3,{label:t.label,orientation:`inline`,children:(0,X.jsx)(e9,{value:t.value,disabled:t.disabled})},t.value))})})}function Wle({spec:e,field:t,locked:n,error:r,render:i,...a}){return i({name:e.name,label:e.label,help:e.help,value:Lle(t),onChange:e=>{t.handleChange(e)},onBlur:t.handleBlur,error:r,disabled:n,id:a.id??e.name,"aria-describedby":a[`aria-describedby`],"aria-invalid":r!==void 0})}function Gle({form:e,spec:t,locked:n,layout:r}){let i=NQ({form:e,name:t.name}),a=jQ(e.store,e=>e.submissionAttempts>0),o=i.state.meta.isBlurred||a?ele(i.state.meta):void 0;if(t.render===void 0&&Hle.has(t.kind))return(0,X.jsx)(Ule,{spec:t,field:i,locked:n,error:o,layout:r});let s=r===`columns`?t.kind===`switch`||t.kind===`checkbox`?`horizontal`:`vertical`:t.kind===`checkbox`?`inline`:(t.layout??(t.kind===`switch`?`row`:`stacked`))===`row`?`horizontal`:`vertical`;return(0,X.jsx)(D3,{label:t.label,...r===`columns`?{labelTitle:t.label}:{},description:t.help,icon:t.icon,orientation:s,error:o,...t.required===void 0?{}:{required:t.required},...t.optional===void 0?{}:{optional:t.optional},children:t.render===void 0?(0,X.jsx)(Vle,{spec:t,field:i,locked:n}):(0,X.jsx)(Wle,{spec:t,field:i,locked:n,error:o,render:t.render})})}var Kle=$y(pb(lb,n9));function a9({form:e,spec:t,locked:n,layout:r}){let i=t.when;return jQ(e.store,e=>i===void 0||i(_d(Kle(e.values),()=>({}))))?(0,X.jsx)(Gle,{form:e,spec:t,locked:n,layout:r}):null}function qle({form:e,section:t,locked:n,layout:r}){let i=t.fields.map(t=>(0,X.jsx)(a9,{form:e,spec:t,locked:n,layout:r},t.name));return t.title===void 0?i:(0,X.jsx)(w3,{title:t.title,description:t.description,layout:r,children:i})}function Jle({model:e,names:t,disabled:n=!1,layout:r}){let i=e.form;return t===void 0?e.description.sections.map(e=>(0,X.jsx)(qle,{form:i,section:e,locked:n,layout:r},e.id??``)):t.map(t=>{let a=e.description.fields.find(e=>e.name===t);return a===void 0?null:(0,X.jsx)(a9,{form:i,spec:a,locked:n,layout:r},t)})}var o9=class{annotation;constructor(e){this.annotation=e}},Yle=class{sections;constructor(e){this.sections=e}},s9=`caps/form`,c9=0;function l9(e){c9+=1;let t={[`${s9}:${String(c9)}`]:new o9(e)};return e.label!==void 0&&(t.title=e.label),e.help!==void 0&&(t.description=e.help),t}lb.annotate(l9({kind:`secret`})).pipe(bb(`Secret`));var u9=e=>{let t=e.replace(/([a-z0-9])([A-Z])/g,`$1 $2`).replace(/[-_]+/g,` `).toLowerCase();return t.charAt(0).toUpperCase()+t.slice(1)};function Xle(e){return Object.values(e??{}).reduce((e,t)=>t instanceof o9?{...e,...t.annotation}:e,{})}function d9(e){return e.reduce((e,t)=>({...e,...Xle(t)}),{})}function f9(e){let t=e?.[s9];return t instanceof Yle?t.sections:{}}var p9=$y(lb);function m9(e){if(Tg(e))return gd(p9(e.literal),{onNone:()=>null,onSome:e=>[e]});if(!kg(e))return null;let t=[];for(let n of e.types){if(bg(n))continue;let e=m9(n);if(e===null)return null;t.push(...e)}return t}function h9(e){if(Sg(e))return{type:`string`,literals:[]};if(Cg(e))return{type:`number`,nullable:!1};if(wg(e))return{type:`boolean`};let t=m9(e);if(t!==null)return{type:`string`,literals:t};if(Dg(e)){let[t]=e.rest;if(t===void 0)return null;if(Sg(t))return{type:`strings`,literals:[]};let n=m9(t);return n===null?null:{type:`strings`,literals:n}}if(kg(e)){let t=e.types.filter(e=>!bg(e)&&!yg(e)),n=e.types.some(e=>yg(e)),[r]=t;if(t.length!==1||r===void 0)return null;let i=h9(r);return i?.type===`number`?{type:`number`,nullable:n}:n?null:i}return null}function Zle(e){let t=e.ast;if(!Og(t))throw Error(`A schema form needs a Schema.Struct.`);return{fields:t.propertySignatures.map(e=>{let t=String(e.name),n=Y_(e.type),r=d9([e.type.annotations,...(e.type.checks??[]).map(e=>e.annotations)]),i=r.kind===`file`?{type:`files`}:h9(n);if(i===null)throw Error(`Schema field "${t}" has no form control. Annotate it with field({ render }) or a kind.`);return{name:t,valueType:i,optional:e.type.context?.isOptional===!0,annotation:r,title:Hte(e.type),description:Ute(e.type)}}),sections:f9(Vte(t))}}function g9(e){let t=e,n=!1,r=!1;for(;;)if(t instanceof ho)n=!0,t=t.unwrap();else if(t instanceof yo)r=!0,t=t.unwrap();else if(t instanceof xo)t=t.unwrap();else if(t instanceof ko)t=t.in;else return{node:t,optional:n,nullable:r}}function _9(e){if(e instanceof Qa){let t=e.options.map(e=>_9(e));return t.some(e=>e===null)?null:t.flatMap(e=>e??[])}let t=e instanceof co?e.options:e instanceof uo?[...e.values]:null;if(t===null)return null;let n=t.map(e=>p9(e));return n.every(hd)?n.map(e=>e.value):null}function Qle(e){let{node:t,nullable:n}=g9(e);if(t instanceof ua)return{type:`string`,literals:[]};if(t instanceof Na)return{type:`number`,nullable:n};if(t instanceof La)return{type:`boolean`};let r=_9(t);if(r!==null)return{type:`string`,literals:r};if(t instanceof qa){let e=g9(t.element).node;if(e instanceof ua)return{type:`strings`,literals:[]};let n=_9(e);return n===null?null:{type:`strings`,literals:n}}return null}function v9(e){let t=[e];for(;;){let e=t[t.length-1];if(e===void 0)break;let n=e instanceof ho||e instanceof yo||e instanceof xo?e.unwrap():e instanceof ko?e.in:e;if(n===e)break;t.push(n)}return t.reverse().map(e=>$n.get(e))}function y9(e){return v9(e).reduce((e,t)=>({...e,...t}),{})}function $le(e){return Object.entries(e.shape)}function eue(e){let t=g9(e).node;if(!(t instanceof Ya))throw Error(`A schema form needs a z.object.`);return{fields:$le(t).map(([e,t])=>{let n=d9(v9(t)),r=n.kind===`file`?{type:`files`}:Qle(t);if(r===null)throw Error(`Schema field "${e}" has no form control. Annotate it with field({ render }) or a kind.`);let i=y9(t);return{name:e,valueType:r,optional:g9(t).optional,annotation:n,title:i.title,description:i.description}}),sections:f9(y9(e))}}function tue(e,t){let n=t.options??{};return(e.length>0?e:Object.keys(n)).map(e=>{let t=n[e],r=t===void 0?{}:t instanceof Object?t:{label:t};return{value:e,label:r.label??u9(e),description:r.description,meta:r.meta,icon:r.icon,caption:r.caption,disabled:r.disabled===!0}})}function nue(e,t){let n=t.some(e=>e.icon!==void 0);switch(e.type){case`boolean`:return`switch`;case`number`:return`number`;case`strings`:return n?`icon-checkboxes`:`checkboxes`;case`files`:return`file`;case`string`:return t.length===0?`text`:t.length>12?`combobox`:n?`icon-radio`:t.some(e=>e.description!==void 0||e.meta!==void 0)||t.length<=3?`radio`:`select`}}function rue(e,t){switch(e.type){case`boolean`:return!1;case`number`:return e.nullable?null:0;case`strings`:case`files`:return[];case`string`:return t[0]?.value??``}}function iue(e){let t=e instanceof ca?eue(e):Zle(e),n=t.fields.map((e,t)=>{let{kind:n,...r}=e.annotation,i=tue(e.valueType.type===`string`||e.valueType.type===`strings`?e.valueType.literals:[],e.annotation),a=r.help??e.description;return{...r,name:e.name,label:r.label??e.title??u9(e.name),help:a,kind:n??nue(e.valueType,i),options:i,optionalInSchema:e.optional,index:t}}),r={};t.fields.forEach((e,t)=>{let i=n[t];i&&(r[e.name]=rue(e.valueType,i.options))});let i=e=>e.order??e.index,a=e=>e.section!==void 0&&Object.hasOwn(t.sections,e.section)?e.section:null,o=e=>n.filter(t=>a(t)===e).sort((e,t)=>i(e)-i(t)),s=Object.entries(t.sections).map(([e,t])=>({id:e,title:t.title,description:t.description,fields:o(e)}));return{fields:n,sections:[{id:null,title:void 0,description:void 0,fields:o(null)},...s].filter(e=>e.fields.length>0),defaults:r}}function b9(e){let t=e instanceof ca?e:Xy(e);return{"~standard":{...t[`~standard`],validate:e=>{let n=t[`~standard`].validate(e);return n instanceof Promise?n.then(e=>x9(e)):x9(n)}}}}function x9(e){return e.issues===void 0?e:{issues:e.issues.map(e=>e.path===void 0?e:{...e,path:e.path.slice(0,1)})}}var S9=`onServer`;function aue(e){let t=e?.querySelector(`[aria-invalid="true"]`);t?.matches(`input, select, textarea, button, [tabindex]`)?t.focus():t?.querySelector(`input, select, textarea, button`)?.focus()}function oue(e){return e.state.meta.errorMap.onServer!==void 0}function sue(e){e.setMeta(e=>({...e,errorMap:{...e.errorMap,[S9]:void 0}}))}function cue(e,t,n){e.setFieldMeta(t,e=>({...e,isBlurred:!0,errorMap:{...e.errorMap,[S9]:n}}))}function C9(e){let[t,n]=(0,K.useState)(null),[r,i]=(0,K.useState)(null),[a,o]=(0,K.useState)(e.defaultValues),[s,c]=(0,K.useState)(null);qZ(a,e.defaultValues)||(o(e.defaultValues),c(null));let{schema:l}=e,u=(0,K.useMemo)(()=>iue(l),[l]),d=(0,K.useMemo)(()=>b9(l),[l]),f=VQ({defaultValues:s??a,validators:{onChange:d,onSubmit:d},listeners:{onChange:({fieldApi:e})=>{n(null),i(null),oue(e)&&sue(e)}},onSubmit:async({value:t,formApi:r})=>{n(null),i(null);let a=await b9(l)[`~standard`].validate(t);if(a.issues){n(a.issues[0]?.message??`Check the form and try again.`);return}let o;try{o=await e.onSubmit(a.value,t)??{kind:`saved`}}catch(t){console.error(`SchemaForm submit failed`,t),n(e.failure??`Couldn't save changes. Try again.`);return}if(o.kind===`refused`){n(o.error??null);let e=r;for(let[t,n]of Object.entries(o.fields??{}))n!==void 0&&n.length>0&&cue(e,t,n);return}let s=o.values??t;c(s),r.reset(s),i(o.message??`Saved`),e.onSaved?.(s)}});return{description:u,form:f,error:t,saved:r,discard:()=>{n(null),i(null),f.reset()},submit:()=>f.handleSubmit()}}function w9(e){return{dirty:jQ(e.form.store,e=>!e.isDefaultValue),submitting:jQ(e.form.store,e=>e.isSubmitting),canSubmit:jQ(e.form.store,e=>e.canSubmit)}}function T9({model:e,submitLabel:t=`Save changes`,discardLabel:n,onCancel:r,cancelLabel:i,allowClean:a,layout:o,footer:s,children:c,disabled:l=!1,...u}){let{submitting:d}=w9(e),f=(0,K.useRef)(null);return(0,X.jsxs)(S3,{...u,ref:f,layout:o,busy:d,noValidate:!0,onSubmit:t=>{t.preventDefault(),e.form.state.isSubmitting||e.submit().then(()=>{setTimeout(()=>{aue(f.current)},0)})},children:[c??(0,X.jsx)(Jle,{model:e,disabled:l,layout:o}),s===void 0?(0,X.jsx)(due,{model:e,label:t,discardLabel:r===void 0?n:void 0,onCancel:r,cancelLabel:i,allowClean:a??r!==void 0,divider:r===void 0}):s]})}function lue({schema:e,defaultValues:t,onSubmit:n,onSaved:r,failure:i,...a}){let o=C9({schema:e,defaultValues:t,onSubmit:n,onSaved:r,failure:i});return(0,X.jsx)(T9,{...a,model:o})}function uue(e){return`model`in e?(0,X.jsx)(T9,{...e}):(0,X.jsx)(lue,{...e})}function due({model:e,label:t,discardLabel:n,onCancel:r,cancelLabel:i=`Cancel`,allowClean:a=!1,dirtyLabel:o=`Unsaved changes`,buttonProps:s,...c}){let{dirty:l,submitting:u}=w9(e),d=u?null:e.saved&&!l?(0,X.jsx)(J5,{tone:`success`,size:`compact`,label:e.saved}):l?(0,X.jsx)(J5,{tone:`neutral`,size:`compact`,label:o}):null;return(0,X.jsxs)(x3,{...c,error:e.error,status:d,children:[r?(0,X.jsx)(OI,{type:`button`,variant:`ghost`,disabled:u,onClick:r,children:i}):n&&l?(0,X.jsx)(OI,{type:`button`,variant:`ghost`,disabled:u,onClick:e.discard,children:n}):null,(0,X.jsx)(OI,{...s,type:`submit`,loading:u,disabled:u||!l&&!a,title:!l&&!a?`No changes to save`:void 0,children:t})]})}var E9={error:0,warning:1,info:2};function fue(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)||E9[e.tone]-E9[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 pue(e,t,n){let r=fue(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:EC(`Activity: ${r.label}`,1024),opens:`dialog`,expanded:n};return r.tone===void 0?i:{...i,tone:r.tone}}var mue={Setup:(0,X.jsx)(cL,{"aria-hidden":`true`,className:`size-[var(--stipe-icon-size-sm)]`}),Images:(0,X.jsx)(nL,{"aria-hidden":`true`,className:`size-[var(--stipe-icon-size-sm)]`}),Uploads:(0,X.jsx)(uL,{"aria-hidden":`true`,className:`size-[var(--stipe-icon-size-sm)]`})};function hue({notices:e,uploads:t,open:n,inset:r,onOpenChange:i,onDismiss:a,onDismissAll:o,onLoadMore:s}){return(0,X.jsx)(Z5,{className:`prints-activity-tray`,placement:`host`,align:`start`,...r===void 0?{}:{hostInset:r},items:[{id:`activity`,label:`Activity`,title:`Activity`,content:(0,X.jsx)(gue,{notices:e,uploads:t,onDismiss:a,onDismissAll:o,onLoadMore:s})}],openId:n?`activity`:null,onOpenChange:e=>{i(e===`activity`)}})}function gue({notices:e,uploads:t,onDismiss:n,onDismissAll:r,onLoadMore:i}){let a=[`Setup`,`Images`,`Uploads`].map(t=>({group:t,items:e.filter(e=>e.group===t)})).filter(e=>e.items.length);return(0,X.jsxs)(`div`,{className:`prints-instrument`,children:[a.map(({group:e,items:t})=>(0,X.jsxs)(`section`,{"aria-label":e,className:`prints-notice-group`,children:[(0,X.jsx)(NI,{level:3,children:e}),(0,X.jsx)(gse,{children:t.map(e=>(0,X.jsx)(Q5,{icon:mue[e.group],primary:e.title,secondary:e.detail,actions:(0,X.jsxs)(`div`,{className:`prints-notice-actions`,"aria-label":`Actions for ${e.title}`,children:[e.actions?.map(e=>(0,X.jsx)(OI,{variant:`ghost`,size:`xs`,onClick:e.run,children:e.label},e.label)),e.blocking?null:(0,X.jsx)(AI,{"aria-label":`Dismiss ${e.title}`,icon:(0,X.jsx)(dL,{"aria-hidden":`true`}),onClick:()=>{n(e.key)}})]})},e.key))})]},e)),e.length?null:(0,X.jsx)($5,{children:`All caught up.`}),t&&t.items.length>0?(0,X.jsxs)(`section`,{"aria-label":`Upload queue`,className:`prints-upload-bank`,children:[(0,X.jsx)(NI,{level:3,children:`Uploading`}),(0,X.jsx)(G7,{...t})]}):null,(0,X.jsxs)(`div`,{className:`prints-panel-footer`,children:[(0,X.jsx)(`span`,{className:`prints-footer-note`,children:`Clear keeps setup notices`}),(0,X.jsx)(OI,{variant:`ghost`,size:`xs`,disabled:!e.some(e=>!e.blocking),onClick:r,children:`Clear`}),i?(0,X.jsx)(OI,{variant:`ghost`,size:`xs`,onClick:i,children:`Load more activity`}):null]})]})}function _ue({folder:e}){return(0,X.jsx)(F5,{open:e.editing,onOpenChange:e.setEditing,children:(0,X.jsxs)(L5,{children:[(0,X.jsx)(z5,{children:(0,X.jsx)(B5,{children:`Save prints to`})}),(0,X.jsx)(yue,{folder:e},e.computerId),(0,X.jsx)(R5,{children:(0,X.jsx)(V5,{render:(0,X.jsx)(OI,{variant:`outline`,size:`sm`}),children:`Close`})})]})})}var vue=q({path:Yb.check(wb(Zy(UA),{message:`Enter an absolute Computer folder, such as /media.`})).annotate(l9({label:`Folder`,placeholder:`/media`}))});function yue({folder:e}){let t=(0,K.useRef)(!1),n=C9({schema:vue,defaultValues:{path:e.path??`/media`},onSubmit:async({path:n})=>{let r=await e.choose(n,t.current);return r?{kind:`refused`,fields:{path:r}}:{kind:`saved`}}}),r=e=>{t.current=e,n.form.setFieldMeta(`path`,e=>({...e,errorMap:{...e.errorMap,onServer:void 0}}))},i=e.busy||!e.writable;return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(uue,{model:n,disabled:i,footer:(0,X.jsxs)(x3,{divider:!1,children:[(0,X.jsx)(XN,{className:`[--caps-keycap-width:auto]`,label:`Use`,type:`submit`,disabled:i,onClick:()=>{r(!1)}}),(0,X.jsx)(XN,{className:`[--caps-keycap-width:auto]`,label:`Create`,type:`submit`,disabled:i,onClick:()=>{r(!0)}})]})}),e.error?(0,X.jsx)(Q5,{role:`alert`,icon:(0,X.jsx)(tL,{"aria-hidden":`true`,className:`size-[var(--stipe-icon-size-sm)]`}),primary:e.error}):(0,X.jsx)($5,{children:e.writable?`Prints saves new images and uploads here and shows this folder as your gallery.`:`This Computer is read-only for Prints, so the folder can’t change.`})]})}function bue({connected:e,mediaCapability:t,modelsError:n,retryModels:r,modelsLoading:i,models:a,canGenerate:o,canWrite:s,generationError:c,recoveryError:l,pendingGenerations:u,activeGenerations:d,gallerySlots:f,computerId:p,failed:m,uploadError:h,uploads:g,permissions:_,resume:v,discard:y,retryUpload:b}){let x=[];if(e)p===null?x.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&&x.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:()=>{_()}}]}):x.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}]}):x.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=ox(new Y(`Prints disconnected`,{code:`DISCONNECTED`,retryable:!0}));x.push({key:`disconnected`,group:`Setup`,tone:`warning`,blocking:!0,short:e.title,title:e.title,detail:e.message})}if(e&&p!==null&&!s&&x.push({key:`read-only`,group:`Setup`,tone:`info`,blocking:!0,short:`Read-only`,title:`Read-only Computer`,detail:`Uploads and new prints are off.`}),c!==null){let e=c.mediaKind??`media`;x.push({key:c.key,group:`Images`,tone:`error`,short:{image:`Image failed`,video:`Video failed`,media:`Media failed`}[e],title:`Couldn’t create ${e}`,detail:c.message,actions:c.billing?[{label:`Open Billing`,run:c.billing}]:c.retry?[{label:`Retry`,run:c.retry}]:[]})}l!==null&&x.push({key:`recovery:${l}`,group:`Images`,tone:`error`,short:`Retry blocked`,title:l});for(let e of u){if(d.has(e.reference.requestId)||f.some(t=>t.computerId===e.reference.computerId&&t.path===e.input.destination.path))continue;let t=`Unfinished ${ML(a,e.input.settings.model)?.kind??`media`}`;x.push({key:`unfinished:${e.reference.requestId}`,group:`Images`,tone:`info`,short:t,title:t,detail:e.reference.computerId===p?e.input.settings.prompt:`${e.input.settings.prompt} · on Computer ${e.reference.computerId}`,actions:[...e.reference.computerId===p?[{label:`Resume`,run:()=>{v(e)}}]:[],{label:`Discard`,run:()=>{y(e)}}]})}m.length>0&&x.push({key:`files:${m.join(`|`)}`,group:`Images`,tone:`error`,short:`Couldn’t open images`,title:`Couldn’t open some images`,detail:m.join(`, `)}),h!==null&&x.push({key:`uploads:${h}`,group:`Uploads`,tone:`error`,short:`Upload failed`,title:`Couldn’t add images`,detail:h});for(let e of g)(e.status===`error`||e.status===`cancelled`)&&x.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:()=>{b(e.id)}}]});return x}function xue(e,t){let n=ES(xM(e)),r=OS(_A({queryKey:vM.dismissals(e),mutationFn:({owner:e,id:t,keys:n})=>Dj(e.capabilities,{operation:`dismiss-notices`,computerId:t,keys: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 D9=0,O9=1,Sue=2,Cue=0,k9=1;function wue(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 Tue(e,t){let n=e.list;if(n.index===t)return n.next===null?Cue:(e.list=n.next,k9);let r=n;for(n=n.next;n!==null;){if(n.index===t)return r.next=n.next,k9;r=n,n=n.next}}var A9={low:0,max:0,high:0,C:Sue,P:void 0,R:void 0,L:void 0,list:void 0};A9.P=A9,A9.L=A9,A9.R=A9;function j9(e){let t=e.high;e.max=e.L===A9&&e.R===A9?t:e.L===A9?Math.max(e.R.max,t):e.R===A9?Math.max(e.L.max,t):Math.max(Math.max(e.L.max,e.R.max),t)}function M9(e){let t=e;for(;t.P!==A9;)j9(t.P),t=t.P}function N9(e,t){if(t.R===A9)return;let n=t.R;t.R=n.L,n.L!==A9&&(n.L.P=t),n.P=t.P,t.P===A9?e.root=n:t===t.P.L?t.P.L=n:t.P.R=n,n.L=t,t.P=n,j9(t),j9(n)}function P9(e,t){if(t.L===A9)return;let n=t.L;t.L=n.R,n.R!==A9&&(n.R.P=t),n.P=t.P,t.P===A9?e.root=n:t===t.P.R?t.P.R=n:t.P.L=n,n.R=t,t.P=n,j9(t),j9(n)}function F9(e,t,n){t.P===A9?e.root=n:t===t.P.L?t.P.L=n:t.P.R=n,n.P=t.P}function Eue(e,t){let n;for(;t!==A9&&t.C===O9;)t===t.P.L?(n=t.P.R,n.C===D9&&(n.C=O9,t.P.C=D9,N9(e,t.P),n=t.P.R),n.L.C===O9&&n.R.C===O9?(n.C=D9,t=t.P):(n.R.C===O9&&(n.L.C=O9,n.C=D9,P9(e,n),n=t.P.R),n.C=t.P.C,t.P.C=O9,n.R.C=O9,N9(e,t.P),t=e.root)):(n=t.P.L,n.C===D9&&(n.C=O9,t.P.C=D9,P9(e,t.P),n=t.P.L),n.R.C===O9&&n.L.C===O9?(n.C=D9,t=t.P):(n.L.C===O9&&(n.R.C=O9,n.C=D9,N9(e,n),n=t.P.L),n.C=t.P.C,t.P.C=O9,n.L.C=O9,P9(e,t.P),t=e.root));t.C=O9}function Due(e){for(;e.L!==A9;)e=e.L;return e}function Oue(e,t){let n;for(;t.P.C===D9;)t.P===t.P.P.L?(n=t.P.P.R,n.C===D9?(t.P.C=O9,n.C=O9,t.P.P.C=D9,t=t.P.P):(t===t.P.R&&(t=t.P,N9(e,t)),t.P.C=O9,t.P.P.C=D9,P9(e,t.P.P))):(n=t.P.P.L,n.C===D9?(t.P.C=O9,n.C=O9,t.P.P.C=D9,t=t.P.P):(t===t.P.L&&(t=t.P,P9(e,t)),t.P.C=O9,t.P.P.C=D9,N9(e,t.P.P)));e.root.C=O9}function kue(){let e={root:A9,size:0},t={};return{insert(n,r,i){let a=e.root,o=A9;for(;a!==A9&&(o=a,n!==o.low);)a=n<a.low?a.L:a.R;if(n===o.low&&o!==A9){if(!wue(o,r,i))return;o.high=Math.max(o.high,r),j9(o),M9(o),t[i]=o,e.size++;return}let s={low:n,high:r,max:r,C:D9,P:o,L:A9,R:A9,list:{index:i,high:r,next:null}};o===A9?e.root=s:(s.low<o.low?o.L=s:o.R=s,M9(s)),Oue(e,s),t[i]=s,e.size++},remove(n){let r=t[n];if(r===void 0)return;delete t[n];let i=Tue(r,n);if(i===void 0)return;if(i===k9){r.high=r.list.high,j9(r),M9(r),e.size--;return}let a=r,o=a.C,s;r.L===A9?(s=r.R,F9(e,r,r.R)):r.R===A9?(s=r.L,F9(e,r,r.L)):(a=Due(r.R),o=a.C,s=a.R,a.P===r?s.P=a:(F9(e,a,a.R),a.R=r.R,a.R.P=a),F9(e,r,a),a.L=r.L,a.L.P=a,a.C=r.C),j9(s),M9(s),o===O9&&Eue(e,s),e.size--},search(t,n,r){let i=[e.root];for(;i.length!==0;){let e=i.pop();if(!(e===A9||t>e.max)&&(e.L!==A9&&i.push(e.L),e.R!==A9&&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 Aue=e=>{let t=K.useRef(e);return K.useEffect(()=>{t.current=e}),t},I9=(e,t)=>{let n=t||jue,r,i;return function(){return r&&n(arguments,r)?i:i=e.apply(null,r=arguments)}},jue=(e,t)=>e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3],L9=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]}}}},Mue=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}}},Nue=(e,t)=>{let n,{g:r,s:i}=Mue(e);return function(){return(n=r(arguments))===void 0?i(arguments,t.apply(null,arguments)):n}},Pue=new WeakMap;function Fue(){let e=K.useState(Iue)[1];return K.useRef(()=>e({})).current}var Iue={},z9=K.createElement;function Lue(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=Bue,overscanBy:h=2,scrollTop:g,isScrolling:_,height:v,render:y,onRender:b}=e,x=0,S,C=Fue(),w=Hue(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=Aue(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(z9(d,{key:a,ref:w(e),role:F,style:typeof f==`object`&&f?Object.assign({},o,f):o},V9(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=Vue(E);for(;t<M+e;t++){let e=r[t],i=m(e,t);P.push(z9(d,{key:i,ref:w(t),role:F,style:typeof f==`object`?Object.assign({},n,f):n},V9(y,t,e,E)))}}K.useEffect(()=>{typeof I.current==`function`&&S!==void 0&&I.current(x,S,r),B9=`1`},[x,S,r,I]),K.useEffect(()=>{R&&C()},[R,t]);let z=Rue(_,k(T,p));return z9(i,{ref:u,key:B9,id:a,role:c,className:o,tabIndex:l,style:typeof s==`object`?zue(z,s):z,children:P})}var B9=`0`,V9=Nue([L9,{},WeakMap,L9],(e,t,n,r)=>z9(e,{index:t,data:n,width:r})),Rue=I9((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})),H9=(e,t)=>e[0]===t[0]&&e[1]===t[1],zue=I9((e,t)=>Object.assign({},e,t),H9);function Bue(e,t){return t}var Vue=I9(e=>({width:e,zIndex:-1e3,visibility:`hidden`,position:`absolute`,writingMode:`horizontal-tb`}),(e,t)=>e[0]===t[0]),Hue=I9((e,t)=>n=>r=>{r!==null&&(t&&(t.observe(r),Pue.set(r,n)),e.get(n)===void 0&&e.set(n,r.offsetHeight))},H9),Uue=function(e,t,n,r){n===void 0&&(n=0),r===void 0&&(r=n);let i=kue(),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=Wue(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}}},Wue=(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},Gue={queued:`Waiting to start`,generating:`Generating`,refining:`Refining`,done:void 0,failed:void 0},Kue=(0,K.forwardRef)(function({status:e,children:t,aspectRatio:n,label:r,indicator:i,failure:a,className:o,style:s,...c},l){let u=(0,K.useRef)(null);(0,K.useImperativeHandle)(l,()=>u.current);let d=(0,K.useRef)(e),[f,p]=(0,K.useState)(!1),[m,h]=(0,K.useState)(e);m!==e&&(h(e),p(e===`done`)),(0,K.useLayoutEffect)(()=>{let t=u.current,n=d.current;if(d.current=e,!t||n===e)return;if(!sP(t)){p(!1);return}let r=rP(t),i=oP(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??Gue[e],v=e===`done`||e===`refining`;return(0,X.jsxs)(`div`,{...c,ref:u,className:Z(`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,X.jsxs)(`div`,{className:Z(`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,X.jsx)(EI,{decorative:!0,size:`lg`,variant:`bloom`}):null,_===void 0?null:(0,X.jsx)(uP,{children:_})]}),v?(0,X.jsx)(`div`,{className:`caps-generation-media`,"data-layer":`media`,children:t}):null,e===`failed`&&a!==void 0?(0,X.jsx)(`div`,{className:`caps-generation-failure`,"data-layer":`failure`,role:`alert`,children:a}):null]})}),U9=0,que=320,Jue=656;function Yue(e,t){return e<=0||!Number.isFinite(t)||t<=0?0:e===1?1:e<=4?2:t>=1280?4:t>=Jue?3:2}function W9({item:e}){return CX(e.path)?(0,X.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,X.jsx)(`img`,{alt:e.path,className:`block h-full w-full object-cover`,"data-media-thumb":!0,src:e.url})}var Xue=(0,K.memo)(function({item:e}){let t=(0,K.useRef)(null);(0,K.useEffect)(()=>{e.onVisible?.()},[e.onVisible]);let[n,r]=(0,K.useState)(e.pending===!0&&!e.onVisible);return e.pending&&!e.onVisible&&!n&&r(!0),(0,K.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 U3(async()=>{let{animate:e,spring:t}=await Promise.resolve().then(()=>bie);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,X.jsxs)(`div`,{ref:t,className:`prints-gallery-tile`,"data-referenced":e.referenced?!0:void 0,children:[(0,X.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,onClick:()=>{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,X.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||e.error?(0,X.jsx)(Kue,{"data-media-pending":e.pending?`true`:void 0,failure:e.error?(0,X.jsx)(`span`,{title:e.error,className:`prints-tile-failed`,children:(0,X.jsx)(J5,{size:`compact`,appearance:`chip`,glyph:`bang`,tone:`error`,label:`Not saved`})}):void 0,indicator:(0,X.jsx)(EI,{decorative:!0,size:`fill`,tone:`accent`,variant:`bloom`}),label:e.pendingLabel??`Preparing image…`,status:e.pending?e.error?`failed`:`generating`:`done`,children:e.pending?null:(0,X.jsx)(W9,{item:e})}):(0,X.jsx)(W9,{item:e})})}),e.error?(0,X.jsxs)(`div`,{className:`prints-gallery-pending-actions`,children:[e.onRetry?(0,X.jsx)(AI,{"aria-label":`Retry ${e.path}`,icon:(0,X.jsx)(oL,{}),onClick:e.onRetry}):null,e.onDismiss?(0,X.jsx)(AI,{"aria-label":`Dismiss ${e.path}`,icon:(0,X.jsx)(dL,{}),onClick:e.onDismiss}):null]}):null,(0,X.jsxs)(`div`,{className:`prints-gallery-tools`,children:[!e.pending&&e.onInfo?(0,X.jsx)(AI,{"aria-label":`Image info: ${e.path}`,title:`Image info (I)`,"aria-keyshortcuts":`I`,onClick:e.onInfo,icon:(0,X.jsx)(rL,{})}):null,!e.pending&&e.onToggleReference?(0,X.jsx)(AI,{className:`prints-gallery-reference`,"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,X.jsx)(XI,{}):(0,X.jsx)(nL,{})}):null]})]})}),Zue=(0,K.memo)(function({children:e,style:t,...n}){return(0,X.jsx)(`div`,{"data-media-grid":!0,...n,style:t,children:e})});function Que(e,t){let[n,r]=(0,K.useState)({height:0,width:0});return(0,K.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 $ue(e){let[t,n]=(0,K.useState)(0),[r,i]=(0,K.useState)(!1);return(0,K.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 ede(e,t){let n=Math.max(1,Yue(e.length,t));return(0,K.useMemo)(()=>{let r=Math.floor((t-(n-1)*U9)/n),i=Uue(n,r,U9);return r>0&&e.forEach((e,t)=>{let n=e.height>0?e.width/e.height:1;i.set(t,r/n)}),i},[e,t,n])}var tde=(0,K.memo)(function({data:e,width:t}){let n=e.height>0?e.width/e.height:1;return(0,X.jsx)(`div`,{"data-media-tile":e.key,style:{height:t/n,width:t},children:(0,X.jsx)(Xue,{item:e})})});function G9(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 nde(e,t,n){let r=e.ownerDocument;(r.activeElement!==r.body||G9(e,t))&&n()}function K9(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 rde=(0,K.memo)(function({items:e,scrollRef:t,focus:n}){let r=Que(t,e.length),i=r.width||que,a=ede(e,i),{isScrolling:o,scrollTop:s}=$ue(t),c=(0,K.useRef)(new Set),l=(0,K.useRef)(null),u=(0,K.useRef)(null);(0,K.useEffect)(()=>{if(!n)return;let o=l.current===n.requestId;if(o&&u.current===i)return;let s=t.current,c=e.findIndex(e=>e.key===n.key),d=a.get(c);if(!s||!d||r.height===0)return;let f=s.querySelector(`[data-media-grid]`);if(!f)return;let p=K9(s,f,d);if(o){nde(s,n.key,()=>{u.current=i});return}G9(s,n.key)?(l.current=n.requestId,u.current=i,n.onFocus()):s.scrollTo({top:p,behavior:`instant`})},[n,e,r.height,t,s,a,i]),(0,K.useEffect)(()=>{let n=t.current;if(!n||r.width===0||r.height===0)return;let i=e.reduce((e,t,n)=>t.pending&&!t.onVisible&&!c.current.has(t.key)?n:e,-1);if(c.current=new Set(e.map(e=>e.key)),i<0)return;let o=a.get(i),s=n.querySelector(`[data-media-grid]`);if(!o||!s)return;let l=s.getBoundingClientRect().top-n.getBoundingClientRect().top+n.scrollTop+o.top,u=l+o.height;l>=n.scrollTop&&u<=n.scrollTop+n.clientHeight||n.scrollTo({top:Math.max(0,l-Math.max(0,(n.clientHeight-o.height)/2)),behavior:window.matchMedia(`(prefers-reduced-motion: reduce)`).matches?`instant`:`smooth`})},[e,r.width,r.height,t,a]);let d=(0,K.useCallback)(({data:e,width:t})=>(0,X.jsx)(tde,{data:e,width:t}),[]);return Lue({as:Zue,height:r.height,isScrolling:o,itemKey:e=>e.key,items:e,overscanBy:2,positioner:a,render:d,scrollTop:s})});function ide({items:e,scrollRef:t,focus:n}){return(0,X.jsx)(`section`,{"data-media-mosaic":!0,children:(0,X.jsx)(rde,{items:e,scrollRef:t,focus:n})})}function ade(e,t,n){let r=new Map(e.map(e=>[e.key,e])),i=new Set(t.map(e=>e.key));return[...t.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 q9=`prints-prompt-counter`;function ode({busy:e,disabled:t,draft:n,label:r,onGenerate:i,promptOver:a}){return(0,X.jsx)(cse,{"aria-describedby":a?q9:void 0,"aria-label":r,className:`prints-generate`,"data-generation-submit":!0,disabled:t||a,onClick:i,state:Ese({draft:n,busy:e}),title:r})}function sde({caretRequest:e,disabled:t,maxLength:n,addedLength:r=0,menu:i,mentionCount:a,onCaret:o,onChange:s,onMentionDismiss:c,onMentionMove:l,onMentionPick:u,onSend:d,onSlashMove:f,onSlashPick:p,placeholder:m,slashCount:h,value:g}){let _=(0,K.useRef)(null),v=(0,K.useRef)(g),[y,b]=(0,K.useState)([]),[x,S]=(0,K.useState)(-1),[C,w]=(0,K.useState)(!1),T=(0,K.useRef)(!1),E=(0,K.useRef)(!1);v.current=g,(0,K.useLayoutEffect)(()=>{if(C||t||!E.current)return;E.current=!1;let e=_.current;e&&e.ownerDocument.activeElement===e.ownerDocument.body&&e.focus({preventScroll:!0})},[t,C]),(0,K.useLayoutEffect)(()=>{let t=_.current;!t||e?.value!==g||(t.setSelectionRange(e.caret,e.caret),t.focus({preventScroll:!0}))},[e,g]),Ose(_,g);let D=(0,K.useCallback)(async()=>{let e=v.current.trim();if(!(!e||t||T.current)&&!(n!==void 0&&e.length+r>n)){E.current=_.current===_.current?.ownerDocument.activeElement,T.current=!0,w(!0);try{if(!await d())return;b(t=>t.at(-1)===e?t:[...t,e].slice(-20)),S(-1)}finally{T.current=!1,w(!1)}}},[t,n,d,r]),O=g.trim().length,k=O>0?O+r:0,A=n!==void 0&&k>n;return(0,X.jsxs)(`div`,{className:`relative min-w-0 flex-1`,children:[(0,X.jsx)(e7,{"aria-invalid":A?!0:void 0,"aria-label":`Image prompt`,className:`w-full`,"data-generation-prompt":!0,...vse(i),disabled:t===!0||C,onChange:e=>{s(e.currentTarget.value),o(e.currentTarget.selectionStart),S(-1)},onSelect:e=>{o(e.currentTarget.selectionStart)},onKeyDown:e=>{if(H5(e))return;let t=_se(e);if(a>0&&t!==null){e.preventDefault(),t===`next`?l(1):t===`previous`?l(-1):t===`accept`?u():c();return}if(g.startsWith(`/`)&&t!==null&&(h>0||t===`dismiss`||e.key===`Enter`)){if(e.preventDefault(),t===`dismiss`)s(g.slice(1));else if(h)t===`next`?f(1):t===`previous`?f(-1):p();else return;return}if(e.key===`Enter`&&!e.shiftKey){e.preventDefault(),D();return}if(e.key===`ArrowUp`&&_.current?.selectionStart===0&&y.length&&(x===-1||x>0)){e.preventDefault();let t=x===-1?y.length-1:x-1;S(t),s(y[t]);return}if(e.key===`ArrowDown`&&x!==-1){e.preventDefault();let t=x+1;t>=y.length?(S(-1),s(``)):(S(t),s(y[t]))}},placeholder:m,ref:_,rows:1,value:g}),n!==void 0&&k>0?(0,X.jsx)(`p`,{className:`px-3 pb-1 text-xs tabular-nums ${A?`text-error`:`text-dim`}`,"data-prompt-counter":!0,id:q9,role:A?`alert`:`status`,children:A?`${String(k)} / ${String(n)} characters. This model accepts up to ${String(n)}; shorten the prompt${r>0?` or its style and characters`:``} by ${String(k-n)} or pick another model.`:`${String(k)} / ${String(n)}`}):null]})}function cde({index:e,listId:t,matches:n,onHighlight:r,onPick:i}){return(0,X.jsx)(n7,{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 lde(e,t){let[n,r]=(0,K.useState)(0),i=t.startsWith(`/`),a=(0,K.useMemo)(()=>{if(!i)return[];let n=Y3(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,K.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 ude({images:e,index:t,listId:n,matches:r,onHighlight:i,onPick:a}){return(0,X.jsx)(n7,{open:!0,rows:r.map(t=>{let n=t.references.at(0)?.path,r=e.find(e=>e.path===n);return{key:String(t.id),label:`@${t.name}`,detail:t.description||void 0,media:(0,X.jsx)(`span`,{className:`prints-character-thumb mask mask-squircle`,children:r?(0,X.jsx)(`img`,{src:r.url,alt:``}):null})}}),selected:t,listId:n,label:`Characters`,kind:`characters`,onHighlight:i,onChoose:a})}function dde(e,t){let[n,r]=(0,K.useState)(0),[i,a]=(0,K.useState)(0),[o,s]=(0,K.useState)(null),[c,l]=(0,K.useState)(null),u=o===t?null:uM(t,n),d=u?dM(e,u.query):[];return(0,K.useEffect)(()=>{a(0)},[t]),{caretRequest:c,matches:d,index:i,setCaret:r,highlight:a,dismiss:()=>{s(t)},move:e=>{a(t=>d.length?(t+e+d.length)%d.length:0)},complete:e=>{let i=d.at(e);if(!u||!i)return null;let a=`${t.slice(0,u.start)}@${i.name} ${t.slice(n)}`,o=u.start+i.name.length+2;return l({value:a,caret:o}),r(o),a}}}function fde(e){let t=mx(),n=ES(wM(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(vM.characters(e),n)}}),i=OS(r((e,t,n)=>gM(e.capabilities,t,n))),a=OS(r((e,t,n)=>_M(e.capabilities,t,n))),o=i.error??a.error??n.error;return{characters:n.data?.characters??[],error:o?ox(o).message:null,busy:i.isPending||a.isPending,save:(e,t)=>{i.mutate(e,{onSuccess:t})},remove:(e,t)=>{a.mutate(e,{onSuccess:t})}}}var J9=Zy(Xj),Y9=e=>e.split(`/`).at(-1)??e;function pde({paths:e,images:t}){return(0,X.jsx)(`span`,{className:`flex gap-xs`,children:e.map(e=>{let n=t.find(t=>t.path===e);return(0,X.jsx)(`span`,{className:`prints-character-thumb mask mask-squircle`,title:e,children:n?(0,X.jsx)(`img`,{src:n.url,alt:Y9(e)}):null},e)})})}function mde({characters:e,images:t,open:n,onOpenChange:r,busy:i,error:a,canUpload:o,onUpload:s,onSave:c,onDelete:l}){let[u,d]=(0,K.useState)(null),f=(0,K.useId)(),p=u?.name.trim()??``,m=p.startsWith(`@`)?p.slice(1):p,h=[];m===``?h.push(`Enter a character name.`):m.length>32?h.push(`Use 32 characters or fewer for the name.`):J9(m)||h.push(`Use only letters, numbers, hyphens (-) and underscores (_).`),u?.references.length===0&&h.push(`Select at least one reference image.`),i&&h.push(`Wait for the current character change to finish, then save.`);let g=h.length>0,_=g?f:void 0;return(0,X.jsx)(F5,{open:n,onOpenChange:e=>{e||d(null),r(e)},children:(0,X.jsxs)(L5,{children:[(0,X.jsx)(z5,{children:(0,X.jsx)(B5,{children:`Characters`})}),(0,X.jsxs)(`div`,{className:`flex flex-col gap-sm`,children:[e.length===0&&u===null?(0,X.jsx)(`p`,{className:`text-sm`,children:`No characters yet. Save one, then type @name in a prompt to keep it the same in every image.`}):(0,X.jsx)(`ul`,{className:`flex flex-col gap-sm`,"aria-label":`Saved characters`,children:e.map(e=>(0,X.jsxs)(`li`,{className:`flex items-center justify-between gap-sm`,children:[(0,X.jsxs)(`span`,{className:`flex min-w-0 items-center gap-sm`,children:[(0,X.jsx)(pde,{paths:e.references.map(e=>e.path),images:t}),(0,X.jsxs)(`span`,{className:`min-w-0 truncate`,children:[`@`,e.name]})]}),(0,X.jsxs)(`span`,{className:`flex gap-xs`,children:[(0,X.jsx)(OI,{size:`xs`,variant:`ghost`,type:`button`,onClick:()=>{d(e)},children:`Edit`}),(0,X.jsx)(OI,{size:`xs`,variant:`ghost`,type:`button`,disabled:i,onClick:()=>{l(e,()=>{u?.id===e.id&&d(null)})},children:`Delete`})]})]},e.id))}),u===null?(0,X.jsx)(OI,{size:`xs`,type:`button`,onClick:()=>{d({name:``,description:``,references:[]})},children:`New character`}):(0,X.jsxs)(`div`,{className:`flex flex-col gap-sm`,children:[(0,X.jsx)(A4,{"aria-label":`Character name`,"aria-invalid":!J9(m),"aria-describedby":_,maxLength:33,placeholder:`Name, typed as @name`,value:u.name,onChange:e=>{d({...u,name:e.currentTarget.value})}}),(0,X.jsx)(e7,{"aria-label":`Character description`,maxLength:500,rows:4,placeholder:`Short description added to the prompt, e.g. a tall girl with silver hair and a red scarf`,value:u.description,onChange:e=>{d({...u,description:e.currentTarget.value})}}),(0,X.jsxs)(`div`,{className:`flex items-center justify-between gap-sm`,children:[(0,X.jsxs)(`span`,{className:`text-xs`,children:[`Reference images · `,u.references.length,` selected, up to`,` `,8]}),(0,X.jsxs)(OI,{size:`xs`,variant:`ghost`,type:`button`,disabled:!o,onClick:s,children:[(0,X.jsx)(uL,{"aria-hidden":`true`,size:14}),`Upload`]})]}),t.length===0?(0,X.jsx)(`p`,{className:`text-xs`,children:`No images in the Prints folder yet. Upload one to use it as a reference.`}):(0,X.jsx)(`ul`,{className:`prints-character-picker`,"aria-label":`Reference images`,children:t.map(e=>{let t=u.references.some(t=>t.path===e.path);return(0,X.jsx)(`li`,{title:e.path,children:(0,X.jsxs)(`label`,{className:`prints-character-pick`,children:[(0,X.jsx)(`img`,{src:e.url,alt:``}),(0,X.jsx)(`span`,{className:`prints-character-check`,children:(0,X.jsx)(i7,{"aria-label":`Use ${Y9(e.path)}`,checked:t,disabled:!t&&u.references.length>=8,onChange:()=>{d({...u,references:t?u.references.filter(t=>t.path!==e.path):[...u.references,{path:e.path}]})}})})]})},e.path)})}),g?(0,X.jsx)(`p`,{id:f,role:`status`,className:`text-xs`,children:h.join(` `)}):null,(0,X.jsxs)(`div`,{className:`flex gap-xs`,children:[(0,X.jsx)(OI,{size:`xs`,variant:`primary`,type:`button`,disabled:g,"aria-describedby":_,onClick:()=>{c({id:u.id,name:m,description:u.description.trim(),references:u.references},()=>{d(null)})},children:`Save character`}),(0,X.jsx)(OI,{size:`xs`,variant:`ghost`,type:`button`,onClick:()=>{d(null)},children:`Cancel`})]})]}),a?(0,X.jsx)(`p`,{role:`alert`,className:`text-xs`,children:a}):null]}),(0,X.jsx)(R5,{children:(0,X.jsx)(V5,{render:(0,X.jsx)(OI,{variant:`outline`,size:`sm`}),children:`Close`})})]})})}var X9=q({destination:rb(vb(lb)),height:rb(zb),model:rb(lb),prompt:rb(lb),references:rb(mb(q({computerId:rb(lb),path:lb,role:rb(_b([`first-frame`,`last-frame`,`reference`]))}))),generateAudio:rb(vb(db)),steps:rb(vb(zb)),style:rb(vb(lb)),width:rb(zb)}),hde=so(da(),Uo()).parse(structuredClone(Qb(X9,{onExcessProperty:`error`}).schema)),Z9=(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`}}}),gde=Z9(`inspect-generation-draft`,`Inspect image draft`,`Read the current Prints image form and available models`),_de=Z9(`set-generation-draft`,`Edit image draft`,`Set selected Prints image form fields; this does not generate an image`,hde),vde=Z9(`submit-generation-draft`,`Generate image`,`Submit the current Prints image form using the same action as the Send button`);function yde(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(gde,()=>{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(_de,({arguments:e})=>{if(n)return;let r=tb(X9,{onExcessProperty:`error`})(e);t.setDraft(r)}),i(vde,async()=>{if(!n)return{accepted:await t.submit()}}),()=>{if(!n){n=!0;for(let e of r)e();r.clear()}}}function bde(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()}},...hL.map((t,n)=>({id:`size-${t}`,title:`Use ${t} size`,category:`Prompt`,description:`Use ${String(mL[t].width)} × ${String(mL[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 xde(e,t){let n=(0,K.useRef)(e);n.current=e;let r=Wk(t,{sourceId:`media-prompt`,namespace:`media`},(0,K.useCallback)(()=>bde(()=>n.current),[])),i=(0,K.useSyncExternalStore)(r.subscribe,r.snapshot,r.snapshot);return{items:(0,K.useMemo)(()=>G3(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 Sde(e){let t=mx(),n=ES(SM(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(vM.styles(e),n)}}),i=OS(r((e,t,n)=>Kj(e.capabilities,t,n))),a=OS(r((e,t,n)=>qj(e.capabilities,t,n))),o=i.error??a.error??n.error;return{styles:n.data?.styles??[],error:o?ox(o).message:null,busy:i.isPending||a.isPending,save:(e,t)=>{i.mutate(e,{onSuccess:n=>{t(n.styles.find(t=>t.name===e.name))}})},remove:(e,t)=>{a.mutate(e,{onSuccess:t})}}}function Q9(e){let t=e.filter(e=>e.kind===`video`&&e.video!==null&&e.input.maxReferences>=1&&e.video.referenceRoles.includes(`first-frame`));return t.find(e=>e.video?.provider===`seedance`)??t.at(0)}function Cde(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 wde(e,t){let{lineage:n,printPath:r,models:i,current:a}=t,o=e===`animate`?Q9(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=ML(i,n.model),c=o??s??ML(i,a.model);if(c===void 0)return{kind:`refused`,message:`Choose a model from the granted registry.`};let l=o===void 0&&s===void 0?`This print was made with ${n.model}, which is no longer available. Loaded it with ${jL(c)} instead.`:null,u=n.references.slice(0,n.typed.references),d=e===`animate`?{path:r,role:`first-frame`}:{path:r},f=[d,...u.filter(e=>!fL(e,t.printComputerId)||e.path!==r)];if(e!==`reuse`&&c.input.maxReferences===0)return{kind:`refused`,message:`${c.label} does not take reference images.`};let p=e===`reuse`?u:e===`remix`?f:[d],m=NL(a,c),h={width:n.width??m.width,height:n.height??m.height},g=o===void 0?AL(h,c,void 0):Cde(c,h.width,h.height)??m,_=o===void 0&&c.input.steps!==`fixed`&&n.steps!==null&&c.id===n.model?n.steps:m.steps,v=n.style!==null&&t.styles.includes(n.style)?n.style:void 0;return{kind:`draft`,notice:l,draft:{...m,destination:void 0,prompt:n.typed.prompt,references:p,steps:_,style:v,width:g.width,height:g.height}}}function Tde({id:e,styles:t,selected:n,disabled:r,onSelect:i}){let a=n===void 0||t.some(e=>e.name===n);return(0,X.jsxs)(N3,{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,X.jsx)(`option`,{value:``,children:`No style`}),a?null:(0,X.jsx)(`option`,{value:n,children:n}),t.map(e=>(0,X.jsx)(`option`,{value:e.name,children:e.name},e.id))]})}function Ede({styles:e,selected:t,open:n,onOpenChange:r,busy:i,error:a,onSelect:o,onSave:s,onDelete:c}){let[l,u]=(0,K.useState)(null);return(0,X.jsx)(F5,{open:n,onOpenChange:r,children:(0,X.jsxs)(L5,{children:[(0,X.jsx)(z5,{children:(0,X.jsx)(B5,{children:`Styles`})}),(0,X.jsx)(`ul`,{className:`space-y-1`,"aria-label":`Saved styles`,children:e.map(e=>(0,X.jsxs)(`li`,{className:`flex items-center justify-between gap-sm`,children:[(0,X.jsx)(`span`,{className:`min-w-0 truncate`,children:e.name}),(0,X.jsxs)(`span`,{className:`flex gap-xs`,children:[(0,X.jsx)(OI,{size:`xs`,variant:t===e.name?`primary`:`ghost`,type:`button`,"aria-pressed":t===e.name,onClick:()=>{o(e.name),r(!1)},children:`Use`}),e.builtIn?null:(0,X.jsx)(OI,{size:`xs`,variant:`ghost`,type:`button`,onClick:()=>{u(e)},children:`Edit`}),(0,X.jsx)(OI,{size:`xs`,variant:`ghost`,type:`button`,onClick:()=>{u({name:`${e.name} copy`.slice(0,64),text:e.text})},children:`Duplicate`}),e.builtIn?null:(0,X.jsx)(OI,{size:`xs`,variant:`ghost`,type:`button`,disabled:i,onClick:()=>{c(e,()=>{t===e.name&&o(void 0),l?.id===e.id&&u(null)})},children:`Delete`})]})]},e.id))}),l===null?(0,X.jsx)(OI,{size:`xs`,type:`button`,onClick:()=>{u({name:``,text:``})},children:`New style`}):(0,X.jsxs)(`div`,{className:`space-y-1`,children:[(0,X.jsx)(A4,{"aria-label":`Style name`,maxLength:64,value:l.name,onChange:e=>{u({...l,name:e.currentTarget.value})}}),(0,X.jsx)(e7,{"aria-label":`Style text`,maxLength:8e3,rows:6,value:l.text,onChange:e=>{u({...l,text:e.currentTarget.value})}}),(0,X.jsxs)(`div`,{className:`flex gap-xs`,children:[(0,X.jsx)(OI,{size:`xs`,variant:`primary`,type:`button`,disabled:i||l.name.trim()===``||l.text.trim()===``,onClick:()=>{let n=e.find(e=>e.id===l.id);s({id:l.id,name:l.name.trim(),text:l.text},e=>{n&&t===n.name&&e&&o(e.name),u(null)})},children:`Save style`}),(0,X.jsx)(OI,{size:`xs`,variant:`ghost`,type:`button`,onClick:()=>{u(null)},children:`Cancel`})]})]}),a?(0,X.jsx)(`p`,{role:`alert`,className:`text-xs`,children:a}):null,(0,X.jsx)(R5,{children:(0,X.jsx)(V5,{render:(0,X.jsx)(OI,{variant:`outline`,size:`sm`}),children:`Close`})})]})})}var Dde=[`a mushroom knight`,`moss on a keyboard`,`your Agent's selfie`];function Ode(e){J4.error(e,{id:`prints-generation-error`,toasterId:`prints-generation-notices`})}function kde(e){let t=(0,K.useRef)(!1),n=VQ({defaultValues:vL(),onSubmit:async({value:n})=>{t.current=await e.current(n)}}),r=(0,K.useCallback)(async()=>(t.current=!1,await n.handleSubmit(),t.current),[n]);return Object.assign(n,{submitCurrent:r})}function Ade({form:e,selected:t,stylePicker:n,sizeChoices:r,sizeMode:i,onCustomSize:a,onEditStyles:o,onEditCharacters:s}){let c=t?.input.dimensions===`none`,l=t!==void 0&&t.sizes!==null,u=t?.video??null;return(0,X.jsxs)(`div`,{className:`prints-settings`,children:[(0,X.jsx)(D3,{label:`Style`,orientation:`horizontal`,children:n}),(0,X.jsx)(D3,{label:`Size`,orientation:`horizontal`,children:(0,X.jsx)(N3,{"aria-label":`Generation size`,"data-generation-size":!0,className:`select-sm`,disabled:c,title:c?`This model chooses the output size.`:void 0,onChange:t=>{let n=t.currentTarget.value;a(n===`custom`);let i=r.find(e=>e.value===n);i&&(e.setFieldValue(`width`,i.width),e.setFieldValue(`height`,i.height))},value:c?`provider`:i,children:c?(0,X.jsx)(`option`,{value:`provider`,children:`Model default`}):(0,X.jsxs)(X.Fragment,{children:[l&&!r.some(e=>e.value===i)?(0,X.jsx)(`option`,{value:i,disabled:!0,children:`Choose a supported resolution`}):null,r.map(e=>(0,X.jsx)(`option`,{value:e.value,children:e.label},e.value)),l?null:(0,X.jsx)(`option`,{value:`custom`,children:`Custom size`})]})})}),!c&&!l&&i===`custom`?(0,X.jsxs)(`div`,{className:`prints-custom-size`,children:[(0,X.jsx)(e.Field,{name:`width`,children:e=>(0,X.jsx)(D3,{label:`Width`,children:(0,X.jsx)(A4,{"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,X.jsx)(e.Field,{name:`height`,children:e=>(0,X.jsx)(D3,{label:`Height`,children:(0,X.jsx)(A4,{"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,u?(0,X.jsx)(e.Field,{name:`durationSeconds`,children:e=>(0,X.jsx)(D3,{label:`Length`,orientation:`horizontal`,children:(0,X.jsx)(N3,{"aria-label":`Video length in seconds`,className:`select-sm`,"data-generation-duration":!0,onChange:t=>{let n=t.currentTarget.value;e.handleChange(u.durations.find(e=>String(e)===n))},value:e.state.value===void 0?``:String(e.state.value),children:u.durations.map(e=>(0,X.jsxs)(`option`,{value:String(e),children:[e,` seconds`]},e))})})}):null,u?.supportsAudio?(0,X.jsx)(e.Field,{name:`generateAudio`,children:e=>u.defaultGenerateAudio===null?(0,X.jsx)(D3,{label:`Audio`,orientation:`horizontal`,children:(0,X.jsxs)(N3,{"aria-label":`Video audio`,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,X.jsx)(`option`,{value:``,children:`Model default`}),(0,X.jsx)(`option`,{value:`on`,children:`On`}),(0,X.jsx)(`option`,{value:`off`,children:`Off`})]})}):(0,X.jsx)(D3,{label:`Audio`,orientation:`horizontal`,children:(0,X.jsx)(F3,{"aria-label":`Video audio`,checked:e.state.value??!0,"data-generation-audio":!0,onCheckedChange:e.handleChange})})}):null,t&&t.input.steps!==`fixed`?(0,X.jsx)(e.Field,{name:`steps`,children:e=>(0,X.jsx)(D3,{label:`Steps`,optional:!0,orientation:`horizontal`,children:(0,X.jsx)(A4,{"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,X.jsxs)(`div`,{className:`prints-settings-library`,children:[(0,X.jsx)(OI,{size:`xs`,variant:`ghost`,type:`button`,onClick:()=>{o()},children:`Edit styles…`}),(0,X.jsx)(OI,{size:`xs`,variant:`ghost`,type:`button`,onClick:()=>{s()},children:`Characters…`})]})]})}function jde({actions:e,guidance:t,commandApp:n,form:r,models:i,modelsLoading:a,mediaCapability:o,submitting:s,values:c,computerId:l,mediaDirectory:u,referenceImages:d,characters:f,characterDialog:p,onSubmit:m,styleControls:h,addedLength:g}){let _=ML(i,c.model),v=c.prompt.trim().length,y=_!==void 0&&v>0&&v+g>_.maxPromptLength,b=IL(_),x=_?.video??null,S=LL(c.references,_),C=_===void 0?void 0:RL(S,_,x?.formats.find(e=>e.width===c.width&&e.height===c.height)?.resolution),w=_?.input.maxReferences??0,T=c.references.length>w,[E,D]=(0,K.useState)(!1),[O,k]=(0,K.useState)(!1),A=_!==void 0&&_.sizes!==null,j=kL(_),M=A?`${String(c.width)}x${String(c.height)}`:E?`custom`:j.find(e=>e.width===c.width&&e.height===c.height)?.value??`custom`,[N,P]=(0,K.useState)(!1),F=xde({clear:()=>{r.setFieldValue(`prompt`,``)},useSize:e=>{D(!1),r.setFieldValue(`width`,mL[e].width),r.setFieldValue(`height`,mL[e].height),r.setFieldValue(`prompt`,``)},openStyles:()=>{r.setFieldValue(`prompt`,``),P(!0)},clearStyle:()=>{r.setFieldValue(`style`,void 0),r.setFieldValue(`prompt`,``)}},n),[I,L]=(0,K.useState)(!1),R=dde(f,c.prompt),z=lde(F.items,c.prompt),ee=(0,K.useId)(),B=`${ee}-commands`,V=`${ee}-characters`,te=lM({computerId:l,prompt:c.prompt,saved:f,references:c.references,model:_===void 0?void 0:{label:_.label,maxReferences:_.input.maxReferences}}),ne=aM(c.prompt,f).characters,H=e=>{let t=z.slashMatches.at(e);t&&(z.resetSlash(),F.run(t.command))},U=h({open:N,onOpenChange:P}),re=[c.style,OL(_,c.width,c.height),x&&c.durationSeconds!==void 0?`${String(c.durationSeconds)}s`:void 0,x?.supportsAudio&&c.generateAudio===!1?`silent`:void 0].filter(e=>e!=null),ie=(0,X.jsx)(Ade,{form:r,selected:_,stylePicker:U.picker,sizeChoices:j,sizeMode:M,onCustomSize:D,onEditStyles:()=>{k(!1),P(!0)},onEditCharacters:()=>{k(!1),L(!0)}});return(0,X.jsxs)(Dse,{"aria-label":`Image generation`,"data-generation-form":!0,attachments:c.references.length>0?(0,X.jsx)(`div`,{className:`prints-reference-tray`,"aria-label":`Image references`,children:c.references.map((e,t)=>{let n=l!==null&&fL(e,l)?d.find(t=>t.path===e.path):void 0,i=S[t]?.role,a=FL(b,S,t);return(0,X.jsxs)(`div`,{className:`prints-reference-tile`,title:e.computerId===void 0?e.path:`${e.computerId}:${e.path}`,children:[(0,X.jsx)(`div`,{className:`prints-reference-face mask mask-squircle`,children:n?(0,X.jsx)(`img`,{src:n.url,alt:e.path.split(`/`).at(-1)}):(0,X.jsxs)(`span`,{children:[`Ref `,t+1]})}),i===void 0?null:a===void 0?(0,X.jsx)(`span`,{className:`prints-reference-role`,"data-reference-role":i,children:PL[i]}):(0,X.jsx)(OI,{size:`xs`,variant:`ghost`,type:`button`,className:`prints-reference-role`,"data-reference-role":i,"aria-label":`Reference ${String(t+1)}: ${PL[i]}. Use as ${PL[a]}`,title:`Use as ${PL[a]}`,onClick:()=>{r.setFieldValue(`references`,S.map((e,n)=>n===t?{...e,role:a}:e))},children:PL[i]}),(0,X.jsx)(AI,{icon:(0,X.jsx)(dL,{}),className:`prints-reference-remove`,"aria-label":`Remove reference ${String(t+1)}`,onClick:()=>{r.setFieldValue(`references`,c.references.filter((e,n)=>n!==t))}})]},JSON.stringify([e.computerId??l,e.path]))})}):void 0,input:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`form`,{"aria-busy":s,onSubmit:e=>{e.preventDefault(),m()},children:(0,X.jsx)(r.Field,{name:`prompt`,children:e=>(0,X.jsxs)(`div`,{className:`prints-prompt`,children:[z.slashOpen?(0,X.jsx)(cde,{index:z.slashIndex,listId:B,matches:z.slashMatches,onHighlight:z.highlightSlash,onPick:H}):null,!z.slashOpen&&R.matches.length>0?(0,X.jsx)(ude,{images:d,index:R.index,listId:V,matches:R.matches,onHighlight:R.highlight,onPick:t=>{let n=R.complete(t);n!==null&&e.handleChange(n)}}):null,(0,X.jsx)(sde,{caretRequest:R.caretRequest,menu:z.slashOpen?{open:z.slashMatches.length>0,listId:B,selected:z.slashIndex}:{open:R.matches.length>0,listId:V,selected:R.index},mentionCount:z.slashOpen?0:R.matches.length,onCaret:R.setCaret,onMentionDismiss:R.dismiss,onMentionMove:R.move,onMentionPick:()=>{let t=R.complete(R.index);t!==null&&e.handleChange(t)},disabled:!o||a||i.length===0||s,maxLength:_?.maxPromptLength,addedLength:g,onChange:t=>{e.handleChange(t)},onSend:m,onSlashMove:z.moveSlash,onSlashPick:()=>{H(z.slashIndex)},placeholder:`What are we making?`,slashCount:z.slashMatches.length,value:e.state.value}),c.references.length>0||C!==void 0||ne.length>0?(0,X.jsxs)(`div`,{className:`prints-composer-notes`,children:[c.references.length>0?(0,X.jsxs)(`span`,{className:`prints-reference-count`,"data-generation-references":!0,"data-over-limit":T?``:void 0,role:T?`alert`:void 0,children:[c.references.length,` / `,w,` `,`references`,T?w===0?` — this model takes none; remove them or pick another model`:` — over this model's limit; remove some to generate`:null]}):null,C===void 0?null:(0,X.jsx)(`span`,{className:`prints-reference-count`,"data-generation-reference-roles":!0,"data-over-limit":``,role:`alert`,children:C}),ne.length>0?(0,X.jsx)(`span`,{className:`prints-reference-count`,"data-generation-characters":!0,"data-over-limit":te.kind===`refused`?``:void 0,role:te.kind===`refused`?`alert`:void 0,children:te.kind===`refused`?te.message:`Characters: ${ne.map(e=>e.name).join(`, `)}`}):null]}):null]})})}),t?(0,X.jsxs)(`div`,{className:`prints-composer-guidance`,role:`status`,"data-composer-guidance":!0,children:[(0,X.jsx)(`span`,{children:t.group===`Images`&&t.detail?t.detail:(0,X.jsxs)(X.Fragment,{children:[t.title,`. `,t.detail]})}),t.actions?.map(e=>(0,X.jsx)(OI,{variant:`ghost`,size:`xs`,onClick:e.run,children:e.label},e.label))]}):null]}),row:{controls:(0,X.jsxs)(X.Fragment,{children:[e,(0,X.jsx)(r.Field,{name:`model`,children:e=>(0,X.jsx)(Xce,{models:i,emptyLabel:l===null?`Choose a Computer`:a?`Loading models…`:`Models unavailable`,disabled:a||!o,onChange:t=>{let n=ML(i,t);if(e.handleChange(t),!n)return;let a=r.store.state.fieldMeta,o=NL(c,n),s=AL(c,n,_);(n.input.dimensions===`none`||n.sizes!==null)&&D(!1),r.setFieldValue(`width`,s.width),r.setFieldValue(`height`,s.height),r.setFieldValue(`durationSeconds`,o.durationSeconds),r.setFieldValue(`generateAudio`,o.generateAudio),(n.input.steps===`fixed`||!a.steps?.isTouched)&&r.setFieldValue(`steps`,o.steps)},value:e.state.value})}),l&&u?(0,X.jsxs)(`span`,{className:`sr-only`,"data-generation-computer":!0,title:`Saved to ${l}:${u}`,children:[`Saves to `,u]}):null]}),action:(0,X.jsx)(ode,{busy:s,draft:c.prompt,disabled:!o||a||i.length===0||s,label:xL(_),onGenerate:()=>{m()},promptOver:y}),items:[{id:`settings`,accessibleLabel:`Generation settings`,title:`Settings`,label:(0,X.jsxs)(`span`,{className:`prints-settings-chip`,children:[(0,X.jsx)(cL,{"aria-hidden":`true`,className:`size-[var(--stipe-icon-size-sm)]`}),re.length>0?re.join(` · `):`Settings`]}),content:ie}],openId:O?`settings`:null,onOpenChange:e=>{k(e===`settings`)}},children:[U.dialog,p({open:I,onOpenChange:L})]})}function Mde({connection:e}){let t=(0,K.useRef)(e);t.current=e;let n=Zce(e?.app??null),[r,i]=(0,K.useState)(!1),[a,o]=(0,K.useState)(),s=xue(e?.app??null,n.computerId),[c,l]=(0,K.useState)(null);(0,K.useEffect)(()=>{l(null)},[e,n.computerId]);let u=n.path,{gallery:d,images:f,failed:p,loading:m,gallerySlots:h,canBrowse:g,canRead:_,canWrite:v,reserveSlot:y,failSlot:b,clearSlotError:x,removeSlot:S,openComputerFile:C,uploads:w,uploadFiles:T}=JX(e,n),[E,D]=(0,K.useState)(Date.now),O=h.some(e=>e.startedAt!==void 0&&!e.resolved&&!e.error);(0,K.useEffect)(()=>{if(!O)return;let e=setInterval(()=>{D(Date.now())},1e3);return()=>{clearInterval(e)}},[O]);let k=HA(e,(e,t,n,r)=>(d.refresh(),C(e,t,n,r))),A=d.entries.some(e=>e.path===k.target?.path);(0,K.useEffect)(()=>{k.target&&!A&&d.nextPageReady&&d.loadMore()},[k.target,A,d.nextPageReady,d.loadMore]);let j=f.find(e=>e.source.kind===`computer`&&e.source.computerId===k.target?.computerId&&e.source.path===k.target.path),M=Sde(e?.app??null),N=fde(e?.app??null),P=sZ({connection:e,folder:n,styles:M.styles,characters:N.characters,effects:{reserve:y,failed:b,notifyFailure:Ode,saved:({result:e},t)=>{_?C(e.destination.path,`add`,t,e.destination.computerId):b(`${e.destination.computerId}:${e.destination.path}`,`Image saved, but this App cannot read its preview.`)}}}),{state:F,models:I,modelsLoading:L,modelsError:R,canGenerate:z,mediaCapability:ee,pendingGenerations:B,activeGenerations:V,recoveryError:te}=P,ne=(0,K.useRef)(I),H=(0,K.useRef)(P);H.current=P;let U=(0,K.useRef)(null),re=(0,K.useRef)(null),ie=(0,K.useRef)(0),[ae,oe]=(0,K.useState)(null),se=(0,K.useRef)(P.submit);se.current=async e=>{let t=await P.submit(e);return t&&oe(null),t};let W=kde(se),G=e=>{W.setFieldValue(`model`,e.model),W.setFieldValue(`width`,e.width),W.setFieldValue(`height`,e.height),W.setFieldValue(`steps`,e.steps),W.setFieldValue(`durationSeconds`,e.durationSeconds),W.setFieldValue(`generateAudio`,e.generateAudio),W.setFieldValue(`prompt`,e.prompt),W.setFieldValue(`references`,e.references),W.setFieldValue(`style`,e.style),W.setFieldValue(`destination`,void 0)},ce=(0,K.useRef)(W);ce.current=W;let le=jQ(W.store,e=>e.values),ue=jQ(W.store,e=>e.isSubmitting),de=e?.app;(0,K.useEffect)(()=>{if(de)return yde(de,{readDraft:()=>ce.current.store.state.values,readModels:()=>ne.current,setDraft:e=>{let t=ce.current;if(e.model!==void 0){let n=ML(ne.current,e.model);if(!n)throw Error(`Choose a model from the granted registry.`);let r=NL(t.store.state.values,n),i=ML(ne.current,t.store.state.values.model),a=AL(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:()=>ce.current.store.state.isSubmitting||H.current.isRunning()?Promise.resolve(!1):ce.current.submitCurrent()})},[de]),(0,K.useEffect)(()=>{ne.current=I},[I]),(0,K.useEffect)(()=>{if(I.length===0||R)return;let e=I.find(e=>e.id===`@cf/black-forest-labs/flux-2-klein-4b`)??I[0];if(!W.store.state.fieldMeta.model?.isTouched){let t=NL(W.store.state.values,e);W.setFieldValue(`model`,t.model),W.store.state.fieldMeta.width?.isTouched||W.setFieldValue(`width`,t.width),W.store.state.fieldMeta.height?.isTouched||W.setFieldValue(`height`,t.height),W.store.state.fieldMeta.steps?.isTouched||W.setFieldValue(`steps`,t.steps)}},[W,R,I]);let fe=ML(I,le.model),pe=le.references,me=fe?.input.maxReferences??0,he=(0,K.useRef)({openComputerFile:C,retryPath:P.retryPath,uploads:w});he.current={openComputerFile:C,retryPath:P.retryPath,uploads:w};let ge=j?j.source.kind===`computer`?`${j.source.computerId}:${j.source.path}`:j.file.name:null,_e=(0,K.useMemo)(()=>f.map(e=>({key:e.source.kind===`computer`?`${e.source.computerId}:${e.source.path}`:e.file.name,selected:(e.source.kind===`computer`?`${e.source.computerId}:${e.source.path}`:e.file.name)===ge,path:e.source.kind===`computer`?e.source.path:e.file.name,referenced:pe.some(t=>e.source.kind===`computer`&&fL(t,e.source.computerId)&&t.path===e.source.path),referenceDisabled:pe.length>=me&&!pe.some(t=>e.source.kind===`computer`&&fL(t,e.source.computerId)&&t.path===e.source.path),onToggleReference:e.source.kind===`computer`&&me>0?()=>{if(e.source.kind!==`computer`)return;let t=e.source.path,n=e.source.computerId,r=pe.some(e=>fL(e,n)&&e.path===t);W.setFieldValue(`references`,r?pe.filter(e=>!fL(e,n)||e.path!==t):[...pe,{path:t}])}:void 0,onInfo:()=>{l(e)},url:e.url,width:e.width,height:e.height,onOpen:()=>{e.source.kind===`computer`?he.current.openComputerFile(e.source.path,`open`,e.source.connection,e.source.computerId):window.open(e.url,`_blank`,`noopener,noreferrer`)}})),[f,pe,me,W,ge]),ve=(0,K.useMemo)(()=>{let e=n.computerId;if(!e)return _e;let t=new Map(_e.map(e=>[e.key,e])),r=[...d.entries].sort((e,t)=>t.modifiedAt-e.modifiedAt||e.name.localeCompare(t.name)).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:()=>{d.loadFile(n.path)},error:d.failures.includes(n.name)?`Could not load this print.`:void 0}}),i=new Set(r.map(e=>e.key));return[...r,..._e.filter(e=>!i.has(e.key)&&e.key!==ge)]},[_e,d.entries,d.loadFile,d.failures,n.computerId,ge]),ye=F.kind===`pending`,be=(0,K.useMemo)(()=>ade(ve,h,e=>{let n=w.items.find(t=>t.id===e.uploadId),r=e.error??(n?.status===`error`||n?.status===`cancelled`?n.message:void 0);return{key:e.key,path:e.path,width:e.width,height:e.height,url:``,pending:!0,error:r,pendingLabel:n?.status===`complete`||F.kind===`completed`?`Loading preview…`:e.uploadId?`Uploading image…`:e.startedAt===void 0?e.pendingLabel:SL(I.find(e=>e.kind===`video`),E-e.startedAt,e.resumed),onOpen:()=>void 0,onRetry:r&&(_||n&&n.status!==`complete`)?()=>{if(x(e.key),n&&n.status!==`complete`){he.current.uploads.retry(n.id);return}!e.uploadId&&he.current.retryPath(e.path)||t.current&&he.current.openComputerFile(e.path,`add`,t.current,e.computerId)}:void 0,onDismiss:r?()=>{S(e.key),e.uploadId&&he.current.uploads.remove(e.uploadId)}:void 0}}),[ve,h,w.items,F.kind,_,I,E]),xe=ue||ye,Se=h.some(e=>e.error!==void 0),Ce=w.items.filter(e=>e.computerId===n.computerId),we=F.kind===`error`&&R===null?{key:P.errorKey,mediaKind:F.mediaKind,message:F.message,billing:F.action===`billing`&&e?()=>{e.app.ui.openTeamBilling().catch(n=>{kX(`open-team-billing`,n),t.current===e&&P.reportRecoveryError(n)})}:void 0,retry:Se&&F.retryable!==!1?P.retry:void 0}:null,Te=bue({connected:e!==null,mediaCapability:ee,modelsError:R,retryModels:P.retryModels,modelsLoading:L,models:I,canGenerate:z,canWrite:v,generationError:we,recoveryError:te,pendingGenerations:B,activeGenerations:V,gallerySlots:h,computerId:n.computerId,failed:p,uploadError:w.error,uploads:Ce,permissions:()=>{e?.app.ui.requestAppPermissions({}).catch(e=>{P.reportRecoveryError(e)})},resume:e=>{P.resume(e)},discard:e=>{P.discard(e)},retryUpload:e=>{w.retry(e)}});s.error&&Te.push({key:`dismissal-storage`,group:`Setup`,tone:`warning`,blocking:!0,short:`Activity not saved`,title:`Activity not saved`,detail:s.error});let Ee=s.visible(Te),De={generating:V.size,uploading:Ce.filter(e=>e.status===`sending`||e.status===`queued`).length},Oe={items:Ce.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=>{w.cancel(e)},onRetry:e=>{w.retry(e)},onRemove:e=>{w.remove(e)}},ke=new Set([...d.entries.map(e=>`${n.computerId??``}:${e.path}`),...f.map(e=>e.source.kind===`computer`?`${e.source.computerId}:${e.source.path}`:e.file.name)]).size,Ae=pue(Ee,De,r);Uk(e?.app,[...n.available?[z3(n.path,{checking:n.busy&&n.path===null,editing:n.editing})]:[],...Ae===null?[]:[Ae],...g?[{kind:`text`,id:`prints`,text:`${String(ke)} ${ke===1?`print`:`prints`}`}]:[]],e=>e.itemId===`activity`?(o(e.anchor?.start),i(e=>!e),!0):e.itemId!==`folder`||!n.available?!1:(n.setEditing(!0),!0),t=>{kX(`prints.status.report`,t),e?.app.ui.showToast({message:`Prints couldn't update its status bar.`,tone:`error`}).catch(e=>{kX(`prints.status.toast`,e)})});let je=f.flatMap(e=>e.source.kind===`computer`?[{path:e.source.path,url:e.url}]:[]);return(0,X.jsxs)(`main`,{className:`h-full w-full flex flex-col overflow-hidden`,"data-app-pane":`media`,"data-generation-state":F.kind,"data-computer-capability":g?`connected`:`absent`,onPaste:e=>{let t=Array.from(e.clipboardData.files);t.length&&v&&(e.preventDefault(),T(t.map(e=>(ie.current+=1,new File([e],`paste-${String(ie.current)}-${KX(e.name)}`,{type:e.type,lastModified:e.lastModified})))))},children:[(0,X.jsx)(m3,{id:`prints-generation-notices`}),(0,X.jsxs)(`div`,{className:`prints-gallery-region`,children:[(0,X.jsx)(k4,{screen:!0,surface:!0,surfaceSize:`lg`,surfaceDepth:`deep`,ref:U,className:`flex-1 min-h-0`,"data-media-scroll":!0,"aria-busy":m||d.loading,onDragOver:e=>{e.preventDefault()},onDrop:e=>{e.preventDefault();let t=Array.from(e.dataTransfer.files);t.length&&v&&T(t)},children:(0,X.jsxs)(`div`,{className:`prints-gallery-content`,children:[be.length>0?(0,X.jsx)(ide,{items:be,scrollRef:U,focus:j&&k.target?{key:`${k.target.computerId}:${k.target.path}`,requestId:k.target.requestId,onFocus:()=>{l(j)}}:void 0}):m||d.loading?(0,X.jsx)(R3,{variant:`hint`,role:`status`,"aria-live":`polite`,title:`Loading prints…`,description:`Your library is on its way.`}):(0,X.jsx)(R3,{"aria-live":`polite`,"data-absence":!0,"data-media-empty":!0,role:`status`,variant:`panel`,visual:(0,X.jsx)(nL,{}),title:`Nothing printed yet.`,description:n.computerId===null?`Your images will appear here.`:n.available&&u===null?`Pick a folder in the composer below, then describe something or drop in images.`:`Describe something and it lands here, or drop in images from your Computer.`,...ee?{suggestions:Dde.map(e=>({label:e,onSelect:()=>{W.setFieldValue(`prompt`,e)}}))}:{}}),d.hasNextPage&&(0,X.jsx)(OI,{variant:`ghost`,disabled:d.loading,onClick:d.loadMore,children:d.loading?`Loading images…`:`Load more images`})]})}),k.error?(0,X.jsx)(`p`,{role:`alert`,children:`Could not open this print. It may no longer be available on this Computer.`}):null,c&&(c.source.kind===`local`||c.source.connection===e&&c.source.computerId===n.computerId)?(0,X.jsx)(BX,{image:c,app:e?.app??null,referenceImages:je,models:I,canAnimate:Q9(I)!==void 0,onIterate:(e,t)=>{if(c.source.kind!==`computer`)return null;let n=wde(e,{lineage:t,printComputerId:c.source.computerId,printPath:c.source.path,models:I,styles:M.styles.map(e=>e.name),current:W.store.state.values});return n.kind===`refused`?n.message:(G(n.draft),oe(n.notice===null?null:{model:n.draft.model,message:n.notice}),l(null),null)},onClose:()=>{l(null)}},c.url):null]}),(0,X.jsxs)(`div`,{className:`prints-composer-dock`,children:[(0,X.jsx)(`section`,{"aria-label":`Computer uploads`,className:`prints-uploads`,children:(0,X.jsx)(`input`,{ref:re,type:`file`,disabled:!v||u===null,accept:`image/*`,multiple:!0,hidden:!0,"aria-label":`Choose images to upload`,onChange:e=>{T(Array.from(e.currentTarget.files??[])),e.currentTarget.value=``}})}),(0,X.jsx)(jde,{addedLength:oM(le.prompt,M.styles.find(e=>e.name===le.style)?.text,N.characters),styleControls:e=>({picker:(0,X.jsx)(Tde,{styles:M.styles,selected:le.style,disabled:!ee||L||xe,onSelect:e=>{W.setFieldValue(`style`,e)}}),dialog:(0,X.jsx)(Ede,{open:e.open,onOpenChange:e.onOpenChange,styles:M.styles,selected:le.style,busy:M.busy,error:M.error,onSelect:e=>{W.setFieldValue(`style`,e)},onSave:M.save,onDelete:(e,t)=>{M.remove(e.id,t)}})}),characters:N.characters,characterDialog:e=>(0,X.jsx)(mde,{open:e.open,onOpenChange:e.onOpenChange,characters:N.characters,images:je,busy:N.busy,error:N.error,canUpload:v&&u!==null,onUpload:()=>re.current?.click(),onSave:N.save,onDelete:(e,t)=>{N.remove(e.id,t)}}),guidance:Ee.find(e=>e.blocking&&e.group===`Setup`)??(ae!==null&&ae.model===le.model?{key:`iteration-model`,group:`Images`,tone:`warning`,short:`Model changed`,title:`Model changed`,detail:ae.message,actions:[{label:`Dismiss`,run:()=>{oe(null)}}]}:void 0),commandApp:de,actions:(0,X.jsx)(XN,{"aria-label":`Upload images`,title:v?`Upload images to Computer`:`Connect a writable Computer to upload`,icon:(0,X.jsx)(uL,{}),label:null,className:`prints-upload-key`,disabled:!v||u===null,onClick:()=>re.current?.click()}),form:W,mediaCapability:ee&&z&&v&&u!==null,models:I,modelsLoading:L,onSubmit:W.submitCurrent,submitting:xe,values:le,computerId:n.computerId,mediaDirectory:u,referenceImages:je}),Ae===null?null:(0,X.jsx)(hue,{notices:Ee,uploads:Oe,open:r,inset:a,onOpenChange:i,onDismiss:s.dismiss,onDismissAll:()=>{s.dismissAll(Te)},onLoadMore:P.hasMore?P.loadMore:void 0})]}),(0,X.jsx)(_ue,{folder:n})]})}var $9=document.getElementById(`media-root`);if(!$9)throw Error(`Media root is missing`);Rk($9,{name:`Prints`,queryClient:hA()},({app:e})=>(0,K.createElement)(Mde,{connection:e?{app:e}:null}));
|